!function(){"use strict";var e,t;!function(e){e.Development="dev",e.Production="prod"}(e||(e={})),function(e){e.Event="event",e.Context="context",e.Init="init"}(t||(t={}));var n,r={};var i=function(){if(n)return r;n=1,r.parse=function(e,n){if("string"!=typeof e)throw new TypeError("argument str must be a string");var r={},i=e.length;if(i<2)return r;var o=n&&n.decode||l,s=0,u=0,f=0;do{if(-1===(u=e.indexOf("=",s)))break;if(-1===(f=e.indexOf(";",s)))f=i;else if(u>f){s=e.lastIndexOf(";",u-1)+1;continue}var p=a(e,s,u),h=c(e,u,p),v=e.slice(p,h);if(!t.call(r,v)){var g=a(e,u+1,f),y=c(e,f,g);34===e.charCodeAt(g)&&34===e.charCodeAt(y-1)&&(g++,y--);var m=e.slice(g,y);r[v]=d(m,o)}s=f+1}while(s<i);return r},r.serialize=function(t,n,r){var a=r&&r.encode||encodeURIComponent;if("function"!=typeof a)throw new TypeError("option encode is invalid");if(!i.test(t))throw new TypeError("argument name is invalid");var c=a(n);if(!o.test(c))throw new TypeError("argument val is invalid");var l=t+"="+c;if(!r)return l;if(null!=r.maxAge){var d=Math.floor(r.maxAge);if(!isFinite(d))throw new TypeError("option maxAge is invalid");l+="; Max-Age="+d}if(r.domain){if(!s.test(r.domain))throw new TypeError("option domain is invalid");l+="; Domain="+r.domain}if(r.path){if(!u.test(r.path))throw new TypeError("option path is invalid");l+="; Path="+r.path}if(r.expires){var f=r.expires;if(!function(t){return"[object Date]"===e.call(t)}(f)||isNaN(f.valueOf()))throw new TypeError("option expires is invalid");l+="; Expires="+f.toUTCString()}r.httpOnly&&(l+="; HttpOnly");r.secure&&(l+="; Secure");r.partitioned&&(l+="; Partitioned");if(r.priority){switch("string"==typeof r.priority?r.priority.toLowerCase():r.priority){case"low":l+="; Priority=Low";break;case"medium":l+="; Priority=Medium";break;case"high":l+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return l};var e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,i=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,o=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,s=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,u=/^[\u0020-\u003A\u003D-\u007E]*$/;function a(e,t,n){do{var r=e.charCodeAt(t);if(32!==r&&9!==r)return t}while(++t<n);return n}function c(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(32!==r&&9!==r)return t+1}return n}function l(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function d(e,t){try{return t(e)}catch(t){return e}}return r}();function o(e,t={}){const n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(!t.doNotParse)try{return JSON.parse(n)}catch(e){}return e}class s{constructor(e,t={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const e=this.cookies;this.cookies=i.parse(document.cookie),this._checkChanges(e)};const n="undefined"==typeof document?"":document.cookie;this.cookies=function(e){return"string"==typeof e?i.parse(e):"object"==typeof e&&null!==e?e:{}}(e||n),this.defaultSetOptions=t,this.HAS_DOCUMENT_COOKIE=function(){const e="undefined"==typeof global?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return"boolean"==typeof e?e:"object"==typeof document&&"string"==typeof document.cookie}()}_emitChange(e){for(let t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)}_checkChanges(e){new Set(Object.keys(e).concat(Object.keys(this.cookies))).forEach((t=>{e[t]!==this.cookies[t]&&this._emitChange({name:t,value:o(this.cookies[t])})}))}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(e,t={}){return t.doNotUpdate||this.update(),o(this.cookies[e],t)}getAll(e={}){e.doNotUpdate||this.update();const t={};for(let n in this.cookies)t[n]=o(this.cookies[n],e);return t}set(e,t,n){n=n?Object.assign(Object.assign({},this.defaultSetOptions),n):this.defaultSetOptions;const r="string"==typeof t?t:JSON.stringify(t);this.cookies=Object.assign(Object.assign({},this.cookies),{[e]:r}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=i.serialize(e,r,n)),this._emitChange({name:e,value:t,options:n})}remove(e,t){const n=t=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=i.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})}addChangeListener(e){this.changeListeners.push(e),this.HAS_DOCUMENT_COOKIE&&1===this.changeListeners.length&&("object"==typeof window&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(e){const t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1),this.HAS_DOCUMENT_COOKIE&&0===this.changeListeners.length&&("object"==typeof window&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}}const u=[];for(let e=0;e<256;++e)u.push((e+256).toString(16).slice(1));let a;const c=new Uint8Array(16);function l(){if(!a){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");a=crypto.getRandomValues.bind(crypto)}return a(c)}var d={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function f(e,t,n){if(d.randomUUID&&!t&&!e)return d.randomUUID();const r=(e=e||{}).random||(e.rng||l)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase()}(r)}const p=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1},h=(...e)=>e.reduce(((e,t)=>{if(Array.isArray(t))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(t).forEach((n=>{["__proto__","constructor","prototype"].includes(n)||(Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=h.options.mergeArrays?h.options.uniqueArrayItems?Array.from(new Set(e[n].concat(t[n]))):[...e[n],...t[n]]:t[n]:p(e[n])&&p(t[n])?e[n]=h(e[n],t[n]):e[n]=void 0===t[n]?h.options.allowUndefinedOverrides?t[n]:e[n]:t[n])})),e}),{}),v={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};h.options=v,h.withOptions=(e,...t)=>{h.options=Object.assign(Object.assign({},v),e);const n=h(...t);return h.options=v,n};var g=function(e,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},g(e,t)};function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var m=function(){return m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},m.apply(this,arguments)};function b(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function w(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))}function _(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function E(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function I(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function k(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||u(e,t)}))},t&&(r[e]=t(r[e])))}function u(e,t){try{(n=i[e](t)).value instanceof O?Promise.resolve(n.value.v).then(a,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function a(e){u("next",e)}function c(e){u("throw",e)}function l(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=E(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError;var P,x,A,C,N,R;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(P||(P={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(x||(x={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(A||(A={})),function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(C||(C={})),function(e){e.US="US",e.EU="EU"}(N||(N={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(R||(R={}));var L=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],D=["div","span","h1","h2","h3","h4","h5","h6"],j=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=R.Unknown),{event:e,code:t,message:n}},U=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,U)},q=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return w(this,void 0,void 0,(function(){return _(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(t.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=U(),t.loggerProvider.warn("Plugin name is undefined. \n      Generating a random UUID for plugin name: ".concat(e.name,". \n      Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return w(this,void 0,void 0,(function(){var n,r;return _(this,(function(i){switch(i.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),r=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=r.teardown)||void 0===t?void 0:t.call(r)];case 1:return i.sent(),[2]}}))}))},e.prototype.reset=function(e){this.applying=!1,this.plugins.map((function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)})),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return w(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,a,c,l,d,f,p,h,v,g,y,b,w,I;return _(this,(function(_){switch(_.label){case 0:if(!e)return[2];t=S(e,1),n=t[0],r=S(e,2),i=r[1],o=this.plugins.filter((function(e){return"before"===e.type})),_.label=1;case 1:_.trys.push([1,6,7,8]),s=E(o),u=s.next(),_.label=2;case 2:return u.done?[3,5]:(f=u.value).execute?[4,f.execute(m({},n))]:[3,4];case 3:if(null===(p=_.sent()))return i({event:n,code:0,message:""}),[2];n=p,_.label=4;case 4:return u=s.next(),[3,2];case 5:return[3,8];case 6:return a=_.sent(),y={error:a},[3,8];case 7:try{u&&!u.done&&(b=s.return)&&b.call(s)}finally{if(y)throw y.error}return[7];case 8:c=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),_.label=9;case 9:_.trys.push([9,14,15,16]),l=E(c),d=l.next(),_.label=10;case 10:return d.done?[3,13]:(f=d.value).execute?[4,f.execute(m({},n))]:[3,12];case 11:if(null===(p=_.sent()))return i({event:n,code:0,message:""}),[2];n=p,_.label=12;case 12:return d=l.next(),[3,10];case 13:return[3,16];case 14:return h=_.sent(),w={error:h},[3,16];case 15:try{d&&!d.done&&(I=l.return)&&I.call(l)}finally{if(w)throw w.error}return[7];case 16:return v=this.plugins.filter((function(e){return"destination"===e.type})),g=v.map((function(e){var t=m({},n);return e.execute(t).catch((function(e){return j(t,0,String(e))}))})),Promise.all(g).then((function(e){var t=S(e,1)[0]||j(n,100,"Event not tracked, no destination plugins on the instance");i(t)})),[2]}}))}))},e.prototype.flush=function(){return w(this,void 0,void 0,(function(){var e,t,n,r=this;return _(this,(function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return r.apply(e)})))];case 1:return i.sent(),t=this.plugins.filter((function(e){return"destination"===e.type})),n=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(n)];case 2:return i.sent(),[2]}}))}))},e}(),M="AMP",F="".concat(M,"_unsent"),z="https://api2.amplitude.com/2/httpapi",K=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!V(t,n))return!1}return!0},V=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=E(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)i=i&&K(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return K(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},$=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return m({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(P.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(P.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(P.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(P.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(P.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(P.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(P.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(P.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(P.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[P.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[P.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===P.ADD?"number"==typeof n:e===P.UNSET||e===P.REMOVE||V(t,n)))},e}(),B=function(e,t){return m(m({},t),{event_type:A.IDENTIFY,user_properties:e.getUserProperties()})},H=function(e){return{promise:e||Promise.resolve()}},W=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new q(this),this.name=e}return e.prototype._init=function(e){return w(this,void 0,void 0,(function(){return _(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return w(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,a;return _(this,(function(c){switch(c.label){case 0:t=this[e],this[e]=[],c.label=1;case 1:c.trys.push([1,8,9,10]),n=E(t),r=n.next(),c.label=2;case 2:return r.done?[3,7]:(i=r.value,(o=i())&&"promise"in o?[4,o.promise]:[3,4]);case 3:return c.sent(),[3,6];case 4:return[4,o];case 5:c.sent(),c.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return s=c.sent(),u={error:s},[3,10];case 9:try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:c.sent(),c.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return m(m(m({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return H(this.dispatch(r))},e.prototype.identify=function(e,t){var n=B(e,t);return H(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=function(e,t,n,r){var i;return m(m({},r),{event_type:A.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n,r);return H(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,i=new $;return i.set(e,t),m(m({},n),{event_type:A.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return H(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return m(m({},t),{event_type:A.REVENUE,event_properties:e.getEventProperties()})}(e,t);return H(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),H())},e.prototype._addPlugin=function(e){return H(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),H())},e.prototype._removePlugin=function(e){return H(this.timeline.deregister(e))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(j(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return w(this,void 0,void 0,(function(){var t=this;return _(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return w(this,void 0,void 0,(function(){var t,n,r;return _(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,j(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(r=i.sent()).code?this.config.loggerProvider.log(r.message):100===r.code?this.config.loggerProvider.warn(r.message):this.config.loggerProvider.error(r.message),[2,r];case 2:return t=i.sent(),n=String(t),this.config.loggerProvider.error(n),[2,r=j(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut=Boolean(e)},e.prototype.flush=function(){return H(this.timeline.flush())},e}(),J=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return K(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?m({},this.properties):{};return e[x.REVENUE_PRODUCT_ID]=this.productId,e[x.REVENUE_QUANTITY]=this.quantity,e[x.REVENUE_PRICE]=this.price,e[x.REVENUE_TYPE]=this.revenueType,e[x.REVENUE]=this.revenue,e},e}(),Q="Amplitude Logger ",Y=function(){function e(){this.logLevel=C.None}return e.prototype.disable=function(){this.logLevel=C.None},e.prototype.enable=function(e){void 0===e&&(e=C.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Verbose||console.log("".concat(Q,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Warn||console.warn("".concat(Q,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Error||console.error("".concat(Q,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Debug||console.log("".concat(Q,"[Debug]: ").concat(e.join(" ")))},e}(),G=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:C.Warn,loggerProvider:new Y,offline:!1,optOut:!1,serverUrl:z,serverZone:"US",useBatch:!1}},Z=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=G();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=ee(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),X=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":z},ee=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=G().serverZone),void 0===n&&(n=G().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:G().serverZone;return{serverZone:r,serverUrl:X(r,n)}},te=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function ne(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var re=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return w(this,void 0,void 0,(function(){var n,r=this;return _(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(F,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map((function(e){return r.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=U()),new Promise((function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(r)}))},e.prototype.getTryableList=function(e){var t=this;return e.filter((function(e){return e.attempts<t.config.flushMaxRetries?(e.attempts+=1,!0):(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)}))},e.prototype.scheduleTryable=function(e,t){var n=this;void 0===t&&(t=!1),e.forEach((function(e){t&&(n.queue=n.queue.concat(e)),0!==e.timeout?setTimeout((function(){e.timeout=0,n.schedule(0)}),e.timeout):n.schedule(n.config.flushIntervalMillis)}))},e.prototype.addToQueue=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.getTryableList(e);this.scheduleTryable(n,!0),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),w(this,void 0,void 0,(function(){var t,n,r,i=this;return _(this,(function(o){switch(o.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),r=s.reduce((function(e,t,n){var r=Math.floor(n/a);return e[r]||(e[r]=[]),e[r].push(t),e}),[]),[4,Promise.all(r.map((function(t){return i.send(t,e)})))]);case 1:return o.sent(),this.scheduleTryable(n),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),w(this,void 0,void 0,(function(){var n,r,i,o,s;return _(this,(function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,b(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new te,u.label=1;case 1:return u.trys.push([1,3,,4]),r=ee(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(i=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(i,e),[3,4]):("body"in i?this.fulfillRequest(e,i.statusCode,"".concat(i.status,": ").concat(ne(i))):this.fulfillRequest(e,i.statusCode,i.status),[2]);case 3:return o=u.sent(),s=(a=o)instanceof Error?a.message:String(a),this.config.loggerProvider.error(s),this.handleResponse({status:R.Failed,statusCode:0},e),[3,4];case 4:return[2]}var a}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case R.Success:this.handleSuccessResponse(e,t);break;case R.Invalid:this.handleInvalidResponse(e,t);break;case R.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case R.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=I(I(I(I([],S(Object.values(e.body.eventsWithInvalidFields)),!1),S(Object.values(e.body.eventsWithMissingFields)),!1),S(Object.values(e.body.eventsWithInvalidIdLengths)),!1),S(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter((function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(ne(e));var s=this.getTryableList(o);this.scheduleTryable(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(ne(e)),this.config.flushQueueSize/=2;var n=this.getTryableList(t);this.scheduleTryable(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),u=new Set(i),a=new Set(o),c=t.filter((function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(ne(e));var l=this.getTryableList(c);this.scheduleTryable(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),r=this.getTryableList(n);this.scheduleTryable(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(j(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),ie=function(e){return function(){var t=m({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},oe=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=E(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},se=function(e,t){return function(){var n,r,i={};try{for(var o=E(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=oe(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},ue=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<C.Debug||!c||!a)return e.apply(i,o);var l,d={type:"invoke public method",name:t,args:o,stacktrace:(l=1,((new Error).stack||"").split("\n").slice(2+l).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};r&&d.states&&(d.states.before=r());var f=e.apply(i,o);return f&&f.promise?f.promise.then((function(){r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=(new Date).toISOString()),a.debug(JSON.stringify(d,null,2))})):(r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=(new Date).toISOString()),a.debug(JSON.stringify(d,null,2))),f}},ae=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return w(this,void 0,void 0,(function(){return _(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return w(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return w(this,void 0,void 0,(function(){var t;return _(this,(function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return w(this,void 0,void 0,(function(){return _(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return w(this,void 0,void 0,(function(){return _(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return w(this,void 0,void 0,(function(){return _(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),ce=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,u,a,c,l,d,f,p,h,v,g,y,m,b,w,_,E;if("object"!=typeof e)return null;var S=e.code||0,I=this.buildStatus(S);switch(I){case R.Success:return{status:I,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case R.Invalid:return{status:I,statusCode:S,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case R.PayloadTooLarge:return{status:I,statusCode:S,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case R.RateLimit:return{status:I,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(_=e.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case R.Timeout:default:return{status:I,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?R.Success:429===e?R.RateLimit:413===e?R.PayloadTooLarge:408===e?R.Timeout:e>=400&&e<500?R.Invalid:e>=500?R.Failed:R.Unknown},e}(),le=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},de=function(){var e,t=le();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=fe(n[0]),i=fe(n[1]);return i?(e[r]=i,e):e}),{}):{}},fe=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},pe="dclid",he="fbclid",ve="gbraid",ge="gclid",ye="ko_click_id",me="li_fat_id",be="msclkid",we="rtd_cid",_e="ttclid",Ee="twclid",Se="wbraid",Ie={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},Oe=function(){function e(){}return e.prototype.parse=function(){return w(this,void 0,void 0,(function(){return _(this,(function(e){return[2,m(m(m(m({},Ie),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=de();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=de();return(e={})[pe]=t[pe],e[he]=t[he],e[ve]=t[ve],e[ge]=t[ge],e[ye]=t[ye],e[me]=t[me],e[be]=t[be],e[we]=t[we],e[_e]=t[_e],e[Ee]=t[Ee],e[Se]=t[Se],e},e}(),ke=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[M,t,e.substring(0,n)].filter(Boolean).join("_")},Te=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Pe=function(e,t,n,r){void 0===r&&(r=!0),e.referrer;var i=e.referring_domain,o=b(e,["referrer","referring_domain"]),s=t||{};s.referrer;var u=s.referring_domain,a=b(s,["referrer","referring_domain"]);if(xe(n.excludeReferrers,e.referring_domain))return!1;if(!r&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return!1;var c=JSON.stringify(o)!==JSON.stringify(a),l=Te(i||"")!==Te(u||"");return!t||c||l},xe=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))},Ae=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Ce=function(){function e(e,t){var n,r,i,o,s;this.shouldTrackNewCampaign=!1,this.options=m({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(o=t.apiKey,void 0===s&&(s=10),[M,"MKTG",o.substring(0,s)].filter(Boolean).join("_")),this.currentCampaign=Ie,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return w(this,void 0,void 0,(function(){var e,t;return _(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=S.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Ae(this.sessionTimeout,this.lastEventTime),Pe(this.currentCampaign,this.previousCampaign,this.options,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},e.prototype.fetchCampaign=function(){return w(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new Oe).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,o=(t=this.currentCampaign,n=this.options,r=m(m({},Ie),t),i=Object.entries(r).reduce((function(e,t){var r,i=S(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)}),new $),B(i));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Ne=function(){function e(e){this.options=m({},e)}return e.prototype.isEnabled=function(){return w(this,void 0,void 0,(function(){var t,n;return _(this,(function(r){switch(r.label){case 0:if(!le())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return r.sent(),[4,t.get(n)];case 3:return[2,r.sent()===e.testValue];case 4:return r.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){var t;return w(this,void 0,void 0,(function(){var n,r;return _(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=i.sent()))return[2,void 0];try{return void 0===(r=null!==(t=Re(n))&&void 0!==t?t:Le(n))?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(r)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return w(this,void 0,void 0,(function(){var r,i,o;return _(this,(function(s){return r=le(),i=null!==(n=null===(t=null==r?void 0:r.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(o=i.find((function(t){return 0===t.indexOf(e+"=")})))?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return w(this,void 0,void 0,(function(){var r,i,o,s,u,a,c;return _(this,(function(l){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(i=null!==t?r:-1)&&((s=new Date).setTime(s.getTime()+24*i*60*60*1e3),o=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(a=le())&&(a.document.cookie=u)}catch(t){c=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}return[2]}))}))},e.prototype.remove=function(e){return w(this,void 0,void 0,(function(){return _(this,(function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}}))}))},e.prototype.reset=function(){return w(this,void 0,void 0,(function(){return _(this,(function(e){return[2]}))}))},e}(),Re=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},Le=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),t.prototype.send=function(e,t){return w(this,void 0,void 0,(function(){var n,r,i;return _(this,(function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},t}(ce),je=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Ue(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Ue=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},qe=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),Me=function(){return Me=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Me.apply(this,arguments)};function Fe(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ze(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var Ke=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=Fe(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var u=Array.isArray(e),a=Array.isArray(t);if(u!==a)return!1;if(!u||!a){var c=Object.keys(e).sort(),l=Object.keys(t).sort();if(!Ke(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){Ke(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!Ke(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var Ve=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Me({},this.identity.userProperties),n=Me(Me({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,u,a=n.userProperties||{};try{for(var c=Fe(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=ze(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var h=(i=void 0,Fe(Object.entries(p))),v=h.next();!v.done;v=h.next()){var g=ze(v.value,2),y=g[0],m=g[1];a[y]=m}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,Fe(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete a[y=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(u=b.return)&&u.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":a={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return n.userProperties=a,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return Me({},this.identity)},e.prototype.setIdentity=function(e){var t=Me({},this.identity);this.identity=Me({},e),Ke(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),$e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Be=function(){function e(){this.identityStore=new Ve,this.eventBridge=new qe,this.applicationContextProvider=new je}return e.getInstance=function(t){return $e.analyticsConnectorInstances||($e.analyticsConnectorInstances={}),$e.analyticsConnectorInstances[t]||($e.analyticsConnectorInstances[t]=new e),$e.analyticsConnectorInstances[t]},e}(),He=function(e){return void 0===e&&(e="$default_instance"),Be.getInstance(e)},We=function(){function e(){this.name="identity",this.type="before",this.identityStore=He().identityStore}return e.prototype.execute=function(e){return w(this,void 0,void 0,(function(){var t;return _(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return w(this,void 0,void 0,(function(){return _(this,(function(t){return e.instanceName&&(this.identityStore=He(e.instanceName).identityStore),[2]}))}))},e}(),Je=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},Qe=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Ye=function(e){return Qe(e,"attribution")},Ge=function(e){return Qe(e,"pageViews")},Ze=function(e){return Qe(e,"sessions")},Xe=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},et=function(e){if(Xe(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},tt=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Ge(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},nt=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.resolve,u=e&&e[i];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},rt=function(e){return e&&void 0!==e._q},it=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.11.9"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return w(this,void 0,void 0,(function(){var r,i,o;return _(this,(function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[2,m(m(m(m(m(m(m(m({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Je()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:U(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]}))}))},e}(),ot=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return w(this,void 0,void 0,(function(){var t,n,r;return _(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return w(this,void 0,void 0,(function(){var t;return _(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return w(this,void 0,void 0,(function(){return _(this,(function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return w(this,void 0,void 0,(function(){return _(this,(function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return w(this,void 0,void 0,(function(){return _(this,(function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return w(this,void 0,void 0,(function(){return _(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),st=1e3,ut=function(e){function t(t){var n,r=this;return(r=e.call(this,null===(n=le())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,r}return y(t,e),t.prototype.set=function(t,n){var r;return w(this,void 0,void 0,(function(){var i;return _(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>st?(i=n.length-st,[4,e.prototype.set.call(this,t,n.slice(0,st))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(st,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t}(ot),at=function(e){function t(){var t;return e.call(this,null===(t=le())||void 0===t?void 0:t.sessionStorage)||this}return y(t,e),t}(ot),ct=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return y(t,e),t.prototype.send=function(e,t){return w(this,void 0,void 0,(function(){var n=this;return _(this,(function(r){return[2,new Promise((function(r,i){"undefined"==typeof XMLHttpRequest&&i(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{r(n.buildResponse(JSON.parse(e)))}catch(e){r(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(ce),lt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),t.prototype.send=function(e,t){return w(this,void 0,void 0,(function(){var n=this;return _(this,(function(r){return[2,new Promise((function(r,i){var o=le();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return r(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}}))]}))}))},t}(ce),dt=function(e,t,n){return void 0===n&&(n=!0),w(void 0,void 0,void 0,(function(){var r,i,o,s,u,a,c,l,d;return _(this,(function(f){switch(f.label){case 0:return r=function(e){return"".concat(M.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=f.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:f.sent(),f.label=3;case 3:return o=S(i.split("."),6),s=o[0],u=o[1],a=o[2],c=o[3],l=o[4],d=o[5],[2,{deviceId:s,userId:pt(u),sessionId:ft(c),lastEventId:ft(d),lastEventTime:ft(l),optOut:Boolean(a)}]}}))}))},ft=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},pt=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},ht="[Amplitude]",vt="".concat(ht," Form Started"),gt="".concat(ht," Form Submitted"),yt="".concat(ht," File Downloaded"),mt="session_start",bt="session_end",wt="".concat(ht," File Extension"),_t="".concat(ht," File Name"),Et="".concat(ht," Link ID"),St="".concat(ht," Link Text"),It="".concat(ht," Link URL"),Ot="".concat(ht," Form ID"),kt="".concat(ht," Form Name"),Tt="".concat(ht," Form Destination"),Pt="cookie",xt=function(e){function t(t,n,r,i,o,s,u,a,c,l,d,f,p,h,v,g,y,m,b,w,_,E,S,I,O,k,T,P,x,A,N,R,L,D){void 0===r&&(r=new ae),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Pt),void 0===g&&(g=new Y),void 0===y&&(y=C.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===S&&(S=""),void 0===I&&(I="US"),void 0===k&&(k=18e5),void 0===T&&(T=new ut({loggerProvider:g})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===x&&(x="fetch"),void 0===A&&(A=!1),void 0===N&&(N=!1);var j=e.call(this,{apiKey:t,storageProvider:T,transportProvider:Nt(x)})||this;return j.apiKey=t,j.appVersion=n,j.cookieOptions=i,j.defaultTracking=o,j.autocapture=s,j.flushIntervalMillis=a,j.flushMaxRetries=c,j.flushQueueSize=l,j.identityStorage=d,j.ingestionMetadata=f,j.instanceName=p,j.loggerProvider=g,j.logLevel=y,j.minIdLength=m,j.offline=b,j.partnerId=_,j.plan=E,j.serverUrl=S,j.serverZone=I,j.sessionTimeout=k,j.storageProvider=T,j.trackingOptions=P,j.transport=x,j.useBatch=A,j.fetchRemoteConfig=N,j._optOut=!1,j._cookieStorage=r,j.deviceId=u,j.lastEventId=h,j.lastEventTime=v,j.optOut=w,j.sessionId=O,j.pageCounter=L,j.userId=R,j.debugLogsEnabled=D,j.loggerProvider.enable(D?C.Debug:j.logLevel),j}return y(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(ke(this.apiKey),e)},t}(Z),At=function(e,t,n){return void 0===t&&(t={}),w(void 0,void 0,void 0,(function(){var r,i,o,s,u,a,c,l,d,f,p,h,v,g,y,b,w,E,S,I,O,k,T,P,x,A,C,N,R,L,D,j,q,M,F,z,K,V,$,B,H,W,J;return _(this,(function(_){switch(_.label){case 0:return r=t.identityStorage||Pt,S={},r===Pt?[3,1]:(o="",[3,5]);case 1:return null===(O=null===(I=t.cookieOptions)||void 0===I?void 0:I.domain)||void 0===O?[3,2]:(s=O,[3,4]);case 2:return[4,Rt()];case 3:s=_.sent(),_.label=4;case 4:o=s,_.label=5;case 5:return i=m.apply(void 0,[(S.domain=o,S.expiration=365,S.sameSite="Lax",S.secure=!1,S.upgrade=!0,S),t.cookieOptions]),u=Ct(t.identityStorage,i),[4,dt(e,u,null===(T=null===(k=t.cookieOptions)||void 0===k?void 0:k.upgrade)||void 0===T||T)];case 6:return a=_.sent(),[4,u.get(ke(e))];case 7:return c=_.sent(),l=de(),d=null!==(N=null!==(C=null!==(A=null!==(x=null!==(P=t.deviceId)&&void 0!==P?P:l.ampDeviceId)&&void 0!==x?x:l.deviceId)&&void 0!==A?A:null==c?void 0:c.deviceId)&&void 0!==C?C:a.deviceId)&&void 0!==N?N:U(),f=null!==(R=null==c?void 0:c.lastEventId)&&void 0!==R?R:a.lastEventId,p=null!==(L=null==c?void 0:c.lastEventTime)&&void 0!==L?L:a.lastEventTime,h=null!==(j=null!==(D=t.optOut)&&void 0!==D?D:null==c?void 0:c.optOut)&&void 0!==j?j:a.optOut,v=null!==(q=null==c?void 0:c.sessionId)&&void 0!==q?q:a.sessionId,g=null!==(F=null!==(M=t.userId)&&void 0!==M?M:null==c?void 0:c.userId)&&void 0!==F?F:a.userId,n.previousSessionDeviceId=null!==(z=null==c?void 0:c.deviceId)&&void 0!==z?z:a.deviceId,n.previousSessionUserId=null!==(K=null==c?void 0:c.userId)&&void 0!==K?K:a.userId,y={ipAddress:null===($=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===$||$,language:null===(H=null===(B=t.trackingOptions)||void 0===B?void 0:B.language)||void 0===H||H,platform:null===(J=null===(W=t.trackingOptions)||void 0===W?void 0:W.platform)||void 0===J||J},b=null==c?void 0:c.pageCounter,w=null==c?void 0:c.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(E=new xt(e,t.appVersion,u,i,t.defaultTracking,t.autocapture,d,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,f,p,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,h,t.partnerId,t.plan,t.serverUrl,t.serverZone,v,t.sessionTimeout,t.storageProvider,y,t.transport,t.useBatch,t.fetchRemoteConfig,g,b,w)).storageProvider.isEnabled()];case 8:return _.sent()||(E.loggerProvider.warn("Storage provider ".concat(E.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),E.storageProvider=new ae),[2,E]}}))}))},Ct=function(e,t){switch(void 0===e&&(e=Pt),void 0===t&&(t={}),e){case"localStorage":return new ut;case"sessionStorage":return new at;case"none":return new ae;default:return new Ne(m(m({},t),{expirationDays:t.expiration}))}},Nt=function(e){return"xhr"===e?new ct:"beacon"===e?new lt:new De},Rt=function(e){return w(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s;return _(this,(function(u){switch(u.label){case 0:return[4,(new Ne).isEnabled()];case 1:if(!u.sent()||"undefined"==typeof location||!location.hostname)return[2,""];for(e=location.hostname,t=e.split("."),n=[],r="AMP_TLDTEST",i=t.length-2;i>=0;--i)n.push(t.slice(i).join("."));i=0,u.label=2;case 2:return i<n.length?(o=n[i],[4,(s=new Ne({domain:"."+o})).set(r,1)]):[3,7];case 3:return u.sent(),[4,s.get(r)];case 4:return u.sent()?[4,s.remove(r)]:[3,6];case 5:return u.sent(),[2,"."+o];case 6:return i++,[3,2];case 7:return[2,""]}}))}))},Lt=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Dt=function(e){var t;void 0===e&&(e={});var n,r,i=le(),o=void 0,s=e.trackOn,u=e.trackHistoryChanges,a=e.eventType,c=void 0===a?"[Amplitude] Page Viewed":a,l=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},d=function(){return w(void 0,void 0,void 0,(function(){var e,t,n;return _(this,(function(r){switch(r.label){case 0:return e=l("undefined"!=typeof location&&location.href||""),n={event_type:c},t=[{}],[4,jt()];case 1:return[2,(n.event_properties=m.apply(void 0,[m.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&l(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},f=function(){return void 0===s||"function"==typeof s&&s()},p="undefined"!=typeof location?location.href:null,h=function(){return w(void 0,void 0,void 0,(function(){var e,n,r,i;return _(this,(function(s){switch(s.label){case 0:return e=location.href,n=qt(u,e,p||"")&&f(),p=e,n?(null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return i=(r=t).track,[4,d()];case 2:i.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}}))}))},v=function(){h()},g={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return w(void 0,void 0,void 0,(function(){var u,a;return _(this,(function(c){switch(c.label){case 0:return t=s,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),i&&(i.addEventListener("popstate",v),n=i.history.pushState,i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=S(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),h()}})),f()?(o.log("Tracking page view event"),a=(u=t).track,[4,d()]):[3,2];case 1:a.apply(u,[c.sent()]),c.label=2;case 2:return[2]}}))}))},execute:function(e){return w(void 0,void 0,void 0,(function(){var t;return _(this,(function(n){switch(n.label){case 0:return"attribution"===s&&Ut(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,d()]):[3,2];case 1:t=n.sent(),e.event_type=t.event_type,e.event_properties=m(m({},e.event_properties),t.event_properties),n.label=2;case 2:return r&&e.event_type===c&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=m(m({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}}))}))},teardown:function(){return w(void 0,void 0,void 0,(function(){return _(this,(function(e){return i&&(i.removeEventListener("popstate",v),n&&(i.history.pushState=n)),[2]}))}))}};return g},jt=function(){return w(void 0,void 0,void 0,(function(){var e;return _(this,(function(t){switch(t.label){case 0:return e=Lt,[4,(new Oe).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},Ut=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[P.SET]||{},r=t[P.UNSET]||{},i=I(I([],S(Object.keys(n)),!1),S(Object.keys(r)),!1);return Object.keys(Ie).every((function(e){return i.includes(e)}))}return!1},qt=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},Mt=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return w(void 0,void 0,void 0,(function(){var i;return _(this,(function(o){return null===(i=le())||void 0===i||i.addEventListener("load",(function(){if(r){if("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n;t||r.track(vt,((n={})[Ot]=Ft(e.id),n[kt]=Ft(e.name),n[Tt]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,i;t||r.track(vt,((n={})[Ot]=Ft(e.id),n[kt]=Ft(e.name),n[Tt]=e.action,n)),r.track(gt,((i={})[Ot]=Ft(e.id),i[kt]=Ft(e.name),i[Tt]=e.action,i)),t=!1}))};Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")})),[2]}))}))},execute:function(e){return w(void 0,void 0,void 0,(function(){return _(this,(function(t){return[2,e]}))}))},teardown:function(){return w(void 0,void 0,void 0,(function(){return _(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},Ft=function(e){if("string"==typeof e)return e},zt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return w(void 0,void 0,void 0,(function(){var i;return _(this,(function(o){return null===(i=le())||void 0===i||i.addEventListener("load",(function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),s=null==i?void 0:i[1];s&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",(function(){var t;s&&r.track(yt,((t={})[wt]=s,t[_t]=n.pathname,t[Et]=e.id,t[St]=e.text,t[It]=e.href,t))}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")})),[2]}))}))},execute:function(e){return w(void 0,void 0,void 0,(function(){return _(this,(function(t){return[2,e]}))}))},teardown:function(){return w(void 0,void 0,void 0,(function(){return _(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},Kt=!1,Vt=function(){var e=le(),t=[],n=function(n,r){e&&(e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return w(void 0,void 0,void 0,(function(){return _(this,(function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",(function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout((function(){t.flush()}),e.flushIntervalMillis)})),n("offline",(function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2])}))}))},teardown:function(){return w(void 0,void 0,void 0,(function(){return _(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;e&&e.removeEventListener(n,r)})),t=[],[2]}))}))}}},$t="Remote config fetch rejected due to timeout after 5 seconds",Bt="Unexpected error occurred",Ht=function(){function e(e){var t=e.localConfig,n=e.configKeys,r=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(e,t,n){return w(r,void 0,void 0,(function(){var r,i,o;return _(this,(function(s){switch(s.label){case 0:return r=Date.now(),[4,this.fetchWithTimeout(n)];case 1:return(i=s.sent())&&(o=i.configs&&i.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-r,[2,o[t]]):(this.metrics.fetchTimeAPIFail=Date.now()-r,[2,void 0])}}))}))},this.fetchWithTimeout=function(e){return w(r,void 0,void 0,(function(){var t,n,r;return _(this,(function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout((function(){return t.abort()}),5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}}))}))},this.fetchRemoteConfig=function(e,t){return w(r,void 0,void 0,(function(){var n,r,i,o,s,u,a,c,l,d,f,p;return _(this,(function(h){switch(h.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:$t})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),h.label=1;case 1:h.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(r=E(this.configKeys),i=r.next();!i.done;i=r.next())o=i.value,n.append("config_keys",o)}catch(e){d={error:e}}finally{try{i&&!i.done&&(f=r.return)&&f.call(r)}finally{if(d)throw d.error}}return t&&n.set("session_id",String(t)),s={headers:{Accept:"*/*"},method:"GET"},u="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(u,m(m({},s),{signal:e}))];case 2:if(null===(a=h.sent()))return[2,this.completeRequest({err:Bt})];switch((new ce).buildStatus(a.status)){case R.Success:return this.attempts=0,[2,this.parseAndStoreConfig(a)];case R.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return c=h.sent(),l=c,e.aborted?[2,this.completeRequest({err:$t})]:[2,this.completeRequest({err:null!==(p=l.message)&&void 0!==p?p:Bt})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return w(r,void 0,void 0,(function(){var n=this;return _(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,n.attempts*n.retryTimeout)}))];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}}))}))},this.parseAndStoreConfig=function(e){return w(r,void 0,void 0,(function(){var t;return _(this,(function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}}))}))},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.serverZone===N.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===N.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw new Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),Wt=function(e){var t=e.localConfig,n=e.configKeys;return w(void 0,void 0,void 0,(function(){return _(this,(function(e){return[2,new Ht({localConfig:t,configKeys:n})]}))}))},Jt=function(){function e(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return w(this,void 0,void 0,(function(){var e;return _(this,(function(t){switch(t.label){case 0:return e=this,[4,Wt({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=t.sent(),[2]}}))}))},e.prototype.generateJoinedConfig=function(){var e,t,n,r;return w(this,void 0,void 0,(function(){var i,o,s;return _(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),(o=this.remoteConfigFetch)?[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)]:[3,2];case 1:o=u.sent(),u.label=2;case 2:return i=o,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(i,null,2)),i&&"autocapture"in i&&("boolean"==typeof i.autocapture&&(this.config.autocapture=i.autocapture),"object"==typeof i.autocapture&&(void 0===this.config.autocapture&&(this.config.autocapture=i.autocapture),"boolean"==typeof this.config.autocapture&&(this.config.autocapture=m({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},i.autocapture)),"object"==typeof this.config.autocapture&&(this.config.autocapture=m(m({},this.config.autocapture),i.autocapture))),this.config.defaultTracking=this.config.autocapture),this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),null!==(e=(r=this.config).requestMetadata)&&void 0!==e||(r.requestMetadata=new te),(null===(t=this.remoteConfigFetch)||void 0===t?void 0:t.metrics.fetchTimeAPISuccess)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),(null===(n=this.remoteConfigFetch)||void 0===n?void 0:n.metrics.fetchTimeAPIFail)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return s=u.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",s),[3,4];case 4:return[2,this.config]}}))}))},e}(),Qt="[Amplitude] Element Clicked",Yt="[Amplitude] Element Tag",Gt="[Amplitude] Element Text",Zt="[Amplitude] Element Selector",Xt="[Amplitude] Page URL",en="https://app.amplitude.com",tn={US:en,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},nn="amp-visual-tagging-selector-highlight";function rn(e){return"function"==typeof e}function on(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var sn=on((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t}}));function un(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var an=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=E(o),u=s.next();!u.done;u=s.next()){u.value.remove(this)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var a=this.initialTeardown;if(rn(a))try{a()}catch(e){i=e instanceof sn?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=E(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{ln(f)}catch(e){i=null!=i?i:[],e instanceof sn?i=I(I([],S(i)),S(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new sn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ln(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&un(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&un(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function cn(e){return e instanceof an||e&&"closed"in e&&rn(e.remove)&&rn(e.add)&&rn(e.unsubscribe)}function ln(e){rn(e)?e():e.unsubscribe()}an.EMPTY;var dn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},fn={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,I([e,t],S(n)))},clearTimeout:function(e){var t=fn.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function pn(e){fn.setTimeout((function(){throw e}))}function hn(){}var vn=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,cn(t)&&t.add(n)):n.destination=_n,n}return y(t,e),t.create=function(e,t,n){return new bn(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(an),gn=Function.prototype.bind;function yn(e,t){return gn.call(e,t)}var mn=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){wn(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){wn(e)}else wn(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){wn(e)}},e}(),bn=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;rn(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&dn.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&yn(t.next,o),error:t.error&&yn(t.error,o),complete:t.complete&&yn(t.complete,o)}):i=t;return s.destination=new mn(i),s}return y(t,e),t}(vn);function wn(e){pn(e)}var _n={closed:!0,next:hn,error:function(e){throw e},complete:hn},En="function"==typeof Symbol&&Symbol.observable||"@@observable";function Sn(e){return e}var In=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof vn||function(e){return e&&rn(e.next)&&rn(e.error)&&rn(e.complete)}(r)&&cn(r)?e:new bn(e,t,n);return function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}(),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=On(t))((function(t,r){var i=new bn({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[En]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?Sn:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=On(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function On(e){var t;return null!==(t=null!=e?e:dn.Promise)&&void 0!==t?t:Promise}function kn(e){return function(t){if(function(e){return rn(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Tn(e,t,n,r,i){return new Pn(e,t,n,r,i)}var Pn=function(e){function t(t,n,r,i,o,s){var u=e.call(this,t)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return y(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(vn),xn=function(){return Date.now()},An=function(e){function t(t,n){return e.call(this)||this}return y(t,e),t.prototype.schedule=function(e,t){return this},t}(an),Cn=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,I([e,t],S(n)))},Nn=function(e){return clearInterval(e)},Rn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return y(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),Cn(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Nn(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,un(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(An),Ln=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=xn,e}(),Dn=new(function(e){function t(t,n){void 0===n&&(n=Ln.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return y(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(Ln))(Rn),jn=Dn,Un=new In((function(e){return e.complete()}));function qn(e){return e&&rn(e.schedule)}function Mn(e){return e[e.length-1]}var Fn=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function zn(e){return rn(null==e?void 0:e.then)}function Kn(e){return rn(e[En])}function Vn(e){return Symbol.asyncIterator&&rn(null==e?void 0:e[Symbol.asyncIterator])}function $n(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Bn="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Hn(e){return rn(null==e?void 0:e[Bn])}function Wn(e){return k(this,arguments,(function(){var t,n,r;return _(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,O(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,O(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,O(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function Jn(e){return rn(null==e?void 0:e.getReader)}function Qn(e){if(e instanceof In)return e;if(null!=e){if(Kn(e))return i=e,new In((function(e){var t=i[En]();if(rn(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Fn(e))return r=e,new In((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(zn(e))return n=e,new In((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,pn)}));if(Vn(e))return Yn(e);if(Hn(e))return t=e,new In((function(e){var n,r;try{for(var i=E(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(Jn(e))return Yn(Wn(e))}var t,n,r,i;throw $n(e)}function Yn(e){return new In((function(t){(function(e,t){var n,r,i,o;return w(this,void 0,void 0,(function(){var s,u;return _(this,(function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=T(e),a.label=1;case 1:return[4,n.next()];case 2:if((r=a.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=a.sent(),i={error:u},[3,11];case 6:return a.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function Gn(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(o),!i)return o}function Zn(e,t){return void 0===t&&(t=0),kn((function(n,r){n.subscribe(Tn(r,(function(n){return Gn(r,e,(function(){return r.next(n)}),t)}),(function(){return Gn(r,e,(function(){return r.complete()}),t)}),(function(n){return Gn(r,e,(function(){return r.error(n)}),t)})))}))}function Xn(e,t){return void 0===t&&(t=0),kn((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function er(e,t){if(!e)throw new Error("Iterable cannot be null");return new In((function(n){Gn(n,t,(function(){var r=e[Symbol.asyncIterator]();Gn(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function tr(e,t){if(null!=e){if(Kn(e))return function(e,t){return Qn(e).pipe(Xn(t),Zn(t))}(e,t);if(Fn(e))return function(e,t){return new In((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(zn(e))return function(e,t){return Qn(e).pipe(Xn(t),Zn(t))}(e,t);if(Vn(e))return er(e,t);if(Hn(e))return function(e,t){return new In((function(n){var r;return Gn(n,t,(function(){r=e[Bn](),Gn(n,t,(function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)}),0,!0)})),function(){return rn(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(Jn(e))return function(e,t){return er(Wn(e),t)}(e,t)}throw $n(e)}function nr(e){return e instanceof Date&&!isNaN(e)}var rr=on((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function ir(e){throw new rr(e)}function or(e,t){return kn((function(n,r){var i=0;n.subscribe(Tn(r,(function(n){r.next(e.call(t,n,i++))})))}))}var sr=Array.isArray;function ur(e){return or((function(t){return function(e,t){return sr(t)?e.apply(void 0,I([],S(t))):e(t)}(e,t)}))}function ar(e,t,n){return void 0===n&&(n=1/0),rn(t)?ar((function(n,r){return or((function(e,i){return t(n,e,r,i)}))(Qn(e(n,r)))}),n):("number"==typeof t&&(n=t),kn((function(t,r){return function(e,t,n,r,i,o,s){var u=[],a=0,c=0,l=!1,d=function(){!l||u.length||a||t.complete()},f=function(e){a++;var i=!1;Qn(n(e,c++)).subscribe(Tn(t,(function(e){t.next(e)}),(function(){i=!0}),void 0,(function(){if(i)try{for(a--;u.length&&a<r;)e=void 0,e=u.shift(),s||f(e);d()}catch(e){t.error(e)}var e})))};return e.subscribe(Tn(t,(function(e){return a<r?f(e):u.push(e)}),(function(){l=!0,d()}))),function(){}}(t,r,e,n)})))}var cr,lr,dr=["addListener","removeListener"],fr=["addEventListener","removeEventListener"],pr=["on","off"];function hr(e,t,n,r){if(rn(n)&&(r=n,n=void 0),r)return hr(e,t,n).pipe(ur(r));var i=S(function(e){return rn(e.addEventListener)&&rn(e.removeEventListener)}(e)?fr.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return rn(e.addListener)&&rn(e.removeListener)}(e)?dr.map(vr(e,t)):function(e){return rn(e.on)&&rn(e.off)}(e)?pr.map(vr(e,t)):[],2),o=i[0],s=i[1];if(!o&&Fn(e))return ar((function(e){return hr(e,t,n)}))(Qn(e));if(!o)throw new TypeError("Invalid event target");return new In((function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}}))}function vr(e,t){return function(n){return function(r){return e[n](t,r)}}}function gr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return qn(Mn(e))?e.pop():void 0}(e),r=function(e,t){return"number"==typeof Mn(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Qn(i[0]):function(e){return void 0===e&&(e=1/0),ar(Sn,e)}(r)(function(e,t){return t?tr(e,t):Qn(e)}(i,n)):Un}function yr(e,t){return kn((function(n,r){var i=0;n.subscribe(Tn(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function mr(e){return e<=0?function(){return Un}:kn((function(t,n){var r=0;t.subscribe(Tn(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function br(e,t){return ar((function(t,n){return Qn(e(t,n)).pipe(mr(1),function(e){return or((function(){return e}))}(t))}))}function wr(e,t){void 0===t&&(t=Dn);var n=function(e,t,n){void 0===n&&(n=jn);var r=-1;return null!=t&&(qn(t)?n=t:r=t),new In((function(t){var i=nr(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}(e,t);return br((function(){return n}))}function _r(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};cr=m(m({},n),t),lr=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(cr.root,n);var r=Er(e,"all",(function(){return Er(e,"two",(function(){return Er(e,"one",(function(){return Er(e,"none")}))}))}));if(r){var i=Nr(Rr(r,e));return i.length>0&&(r=i[0]),Ir(r)}throw new Error("Selector was not found.")}function Er(e,t,n){for(var r=null,i=[],o=e,s=0,u=function(){var e,u,a=xr(function(e){var t=e.getAttribute("id");if(t&&cr.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(o))||xr.apply(void 0,I([],S(function(e){var t=Array.from(e.attributes).filter((function(e){return cr.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(o)),!1))||xr.apply(void 0,I([],S(function(e){var t=Array.from(e.classList).filter(cr.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(o)),!1))||xr(function(e){var t=e.tagName.toLowerCase();if(cr.tagName(t))return{name:t,penalty:2};return null}(o))||[{name:"*",penalty:3}],c=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)c&&(a=a.concat(a.filter(Pr).map((function(e){return Tr(e,c)}))));else if("two"==t)a=a.slice(0,1),c&&(a=a.concat(a.filter(Pr).map((function(e){return Tr(e,c)}))));else if("one"==t){var l=S(a=a.slice(0,1),1)[0];c&&Pr(l)&&(a=[Tr(l,c)])}else"none"==t&&(a=[{name:"*",penalty:3}],c&&(a=[Tr(a[0],c)]));try{for(var d=(e=void 0,E(a)),f=d.next();!f.done;f=d.next()){(l=f.value).level=s}}catch(t){e={error:t}}finally{try{f&&!f.done&&(u=d.return)&&u.call(d)}finally{if(e)throw e.error}}if(i.push(a),i.length>=cr.seedMinLength&&(r=Sr(i,n)))return"break";o=o.parentElement,s++};o;){if("break"===u())break}return r||(r=Sr(i,n)),!r&&n?n():r}function Sr(e,t){var n,r;if(e.reduce((function(e,t){return e*t.length}),1)>cr.threshold)return t?t():null;var i=Nr(Cr(e));try{for(var o=E(i),s=o.next();!s.done;s=o.next()){var u=s.value;if(kr(u))return u}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function Ir(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function Or(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function kr(e){var t=Ir(e);switch(lr.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function Tr(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function Pr(e){return"html"!==e.name&&!e.name.startsWith("#")}function xr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(Ar);return n.length>0?n:null}function Ar(e){return null!=e}function Cr(e,t){var n,r,i,o,s,u;return void 0===t&&(t=[]),_(this,(function(a){switch(a.label){case 0:if(!(e.length>0))return[3,9];a.label=1;case 1:a.trys.push([1,6,7,8]),n=E(e[0]),r=n.next(),a.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,E(Cr(e.slice(1,e.length),t.concat(i)))]);case 3:a.sent(),a.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o=a.sent(),s={error:o},[3,8];case 7:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:a.sent(),a.label=11;case 11:return[2]}}))}function Nr(e){return I([],S(e),!1).sort((function(e,t){return Or(e)-Or(t)}))}function Rr(e,t,n){var r,i,o;return void 0===n&&(n={counter:0,visited:new Map}),_(this,(function(s){switch(s.label){case 0:if(!(e.length>2&&e.length>cr.optimizedMinLength))return[3,5];r=1,s.label=1;case 1:return r<e.length-1?n.counter>cr.maxNumberOfTries?[2]:(n.counter+=1,(i=I([],S(e),!1)).splice(r,1),o=Ir(i),n.visited.has(o)?[2]:kr(i)&&function(e,t){return lr.querySelector(Ir(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return s.sent(),n.visited.set(o,!0),[5,E(Rr(i,t,n))];case 3:s.sent(),s.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}var Lr=["input","select","textarea"],Dr=function(e,t){return function(n,r){var i,o,s,u=e.pageUrlAllowlist,a=e.shouldTrackEventResolver,c=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!c)return!1;if(a)return a(n,r);if(!Fr(window.location.href,u))return!1;var l=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t){var d=t.some((function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))}));if(!d)return!1}switch(c){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var f=null===(s=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===s?void 0:s.call(window,r);return!(!f||"pointer"!==f.getPropertyValue("cursor")||"click"!==n)||"click"===n}}},jr=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},Ur=function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Lr.includes(i)&&!o},qr=function(e){var t="";return Ur(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=qr(e),t+=r.split(/(\s+)/).filter(jr).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},Mr=function(e,t){var n,r,i="";try{return i=_r(e,{className:function(e){return e!==nn},maxNumberOfTries:1e3})}catch(e){if(t){var o=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(o.toString()))}}var s=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);s&&(i=s);var u=e.getAttribute("id"),a=e.getAttribute("class");if(u)i="#".concat(u);else if(a){var c=a.split(" ").filter((function(e){return e!==nn})).join(".");c&&(i="".concat(i,".").concat(c))}return i},Fr=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},zr=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},Kr=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}if(t){var r=t.textContent||"";return jr(r)?r:""}return Kr(n)},Vr=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:Vr(null==e?void 0:e.parentElement,t):null},$r=function(e,t){var n,r,i;if(!e)return{};var o=null===(i=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),s=Mr(e,t),u=((n={})[Yt]=o,n[Gt]=qr(e),n[Zt]=s,n[Xt]=window.location.href.split("?")[0],n);return zr(u)};var Br=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},Hr=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?en:t,r=this;this.endpoint=en,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===en&&(this.endpoint=i);var a=null;window.addEventListener("message",(function(e){var n,r,i,c,l;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var d,f=null==e?void 0:e.data,p=null==f?void 0:f.action;if(p)if("id"in f)null===(c=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===c||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===p)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===p){var h=null==f?void 0:f.data;(d="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=d,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(d)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;a=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:$r,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:nn,messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===p&&(null===(l=null==a?void 0:a.close)||void 0===l||l.call(a))}})),this.notify({action:"page-loaded"})},e}(),Wr=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],Jr=["type"],Qr=["svg","path","g"],Yr=["password","hidden"];var Gr=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(null===i)n+=4;else{var o=Zr(i);n+=o?Array.from(o).length:4}if(n>t)return e.slice(0,r)}return e}(function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e).map((function(e){return function(e){var t,n,r,i,o,s;if(null===e)return null;var u=String(e.tagName).toLowerCase(),a={tag:u},c=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);c.length&&(a.index=c.indexOf(e),a.indexOfType=c.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var l=null===(s=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===s?void 0:s.toLowerCase();l&&(a.prevSib=String(l));var d=e.getAttribute("id");d&&(a.id=String(d));var f=Array.from(e.classList);f.length&&(a.classes=f);var p={},h=Array.from(e.attributes).filter((function(e){return!Wr.includes(e.name)})),v=!Ur(e);if(!Yr.includes(String(e.getAttribute("type")))&&!Qr.includes(u))try{for(var g=E(h),y=g.next();!y.done;y=g.next()){var m=y.value;v&&!Jr.includes(m.name)||(p[m.name]=String(m.value).substring(0,128))}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}return Object.keys(p).length&&(a.attrs=p),a}(e)})),1024),t):[]};function Zr(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return Zr(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=S(e,1)[0]})).map((function(e){var t=S(e,2),n=t[0],r=t[1];return"".concat(String(Zr(n,!0)),": ").concat(String(Zr(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var Xr;function ei(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,u=e.shouldTrackEvent,a=o.clickObservable,c=a.pipe(kn((function(e,t){var n,r=!1;e.subscribe(Tn(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),yr((function(e){var t=S(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),l=gr(c,a.pipe((t=s.debounceTime,void 0===n&&(n=Dn),kn((function(e,r){var i=null,o=null,s=null,u=function(){if(i){i.unsubscribe(),i=null;var e=o;o=null,r.next(e)}};function a(){var e=s+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);u()}e.subscribe(Tn(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(a,t),r.add(i))}),(function(){u(),r.complete()}),void 0,(function(){o=i=null})))}))),or((function(){return"timeout"}))));return a.pipe(wr(0),yr(Br),yr((function(e){return u("click",e.closestTrackedAncestor)})),(r=l,kn((function(e,t){var n=[];return e.subscribe(Tn(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Qn(r).subscribe(Tn(t,(function(){var e=n;n=[],t.next(e)}),hn)),function(){n=null}})))).subscribe((function(e){var t,n,r=(e.length,Qt);try{for(var o=E(e),s=o.next();!s.done;s=o.next()){var u=s.value;null==i||i.track(r,u.targetElementProperties,{time:u.timestamp})}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}))}function ti(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,u=n.clickObservable,a=n.mutationObservable,c=n.navigateObservable,l=u.pipe(yr((function(e){return!o("click",e.closestTrackedAncestor)})),or((function(e){var t=Vr(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),yr(Br),yr((function(e){return s("click",e.closestTrackedAncestor)}))),d=[a];c&&d.push(c);var f,p,h=gr.apply(void 0,I([],S(d),!1)),v=l.pipe((f=function(e){return h.pipe(mr(1),function(e){var t=nr(e)?{first:e}:"number"==typeof e?{each:e}:e,n=t.first,r=t.each,i=t.with,o=void 0===i?ir:i,s=t.scheduler,u=void 0===s?Dn:s,a=t.meta,c=void 0===a?null:a;if(null==n&&null==r)throw new TypeError("No timeout provided.");return kn((function(e,t){var i,s,a=null,l=0,d=function(e){s=Gn(t,u,(function(){try{i.unsubscribe(),Qn(o({meta:c,lastValue:a,seen:l})).subscribe(t)}catch(e){t.error(e)}}),e)};i=e.subscribe(Tn(t,(function(e){null==s||s.unsubscribe(),l++,t.next(a=e),r>0&&d(r)}),void 0,void 0,(function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),a=null}))),!l&&d(null!=n?"number"==typeof n?n:+n-u.now():r)}))}({first:500,with:function(){return Un}}),or((function(){return e})))},kn((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(Tn(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;Qn(f(e,s)).subscribe(n=Tn(t,(function(n){return t.next(p?p(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return v.subscribe((function(e){null==t||t.track(Qt,i("click",e.closestTrackedAncestor),{time:e.timestamp})}))}!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(Xr||(Xr={}));var ni=function(e){var t,n,r;void 0===e&&(e={});var i=e.dataAttributePrefix,o=void 0===i?"data-amp-track-":i,s=e.visualTaggingOptions,u=void 0===s?{enabled:!0,messenger:new Hr}:s;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:L,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:D,e.debounceTime=null!==(r=e.debounceTime)&&void 0!==r?r:0;var a="@amplitude/plugin-autocapture-browser",c=[],l=void 0,d=function(e,t){var n,r,i,s=null===(i=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),c=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var i=r.replace(t,""),o=e.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(t,o),d=Kr(t),f=Mr(t,l),p=((n={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",n["[Amplitude] Element Class"]=t.getAttribute("class"),n["[Amplitude] Element Hierarchy"]=Gr(t),n[Yt]=s,n[Gt]=qr(t),n["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),n["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=c,n[Zt]=f,n["[Amplitude] Element Parent Label"]=d,n[Xt]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===s&&"click"===e&&t instanceof HTMLAnchorElement&&(p["[Amplitude] Element Href"]=t.href),zr(p)},f=function(t,n){var r={event:t,timestamp:Date.now(),type:n};if(function(e){return"click"===e.type||"change"===e.type}(r)&&null!==r.event.target){var i=Vr(r.event.target,e.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=d(r.type,i)),r}return r};return{name:a,type:"enrichment",setup:function(t,n){return w(void 0,void 0,void 0,(function(){var r,i,o,s,p,h,v,g,y,b;return _(this,(function(w){return l=t.loggerProvider,"undefined"==typeof document||(r=Dr(e,e.cssSelectorAllowlist),i=Dr(e,e.actionClickAllowlist),o=function(){var e,t,n=hr(document,"click",{capture:!0}).pipe(or((function(e){return f(e,"click")}))),r=hr(document,"change",{capture:!0}).pipe(or((function(e){return f(e,"change")})));window.navigation&&(t=hr(window.navigation,"navigate").pipe(or((function(e){return f(e,"navigate")}))));var i=new In((function(e){var t=new MutationObserver((function(t){e.next(t)}));return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})).pipe(or((function(e){return f(e,"mutation")})));return(e={})[Xr.ClickObservable]=n,e[Xr.ChangeObservable]=r,e[Xr.NavigateObservable]=t,e[Xr.MutationObservable]=i,e}(),s=ei({allObservables:o,options:e,amplitude:n,shouldTrackEvent:r}),c.push(s),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent;return n.changeObservable.pipe(yr(Br),yr((function(e){return i("change",e.closestTrackedAncestor)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:o,getEventProperties:d,amplitude:n,shouldTrackEvent:r}),c.push(p),h=ti({allObservables:o,options:e,getEventProperties:d,amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:i}),c.push(h),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(a," has been successfully added.")),window.opener&&u.enabled&&(v=e.cssSelectorAllowlist,g=e.actionClickAllowlist,null===(b=u.messenger)||void 0===b||b.setup(m(m({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:tn[t.serverZone]}),{isElementSelectable:Dr(e,I(I([],S(v),!1),S(g),!1)),cssSelectorAllowlist:v,actionClickAllowlist:g})))),[2]}))}))},execute:function(e){return w(void 0,void 0,void 0,(function(){return _(this,(function(t){return[2,e]}))}))},teardown:function(){return w(void 0,void 0,void 0,(function(){var e,t,n,r;return _(this,(function(i){try{for(e=E(c),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},ri=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return y(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),H(this._init(m(m({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i;return w(this,void 0,void 0,(function(){var o,s,u,a,c,l=this;return _(this,(function(d){switch(d.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,At(t.apiKey,t,this)]);case 1:return o=d.sent(),t.fetchRemoteConfig?[4,(p=o,w(void 0,void 0,void 0,(function(){var e;return _(this,(function(t){switch(t.label){case 0:return[4,(e=new Jt(p)).initialize()];case 1:return t.sent(),[2,e]}}))})))]:[3,4];case 2:return[4,d.sent().generateJoinedConfig()];case 3:o=d.sent(),d.label=4;case 4:return[4,e.prototype._init.call(this,o)];case 5:return d.sent(),this.logBrowserOptions(o),Ye(this.config.defaultTracking)?(s=function(e){return Ye(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?m({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new Ce(s,this.config),[4,this.webAttribution.init()]):[3,7];case 6:d.sent(),d.label=7;case 7:return u=de(),a=Number.isNaN(Number(u.ampSessionId))?void 0:Number(u.ampSessionId),this.setSessionId(null!==(i=null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:a)&&void 0!==r?r:this.config.sessionId)&&void 0!==i?i:Date.now()),(c=He(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,9]:[4,this.add(Vt()).promise];case 8:d.sent(),d.label=9;case 9:return[4,this.add(new re).promise];case 10:return d.sent(),[4,this.add(new it).promise];case 11:return d.sent(),[4,this.add(new We).promise];case 12:return d.sent(),function(e){Kt||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n  defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Kt=!0)}(this.config),f=this.config.defaultTracking,Qe(f,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(zt()).promise]):[3,14];case 13:d.sent(),d.label=14;case 14:return function(e){return Qe(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Mt()).promise]):[3,16];case 15:d.sent(),d.label=16;case 16:return Ge(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Dt(tt(this.config))).promise]):[3,18];case 17:d.sent(),d.label=18;case 18:return Xe(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(ni(et(this.config))).promise]):[3,20];case 19:d.sent(),d.label=20;case 20:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 21:return d.sent(),c.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var f,p}))}))},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){He(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),this.config.deviceId=e,function(e,t){He(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(U()),this.setUserId(void 0)},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),H(Promise.resolve());if(e===this.config.sessionId)return H(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId(),i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,Ze(this.config.defaultTracking)&&(r&&i&&n.push(this.track(bt,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return Ze(this.config.defaultTracking)&&n.push(this.track(mt,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,H(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Nt(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(rt(t)){var r=t._q;t._q=[],t=nt(new $,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(rt(r)){var o=r._q;r._q=[],r=nt(new $,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(rt(t)){var r=t._q;t._q=[],t=nt(new J,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return w(this,void 0,void 0,(function(){var n,r,i;return _(this,(function(o){return n=Date.now(),r=Ae(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===mt||t.event_type===bt||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=m(m({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t}(W),ii=function(){var e=new ri;return{init:ue(e.init.bind(e),"init",ie(e),se(e,["config"])),add:ue(e.add.bind(e),"add",ie(e),se(e,["config.apiKey","timeline.plugins"])),remove:ue(e.remove.bind(e),"remove",ie(e),se(e,["config.apiKey","timeline.plugins"])),track:ue(e.track.bind(e),"track",ie(e),se(e,["config.apiKey","timeline.queue.length"])),logEvent:ue(e.logEvent.bind(e),"logEvent",ie(e),se(e,["config.apiKey","timeline.queue.length"])),identify:ue(e.identify.bind(e),"identify",ie(e),se(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ue(e.groupIdentify.bind(e),"groupIdentify",ie(e),se(e,["config.apiKey","timeline.queue.length"])),setGroup:ue(e.setGroup.bind(e),"setGroup",ie(e),se(e,["config.apiKey","timeline.queue.length"])),revenue:ue(e.revenue.bind(e),"revenue",ie(e),se(e,["config.apiKey","timeline.queue.length"])),flush:ue(e.flush.bind(e),"flush",ie(e),se(e,["config.apiKey","timeline.queue.length"])),getUserId:ue(e.getUserId.bind(e),"getUserId",ie(e),se(e,["config","config.userId"])),setUserId:ue(e.setUserId.bind(e),"setUserId",ie(e),se(e,["config","config.userId"])),getDeviceId:ue(e.getDeviceId.bind(e),"getDeviceId",ie(e),se(e,["config","config.deviceId"])),setDeviceId:ue(e.setDeviceId.bind(e),"setDeviceId",ie(e),se(e,["config","config.deviceId"])),reset:ue(e.reset.bind(e),"reset",ie(e),se(e,["config","config.userId","config.deviceId"])),getSessionId:ue(e.getSessionId.bind(e),"getSessionId",ie(e),se(e,["config"])),setSessionId:ue(e.setSessionId.bind(e),"setSessionId",ie(e),se(e,["config"])),extendSession:ue(e.extendSession.bind(e),"extendSession",ie(e),se(e,["config"])),setOptOut:ue(e.setOptOut.bind(e),"setOptOut",ie(e),se(e,["config"])),setTransport:ue(e.setTransport.bind(e),"setTransport",ie(e),se(e,["config"]))}}(),oi=ii.identify,si=ii.init,ui=ii.setUserId,ai=ii.track;const ci=["User ID"],li=[{source:"uid",target:"UID"}];class di{_getUserAnonymousId(){let e=this.cookies.get("_dlaid")||f();return this.cookies.set("_dlaid",e),e}constructor(e){if(Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"cookies",{enumerable:!0,configurable:!0,writable:!0,value:new s(null,{path:"/",expires:new Date(Date.now()+31536e6)})}),Object.defineProperty(this,"initialized",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:{debugEnabled:!1,amplitudeEnabled:!1}}),Object.defineProperty(this,"_getTimezoneOffsetMinutes",{enumerable:!0,configurable:!0,writable:!0,value:()=>(new Date).getTimezoneOffset()}),Object.defineProperty(this,"_handleInitCall",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.initialized&&console.warn("[DADL][WARNING] Data layer is already initialized, repeating initialization will be skipped"),this.config.debugEnabled=null!==this.cookies.get("dadlDebug"),this.context.project=e.project,this.context.page={originalUrl:e.page.url,originalReferrer:e.page.referrer},this.context.userIdentities={};for(let e of li){let t=this.cookies.get(e.source);t&&(this.context.userIdentities[e.target]=t)}this.context.app=Object.assign({},e.app||{}),this.context.userIdentities=Object.assign(this.context.userIdentities,e.userIdentities||{}),this.context.contentProperties=Object.assign({},e.contentProperties||{}),this.context.userProperties=Object.assign({},e.userProperties||{}),this.context.userExperiments=Object.assign({},e.userExperiments||{}),this.context.app=Object.assign({},e.app),this.initialized=!0,this.config.debugEnabled&&(console.debug("[DADL][DEBUG] Data layer initialized with the following initial context/event:"),console.debug(this.context)),this._initExternalDependencies()}}),Object.defineProperty(this,"_writeSnippetQueue",{enumerable:!0,configurable:!0,writable:!0,value:e=>{e.forEach((e=>this._pushMessage(e)))}}),Object.defineProperty(this,"_initExternalDependencies",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e=this.cookies.get("amplitudeDevKey")||function(e){switch(!0){case e.endsWith("crm.ostrovok.in"):return"781a932436f9aa2b4cba444288eb6a29";case e.endsWith("ostrovok.ru"):case e.endsWith("zenhotels.com"):return"0bb6987507394e926bda4be6369270b2";default:return null}}(document.location.host);e?(this.config.amplitudeEnabled=!0,si(e,{autocapture:{pageViews:!1,sessions:!1}})):console.info("[DADL][WARNING] Amplitude API key is not found by DADL SDK, please make sure you have it setup either in cookie or in DADL config")}}),Object.defineProperty(this,"_mergeContext",{enumerable:!0,configurable:!0,writable:!0,value:e=>{let n={allowUndefinedOverrides:!1};e.messageType==t.Init&&(this.context=h.withOptions(n,this.context,{app:e.app})),e.messageType!=t.Context&&e.messageType!=t.Init||(this.context=h.withOptions(n,this.context,{userProperties:e.userProperties,userIdentities:e.userIdentities,userExperiments:e.userExperiments,contentProperties:e.contentProperties})),e.messageType==t.Event&&((e.userProperties||e.userIdentities||e.userIdentities)&&console.warn("[DADL][WARNING] 'event' tracking call can't pass 'userProperties', 'userExperiments', or 'userIdentities', please use 'context' or 'init' tracking type"),e.userProperties={},e.userIdentities={},e.userExperiments={});const r=["app","snippet","anonymousId","httpRequestId","userExperiments","userProperties","userIdentities","contentProperties"];for(let t of r)e[t]=this.context[t];return e.page=Object.assign(e.page,this.context.page),e}}),Object.defineProperty(this,"_handleAmplitudeOutput",{enumerable:!0,configurable:!0,writable:!0,value:e=>{let n={insert_id:e.messageId};switch(e.messageType){case t.Event:let r=Object.assign({},e.eventProperties,e.contentProperties);ai(e.eventName,r,n);break;case t.Context:let i=new $;for(const[t,n]of Object.entries(e.userProperties||{}))i.set(t,n);for(const[t,n]of Object.entries(e.userIdentities||{}))ci.includes(t)?ui(n):i.set(t,n);for(const[t,n]of Object.entries(e.userExperiments||{}))i.set(t,n);oi(i,n)}}}),Object.defineProperty(this,"_handleConsoleOutput",{enumerable:!0,configurable:!0,writable:!0,value:e=>{e.messageType!==t.Init&&(console.debug(`[DADL][DEBUG] Payload of messageId '${e.messageId}', type '${e.messageType}':`),console.debug(e))}}),Object.defineProperty(this,"_handlePush",{enumerable:!0,configurable:!0,writable:!0,value:e=>{e.messageType===t.Init&&this._handleInitCall(e),this.config.amplitudeEnabled&&this._handleAmplitudeOutput(e),this.config.debugEnabled&&this._handleConsoleOutput(e)}}),Object.defineProperty(this,"_pushMessage",{enumerable:!0,configurable:!0,writable:!0,value:e=>{(e=this._mergeContext(e)).messageId=f(),this._handlePush(e)}}),Object.defineProperty(this,"push",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this._pushMessage(Object.assign(t,{ts:Date.now(),messageType:e,page:{url:document.location.href,referrer:document.referrer?document.referrer.toString():null,title:document.title}}))}}),e instanceof di)return console.info("DADL SDK is already initialized"),e;this.context.httpRequestId=window.ota_http_request_id||null,this.context.anonymousId=this._getUserAnonymousId(),this.context.snippet=e.s,e.q[0].messageType===t.Init?this._writeSnippetQueue(e.q):console.error("DADL needs to be initialized first")}}window.dadl?window.dadl=new di(window.dadl):console.error("DADL Snippet is not found")}();
