1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="61b4539a-9d45-45a4-aed5-866bdc4f3a6e",e._sentryDebugIdIdentifier="sentry-dbid-61b4539a-9d45-45a4-aed5-866bdc4f3a6e")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15489],{12539:(e,t,r)=>{"use strict";r.d(t,{Se:()=>u,T$:()=>l});var n,i,o=r(32978),s=r(56642),a=r(25501),l=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,o.Cl)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(i.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(i.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(i.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(i.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(i.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(i.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(i.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(i.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(i.UNSET,e,s.mG),this},e.prototype.clearAll=function(){return this._properties={},this._properties[i.CLEAR_ALL]=s.mG,this},e.prototype._safeSet=function(e,t,r){if(this._validate(e,t,r)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=r,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,r){return!(void 0!==this._properties[i.CLEAR_ALL]||this._propertySet.has(t))&&(e===i.ADD?"number"==typeof r:e===i.UNSET||e===i.REMOVE||(0,a.E)(t,r))},e}();(n=i||(i={})).SET="$set",n.SET_ONCE="$setOnce",n.ADD="$add",n.APPEND="$append",n.PREPEND="$prepend",n.REMOVE="$remove",n.PREINSERT="$preInsert",n.POSTINSERT="$postInsert",n.UNSET="$unset",n.CLEAR_ALL="$clearAll";var u=[i.CLEAR_ALL,i.UNSET,i.SET,i.SET_ONCE,i.ADD,i.APPEND,i.PREPEND,i.PREINSERT,i.POSTINSERT,i.REMOVE]},15489:(e,t,r)=>{"use strict";let n,i,o,s,a,l,u;r.d(t,{y1:()=>uR,IP:()=>uM,u0:()=>uD,ls:()=>uL,Yi:()=>uA,do:()=>uN,u4:()=>uH});var c,d,f,h,p,g,v,m,y,b,w,S,E,k,C,I,x,T,P,_,O,A,R,M,D,L,N,H,U,F,j,q,B,z,Y,J,W,V,K,$,X,G,Q,Z,ee,et,er,en,ei,eo,es,ea,el,eu,ec,ed,ef,eh,ep,eg,ev,em,ey,eb,ew,eS,eE,ek,eC,eI=r(32978),ex=function(e){return{promise:e||Promise.resolve()}};(c=G||(G={}))[c.None=0]="None",c[c.Error=1]="Error",c[c.Warn=2]="Warn",c[c.Verbose=3]="Verbose",c[c.Debug=4]="Debug";var eT="Amplitude Logger ",eP=function(){function e(){this.logLevel=G.None}return e.prototype.disable=function(){this.logLevel=G.None},e.prototype.enable=function(e){void 0===e&&(e=G.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Verbose||console.log("".concat(eT,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Warn||console.warn("".concat(eT,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Error||console.error("".concat(eT,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<G.Debug||console.log("".concat(eT,"[Debug]: ").concat(e.join(" ")))},e}(),e_=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var r=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(r))),Promise.resolve({remoteConfig:r.remoteConfig,lastFetch:new Date(r.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),eO=r(97345),eA=(0,eI.fX)([],(0,eI.zs)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),eR=function(e){var t,r=(0,eO.m)();if(!(null==(t=null==r?void 0:r.crypto)?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,eR);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,(0,eI.fX)([],(0,eI.zs)(n.entries()),!1).map(function(e){var t=(0,eI.zs)(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(eA[n]):eA[n]}).join("")},eM=function(){function e(e,t,r,n,i){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvali
1dApiKey=!1,this.apiKey=e,this.serverUrl=n||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new e_(e,t),this.customFetch=i}return e.prototype.subscribe=function(e,t,r){var n=eR(),i={id:n,key:e,deliveryMode:t,callback:r};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),n},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return -1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t=this;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5)return this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2];return[4,this.getOrCreateFetchPromise()];case 1:return e=r.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(r){t.sendCallback(r,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise||(this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null})):this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null})),this.fetchPromise},e.prototype.subscribeAll=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eI.YH)(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),r=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,r])];case 1:return void 0!==(n=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(n))),null!==n.remoteConfig?this.sendCallback(e,n,"cache"):this.logger.debug("Remote config client skips sending c
1allback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:r=new Promise(function(e,r){setTimeout(function(){r("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),r])];case 2:return n=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,n,"remote"),this.storage.setConfig(n),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(n=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,n,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,n,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,r){var n;e.lastCallback=new Date,n=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(n,r,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,eI.sH)(this,void 0,void 0,function(){var r,n,i,o,s,a,l=this;return(0,eI.YH)(this,function(u){switch(u.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,u,c,d,f,h,p;return(0,eI.YH)(this,function(g){switch(g.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),g.label=1;case 1:var v,m;if(g.trys.push([1,10,11,12]),u=o.getUrlParams(),c={Accept:"*/*"},!o.customFetch)return[3,3];return[4,(v=o.customFetch({url:u,method:"GET",headers:c,signal:s.signal}),m=s.signal,new Promise(function(e,t){var r=function(){var e=Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",r,{once:!0}),v.then(function(t){m.removeEventListener("abort",r),e(t)},function(e){m.removeEventListener("abort",r),t(e)})}))];case 2:return f=g.sent(),[3,5];case 3:return[4,fetch(u,{method:"GET",headers:c,signal:s.signal})];case 4:f=g.sent(),g.label=5;case 5:if((d=f).ok||d.status>=200&&d.status<300)return[3,7];return[4,d.text()];case 6:return h=g.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(d.status,": ").concat(h)),401===d.status||403===d.status?(o.logger.error("Remote config client fetch failed with ".concat(d.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):d.status>=400&&d.status<500&&429!==d.status&&(i=!1),[3,9];case 7:return[4,d.json()];case 8:return[2,{value:{remoteConfig:g.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(p=g.sent())instanceof Error&&"AbortError"===p.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),p),[3,12];case 11:return clearTimeout(a),[7];case 12:if(!i)return[2,"break"];if(!(n<e-1))return[3,14];return[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(r))})];case 13:g.sent(),g.label=14;case 14:return[2]}})},o=this,s=0,u.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=u.sent()))return[2,a.value];if("break"===a)return[3,4];u.label=3;case 3:return s++,[3,1];case 4:return[2,n]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(r.toString())},e.CONFIG_GROUP="browser",e}(),eD="tags",eL="counters",eN="histograms",eH="events",eU="internal",eF="last_flush_timestamp",ej=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return(null==(e=(0,eO.m)())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,r){var n=indexedDB.open(e.dbName,1);n.onerror=function(){e.dbPromise=null,r(Error("Failed to open IndexedDB"))},n.onsuccess=function(){var r=n.result;r.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},r.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),r.close()},t(r)},n.onupgradeneeded=function(){var t=n.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(eD)||e.createObjectStore(eD,{keyPath:"key"}),e.objectStoreNames.contains(eL)||e.createObjectStore(eL,{keyPath:"key"}),e.objectStoreNames.contains(eN)||e.createObjectStore(eN,{keyPath:"key"}),e.objectStoreNames.contains(eH)||e.createObjectStore(eH,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(eU)||e.createObjectStore(eU,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i=this;
1return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([eD],"readwrite")).objectStore(eD),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tags",e),n()},o.forEach(function(e){var t=(0,eI.zs)(e,2),n=t[0],o=t[1];r.put({key:n,value:o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tag",n,o,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",n),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([eL],"readwrite")).objectStore(eL),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to increment counters",e),n()},o.forEach(function(e){var t=(0,eI.zs)(e,2),n=t[0],o=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?e.value:0;r.put({key:n,value:t+o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",n),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([eN],"readwrite")).objectStore(eN),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),n()},o.forEach(function(e){var t=(0,eI.zs)(e,2),n=t[0],o=t[1],s=r.get(n);s.onsuccess=function(){var e,t=s.result;e=t?{key:n,count:t.count+o.count,min:Math.min(t.min,o.min),max:Math.max(t.max,o.max),sum:t.sum+o.sum}:{key:n,count:o.count,min:o.min,max:o.max,sum:o.sum},r.put(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===e.length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([eH],"readwrite")).objectStore(eH),[2,new Promise(function(n){t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event records",e),n()};var o=r.count();o.onsuccess=function(){var t=Math.max(0,10-o.result);t<e.length&&i.logger.debug("DiagnosticsStorage: Only added ".concat(t," of ").concat(e.length," events due to storage limit")),e.slice(0,t).forEach(function(e){r.add(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},o.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",n),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n,i;return(0,eI.YH)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=(r=o.sent().transaction([eU],"readwrite")).objectStore(eU),[2,new Promise(function(i,o){r.onabort=function(){return o(Error("Failed to set internal value"))};var s=n.put({key:e,value:t});s.onsuccess=function(){return i()},s.onerror=function(){return o(Error("Failed to set internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",i),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=(t=i.sent().transaction([eU],"readonly")).objectStore(eU),[2,new Promise(function(n,i){t.onabort=function(){return i(Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return n(o.result)},o.onerror=function(){return i(Error("Failed to get internal value"))}})];case 2:return n=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",n),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(eF)];case 1:return[2,(e=r.sent())?parseInt(e.value,10):void 0];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(eF,e.toString())];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).clear();i.onsuccess=function(){return r()},i.onerror=function(){return n(Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=a.sent().transaction([eD,eL,eN,eH],"readwrite"),[4,Promise.all([this.getAllFromStore(e,eD),this.getAllFromStore(e,eL),this.getAllFromStore(e,eN),this.getAllFromStore(e,eH)])];case 2:return r=(t=eI.zs.apply(void 0,[a.sent(),4]))[0],n=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,eL),this.clearTable(e,eN),this.clearTable(e,eH)])];case 3:return a.sent(),[2,{tags:r,counters:n,histogramStats:i,events:o}];case 4:return s=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).getAll();i.onsuccess=function(){return r(i.result)},i.onerror=function(){return n(Error("Failed to get all from ".concat(t)))}})},e}(),eq=function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return t}
1,eB=function(e,t){return 31*Math.abs(eq(e.toString()))%1e5/1e5<t},ez=function(){var e=(0,eO.m)();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},eY=function(e){var t=(0,eO.m)();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",(0,eI.Cl)({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,n=null==t?void 0:t.stack,i=eJ({filename:e.filename,stack:n});i&&r({type:"error",message:e.message,stack:n,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,n=e.reason instanceof Error?e.reason:void 0,i=null==n?void 0:n.stack,o=eW(i),s=eJ({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!=(t=null==n?void 0:n.message)?t:eV(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},eJ=function(e){var t,r,n=ez();if(0!==n.length)try{for(var i=(0,eI.Ju)(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},eW=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},eV=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},eK=function(){function e(e,t,r,n,i){void 0===r&&(r="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===r?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(n,null,2)),this.config=(0,eI.Cl)({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=eB(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:ej.isSupported()?this.storage=new ej(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),eY(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(void 0===t&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");var r=this.inMemoryHistograms[e];r?(r.count+=1,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=10)return void this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},3e5))},e.prototype.saveAllDataToStorage=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,eI.Cl)({},this.inMemoryTags),t=(0,eI.Cl)({},this.inMemoryCounters),r=(0,eI.Cl)({},this.inMemoryHistograms),n=(0,eI.fX)([],(0,eI.zs)(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(r),this.storage.addEventRecords(n)])];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,u;return(0,eI.YH)(this,function(c){switch(c.label){case 0:if(!this.storage)return[2];return[4,this.saveAllDataToStorage()];case 1:return c.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:if(t=(e=c.sent()).tags,r=e.counters,n=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]=e.value}),a={}
1,n.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),l=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===l.length)return[2];return u={tags:o,histogram:a,counters:s,events:l},this.fetch(u),[2]}})})},e.prototype.fetch=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!(0,eO.m)())throw Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:if(!r.sent().ok)return this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2];return this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t,r;return(0,eI.YH)(this,function(n){switch(n.label){case 0:if(!this.storage)return[2];return e=Date.now(),[4,this.storage.getLastFlushTimestamp()];case 1:if(-1===(t=n.sent()||-1))return this.storage.setLastFlushTimestamp(e),this._setFlushTimer(3e5),[2];return(r=e-t)>=3e5?this._flush():this._setFlushTimer(3e5-r),[2]}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=eB(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),e$=function(){var e,t=(0,eO.m)();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var r=t.split("=",2),n=eX(r[0]),i=eX(r[1]);return i&&(e[n]=i),e},{}):{}},eX=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}};class eG{getApplicationContext(){return{versionName:this.versionName,language:eQ(),platform:"Web",os:void 0,deviceModel:void 0}}}let eQ=()=>"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class eZ{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}let e0=(e,t)=>{let r=typeof e;if(r!==typeof t)return!1;for(let n of["string","number","boolean","undefined"])if(n===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;let n=Array.isArray(e),i=Array.isArray(t);if(n!==i)return!1;if(n&&i){for(let r=0;r<e.length;r++)if(!e0(e[r],t[r]))return!1}else{if(!e0(Object.keys(e).sort(),Object.keys(t).sort()))return!1;let r=!0;return Object.keys(e).forEach(n=>{e0(e[n],t[n])||(r=!1)}),r}return!0};Object.entries||(Object.entries=function(e){let t=Object.keys(e),r=t.length,n=Array(r);for(;r--;)n[r]=[t[r],e[t[r]]];return n});class e1{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){let e=this,t=Object.assign({},this.identity.userProperties),r=Object.assign(Object.assign({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut(e){return r.optOut=e,this},updateUserProperties:function(e){let t=r.userProperties||{};for(let[r,n]of Object.entries(e))switch(r){case"$set":for(let[e,r]of Object.entries(n))t[e]=r;break;case"$unset":for(let e of Object.keys(n))delete t[e];break;case"$clearAll":t={}}return r.userProperties=t,this},commit:function(){return e.setIdentity(r),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){let t=Object.assign({},this.identity);this.identity=Object.assign({}
1,e),e0(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}let e2="u">typeof globalThis?globalThis:void 0!==r.g?r.g:self;class e3{constructor(){this.identityStore=new e1,this.eventBridge=new eZ,this.applicationContextProvider=new eG}static getInstance(e){return e2.analyticsConnectorInstances||(e2.analyticsConnectorInstances={}),e2.analyticsConnectorInstances[e]||(e2.analyticsConnectorInstances[e]=new e3),e2.analyticsConnectorInstances[e]}}var e4=r(56642),e5=function(e){return void 0===e&&(e=e4.e5),e3.getInstance(e)},e6=function(e,t){e5(t).identityStore.editIdentity().setUserId(e).commit()},e8=function(e,t){e5(t).identityStore.editIdentity().setDeviceId(e).commit()};(d=Q||(Q={})).Unknown="unknown",d.Skipped="skipped",d.Success="success",d.RateLimit="rate_limit",d.PayloadTooLarge="payload_too_large",d.Invalid="invalid",d.Failed="failed",d.Timeout="Timeout",d.SystemError="SystemError";var e7="Event skipped due to empty event type",e9=function(e,t){var r=Math.max(t,1);return e.reduce(function(e,t,n){var i=Math.floor(n/r);return e[i]||(e[i]=[]),e[i].push(t),e},[])},te=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Q.Unknown),{event:e,code:t,message:r}},tt=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:e4.e5,logLevel:G.Warn,loggerProvider:new eP,offline:!1,optOut:!1,serverUrl:e4.mJ,serverZone:"US",useBatch:!1}},tr=function(){function e(e){this._optOut=!1;var t,r,n,i,o=tt();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?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!=(r=e.logLevel)?r: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!=(n=e.optOut)?n: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)?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=tn(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}(),tn=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=tt().serverZone),void 0===r&&(r=tt().useBatch),e)return{serverUrl:e,serverZone:void 0};var n,i=["US","EU"].includes(t)?t:tt().serverZone;return{serverZone:i,serverUrl:(n=r,"EU"===i?n?e4.OP:e4.bu:n?e4.pL:e4.mJ)}},ti=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function to(e){return e>=200&&e<300}var ts=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},ta=function(e){return function(){var t=(0,eI.Cl)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},tl=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,eI.Ju)(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},tu=function(e,t){return function(){var r,n,i={};try{for(var o=(0,eI.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=tl(e,a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},tc=function(e,t,r,n,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=r(),l=a.logger,u=a.logLevel;if(u&&u<G.Debug||!u||!l)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:ts(1),time:{start:new Date().toISOString()},states:{}};n&&c.states&&(c.states.before=n());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))),d}},td=new Set([e4.mJ,e4.bu,e4.pL,e4.OP]);function tf(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var th=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return(0,eI.sH)(this,void 0,void 0,function(){var r,n=this;return(0,eI.YH)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(e4.fS,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?void 0:t.get(this.storageKey)];case 1:return(r=i.sent())&&r.length>0&&Promise.all(r.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=eR()),new Promise(function(r){t.queue.push({event:e,attempts:0,callback:function(e){return r(e)},timeout:0}),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})}
1,e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,eI.sH)(this,void 0,void 0,function(){var t,r,n=this;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(this.config.offline)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2];if(this.flushId)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2];return this.flushId=this.scheduleId,this.resetSchedule(),t=[],r=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):r.push(e)}),[4,e9(t,this.config.flushQueueSize).reduce(function(t,r){return(0,eI.sH)(n,void 0,void 0,function(){return(0,eI.YH)(this,function(n){switch(n.label){case 0:return[4,t];case 1:return n.sent(),[4,this.send(r,e)];case 2:return[2,n.sent()]}})})},Promise.resolve())];case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var r;return void 0===t&&(t=!0),(0,eI.sH)(this,void 0,void 0,function(){var n,i,o,s,a;return(0,eI.YH)(this,function(l){var u,c,d;switch(l.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,(0,eI.Tt)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new ti,l.label=1;case 1:return l.trys.push([1,3,,4]),u=i=tn(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(c=this.config.enableRequestBodyCompression)&&(c=!1),o=!!td.has(u)||c,[4,this.config.transportProvider.send(i,n,o)];case 2:if(null===(s=l.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(tf(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:return a=(d=l.sent())instanceof Error?d.message:String(d),this.config.loggerProvider.error(a),null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:a,stack_trace:ts()}),this.handleResponse({status:Q.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){to(e.statusCode)||null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:tf(e),stack_trace:ts()});var r,n=e.status;switch(n){case Q.Success:this.handleSuccessResponse(e,t);break;case Q.Invalid:this.handleInvalidResponse(e,t);break;case Q.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case Q.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 r=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))return void this.fulfillRequest(t,e.statusCode,e.body.error);var n=new Set((0,eI.fX)((0,eI.fX)((0,eI.fX)((0,eI.fX)([],(0,eI.zs)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,eI.zs)(Object.values(e.body.eventsWithMissingFields)),!1),(0,eI.zs)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,eI.zs)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){return!n.has(i)||void r.fulfillRequest([t],e.statusCode,e.body.error)});i.length>0&&this.config.loggerProvider.warn(tf(e));
1var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(tf(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(r)},e.prototype.handleRateLimitResponse=function(e,t){var r=this,n=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),a=new Set(i),l=new Set(o),u=t.filter(function(t,n){return t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)?void r.fulfillRequest([t],e.statusCode,e.body.error):(l.has(n)&&(t.timeout=r.throttleTimeout),!0)});u.length>0&&this.config.loggerProvider.warn(tf(e));var c=this.removeEventsExceedFlushMaxRetries(u);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,r=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.fulfillRequest=function(e,t,r){var n,i,o;to(t)?null==(o=this.diagnosticsClient)||o.increment("analytics.events.sent",e.length):(null==(n=this.diagnosticsClient)||n.increment("analytics.events.dropped",e.length),null==(i=this.diagnosticsClient)||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:r,stack_trace:ts()})),this.removeEvents(e),e.forEach(function(e){return e.callback(te(e.event,t,r))})},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}(),tp=function(){function e(){this.name="identity",this.type="before",this.identityStore=e5().identityStore}return e.prototype.execute=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return e.instanceName&&(this.identityStore=e5(e.instanceName).identityStore),[2]})})},e}(),tg=r(12539);(f=Z||(Z={})).SET="$set",f.SET_ONCE="$setOnce",f.ADD="$add",f.APPEND="$append",f.PREPEND="$prepend",f.REMOVE="$remove",f.PREINSERT="$preInsert",f.POSTINSERT="$postInsert",f.UNSET="$unset",f.CLEAR_ALL="$clearAll",(h=ee||(ee={})).IDENTIFY="$identify",h.GROUP_IDENTIFY="$groupidentify",h.REVENUE="revenue_amount";var tv=function(e,t){return(0,eI.Cl)((0,eI.Cl)({},t),{event_type:ee.IDENTIFY,user_properties:e.getUserProperties()})},tm=function(e,t,r,n){var i;return(0,eI.Cl)((0,eI.Cl)({},n),{event_type:ee.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:((i={})[e]=t,i)})},ty=function(e,t,r){var n,i=new tg.T$;return i.set(e,t),(0,eI.Cl)((0,eI.Cl)({},r),{event_type:ee.IDENTIFY,user_properties:i.getUserProperties(),groups:((n={})[e]=t,n)})},tb=r(25501),tw=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.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));(0,tb.a)(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?(0,eI.Cl)({},this.properties):{};return e[et.REVENUE_PRODUCT_ID]=this.productId,e[et.REVENUE_QUANTITY]=this.quantity,e[et.REVENUE_PRICE]=this.price,e[et.REVENUE_TYPE]=this.revenueType,e[et.REVENUE_CURRENCY]=this.currency,e[et.REVENUE]=this.revenue,e[et.RECEIPT]=this.receipt,e[et.RECEIPT_SIG]=this.receiptSig,e},e}();(p=et||(et={})).REVENUE_PRODUCT_ID="$productId",p.REVENUE_QUANTITY="$quantity",p.REVENUE_PRICE="$price",p.REVENUE_TYPE="$revenueType",p.REVENUE_CURRENCY="$currency",p.REVENUE="$revenue",p.RECEIPT="$receipt",p.RECEIPT_SIG="$receiptSig";var tS=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},tE=r(64869),tk=r.n(tE)()||tE,tC=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var r,n;return(0,eI.sH)(this,void 0,void 0,function(){var i;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(void 0===e.name&&(e.name=eR(),this.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."))),i=e.name,this.pluginStatus.has(i))return this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2];return e.type=null!=(r=e.type)?r:"enrichment",this.pluginStatus.set(i,"locked"),[4,null==(n=e.setup)?void 0:n.call(e,t,this.client)];case 1:if(o.sent(),"locked"!==this.pluginStatus.get(i))return[2];return this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2]}})})},e.prototype.deregister=function(e,t){var r;return(0,eI.sH)(this,void 0,void 0,function(){var n,i;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(this.pluginStatus.delete(e),-1===(n=this.plugins.findIndex(function(t){return t.name===e})))return t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2];return i=this.plugins[n],this.plugins.splice(n,1),[4,null==(r=i.teardown)?void 0:r.call(i)];case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null==(t=e.teardown)?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(r){t.queue.push([e,r]),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(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s,a,l,u,c,d,f,h,p,g;return(0,eI.YH)(this,function(v){switch(v.label){case 0:if(!e)return[2];t=(0,eI.zs)(e,1)[0],r=(0,eI.zs)(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),n=this.plugins.filter(function(e){return"before"===e.type}),v.label=1;case 1:v.trys.push([1,6,7,8]),o=(i=(0,eI.Ju)(n)).next(),v.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,eI.Cl)({},t))];case 3:if(null===(a=v.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),r({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),v.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return f={error:v.sent()},[3,8];case 7:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(f)throw f.error}
1return[7];case 8:l=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),v.label=9;case 9:v.trys.push([9,14,15,16]),c=(u=(0,eI.Ju)(l)).next(),v.label=10;case 10:if(c.done)return[3,13];if(!(s=c.value).execute)return[3,12];return[4,s.execute((0,eI.Cl)({},t))];case 11:if(null===(a=v.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),r({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),v.label=12;case 12:return c=u.next(),[3,10];case 13:return[3,16];case 14:return p={error:v.sent()},[3,16];case 15:try{c&&!c.done&&(g=u.return)&&g.call(u)}finally{if(p)throw p.error}return[7];case 16:return d=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(t))),Promise.all(d.map(function(e){var r=(0,eI.Cl)({},t);return e.execute(r).catch(function(e){return te(r,0,String(e))})})).then(function(e){var n=(0,eI.zs)(e,1)[0]||te(t,100,"Event not tracked, no destination plugins on the instance");r(n)}),[2]}})})},e.prototype.flush=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t=this;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return r.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return r.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onIdentityChanged)||r.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onSessionIdChanged)||r.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onOptOutChanged)||r.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),r=(t=(0,eI.Ju)(this._optOutListeners)).next(),a.label=1;case 1:if(r.done)return[3,6];n=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,n(e)];case 3:return a.sent(),[3,5];case 4:return i=a.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return o={error:a.sent()},[3,9];case 8:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null==(t=e.onReset)||t.call(e)})},e}(),tI=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 tC(this),this.name=e}return e.prototype._init=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t=this;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return r.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n,i,o,s,a;return(0,eI.YH)(this,function(l){switch(l.label){case 0:r=this[e],this[e]=[],l.label=1;case 1:l.trys.push([1,8,9,10]),i=(n=(0,eI.Ju)(r)).next(),l.label=2;case 2:if(i.done)return[3,7];if(!((o=(0,i.value)())&&"promise"in o))return[3,4];return[4,o.promise];case 3:return l.sent(),[3,6];case 4:return[4,o];case 5:l.sent(),l.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return s={error:l.sent()},[3,10];case 9:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}
1return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e,t)];case 11:return l.sent(),[3,13];case 12:null==t||t(),l.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,r){var n=(0,eI.Cl)((0,eI.Cl)((0,eI.Cl)({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ex(this.dispatch(n))},e.prototype.identify=function(e,t){var r=tv(e,t);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ex(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=tm(e,t,r,n);return ex(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=ty(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ex(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=(0,eI.Cl)((0,eI.Cl)({},t),{event_type:ee.REVENUE,event_properties:e.getEventProperties()});return ex(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ex())},e.prototype._addPlugin=function(e){return ex(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)),ex())},e.prototype._removePlugin=function(e){return ex(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(te(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t=this;return(0,eI.YH)(this,function(r){return this.isReady?[2,this.process(e)]:[2,new Promise(function(r){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,r))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,r=null!=(t=this.userProperties)?t:{},n=(0,eI.Cl)({},r);if(void 0===e)return n;var i={};return Object.keys(e).forEach(function(t){Object.values(Z).includes(t)||(i[t]=e[t])}),tg.Se.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];switch(t){case Z.CLEAR_ALL:Object.keys(n).forEach(function(e){delete n[e]});break;case Z.UNSET:Object.keys(r).forEach(function(e){delete n[e]});break;case Z.SET:Object.assign(n,r)}}}),Object.assign(n,i),n},e.prototype.process=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),this.config.optOut)return[2,te(e,0,"Event skipped due to optOut config")];if("string"!=typeof(t=e.event_type)||0===t.trim().length)return this.config.loggerProvider.error(e7),[2,te(e,0,e7)];return e.event_type===ee.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[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 n=String(i.sent()),this.config.loggerProvider.error(n),[2,r=te(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,!!e))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ex(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});return void 0===t?void this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e)):t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),tx=function(e,t){var r,n,i;return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1&&("string"!=typeof(null==(n=null==(r=null==(i=(0,eO.m)())?void 0:i.chrome)?void 0:r.runtime)?void 0:n.id)||!!(null==e?void 0:e[t]))},tT=function(e){return tx(e,"attribution")},tP=function(e){return tx(e,"formInteractions")},t_=function(e){return tx(e,"pageViews")},tO=function(e){return tx(e,"sessions")},tA=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},tR=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},tM=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tD=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;if(!0===t)return{mainThreadBlock:!0};if("object"==typeof t&&null!==t)return t}},tL=function(e){if(tR(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},tN=function(e){if(tM(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tH=function(e){if(tA(e.autocapture)){var t,r,n=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.
1networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),(0,eI.Cl)((0,eI.Cl)({},n),{captureRules:(t=null==n?void 0:n.captureRules,r=e.loggerProvider,null==t?void 0:t.map(function(e){var t,n;if((null==(t=e.urls)?void 0:t.length)&&(null==(n=e.hosts)?void 0:n.length)){var i=JSON.stringify(e.hosts),o=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,eI.Cl)((0,eI.Cl)({},e),{hosts:void 0})}return e}))})}},tU=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return t_(e.defaultTracking)&&(r=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:r,trackHistoryChanges:n,eventType:t,pageCounter:i}},tF=function(e){if(tP(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},tj=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,s=n.resolve,a=e&&e[i];if("function"==typeof a){var l=a.apply(e,o);"function"==typeof s&&s(null==l?void 0:l.promise)}}return e},tq=function(e){return e&&void 0!==e._q},tB=function(e){var t,r;return"string"==typeof(null==(r=null==(t=e.chrome)?void 0:t.runtime)?void 0:r.id)},tz=function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t},tY=function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t},tJ=function(e){var t,r;return"string"==typeof(null==(r=null==(t=e.process)?void 0:t.versions)?void 0:r.node)},tW=function(){if("u"<typeof navigator)return"";var e,t,r,n,i=navigator.userLanguage;return null!=(n=null!=(r=null!=(t=null==(e=navigator.languages)?void 0:e[0])?t:navigator.language)?r:i)?n:""},tV="2.45.8",tK="amplitude-ts",t$=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(tK,"/").concat(tV),"u">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,r;return(0,eI.sH)(this,void 0,void 0,function(){var n,i,o;return(0,eI.YH)(this,function(s){return n=new Date().getTime(),i=null!=(t=this.config.lastEventId)?t:-1,o=null!=(r=e.event_id)?r:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=n),[2,(0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:n},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:tW()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:eR(),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}(),tX=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return[2,(t=r.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),tG=function(){var e,t=(0,eO.m)();return null==(e=null==t?void 0:t.navigator)?void 0:e.locks},tQ=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,eI.Cl)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,eI.YH)(this,function(o){switch(o.label){case 0:return t="AMP_TEST",r=new e((0,eI.Cl)({},this.options)),n=String(Date.now()),[4,r.transaction(t,function(e){var r,o;try{e.set(n);var s=e.get()===n;return!s&&i.config.diagnosticsClient&&(null==(r=i.config.diagnosticsClient)||r.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:n,sync:!0})),s}catch(e){if(i.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null==(o=i.config.diagnosticsClient)||o.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:n,error:a,sync:!0})}return!1}
1finally{e.set(null)}})];case 1:return[2,o.sent()]}})})},e.prototype.get=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:return t=r.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var r=t1(t);if(void 0===r)return void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t));return JSON.parse(r)}catch(r){console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t));return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,r;return(0,eI.sH)(this,void 0,void 0,function(){var n,i,o,s,a,l,u,c;return(0,eI.YH)(this,function(d){switch(d.label){case 0:n=(0,eO.m)(),d.label=1;case 1:if(d.trys.push([1,4,,5]),!(i=null==n?void 0:n.cookieStore))return[3,3];return[4,i.getAll(e)];case 2:if(o=d.sent()){o.length>1&&(null==(t=this.config.diagnosticsClient)||t.recordEvent("cookies.duplicate",{cookies:o.map(function(e){return e.domain})}),null==(r=this.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(s=(0,eI.Ju)(o)).next();!a.done;a=s.next())if(l=a.value,t2(l.domain,this.options.domain))return[2,l.value]}catch(e){u={error:e}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}}}d.label=3;case 3:return[3,5];case 4:return d.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,r,n=this,i=(0,eO.m)(),o=(null!=(r=null==(t=null==i?void 0:i.document)?void 0:t.cookie.split("; "))?r:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var r;try{var i=a(t.substring(e.length+1));return i||null==(r=n.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var r;try{var n=(0,eO.m)();if(!n||!n.document||"function"!=typeof n.btoa||"function"!=typeof n.encodeURIComponent)return;var i=null!=(r=this.options.expirationDays)?r:0,o=null!==t?i:-1,s=void 0;if(o){var a=new Date;a.setTime(a.getTime()+24*o*36e5),s=a}var l="".concat(e,"=").concat(n.btoa(n.encodeURIComponent(JSON.stringify(t))));s&&(l+="; expires=".concat(s.toUTCString())),l+="; path=/",this.options.domain&&(l+="; domain=".concat(this.options.domain)),this.options.secure&&(l+="; Secure"),this.options.sameSite&&(l+="; SameSite=".concat(this.options.sameSite)),n.document.cookie=l}catch(t){var u=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(u))}},e.prototype.remove=function(e){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(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(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return[2]})})},e.isDomainWritable=function(t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];r="AMP_TLDTEST",n=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.transaction(r,function(r){if(e.cachedTlds[t])return!0;try{r.set(1);var n=!!r.get();return n&&(e.cachedTlds[t]=!0),n}finally{r.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n,i=this;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(r=tG(),n=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!r)return[2,n()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.request("com.amplitude:cookie-lock:".concat(e),n)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,n()];case 4:return[2]}})})},e.cachedTlds={},e}(),tZ=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},t0=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},t1=function(e){var t;
1return null!=(t=tZ(e))?t:t0(e)},t2=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,n=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===n.toLowerCase()},t3=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),[e4.r,t,e.substring(0,r)].filter(Boolean).join("_")},t4=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return i.sent(),[4,r.get(n)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:if(!(t=r.sent()))return[2,void 0];return[2,JSON.parse(t)];case 2:return r.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(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return[2,(null==(t=this.storage)?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var r;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(n){try{null==(r=this.storage)||r.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),t5=function(e){function t(t){var r,n,i,o=this;try{i=null==(r=(0,eO.m)())?void 0:r.localStorage}catch(e){null==(n=null==t?void 0:t.loggerProvider)||n.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return(0,eI.C6)(t,e),t.prototype.set=function(t,r){var n;return(0,eI.sH)(this,void 0,void 0,function(){var i;return(0,eI.YH)(this,function(o){switch(o.label){case 0:if(!(Array.isArray(r)&&r.length>1e3))return[3,2];return i=r.length-1e3,[4,e.prototype.set.call(this,t,r.slice(0,1e3))];case 1:return o.sent(),null==(n=this.loggerProvider)||n.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(t4),t6=function(e){function t(){var t;return e.call(this,null==(t=(0,eO.m)())?void 0:t.sessionStorage)||this}return(0,eI.C6)(t,e),t}(t4);function t8(){return"u">typeof CompressionStream}function t7(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,new Response(new Blob([e]).stream().pipeThrough(new t("gzip"))).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var t9=function(){function e(){}return e.prototype.send=function(e,t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,r,n,i,o,s,a,l,u,c,d,f,h,p,g,v,m,y,b,w,S,E,k=e.code||0,C=this.buildStatus(k);switch(C){case Q.Success:return{status:C,statusCode:k,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(r=e.payload_size_bytes)?r:0,serverUploadTime:null!=(n=e.server_upload_time)?n:0}};case Q.Invalid:return{status:C,statusCode:k,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(s=e.events_with_invalid_fields)?s:{},eventsWithMissingFields:null!=(a=e.events_with_missing_fields)?a:{}
1,eventsWithInvalidIdLengths:null!=(l=e.events_with_invalid_id_lengths)?l:{},epsThreshold:null!=(u=e.eps_threshold)?u:0,exceededDailyQuotaDevices:null!=(c=e.exceeded_daily_quota_devices)?c:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(f=e.silenced_events)?f:[],throttledDevices:null!=(h=e.throttled_devices)?h:{},throttledEvents:null!=(p=e.throttled_events)?p:[]}};case Q.PayloadTooLarge:return{status:C,statusCode:k,body:{error:null!=(g=e.error)?g:""}};case Q.RateLimit:return{status:C,statusCode:k,body:{error:null!=(v=e.error)?v:"",epsThreshold:null!=(m=e.eps_threshold)?m:0,throttledDevices:null!=(y=e.throttled_devices)?y:{},throttledUsers:null!=(b=e.throttled_users)?b:{},exceededDailyQuotaDevices:null!=(w=e.exceeded_daily_quota_devices)?w:{},exceededDailyQuotaUsers:null!=(S=e.exceeded_daily_quota_users)?S:{},throttledEvents:null!=(E=e.throttled_events)?E:[]}};case Q.Timeout:default:return{status:C,statusCode:k}}},e.prototype.buildStatus=function(e){return to(e)?Q.Success:429===e?Q.RateLimit:413===e?Q.PayloadTooLarge:408===e?Q.Timeout:e>=400&&e<500?Q.Invalid:e>=500?Q.Failed:Q.Unknown},e}(),re=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.state={done:4},r.customHeaders=t,r}return(0,eI.C6)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,eI.sH)(this,void 0,void 0,function(){var n=this;return(0,eI.YH)(this,function(i){return[2,new Promise(function(i,o){"u"<typeof XMLHttpRequest&&o(Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",e,!0),s.onreadystatechange=function(){if(s.readyState===n.state.done){var e=s.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(e){i(n.buildResponse({code:s.status}))}}};var a={"Content-Type":"application/json",Accept:"*/*"},l=JSON.stringify(t),u=r&&l.length>=2048&&t8(),c=function(e){var t,r;a=(0,eI.Cl)((0,eI.Cl)({},n.customHeaders),a);try{for(var i=(0,eI.Ju)(Object.entries(a)),o=i.next();!o.done;o=i.next()){var l=(0,eI.zs)(o.value,2),u=l[0],c=l[1];s.setRequestHeader(u,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}s.send(e)};(0,eI.sH)(n,void 0,void 0,function(){var e;return(0,eI.YH)(this,function(t){switch(t.label){case 0:if(!u)return[3,2];return[4,t7(l)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(l),[3,3];case 2:c(l),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(t9),rt=function(e){function t(t,r,n){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==r,i.referrerPolicy=n,i}return(0,eI.C6)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,eI.sH)(this,void 0,void 0,function(){var n,i,o,s,a,l,u,c,d;return(0,eI.YH)(this,function(f){switch(f.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");if(n=JSON.stringify(t),i=r&&n.length>=2048&&t8(),o=n,s={"Content-Type":"application/json",Accept:"*/*"},!i)return[3,2];return[4,t7(n)];case 1:(a=f.sent())&&(s["Content-Encoding"]="gzip",o=a),f.label=2;case 2:return s=(0,eI.Cl)((0,eI.Cl)({},this.customHeaders),s),l="string"==typeof o?o.length:o.byteLength,u={headers:s,body:o,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(u.referrerPolicy=this.referrerPolicy),[4,fetch(e,u)];case 3:return[4,(c=f.sent()).text()];case 4:d=f.sent();try{return[2,this.buildResponse(JSON.parse(d))]}catch(e){return[2,this.buildResponse({code:c.status})]}}})})},t}(t9),rr=function(e){function t(){return e.call(this)||this}return(0,eI.C6)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,eI.sH)(this,void 0,void 0,function(){var r=this;return(0,eI.YH)(this,function(n){return[2,new Promise(function(n,i){var o=(0,eO.m)();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,s))return n(r.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return n(r.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(t9),rn=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},ri=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},ro="[Amplitude]",rs="".concat(ro," Form Started"),ra="".concat(ro," Form Submitted"),rl="".concat(ro," File Downloaded"),ru="session_start",rc="session_end",rd="".concat(ro," File Extension"),rf="".concat(ro," File Name"),rh="".concat(ro," Link ID"),rp="".concat(ro," Link Text"),rg="".concat(ro," Link URL"),rv="".concat(ro," Form ID"),rm="".concat(ro," Form Name"),ry="".concat(ro," Form Destination"),rb="cookie",rw={always:"always",ifEmptyCampaign:"ifEmptyCampaign"},rS=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rE=function(e,t,r,n,i,o){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,a=(0,eI.Tt)(e,["referrer","referring_domain"]),l=t||{},u=(l.referrer,l.referring_domain),c=(0,eI.Tt)(l,["referrer","referring_domain"]),d=r.excludeInternalReferrers;if(d){var f=rx(d,n);if(!(f instanceof TypeError)&&e.referring_domain&&rO(e.referring_domain,o)){if
1("always"===f)return rT(f,e.referring_domain,n),!1;else if("ifEmptyCampaign"===f&&Object.values((0,eI.Cl)((0,eI.Cl)({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e}))return rT(f,e.referring_domain,n),!1}}if(rk(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&Object.values(e).every(function(e){return!e})&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var h=JSON.stringify(a)!==JSON.stringify(c),p=rS(s||"")!==rS(u||""),g=!t||h||p;return g?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),g},rk=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})},rC=function(e,t){var r=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(r)},rI=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},rx=function(e,t){if(!0===e)return rw.always;if("object"==typeof e){var r=e.condition;if("string"==typeof r&&Object.keys(rw).includes(r))return r;if(void 0===r)return rw.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),TypeError(n)};function rT(e,t,r){var n="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?r.debug(n):"ifEmptyCampaign"===e&&r.debug("".concat(n," with empty campaign parameters"))}var rP=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],r_=function(e){var t,r,n=e||(null==(r=null==(t=(0,eO.m)())?void 0:t.location)?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],s=i[i.length-2];return(rP.find(function(e){return n.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s)?"".concat(s,".").concat(o):o},rO=function(e,t){var r=(0,eO.m)();return!!r&&rC(e,(t||"").trim()||r_(r.location.hostname))},rA=function(e){function t(t,r,n,i,o,s,a,l,u,c,d,f,h,p,g,v,m,y,b,w,S,E,k,C,I,x,T,P,_,O,A,R,M,D,L,N,H,U,F,j,q,B,z,Y){void 0===n&&(n=new tX),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===l&&(l=1e3),void 0===u&&(u=5),void 0===c&&(c=30),void 0===d&&(d=rb),void 0===v&&(v=new eP),void 0===m&&(m=G.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===C&&(C="US"),void 0===T&&(T=18e5),void 0===P&&(P=new t5({loggerProvider:v})),void 0===_&&(_={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===z&&(z=!1);var J,W=this;(W=e.call(this,{apiKey:t,storageProvider:P,transportProvider:rD(O)})||this).apiKey=t,W.appVersion=r,W.cookieOptions=i,W.defaultTracking=o,W.autocapture=s,W.flushIntervalMillis=l,W.flushMaxRetries=u,W.flushQueueSize=c,W.identityStorage=d,W.ingestionMetadata=f,W.instanceName=h,W.loggerProvider=v,W.logLevel=m,W.minIdLength=y,W.offline=b,W.partnerId=S,W.plan=E,W.serverUrl=k,W.serverZone=C,W.sessionTimeout=T,W.storageProvider=P,W.trackingOptions=_,W.transport=O,W.useBatch=A,W.fetchRemoteConfig=R,W.networkTrackingOptions=N,W.identify=H,W.enableDiagnostics=U,W.diagnosticsSampleRate=F,W.diagnosticsClient=j,W.remoteConfig=q,W.topLevelDomain=B,W.enableRequestBodyCompression=z,W.customEnrichment=Y,W.version=tV,W._optOut=!1,W._cookieStorage=n,W.deviceId=a,W.lastEventId=p,W.lastEventTime=g,W.optOut=w,W.deferredSessionId=x,W.sessionId=I,W.page
1Counter=D,W.userId=M,W.debugLogsEnabled=L,W.loggerProvider.enable(L?G.Debug:W.logLevel),W.networkTrackingOptions=N,W.identify=H,W.enableDiagnostics=U,W.diagnosticsSampleRate=F,W.diagnosticsClient=j;var V=null!=(J=null==q?void 0:q.fetchRemoteConfig)?J:R;return W.remoteConfig=W.remoteConfig||{},W.remoteConfig.fetchRemoteConfig=V,W.fetchRemoteConfig=V,W.topLevelDomain=B||r_(),W}return(0,eI.C6)(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,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=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,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof tQ&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(t3(this.apiKey),e)},t}(tr),rR=function(e,t,r){switch(void 0===e&&(e=rb),void 0===t&&(t={}),e){case"localStorage":return new t5;case"sessionStorage":return new t6;case"none":return new tX;default:return new tQ((0,eI.Cl)((0,eI.Cl)({},t),{expirationDays:t.expiration}),r)}},rM=function(e){var t,r;return void 0===e&&(e={}),(null==(t=e.remoteConfig)?void 0:t.fetchRemoteConfig)===!0||(null==(r=e.remoteConfig)?void 0:r.fetchRemoteConfig)!==!1&&!1!==e.fetchRemoteConfig},rD=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0,n="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new re(r):"beacon"===t?new rr:new rt(r,n,i)},rL="data-amp-mask",rN="*****",rH=/\b(?:\d[ -]*?){13,16}\b/,rU=/(\d{3}-?\d{2}-?\d{4})/g,rF=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,rj=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var r,n,i=e;i=(i=(i=i.replace(rH,rN)).replace(rU,rN)).replace(rF,rN);try{for(var o=(0,eI.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,rN)}catch(e){}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},rq=function(e){if("u"<typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(rL)?rN:e?e(document.title):document.title},rB=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},rz=function(){function e(){}return e.prototype.parse=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return[2,(0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)({},e4.F3),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=e$();return{utm_campaign:e[e4._9],utm_content:e[e4.fL],utm_id:e[e4.Cs],utm_medium:e[e4.Jn],utm_source:e[e4.VU],utm_term:e[e4.Wx]}},e.prototype.getReferrer=function(){var e,t,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=null!=(t=null==(e=r.referrer)?void 0:e.split("/")[2])?t:void 0}catch(e){}return r},e.prototype.getClickIds=function(){var e,t=e$();return(e={})[e4.h2]=t[e4.h2],e[e4.lT]=t[e4.lT],e[e4.wX]=t[e4.wX],e[e4.q2]=t[e4.q2],e[e4.KY]=t[e4.KY],e[e4.Ct]=t[e4.Ct],e[e4.qr]=t[e4.qr],e[e4.wu]=t[e4.wu],e[e4.tt]=t[e4.tt],e[e4.Gp]=t[e4.Gp],e[e4.SO]=t[e4.SO],e},e}(),rY="AMP_PAGE_VIEW",rJ=function(e){void 0===e&&(e={});var t,r,n,i=(0,eO.m)(),o=void 0,s=!1,a=e.trackOn,l=e.trackHistoryChanges,u=e.eventType,c=void 0===u?"[Amplitude] Page Viewed":u,d=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},f=function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){var t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:return t=d("u">typeof location&&location.href||""),n={event_type:c},r=[{}],[4,rW()];case 1:return[2,(n.event_properties=eI.Cl.apply(void 0,[eI.Cl.apply(void 0,r.concat([i.sent()])),{"[Amplitude] Page Domain":"u">typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"u">typeof location&&d(location.pathname)||"","[Amplitude] Page Title":rq(rj),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),n)]}})})},h=function(){return void 0===a||"function"==typeof a&&a()},p="u">typeof location?location.href:null,g=function(){(0,eI.sH)(void 0,void 0,void 0,function(){var e,r,i,s,a;return(0,eI.YH)(this,function(u){switch(u.label){case 0:if(r=rK(l,e=location.href,p||"")&&h(),p=e,!r)return[3,4];if(i=void 0,n&&(i=eR(),n.set(rY,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return a=(s=t).track,[4,f(i)];case 2:a.apply(s,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return(0,eI.sH)(void 0,void 0,void 0,function(){var l,u,c;return(0,eI.YH)(this,function(d){switch(d.label){case 0:if(t=a,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,i){try{n=new t4(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",g),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,r){var n=(0,eI.zs)(r,3),i=n[0],o=n[1],a=n[2];e.apply(t,[i,o,a]),s&&g()}})}if(!h())return[3,2];return o.log("Tracking page view event"),l=void 0,n&&(l=eR(),n.set(rY,{pageViewId:l})),c=(u=t).track,[4,f(l)];case 1:c.apply(u,[d.sent()]),d.label=2;case 2:return[2]}})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){var t,i,s;return(0,eI.YH)(this,function(l){switch(l.label){case 0:if(!("attribution"===a&&rV(e)))return[3,4];
1if(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,!n)return[3,2];return[4,n.get(rY)];case 1:t=null==(i=l.sent())?void 0:i.pageViewId,l.label=2;case 2:return[4,f(t)];case 3:e.event_type=(s=l.sent()).event_type,e.event_properties=(0,eI.Cl)((0,eI.Cl)({},e.event_properties),s.event_properties),l.label=4;case 4:return r&&e.event_type===c&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=(0,eI.Cl)((0,eI.Cl)({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return i&&(i.removeEventListener("popstate",g),s=!1),[2]})})}}},rW=function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e;return(0,eI.YH)(this,function(t){switch(t.label){case 0:return e=rB,[4,new rz().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},rV=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[Z.SET]||{},n=t[Z.UNSET]||{},i=(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(Object.keys(r)),!1),(0,eI.zs)(Object.keys(n)),!1);return Object.keys(e4.F3).every(function(e){return i.includes(e)})}return!1},rK=function(e,t,r){if("pathOnly"!==e)return t!==r;if(""==r)return!0;var n=new URL(t),i=new URL(r);return n.origin+n.pathname!==i.origin+i.pathname},r$=function(){var e,t,r=[],n=function(e,t,n){e.addEventListener(t,n),r.push({element:e,type:t,handler:n})},i=function(){r.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),r=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(r,i){return(0,eI.sH)(void 0,void 0,void 0,function(){var o,s;return(0,eI.YH)(this,function(a){return t=tF(r),o=function(){if(!i)return void r.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");if("u">typeof document){var o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;n(e,"change",function(){var t,r=rG(e);s||i.track(rs,((t={})[rv]=rX(e.id),t[rm]=rX(e.name),t[ry]=r,t)),s=!0}),n(e,"submit",function(n){var o,a,l=rG(e);if(s||i.track(rs,((o={})[rv]=rX(e.id),o[rm]=rX(e.name),o[ry]=l,o)),s=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0)if("function"==typeof t.shouldTrackSubmit&&"u">typeof SubmitEvent&&n instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(n))return}catch(e){r.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else r.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(ra,((a={})[rv]=rX(e.id),a[rm]=rX(e.name),a[ry]=l,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(s)}}catch(e){r.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=(0,eO.m)())?s.addEventListener("load",o):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},rX=function(e){if("string"==typeof e)return e},rG=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},rQ=function(){var e,t=[],r=function(e,r,n){e.addEventListener(r,n),t.push({element:e,type:r,handler:n})},n=function(){t.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,n){return(0,eI.sH)(void 0,void 0,void 0,function(){var i,o;return(0,eI.YH)(this,function(s){return i=function(){if(!n)return void t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");if("u">typeof document){var i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&r(e,"click",function(){var r;s&&n.track(rl,((r={})[rd]=s,r[rf]=t.pathname,r[rh]=e.id,r[rp]=e.text,r[rg]=e.href,r))})},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)(\?.+)?$/;
1Array.from(document.getElementsByTagName("a")).forEach(i),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var r=e.querySelectorAll("a");null==r||r.forEach(i)}}catch(e){t.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=(0,eO.m)())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},rZ=!1,r0=function(e){rZ||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."),rZ=!0)},r1=function(){var e=(0,eO.m)(),t=[],r=function(r,n){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(r,n),t.push({type:r,handler:n}))},n=function(){t.forEach(function(t){var r=t.type,n=t.handler;null==e||e.removeEventListener(r,n)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(n){return"u"<typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1):(e.offline=!navigator.onLine,r("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),r("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return n(),[2]})})}}};function r2(e,t,r){var n,i,o=[];try{for(var s=(0,eI.Ju)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var l=a.value;try{o.push(new RegExp(l))}catch(e){r.warn("Invalid regex pattern: ".concat(l),e)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e.concat(o)}var r3=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],r4="data-amp-track-",r5=["div","span","h1","h2","h3","h4","h5","h6"],r6=r(87158),r8=r.n(r6);function r7(e,t){return new(r8())(function(r){e.subscribe({next:function(e){t(e).then(function(e){return r.next(e)}).catch(function(e){return r.error(e)})},error:function(e){r.error(e)},complete:function(){r.complete()}})})}function r9(e,t){return new(r8())(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=(0,eI.Ju)(i),o=r.next();!o.done;o=r.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){n||r.next(e)},error:function(e){n||(n=!0,r.error(e),o())},complete:function(){i.delete(t),n||0!==i.size||(r.complete(),o(),n=!0)}});i.add(t)};return s(e),s(t),o})}function ne(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new(r8())(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){try{for(var r,n,i,o=(0,eI.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.next)||i.call(a,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},error:function(e){try{for(var r,i,o,s=(0,eI.Ju)(t),a=s.next();!a.done;a=s.next()){var l=a.value;null==(o=l.error)||o.call(l,e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}n()},complete:function(){try{for(var e,r,i,o=(0,eI.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.complete)||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}n()}})),function(){t.delete(i),0===t.size&&r&&(r.unsubscribe(),r=null)}})}var nt="https://app.amplitude.com",nr={US:nt,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},nn="__AMPLITUDE_MESSENGER_INSTANCE__",ni="__AMPLITUDE_MESSENGER__",no=function(){function e(e){var t=(void 0===e?{}:e).origin;this[er]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=void 0===t?nt:t}return e.prototype.notify=function(e){var t,r,n,i;null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Message sent: ",JSON.stringify(e)),null==(i=null==(n=window.opener)?void 0:n.postMessage)||i.call(n,e,this.endpoint)},e.prototype.sendRequest=function(e,t,r){var n=this;void 0===r&&(r={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){n.requestCallbacks[i]={resolve:t,reject:s},n.notify(o),r.timeout>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete n.requestCallbacks[i]},r.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null==(t=this.logger)||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){this.actionHandlers.has(e)&&(null==(o=null==(i=this.logger)?void 0:i.warn)||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var r,n,i,o,s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=(0,eI.Ju)(s),l=a.next();!l.done;l=a.next()){var u=l.value;t(u)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];r=(document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,r){var n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),null==(n=document.head)||n.appendChild(i)}catch(e){r(e)}})).then(function(){}),this.scriptLoadPromises.set(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),this.scriptLoadPromises.delete(e),n;case 4:return[2]}})})},e.prototype.setup=function(e){var t,r,n=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===nt&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null==(r=null==(t=n.logger)?void 0:t.debug)||r.call(t,"Message received: ",JSON.stringify(e)),n.endpoint===e.origin){var t,r,i,o,s,a=e.data,l=null==a?void 0:a.action;if(l)if("id"in a&&a.id)null==(o=null==(i=n.logger)?void 0:i.debug)||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),n.handleResponse(a
1);else{if("ping"===l)return void n.notify({action:"pong"});var u=n.actionHandlers.get(l);if(u)u(a.data);else{var c=null!=(s=n.pendingMessages.get(l))?s:[];c.push(a.data),n.pendingMessages.set(l,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=(0,eO.m)();(null==e?void 0:e[ni])===this&&delete e[ni]},e}();function ns(e){var t=(0,eO.m)(),r=null==t?void 0:t[ni];if("object"==typeof r&&null!==r&&nn in r&&!0===r[nn])return r;var n=new no(e);return t&&(t[ni]=n),n}er=nn;var na="__AMPLITUDE_BACKGROUND_CAPTURE__";function nl(e,t){var r;if(!0!==e[na]){e[na]=!0;var n=null!=(r=null==t?void 0:t.scriptUrl)?r:"https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",i=null,o=function(t,r){var n,i;"background-capture-complete"===t&&(null==(i=null==(n=e.logger)?void 0:n.debug)||i.call(n,"Background capture complete"),e.notify({action:"background-capture-complete",data:r}))};e.registerActionHandler("initialize-background-capture",function(){null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Initializing background capture (external script)");var t,r,s=new URL(n,e.endpoint).toString();e.loadScriptOnce(s).then(function(){var t,r,n;null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Background capture script loaded (external)"),i=null==(n=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:n.call(window,{messenger:e,onBackgroundCapture:o}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null==(e=null==i?void 0:i.close)||e.call(i),i=null})}}var nu="1.29.0",nc="[Amplitude] Element Clicked",nd="[Amplitude] Element Tag",nf="[Amplitude] Element Text",nh="[Amplitude] Page URL",np="[Amplitude] Viewport Height",ng="[Amplitude] Viewport Width",nv="[Amplitude] Page View ID",nm="data-amp-mask-attributes",ny="data-amp-internal-shadow",nb=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},nw=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},nS=":scope > ";function nE(e){return"u">typeof ShadowRoot&&e instanceof ShadowRoot}function nk(e,t){var r,n,i,o;return(0,eI.YH)(this,function(s){switch(s.label){case 0:r=e,n=0,i=0,s.label=1;case 1:if(!(null!==r&&i<1024))return[3,3];return i+=1,[4,r];case 2:if(s.sent(),r.parentElement)return r=r.parentElement,[3,1];if(n<t&&"function"==typeof r.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return nE(t)?t.host:null}(r))&&o!==r)return n+=1,r=o,[3,1];return[3,3];case 3:return[2]}})}function nC(e,t){var r=[];if(t<=0)return r;for(var n=[[e,0]],i=0;n.length&&i<5e4;){i+=1;var o=(0,eI.zs)(n.pop(),2),s=o[0],a=o[1],l=s.shadowRoot;if(l&&a+1<=t){r.push({root:l,depth:a+1});for(var u=l.children,c=0;c<u.length;c++)n.push([u[c],a+1])}for(var d=s.children,c=0;c<d.length;c++)n.push([d[c],a])}return r}function nI(e,t){for(var r=[],n=e,i=0;null!==n&&i<1024;){i+=1;var o=function(e){var t,r=e.getRootNode();return nE(r)?r:null!=(t=e.ownerDocument)?t:document}(n);r.push({root:o,target:n});var s=n.getRootNode();if(!nE(s))break;n=s.host}var a=r.length-1,l=!1,u=r;return a>t&&(u=r.slice(a-t),l=!0),{segments:u.reverse(),truncated:l}}function nx(e,t){for(var r=0,n=0;n<t.length;n++){var i=t[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var nT=Object.freeze({enabled:!1,maxDepth:0}),nP=function(e){var t,r=null!=(t=e.maxShadowDomDepth)?t:1;return!e.shadowDomEnabled||r<=0?nT:Object.freeze({enabled:!0,maxDepth:r})},n_=function(){var e=nT,t=new Set,r=function(e){var r,n;try{for(var i=(0,eI.Ju)((0,eI.fX)([],(0,eI.zs)(t),!1)),o=i.next();!o.done;o=i.next()){var s=o.value;try{s(e)}catch(e){}}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.clear()};return{get:function(){return e},arm:function(t){return e.enabled||!t.enabled||(e=t,r(t)),e},onArm:function(r){if(e.enabled){var n=e;try{r(n)}catch(e){}return function(){}}return t.add(r),function(){t.delete(r)}}}},nO=["input","select","textarea"],nA=function(e,t){var r,n=null==(r=null==window?void 0:window.getComputedStyle)?void 0:r.call(window,e);return(null==n?void 0:n.getPropertyValue("cursor"))==="pointer"&&"click"===t},nR=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&nb(window.location.href,r))&&!!nb(window.location.href,t)},nM=function(e,t){return function(r,n){var i,o,s=e.shouldTrackEventResolver,a=null==(o=null==(i=null==n?void 0:n.tagName)?void 0:i.toLowerCase)?void 0:o.call(i);if(!a)return!1;if(s)return s(r,n);if(!nR(e))return!1;var l=String(null==n?void 0:n.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t&&!t.some(function(e){var t;return!!(null==(t=null==n?void 0:n.matches)?void 0:t.call(n,e))}))return!1;switch(a){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return"click"===r}}},nD=function(e){var t,r,n,i=null==(r=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:r.call(t),o=e instanceof HTMLElement&&(null==(n=e.getAttribute("contenteditable"))?void 0:n.toLowerCase())==="true";return!nO.includes(i)&&!o},nL=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return null!=n&&("object"!=typeof n||0!==Object.keys(n).length)&&("string"!=typeof n||0!==n.trim().length)&&(t[r]=n),t},{})},nN=function(){var e;try{var t=(0,eO.m)(),r=null==(e=null==t?void 0:t.sessionStorage)?void 0:e.getItem("AMP_PAGE_VIEW");if(!r)return;var n=JSON.parse(r);if("string"==typeof n.pageViewId)return n.pageViewId}catch(e){}},nH=function(e,t,r){return(void 0===r&&(r=nT),r.enabled)?nF(e,t,r.maxDepth):nU(e,t)},nU=function(e,t){return e?t.some(function(t){var r;return null==(r=null==e?void 0:e.matches)?void 0:r.call(e,t)})?e:nU(null==e?void 0:e.parentElement,t):null},nF=function(e,t,r){if(!e)return null;var n,i,o=function(e){if(t.some(function(t){var r;return null==(r=null==e?void 0:e.matches)?void 0:r.call(e,t)}))return{value:e}};try{for(var s=(0,eI.Ju)(nk(e,r)),a=s.next();!a.done;a=s.next()){var l=a.value,u=o(l);if("object"==typeof u)return u.value}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return null},nj=function(e,t,r){return void 0===r&&(r=nT),r.enabled?nB(e,t,r.maxDepth):nq(e,t)},nq=function(e,t){var r=[];return t&&e.querySelectorAll(t).forEach(function(e){return r.push(e)}),r},nB=function(e,t,r){var n=nq(e,t),i=e instanceof Document?e.documentElement:e;return i&&nC(i,r).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return n.push(e)})}),n},nz=function(e,t){if(void 0===t&&(t=nT),!t.enabled)return e.target;var r,n,i=null==(r=e.composedPath)?void 0:r.call(e),o=null!=(n=e.target)?n:null;if(!i||0===i.length)return o;var s=i[0];if(!(s instanceof Element))return null!=s?s:o;var a=nI(s,t.maxDepth),l=a.segments;return a.truncated&&l.length>0?l[l.length-1].target:s},nY=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};function nJ(e){if(!e)return"";try{var t=new URL(e);return t.search="",nw(t.href)}catch(t){return nw(e)}}function nW(e){var t,r;return void 0===e&&(e=(0,eO.m)()),nJ(null!=(r=null==(t=null==e?void 0:e.location)?void 0:t.href)?r:"")}(g=ei||(ei={}))[g.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",g[g.MIDDLE=1]="MIDDLE",g[g.RIGHT=2]="RIGHT";var nV="__AMPLITUDE_VISUAL_TAGGING__",nK=(0,eO.m)(),n$=null==nK?void 0:nK.console,nX={},nG={},nQ=!1,nZ=function(e,t){if(!n$||"function"!=typeof n$[e]||!nG[e]&&(nG[e]=n$[e],n$[e]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{if(nX[e]&&!nQ){nQ=!0;var n=nX[e];
1n&&n.forEach(function(r){try{r(e,t)}catch(e){}})}}catch(e){}return nQ=!1,nG[e].apply(n$,t)},0))return Error("Console override failed");nX[e]?nX[e].push(t):nX[e]=[t]},n0=function(e){var t,r;try{for(var n=(0,eI.Ju)(Object.values(nX)),i=n.next();!i.done;i=n.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},n1=(0,eO.m)(),n2=function(e){return e.get()},n3={childList:!0,attributes:!0,characterData:!0,subtree:!0},n4=function(e){return new(r8())(e?function(t){var r,n=new WeakSet,i=new WeakMap,o=function(e,t){n.has(e)||(n.add(e),nE(e)&&i.set(e,t),l.observe(e,n3))},s=function(e,t,r){var n=r-t;n<=0||nC(e,n).forEach(function(e){return o(e.root,t+e.depth)})},a=function(e){var t=e.getRootNode();if(!nE(t))return 0;var r=i.get(t);return null!=r?r:0},l=new MutationObserver(function(r){var n,i;t.next(r);try{var o=n2(e);if(!o.enabled)return;try{for(var l=(0,eI.Ju)(r),u=l.next();!u.done;u=l.next()){var c=u.value;!function(e){var t=a(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&s(e,t,o.maxDepth)})}(c)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),r=e.onArm(function(e){s(u,0,e.maxDepth)})}return function(){null==r||r(),l.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},n5=function(e){return void 0===e&&(e="click"),new(r8())(function(t){var r,n=function(e){t.next(e)};return null==(r=(0,eO.m)())||r.document.addEventListener(e,n,{capture:!0}),function(){var t;null==(t=(0,eO.m)())||t.document.removeEventListener(e,n,{capture:!0})}})},n6=function(e,t,r,n){var i="function"==typeof r?r:void 0,o="function"==typeof r?n:r;return new(r8())(function(r){var n=(0,eO.m)();if(!(null==n?void 0:n.IntersectionObserver))return function(){};var s=new IntersectionObserver(function(e){e.forEach(function(e){r.next(e)})},{root:null,rootMargin:"0px",threshold:1}),a=t.join(","),l=function(e){e instanceof Element&&e.matches(a)&&s.observe(e),e.querySelectorAll(a).forEach(function(e){s.observe(e)})},u=function(e){if(o)try{nj(e,a,n2(o)).forEach(function(e){s.observe(e)})}catch(e){}},c=function(){var e=null==n?void 0:n.document;if(e){var t=[];try{t=o&&n2(o).enabled?nj(e,a,n2(o)):e.querySelectorAll(a)}catch(e){return}Array.from(t).forEach(function(e){s.unobserve(e),s.observe(e)})}};null==i||i(c),c();var d=null==o?void 0:o.onArm(function(){(null==n?void 0:n.document)&&u(n.document)}),f=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)return void l(e);if(e instanceof Element){if(!o||!n2(o).enabled)return void l(e);try{e.matches(a)&&s.observe(e)}catch(e){}u(e)}})})});return function(){null==i||i(void 0),null==d||d(),f.unsubscribe(),s.disconnect()}})},n8=function(){var e=r9(new(r8())(function(e){var t=function(t){if(t instanceof ErrorEvent){var r={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?r=(0,eI.Cl)((0,eI.Cl)({},r),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(r.message=t.error),e.next(r)}};return n1.addEventListener("error",t),function(){n1.removeEventListener("error",t)}}),new(r8())(function(e){var t=function(t){var r={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(r.message=t.reason.message,r.stack=t.reason.stack):"string"==typeof t.reason&&(r.message=t.reason),e.next(r)};return n1.addEventListener("unhandledrejection",t),function(){n1.removeEventListener("unhandledrejection",t)}}));return r9(e,new(r8())(function(e){var t=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=void 0;Array.isArray(r[0])&&"string"==typeof r[0][0]&&(i=r[0][0]),e.next({kind:"console",message:i})};return nZ("error",t),function(){n0(t)}}
1))},n7=function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){console.error("Error matching event to filter",e)}return!1},n9=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var r=document.documentElement;if(e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector)return r.querySelector(e.selector);return r}}catch(e){}},ie=function(e,t,r){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=r.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}})},it={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},ir=function(e){var t,r,n,i,o=Object.values(it).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,eI.Ju)(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{try{for(var u=(n=void 0,(0,eI.Ju)(l.definition)),c=u.next();!c.done;c=u.next()){var d=it[c.value.event_type];d&&o[d].add(l.id)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},ii=function(e){var t,r,n,i,o=new Map;try{for(var s=(0,eI.Ju)(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(n=void 0,(0,eI.Ju)(l.conditions)),c=u.next();!c.done;c=u.next()){var d=c.value;if("LABELED_EVENT"===d.type){var f=d.match.eventId,h=o.get(f);h||(h=[],o.set(f,h)),h.push(l)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},io=function(e,t){var r,n,i,o,s=new Set;try{for(var a=(0,eI.Ju)(e),l=a.next();!l.done;l=a.next()){var u=l.value,c=t.get(u.id);if(c)try{for(var d=(i=void 0,(0,eI.Ju)(c)),f=d.next();!f.done;f=d.next()){var h=f.value;s.add(h)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Array.from(s)},is=function(){function e(e,t,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=r,this.options=n}return e.prototype.evaluate=function(e){var t,r,n=this.options.pageActions;if(!n)return e;var i=io(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return it[t.event_type]===e.type&&t.filters.every(function(t){return n7(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,eI.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;ie(a.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=r},e}(),ia=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",nm,rL,ny]),il=["type"],iu=["svg","path","g"],ic=["password","hidden"];function id(e,t){return(void 0===t&&(t=nT),e)?t.enabled?function(e,t){var r,n,i=[];try{for(var o=(0,eI.Ju)(nk(e,t)),s=o.next();!s.done;s=o.next()){var a=s.value;if("HTML"===a.tagName)break;i.push(a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);for(var r=e.parentElement;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e):[]}var ih=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:(0,eI.fX)([],(0,eI.zs)([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:(0,eI.fX)([],(0,eI.zs)([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:!1,maxShadowDomDepth:1});function ip(e){var t;return(0,eI.Cl)((0,eI.Cl)({},e),{shadowDomEnabled:null!=(t=e.shadowDomEnabled)&&t,maxShadowDomDepth:iv(e.maxShadowDomDepth)})}function ig(e,t){if(!e)return im();var r=im();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var r,n,i=[];try{for(var o=(0,eI.Ju)(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var r,n,i=[];try{for(var o=(0,eI.Ju)(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth=function(e){if("number"==typeof e&&Number.isFinite(e)&&!(e<=0))return Math.floor(e)}(e.maxAncestorWalkDepth),"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=iv(e.maxShadowDomDepth),ip(r)}function iv(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}
1function im(){return{enabled:ih.enabled,explicitTrackingAttribute:ih.explicitTrackingAttribute,autogeneratedIdPatterns:(0,eI.fX)([],(0,eI.zs)(ih.autogeneratedIdPatterns),!1),unstableClassPatterns:(0,eI.fX)([],(0,eI.zs)(ih.unstableClassPatterns),!1),maxAncestorWalkDepth:ih.maxAncestorWalkDepth,shadowDomEnabled:ih.shadowDomEnabled,maxShadowDomDepth:ih.maxShadowDomDepth}}function iy(e,t){var r=e.getAttribute(t.explicitTrackingAttribute);if(null!==r&&""===r)return null;var n=e.getAttribute("id");return null===n||""===n||!function(e,t){var r,n;if(null==e||""===e)return!1;try{for(var i=(0,eI.Ju)(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}(n,t.autogeneratedIdPatterns)?null:n}function ib(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var r=String(e),n=r.length,i="",o=0;o<n;o++){var s=r.charCodeAt(o);if(0===s){i+="�";continue}if(s>=1&&s<=31||127===s||0===o&&s>=48&&s<=57||1===o&&s>=48&&s<=57&&45===r.charCodeAt(0)){i+="\\".concat(s.toString(16)," ");continue}if(0===o&&1===n&&45===s){i+="\\-";continue}if(s>=128||45===s||95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122){i+=r.charAt(o);continue}i+="\\".concat(r.charAt(o))}return i}function iw(e){var t=e.tagName.toLowerCase(),r=e.parentElement;if(null===r)return t;var n=function(e,t){for(var r=0,n=0;n<t.children.length;n++){var i=t.children[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}(e,r);return"".concat(t,":nth-of-type(").concat(n,")")}var iS=[{name:"explicitTrackingAttribute",try:function(e,t){var r=t.config.explicitTrackingAttribute,n=e.getAttribute(r);return null===n||""===n?null:"[".concat(r,"=").concat(JSON.stringify(n),"]")}},{name:"stableId",try:function(e,t){var r=iy(e,t.config);return null===r?null:"".concat(e.tagName.toLowerCase(),"#").concat(ib(r))}}];function iE(e,t,r,n,i){var o;try{o=e.querySelectorAll(t)}catch(e){var s=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(n,'" emitted a malformed selector "').concat(t,'" (').concat(s,")")),!1}return 1===o.length&&o[0]===r}var ik=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),iC=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=iI(n,!!t,n===e);if(!i||(r.push(i),i.optimized))break;n=n.parentElement}return r.reverse(),r.join(" > ")},iI=function(e,t,r){if(e.nodeType!==Node.ELEMENT_NODE)return null;var n,i,o=e.getAttribute("id");if(t){if(o)return new ik(iT(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new ik(s,!0)}var a=e.tagName.toLowerCase();if(o)return new ik(a+iT(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new ik(a,!0);for(var u=ix(e),c=!1,d=!1,f=-1,h=-1,p=l.children,g=0;p&&(-1===f||!d)&&g<p.length;++g){var v=p[g];if(v.nodeType===Node.ELEMENT_NODE){if(h+=1,v===e){f=h;continue}if(!d&&v.tagName.toLowerCase()===a){c=!0;var m=new Set(u);if(!m.size){d=!0;continue}for(var y=ix(v),b=0;b<y.length;++b){var w=y[b];if(m.has(w)&&(m.delete(w),!m.size)){d=!0;break}}}}}var S=a;if(r&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+ib(e.getAttribute("type")||"")+"]"),d)S+=":nth-child("+String(f+1)+")";else if(c)try{for(var E=(0,eI.Ju)(u),k=E.next();!k.done;k=E.next()){var C=k.value;S+="."+ib(C.slice(1))}}catch(e){n={error:e}}finally{try{k&&!k.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}return new ik(S,!1)},ix=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},iT=function(e){return"#"+ib(e)};function iP(e,t){try{return iC(e)}catch(e){var r=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(r)),""}}var i_=function(e,t){var r,n;return!!id(e,t).some(function(e){return e.hasAttribute(rL)})||null!=(n=null==(r=document.documentElement)?void 0:r.hasAttribute(rL))&&n},iO=function(e,t){var r,n,i,o,s,a,l,u,c,d,f,h=this;
1this.replaceSensitiveString=function(e){return rj(e,h.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,n,i,o=performance.now(),s=[];if(!e)return[];for(var a=h.getShadowMode(),l=id(e,a),u=new Map,c=l.length-1;c>=0;c--){var d=l[c];if(d){var f,p=(f=d.getAttribute(nm))?f.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],g=c===l.length-1?[]:null!=(n=u.get(l[c+1]))?n:new Set,v=new Set((0,eI.fX)((0,eI.fX)([],(0,eI.zs)(g),!1),(0,eI.zs)(p),!1));u.set(d,v)}}s=l.map(function(e){var t;return function(e,t,r){if(void 0===r&&(r=nT),null===e)return null;var n,i,o,s,a,l=String(e.tagName).toLowerCase(),u={tag:l},c=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var r=e.getRootNode();return t&&nE(r)?r.children:[]}(e,r.enabled));c.length&&(u.index=c.indexOf(e),u.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null==(a=null==(s=e.previousElementSibling)?void 0:s.tagName)?void 0:a.toLowerCase();d&&(u.prevSib=String(d));var f=e.getAttribute("id");f&&(u.id=String(f));var h=Array.from(e.classList);h.length&&(u.classes=h);var p={},g=Array.from(e.attributes).filter(function(e){return!ia.has(e.name)}),v=!nD(e);if(!ic.includes(String(e.getAttribute("type")))&&!iu.includes(l))try{for(var m=(0,eI.Ju)(g),y=m.next();!y.done;y=m.next()){var b=y.value;if(!v||il.includes(b.name)){if(t.has(b.name)){p[b.name]=rN;continue}p[b.name]=String(b.value).substring(0,128)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}return Object.keys(p).length&&(u.attrs=p),e.shadowRoot&&(u.attrs=(0,eI.Cl)((0,eI.Cl)({},u.attrs||{}),((o={})[ny]="true",o)),u.shadow=!0),u}(e,null!=(t=u.get(e))?t:new Set,a)});var m=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=(0,eI.zs)(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=h.replaceSensitiveString(i))})};try{for(var y=(0,eI.Ju)(s),b=y.next();!b.done;b=y.next()){var w=b.value;m(w)}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}var S=performance.now();return null==(i=h.diagnosticsClient)||i.recordHistogram("autocapturePlugin.getHierarchy",S-o),s},this.getNearestLabel=function(e){var t,r=e.parentElement;if(!r)return"";try{t=r.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?h.getText(t):h.getNearestLabel(r)},this.getElementPath=function(e){if(!e)return"";var t,r=performance.now(),n=h.selectorEngine.generate(e),i=performance.now();return null==(t=h.diagnosticsClient)||t.recordHistogram("autocapturePlugin.getElementPath",i-r),n},this.updateSelectorConfig=function(e,t){if(null!=e){var r,n="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(!n&&!i){null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.");return}var o=ig(e,t),s=h.selectorEngine.getConfig().enabled,a=h.shadowGate.get().enabled,l=h.shadowGate.arm(nP(o));h.selectorEngine.updateConfig((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)({},n?o:h.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),n&&s!==o.enabled&&(null==t||t.debug(o.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!a&&l.enabled&&(null==(r=h.diagnosticsClient)||r.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}}
1,this.getShadowMode=function(){return h.shadowGate.get()},this.getEventProperties=function(e,t,r){var n,i,o,s,a=null==(o=null==(i=null==t?void 0:t.tagName)?void 0:i.toLowerCase)?void 0:o.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},u=h.getHierarchy(t),c=null==(s=u[0])?void 0:s.attrs,d=h.getNearestLabel(t),f=Object.entries(null!=c?c:{}).reduce(function(e,t){var n=(0,eI.zs)(t,2),i=n[0],o=n[1];if(i.startsWith(r)){var s=i.replace(r,"");s&&(e[s]=o||"")}return e},{}),p=((n={})["[Amplitude] Element Hierarchy"]=u,n[nd]=a,n[nf]=h.getText(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Attributes"]=f,n["[Amplitude] Element Path"]=h.getElementPath(t),n["[Amplitude] Element Parent Label"]=d,n[nh]=nw(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=rq(h.replaceSensitiveString),n[np]=window.innerHeight,n[ng]=window.innerWidth,n),g=nN();if(g&&(p[nv]=g),p["[Amplitude] Element ID"]=t.getAttribute("id")||"",p["[Amplitude] Element Class"]=t.getAttribute("class"),p["[Amplitude] Element Aria Label"]=null==c?void 0:c["aria-label"],"a"===a&&"click"===e&&t instanceof HTMLAnchorElement){var v=t.href.substring(0,128);p["[Amplitude] Element Href"]=h.replaceSensitiveString(v)}return nL(p)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,r,n,i){void 0===i&&(i=!1);var o=h.addTypeAndTimestamp(e,t);try{if(("click"===o.type||"change"===o.type)&&null!==o.event.target){var s=h.getShadowMode(),a=nz(o.event,s);if(i&&nA(a,o.type))return o.closestTrackedAncestor=a,o.targetElementProperties=h.getEventProperties(o.type,o.closestTrackedAncestor,n),o;var l=nH(a,r,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=h.getEventProperties(o.type,l,n))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=n9(e,t);if(r){if("TEXT"===e.elementExtractType)return h.getText(r);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return r.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,r,n="[".concat(rL,"], [contenteditable]");if(!e.querySelector(n))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=(0,eI.Ju)(o),a=s.next();!a.done;a=s.next()){var l=a.value;if(l.nodeType===Node.TEXT_NODE){i+=l.textContent||"";continue}if(l instanceof Element){if(l.hasAttribute(rL)||l.hasAttribute("contenteditable")){i+=rN;continue}i+=h.getTextWithMaskedDescendants(l)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=h.getShadowMode();return t.enabled?i_(e,t):null!==e.closest("[".concat(rL,"]"))},this.getText=function(e){if(h.hasMaskedAncestor(e))return rN;var t="";return t=e.querySelector("[".concat(rL,"], [contenteditable]"))?h.getTextWithMaskedDescendants(e):e.innerText||"",h.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){if(!e)return{};var t,r,n,i=null==(n=null==(r=null==e?void 0:e.tagName)?void 0:r.toLowerCase)?void 0:n.call(r);return nL(((t={})[nd]=i,t[nf]=h.getText(e),t[nh]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(eo||(r=ig(),void 0===n&&(n={}),i=ip(r),o=new Set,s=n.logger,a=function(e){return iP(e,s)},l=function(e,t){var r;return null!=(r=function(e,t,r){void 0===r&&(r={});var n,i,o,s,a,l=ip(t),u=null!=(o=r.strategies)?o:iS,c=null!=(a=null!=(s=r.scope)?s:e.ownerDocument)?a:document,d={scope:c,config:l},f=function(e,t){for(var r=[],n=e;null!==n&&(r.push(n),void 0===t||!(r.length>t));)n=n.parentElement;return r}(e,l.maxAncestorWalkDepth);try{for(var h=(0,eI.Ju)(u),p=h.next();!p.done;p=h.next())for(var g=p.value,v=0;v<f.length;v++){var m=f[v],y=g.try(m,d);if(null!==y){if(0===v){if(iE(c,y,e,g.name,r.logger))return y;continue}var b=f.slice(0,v).reverse().map(iw).join(" > "),w="".concat(y," > ").concat(b);if(iE(c,w,e,g.name,r.logger))return w}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return null}(e,i,{strategies:n.strategies,scope:t,logger:s}
1))?r:function(e,t,r){void 0===r&&(r={});for(var n,i,o=ip(t),s=null!=(i=null!=(n=r.scope)?n:e.ownerDocument)?i:document,a=nE(s),l=[],u=e,c=0,d=!(o.shadowDomEnabled&&a);null!==u&&(!d||void 0===o.maxAncestorWalkDepth||!(c>o.maxAncestorWalkDepth));){var f=iy(u,o);if(null!==f){var h="".concat(u.tagName.toLowerCase(),"#").concat(ib(f)),p=(0,eI.fX)([h],(0,eI.zs)(l),!1).join(" > ");if(function(e,t,r){var n;try{n=e.querySelectorAll(t)}catch(e){return!1}return 1===n.length&&n[0]===r}(s,p,e))return p}l.unshift(function(e,t){var r=e.tagName.toLowerCase(),n=e.parentElement;if(null===n){var i=e.getRootNode();return t&&nE(i)?"".concat(r,":nth-of-type(").concat(nx(e,i.children),")"):r}return"".concat(r,":nth-of-type(").concat(nx(e,n.children),")")}(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var g=l.join(" > ");return o.shadowDomEnabled&&a&&null===u?"".concat(nS).concat(g):g}(e,i,{scope:t})},u=function(e,t){var r,n;return r=a(e),n=function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e),r&&n&&nE(t)?"".concat(nS).concat(r):r},eo={generate:function(e){try{if(!i.shadowDomEnabled)return(i.enabled?l:a)(e,null!=(r=null!=(t=n.scope)?t:e.ownerDocument)?r:document);return o=i.enabled?l:u,d=(c=nI(e,i.maxShadowDomDepth)).segments,c.truncated&&(null==s||s.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(i.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),d.map(function(e){return o(e.target,e.root)}).join(" >>> ")}catch(n){var t,r,o,c,d,f=n instanceof Error?n.message:String(n);return null==s||s.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(f)),iP(e,s)}},getConfig:function(){return i},updateConfig:function(e){var t,r;i=ip(e);try{for(var n=(0,eI.Ju)(o),a=n.next();!a.done;a=n.next()){var l=a.value;try{l(i)}catch(e){var u=e instanceof Error?e.message:String(e);null==s||s.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(u))}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},onConfigChange:function(e){return o.add(e),function(){o.delete(e)}}}),eo),this.shadowGate=(en||(en=n_()),en);var p=null!=(f=e.maskTextRegex)?f:[],g=[];try{for(var v=(0,eI.Ju)(p),m=v.next();!m.done;m=v.next()){var y=m.value;if(g.length>=25)break;if(y instanceof RegExp)g.push(y);else if("pattern"in y&&"string"==typeof y.pattern)try{g.push(RegExp(y.pattern,"i"))}catch(e){}}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=v.return)&&d.call(v)}finally{if(c)throw c.error}}this.additionalMaskTextPatterns=g};function iA(e,t){var r=e.remoteConfigClient;if(e.fetchRemoteConfig&&r){var n=r.subscribe("configs.analyticsSDK.browserSDK.autocapture.elementSelector","all",function(r,n){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(n),") ").concat(JSON.stringify(r))),t.updateSelectorConfig(r,e.loggerProvider)});return function(){r.unsubscribe(n)}}}(v=es||(es={})).ClickObservable="clickObservable",v.PointerDownObservable="pointerDownObservable",v.ChangeObservable="changeObservable",v.NavigateObservable="navigateObservable",v.MutationObservable="mutationObservable",v.ScrollObservable="scrollObservable",v.ExposureObservable="exposureObservable",v.BrowserErrorObservable="browserErrorObservable",v.SelectionObservable="selectionObservable",v.MouseMoveObservable="mouseMoveObservable";var iR=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",nu);var r,n,i,o,s,a,l,u,c,d,f,h,p,g,v=e.dataAttributePrefix,m=void 0===v?r4:v,y=e.visualTaggingOptions,b=void 0===y?{enabled:!0}:y;e.cssSelectorAllowlist=null!=(r=e.cssSelectorAllowlist)?r:r3,e.actionClickAllowlist=null!=(n=e.actionClickAllowlist)?n:r5,e.debounceTime=null!=(i=e.debounceTime)?i:0;var w=(null==(o=e.viewportContentUpdated)?void 0:o.enabled)!==!1,S=null!=(l=null!=(a=null==(s=e.viewportContentUpdated)?void 0:s.exposureDuration)?a:e.exposureDuration)?l:150;e.viewportContentUpdated=(0,eI.Cl)((0,eI.Cl)({},e.viewportContentUpdated),{exposureDuration:S}
1),e.pageUrlExcludelist=null==(u=e.pageUrlExcludelist)?void 0:u.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(e){console.warn("Invalid regex pattern: ".concat(t.pattern),e)}return e},[]);var E="@amplitude/plugin-autocapture-browser",k=[],C=new iO(e,t),I=new Set,x=new Set,T=new Set,P=function(){var t,r,n=ne(n5().map(function(t){return C.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,m)})),i=ne(new(r8())(function(t){var r,n=function(r){var n=C.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,m);t.next(n)};return null==(r=(0,eO.m)())||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null==(e=(0,eO.m)())?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(r=ne(new(r8())(function(t){var r=function(r){var n=C.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,m);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var o=C.shadowGate,s=ne(n4(o).map(function(t){return C.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,m)})),a=new(r8())(function(e){var t,r=function(t){e.next(t)};return null==(t=(0,eO.m)())||t.addEventListener("scroll",r),function(){var e;null==(e=(0,eO.m)())||e.removeEventListener("scroll",r)}}),l=n6(s,e.cssSelectorAllowlist,function(e){g=e},o);return(t={})[es.ChangeObservable]=i,t[es.ClickObservable]=n,t[es.MutationObservable]=s,t[es.NavigateObservable]=r,t[es.ScrollObservable]=a,t[es.ExposureObservable]=l,t},_=ir(Object.values(null!=(d=null==(c=e.pageActions)?void 0:c.labeledEvents)?d:{})),O=ii(null!=(h=null==(f=e.pageActions)?void 0:f.triggers)?h:[]),A=new is(_,O,C,e),R=function(t){var r,n;t&&(e.pageActions=(0,eI.Cl)((0,eI.Cl)({},e.pageActions),t),_=ir(Object.values(null!=(r=e.pageActions.labeledEvents)?r:{})),O=ii(null!=(n=e.pageActions.triggers)?n:[]),A.update(_,O,e))};return{name:E,type:"enrichment",setup:function(t,r){return(0,eI.sH)(void 0,void 0,void 0,function(){var n,i,o,s,a,l,u,c,d,f,h,v,y,_,O,M,D,L,N,H,U,F,j,q,B,z,Y;return(0,eI.YH)(this,function(J){var W,V,K,$,X,G,Q,Z,ee,et,er,en,ei,eo,ea,el,eu,ec,ed,ef,eh,ep,eg,ev,em,ey,eb,ew,eS,eE,ek,eC,ex,eT,eP,e_,eA,eR,eM,eD,eL,eN,eH,eU,eF,ej,eq,eB,ez,eY,eJ,eW,eV,eK,e$,eX,eG,eQ,eZ;return"u"<typeof document?[2]:(n=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){R(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),(i=iA(t,C))&&k.push({unsubscribe:i}),o=nM(e,e.cssSelectorAllowlist),s=nM(e,e.actionClickAllowlist),V=(W={allObservables:a=P(),amplitude:r,shouldTrackEvent:o,evaluateTriggers:A.evaluate.bind(A)}).amplitude,K=W.allObservables,$=W.shouldTrackEvent,X=W.evaluateTriggers,l=K.clickObservable.filter(nY).filter(function(e){return $("click",e.closestTrackedAncestor)}).map(function(e){return X(e)}).subscribe(function(e){null==V||V.track(nc,e.targetElementProperties)}),k.push(l),Q=(G={allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(e),!1),[m],!1))},amplitude:r,shouldTrackEvent:o,evaluateTriggers:A.evaluate.bind(A)}).amplitude,Z=G.allObservables,ee=G.getEventProperties,et=G.shouldTrackEvent,er=G.evaluateTriggers,u=Z.changeObservable.filter(nY).filter(function(e){return et("change",e.closestTrackedAncestor)}).map(function(e){return er(e)}).subscribe(function(e){null==Q||Q.track("[Amplitude] Element Changed",ee("change",e.closestTrackedAncestor))}),k.push(u),ei=(en={allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(e),!1),[m],!1))},amplitude:r,shouldTrackEvent:o,shouldTrackActionClick:s}).amplitude,eo=en.allObservables,ea=en.options,el=en.getEventProperties,eu=en.shouldTrackEvent,ec=en.shouldTrackActionClick,ed=eo.clickObservable,ef=eo.mutationObservable,eh=eo.navigateObservable,ep=ed.filter(function(e){return!eu("click",e.closestTrackedAncestor)}).map(function(e){var t=nH(e.event.target,ea.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=el(e.type,e.closestTrackedAncestor)),e}).filter(nY).filter(function(e){return ec("click",e.closestTrackedAncestor)}),eg=eh?r9(ef,eh):ef,ev=r9(ep,eg),em=null,ey=null,(c=r7(ev,function(e){if(em&&(clearTimeout(em),em=null),"click"===e.type)ey=e,em=setTimeout(function(){em=null,ey=null},500);else if(ey){var t=ey;return ey=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==ei||ei.track(nc,el("click",e.closestTrackedAncestor)))}))&&k.push(c),(eb={allObservables:a,amplitude:r}).amplitude,ew=eb.allObservables.scrollObservable,eS={maxX:0,maxY:0},eE=ew.subscribe(function(){var e,t,r,n,i=(0,eO.m)(),o=Math.floor(null!=(t=null!=(e=null==i?void 0:i.scrollX)?e:null==i?void 0:i.pageXOffset)?t:0),s=Math.floor(null!=(n=null!=(r=null==i?void 0:i.scrollY)?r:null==i?void 0:i.pageYOffset)?
1n:0);eS.maxX=Math.max(eS.maxX,o),eS.maxY=Math.max(eS.maxY,s)}),d={unsubscribe:function(){eE.unsubscribe()},getState:function(){return eS},reset:function(){eS.maxX=0,eS.maxY=0}},k.push(d),f=(0,eI.Cl)({},d.getState()),h={},v=(0,eO.m)(),_=function(e){e&&(null==y||y.reset()),e&&n||(e&&(n=!0,setTimeout(function(){n=!1},100)),function(e){var t,r,n,i=e.amplitude,o=e.scrollTracker,s=e.currentElementExposed,a=e.elementExposedForPage,l=e.elementExposedInSentEvents,u=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,f=o.getState(),h=(0,eO.m)(),p=null!=(r=null==h?void 0:h.innerWidth)?r:0,g=null!=(n=null==h?void 0:h.innerHeight)?n:0,v=Array.from(s).filter(function(e){return!l.has(e)}),m=((t={})[nh]=nW(h),t["[Amplitude] Max Page X"]=f.maxX+p,t["[Amplitude] Max Page Y"]=f.maxY+g,t[np]=g,t[ng]=p,t["[Amplitude] Element Exposed"]=v,t),y=nN();y&&(m[nv]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,a.clear(),l.clear(),null==u||u.reset()};if(0===v.length&&f.maxX===d.maxX&&f.maxY===d.maxY){c&&b();return}null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=f.maxX,d.maxY=f.maxY,v.forEach(function(e){l.add(e)}),s.clear(),c&&b()}({amplitude:r,scrollTracker:d,currentElementExposed:T,elementExposedForPage:I,elementExposedInSentEvents:x,exposureTracker:h.exposure,isPageEnd:e,lastScroll:f}))},O=nW(v),M=function(){var e=nW(v);e!==O&&(O=e,_(!0))},D=function(e,t){var r=nW(v),n=function(e,t){if(void 0===t&&(t=(0,eO.m)()),null==e||""===e)return nW(t);var r,n=(null==(r=null==t?void 0:t.location)?void 0:r.href)||"http://localhost/";try{return nJ(new URL(e,n).href)}catch(e){return nW(t)}}(t,v);r===n||(O=n,_(!0)),e()},L=function(e){!(I.has(e)||x.has(e))&&(I.add(e),T.add(e),JSON.stringify(Array.from(T)).length>=18e3&&_(!1))},w&&(eC=(ek={allObservables:a,onExposure:L,dataExtractor:C,exposureDuration:S}).allObservables,ex=ek.onExposure,eT=ek.dataExtractor,e_=void 0===(eP=ek.exposureDuration)?150:eP,eA=new Map,eR=new Map,eM=eC.exposureObservable.subscribe(function(e){var t=e.target;if(e.isIntersecting){if(!eA.get(t)){var r=eR.get(t);r&&clearTimeout(r);var n=setTimeout(function(){eA.set(t,!0),ex(eT.getElementPath(t)),eR.set(t,null)},e_);eR.set(t,n)}}else if(!e.isIntersecting&&e.intersectionRatio<1){var n=eR.get(t);n&&(clearTimeout(n),eR.set(t,null))}}),h.exposure={unsubscribe:function(){eM.unsubscribe()},reset:function(){eR.forEach(function(e){e&&clearTimeout(e)}),eR.clear(),eA.clear()}},h.exposure&&k.push(h.exposure),ej=(eD={mutationObservable:a[es.MutationObservable],onRescan:function(){var e,r;null==(r=null==(e=t.loggerProvider)?void 0:e.debug)||r.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==g||g()},onFlush:function(){var e,r;null==(r=null==(e=t.loggerProvider)?void 0:e.debug)||r.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),_(!1)},exposureDuration:S}).mutationObservable,eq=eD.onRescan,eB=eD.onFlush,ez=eD.exposureDuration,eJ=void 0===(eY=eD.quietMs)?150:eY,eV=void 0===(eW=eD.maxWaitMs)?4e3:eW,eK=!1,e$=function(){eL&&(clearTimeout(eL),eL=void 0),eN&&(clearTimeout(eN),eN=void 0),eH&&(clearTimeout(eH),eH=void 0)},eX=function(){eF&&(document.removeEventListener("DOMContentLoaded",eF),eF=void 0)},eG=function(){if(!eK){if(!("u">typeof document&&"loading"!==document.readyState)){eF||(eF=function(){eF=void 0,eQ()},document.addEventListener("DOMContentLoaded",eF));return}eK=!0,e$(),eX(),eq(),eH=setTimeout(function(){eH=void 0,eB()},ez+50)}},eQ=function(){eK||(eL&&clearTimeout(eL),eL=setTimeout(eG,eJ))},eZ=function(){e$(),eX(),eK=!1,eQ(),eN=setTimeout(eG,eV)},(y={start:function(){eU||(eU=ej.subscribe(function(){eQ()}),eZ())},reset:function(){eZ()},stop:function(){null==eU||eU.unsubscribe(),eU=void 0,e$(),eX()}}).start(),k.push({unsubscribe:function(){null==y||y.stop()}}),N=function(){_(!0)},null==v||v.addEventListener("beforeunload",N),p=function(){null==v||v.removeEventListener("beforeunload",N)},k.push({unsubscribe:function(){return p()}}),(H=a[es.NavigateObservable])?k.push(H.subscribe(function(e){var t,r,n=null==(r=null==(t=e.event)?void 0:t.destination)?void 0:r.url;if(n){var i=nJ(n);if(i===O)return;O=i,_(!0);return}M()})):v&&(U=function(){M()},v.addEventListener("popstate",U),F=v.history.pushState,j=v.history.replaceState,v.history&&F&&(v.history.pushState=new Proxy(F,{apply:function(e,t,r){D(function(){e.apply(t,r)},r[2])}})),v.history&&j&&(v.history.replaceState=new Proxy(j,{apply:function(e,t,r){D(function(){e.apply(t,r)},r[2])}})),k.push({unsubscribe:function(){v.removeEventListener("popstate",U),v.history&&F&&(v.history.pushState=F),v.history&&j&&(v.history.replaceState=j)}}))),null==(Y=null==t?void 0:t.loggerProvider)||Y.log("".concat(E," has been successfully added.")),window.opener&&b.enabled&&(q=e.cssSelectorAllowlist,B=e.actionClickAllowlist,!function(e,t){if(!0!==e[nV]){e[nV]=!0;var r=t.dataExtractor,n=t.isElementSelectable,i=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,a=function(t){e.notify({action:"element-selected",data:t})},l=function(t,r){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:r}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:r})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var u;s=null==(u=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:u.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!n||n((null==t?void 0:t.actionType)||"click",e)},onTrack:l,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:i,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:nu}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null==(e=null==s?void 0:s.close)||e.call(s)})}}(z=ns(),{dataExtractor:C,isElementSelectable:nM(e,(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(q),!1),(0,eI.zs)(B),!1)),cssSelectorAllowlist:q,actionClickAllowlist:B}),nl(z),z.setup((0,eI.Cl)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:nr[t.serverZone]}))),[2])})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,eI.YH)(this,function(i){try{for(t=(e=(0,eI.Ju)(k)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(r)throw r.error}}return[2]})})}}},iM=(0,eI.fX)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,eI.zs)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),iD=["*"],iL=["mutation","navigate"];function iN(e,t){var r,n,i,o,s=t.event,a=s.pageX,l=s.pageY;e.yMin=Math.min(null!=(r=e.yMin)?r:l,l),e.yMax=Math.max(null!=(n=e.yMax)?n:l,l),e.xMin=Math.min(null!=(i=e.xMin)?i:a,a),e.xMax=Math.max(null!=(o=e.xMax)?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function iH(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:(0,eI.Cl)({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}(m=ea||(ea={})).INCREASING="increasing",m.DECREASING="decreasing",(y=el||(el={})).X="x",y.Y="y";var iU=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new(r8())(function(e){var r=null,n=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};if(null===r){r=o;return}o.x>r.x?(n===ea.DECREASING&&e.next(el.X),n=ea.INCREASING):o.x<r.x&&(n===ea.INCREASING&&e.next(el.X),n=ea.DECREASING),o.y>r.y?(i===ea.DECREASING&&e.next(el.Y),i=ea.INCREASING):o.y<r.y&&(i===ea.INCREASING&&e.next(el.Y),i=ea.DECREASING),r=o})})};function iF(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;return!(t.length<r)&&t[t.length-1]-t[0]<n}function ij(e){e.changes=[],e.startTime=void 0}function iq(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length&&!(i-t[n]<r);n++);0!==n&&(e.startTime=t[n],e.changes.splice(0,n))}var iB=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=void 0===r?20:r,i=e.thresholdMs,o=void 0===i?2e3:i;return new(r8())(function(e){var r={changes:[],changesThreshold:n,thresholdMs:o},i={changes:[],changesThreshold:n,thresholdMs:o},s=void 0,a=null;function l(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),ij(r),ij(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===el.X?r:i,n=+Date.now(),t.startTime=t.startTime||n,u=t.changes,c=t.changesThreshold,u.push(n),u.length>c&&u.shift();var t,n,u,c,d=function(e,t){var r=void 0;if(iF(e)&&(r=e.startTime),iF(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}(r,i);return d?(s=s||d,a=setTimeout(function(){l(),a=null},o)):l(),iq(r),iq(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},iz=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=e.thresholdMs;return iB({mouseDirectionChangeObservable:iU({allWindowObservables:n}),directionChanges:void 0===i?20:i,thresholdMs:void 0===o?2e3:o}).subscribe(function(e){nR(r)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function iY(e,t,r,n){if(!n)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var iJ=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-frustration-browser",n=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,s=!1!==e.rageClicks&&null!==e.rageClicks,a=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(a=!1);var l=iY(e,"rageClicks",iD,s),u=iY(e,"deadClicks",iM,o),c=iY(e,"errorClicks",iM,i),d=null!=(t=e.dataAttributePrefix)?t:r4,f=new iO(e),h=(0,eI.fX)([],(0,eI.zs)(new Set((0,eI.fX)((0,eI.fX)((0,eI.fX)([],(0,eI.zs)(l),
1!1),(0,eI.zs)(u),!1),(0,eI.zs)(c),!1))),!1),p=function(){var e,t,r=function(e){return ne(n5(e).map(function(e){return f.addAdditionalEventProperties(e,"click",h,d,!0)}))},n=r("click"),i=r("pointerdown"),o=ne(n8().map(function(e){return f.addTypeAndTimestamp(e,"error")})),s=ne(n4(f.shadowGate).map(function(e){return f.addAdditionalEventProperties(e,"mutation",h,d)}));window.navigation&&(t=ne(new(r8())(function(e){var t=function(t){e.next((0,eI.Cl)((0,eI.Cl)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return f.addAdditionalEventProperties(e,"navigate",h,d)})));var a=ne(new(r8())(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){var r=void 0,n=void 0;try{if(r=t.selectionStart,n=t.selectionEnd,r===n)return}catch(e){return}return e.next()}var i=window.getSelection();if(i&&!i.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),l=ne(new(r8())(function(e){var t=function(t){e.next(t)},r={capture:!0};return n1.document.addEventListener("mousemove",t,r),function(){n1.document.removeEventListener("mousemove",t,r)}}));return(e={})[es.ClickObservable]=n,e[es.PointerDownObservable]=i,e[es.MutationObservable]=s,e[es.NavigateObservable]=t,e[es.BrowserErrorObservable]=o,e[es.SelectionObservable]=a,e[es.MouseMoveObservable]=l,e};return{name:r,type:"enrichment",setup:function(t,h){return(0,eI.sH)(void 0,void 0,void 0,function(){var g,v,m,y,b,w,S,E,k;return(0,eI.YH)(this,function(C){var I,x,T,P,_,O,A,R,M,D,L,N,H,U,F,j,q,B,z,Y,J,W;return"u"<typeof document?[2]:(g=p(),(v=iA(t,f))&&n.push({unsubscribe:v}),s&&(m=function(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.pointerDownObservable,s=n.selectionObservable,a=[],l={},u=null;function c(e){a=[],l={},e&&(iN(l,e),a.push(e))}var d=r7(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,eI.sH)(t,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){var n,i,o,s;return(iN(l,e),t=null,0===a.length||(n=a).length>0&&n[n.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(o=Math.max(0,(i=a).length-4+1),s=i[o],e.timestamp-s.timestamp>=1e3)||l.isOutOfBounds)?(u&&(t=iH(a)),c(e)):a.push(e),(u&&(clearTimeout(u.timerId),u.resolve(t),u=null),a.length>=4)?[2,new Promise(function(e){u={resolve:e,timerId:setTimeout(function(){e(iH(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){c()}),h=d.subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==f||f.unsubscribe()}}}({allObservables:g,amplitude:h,shouldTrackRageClick:nM(e,l)}),n.push(m)),o&&(x=(I={amplitude:h,allObservables:g,getEventProperties:function(e,t){return f.getEventProperties(e,t,d)},shouldTrackDeadClick:nM(e,u)}).amplitude,T=I.allObservables,P=I.getEventProperties,_=I.shouldTrackDeadClick,O=T.clickObservable,A=T.mutationObservable,R=T.navigateObservable,M=O.filter(function(e){return nY(e)&&_("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===ei.LEFT_OR_TOUCH_CONTACT}),D=R?r9(A,R):A,L=r9(M,D),N=null,y=r7(L,function(e){if(N&&iL.includes(e.type))clearTimeout(N),N=null;else if("click"===e.type)return N?Promise.resolve(null):new Promise(function(t){N=setTimeout(function(){t(e),N=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};x.track("[Amplitude] Dead Click",(0,eI.Cl)((0,eI.Cl)({},P("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),n.push(y)),i&&(U=(H={amplitude:h,allObservables:g,shouldTrackErrorClick:nM(e,c)}).amplitude,F=H.allObservables,j=H.shouldTrackErrorClick,q=F.pointerDownObservable,B=F.browserErrorObservable,z=q.filter(function(e){return nY(e)&&j("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===ei.LEFT_OR_TOUCH_CONTACT}),Y=null,J=null,W=function(){null!==Y&&(clearTimeout(Y),Y=null),J=null},b=r9(z,B).subscribe(function(e){var t;if("click"===e.type){W(),J=e,Y=setTimeout(W,2e3);return}"error"===e.type&&J&&(U.track("[Amplitude] Error Click",(0,eI.Cl)(((t={})["[Amplitude] Kind"]=e.event.kind,t["[Amplitude] Message"]=e.event.message,t["[Amplitude] Stack"]=e.event.stack,t["[Amplitude] Filename"]=e.event.filename,t["[Amplitude] Line Number"]=e.event.lineNumber,t["[Amplitude] Column Number"]=e.event.columnNumber,t),J.targetElementProperties)),W())}),n.push(b)),a&&(w=void 0,S=void 0,"object"==typeof e.thrashedCursor&&(w=e.thrashedCursor.directionChanges,S=e.thrashedCursor.threshold,w&&w<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(w," is below the minimum of ").concat(5,", setting to ").concat(5)),w=5),S&&S>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(S," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),S=4e3)),E=iz({amplitude:h,options:e,allObservables:g,directionChanges:w,thresholdMs:S}),n.push(E)),null==(k=null==t?void 0:t.loggerProvider)||k.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,i;return(0,eI.YH)(this,function(o){try{for(t=(e=(0,eI.Ju)(n)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}};function iW(e,t){var r=e.startTime+e.duration;return t.filter(function(t){return t.startTime<r&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}var iV=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",r=[],n=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return(0,eI.sH)(void 0,void 0,void 0,function(){var s,a,l;return(0,eI.YH)(this,function(u){return"u"<typeof document||(n&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=function(e){var t=e.amplitude,r=e.options,n=e.durationThreshold,i=void 0===n?100:n,o=function(){if("u"<typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var s=[],a=new PerformanceObserver(function(e){var t,r,n=performance.now();try{for(var i=(0,eI.Ju)(e.getEntries()),o=i.next();!o.done;o=i.next()){var a=o.value;s.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}for(var l=n-1e4;s.length>0&&s[0].startTime<l;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var n,a;try{for(var l=(0,eI.Ju)(e.getEntries()),u=l.next();!u.done;u=l.next()){var c=u.value;if(!nR(r))return;if(!(c.duration<i)){var d="long-animation-frame"===o?function(e,t){var r,n=iW(e,t),i=null!=(r=e.scripts)?r:[],o=i.map(function(e){return e.sourceURL}
1).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),a=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),l=i.map(function(e){return e.invokerType}).filter(Boolean),u=i.map(function(e){return e.invoker}).filter(Boolean);return(0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)((0,eI.Cl)({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),a.length>0&&{"[Amplitude] Main Thread Block Script Positions":a}),l.length>0&&{"[Amplitude] Main Thread Block Invoker Types":l}),u.length>0&&{"[Amplitude] Main Thread Block Invokers":u})}(c,s):function(e,t){var r,n=iW(e,t),i=null!=(r=e.attribution)?r:[];return(0,eI.Cl)((0,eI.Cl)({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}(c,s);t.track("[Amplitude] Main Thread Block",d)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}});try{l.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}({amplitude:o,options:e,durationThreshold:s}),r.push(a)),null==(l=null==i?void 0:i.loggerProvider)||l.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,n,i;return(0,eI.YH)(this,function(o){try{for(t=(e=(0,eI.Ju)(r)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}},iK=r(78922),i$=function(){function e(e){this.request=e}return e.prototype.headers=function(e){void 0===e&&(e=[]);var t,r,n=this.request.headers,i={};if(Array.isArray(n))n.forEach(function(e){var t=(0,eI.zs)(e,2),r=t[0],n=t[1];i[r]=n});else if(n instanceof Headers)n.forEach(function(e,t){i[t]=e});else if("object"==typeof n&&null!==n)try{for(var o=(0,eI.Ju)(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=(0,eI.zs)(s.value,2),l=a[0],u=a[1];i[l]=u}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i2(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=(0,eO.m)();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=iG(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return 0===e.length?[2,null]:[2,i0(this.body,e,t)]})})},e}(),iX=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),i2(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return iG(this.bodyRaw,100)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return 0===e.length?[2,null]:[2,i0(this.body,e,t)]})})},e}();function iG(e,t){var r,n,i,o,s=(0,eO.m)(),a=null==s?void 0:s.TextEncoder;if(a&&null!=e){if("string"==typeof e)o=e,i=new a().encode(o).length;else if("u">typeof Blob&&e instanceof Blob)i=(o=e).size;else if("u">typeof URLSearchParams&&e instanceof URLSearchParams)o=e,i=new a().encode(o.toString()).length;else if(ArrayBuffer.isView(e))i=(o=e).byteLength;else if(e instanceof ArrayBuffer)i=(o=e).byteLength;else if("u">typeof FormData&&e instanceof FormData){var l=0,u=0;try{for(var c=(0,eI.Ju)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,eI.zs)(d.value,2),h=f[0],p=f[1];if(l+=h.length,"string"==typeof p)l+=new a().encode(p).length;else{if(!("u">typeof Blob&&p instanceof Blob))return;l+=p.size}if(++u>=t)return}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}i=l}else if("u">typeof ReadableStream&&e instanceof ReadableStream){o=e;return}return i}}var iQ=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null==(t=null==r?void 0:r.forEach)||t.call(r,function(e,t){n[t]=e}),i2(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(void 0!==this._bodySize)return this._bodySize;var e,t,r=null==(t=null==(e=this.response.headers)?void 0:e.get)?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,Promise.race([this.clonedResponse.text(),new Promise(function(e){return setTimeout(function(){return e(null)},500)})])];case 2:return[2,e.sent()];case 3:return e.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,i0(r.sent(),e,t)]}})})},e}(),iZ=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){if(void 0===e&&(e=[]),!this.headersString)return{};var t,r,n={},i=this.headersString.split("\r\n");try{for(var o=(0,eI.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,l=(0,eI.zs)(a.split(": "),2),u=l[0],c=l[1];u&&c&&(n[u]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i2(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eI.sH)(this,void 0,void 0,function(){var r;return(0,eI.YH)(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?((0,iK.D7)(r,e,t),[2,r]):[2,null]})})},e}();function i0(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return(0,iK.D7)(n,t,r),n}catch(e){return null}}(b=eu||(eu={})).REDACT="redact",b.REMOVE="remove";var i1="[REDACTED]",i2=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?eu.REMOVE:s,l=(0,eI.fX)([],(0,eI.zs)(e4.L),!1),u={};try{for(var c=(0,eI.Ju)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var f=d.value;!function(t){var r=t.toLowerCase();l.find(function(e){return e.toLowerCase()===r})?a===eu.REDACT&&(u[t]=i1):o.find(function(e){return e.toLowerCase()===r})?u[t]=e[t]:a===eu.REDACT&&(u[t]=i1)}(f)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return u},i3=function(){function e(e,t,r,n,i,o,s,a,l,u,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=i,this.requestWrapper=o,this.status=s,this.duration=a,this.responseWrapper=l,this.error=u,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,r,n;
1return Object.fromEntries(Object.entries({type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null==(e=this.requestWrapper)?void 0:e.headers((0,eI.fX)([],(0,eI.zs)(e4.j7),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(r=this.responseWrapper)?void 0:r.headers((0,eI.fX)([],(0,eI.zs)(e4.j7),!1)),responseBodySize:null==(n=this.responseWrapper)?void 0:n.bodySize}).filter(function(e){var t=(0,eI.zs)(e,2);return void 0!==(t[0],t[1])}))},e}(),i4=function(e,t){void 0===t&&(t=eR()),this.callback=e,this.id=t};function i5(e){try{e()}catch(e){}}var i6=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=(0,eO.m)();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=(0,eO.m)();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,i,o,s,a,l,u,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null==(i=null==(n=null==(r=this.globalScope)?void 0:r.XMLHttpRequest)?void 0:n.prototype)?void 0:i.open,h=null==(a=null==(s=null==(o=this.globalScope)?void 0:o.XMLHttpRequest)?void 0:s.prototype)?void 0:a.send,p=null==(c=null==(u=null==(l=this.globalScope)?void 0:l.XMLHttpRequest)?void 0:u.prototype)?void 0:c.setRequestHeader;f&&h&&p&&this.observeXhr(f,h,p);var g=null==(d=this.globalScope)?void 0:d.fetch;g&&this.observeFetch(g),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(r){try{r.callback(e)}catch(e){i5(function(){var r;null==(r=t.logger)||r.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,i,o,s){if(void 0!==o&&void 0!==s){var a,l,u,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(l=t.url,d=t.method):l=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),l)try{var f=new URL(l);l="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==r?void 0:r.method)||d,n&&(u=n.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},u=0);var h=Math.floor(performance.now()-s),p=Math.floor(o+h),g=new i3(e,d,o,o,l,r,u,h,n,c,p);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null==(e=Date.now)?void 0:e.call(Date),durationStart:null==(t=null==performance?void 0:performance.now)?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return(0,eI.sH)(t,void 0,void 0,function(){var t,i,o,s=this;return(0,eI.YH)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){i5(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(r,n)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new i$(n):void 0,i?new iQ(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){i5(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var r;try{if("json"===e.responseType){if(null==(r=t.globalScope)?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){r instanceof Error&&"InvalidStateError"===r.name&&i5(function(){var r;return null==(r=t.logger)?void 0:r.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))})}return null}},e.prototype.observeXhr=function(t,r,n){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=(0,eI.zs)(r,2),s=i[0],a=i[1];try{this.$$AmplitudeAnalyticsEvent=(0,eI.Cl)({method:s,url:null==(e=null==a?void 0:a.toString)?void 0:e.call(a),headers:{}},o.getTimestamps())}catch(e){i5(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,r)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],l=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),r=new iZ(i.status,e,t?parseInt(t,10):void 0,s),n=i.$$AmplitudeAnalyticsEvent.headers,u=new iX(a,n);l.status=i.status,o.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,r,void 0,l.startTime,l.durationStart)}catch(e){i5(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),r.apply(i,t)},i.setRequestHeader=function(e,t){try{var r=this.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){i5(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}n.apply(this,[e,t])}}},e}()),i8="[Amplitude] Network Request",i7="500-599";function i9(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function oe(e,t){var r,n,i=t.split(",");try{for(var o=(0,eI.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,l=(0,eI.zs)(a.split("-").map(Number),2),u=l[0],c=l[1];if(e===u&&void 0===c||e>=u&&e<=c)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function ot(e){if(e)try{var t,r,n,i,o,s,a,l,u,c=null==(t=(0,eO.m)())?void 0:t.location.href,d=new URL(e,c),f=d.searchParams.toString(),h=d.hash.replace("#",""),p=d.href,g=d.host;d.hash="",d.search="";var v=d.href;return{query:f,fragment:h,href:p,hrefWithoutQueryOrHash:v,host:g}}catch(t){try{return i=(n=e.indexOf("#"))>=0?e.slice(n+1):"",a=(s=(o=n>=0?e.slice(0,n):e).indexOf("?"))>=0?o.slice(s+1):"",u=(l=s>=0?o.slice(0,s):o).match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i),{query:a,fragment:i,href:e,hrefW
1ithoutQueryOrHash:l,host:null!=(r=null==u?void 0:u[1])?r:""}}catch(e){return}}}function or(e){return"object"!=typeof e||null===e?e?(0,eI.fX)([],(0,eI.zs)(e4.j7),!1):void 0:0!==e.length?e:void 0}function on(e){var t,r,n;return!(null==(t=null==e?void 0:e.allowlist)?void 0:t.length)&&!(null==(r=null==e?void 0:e.blocklist)?void 0:r.length)&&!(null==(n=null==e?void 0:e.excludelist)?void 0:n.length)}(ec||(ec={})).NetworkObservable="networkObservable";var oi=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new(r8())(function(e){var r=new i4(function(t){var r={event:t,timestamp:Date.now(),type:"network"};e.next(r)});return i6.subscribe(r,t),function(){i6.unsubscribe(r)}});return(e={})[ec.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return(0,eI.sH)(void 0,void 0,void 0,function(){var s;return(0,eI.YH)(this,function(a){var l,u,c,d,f,h,p;return"u"<typeof document&&(null==(l=null==(u=(0,eO.m)())?void 0:u.navigator)?void 0:l.product)!=="ReactNative"?[2]:(s=n(),t=null==i?void 0:i.loggerProvider,d=(c={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,f=c.networkTrackingOptions,h=c.amplitude,p=c.loggerProvider,ed=d.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var r,n,i=ot(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(i9(o,"*.amplitude.com")||i9(o,"amplitude.com"))||(null==(r=t.ignoreHosts)?void 0:r.find(function(e){return i9(o,e)})))&&(!!t.captureRules||void 0===e.status||!!oe(e.status,i7))&&(!t.captureRules||((0,eI.fX)([],(0,eI.zs)(t.captureRules),!1).reverse().find(function(t){if(n=function(e,t,r,n,i){if((!e.hosts||e.hosts.find(function(e){return i9(t,e)}))&&(!n||!e.urls||nb(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!r&&0!==r||!!oe(r,e.statusCodeRange||i7))&&!0}(t,o,e.status,e.url,e.method)){var r=or(t.responseHeaders);if(e.responseWrapper&&r){var i=e.responseWrapper.headers(r);i&&(e.responseHeaders=i)}var s=or(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!on(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!on(t.requestBody)){var l=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,l)}}return void 0!==n}),!!n))&&!(e.requestWrapper&&function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find(function(e){return e.event_type===i8}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,f)}).subscribe(function(e){var t,r,n,i=e.event,o=ot(i.url);if(o){var s=null==(r=i.responseWrapper)?void 0:r.bodySize,a=null==(n=i.requestWrapper)?void 0:n.bodySize;!function(e,t,r,n){(0,eI.sH)(this,void 0,void 0,function(){var i,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:if(!(t.requestBodyJson||t.responseBodyJson))return[3,2];return[4,Promise.all([t.requestBodyJson,t.responseBodyJson])];case 1:if(o=(i=eI.zs.apply(void 0,[a.sent(),2]))[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==n||n.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==n||n.debug("Failed to stringify response body")}a.label=2;case 2:return null==r||r.track(i8,e),[2]}})})}(((t={})["[Amplitude] URL"]=o.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=o.query,t["[Amplitude] URL Fragment"]=o.fragment,t["[Amplitude] Request Method"]=i.method,t["[Amplitude] Status Code"]=i.status,t["[Amplitude] Start Time"]=i.startTime,t["[Amplitude] Completion Time"]=i.endTime,t["[Amplitude] Duration"]=i.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=s,t["[Amplitude] Request Type"]=i.type,t["[Amplitude] Request Headers"]=i.requestHeaders,t["[Amplitude] Response Headers"]=i.responseHeaders,t),i,h,p)}}),null==t||t.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return ed.unsubscribe(),[2]})})}}};let oo=-1,os=e=>{addEventListener("pageshow",t=>{t.persisted&&(oo=t.timeStamp,e(t))},!0)},oa=(e,t,r,n)=>{let i,o;return s=>{let a;t.value>=0&&(s||n)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,a=t.value,t.rating=a>r[1]?"poor":a>r[0]?"needs-improvement":"good",e(t))}},ol=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ou=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},oc=()=>{let e=ou();return e?.activationStart??0},od=(e,t=-1)=>{let r=ou(),n="navigate";return oo>=0?n="back-forward-cache":r&&(document.prerendering||oc()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(0x82f79cd8fff*Math.random())+1e12}`,navigationType:n}},of=new WeakMap;function oh(e,t){return of.get(e)||of.set(e,new t),of.get(e)}class op{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}let og=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},ov=e=>{let t=!1;return()=>{t||(e(),t=!0)}},om=-1,oy=new Set,ob=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,ow=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of oy)e();isFinite(om)||(om="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",ow,!0))}},oS=()=>
1{if(om<0){let e=oc();om=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??ob(),addEventListener("visibilitychange",ow,!0),addEventListener("prerenderingchange",ow,!0),os(()=>{setTimeout(()=>{om=ob()})})}return{get firstHiddenTime(){return om},onHidden(e){oy.add(e)}}},oE=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},ok=[1800,3e3],oC=(e,t={})=>{oE(()=>{let r=oS(),n,i=od("FCP"),o=og("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-oc(),0),i.entries.push(t),n(!0)))});o&&(n=oa(e,i,ok,t.reportAllChanges),os(r=>{n=oa(e,i=od("FCP"),ok,t.reportAllChanges),ol(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},oI=[.1,.25],ox=0,oT=1/0,oP=0,o_=e=>{for(let t of e)t.interactionId&&(oT=Math.min(oT,t.interactionId),ox=(oP=Math.max(oP,t.interactionId))?(oP-oT)/7+1:0)},oO=()=>n?ox:performance.interactionCount??0,oA=0;class oR{u=[];l=new Map;m;p;v(){oA=oO(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((oO()-oA)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;let t=this.u.at(-1),r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);this.p?.(r)}}}let oM=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=ov(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},oD=[200,500];class oL{m;h(e){this.m?.(e)}}let oN=[2500,4e3],oH=[800,1800],oU=e=>{document.prerendering?oE(()=>oU(e)):"complete"!==document.readyState?addEventListener("load",()=>oU(e),!0):setTimeout(e)};function oF(e){var t,r;return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor((r=(null==(t=e.entries[0])?void 0:t.startTime)||0,performance.timeOrigin+r)),navigationStart:Math.floor(performance.timeOrigin)}}var oj=function(){var e=null,t=(0,eO.m)(),r=null==t?void 0:t.document,i=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,o){return(0,eI.sH)(void 0,void 0,void 0,function(){var s,a;return(0,eI.YH)(this,function(l){return void 0===r||(s=nw((null==i?void 0:i.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==i?void 0:i.hostname)||"","[Amplitude] Page Location":s,"[Amplitude] Page Path":nw((null==i?void 0:i.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"u">typeof document&&document.title||"","[Amplitude] Page URL":nw(s.split("?")[0],t.loggerProvider)},((e,t={})=>{oE(()=>{let r=oS(),n,i=od("LCP"),o=oh(t,oL),s=e=>{for(let s of(t.reportAllChanges||(e=e.slice(-1)),e))o.h(s),s.startTime<r.firstHiddenTime&&(i.value=Math.max(s.startTime-oc(),0),i.entries=[s],n())},a=og("largest-contentful-paint",s);if(a){n=oa(e,i,oN,t.reportAllChanges);let r=ov(()=>{s(a.takeRecords()),a.disconnect(),n(!0)}),o=e=>{e.isTrusted&&(oM(r),removeEventListener(e.type,o,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});os(r=>{n=oa(e,i=od("LCP"),oN,t.reportAllChanges),ol(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})})(function(e){a["[Amplitude] LCP"]=oF(e)}),oC(function(e){a["[Amplitude] FCP"]=oF(e)}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let r=oS();oE(()=>{"interactionCount"in performance||n||(n=og("event",o_,{type:"event",buffered:!0,durationThreshold:0}));let i,o=od("INP"),s=oh(t,oR),a=e=>{oM(()=>{for(let t of e)s.h(t);let t=s.L();t&&t.P!==o.value&&(o.value=t.P,o.entries=t.entries,i())})},l=og("event",a,{durationThreshold:t.durationThreshold??40});i=oa(e,o,oD,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden(()=>{a(l.takeRecords()),i(!0)}),os(()=>{s.v(),i=oa(e,o=od("INP"),oD,t.reportAllChanges)}))})})(function(e){a["[Amplitude] INP"]=oF(e)}),((e,t={})=>{let r=oS();oC(ov(()=>{let n,i=od("CLS",0),o=oh(t,op),s=e=>{for(let t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=og("layout-shift",s);a&&(n=oa(e,i,oI,t.reportAllChanges),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),os(()=>{o.i=0,n=oa(e,i=od("CLS",0),oI,t.reportAllChanges),ol(()=>n())}),setTimeout(n))}))})(function(e){a["[Amplitude] CLS"]=oF(e)}),((e,t={})=>{let r=od("TTFB"),n=oa(e,r,oH,t.reportAllChanges);oU(()=>{let i=ou();i&&(r.value=Math.max(i.responseStart-oc(),0),r.entries=[i],n(!0),os(()=>{(n=oa(e,r=od("TTFB",0),oH,t.reportAllChanges))(!0)}))})})(function(e){a["[Amplitude] TTFB"]=oF(e)}),e=function(){"hidden"===r.visibilityState&&e&&(o.track("[Amplitude] Web Vitals",a),r.removeEventListener("visibilitychange",e),e=null)},r.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return e&&(null==r||r.removeEventListener("visibilitychange",e)),[2]})})}}},oq=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),[e4.r,t,e.substring(0,r)].filter(
1Boolean).join("_")},oB=function(){function e(e,t){var r;this.shouldTrackNewCampaign=!1,this.options=(0,eI.Cl)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:rI((null==(r=t.cookieOptions)?void 0:r.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=oq(t.apiKey,"MKTG"),this.webExpStorageKey=oq(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=e4.F3,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=eI.zs.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||tS(this.sessionTimeout,this.lastEventTime),!rE(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e;return(0,eI.YH)(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:if(!(e=t.sent()))return[3,3];return[4,this.storage.remove(this.webExpStorageKey)];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new rz().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,r,n=(t=this.currentCampaign,r=this.options,tv(Object.entries((0,eI.Cl)((0,eI.Cl)({},e4.F3),t)).reduce(function(e,t){var n,i=(0,eI.zs)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!=(n=null!=s?s:r.initialEmptyValue)?n:"EMPTY"),s)?e.set(o,s):e.unset(o)},new tg.T$)));return e&&(n.event_id=e),n},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),oz=new Set([ee.IDENTIFY,ee.GROUP_IDENTIFY]),oY=function(e){void 0===e&&(e={});var t,r,n,i,o,s,a,l=null!=(t=e.fallbackAttributionEvent)&&t,u=(0,eO.m)(),c={},d=!1,f=!1,h=function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:return[4,new rz().parse()];case 1:return c=rB(e.sent()),l&&(null==n||n.log("Tracking attribution fallback event."),null==r||r.track("[Amplitude] Attribution",c)),[2]}})})},p=function(){h()},g=function(e){return new Proxy(e,{apply:function(e,t,r){Reflect.apply(e,t,r),d&&p()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(l){switch(l.label){case 0:return r=t,n=e.loggerProvider,d=!0,n.log("Installing event property attribution tracking."),[4,h()];case 1:if(l.sent(),!u)return[2];if(u.addEventListener("popstate",p),!f){if(i=Reflect.get(u.history,"pushState"),o=Reflect.get(u.history,"replaceState"),!i||!o)return[2];s=g(i),u.history.pushState=s,a=g(o),u.history.replaceState=a,f=!0}return[2]}})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return oz.has(e.event_type)||(e.event_properties=(0,eI.Cl)((0,eI.Cl)({},c),e.event_properties)),[2,e]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e,t;return(0,eI.YH)(this,function(r){return u&&(u.removeEventListener("popstate",p),e=Reflect.get(u.history,"pushState"),t=Reflect.get(u.history,"replaceState"),f&&e===s&&i&&(u.history.pushState=i),f&&t===a&&o&&(u.history.replaceState=o)),d=!1,f=!1,i=void 0,o=void 0,s=void 0,a=void 0,c={},[2]})})}}},oJ="AMP_CURRENT_PAGE",oW="AMP_PREVIOUS_PAGE",oV="AMP_URL_INFO";(w=ef||(ef={})).Direct="direct",w.Internal="internal",w.External="external";var oK=new Set([ee.IDENTIFY,ee.GROUP_IDENTIFY,ee.REVENUE]),o$=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=(0,eO.m)(),i=void 0,o=!1,s=void 0,a=!1,l=!1,u=function(e){var t;try{var r=nw(e,s);
1t=new URL(r).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="u">typeof location&&location.hostname||"",n=e?u(e):void 0;if(!n)return ef.Direct;var i=r.some(function(e){return -1!==t.indexOf(e)}),o=r.some(function(e){return -1!==n.indexOf(e)});return t===n||o&&i?ef.Internal:ef.External},d=function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,n,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(oV)];case 1:return e=a.sent(),t=nw("u">typeof location&&location.href||""),r=(null==e?void 0:e[oJ])||"",n=void 0,n=t===r?(null==e?void 0:e[oW])||"":r||document.referrer||"",[4,i.set(oV,((s={})[oJ]=t,s[oW]=n,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},f=function(){d()};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,eI.sH)(void 0,void 0,void 0,function(){var t,r,c,h,p,g,v,m;return(0,eI.YH)(this,function(y){switch(y.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),l=!0,!n)return[3,7];try{i=new t4(n.sessionStorage)}catch(e){null==s||s.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:if(o=null!=(m=y.sent())&&m,!(i&&o))return[3,6];return r=(t="u">typeof document&&document.referrer||"")?u(t):void 0,c="u">typeof location&&location.hostname||"",h=nw("u">typeof location&&location.href||""),[4,i.get(oV)];case 2:if(g=(null==(p=y.sent())?void 0:p[oJ])||"",!(r&&r!==c&&g!==h))return[3,4];return[4,i.set(oV,((v={})[oJ]=h,v[oW]=t,v))];case 3:return y.sent(),[3,6];case 4:return[4,d()];case 5:y.sent(),y.label=6;case 6:n.addEventListener("popstate",f),a||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,eI.zs)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),l&&f()}}),n.history.replaceState=new Proxy(n.history.replaceState,{apply:function(e,t,r){var n=(0,eI.zs)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),l&&f()}}),a=!0),y.label=7;case 7:return[2]}})})},execute:function(e){return(0,eI.sH)(void 0,void 0,void 0,function(){var t,r,n;return(0,eI.YH)(this,function(s){switch(s.label){case 0:if(t=nw("u">typeof location&&location.href||""),!(i&&o))return[3,2];return[4,i.get(oV)];case 1:if(n=(null==(r=s.sent())?void 0:r[oW])||"",oK.has(e.event_type))return[2,e];e.event_properties=(0,eI.Cl)((0,eI.Cl)({},e.event_properties||{}),{"[Amplitude] Page Domain":oX(e,"[Amplitude] Page Domain","u">typeof location&&location.hostname||""),"[Amplitude] Page Location":oX(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":oX(e,"[Amplitude] Page Path","u">typeof location&&nw(location.pathname)||""),"[Amplitude] Page Title":oX(e,"[Amplitude] Page Title",rq(rj)),"[Amplitude] Page URL":oX(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":n,"[Amplitude] Previous Page Type":c(n)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:if(n&&(n.removeEventListener("popstate",f),l=!1),!(i&&o))return[3,2];return[4,i.set(oV,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function oX(e,t,r){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?r:e.event_properties[t]}var oG=function(){var e,t,r;function n(t){if(t)try{var r=Function("return "+t)();if("function"==typeof r)return r;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}return{name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return(0,eI.sH)(void 0,void 0,void 0,function(){var o,s;return(0,eI.YH)(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null==(s=i.remoteConfig)?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){r=e&&"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body?n(e.body||""):n("")}),t=function(){var e;return null==(e=i.remoteConfigClient)?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return(0,eI.sH)(void 0,void 0,void 0,function(){var n;return(0,eI.YH)(this,function(i){if(r)try{return[2,null!=(n=r(t))?n:null]}catch(t){null==e||e.error("Could not execute custom enrichment function",t)}return[2,t]})})},teardown:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return t&&t(),[2]})})}}},oQ="userProperty",oZ="eventProperty",o0=function(e){return e===oQ||e===oZ},o1=[oQ,oZ],o2=function(e){var t=(0,eI.fX)([],(0,eI.zs)(new Set((Array.isArray(e)?e:[e]).filter(o0))),!1);return t.length>0?t:(0,eI.fX)([],(0,eI.zs)(o1),!1)},o3=function(e,t){return o2(e.trackingMethod).includes(t)},o4=function(e){return o3(e,oQ)},o5=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return(0,eI.C6)(t,e),t.prototype.init=function(e,t,r){var n,i;return void 0===e&&(e=""),arguments.length>2?(n=t,i=r):"string"==typeof t?(n=t,i=void 0):(n=null==t?void 0:t.userId,i=t),ex(this._init((0,eI.Cl)((0,eI.Cl)({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o,s,a,l,u;return(0,eI.sH)(this,void 0,void 0,function(){var c,d,f,h,p,g,v,m,y,b,w,S,E,k,C=this;return(0,eI.YH)(this,function(I){var x,T,P,_,O,A,R,M,D;switch(I.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,c=rM(t),d=null!=(r=t.loggerProvider)?r:new eP,t.loggerProvider||d.enable(null!=(n=t.logLevel)?n:G.Warn),f=null!=(i=t.serverZone)?i:"US",p=this._diagnosticsSampleRate,g=null==(o=t.enableDiagnostics)||o,!c)return[3,2];return h=new eM(t.apiKey,d,f,null==(s=t.remoteConfig)?void 0:s.serverUrl),[4,new Promise(function(e){null==h||h.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(p=i);var o=t.enabled;"boolean"==typeof o&&(g=o)}e()})})];case 1:I.sent(),I.label=2;case 2:return(v=new eK(t.apiKey,d,f,{enabled:g,sampleRate:p})).setTag("library","".concat(tK,"/").concat(tV)),v.setTag("platform","Web"),v.setTag("web_environment",function(){var e=(0,eO.m)();if(!e)return"unknown";var t=tB(e);return tz(e)?t?"chrome_extension_service_worker":"service_worker":tY(e)?"web_worker":void 0!==e.document?t?"chrome_extension":"browser":tJ(e)?"
1node":"unknown"}()),"u">typeof navigator&&v.setTag("user_agent",navigator.userAgent),[4,(x=t.apiKey,T=t,P=this,_=v,O={loggerProvider:d,serverZone:f,enableDiagnostics:g,diagnosticsSampleRate:p},void 0===T&&(T={}),(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,u,c,d,f,h,p,g,v,m,y,b,w,S,E,k,C,I,A,R,M,D,L,N,H,U,F,j,q,B,z,Y,J,W,V,K,$,X,G,Q,Z,ee,et;return(0,eI.YH)(this,function(er){var en,ei,eo,es;switch(er.label){case 0:if(e=T.identityStorage||rb,t="",!(e===rb&&!(null==(S=T.cookieOptions)?void 0:S.domain)&&(null==(E=T.cookieOptions)?void 0:E.domain)!==""))return[3,2];return[4,(en=void 0,ei=_,(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:return[4,new tQ(void 0,{diagnosticsClient:ei}).isEnabled()];case 1:if(!a.sent()||!en&&("u"<typeof location||!location.hostname)||1===(t=(e=null!=en?en:location.hostname).split(".")).length)return[2,""];for(r=[],n=1,rP.find(function(t){return e.endsWith(".".concat(t))})&&(n=2),i=t.length-n-1;i>=0;--i)r.push(t.slice(i).join("."));i=0,a.label=2;case 2:if(!(i<r.length))return[3,7];o=r[i],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,tQ.isDomainWritable(o)];case 4:if(a.sent())return[2,"."+o];return[3,6];case 5:return s=a.sent(),ei&&ei.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(o),error:s instanceof Error?s.message:String(s)}),[3,6];case 6:return i++,[3,2];case 7:return ei&&ei.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=er.sent(),er.label=2;case 2:return r=(0,eI.Cl)({domain:null!=(C=null==(k=T.cookieOptions)?void 0:k.domain)?C:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},T.cookieOptions),n={duplicateResolverFn:function(e){var t=t1(e);return!!t&&t2(JSON.parse(t).cookieDomain,r.domain)},diagnosticsClient:_},[4,(eo=i=rR(T.identityStorage,r,n),void 0===(es=null==(A=null==(I=T.cookieOptions)?void 0:I.upgrade)||A)&&(es=!0),(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l;return(0,eI.YH)(this,function(u){switch(u.label){case 0:return e="".concat(e4.r.toLowerCase(),"_").concat(x.substring(0,6)),[4,eo.getRaw(e)];case 1:if(!(t=u.sent()))return[2,{optOut:!1}];if(!es)return[3,3];return[4,eo.remove(e)];case 2:u.sent(),u.label=3;case 3:return n=(r=(0,eI.zs)(t.split("."),6))[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],[2,{deviceId:n,userId:ri(i),sessionId:rn(s),lastEventId:rn(l),lastEventTime:rn(a),optOut:!!o}]}})}))];case 3:return o=er.sent(),[4,i.get(t3(x))];case 4:return s=er.sent(),u=!(l=(a=e$()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<l,c=null!=(N=null!=(L=null!=(D=null!=(R=T.deviceId)?R:u?null!=(M=a.ampDeviceId)?M:a.deviceId:void 0)?D:null==s?void 0:s.deviceId)?L:o.deviceId)?N:eR(),d=null!=(H=null==s?void 0:s.lastEventId)?H:o.lastEventId,f=null!=(U=null==s?void 0:s.lastEventTime)?U:o.lastEventTime,h=null!=(j=null!=(F=T.optOut)?F:null==s?void 0:s.optOut)?j:o.optOut,p=null!=(q=null==s?void 0:s.sessionId)?q:o.sessionId,g=null==s?void 0:s.deferredSessionId,v=null!=(z=null!=(B=T.userId)?B:null==s?void 0:s.userId)?z:o.userId,P.previousSessionDeviceId=null!=(Y=null==s?void 0:s.deviceId)?Y:o.deviceId,P.previousSessionUserId=null!=(J=null==s?void 0:s.userId)?J:o.userId,m={ipAddress:null==(V=null==(W=T.trackingOptions)?void 0:W.ipAddress)||V,language:null==($=null==(K=T.trackingOptions)?void 0:K.language)||$,platform:null==(G=null==(X=T.trackingOptions)?void 0:X.platform)||G},y=null==s?void 0:s.pageCounter,b=null==s?void 0:s.debugLogsEnabled,void 0!==T.autocapture&&(T.defaultTracking=T.autocapture),[4,(w=new rA(x,T.appVersion,i,r,T.defaultTracking,T.autocapture,c,T.flushIntervalMillis,T.flushMaxRetries,T.flushQueueSize,e,T.ingestionMetadata,T.instanceName,d,f,null!=(Q=null==O?void 0:O.loggerProvider)?Q:T.loggerProvider,T.logLevel,T.minIdLength,T.offline,h,T.partnerId,T.plan,T.serverUrl,null!=(Z=null==O?void 0:O.serverZone)?Z:T.serverZone,p,g,T.sessionTimeout,T.storageProvider,m,T.transport,T.useBatch,T.fetchRemoteConfig,v,y,b,T.networkTrackingOptions,T.identify,null!=(ee=null==O?void 0:O.enableDiagnostics)?ee:T.enableDiagnostics,null!=(et=null==O?void 0:O.diagnosticsSampleRate)?et:P._diagnosticsSampleRate,_,T.remoteConfig,t,T.enableRequestBodyCompression,T.customEnrichment)).storageProvider.isEnabled()];case 5:return er.sent()||(w.loggerProvider.warn("Storage provider ".concat(w.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),w.storageProvider=new tX),[2,w]}})}))];case 3:if(m=I.sent(),!(c&&h))return[3,5];return[4,new Promise(function(e){null==h||h.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,n){m.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t&&function(e,t){var r,n;if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var r,n,i,o,s,a,l,u,c,d,f,h,p=Object.keys(t);try{for(var g=(0,eI.Ju)(p),v=g.next();!v.done;v=g.next()){var m=v.value;try{var y=t[m];"boolean"==typeof(null==y?void 0:y.enabled)&&(y.enabled?(delete y.enabled,0===Object.keys(y).length&&(t[m]=!0)):t[m]=!1),e(y)}catch(e){}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}
1try{if(null==(c=null==(u=null==(l=t.autocapture)?void 0:l.networkTracking)?void 0:u.captureRules)?void 0:c.length)try{for(var b=(0,eI.Ju)(t.autocapture.networkTracking.captureRules),w=b.next();!w.done;w=b.next()){var S=w.value;try{for(var E=(s=void 0,(0,eI.Ju)(["responseHeaders","requestHeaders"])),k=E.next();!k.done;k=E.next()){var C=k.value,I=null!=(d=S[C])?d:{},x=I.captureSafeHeaders,T=I.allowlist;if(x||T){if(void 0!==T&&!Array.isArray(T)){delete S[C];continue}S[C]=(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(x?e4.j7:[]),!1),(0,eI.zs)(null!=T?T:[]),!1)}}}catch(e){s={error:e}}finally{try{k&&!k.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}catch(e){}var P=null==(f=t.autocapture)?void 0:f.frustrationInteractions;P&&(P.rageClick&&(P.rageClicks=P.rageClick,delete P.rageClick),P.deadClick&&(P.deadClicks=P.deadClick,delete P.deadClick));try{var _=null==(h=t.autocapture)?void 0:h.elementInteractions;if(_&&"object"==typeof _&&(!0===_.viewportContentUpdated&&(_.viewportContentUpdated={}),!1===_.viewportContentUpdated&&(_.viewportContentUpdated={enabled:!1}),void 0!==_.exposureDuration)){var O=_.viewportContentUpdated;void 0===O?_.viewportContentUpdated={exposureDuration:_.exposureDuration}:"object"==typeof O&&void 0===O.exposureDuration&&!1!==O.enabled&&(O.exposureDuration=_.exposureDuration),delete _.exposureDuration}}catch(e){}}}(e);try{if(t.loggerProvider.debug("Update browser config with remote configuration:",tk(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var i=(0,eI.Cl)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(r=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:r.length)){i.elementInteractions=(0,eI.Cl)({},e.autocapture.elementInteractions);var o=i.elementInteractions,s=null!=(n=o.pageUrlAllowlist)?n:[],a=e.autocapture.elementInteractions.pageUrlAllowlistRegex;o.pageUrlAllowlist=r2(s,a,t.loggerProvider),delete o.pageUrlAllowlistRegex}var l=function(e,t){if("object"==typeof e&&null!==e&&(null==(i=e.captureRules)?void 0:i.length)){var r,n,i,o,s,a=(0,eI.Cl)({},e),l=null!=(o=a.captureRules)?o:[];try{for(var u=(0,eI.Ju)(l),c=u.next();!c.done;c=u.next()){var d=c.value;d.urls=r2(null!=(s=d.urls)?s:[],d.urlsRegex,t),delete d.urlsRegex}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return a}}(e.autocapture.networkTracking,t.loggerProvider);l&&(i.networkTracking=l),"boolean"==typeof t.autocapture&&(t.autocapture=(0,eI.Cl)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},i)),"object"==typeof t.autocapture&&(t.autocapture=(0,eI.Cl)((0,eI.Cl)({},t.autocapture),i))}t.defaultTracking=t.autocapture}"customEnrichment"in e&&null!==e.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=e.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",tk(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}(t,m),e()})})];case 4:I.sent(),I.label=5;case 5:return[4,e.prototype._init.call(this,m)];case 6:if(I.sent(),this.logBrowserOptions(m),this.config.remoteConfigClient=h,y=tT((A=this.config).defaultTracking)&&A.defaultTracking&&"object"==typeof A.defaultTracking&&A.defaultTracking.attribution&&"object"==typeof A.defaultTracking.attribution?(0,eI.Cl)({},A.defaultTracking.attribution):{},!(tT(this.config.defaultTracking)&&o4(y)))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,eI.sH)(C,void 0,void 0,function(){return(0,eI.YH)(this,function(t){switch(t.label){case 0:if(e)return[3,2];return this.webAttribution=new oB(y,this.config),[4,this.webAttribution.init()];case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new oB(y,this.config),[4,this.webAttribution.init()];case 7:I.sent(),I.label=8;case 8:if(S=!(!(w=(b=e$()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<w)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),-1!==(E=this.config.deferredSessionId)||this.config.optOut||(E=Date.now()),this.setSessionId(null!=(u=null!=(l=null!=(a=t.sessionId)?a:S)?l:E)?u:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,eI.sH)(C,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(k=e5(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(r1()).promise];case 9:I.sent(),I.label=10;case 10:return[4,this.add(new th({diagnosticsClient:v})).promise];case 11:return I.sent(),[4,this.add(new t$).promise];case 12:return I.sent(),[4,this.add(new tp).promise];case 13:if(I.sent(),r0(this.config),!tx(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(rQ()).promise];case 14:I.sent(),I.label=15;case 15:if(!tP(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(r$()).promise];case 16:I.sent(),I.label=17;case 17:if(!t_(this.config.defaultTracking))return[3,20];if(this.config.optOut)return[3,19];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rJ(tU(this.config))).promise];case 18:return I.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return(0,eI.sH)(C,void 0,void 0,function(){return(0,eI.YH)(this,function(t){switch(t.label){case 0:if(e)return[2];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rJ(tU(this.config))).promise];case 1:return t.sent(),[2]}})})}),I.label=20;case 20:if(!(tT(this.config.defaultTracking)&&o3(y,oZ)))return[3,22];return this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(oY(y)).promise];case 21:I.sent(),I.label=22;case 22:if(!tR(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(iR(tL(this.config),{diagnosticsClient:v})).promise];case 23:I.sent(),I.label=24;case 24:if(!tM(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(iJ(tN(this.config))).promise];
1case 25:I.sent(),I.label=26;case 26:if(!tA(this.config.autocapture))return[3,28];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(oi(tH(this.config))).promise];case 27:I.sent(),I.label=28;case 28:if(!("boolean"==typeof(R=this.config.autocapture)?R:"object"==typeof R&&!0===R.webVitals))return[3,30];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(oj()).promise];case 29:I.sent(),I.label=30;case 30:if("object"!=typeof(M=this.config.autocapture)||!0!==M.performanceTracking&&"object"!=typeof M.performanceTracking)return[3,32];return this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(iV(tD(this.config))).promise];case 31:I.sent(),I.label=32;case 32:if(!tx(this.config.autocapture,"pageUrlEnrichment"))return[3,34];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(o$()).promise];case 33:I.sent(),I.label=34;case 34:if(!("boolean"==typeof(D=this.config.customEnrichment)?D:"object"==typeof D&&null!==D&&!1!==D.enabled))return[3,36];return this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(oG()).promise];case 35:I.sent(),I.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return I.sent(),k.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=(0,eI.Tt)(t,["time"]);C.track(e.eventType,n,"number"==typeof r?{time:r}:void 0)}),[2]}})})},t.prototype.getUserId=function(){var e;return null==(e=this.config)?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,this.timeline.onIdentityChanged({userId:e}),e6(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.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),e8(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(eR()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null==(e=this.config)?void 0:e.deviceId,userId:null==(t=this.config)?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var t,r,n,i=new tg.T$,o=null!=(n=e.userProperties)?n:{};try{for(var s=(0,eI.Ju)(Object.entries(o)),a=s.next();!a.done;a=s.next()){var l=(0,eI.zs)(a.value,2),u=l[0],c=l[1];i.set(u,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null==(e=this.config)?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null==(e=this.config)?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ex(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ex(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ex(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!=(t=this.config.lastEventId)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,tO(this.config.defaultTracking)&&(n&&i&&r.push(this.track(rc,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:n,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,r);return this.config.identify&&r.push(this.track(tv(this.config.identify)).promise),tO(this.config.defaultTracking)&&r.push(this.track(ru,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,ex(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=
1Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=rD(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(tq(t)){var n=t._q;t._q=[],t=tj(new tg.T$,n)}return(null==r?void 0:r.user_id)&&this.setUserId(r.user_id),(null==r?void 0:r.device_id)&&this.setDeviceId(r.device_id),e.prototype.identify.call(this,t,r)},t.prototype.groupIdentify=function(t,r,n,i){if(tq(n)){var o=n._q;n._q=[],n=tj(new tg.T$,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(tq(t)){var n=t._q;t._q=[],t=tj(new tw,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!o4(this.webAttribution.options))return!1;var r=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n,i;return(0,eI.YH)(this,function(o){return r=Date.now(),n=tS(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==ru&&t.event_type!==rc&&(!t.session_id||t.session_id===this.getSessionId())&&(n||i?(this.setSessionId(r),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):n||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,eI.Cl)((0,eI.Cl)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",tk(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1)&&!(e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t}(tI),o6=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,eI.C6)(t,e),t.prototype.send=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,eI.Cl)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"})];case 1:return[4,(r=i.sent()).text()];case 2:n=i.sent();try{return[2,this.buildResponse(JSON.parse(n))]}catch(e){return[2,this.buildResponse({code:r.status})]}}})})},t}(t9);(S=eh||(eh={})).US="US",S.EU="EU",S.STAGING="STAGING";var o8="[Amplitude]",o7="".concat(o8," Session Replay ID"),o9=eh.US,se={enabled:!0},st="".concat(o8," Session Replay Debug"),sr="amp-mask",sn="amp-unmask",si="https://api-sr.amplitude.com/sessions/v2/track",so="https://api-sr.eu.amplitude.com/sessions/v2/track",ss="https://api-sr.stag2.amplitude.com/sessions/v2/track";e4.r;var sa=/payload.*exceed/i,sl="X-Session-Replay-Event-Skipped",su="amplitude-sr-iframe";(E=ep||(ep={})).GET_SR_PROPS="get-sr-props",E.DEBUG_INFO="debug-info",E.FETCH_REQUEST="fetch-request",E.METADATA="metadata",E.TARGETING_DECISION="targeting-decision",E.REPLAY_GATE_DECISION="replay-gate-decision";var sc=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){if(!this.logger)return function(){};var t,r=this.logger[e];return"function"==typeof r?(null!=(t=r.__rrweb_original__)?t:r).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),sd="medium",sf=function(e,t,r){switch(t){case"light":if("input"!==e)return!1;var n,i,o=r?(i=(n=r).type,n.hasAttribute("data-rr-is-password")?"password":i?i.toLowerCase():null):"";if(!o)return!1;if(["password","hidden","email","tel"].includes(o)||r.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":return"input"===e;case"conservative":return!0;default:return sf(e,sd,r)}},sh=function(e,t){if(e&&t.urlMaskLevels)try{for(var r,n,i,o=(0,eI.Ju)(t.urlMaskLevels),s=o.next();!s.done;s=o.next()){var a=s.value;if(sy(a.match).test(e))return a.maskLevel}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null!=(i=t.defaultMaskLevel)?i:sd},sp=function(e,t,r,n){var i,o;if(void 0===t&&(t={defaultMaskLevel:sd}),r){if(r.closest("."+sr)||(null!=(i=t.maskSelector)?i:[]).some(function(e){return r.closest(e)}))return!0;
1if(r.closest("."+sn)||(null!=(o=t.unmaskSelector)?o:[]).some(function(e){return r.closest(e)}))return!1}return sf(e,sh(n,t),r)},sg=function(e,t,r){return function(n,i){return sp(e,t,i,null==r?void 0:r())?n.replace(/[^\s]/g,"*"):n}},sv=function(){var e=(0,eO.m)();return(null==e?void 0:e.location)?e.location.href:""},sm=new Map,sy=function(e){var t=sm.get(e);if(t)return t;var r="\0TRAIL\0",n="\0MID\0",i="\0DS\0",o="\0ST\0",s="\0QU\0",a=e;a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.replace(/\/\*\*$/,r)).replace(/\/\*\*\//g,n)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(r).join("(/.*)?")).split(n).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var l=new RegExp("^".concat(a,"$"));return sm.set(e,l),l},sb=function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){var t;return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t)}))throw Error("ugcFilterRules must be an array of objects with valid globs")},sw=function(e,t){var r,n;try{for(var i=(0,eI.Ju)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=sy(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},sS=function(){return(0,eI.sH)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,eO.m)()))return[3,2];return[4,e.navigator.storage.estimate()];case 1:return r=(t=i.sent()).usage,n=t.quota,[2,{totalStorageSize:r?Math.round(r/1024):0,percentOfQuota:r&&n?Math.round((r/n+Number.EPSILON)*1e3)/1e3:0,usageDetails:JSON.stringify(t.usageDetails)}];case 2:return[3,4];case 3:return i.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},sE=function(e){var t=(0,eI.Cl)({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},sk=function(){return{flushMaxRetries:2,logLevel:G.Warn,loggerProvider:new eP,transportProvider:new o6}},sC=function(e){function t(t,r){var n,i,o,s,a,l,u,c,d,f,h,p,g,v,m=this,y=sk();return(m=e.call(this,(0,eI.Cl)((0,eI.Cl)({transportProvider:y.transportProvider,loggerProvider:new sc(r.loggerProvider||y.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=y.flushMaxRetries?r.flushMaxRetries:y.flushMaxRetries,m.apiKey=t,m.sampleRate=r.sampleRate||0,m.serverZone=r.serverZone||o9,m.configServerUrl=r.configServerUrl,m.trackServerUrl=r.trackServerUrl,m.shouldInlineStylesheet=r.shouldInlineStylesheet,m.inlineImages=r.inlineImages,m.version=r.version,m.performanceConfig=r.performanceConfig||se,m.storeType=null!=(n=r.storeType)?n:"memory",m.applyBackgroundColorToBlockedElements=null!=(i=r.applyBackgroundColorToBlockedElements)&&i,m.enableUrlChangePolling=null!=(o=r.enableUrlChangePolling)&&o,m.urlChangePollingInterval=null!=(s=r.urlChangePollingInterval)?s:1e3,m.captureDocumentTitle=null!=(a=r.captureDocumentTitle)&&a,void 0!==r.fullSnapshotIntervalMs&&(m.fullSnapshotIntervalMs=r.fullSnapshotIntervalMs),void 0!==r.eagerFullSnapshotSend&&(m.eagerFullSnapshotSend=r.eagerFullSnapshotSend),m.captureFullSnapshotOnFocus=null!=(l=r.captureFullSnapshotOnFocus)&&l,void 0!==r.maxPersistedEventsSizeBytes&&(m.maxPersistedEventsSizeBytes=sP(r.maxPersistedEventsSizeBytes,sI,sx,"maxPersistedEventsSizeBytes",m.loggerProvider)),void 0!==r.maxSingleEventSizeBytes&&(m.maxSingleEventSizeBytes=sP(r.maxSingleEventSizeBytes,sI,sT,"maxSingleEventSizeBytes",m.loggerProvider)),m.privacyConfig=(0,eI.Cl)((0,eI.Cl)({},null!=(u=r.privacyConfig)?u:{}),{unmaskSelector:Array.from(new Set((0,eI.fX)([".".concat(sn)],(0,eI.zs)(null!=(d=null==(c=r.privacyConfig)?void 0:c.unmaskSelector)?d:[]),!1)))}),r.interactionConfig&&(m.interactionConfig=r.interactionConfig,m.interactionConfig.ugcFilterRules&&sb(m.interactionConfig.ugcFilterRules)),r.debugMode&&(m.debugMode=r.debugMode),m.useWebWorker=null==(p=null!=(f=r.useWebWorker)?f:null==(h=r.experimental)?void 0:h.useWebWorker)||p,m.enableTransportCompression=null==(g=r.enableTransportCompression)||g,m.sendTimeoutMs=r.sendTimeoutMs,m.captureAdoptedStyleSheets=null==(v=r.captureAdoptedStyleSheets)||v,r.crossOriginIframes&&(m.crossOriginIframes=r.crossOriginIframes),r.flushIntervalConfig?m.flushIntervalConfig=function(e,t){var r,n,i={};if(void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<100?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(100,"ms; clamping.")),i.minIntervalMs=100):i.minIntervalMs=e.minIntervalMs),void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<100?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(100,"ms; clamping.")),i.maxIntervalMs=100):i.maxIntervalMs=e.maxIntervalMs),void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!=(r=i.minIntervalMs)?r:500,s=null!=(n=i.maxIntervalMs)?n:1e4;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(1e4,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(500,"); lowering min to match max.")),i.minIntervalMs=s):(t.warn("flushIntervalConfig.maxIntervalMs (".concat(i.maxIntervalMs,") is less than minIntervalMs (").concat(i.minIntervalMs,"); raising max to match min.")),i.maxIntervalMs=i.minIntervalMs))}return i}(r.flushIntervalConfig,m.loggerProvider):m.flushIntervalConfig={minIntervalMs:1e3,maxIntervalMs:1e4},m.handleSendEvents=r.handleSendEvents,m.handleFetchConfig=r.handleFetchConfig,m}return(0,eI.C6)(t,e),t}(tr),sI=1e3,sx=8e6,sT=1e7;function sP(e,t,r,n,i){return Number.isFinite(e)?e<t?(i.warn("".concat(n," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>r?(i.warn("".concat(n," ").concat(e," exceeds ceiling ").concat(r,";
1 clamping.")),r):e:void i.warn("".concat(n," value is not a finite number (got ").concat(String(e),"); ignoring."))}var s_=((k=s_||{})[k.DomContentLoaded=0]="DomContentLoaded",k[k.Load=1]="Load",k[k.FullSnapshot=2]="FullSnapshot",k[k.IncrementalSnapshot=3]="IncrementalSnapshot",k[k.Meta=4]="Meta",k[k.Custom=5]="Custom",k[k.Plugin=6]="Plugin",k),sO=((C=sO||{})[C.Mutation=0]="Mutation",C[C.MouseMove=1]="MouseMove",C[C.MouseInteraction=2]="MouseInteraction",C[C.Scroll=3]="Scroll",C[C.ViewportResize=4]="ViewportResize",C[C.Input=5]="Input",C[C.TouchMove=6]="TouchMove",C[C.MediaInteraction=7]="MediaInteraction",C[C.StyleSheetRule=8]="StyleSheetRule",C[C.CanvasMutation=9]="CanvasMutation",C[C.Font=10]="Font",C[C.Log=11]="Log",C[C.Drag=12]="Drag",C[C.StyleDeclaration=13]="StyleDeclaration",C[C.Selection=14]="Selection",C[C.AdoptedStyleSheet=15]="AdoptedStyleSheet",C[C.CustomElement=16]="CustomElement",C),sA=((I=sA||{})[I.MouseUp=0]="MouseUp",I[I.MouseDown=1]="MouseDown",I[I.Click=2]="Click",I[I.ContextMenu=3]="ContextMenu",I[I.DblClick=4]="DblClick",I[I.Focus=5]="Focus",I[I.Blur=6]="Blur",I[I.TouchStart=7]="TouchStart",I[I.TouchMove_Departed=8]="TouchMove_Departed",I[I.TouchEnd=9]="TouchEnd",I[I.TouchCancel=10]="TouchCancel",I),sR=((x=sR||{})[x.Mouse=0]="Mouse",x[x.Pen=1]="Pen",x[x.Touch=2]="Touch",x),sM=((T=sM||{})[T["2D"]=0]="2D",T[T.WebGL=1]="WebGL",T[T.WebGL2=2]="WebGL2",T),sD=((P=sD||{})[P.Play=0]="Play",P[P.Pause=1]="Pause",P[P.Seeked=2]="Seeked",P[P.VolumeChange=3]="VolumeChange",P[P.RateChange=4]="RateChange",P),sL=((_=sL||{}).Start="start",_.Pause="pause",_.Resume="resume",_.Resize="resize",_.Finish="finish",_.FullsnapshotRebuilded="fullsnapshot-rebuilded",_.LoadStylesheetStart="load-stylesheet-start",_.LoadStylesheetEnd="load-stylesheet-end",_.SkipStart="skip-start",_.SkipEnd="skip-end",_.MouseInteraction="mouse-interaction",_.EventCast="event-cast",_.CustomEvent="custom-event",_.Flush="flush",_.StateChange="state-change",_.PlayBack="play-back",_.Destroy="destroy",_.SeekStart="seek-start",_.SeekEnd="seek-end",_),sN=((O=sN||{})[O.Document=0]="Document",O[O.DocumentType=1]="DocumentType",O[O.Element=2]="Element",O[O.Text=3]="Text",O[O.CDATA=4]="CDATA",O[O.Comment=5]="Comment",O),sH=function(e,t){var r=document.createDocumentFragment(),n=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),0!==(e=e.filter(function(e){try{r.querySelector(e)}catch(r){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})).length)return e};return e.blockSelector=n(e.blockSelector),e.maskSelector=n(e.maskSelector),e.unmaskSelector=n(e.unmaskSelector),e},sU=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,r,n,i,o,s;return(0,eI.sH)(this,void 0,void 0,function(){var a,l,u,c,d,f,h,p,g,v,m,y,b,w,S,E,k,C=this;return(0,eI.YH)(this,function(I){switch(I.label){case 0:(a=(0,eI.Cl)({},this.localConfig)).optOut=this.localConfig.optOut,a.captureEnabled=!0,I.label=1;case 1:return I.trys.push([1,3,,4]),[4,new Promise(function(e,t){C.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(r,n){if(C.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(n,":"),JSON.stringify(r,null,2)),!r)return void t(Error("No remote config received"));var i,o=r.sr_sampling_config,s=r.sr_privacy_config,u=r.sr_targeting_config,c=null==(i=a.interactionConfig)?void 0:i.ugcFilterRules;a.interactionConfig=r.sr_interaction_config,a.interactionConfig&&c&&(a.interactionConfig.ugcFilterRules=c),a.loggingConfig=r.sr_logging_config,(o||s||u)&&(l={},o&&(l.sr_sampling_config=o),s&&(l.sr_privacy_config=s),u&&(l.sr_targeting_config=u)),e()})})];case 2:return I.sent(),[3,4];case 3:return u=I.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",u),a.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:void 0}];case 4:if(!l)return[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:l}];if(c=l.sr_sampling_config,d=l.sr_privacy_config,f=l.sr_targeting_config,c&&Object.keys(c).length>0?(Object.prototype.hasOwnProperty.call(c,"capture_enabled")?a.captureEnabled=c.capture_enabled:a.captureEnabled=!1,Object.prototype.hasOwnProperty.call(c,"sample_rate")&&(a.sampleRate=c.sample_rate),Object.prototype.hasOwnProperty.call(c,"min_session_duration_ms")&&(a.minSessionDurationMs=this.sanitizeMinSessionDurationMs(c.min_session_duration_ms))):(a.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),d){h=null!=(e=a.privacyConfig)?e:{},p={defaultMaskLevel:null!=(r=null!=(t=d.defaultMaskLevel)?t:h.defaultMaskLevel)?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,eI.fX)([],(0,eI.zs)(new Set((0,eI.fX)((0,eI.fX)([],(0,eI.zs)(null!=(n=h.maskAttributes)?n:[]),!1),(0,eI.zs)(null!=(i=d.maskAttributes)?i:[]),!1))),!1),urlMaskLevels:(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(null!=(o=d.urlMaskLevels)?o:[]),!1),(0,eI.zs)(null!=(s=h.urlMaskLevels)?s:[]),!1)},g=function(e){var t,r,n,i,o,s,a,l,u,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,eI.Ju)(null!=(a=e.blockSelector)?a:[]),f=d.next();!f.done;f=d.next()){var h=f.value;c[h]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}try{for(var p=(0,eI.Ju)(null!=(l=e.maskSelector)?l:[]),g=p.next();!g.done;g=p.next()){var h=g.value;c[h]="mask"}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}try{for(var v=(0,eI.Ju)(null!=(u=e.unmaskSelector)?u:[]),m=v.next();!m.done;m=v.next()){var h=m.value;c[h]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return c},v=(0,eI.Cl)((0,eI.Cl)({},g(h)),g(d));try{for(y=(m=(0,eI.Ju)(Object.entries(v))).next();!y.done;y=m.next())w=(b=(0,eI.zs)(y.value,2))[0],S=b[1],"mask"===S?p.maskSelector.push(w):"block"===S?p.blockSelector.push(w):"unmask"===S&&p.unmaskSelector.push(w)}catch(e){E={error:e}}finally{try{y&&!y.done&&(k=m.return)&&k.call(m)}finally{if(E)throw E.error}}a.privacyConfig=sH(p,this.localConfig.loggerProvider)}return f&&Object.keys(f).length>0&&(a.targetingConfig=f),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:sE(a)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:l}]}})})},e.prototype.sanitizeMinSessionDurationMs=function(e){return"number"==typeof e&&Number.isFinite(e)?e<0?void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(e,"); ignoring.")):e>sF?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(sF,"ms ceiling; clamping.")),sF):e:void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),sF=6e4;function sj(e,t){return t||("STAGING"===e?ss:"EU"===e?so:si)}function sq(e){if(e.type!==s_.IncrementalSnapshot)return!1;var t=e.data;return t.source===sO.Mutation&&!t.isAttachIframe}var sB=function(){function e(e,t,r,n,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e.type,r=e.timestamp,n=e.delay,i=e.data;return null!=n?JSON.stringify({type:t,timestamp:r,delay:n,data:i}):JSON.stringify({type:t,timestamp:r,data:i})},this.addCompressedEventToManager=function(e,t){var r,n=new Blob([e]).size;n>(null!=(r=s.config.maxSingleEventSizeBytes)?r:9e6)?s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(n/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")):s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId})},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var r=s.compressEvent(e);s.addCompressedEventToManager(r,t)}},this.flushQueue=function(){var e;
1for(s.pendingQueue.length>0&&(e=s.taskQueue).push.apply(e,(0,eI.fX)([],(0,eI.zs)(s.mergeMutationTasks(s.pendingQueue.splice(0))),!1));s.taskQueue.length>0;){var t=s.taskQueue.shift();if(t){var r=t.event,n=t.sessionId,i=s.compressEvent(r);s.addCompressedEventToManager(i,n)}}s.isProcessing=!1},this.terminate=function(){var e;null==(e=s.worker)||e.terminate()};var a=(0,eO.m)();if(this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=r,this.timeout=(null==(o=t.performanceConfig)?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,n){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([n],{type:"application/javascript"}),u=URL.createObjectURL(l),c=new Worker(u);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0},c.onmessage=function(e){var t=e.data,r=t.compressedEvent,n=t.sessionId;s.addCompressedEventToManager(r,n)},this.worker=c}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){if(e.type===s_.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var r,n,i,o,s=(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(this.taskQueue.splice(0)),!1),(0,eI.zs)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var a=(0,eI.Ju)(s),l=a.next();!l.done;l=a.next()){var u=l.value,c=this.compressEvent(u.event);this.addCompressedEventToManager(c,u.sessionId)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}this.isProcessing=!1}var d=this.compressEvent(e);this.addCompressedEventToManager(d,t),null==(i=this.onFullSnapshotProcessed)||i.call(this);return}this.canUseIdleCallback&&(null==(o=this.config.performanceConfig)?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.pendingQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){var t,r=this;for(this.pendingQueue.length>0&&(t=this.taskQueue).push.apply(t,(0,eI.fX)([],(0,eI.zs)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1));this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var i=n.event,o=n.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(e){r.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){if((null==(n=this.config.performanceConfig)?void 0:n.mergeMutations)===!1||e.length<=1)return e;for(var t,r,n,i=[],o=0;o<e.length;){for(var s=e[o].sessionId,a=o+1;a<e.length&&e[a].sessionId===s;)a++;var l=function(e){if(e.length<=1)return e;for(var t=[],r=0;r<e.length;){if(!sq(e[r])){t.push(e[r]),r++;continue}for(var n=r+1;n<e.length&&sq(e[n]);)n++;t.push(n>r+1?function(e){var t,r,n,i,o=e[0],s=new Map,a=new Map,l=new Map,u=new Map,c=new Map;e.forEach(function(e,t){var r,n,i,o,d=e.data;try{for(var f=(0,eI.Ju)(d.adds),h=f.next();!h.done;h=f.next()){var p=h.value;s.has(p.node.id)||s.set(p.node.id,t),a.set(p.node.id,t),c.set(p.node.id,p.parentId)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}try{for(var g=(0,eI.Ju)(d.removes),v=g.next();!v.done;v=g.next()){var m=v.value;l.has(m.id)||l.set(m.id,t),u.set(m.id,t)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}});var d=new Set,f=new Set;try{for(var h=(0,eI.Ju)(s),p=h.next();!p.done;p=h.next()){var g=(0,eI.zs)(p.value,2),v=g[0],m=g[1],y=l.get(v);if(void 0!==y){var b=a.get(v),w=u.get(v);!(b>=w)&&(m<y?d.add(v):y<m&&f.add(v))}}}catch(e){t={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}var S=new Set;if(d.size>0||f.size>0)for(var E=!0;
1E;){E=!1;try{for(var k=(n=void 0,(0,eI.Ju)(c)),C=k.next();!C.done;C=k.next()){var I=(0,eI.zs)(C.value,2),x=I[0],T=I[1];if(!d.has(x)&&!f.has(x)&&!S.has(x)&&(d.has(T)||f.has(T)||S.has(T))){var P=l.get(x),_=s.get(x);void 0!==P&&void 0!==_&&P<_?f.add(x):void 0!==P&&void 0!==_&&P===_?S.add(x):d.add(x),E=!0}}}catch(e){n={error:e}}finally{try{C&&!C.done&&(i=k.return)&&i.call(k)}finally{if(n)throw n.error}}}var O=d.size>0||f.size>0||S.size>0,A=[];e.forEach(function(e,t){var r,n;try{for(var i=(0,eI.Ju)(e.data.removes),o=i.next();!o.done;o=i.next()){var a=o.value;!(d.has(a.id)||f.has(a.id)&&t>=s.get(a.id))&&(S.has(a.id)&&(d.has(a.parentId)||f.has(a.parentId)||S.has(a.parentId))||A.push(a))}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}});var R=e.flatMap(function(e){return e.data.adds}),M=e.flatMap(function(e){return e.data.texts}),D=e.flatMap(function(e){return e.data.attributes}),L=O?D.filter(function(e){return!d.has(e.id)&&!f.has(e.id)&&!S.has(e.id)}):D,N={source:sO.Mutation,removes:A,adds:O?R.filter(function(e){return!d.has(e.node.id)&&!f.has(e.node.id)&&!S.has(e.node.id)}):R,texts:O?M.filter(function(e){return!d.has(e.id)&&!f.has(e.id)&&!S.has(e.id)}):M,attributes:function(e){var t,r,n=new Map;if(e.forEach(function(e,t){if(e.attributes&&"style"in e.attributes){var r=n.get(e.id);r?r.push(t):n.set(e.id,[t])}}),0===n.size)return e;var i=function(t){return e[t].attributes.style},o=new Set,s=new Map;try{for(var a=(0,eI.Ju)(n.values()),l=a.next();!l.done;l=a.next()){var u=l.value;!function(e){if(1!==e.length){var t=-1;e.forEach(function(e,r){var n;("object"!=typeof(n=i(e))||null===n)&&(t=r)});var r=[];
1if(e.forEach(function(e,n){n!==t&&(o.add(e),n>t&&r.push(e))}),r.length>0){var n=r[r.length-1],a=function(e){var t,r,n,i,o={};try{for(var s=(0,eI.Ju)(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(n=void 0,(0,eI.Ju)(Object.keys(l))),c=u.next();!c.done;c=u.next()){var d=c.value;o[d]=l[d]}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o}(r.map(function(e){return i(e)}));o.delete(n),s.set(n,a)}}}(u)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}if(0===o.size&&0===s.size)return e;var c=[];return e.forEach(function(e,t){var r=s.get(t);if(void 0!==r)return void c.push((0,eI.Cl)((0,eI.Cl)({},e),{attributes:(0,eI.Cl)((0,eI.Cl)({},e.attributes),{style:r})}));if(!o.has(t))return void c.push(e);var n=(0,eI.Cl)({},e.attributes);delete n.style,Object.keys(n).length>0&&c.push((0,eI.Cl)((0,eI.Cl)({},e),{attributes:n}))}),c}(L)};return(0,eI.Cl)((0,eI.Cl)({},o),{data:N})}(e.slice(r,n)):e[r]),r=n}return t}(e.slice(o,a).map(function(e){return e.event}));try{for(var u=(t=void 0,(0,eI.Ju)(l)),c=u.next();!c.done;c=u.next()){var d=c.value;i.push({event:d,sessionId:s})}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}o=a}return i},e}(),sz="Session replay event batch rejected due to exceeded retry count",sY="Failed to store session replay events in IndexedDB",sJ="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",sW="1.50.0",sV=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher,i=e.workerScript,o=e.enableTransportCompression,s=e.sendTimeoutMs,a=e.handleSendEvents,l=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.timedOutWorkerRequests=new Map,this.flushPauseUntilMs=0,this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,this.mergeLogFiredThisPause=!1,this.killedSessions=new Set,this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t,this.enableTransportCompression=null==o||o,this.sendTimeoutMs=null!=s?s:1e4,this.handleSendEvents=a,i)try{var u=new Blob([i],{type:"application/javascript"}),c=URL.createObjectURL(u),d=new Worker(c);d.onerror=function(e){var t,n;e.preventDefault(),r.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),d.terminate(),l.worker=void 0;try{for(var i=(0,eI.Ju)(l.pendingWorkerRequests),o=i.next();!o.done;o=i.next()){var s=(0,eI.zs)(o.value,2)[1];s.timeout&&clearTimeout(s.timeout),r.warn("Session replay event send failed due to worker crash: ".concat(e.message)),s.resolve()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}l.pendingWorkerRequests.clear(),l.timedOutWorkerRequests.clear()},d.onmessage=function(e){var t=e.data;if("log"===t.type)r.log(t.message);else if("warn"===t.type)r.warn(t.message);else if("payload_too_large"===t.type){var n=l.pendingWorkerRequests.get(t.id);if(n)n.timeout&&clearTimeout(n.timeout),l.handlePayloadTooLargeResponse(n.context,t.isWaf),n.resolve(),l.pendingWorkerRequests.delete(t.id);else{var i=l.timedOutWorkerRequests.get(t.id);i&&(l.timedOutWorkerRequests.delete(t.id),l.handlePayloadTooLargeResponse(i,t.isWaf))}}else if("complete"===t.type){var o=l.pendingWorkerRequests.get(t.id);if(o)o.timeout&&clearTimeout(o.timeout),void 0!==t.skipCode&&l.applyServerDirective(o.context.sessionId,t.skipCode),l.completeRequest({context:o.context}),o.resolve(),l.pendingWorkerRequests.delete(t.id);else{var i=l.timedOutWorkerRequests.get(t.id);i&&(l.timedOutWorkerRequests.delete(t.id),void 0!==t.skipCode&&l.applyServerDirective(i.sessionId,t.skipCode),l.completeRequest({context:i}))}}else"fetch-request"===t.type&&l.handleDelegatedFetch(d,t).catch(function(e){r.warn("Failed to handle delegated session replay fetch:",e)})},this.worker=d}catch(e){r.error("Failed to create track destination worker, falling back to main-thread sending:",e)}}return e.prototype.sendEventsList=function(e){this.addToQueue((0,eI.Cl)((0,eI.Cl)({},e),{attempts:0,timeout:0}))},e.prototype.markCoalesceNextFlush=function(){this.coalesceNextFlush=!0,this.schedule(0)},e.prototype.sendBeacon=function(e){var t,r,n=this,i=e.events,o=e.sessionId,s=e.deviceId,a=e.apiKey,l=e.serverZone,u=function(e){return new Blob([e]).size},c=i,d=JSON.stringify({version:2,events:c});if(u(d)>65536){for(var f=0,h=c.length;f<h;){var p=Math.floor((f+h+1)/2);65536>=u(JSON.stringify({version:2,events:c.slice(0,p)}))?f=p:h=p-1}d=JSON.stringify({version:2,events:c=c.slice(0,f)}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(i.length," to ").concat(c.length," events"))}if(0!==c.length){if(this.handleSendEvents){var g=new URLSearchParams({device_id:s,session_id:String(o),type:"replay"}),v="".concat(sj(l,this.trackServerUrl),"?").concat(g.toString());this.loggerProvider.debug("Routing session replay exit batch (".concat(c.length," events) through custom transport for session id ").concat(o,"."));try{this.handleSendEvents({url:v,method:"POST",headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(a)},body:d,keepalive:!0}
1).catch(function(e){n.loggerProvider.warn("Custom transport failed to send session replay exit batch:",e)})}catch(e){this.loggerProvider.warn("Custom transport threw while sending session replay exit batch:",e)}return}var m=new URLSearchParams({device_id:s,session_id:String(o),type:"replay",api_key:a}),y="".concat(sj(l,this.trackServerUrl),"?").concat(m.toString()),b=(0,eO.m)();try{var w=new Blob([d],{type:"application/json"}),S=null==(r=null==(t=null==b?void 0:b.navigator)?void 0:t.sendBeacon)?void 0:r.call(t,y,w);!1===S&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(e){}}},e.prototype.addToQueue=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];t.filter(function(t){return e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:sJ}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:sz}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;if(!this.scheduled){var r=this.flushPauseUntilMs-Date.now(),n=r>e?r:e;r>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},n)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),this.mergeOnNextFlush?(this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,t=this.mergeQueueAfterThrottle(t)):this.coalesceNextFlush&&(this.coalesceNextFlush=!1,t=this.mergeDrainBacklog(t)),a.label=1;case 1:a.trys.push([1,6,7,8]),n=(r=(0,eI.Ju)(t)).next(),a.label=2;case 2:if(n.done)return[3,5];return i=n.value,[4,this.send(i,e)];case 3:a.sent(),a.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o={error:a.sent()},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.mergeQueueAfterThrottle=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(e.length," queued batches into ").concat(t.length," request(s)"))),t},e.prototype.mergeDrainBacklog=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&this.loggerProvider.log("Session replay coalesced ".concat(e.length," persisted page-load backlog batches into ").concat(t.length," request(s)")),t},e.prototype.coalesceByIdentity=function(e){var t,r,n,i,o,s,a,l,u,c,d,f=this;if(e.length<=1)return e;var h=new Map;try{for(var p=(0,eI.Ju)(e),g=p.next();!g.done;g=p.next()){var v=g.value,m=[v.sessionId,null!=(o=v.deviceId)?o:"",null!=(s=v.apiKey)?s:"",v.type,null!=(a=v.serverZone)?a:"",v.sampleRate,null!=(u=null==(l=v.version)?void 0:l.type)?u:"",null!=(d=null==(c=v.version)?void 0:c.version)?d:""].join("|"),y=h.get(m);y?y.push(v):h.set(m,[v])}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}var b=[];try{for(var w=(0,eI.Ju)(h.values()),S=w.next();!S.done;S=w.next()){var E=S.value;!function(e){if(1===e.length)return b.push(e[0]);var t,r,n=null,i=0,o=function(){n&&b.push(n),n=null,i=0};try{for(var s=(t=void 0,(0,eI.Ju)(e)),a=s.next();!a.done;a=s.next()){var l=a.value;!function(e){var t=e.events.reduce(function(e,t){return e+new Blob([t]).size},0);if(null===n)return n=(0,eI.Cl)((0,eI.Cl)({},e),{events:(0,eI.fX)([],(0,eI.zs)(e.events),!1),attempts:0}),i=t;if(i+t>4e6)return o(),n=(0,eI.Cl)((0,eI.Cl)({},e),{events:(0,eI.fX)([],(0,eI.zs)(e.events),!1),attempts:0}),i=t;var r=n.onComplete,s=e.onComplete;n.events=n.events.concat(e.events),i+=t,n.onComplete=function(){return(0,eI.sH)(f,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([r(),s()])];case 1:return e.sent(),[2]}})})}}(l)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}o()}(E)}}catch(e){n={error:e}}finally{try{S&&!S.done&&(i=w.return)&&i.call(w)}finally{if(n)throw n.error}}return b},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,eI.sH)(this,void 0,void 0,function(){var r,n,i,o;return(0,eI.YH)(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:sJ})]:(r=e.apiKey)?(n=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(o=this.worker)?[2,this.sendViaWorker(o,e,i,t)]:[2,this.sendOnMainThread(r,n,e,i,t)]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})]})})},e.prototype.sendViaWorker=function(e,t,r,n){return(0,eI.sH)(this,void 0,void 0,function(){var i,o=this;return(0,eI.YH)(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a,l=o.sendTimeoutMs>0?setTimeout(function(){var e=o.pendingWorkerRequests.get(i);
1e&&(o.pendingWorkerRequests.delete(i),o.rememberTimedOutRequest(i,e.context),o.loggerProvider.warn("Session replay worker send timed out after ".concat(o.sendTimeoutMs,"ms; leaving events for retry")),e.resolve())},o.sendTimeoutMs):void 0;o.pendingWorkerRequests.set(i,{context:t,resolve:s,timeout:l}),e.postMessage({type:"send",id:i,payload:r,useRetry:n,useCustomTransport:!!o.handleSendEvents,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!=(a=t.flushMaxRetries)?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:sv(),sdkVersion:sW,enableTransportCompression:o.enableTransportCompression,sendTimeoutMs:o.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(e,t){var r,n;if(this.timedOutWorkerRequests.set(e,t),this.timedOutWorkerRequests.size>256)try{for(var i=(0,eI.Ju)(this.timedOutWorkerRequests.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;this.timedOutWorkerRequests.delete(s);break}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.handleDelegatedFetch=function(e,t){var r,n,i;return(0,eI.sH)(this,void 0,void 0,function(){var o,s,a,l,u,c,d,f,h,p,g;return(0,eI.YH)(this,function(v){switch(v.label){case 0:o=t.requestId,s=t.url,a=t.method,l=t.headers,u=t.body,c=t.keepalive,v.label=1;case 1:if(v.trys.push([1,10,,11]),d=void 0,!this.handleSendEvents)return[3,3];return[4,this.handleSendEvents({url:s,method:a,headers:l,body:u,keepalive:c})];case 2:return d=v.sent(),[3,5];case 3:return this.loggerProvider.warn("Delegated session replay fetch received without a custom transport configured; falling back to built-in fetch."),[4,fetch(s,{method:a,headers:l,body:u,keepalive:c})];case 4:d=v.sent(),v.label=5;case 5:if(f=d.status,h=null,p="",f>=200&&f<300&&(h=null!=(i=null==(n=null==(r=d.headers)?void 0:r.get)?void 0:n.call(r,sl))?i:null),413!==f)return[3,9];v.label=6;case 6:return v.trys.push([6,8,,9]),[4,d.text()];case 7:return p=v.sent(),[3,9];case 8:return v.sent(),[3,9];case 9:return this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") returned status ").concat(f,".")),e.postMessage({type:"fetch-response",requestId:o,status:f,skipHeader:h,body:p}),[3,11];case 10:return g=v.sent(),this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") failed:"),g),e.postMessage({type:"fetch-response",requestId:o,status:0,skipHeader:null,body:String(g),error:!0}),[3,11];case 11:return[2]}})})},e.prototype.sendOnMainThread=function(e,t,r,n,i){var o,s,a,l,u,c,d;return(0,eI.sH)(this,void 0,void 0,function(){var f,h,p,g,v,m,y,b,w,S,E,k,C,I,x,T,P,_,O,A,R,M;return(0,eI.YH)(this,function(D){switch(D.label){case 0:f=sv(),h=sW,p=r.sampleRate,g=new URLSearchParams({device_id:t,session_id:"".concat(r.sessionId),type:"".concat(r.type)}),v="".concat(null!=(s=null==(o=r.version)?void 0:o.type)?s:"standalone","/").concat(null!=(l=null==(a=r.version)?void 0:a.version)?l:h),D.label=1;case 1:if(D.trys.push([1,19,,23]),m=JSON.stringify(n),y=(0,eO.m)(),!(this.enableTransportCompression&&y&&"CompressionStream"in y))return[3,3];return[4,function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r,n,i,o,s,a,l,u,c,d,f,h,p=this;return(0,eI.YH)(this,function(g){switch(g.label){case 0:return g.trys.push([0,4,,5]),n=(r=new t.CompressionStream("gzip")).writable.getWriter(),i=r.readable.getReader(),o=[],s=(0,eI.sH)(p,void 0,void 0,function(){var e,t,r;return(0,eI.YH)(this,function(n){switch(n.label){case 0:return[4,i.read()];case 1:if(t=(e=n.sent()).done,r=e.value,t)return[3,3];o.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,n.write(new TextEncoder().encode(e))];case 1:return g.sent(),[4,n.close()];case 2:return g.sent(),[4,s];case 3:g.sent(),a=new Uint8Array(o.reduce(function(e,t){return e+t.length},0)),l=0;try{for(c=(u=(0,eI.Ju)(o)).next();!c.done;c=u.next())d=c.value,a.set(d,l),l+=d.length}catch(e){f={error:e}}finally{try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(f)throw f.error}}return[2,a];case 4:return g.sent(),[2,null];case 5:return[2]}})})}(m,y)];case 2:return w=D.sent(),[3,4];case 3:w=null,D.label=4;case 4:if(S=(b=w)?b.byteLength:new Blob([m]).size,E=new AbortController,x={headers:k=(0,eI.Cl)({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":h,"X-Client-Library":v,"X-Client-Url":f.substring(0,1e3),"X-Client-Sample-Rate":"".concat(p),"X-Sampling-Hash-Alg":"xxhash32"},b?{"Content-Encoding":"gzip"}:{}),body:C=null!=b?b:m,method:"POST",keepalive:I=S<=65536,signal:E.signal},T="".concat(sj(r.serverZone,this.trackServerUrl),"?").concat(g.toString()),0===n.events.length)return this.completeRequest({context:r}),[2];P=this.sendTimeoutMs>0?setTimeout(function(){E.abort()},this.sendTimeoutMs):void 0,_=void 0,D.label=5;case 5:var L,N;if(D.trys.push([5,,10,11]),!this.handleSendEvents)return[3,7];return[4,(L=this.handleSendEvents({url:T,method:"POST",headers:k,body:C,keepalive:I}),N=E.signal,new Promise(function(e,t){var r=function(){var e=Error("Custom session replay transport aborted by send timeout");e.name="AbortError",t(e)};N.addEventListener("abort",r,{once:!0}),L.then(function(t){N.removeEventListener("abort",r),e(t)},function(e){N.removeEventListener("abort",r),t(e)})}))];case 6:return O=D.sent(),[3,9];case 7:return[4,fetch(T,x)];case 8:O=D.sent(),D.label=9;case 9:return _=O,[3,11];case 10:return P&&clearTimeout(P),[7];case 11:if(null===_)return this.completeRequest({context:r,err:"Unexpected error occurred"}),[2];if(_.status>=200&&_.status<300&&(A=null!=(d=null==(c=null==(u=_.headers)?void 0:u.get)?void 0:c.call(u,sl))?d:null,this.applyServerDirective(r.sessionId,A)),i)return[3,12];R="";try{R=JSON.stringify(_.body,null,2)}catch(e){}return this.completeRequest({context:r,success:"".concat(_.status,": ").concat(R)}),[3,18];
1case 12:if(R="",413!==_.status)return[3,16];D.label=13;case 13:return D.trys.push([13,15,,16]),[4,_.text()];case 14:return R=D.sent(),[3,16];case 15:return D.sent(),[3,16];case 16:return[4,this.handleReponse(_.status,r,R)];case 17:D.sent(),D.label=18;case 18:return[3,23];case 19:if(!((M=D.sent())&&"object"==typeof M&&"AbortError"===M.name&&i))return[3,21];return[4,this.handleOtherResponse(r)];case 20:return D.sent(),[3,22];case 21:this.completeRequest({context:r,err:M}),D.label=22;case 22:return[3,23];case 23:return[2]}})})},e.prototype.handleReponse=function(e,t,r){return void 0===r&&(r=""),(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(n){switch(n.label){case 0:switch(new t9().buildStatus(e)){case Q.Success:return[3,1];case Q.Failed:case Q.Timeout:case Q.RateLimit:return[3,2];case Q.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(t),[3,8];case 2:return[4,this.handleOtherResponse(t)];case 3:case 6:return n.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(t,sa.test(r)),[3,8];case 5:if(499!==e)return[3,7];return[4,this.handleOtherResponse(t)];case 7:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),n.label=8;case 8:return[2]}})})},e.prototype.handlePayloadTooLargeResponse=function(e,t){var r=t?"WAF (compressed payload too large)":"server (event too large)",n=Math.round(e.events.reduce(function(e,t){return e+t.length},0)/1024);if(!t)return void this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(r," rejected payload (").concat(e.events.length," events, ").concat(n," KB) — not retrying non-WAF 413")});if(1===e.events.length)return void this.completeRequest({context:e,err:"Session replay event dropped: single event (".concat(n," KB, 1 event) rejected by ").concat(r," — cannot split further")});this.loggerProvider.warn("Session replay event batch rejected by ".concat(r," (").concat(e.events.length," events, ").concat(n," KB total) — splitting and retrying")),e.onComplete();var i=function(){return Promise.resolve()},o=Math.floor(e.events.length/2);this.sendEventsList((0,eI.Cl)((0,eI.Cl)({},e),{events:e.events.slice(0,o),onComplete:i})),this.sendEventsList((0,eI.Cl)((0,eI.Cl)({},e),{events:e.events.slice(o),onComplete:i}))},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0))return this.completeRequest({context:e,err:sz}),[2];return[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return r.sent(),[4,this.send(e,!0)];case 2:return r.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,r=e.err,n=e.success;t.onComplete(),r?this.loggerProvider.warn(r):n&&this.loggerProvider.log(n)},e.prototype.applyServerDirective=function(e,t){if(null===t){this.flushPauseUntilMs=0,this.mergeLogFiredThisPause=!1;return}if("429"===t){var r=this.flushPauseUntilMs>Date.now();this.flushPauseUntilMs=Date.now()+6e4,r||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(60,"s"));return}("4005"===t||"4004"===t)&&this.killSession(e,t)},e.prototype.killSession=function(e,t){if(!this.killedSessions.has(e)){if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var r,n,i,o,s=(0,eI.Ju)(this.killedSessions),a=s.next();!a.done;a=s.next()){var l=a.value;this.killedSessions.delete(l);break}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.loggerProvider.log("Session replay capture stopped for session ".concat(e," by server directive ").concat(t,"; remaining events will be dropped"));var u=[];try{for(var c=(0,eI.Ju)(this.queue),d=c.next();!d.done;d=c.next()){var f=d.value;f.sessionId===e?this.completeRequest({context:f,err:sJ}):u.push(f)}}catch(e){i={error:e}}
1finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}this.queue=u}},e}(),sK=r(60979),s$=function(){function e(e){var t,r,n,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=6e6,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var r=i.getStringSize(t);return i.getEventsArraySize(e)+r>=i.maxPersistedEventsSize||Date.now()-i.timeAtLastSplit>i.interval&&!!e.length&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!=(t=e.minInterval)?t:this.minInterval,this.maxInterval=null!=(r=e.maxInterval)?r:this.maxInterval,this.maxPersistedEventsSize=null!=(n=e.maxPersistedEventsSize)?n:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){for(var t=0,r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n>=55296&&n<=56319){var i=r+1<e.length?e.charCodeAt(r+1):NaN;i>=56320&&i<=57343?(t+=4,r++):t+=3}else t+=3}return t},e.prototype.getEventsArraySize=function(e){var t,r,n=0;try{for(var i=(0,eI.Ju)(e),o=i.next();!o.done;o=i.next()){var s=o.value;n+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n+(2+Math.max(0,e.length-1)+2*e.length)},e}(),sX=function(e,t,r){"object"==typeof r&&null!==r&&"AbortError"===r.name?e.debug(t):e.warn(t)},sG="sessionCurrentSequence",sQ="sequencesToSend";function sZ(e,t,r){var n=setTimeout(r,t);return e.then(function(){return clearTimeout(n)},function(){return clearTimeout(n)}),function(){return clearTimeout(n)}}var s0=function(e){var t,r;return e.objectStoreNames.contains(sG)||(r=e.createObjectStore(sG,{keyPath:"sessionId"})),e.objectStoreNames.contains(sQ)||(t=e.createObjectStore(sQ,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},s1=function(e){function t(t){var r,n=this;return(n=e.call(this,t)||this).consecutiveFailures=0,n.hasTriggeredFallback=!1,n.emptyFilteredCount=0,n.getSequencesToSend=function(){return(0,eI.sH)(n,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,u,c=this;return(0,eI.YH)(this,function(d){switch(d.label){case 0:e=!1,t=!1,d.label=1;case 1:return d.trys.push([1,9,,10]),r=[],(n=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(r){e||t||(sX(c.loggerProvider,"".concat(sY,": ").concat(r),r),c.recordFailure())}),i=sZ(n.done,5e3,function(){e||t||(t=!0,sX(c.loggerProvider,"".concat(sY,": transaction timed out")),c.recordFailure())}),[4,n.store.openCursor()];case 2:o=d.sent(),d.label=3;case 3:if(!o)return[3,8];if(a=(s=o.value).sessionId,0!==(l=s.events).length)return[3,5];return this.maybeLogEmptyFiltered("getSequencesToSend"),[4,o.delete()];case 4:return d.sent(),[3,6];case 5:r.push({events:l,sequenceId:o.key,sessionId:a}),d.label=6;case 6:return[4,o.continue()];case 7:return o=d.sent(),[3,3];case 8:return this.recordSuccess(),i(),[2,r];case 9:return u=d.sent(),t||(e=!0,sX(this.loggerProvider,"".concat(sY,": ").concat(u),u),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return(0,eI.sH)(n,void 0,void 0,function(){var t,r,n,i,o,s,a,l,u=this;return(0,eI.YH)(this,function(c){switch(c.label){case 0:t=!1,r=!1,c.label=1;case 1:return c.trys.push([1,5,,6]),(n=this.db.transaction([sG,sQ],"readwrite")).done.catch(function(e){t||r||(sX(u.loggerProvider,"".concat(sY,": ").concat(e),e),u.recordFailure())}),i=sZ(n.done,5e3,function(){t||r||(r=!0,sX(u.loggerProvider,"".concat(sY,": transaction timed out")),u.recordFailure())}),[4,n.objectStore(sG).get(e)];case 2:if(!(o=c.sent())||o.tabId&&o.tabId!==this.tabId)return i(),[2,void 0];if(0===o.events.length)return this.maybeLogEmptyFiltered("storeCurrentSequence"),i(),[2,void 0];return[4,n.objectStore(sQ).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return s=c.sent(),[4,n.objectStore(sG).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return c.sent(),this.recordSuccess(),i(),o.tabId,a=(0,eI.Tt)(o,["tabId"]),[2,(0,eI.Cl)((0,eI.Cl)({},a),{sessionId:e,sequenceId:s})];case 5:return l=c.sent(),r||(t=!0,sX(this.loggerProvider,"".concat(sY,": ").concat(l),l),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return(0,eI.sH)(n,void 0,void 0,function(){var r,n,i,o,s,a,l,u,c,d=this;return(0,eI.YH)(this,function(f){switch(f.label){case 0:r=!1,n=!1,f.label=1;case 1:return f.trys.push([1,15,,16]),(i=this.db.transaction([sG,sQ],"readwrite")).done.catch(function(e){r||n||(sX(d.loggerProvider,"".concat(sY,": ").concat(e),e),d.recordFailure())}),o=sZ(i.done,5e3,function(){r||n||(n=!0,sX(d.loggerProvider,"".concat(sY,": transaction timed out")),d.recordFailure())}),[4,i.objectStore(sG).get(e)];case 2:if(!((null==(s=f.sent())?void 0:s.tabId)&&s.tabId!==this.tabId))return[3,6];if(!(s.events.length>0))return[3,4];return[4,i.objectStore(sQ).put({sessionId:e,events:s.events,tabId:s.tabId})];case 3:f.sent(),f.label=4;case 4:case 12:return[4,i.objectStore(sG).put({sessionId:e,events:[t],tabId:this.tabId})];case 5:case 7:case 9:case 11:return f.sent(),this.recordSuccess(),o(),[2,void 0];case 6:if(a=s)return[3,8];return[4,i.objectStore(sG).put({sessionId:e,events:[t],tabId:this.tabId})];case 8:if(this.shouldSplitEventsList(a.events,t))return[3,10];return[4,i.objectStore(sG).put({sessionId:e,events:a.events.concat(t),tabId:this.tabId})];case 10:if(0!==(l=a.events).length)return[3,12];return this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore(sG).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return f.sent(),[4,i.objectStore(sQ).put({sessionId:e,events:l,tabId:this.tabId})];case 14:return u=f.sent(),this.recordSuccess(),o(),[2,{events:l,sessionId:e,sequenceId:u}];case 15:return c=f.sent(),n||(r=!0,sX(this.loggerProvider,"".concat(sY,": ").concat(c),c),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return(0,eI.sH)(n,void 0,void 0,function(){var r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(sQ,{sessionId:e,events:t,tabId:this.tabId})];case 1:return r=i.sent(),this.recordSuccess(),[2,r];case 2:return n=i.sent(),sX(this.loggerProvider,"".concat(sY,": ").concat(n),n),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return(0,eI.sH)(n,void 0,void 0,function(){var e;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(!t)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.db.delete(sQ,t)];case 2:return r.sent(),this.recordSuccess(),[3,4];case 3:return e=r.sent(),sX(this.loggerProvider,"".concat(sY,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},n.db=t.db,n.tabId=t.tabId,n.onPersistentFailure=t.onPersistentFailure,n.consecutiveFailureThreshold=null!=(r=t.consecutiveFailureThreshold)?r:1,n}return(0,eI.C6)(t,e),t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (idb store)"))},t.prototype.recordFailure=function(){var e;this.consecutiveFailures++,!this.hasTriggeredFallback&&this.consecutiveFailures>=this.consecutiveFailureThreshold&&(this.hasTriggeredFallback=!0,null==(e=this.onPersistentFailure)||e.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(e,r){var n;return(0,eI.sH)(this,void 0,void 0,function(){var i,o,s,a;return(0,eI.YH)(this,function(l){switch(l.label){case 0:var u;return l.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),[4,(u="".concat(r.a
1piKey.substring(0,10),"_amp_session_replay_events").concat(i),(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:var t;return[4,(t=(0,sK.P2)(u,1,{upgrade:s0}),new Promise(function(e,r){var n=setTimeout(function(){return r(Error("".concat("IDB openDB timed out"," after ").concat(2e3,"ms")))},2e3);t.then(function(t){clearTimeout(n),e(t)},function(e){clearTimeout(n),r(e)})}))];case 1:return[2,e.sent()]}})}))];case 1:return o=l.sent(),s=null!=(n=r.tabId)?n:function(){try{return crypto.randomUUID()}catch(e){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}(),[2,new t((0,eI.Cl)((0,eI.Cl)({},r),{db:o,tabId:s}))];case 2:return a=l.sent(),sX(r.loggerProvider,"".concat(sY,": ").concat(a),a),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s,a;return(0,eI.YH)(this,function(l){switch(l.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=l.sent())||t.tabId&&t.tabId!==this.tabId)return[2,void 0];return t.tabId,[2,[r=(0,eI.Tt)(t,["tabId"])]];case 2:n=[],l.label=3;case 3:return l.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:o=(i=eI.Ju.apply(void 0,[l.sent()])).next(),l.label=5;case 5:if(o.done)return[3,7];if((t=o.value).tabId&&t.tabId!==this.tabId)return[3,6];t.tabId,r=(0,eI.Tt)(t,["tabId"]),n.push(r),l.label=6;case 6:return o=i.next(),[3,5];case 7:return[3,10];case 8:return s={error:l.sent()},[3,10];case 9:try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}return[7];case 10:return[2,n]}})})},t}(s$),s2=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t.emptyFilteredCount=0,t}return(0,eI.C6)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=(0,eI.fX)([],(0,eI.zs)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:r},this.resetCurrentSequence(e),{sequenceId:t,events:r,sessionId:e}},t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (in-memory store)"))},t.prototype.getSequencesToSend=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,l,u;return(0,eI.YH)(this,function(c){e=[];try{for(r=(t=(0,eI.Ju)(Object.entries(this.finalizedSequences))).next();!r.done;r=t.next()){if(i=(n=(0,eI.zs)(r.value,2))[0],s=(o=n[1]).sessionId,a=o.events,0===a.length){this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(i)];continue}e.push({sequenceId:Number(i),sessionId:s,events:a})}}catch(e){l={error:e}}finally{try{r&&!r.done&&(u=t.return)&&u.call(t)}finally{if(l)throw l.error}}return[2,e]})})},t.prototype.storeCurrentSequence=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){return(t=this.sequences[e])?0===t.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),[2,void 0]):[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){var r;return(0,eI.YH)(this,function(n){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):r=this.addSequence(e)),this.sequences[e].push(t),[2,r]})})},t.prototype.storeSendingEvents=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(s$),s3=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.maxPersistedEventsSize,o=e.type,s=e.payloadBatcher,a=e.storeType,l=e.trackDestinationWorkerScript,u=e.shouldSe
1nd;return(0,eI.sH)(void 0,void 0,void 0,function(){var e,c,d,f,h,p,g,v,m,y,b,w;function S(e){return void 0===e&&(e=!1),(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){return[2,c.flush(e)]})})}return(0,eI.YH)(this,function(E){switch(E.label){case 0:if(e=null!=(w=t.maxSingleEventSizeBytes)?w:9e6,c=new sV((0,eI.Cl)((0,eI.Cl)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:s,workerScript:l})),d=function(){return new s2({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r,maxPersistedEventsSize:i})},h=!1,"idb"!==a)return[3,2];return[4,(0,eI.sH)(void 0,void 0,void 0,function(){var e;return(0,eI.YH)(this,function(s){switch(s.label){case 0:return[4,s1.new(o,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,maxPersistedEventsSize:i,apiKey:t.apiKey,onPersistentFailure:function(){(0,eI.sH)(void 0,void 0,void 0,function(){var e,r,n;return(0,eI.YH)(this,function(i){switch(i.label){case 0:if(!h)return[2];if(h=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),!f)return[3,2];return[4,p.getSequencesToSend()];case 1:return r=i.sent(),[3,3];case 2:r=void 0,i.label=3;case 3:return e=r,p=d(),e&&f&&(n=f,e.forEach(function(e){b({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})})),[2]}})})}})];case 1:if(!(e=s.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,d()];return h=!0,[2,e]}})})];case 1:return g=E.sent(),[3,3];case 2:g=d(),E.label=3;case 3:return p=g,v=[],m=0,y=function(e){if(!(e<=m)){var t=Math.min(e-m,v.length);t>0&&(v.splice(0,t),m=e)}},b=function(r){var n=r.events,i=r.sessionId,s=r.deviceId,a=r.sequenceId,l=n.map(function(e){return{event:e,bytes:new Blob([e]).size}}),u=l.filter(function(t){return t.bytes>e});u.length>0&&t.loggerProvider.warn("Dropping ".concat(u.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(u.map(function(e){return"".concat(Math.round(e.bytes/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var d=u.length>0?l.filter(function(t){return t.bytes<=e}).map(function(e){return e.event}):n;0===d.length?p.cleanUpSessionEventsStore(i,a).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)}):(t.debugMode&&sS().then(function(e){var r=e.totalStorageSize,n=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(r," KB, percentage of quota: ").concat(n,"%, usage details: ").concat(i))}).catch(function(){}),c.sendEventsList({events:d,sessionId:i,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:o,onComplete:function(){return(0,eI.sH)(void 0,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:return[4,p.cleanUpSessionEventsStore(i,a)];case 1:return e.sent(),[2]}})})}}))},[2,{sendCurrentSequenceEvents:function(e){var r=e.sessionId,n=e.deviceId;if(f=n,!u||u()){var i=m+v.length;p.storeCurrentSequence(r).then(function(e){e&&(y(i),b({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})}},addEvent:function(e){var r=e.event,n=e.sessionId,i=e.deviceId;f=i;var o=!u||u(),s=m+v.length;v.push(r.data),p.addEventToCurrentSequence(n,r.data).then(function(e){if(e){if(!o){p.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch(function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)}),y(s);return}y(s),b({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i})}}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var r=e.deviceId;return(0,eI.sH)(void 0,void 0,void 0,function(){var e;return(0,eI.YH)(this,function(n){switch(n.label){case 0:return f=r,[4,p.getSequencesToSend()];case 1:if(!(null==(e=n.sent())?void 0:e.length))return[2];return t.loggerProvider.log("Draining ".concat(e.length," stored sequence(s) from previous session.")),e.length>1&&c.markCoalesceNextFlush(),e.forEach(function(e){b({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}),[2]}})})},flush:S,getBeaconEvents:function(){return(0,eI.fX)([],(0,eI.zs)(v),
1!1)},dropPendingBeaconEvents:function(){y(m+v.length)},trackDestination:c}]}})})},s4=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=new Map;e.forEach(function(e){r.set(e.name,e.manager)}),this.managers=r}return e.prototype.sendStoredEvents=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,r=e.sessionId,n=e.event,i=e.deviceId;null==(t=this.managers.get(n.type))||t.addEvent({sessionId:r,event:n,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,r=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:r})})},e.prototype.flush=function(e){return(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.flush(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e}();function s5(e,t,r){for(var n=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,l,u,c=new Date().getTime()-em.getTime();if(void 0!==eg.timeoutMs&&c>eg.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=an((e=o.getAttribute("id"))&&eg.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||an.apply(void 0,(0,eI.fX)([],(0,eI.zs)(Array.from(o.attributes).filter(function(e){return eg.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||an.apply(void 0,(0,eI.fX)([],(0,eI.zs)(Array.from(o.classList).filter(eg.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||an((a=o.tagName.toLowerCase(),eg.tagName(a)?{name:a,penalty:2}:null))||[ae()],f=function(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;for(var n=0;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}(o);if("all"==t)f&&(d=d.concat(d.filter(ar).map(function(e){return at(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(ar).map(function(e){return at(e,f)})));else if("one"==t){var h=(0,eI.zs)(d=d.slice(0,1),1)[0];f&&ar(h)&&(d=[at(h,f)])}else"none"==t&&(d=[ae()],f&&(d=[at(d[0],f)]));try{for(var p=(l=void 0,(0,eI.Ju)(d)),g=p.next();!g.done;g=p.next()){var h=g.value;h.level=s}}catch(e){l={error:e}}finally{try{g&&!g.done&&(u=p.return)&&u.call(p)}finally{if(l)throw l.error}}if(i.push(d),i.length>=eg.seedMinLength&&(n=s6(i,r)))return"break";o=o.parentElement,s++}(););return(n||(n=s6(i,r)),!n&&r)?r():n}function s6(e,t){var r,n,i=ao(function e(t,r){var n,i,o,s,a;return void 0===r&&(r=[]),(0,eI.YH)(this,function(l){switch(l.label){case 0:if(!(t.length>0))return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),i=(n=(0,eI.Ju)(t[0])).next(),l.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,eI.Ju)(e(t.slice(1,t.length),r.concat(o)))];case 3:l.sent(),l.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return s={error:l.sent()},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,r];case 10:l.sent(),l.label=11;case 11:return[2]}})}(e));if(i.length>eg.threshold)return t?t():null;try{for(var o=(0,eI.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(s9(a))return a}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null}function s8(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var i=e[n].level||0;r=t.level===i-1?"".concat(e[n].name," > ").concat(r):"".concat(e[n].name," ").concat(r),t=e[n]}return r}function s7(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function s9(e){var t=s8(e);switch(ev.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function ae(){return{name:"*",penalty:3}}function at(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function ar(e){return"html"!==e.name&&!e.name.startsWith("#")}function an(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(ai);return r.length>0?r:null}function ai(e){return null!=e}function ao(e){return(0,eI.fX)([],(0,eI.zs)(e),!1).sort(function(e,t){return s7(e)-s7(t)})}var as=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&n.push(t)}),{version:t,events:n}},aa=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&n.push(t)}),{version:t,events:Object.values(n.reduce(function(e,t){var r=t.x,n=t.y,i=t.selector,o=t.timestamp,s=o-o%36e5,a="".concat(r,":").concat(n,":").concat(null!=i?i:"",":").concat(s);return e[a]?e[a].count+=1:e[a]=(0,eI.Cl)((0,eI.Cl)({},t),{timestamp:s,count:1}),e},{}))}},al=function(e,t){var r=this;this.createHook=function(e){var t=e.eventsManager,n=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type!==sA.Click)return;var l,u=(0,eO.m)();
1if(u){var c=u.location,d=u.innerHeight,f=u.innerWidth;if(c){var h=e.x,p=e.y;if(void 0!==h&&void 0!==p){var g=o.getNode(e.id);if(g)try{l=function(e,t){if(em=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r,n,i={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,timeoutMs:void 0};r=(eg=(0,eI.Cl)((0,eI.Cl)({},i),t)).root,n=i,ev=r.nodeType===Node.DOCUMENT_NODE?r:r===n.root?r.ownerDocument:r;var o=s5(e,"all",function(){return s5(e,"two",function(){return s5(e,"one",function(){return s5(e,"none")})})});if(o){var s=ao(function e(t,r,n){var i,o,s;return void 0===n&&(n={counter:0,visited:new Map}),(0,eI.YH)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>eg.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var l,u;if(!(i<t.length-1))return[3,5];if(n.counter>eg.maxNumberOfTries||(n.counter+=1,(o=(0,eI.fX)([],(0,eI.zs)(t),!1)).splice(i,1),s=s8(o),n.visited.has(s)))return[2];if(!(s9(o)&&(l=o,u=r,ev.querySelector(s8(l))===u)))return[3,4];return[4,o];case 2:return a.sent(),n.visited.set(s,!0),[5,(0,eI.Ju)(e(o,r,n))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(o,e));return s.length>0&&(o=s[0]),s8(o)}throw Error("Selector was not found.")}(g,a)}catch(e){r.logger.debug("error resolving selector from finder")}var v=sw(c.href,s),m={x:h+r.scrollWatcher.currentScrollX,y:p+r.scrollWatcher.currentScrollY,selector:l,viewportHeight:d,viewportWidth:f,pageUrl:v,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}},this.logger=e,this.scrollWatcher=t};function au(){var e=(0,eO.m)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function ac(){var e=(0,eO.m)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var ad=function(){function e(e,t){var r=(0,eO.m)();r&&r.navigator&&"function"==typeof r.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(r.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var r=new XMLHttpRequest;return r.open("POST",e,!0),r.setRequestHeader("Accept","*/*"),r.send(JSON.stringify(t)),!0},this.basePageUrl=sj(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e,this.handleSendEvents=t.handleSendEvents,this.loggerProvider=t.loggerProvider}return e.prototype.send=function(e,t){var r,n=this,i=this.context,o=i.sessionId,s=i.type;if(this.handleSendEvents){var a=new URLSearchParams({device_id:e,session_id:String(o),type:String(s)}),l="".concat(this.basePageUrl,"?").concat(a.toString()),u={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(this.apiKey)};try{this.handleSendEvents({url:l,method:"POST",headers:u,body:JSON.stringify(t),keepalive:!0}).catch(function(e){var t;null==(t=n.loggerProvider)||t.warn("Custom transport failed to send session replay interaction beacon:",e)})}catch(e){null==(r=this.loggerProvider)||r.warn("Custom transport threw while sending session replay interaction beacon:",e)}return}var c=new URLSearchParams({device_id:e,session_id:String(o),type:String(s),api_key:this.apiKey}),d="".concat(this.basePageUrl,"?").concat(c.toString());this.sendBeacon(d,t)||this.sendXhr(d,t)},e}(),af=function(){function e(e,t){var r=this;this.timestamp=Date.now(),this.hook=function(e){r.update(e)},this.send=function(e){return function(t){var n,i,o,s,a=e(),l=(0,eO.m)();if(l&&a){var u=null!=(n=l.scrollX)?n:0,c=null!=(i=l.scrollY)?i:0;(u>0||c>0)&&r.update({id:1,x:u,y:c}),r.transport.send(a,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHeight:au(),viewportWidth:ac(),pageUrl:sw(l.location.href,null!=(s=null==(o=r.config.interactionConfig)?void 0:o.ugcFilterRules)?s:[]),timestamp:r.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=ac(),this._maxScrollHeight=au(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new ad(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var r=ac();this._maxScrollX=e.x;var n=e.x+r;n>this._maxScrollWidth&&(this._maxScrollWidth=n),this.timestamp=t}if(e.y>this._maxScrollY){var i=au();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),ah=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId="".concat(r,"/").concat(t))},ap=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},ag=function(e,t){return"".concat(ap(e)).concat(t)},av=function(){try{var e=(0,eO.m)();return null==e?void 0:e.localStorage}catch(e){return}},am=function(e,t,r,n){var i=av();if(i){var o=ag(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=r&&r-a<864e5)return a}return i.setItem(o,String(r)),r}catch(e){null==n||n.debug("Failed to read/write replay start time from storage: ".concat(String(e)));return}}},ay=function(e,t,r,n){var i=av();if(i)try{i.setItem(ag(e,t),String(r))}catch(e){null==n||n.debug("Failed to write replay start time to storage: ".concat(String(e)))}},ab=function(e,t,r){var n=av();if(n)try{n.removeItem(ag(e,t))}catch(e){null==r||r.debug("Failed to remove replay start time from storage: ".concat(String(e)))}},aw=function(e,t,r){var n,i,o=av();if(o){var s=ap(e);try{for(var a=[],l=0;l<o.length;l++){var u=o.key(l);if(u&&u.startsWith(s)){var c=o.getItem(u);if(null!==c){var d=Number(c);(!Number.isFinite(d)||d<=0||t-d>=864e5)&&a.push(u)}}}try{for(var f=(0,eI.Ju)(a),h=f.next();!h.done;h=f.next()){var u=h.value;o.removeItem(u)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}catch(e){null==r||r.debug("Failed to prune stale replay start times: ".concat(String(e)))}}},aS=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,eI.sH)(e,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:return[4,(0,sK.P2)(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return(0,eI.sH)(e,void 0,void 0,function(){var e,r;return(0,eI.YH)(this,function(n){switch(n.label){case 0:if(this.dbs&&this.dbs[t])return[2,this.dbs[t]];return e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)];case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.getTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId;return(0,eI.sH)(e,void 0,void 0,function(){var e,t,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),sX(r,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId,o=t.targetingMatch;return(0,eI.sH)(e,void 0,void 0,function(){var e,t,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),sX(r,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.currentSessionId;return(0,eI.sH)(e,void 0,void 0,function(){var e,t,o,s,a,l,u,c;return(0,eI.YH)(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.openOrCreateDB(n)];case 1:return e=d.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=d.sent(),a=0,d.label=3;case 3:if(!(a<s.length))return[3,6];if(l=s[a],u=Date.now()-l.lastUpdated,!(l.sessionId!==t&&u>1728e5))return[3,5];return[4,o.store.delete(l.sessionId)];case 4:d.sent(),d.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),sX(r,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},aE=function(e){var t=e.sessionId,n=e.targetingConfig,i=e.loggerProvider,o=e.apiKey,s=e.targetingParams,a=e.urlChange,l=void 0!==a&&a;return(0,eI.sH)(void 0,void 0,void 0,function(){var e,a,u;return(0,eI.YH)(this,function(c){switch(c.label){case 0:return[4,aS.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:t})];case 1:return c.sent(),[4,aS.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t})];case 2:if(!0===c.sent()&&!l)return[2,!0];e=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,r.e(21575).then(r.bind(r,21575))];case 4:return[4,(0,c.sent().evaluateTargeting)((0,eI.Cl)((0,eI.Cl)({},s),{flag:n,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:o,loggerProvider:i}))];case 5:return(a=c.sent())&&a.sr_targeting_config&&(e="on"===a.sr_targeting_config.key),aS.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t,targetingMatch:e}),[3,7];case 6:return u=c.sent(),i.warn(u.message),[3,7];case 7:return[2,e]}})})};function ak(e,t){return(e<<t|e>>>32-t)>>>0}
1function aC(e,t){return Math.imul(e=ak(e=e+Math.imul(t,0x85ebca77)>>>0,13),0x9e3779b1)>>>0}function aI(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var ax="__amplitude_url_tracking_patched__",aT=new WeakMap;function aP(e,t,r){if(void 0===r&&(r={}),!(null==e?void 0:e.location))return function(){};var n=r.enablePolling,i=r.pollingInterval;if(void 0!==n&&n){var o=function(){var t;return null!=(t=e.location.href)?t:""},s=o(),a=e.setInterval(function(){var e=o();e!==s&&(s=e,t(e))},void 0===i?1e3:i);return function(){null!=a&&e.clearInterval(a)}}var l=aT.get(e);if(!l){var u=void 0,c=new Set,d=function(){var t;return null!=(t=e.location.href)?t:""},f=function(){var e=d();(void 0===u||e!==u)&&(u=e,c.forEach(function(t){return t(e)}))},h=function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=e.apply(this,t);return f(),n};return t[ax]=!0,t},p=e.history;if(null==p?void 0:p.pushState){var g=Reflect.get(p,"pushState");g[ax]||(p.pushState=h(g))}if(null==p?void 0:p.replaceState){var v=Reflect.get(p,"replaceState");v[ax]||(p.replaceState=h(v))}l={callbacks:c,notify:f,onPopStateOrHashChange:function(){return f()},listenersAttached:!1},aT.set(e,l)}var m=l;return m.listenersAttached||(e.addEventListener("popstate",m.onPopStateOrHashChange),e.addEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!0),m.callbacks.add(t),function(){m.callbacks.delete(t),0===m.callbacks.size&&m.listenersAttached&&(e.removeEventListener("popstate",m.onPopStateOrHashChange),e.removeEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!1)}}function a_(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,s,a=(0,eI.Cl)((0,eI.Cl)({},e),n),l=a.ugcFilterRules||[],u=null!=(i=a.enablePolling)&&i,c=null!=(o=a.pollingInterval)?o:1e3,d=null!=(s=a.captureDocumentTitle)&&s;if(!r)return function(){};var f=void 0,h=function(){return r.location&&r.location.href||""},p=function(){var e=r.innerHeight,t=r.innerWidth,n=r.document,i=h(),o="";return d&&(o=(null==n?void 0:n.title)||""),{href:l.length>0?sw(i,l):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},g=function(){var e=h();(void 0===f||e!==f)&&(f=e,t(p()))},v=aP(r,function(){return g()},u?{enablePolling:!0,pollingInterval:c}:{});return g(),function(){return v()}},options:e}}a_();var aO=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null==(e=this.mutationObserver)||e.disconnect(),(0,eO.m)()&&(this.sendToAllIframes({type:su,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var r,n,i,o,s,a;try{for(var l=(0,eI.Ju)(e),u=l.next();!u.done;u=l.next()){var c=u.value;try{for(var d=(i=void 0,(0,eI.Ju)(Array.from(c.addedNodes))),f=d.next();!f.done;f=d.next()){var h=f.value;h instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(h):h instanceof Element&&h.querySelectorAll("iframe").forEach(function(e){t.sendToIframeAfterLoad(e)})}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}try{for(var p=(s=void 0,(0,eI.Ju)(Array.from(c.removedNodes))),g=p.next();!g.done;g=p.next()){var h=g.value;if(h instanceof HTMLIFrameElement){var v=t.pendingLoadListeners.get(h);v&&(h.removeEventListener("load",v),t.pendingLoadListeners.delete(h))}}}catch(e){s={error:e}}finally{try{g&&!g.done&&(a=p.return)&&a.call(p)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}),this.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},e.prototype.stop=function(){var e;null==(e=this.mutationObserver)||e.disconnect(),this.mutationObserver=void 0,this.pendingLoadListeners.forEach(function(e,t){t.removeEventListener("load",e)}),this.pendingLoadListeners.clear(),this.sendToAllIframes({type:su,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,r=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:su,action:"start"})};this.pendingLoadListeners.set(e,r),e.addEventListener("load",r,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach(function(r){return t.sendToIframe(r,e)})},e.prototype.sendToIframe=function(e,t){var r;try{null==(r=e.contentWindow)||r.postMessage(t,"*")}catch(e){}},e}(),aA=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,this.recordFunction=null,this.recordEventsInFlight=!1,this.recordingEnabled=!0,this.recordingGeneration=0,this.startChildRecordingOnSetup=!1,this.pendingEmitEvents=[],this.currentPageUrl="",this.recordEventsPendingShouldLogMetadata=null,this.urlChangeCleanup=null,this.crossOriginIframeC
1oordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var r=(0,eO.m)();r&&(r.removeEventListener("blur",e.blurListener),r.removeEventListener("focus",e.focusListener),t||r.addEventListener("blur",e.blurListener),t||r.addEventListener("focus",e.focusListener),r.self&&"onpagehide"in r.self?(r.removeEventListener("pagehide",e.pageLeaveListener),t||r.addEventListener("pagehide",e.pageLeaveListener)):(r.removeEventListener("beforeunload",e.pageLeaveListener),t||r.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){var t;if(e.recordingEnabled)if(e.recordCancelCallback&&e.recordFunction){if((null==(t=e.config)?void 0:t.captureFullSnapshotOnFocus)===!1)return;try{e.recordFunction.takeFullSnapshot(!0)}catch(t){e.loggerProvider.warn("Failed to take full snapshot on focus:",t)}}else e.recordEventsInFlight||e.recordEvents(!1)},this.pageLeaveListener=function(t){var r;null==(r=e.eventCompressor)||r.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,r,n,i){return void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1),(0,eI.sH)(e,void 0,void 0,function(){var e,o,s,a,l,u,c,d,f,h,p,g;return(0,eI.YH)(this,function(v){switch(v.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig)if(!r)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];else this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.");if(this.lastTargetingParams=t,!((e=this.config.targetingConfig)&&!this.sessionTargetingMatch))return[3,2];return o=i?this.latestUrlChangeTargetingEvaluationId:void 0,(s=t.event)&&Object.values(ee).includes(s.event_type)&&(s=void 0),a=null!=(p=null!=(d=null==(c=t.page)?void 0:c.url)?d:null==(h=null==(f=(0,eO.m)())?void 0:f.location)?void 0:h.href)?p:"",l=null!=(g=t.page)?g:""!==a?{url:a}:void 0,[4,aE({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:l},urlChange:i})];case 1:if(u=v.sent(),i&&void 0!==o&&o!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(o,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||u,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),v.label=2;case 2:if(!r)return[3,3];return this.initialize(!0),[3,5];case 3:if(!(n||!this.recordCancelCallback))return[3,5];return this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()];case 4:v.sent(),v.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),(0,eI.sH)(e,void 0,void 0,function(){var e,i,o,s;return(0,eI.YH)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==ep.METADATA)||(e={config:sE(i),version:sW},!n))return[3,2];return[4,sS()];case 1:o=a.sent(),e=(0,eI.Cl)((0,eI.Cl)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,eI.Cl)((0,eI.Cl)({},r),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return s=a.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",s),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t,r,n;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null==(t=e.networkObservers)||t.stop(),null==(r=e.crossOriginIframeC
1oordinator)||r.stop(),e.crossOriginIframeCoordinator=null,null==(n=e.crossOriginParentSignalCleanup)||n.call(e),e.crossOriginParentSignalCleanup=null}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new sc(new eP)}return e.prototype.init=function(e,t){return ex(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,r=this;null==(e=this.urlChangeCleanup)||e.call(this);var n=(0,eO.m)();if(null==n?void 0:n.location){var i=!!(null==(t=this.config)?void 0:t.targetingConfig),o=aP(n,function(e){if(r.currentPageUrl=e,i){var t=++r.latestUrlChangeTargetingEvaluationId;r.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),r.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}});this.urlChangeCleanup=function(){o(),r.urlChangeCleanup=null}}},e.prototype.isBelowMinSessionDuration=function(){var e,t=null==(e=this.config)?void 0:e.minSessionDurationMs;return void 0!==t&&void 0!==this.sessionStartTime&&Date.now()-this.sessionStartTime<t},e.prototype.getCurrentPageForTargeting=function(){var e,t,r=null==(t=null==(e=(0,eO.m)())?void 0:e.location)?void 0:t.href;return null!=r?{url:r}:void 0},e.prototype._init=function(e,t){var n,i,o,s,a,l,u,c,d,f,h,p,g,v;return(0,eI.sH)(this,void 0,void 0,function(){var m,y,b,w,S,E,k,C,I,x,T,P,_,O,A,R,M,D,L,N,H,U,F,j,q,B,z,Y,J,W=this;return(0,eI.YH)(this,function(V){switch(V.label){case 0:return null==(n=this.urlChangeCleanup)||n.call(this),this.recordingEnabled=!0,this.startChildRecordingOnSetup=!1,this.loggerProvider=new sc(t.loggerProvider||new eP),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=sv(),this.identifiers=new ah({sessionId:t.sessionId,deviceId:t.deviceId}),aw(e,m=Date.now(),this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!=(i=am(e,t.sessionId,m,this.loggerProvider))?i:m,y=this,[4,(0,eI.sH)(void 0,void 0,void 0,function(){var r;return(0,eI.YH)(this,function(n){return r=new sC(e,t),[2,new sU(new eM(e,r.loggerProvider,r.serverZone,t.configServerUrl,t.handleFetchConfig),r)]})})];case 1:return y.joinedConfigGenerator=V.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:if(w=(b=V.sent()).joinedConfig,S=b.localConfig,E=b.remoteConfig,this.config=w,this.setMetadata(t.sessionId,w,S,E,null==(o=t.version)?void 0:o.version,sW,null==(s=t.version)?void 0:s.type),this.pageLeaveFns=[],t.sessionId&&(null==(a=this.config.interactionConfig)?void 0:a.enabled)&&(k=af.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[k.send(this.getDeviceId.bind(this)).bind(k)],this.scrollHook=k.hook.bind(k),this.clickHandler=new al(this.loggerProvider,k)),C=[],"idb"!==(I=this.config.storeType)||(null==(l=(0,eO.m)())?void 0:l.indexedDB)||(I="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(I," for event storage.")),P=(0,eO.m)(),!(this.config.useWebWorker&&P&&P.Worker))return[3,4];return[4,r.e(69857).then(r.bind(r,69857))];case 3:O=(_=V.sent()).compressionScript,A=_.trackDestinationScript,x=O,T=A,V.label=4;case 4:return V.trys.push([4,6,,7]),[4,s3({config:this.config,type:"replay",minInterval:null==(u=this.config.flushIntervalConfig)?void 0:u.minIntervalMs,maxInterval:null==(c=this.config.flushIntervalConfig)?void 0:c.maxIntervalMs,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,storeType:I,trackDestinationWorkerScript:T,shouldSe
1nd:function(){return!W.isBelowMinSessionDuration()}})];case 5:return R=V.sent(),this.rrwebEventManager=R,C.push({name:"replay",manager:R}),[3,7];case 6:return M=V.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(M.toString())),[3,7];case 7:if(!(null==(d=this.config.interactionConfig)?void 0:d.enabled))return[3,11];D=this.config.interactionConfig.batch?aa:as,V.label=8;case 8:return V.trys.push([8,10,,11]),[4,s3({config:this.config,type:"interaction",minInterval:null!=(f=this.config.interactionConfig.trackEveryNms)?f:3e4,maxInterval:6e4,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,payloadBatcher:D,storeType:I,trackDestinationWorkerScript:T})];case 9:return L=V.sent(),C.push({name:"interaction",manager:L}),[3,11];case 10:return M=V.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(M.toString())),[3,11];case 11:if(this.eventsManager=new(s4.bind.apply(s4,(0,eI.fX)([void 0],(0,eI.zs)(C),!1))),this.eventCompressor&&this.eventCompressor.terminate(),N=!0===this.config.eagerFullSnapshotSend?function(){return W.sendEvents()}:void 0,this.eventCompressor=new sB(this.eventsManager,this.config,this.getDeviceId(),x,N),this.pendingEmitEvents.length>0){H=this.pendingEmitEvents.splice(0);try{for(F=(U=(0,eI.Ju)(H)).next();!F.done;F=U.next())q=(j=F.value).event,B=j.sessionId,this.eventCompressor.enqueueEvent(q,B)}catch(e){Y={error:e}}finally{try{F&&!F.done&&(J=U.return)&&J.call(U)}finally{if(Y)throw Y.error}}}return this.pageLeaveFns=(0,eI.fX)((0,eI.fX)([],(0,eI.zs)(this.pageLeaveFns),!1),[function(){if(W.config&&(null==(e=W.identifiers)?void 0:e.sessionId)&&R){var e,t=R.getBeaconEvents();if(t.length){var r=W.getDeviceId();!r||W.isBelowMinSessionDuration()||R.trackDestination.sendBeacon({events:t,sessionId:W.identifiers.sessionId,deviceId:r,apiKey:W.config.apiKey,serverZone:W.config.serverZone})}}}],!1),[4,this.initializeNetworkObservers()];case 12:return V.sent(),(null==(h=(0,eO.m)())?void 0:h.opener)&&(nl(z=ns()),z.setup((0,eI.Cl)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:nr[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:t.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 13:return V.sent(),(this.config.targetingConfig||(null!=(v=null==(g=null==(p=this.config.privacyConfig)?void 0:p.urlMaskLevels)?void 0:g.length)?v:0)>0)&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(e,t){return ex(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,r){var n,i,o,s;return(0,eI.sH)(this,void 0,void 0,function(){var a,l,u,c,d;return(0,eI.YH)(this,function(f){switch(f.label){case 0:if(a=null==(n=this.identifiers)?void 0:n.sessionId,l=this.getDeviceId(),void 0!==a&&a===e&&(void 0===t||t===l)&&((null==r?void 0:r.userProperties)===void 0||0===Object.keys(r.userProperties).length))return[2];if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,a&&this.sendEvents(a),(u=a!==e)&&(null==(i=this.rrwebEventManager)||i.dropPendingBeaconEvents()),c=t||this.getDeviceId(),this.identifiers=new ah({sessionId:e,deviceId:c}),u&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null==(o=this.config)?void 0:o.apiKey)&&(ay(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==a&&ab(this.config.apiKey,a,this.loggerProvider))),!(this.joinedConfigGenerator&&a))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:d=f.sent().joinedConfig,this.config=d,f.label=2;case 2:if(!(null==(s=this.config)?void 0:s.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==r?void 0:r.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return f.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:f.sent(),f.label=6;case 6:return[2]}})})},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,r=this.identifiers;if(!t||!r)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var n=this.getShouldRecord(),i={};return n&&((e={})[o7]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[st]=JSON.stringify({appHash:eq(t.apiKey).toString()}))),this.addCustomRRWebEvent(ep.GET_SR_PROPS,{shouldRecord:n,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,r,n=e||(null==(t=this.identifiers)?void 0:t.sessionId),i=this.getDeviceId();
1if(this.eventsManager&&n&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;this.loggerProvider.log("Session ".concat(n," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),this.suppressedSendCount++;return}if(!this.hasEmittedGateDecision&&(null==(r=this.config)?void 0:r.minSessionDurationMs)!==void 0&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(ep.REPLAY_GATE_DECISION,{sessionId:n,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,eI.sH)(this,void 0,void 0,function(){var r;return(0,eI.YH)(this,function(n){return(null==(t=this.identifiers)?void 0:t.sessionId)?(r=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:r}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){if(null==(e=this.config)?void 0:e.instanceName){var e,t,r;r=e5(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==r?r:null==(t=this.config)?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.recordingEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured because recording was stopped.")),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,r=!1,n="",i=!1;return this.config.targetingConfig?this.sessionTargetingMatch?(n="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(n),r=!0,i=!0):(n="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(n),r=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,function(e,t){void 0===t&&(t=0);var r,n=function(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(n=(n-55296<<10)+(i-56320)+65536,r++)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<65536?t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return new Uint8Array(t)}(e),i=n.length,o=0;if(i>=16){for(var s=t+0x9e3779b1+0x85ebca77>>>0,a=t+0x85ebca77>>>0,l=t>>>0,u=t-0x9e3779b1>>>0;o<=i-16;)s=aC(s,aI(n,o)),o+=4,a=aC(a,aI(n,o)),o+=4,l=aC(l,aI(n,o)),o+=4,u=aC(u,aI(n,o)),o+=4;r=ak(s,1)+ak(a,7)+ak(l,12)+ak(u,18)>>>0}else r=t+0x165667b1>>>0;for(r=r+i>>>0;o<=i-4;)r=Math.imul(ak(r=r+Math.imul(aI(n,o),0xc2b2ae3d)>>>0,17),0x27d4eb2f)>>>0,o+=4;for(;o<i;)r=Math.imul(ak(r=r+Math.imul(n[o],0x165667b1)>>>0,11),0x9e3779b1)>>>0,o++;return r^=r>>>15,r=Math.imul(r,0x85ebca77)>>>0,r^=r>>>13,r=Math.imul(r,0xc2b2ae3d)>>>0,(r^=r>>>16)>>>0}(e.toString())%1e6/1e6<t)?(r=!0,i=!0):(n="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(n),r=!1,i=!1),this.lastShouldRecordDecision!==r&&this.config.targetingConfig&&(this.addCustomRRWebEvent(ep.TARGETING_DECISION,{message:n,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=r),r},e.prototype.getBlockSelectors=function(){var e,t,r,n=null!=(r=null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.blockSelector)?r:[];if(0!==n.length)return n},e.prototype.getMaskTextSelectors=function(){var e,t,r=null==(e=this.config)?void 0:e.privacyConfig;if("conservative"===(r?sh(this.currentPageUrl,r):void 0)||(null==(t=null==r?void 0:r.urlMaskLevels)?void 0:t.some(function(e){return"conservative"===e.maskLevel})))return"*";var n=null==r?void 0:r.urlMaskLevels;if((null==r?void 0:r.defaultMaskLevel)==="conservative"&&n&&n.length>0)return"*";var i=null==r?void 0:r.maskSelector;if(i)return i},e.prototype.getRecordingPlugins=function(e){var t,n,i,o,s,a;return(0,eI.sH)(this,void 0,void 0,function(){var l,u,c,d;return(0,eI.YH)(this,function(f){switch(f.label){case 0:l=[];try{u=a_({ugcFilterRules:(null==(n=null==(t=this.config)?void 0:t.interactionConfig)?void 0:n.ugcFilterRules)||[],enablePolling:(null==(i=this.config)?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null==(o=this.config)?void 0:o.urlChangePollingInterval,captureDocumentTitle:null==(s=this.config)?void 0:s.captureDocumentTitle}),l.push(u)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null==(a=null==e?void 0:e.console)?void 0:a.enabled))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,r.e(48970).then(r.bind(r,70242))];case 2:return c=f.sent().getRecordConsolePlugin,l.push(c({level:e.console.levels})),[3,4];case 3:return d=f.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,l.length>0?l:void 0]}})})},e.prototype.getRecordFunction=function(){return(0,eI.sH)(this,void 0,void 0,function(){var e,t;return(0,eI.YH)(this,function(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.e(17840).then(r.bind(r,52170))];case 2:return e=n.sent().record,this.recordFunction=e,[2,e];case 3:return t=n.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",t),[2,null];case 4:return[2]}})})},e.prototype.recordEvents=function(e){return void 0===e&&(e=!0),(0,eI.sH)(this,void 0,void 0,function(){var t;return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,r.label=1;case 1:return r.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:r.sent(),r.label=3;case 3:if(null===this.recordEventsPendingShouldLogMetadata)return[3,5];return t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)];case 4:return r.sent(),[3,3];case 5:return[3,7];case 6:return this.recordEventsInFlight=!1,this.recordEventsPendingShouldLogMetadata=null,[7];case 7:return[2]}})})},e.prototype.shouldAbandonRecordStart=function(e){return!this.recordingEnabled||e!==this.recordingGeneration},e.prototype._recordEvents=function(e){var t,r,n,i,o,s,a,l;return void 0===e&&(e=!0),(0,eI.sH)(this,void 0,void 0,function(){var u,c,d,f,h,p,g,v,m,y,b,w,S,E,k,C,I=this;return(0,eI.YH)(this,function(x){switch(x.label){case 0:if(u=this.config,c=this.getShouldRecord(),d=null==(t=this.identifiers)?void 0:t.sessionId,!c||!d||!u)return[2];return this.stopRecordingEvents(),f=this.recordingGeneration,[4,this.getRecordFunction()];case 1:if(!(h=x.sent())||this.shouldAbandonRecordStart(f))return[2];return[4,this.initializeNetworkObservers()];case 2:if(x.sent(),this.shouldAbandonRecordStart(f))return[2];p=null==(r=u.loggingConfig)?void 0:r.network,g=[si,so,ss,sj(u.serverZone,u.trackServerUrl)],null==(n=this.networkObservers)||n.start(function(e){g.some(function(t){return e.url.
1startsWith(t)})||I.addCustomRRWebEvent(ep.FETCH_REQUEST,e)},p),v=u.interactionConfig,m=u.loggingConfig,y=(null==v?void 0:v.enabled)?{mouseInteraction:this.eventsManager&&(null==(i=this.clickHandler)?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:h.mirror,ugcFilterRules:null!=(o=v.ugcFilterRules)?o:[],performanceOptions:null==(s=u.performanceConfig)?void 0:s.interaction})),scroll:this.scrollHook}:{},b=(null==v?void 0:v.enabled)&&v.ugcFilterRules?v.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),x.label=3;case 3:if(x.trys.push([3,5,,6]),w=!!(null==(a=u.crossOriginIframes)?void 0:a.enabled),S=(null==(l=u.crossOriginIframes)?void 0:l.coordinateChildren)!==!1,(E=w&&function(){try{var e=(0,eO.m)();if(!e)return!1;return e.parent!==e}catch(e){return!0}}())&&S)return this.crossOriginParentSignalCleanup=function(e){var t=(0,eO.m)();if(!t)return function(){};var r=t.parent;function n(t){if(t.source===r){var n=t.data;(null==n?void 0:n.type)===su&&("start"===n.action?e.onStart():"stop"===n.action&&e.onStop())}}return t.addEventListener("message",n),function(){return t.removeEventListener("message",n)}}({onStart:function(){I.recordingEnabled&&I._recordEventsInChildMode(h,d,u,y)},onStop:function(){try{I.recordCancelCallback&&I.recordCancelCallback(),I.recordCancelCallback=null}catch(e){I.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),this.startChildRecordingOnSetup&&(this.startChildRecordingOnSetup=!1,this._recordEventsInChildMode(h,d,u,y)),[2];return this.startChildRecordingOnSetup=!1,[4,this.getRecordingPlugins(m)];case 4:if(k=x.sent(),this.shouldAbandonRecordStart(f))return[2];return this.recordCancelCallback=h((0,eI.Cl)((0,eI.Cl)({},this.buildRRWebRecordOptions(u,y,function(e){if(I.shouldOptOut()||!I.recordingEnabled){I.loggerProvider.log(I.shouldOptOut()?"Opting session ".concat(d," out of recording due to optOut config."):"Session Replay capture stopping for ".concat(d,".")),I.stopRecordingEvents(),I.sendEvents();return}e.type===s_.Meta&&(e.data.href=sw(e.data.href,b)),I.eventCompressor?I.eventCompressor.enqueueEvent(e,d):I.pendingEmitEvents.push({event:e,sessionId:d})},"Error while capturing replay: ")),{plugins:k,recordCrossOriginIframes:w})),w&&!E&&S&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new aO),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(ep.DEBUG_INFO),e&&this.addCustomRRWebEvent(ep.METADATA,this.metadata),[3,6];case 5:return C=x.sent(),this.loggerProvider.warn("Failed to initialize session replay:",C),[3,6];case 6:return[2]}})})},e.prototype.buildRRWebRecordOptions=function(e,t,r,n){var i,o=this,s=e.privacyConfig;return(0,eI.Cl)((0,eI.Cl)({emit:r,inlineStylesheet:e.shouldInlineStylesheet,inlineImages:e.inlineImages,hooks:t,maskAllInputs:!0,maskTextClass:sr,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements,maskInputFn:sg("input",s,function(){return o.currentPageUrl}),maskTextFn:sg("text",s,function(){return o.currentPageUrl}),maskAttributeFn:(i=function(){return o.currentPageUrl},function(e,t,r){var n;return"style"!==e&&(null!=(n=null==s?void 0:s.maskAttributes)?n:[]).includes(e)?sp(["INPUT","SELECT","TEXTAREA"].includes(r.tagName)?"input":"text",s,r,null==i?void 0:i())?t.replace(/[^\s]/g,"*"):t:t}),maskTextSelector:this.getMaskTextSelectors()},void 0!==e.fullSnapshotIntervalMs&&{checkoutEveryNms:e.fullSnapshotIntervalMs}),{recordCanvas:!1,captureAdoptedStyleSheets:e.captureAdoptedStyleSheets,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return o.loggerProvider.warn(n,e.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,r,n){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e((0,eI.Cl)((0,eI.Cl)({},this.buildRRWebRecordOptions(r,n,function(){},"Error while capturing replay (child iframe): ")),{recordCrossOriginIframes:!0})),this.loggerProvider.log("Session Replay child iframe capture beginning for session ".concat(t,"."))}catch(e){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",e)}},e.prototype.getDeviceId=function(){var e;return null==(e=this.identifiers)?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null==(e=this.identifiers)?void 0:e.sessionId},e.prototype.start=function(){return ex(this._start())},e.prototype._start=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:return this.recordingEnabled=!0,this.startChildRecordingOnSetup=!0,[4,this.recordEvents()];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,this.stopRecordingEvents(),this.sendEvents()},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e,t;this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,null==(e=this.urlChangeCleanup)||e.call(this),null==(t=this.crossOriginParentSignalCleanup)||t.call(this),this.crossOriginParentSignalCleanup=null,this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,r,n,i,o,s){var a=(null==e?void 0:e.toString())?eq(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:r,remoteConfig:n,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:o}},e.prototype.initializeNetworkObservers=function(){var e,t,n;return(0,eI.sH)(this,void 0,void 0,function(){var i,o;return(0,eI.YH)(this,function(s){switch(s.label){case 0:if(!((null==(n=null==(t=null==(e=this.config)?void 0:e.loggingConfig)?void 0:t.network)?void 0:n.enabled)&&!this.networkObservers))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.e(54734).then(r.bind(r,54734))];case 2:return i=s.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return o=s.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",o),[3,4];case 4:return[2]}})})},e}(),aR=function(e){return function(){var t=e.config||sk();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let aM={init:tc((A=new aA).init.bind(A),"init",aR(A)),evaluateTargetingAndCapture:tc(A.evaluateTargetingAndCapture.bind(A),"evaluateTargetingAndRecord",aR(A)),setSessionId:tc(A.setSessionId.bind(A),"setSessionId",aR(A)),getSessionId:tc(A.getSessionId.bind(A),"getSessionId",aR(A)),getSessionReplayProperties:tc(A.getSessionReplayProperties.bind(A),"getSessionReplayProperties",aR(A)),flush:tc(A.flush.bind(A),"flush",aR(A)),start:tc(A.start.bind(A),"start",aR(A)),stop:tc(A.stop.bind(A),"stop",aR(A)),shutdown:tc(A.shutdown.bind(A),"shutdown",aR(A))};var aD=aM.init,aL=aM.setSessionId,aN=aM.getSessionId,aH=aM.getSessionReplayProperties,aU=aM.flush,aF=aM.start,aj=aM.stop,aq=aM.shutdown,aB=aM.evaluateTargetingAndCapture;
1(R=ey||(ey={})).SET="$set",R.SET_ONCE="$setOnce",R.ADD="$add",R.APPEND="$append",R.PREPEND="$prepend",R.REMOVE="$remove",R.PREINSERT="$preInsert",R.POSTINSERT="$postInsert",R.UNSET="$unset",R.CLEAR_ALL="$clearAll",(M=eb||(eb={})).REVENUE_PRODUCT_ID="$productId",M.REVENUE_QUANTITY="$quantity",M.REVENUE_PRICE="$price",M.REVENUE_TYPE="$revenueType",M.REVENUE_CURRENCY="$currency",M.REVENUE="$revenue",(D=ew||(ew={})).IDENTIFY="$identify",D.GROUP_IDENTIFY="$groupidentify",D.REVENUE="revenue_amount";var az=[ey.SET,ey.SET_ONCE,ey.ADD,ey.APPEND,ey.PREPEND,ey.POSTINSERT],aY=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(r){if(az.includes(r)){var n=e.user_properties&&e.user_properties[r];t=(0,eI.Cl)((0,eI.Cl)({},t),n)}}),t}},aJ="1.35.0",aW="".concat("[Amplitude]"," Session Replay ID"),aV=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:aU,getSessionId:aN,getSessionReplayProperties:aH,init:aD,setSessionId:aL,start:aF,stop:aj,shutdown:aq,evaluateTargetingAndCapture:aB},this.options=(0,eI.Cl)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var r,n,i,o,s,a,l,u;return(0,eI.sH)(this,void 0,void 0,function(){var t,c;return(0,eI.YH)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(aJ,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=(0,eI.Cl)((0,eI.Cl)({},e.defaultTracking),{sessions:!0})),t=e5(this.config.instanceName).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!=(r=this.options.deviceId)?r:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||(null==(n=this.config.remoteConfig)?void 0:n.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null==(i=this.options.privacyConfig)?void 0:i.blockSelector,maskSelector:null==(o=this.options.privacyConfig)?void 0:o.maskSelector,unmaskSelector:null==(s=this.options.privacyConfig)?void 0:s.unmaskSelector,defaultMaskLevel:null==(a=this.options.privacyConfig)?void 0:a.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,inlineImages:this.options.inlineImages,version:{type:"plugin",version:aJ},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!=(l=this.options.useWebWorker)?l:null==(u=this.options.experimental)?void 0:u.useWebWorker,userProperties:t,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval,captureAdoptedStyleSheets:this.options.captureAdoptedStyleSheets,crossOriginIframes:this.options.crossOriginIframes,flushIntervalConfig:this.options.flushIntervalConfig,eagerFullSnapshotSend:this.options.eagerFullSnapshotSend,captureFullSnapshotOnFocus:this.options.captureFullSnapshotOnFocus,maxPersistedEventsSizeBytes:this.options.maxPersistedEventsSizeBytes,maxSingleEventSizeBytes:this.options.maxSingleEventSizeBytes,sendTimeoutMs:this.options.sendTimeoutMs,handleSendEvents:this.options.handleSendEvents,handleFetchConfig:this.options.handleFetchConfig},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return d.sent(),[3,3];case 2:return c=d.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(c.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){switch(r.label){case 0:return null==(t=this.config)||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return r.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){switch(r.label){case 0:if(null==(t=this.config)||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),!e)return[3,1];return this.sessionReplay.shutdown(),[3,4];case 1:if(null==this.config)return[3,3];return[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise];case 2:r.sent(),r.label=3;case 3:r.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,r,n;return(0,eI.sH)(this,void 0,void 0,function(){var i,o,s,a,l;return(0,eI.YH)(this,function(u){switch(u.label){case 0:if(u.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(i=this.options.customSessionId(e)))return[3,3];if(i===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(i).promise];case 1:u.sent(),u.label=2;case 2:o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,eI.Cl)((0,eI.Cl)({},e.event_properties),o),u.label=3;case 3:return[3,8];case 4:if(!((i=null==(t=this.config)?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(i).promise];case 5:u.sent(),u.label=6;case 6:if(!(i&&i===e.session_id))return[3,8];return s=void 0,e.event_type===ee.IDENTIFY&&(s=aY(e)),a=(0,eO.m)(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:s,page:(null==(r=null==a?void 0:a.location)?void 0:r.href)!=null?{url:a.location.href}:void 0})];case 7:u.sent(),o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,eI.Cl)((0,eI.Cl)({},e.event_properties),o),u.label=8;case 8:return e.event_type===ee.IDENTIFY&&e.event_properties&&delete e.event_properties[aW],[2,Promise.resolve(e)];case 9:return l=u.sent(),null==(n=this.config)||n.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(l.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null==(e=this.config)||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.prototype.start=function(){return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(e){switch(e.label){case 0:return[4,this.sessionReplay.start().promise];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.sessionReplay.stop()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),aK=r(86141).hp;let a$="is not",aX="contains",aG="does not contain",aQ="less",aZ="less or equal",a0="greater",a1="greater or equal",a2="version less",a3="version less or equal",a4="version greater",a5="version greater or equal",a6="set is",a8="set is not",a7="set contains",a9="set does not contain",le="set contains any",lt="set does not contain any",lr=(e,t)=>{let r=e,n=t;return n^=r=Math.imul(r=ln(r=Math.imul(r,-0x3361d2af),15),0x1b873593),(n=Math.imul(n=ln(n,13),5))+-0x19ab949c|0},ln=(e,t,r=32)=>{t>r&&(t%=r);let n=(e&0xffffffff<<r-t>>>0)>>>0>>>r-t>>>0;return(e<<t|n)>>>0},li=(e,t=0)=>lo(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]),lo=e=>(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24,ls=(e,t)=>{if(t&&0!==t.length){for(let r of t){if(!r||!e||"object"!=typeof e)return;e=e[r]}if(null!=e)return e}};class la{constructor(e,t,r,n){this.major=e,this.minor=t,this.patch=r,this.preRelease=n}static parse(e){if(!e)return;
1let t=RegExp("^(\\d+)\\.(\\d+)(\\.(\\d+)(-(([-\\w]+\\.?)*))?)?$").exec(e);if(!t)return;let r=Number(t[1]),n=Number(t[2]);if(!(isNaN(r)||isNaN(n)))return new la(r,n,Number(t[4])||0,t[5]||void 0)}compareTo(e){if(this.major>e.major)return 1;if(this.major<e.major)return -1;if(this.minor>e.minor)return 1;if(this.minor<e.minor)return -1;if(this.patch>e.patch)return 1;if(this.patch<e.patch||this.preRelease&&!e.preRelease)return -1;if(!this.preRelease&&e.preRelease)return 1;if(this.preRelease&&e.preRelease){if(this.preRelease>e.preRelease)return 1;if(this.preRelease<e.preRelease)return -1}return 0}}class ll{evaluate(e,t){let r={},n={context:e,result:r};for(let e of t){let t=this.evaluateFlag(n,e);t&&(r[e.key]=t)}return r}evaluateWithTraces(e,t){let r={},n={},i={context:e,result:r};for(let e of t){let{variant:t,trace:o}=this.evaluateFlagWithTrace(i,e);t&&(r[e.key]=t),n[e.key]=o}return{results:r,traces:n}}evaluateFlag(e,t){let r;for(let n of t.segments)if(r=this.evaluateSegment(e,t,n)){let e=Object.assign(Object.assign(Object.assign({},t.metadata),n.metadata),r.metadata);r=Object.assign(Object.assign({},r),{metadata:e});break}return r}evaluateFlagWithTrace(e,t){var r,n;let i,o,s,a=[];for(let l of t.segments){let u;if(!l.conditions){let n=this.bucket(e,l),u=void 0!==n;a.push({segmentMetadata:l.metadata,conditionsPassed:!0,bucketed:u,bucketVariant:n,conditionResult:void 0,matched:u}),i||void 0===n||(i=t.variants[n],o=l,s=null==(r=l.metadata)?void 0:r.segmentName);continue}let c=[],d=!1;for(let t of l.conditions){let r=!0,n=[];for(let i of t){let t=ls(e,i.selector),o=this.matchCondition(e,i);if(n.push({propValue:t,condition:i,matched:o}),!o){r=!1;break}}if(c.push(n),r){d=!0;break}}let f=!1;d&&(f=void 0!==(u=this.bucket(e,l))),a.push({segmentMetadata:l.metadata,conditionsPassed:d,bucketed:f,bucketVariant:u,conditionResult:c,matched:d&&f}),d&&void 0!==u&&!i&&(i=t.variants[u],o=l,s=null==(n=l.metadata)?void 0:n.segmentName)}if(i&&o){let e=Object.assign(Object.assign(Object.assign({},t.metadata),o.metadata),i.metadata);i=Object.assign(Object.assign({},i),{metadata:e})}let l={flagKey:t.key,matched:void 0!==i,matchedSegment:s,steps:a};return{variant:i,trace:l}}evaluateSegment(e,t,r){if(!r.conditions){let n=this.bucket(e,r);return void 0!==n?t.variants[n]:void 0}if(this.evaluateConditions(e,r.conditions)){let n=this.bucket(e,r);if(void 0!==n)return t.variants[n]}}evaluateConditions(e,t){for(let r of t){let t=!0;for(let n of r)if(!(t=this.matchCondition(e,n)))break;if(t)return!0}return!1}matchCondition(e,t){let r=ls(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);{let e=this.coerceStringArray(r);if(this.isSetOperator(t.op))return!!e&&this.matchSet(e,t.op,t.values);{if(e)return this.matchStringsNonSet(e,t.op,t.values);let n=this.coerceString(r);return void 0!==n&&this.matchString(n,t.op,t.values)}}}getHash(e){return((e,t=0)=>{var r;let n,i=(e=>{let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:((64512&i)==55296&&n+1<e.length&&(64512&e.charCodeAt(n+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return Uint8Array.from(t)})(e),o=i.length,s=o>>2,a=t;for(let e=0;e<s;e++)a=lr(li(i,e<<2),a);let l=s<<2,u=0;switch(o-l){case 3:u^=i[l+2]<<16,u^=i[l+1]<<8,u^=i[l],a^=u=Math.imul(u=ln(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=i[l+1]<<8,u^=i[l],a^=u=Math.imul(u=ln(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=i[l],a^=u=Math.imul(u=ln(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return n=r=a^=o,n^=n>>>16,n=Math.imul(n,-0x7a143595),n^=n>>>13,n=Math.imul(n,-0x3d4d51cb),(n^=n>>>16)>>>0})(e)}bucket(e,t){if(!t.bucket)return t.variant;let r=this.coerceString(ls(e,t.bucket.selector));if(!r||0===r.length)return t.variant;let n=`${t.bucket.salt}/${r}`,i=this.getHash(n),o=i%100,s=Math.floor(i/100);for(let e of t.bucket.allocations){let t=e.range[0],r=e.range[1];if(o>=t&&o<r)for(let t of e.distributions){let e=t.range[0],r=t.range[1];if(s>=e&&s<r)return t.variant}}return t.variant}matchNull(e,t){let r=this.containsNone(t);
1switch(e){case"is":case aX:case aQ:case aZ:case a0:case a1:case a2:case a3:case a4:case a5:case a6:case a7:case le:return r;case a$:case aG:case a9:case lt:return!r;default:return!1}}matchSet(e,t,r){switch(t){case a6:return this.setEquals(e,r);case a8:return!this.setEquals(e,r);case a7:return this.matchesSetContainsAll(e,r);case a9:return!this.matchesSetContainsAll(e,r);case le:return this.matchesSetContainsAny(e,r);case lt:return!this.matchesSetContainsAny(e,r);default:return!1}}matchString(e,t,r){switch(t){case"is":return this.matchesIs(e,r);case a$:return!this.matchesIs(e,r);case aX:return this.matchesContains(e,r);case aG:return!this.matchesContains(e,r);case aQ:case aZ:case a0:case a1:return this.matchesComparable(e,t,r,e=>this.parseNumber(e),(e,t,r)=>this.comparator(e,t,r));case a2:case a3:case a4:case a5:return this.matchesComparable(e,t,r,e=>la.parse(e),(e,t,r)=>this.versionComparator(e,t,r));case"regex match":return this.matchesRegex(e,r);case"regex does not match":return!this.matchesRegex(e,r);default:return!1}}matchStringsNonSet(e,t,r){return e.some(e=>this.matchString(e,t,r))}matchesIs(e,t){if(this.containsBooleans(t)){let r=e.toLowerCase();if("true"===r||"false"===r)return t.some(e=>e.toLowerCase()===r)}return t.some(t=>e===t)}matchesContains(e,t){for(let r of t)if(e.toLowerCase().includes(r.toLowerCase()))return!0;return!1}matchesComparable(e,t,r,n,i){let o=n(e),s=r.map(e=>n(e)).filter(e=>void 0!==e);return void 0===o||0===s.length?r.some(r=>this.comparator(e,t,r)):s.some(e=>i(o,t,e))}comparator(e,t,r){switch(t){case aQ:case a2:return e<r;case aZ:case a3:return e<=r;case a0:case a4:return e>r;case a1:case a5:return e>=r;default:return!1}}versionComparator(e,t,r){let n=e.compareTo(r);switch(t){case aQ:case a2:return n<0;case aZ:case a3:return n<=0;case a0:case a4:return n>0;case a1:case a5:return n>=0;default:return!1}}matchesRegex(e,t){return t.some(t=>!!new RegExp(t).exec(e))}containsNone(e){return e.some(e=>"(none)"===e)}containsBooleans(e){return e.some(e=>{switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})}parseNumber(e){var t;return null!=(t=Number(e))?t:void 0}coerceString(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)}coerceStringArray(e){if(Array.isArray(e))return e.map(e=>this.coerceString(e)).filter(Boolean);let t=String(e);if(t.startsWith("["))try{let e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>this.coerceString(e)).filter(Boolean);return}catch(e){return}}isSetOperator(e){switch(e){case a6:case a8:case a7:case a9:case le:case lt:return!0;default:return!1}}setEquals(e,t){let r=new Set(e),n=new Set(t);return r.size===n.size&&[...n].every(e=>r.has(e))}matchesSetContainsAll(e,t){if(e.length<t.length)return!1;for(let r of t)if(!this.matchesIs(r,e))return!1;return!0}matchesSetContainsAny(e,t){for(let r of t)if(this.matchesIs(r,e))return!0;return!1}}let lu=(e,t)=>{let r=Object.assign({},e),n=[];for(let e of t||Object.keys(r)){let t=lc(e,r);t&&n.push(...t)}return n},lc=(e,t,r=[])=>{let n=t[e];if(!n)return;if(!n.dependencies||0===n.dependencies.length)return delete t[n.key],[n];
1r.push(n.key);let i=[];for(let e of n.dependencies){if(r.some(t=>t===e))throw Error(`Detected a cycle between flags ${r.join(", ")}`);let n=lc(e,t,r);n&&i.push(...n)}return i.push(n),r.pop(),delete t[n.key],i};function ld(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let lf="function"==typeof aK,lh="function"==typeof TextDecoder?new TextDecoder:void 0,lp="function"==typeof TextEncoder?new TextEncoder:void 0,lg=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),lv=(i={},lg.forEach((e,t)=>i[e]=t),i),lm=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ly=String.fromCharCode.bind(String),lb="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),lw=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),lS="function"==typeof btoa?e=>btoa(e):lf?e=>aK.from(e,"binary").toString("base64"):e=>{let t,r,n,i,o="",s=e.length%3;for(let s=0;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw TypeError("invalid character found");o+=lg[(t=r<<16|n<<8|i)>>18&63]+lg[t>>12&63]+lg[t>>6&63]+lg[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},lE=lf?e=>aK.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(ly.apply(null,e.subarray(r,r+4096)));return lS(t.join(""))},lk=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?ly(192|t>>>6)+ly(128|63&t):ly(224|t>>>12&15)+ly(128|t>>>6&63)+ly(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return ly(240|t>>>18&7)+ly(128|t>>>12&63)+ly(128|t>>>6&63)+ly(128|63&t)},lC=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,lI=lf?e=>aK.from(e,"utf8").toString("base64"):lp?e=>lE(lp.encode(e)):e=>lS(e.replace(lC,lk)),lx=(e,t=!1)=>t?lw(lI(e)):lI(e),lT=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,lP=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return ly((t>>>10)+55296)+ly((1023&t)+56320);case 3:return ly((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return ly((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},l_="function"==typeof atob?e=>atob(e.replace(/[^A-Za-z0-9\+\/]/g,"")):lf?e=>aK.from(e,"base64").toString("binary"):e=>{let t,r,n;if(e=e.replace(/\s+/g,""),!lm.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let i=[];for(let o=0;o<e.length;)t=lv[e.charAt(o++)]<<18|lv[e.charAt(o++)]<<12|(r=lv[e.charAt(o++)])<<6|(n=lv[e.charAt(o++)]),64===r?i.push(ly(t>>16&255)):64===n?i.push(ly(t>>16&255,t>>8&255)):i.push(ly(t>>16&255,t>>8&255,255&t));return i.join("")},lO=lf?e=>lb(aK.from(e,"base64")):e=>lb(l_(e).split("").map(e=>e.charCodeAt(0))),lA=lf?e=>aK.from(e,"base64").toString("utf8"):lh?e=>lh.decode(lO(e)):e=>l_(e).replace(lT,lP);
1class lR extends Error{constructor(e,t){super(t),this.statusCode=e,Object.setPrototypeOf(this,lR.prototype)}}class lM extends Error{constructor(e){super(e),Object.setPrototypeOf(this,lM.prototype)}}class lD{constructor(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}getVariants(e,t){return ld(this,void 0,void 0,function*(){let r=lx(JSON.stringify(e),!0),n={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-User":r};(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=lx(JSON.stringify(t.flagKeys),!0)),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(n["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption);let i=new URL(`${this.serverUrl}/sdk/v2/vardata?v=0`);(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod);let o=yield this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.timeoutMillis});if(200!=o.status)throw new lR(o.status,`Fetch error response: status=${o.status}`);return JSON.parse(o.body)})}}class lL{constructor(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}getFlags(e){return ld(this,void 0,void 0,function*(){let t={Authorization:`Api-Key ${this.deploymentKey}`};(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]=`${e.libraryName}/${e.libraryVersion}`),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=lx(JSON.stringify(e.user),!0));let r=yield this.httpClient.request({requestUrl:`${this.serverUrl}/sdk/v2/flags`+((null==e?void 0:e.deliveryMethod)?`?delivery_method=${e.deliveryMethod}`:""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis});if(200!=r.status)throw Error(`Flags error response: status=${r.status}`);return JSON.parse(r.body).reduce((e,t)=>(e[t.key]=t,e),{})})}}let lN=()=>"u">typeof globalThis&&null!==globalThis?globalThis:"u">typeof window&&null!==window?window:"u">typeof self&&null!==self?self:void 0!==r.g&&null!==r.g?r.g:void 0;lN();let lH=()=>{var e;return null==(e=lN())?void 0:e.localStorage},lU=()=>{var e;return null==(e=lN())?void 0:e.sessionStorage},lF=()=>{let e=lN();return(null==e?void 0:e.setTimeout)?e.setTimeout.bind(e):void 0},lj=()=>{let e=lN();return(null==e?void 0:e.setInterval)?e.setInterval.bind(e):void 0},lq=()=>{let e=lN();return(null==e?void 0:e.clearInterval)?e.clearInterval.bind(e):void 0};class lB{constructor(e,t){this.poller=void 0,this.action=e,this.ms=t}start(){if(this.poller)return;let e=lj();e&&(this.poller=e(()=>{this.action()},this.ms),this.action())}stop(){if(!this.poller)return;let e=lq();e&&e(this.poller),this.poller=void 0}}var lz=r(27360);function lY(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let lJ=(e,t=!1)=>{var r;let n,i=lW(e,t),o=null==(r=lN())?void 0:r.document;if(o){for(let e of o.cookie.split("; ")){let[t,r]=e.split("=",2);t===i&&(n=decodeURIComponent(r))}if(n)try{let e;if(t){let e=atob(n);return JSON.parse(decodeURIComponent(e))}let r=n.split(".");return r.length>=2&&r[1]&&(e=atob(r[1])),{deviceId:r[0],userId:e}}catch(e){return}}},lW=(e,t)=>{if(t){if((null==e?void 0:e.length)<10)return;return`AMP_${e.substring(0,10)}`}if(!((null==e?void 0:e.length)<6))return`amp_${e.substring(0,6)}`};class lV{constructor(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}setup(e,t){return lY(this,void 0,void 0,function*(){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(()=>{null==t||t.fetch()}),this.waitForConnectorIdentity(this.timeoutMillis)})}getUser(){let e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}}track(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)}loadPersistedState(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;let e=lJ(this.apiKey,!0);return!!(e||(e=lJ(this.apiKey,!1))||(e=(e=>{let t=lW(e,!0);try{let e=lH();if(!e)return;let r=e.getItem(t);if(!r)return;let n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}})(this.apiKey))||(e=(e=>{let t=lW(e,!0);try{let e=lU();if(!e)return;let r=e.getItem(t);if(!r)return;let n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}})(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)}commitIdentityToConnector(e){let t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()}waitForConnectorIdentity(e){return lY(this,void 0,void 0,function*(){let t=this.identityStore.getIdentity();if(!t.userId&&!t.deviceId)return Promise.race([new Promise(e=>{let t=()=>{e(),this.identityStore.removeIdentityListener(t)};this.identityStore.addIdentityListener(t)}),new Promise((t,r)=>{let n=lF();n?n(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize."):r("Timed out waiting for Amplitude Analytics SDK to initialize.")})])})}}let lK=((null==(o=lN())?void 0:o.fetch)?o.fetch.bind(o):void 0)||function(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],s=[],a={},l=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:l,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var u in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),s.push([t,r]),a[t]=a[t]?a[t]+","+r:r}),r(l())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(u,t.headers[u]);i.send(t.body||null)})};class l${constructor(e){this.client=e}request(e){return lY(this,void 0,void 0,function*(){return yield this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)})}}let lX={request:(e,t,r,n,i)=>{var o;return o=lY(void 0,void 0,void 0,function*(){let i=yield lK(e,{method:t,headers:r,body:n});return{status:i.status,body:yield i.text()}}),null==i||i<=0?o:new Promise(function(e,t){let r=lF();r&&r(function(){t(new lM(`Request timeout after ${i} milliseconds`))},i),o.then(e,t)})}};(L=eS||(eS={}))[L.Disable=0]="Disable",L[L.Error=1]="Error",L[L.Warn=2]="Warn",L[L.Info=3]="Info",L[L.Debug=4]="Debug",L[L.Verbose
1=5]="Verbose",(N=eE||(eE={})).LocalStorage="localStorage",N.InitialVariants="initialVariants",(H=ek||(ek={})).LocalStorage="storage",H.InitialVariants="initial",H.SecondaryLocalStorage="secondary-storage",H.SecondaryInitialVariants="secondary-initial",H.FallbackInline="fallback-inline",H.FallbackConfig="fallback-config",H.LocalEvaluation="local-evaluation";let lG=e=>!e||e===ek.FallbackInline||e===ek.FallbackConfig||e===ek.SecondaryInitialVariants,lQ={debug:!1,logLevel:eS.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:eE.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:lX};var lZ="1.23.1";class l0{constructor(e,t){var r;this.isReady=new Promise(e=>{this.resolve=e}),this.config=e,this.client=t;const n=null!=(r=e.instanceName)?r:lQ.instanceName;this.queue=new l2(n,512,e.internalPersistenceAllowed),this.cache=new l1(n,e.internalPersistenceAllowed)}ready(){return this.integration?this.isReady:Promise.resolve()}setIntegration(e){this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()},()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())}getUser(){return this.integration?this.integration.getUser():{}}track(e,t){if(this.cache.shouldTrack(e,t)){let t=this.getExposureEvent(e);this.queue.push(t)}}getExposureEvent(e){var t,r,n;let i={eventType:"$exposure",eventProperties:e};return(null==(t=e.metadata)?void 0:t.exposureEvent)?i={eventType:null==(r=e.metadata)?void 0:r.exposureEvent,eventProperties:e}:(null==(n=e.metadata)?void 0:n.deliveryMethod)==="web"&&(i={eventType:"$impression",eventProperties:e}),i}}class l1{constructor(e,t){this.persistenceAllowed=t,this.clearStoredOnReopen=!1,this.hasGatedEntries=!1,this.inMemoryCache={},this.identity={},this.storageKey=`EXP_sent_v3_${e}`}isGated(){return void 0!==this.persistenceAllowed&&!this.persistenceAllowed()}usableStorage(){if(this.isGated())return;void 0===this.isSessionStorageAvailable&&(this.isSessionStorageAvailable=l3());let e=lU();if(this.isSessionStorageAvailable&&e)return this.clearStoredOnReopen&&(this.clearStoredOnReopen=!1,e.removeItem(this.storageKey)),e}shouldTrack(e,t){var r,n;if((null==(r=e.metadata)?void 0:r.deliveryMethod)==="web")return!0;let i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();let o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!=(n=e.variant)?n:null,l=!1;return(!o||(null!=s?s:null)!==a)&&(l=!0,this.inMemoryCache[e.flag_key]=a,this.isGated()&&(this.hasGatedEntries=!0)),this.storeCache(),l}clearCache(){this.inMemoryCache={},this.hasGatedEntries=!1;let e=this.usableStorage();e?e.removeItem(this.storageKey):this.isGated()&&(this.clearStoredOnReopen=!0)}identityEquals(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId}loadCache(){let e=this.usableStorage();if(e){let t=e.getItem(this.storageKey),r=t?JSON.parse(t):{};this.hasGatedEntries?(this.inMemoryCache=Object.assign(Object.assign({},r),this.inMemoryCache),this.hasGatedEntries=!1):this.inMemoryCache=r}}storeCache(){let e=this.usableStorage();if(e)try{e.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}}}class l2{constructor(e,t=512,r){this.persistenceAllowed=r,this.inMemoryQueue=[],this.holdsGatedEvents=!1,this.storageKey=`EXP_unsent_${e}`,this.maxQueueSize=t}push(e){this.loadQueue(),this.inMemoryQueue.push(e),this.canPersist()||(this.holdsGatedEvents=!0),this.flush(),this.storeQueue()}setTracker(e){this.tracker=e;let t=lj();t&&(this.poller=t(()=>{this.loadFlushStore()},1e3)),this.loadFlushStore()}flush(){if(!this.tracker||0===this.inMemoryQueue.length)return;let e=0;for(;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}if(this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller){let e=lq();e&&e(this.poller),this.poller=void 0}}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}usableStorage(){if(!this.canPersist())return;void 0===this.isLocalStorageAvailable&&(this.isLocalStorageAvailable=(()=>{let e=lN();if(e)try{let t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1})());let e=lH();return this.isLocalStorageAvailable&&e?e:void 0}loadQueue(){let e=this.usableStorage();if(e){let t=e.getItem(this.storageKey),r=t?JSON.parse(t):[];this.holdsGatedEvents?(this.inMemoryQueue=[...r,...this.inMemoryQueue],this.holdsGatedEvents=!1):this.inMemoryQueue=r}}storeQueue(){let e=this.usableStorage();if(e){if(0===this.inMemoryQueue.length)return void e.removeItem(this.storageKey);this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),e.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue))}}loadFlushStore(){this.loadQueue(),this.flush(),this.storeQueue()}}let l3=()=>{let e=lN();if(e)try{let t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1};class l4{constructor(e,t=eS.Error){this.logger=e,this.logLevel=t}error(e,...t){this.logLevel>=eS.Error&&this.logger.error(e,...t)}warn(e,...t){this.logLevel>=eS.Warn&&this.logger.warn(e,...t)}info(e,...t){this.logLevel>=eS.Info&&this.logger.info(e,...t)}debug(e,...t){this.logLevel>=eS.Debug&&this.logger.debug(e,...t)}verbose(e,...t){this.logLevel>=eS.Verbose&&this.logger.verbose(e,...t)}}class l5{error(e,...t){console.error(e,...t)}warn(e,...t){console.warn(e,...t)}info(e,...t){console.info(e,...t)}debug(e,...t){console.debug(e,...t)}verbose(e,...t){console.debug(e,...t)}}class l6{constructor(){this.globalScope=lN()}get(e){var t;return null==(t=this.globalScope)?void 0:t.localStorage.getItem(e)}put(e,t){var r;null==(r=this.globalScope)||r.localStorage.setItem(e,t)}delete(e){var t;null==(t=this.globalScope)||t.localStorage.removeItem(e)}}class l8{constructor(e,t){this.namespace=e,this.storage=t}get(){return this.value}put(e){this.value=e}load(){let e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))}store(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))}}class l7{constructor(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}get(e){return this.cache[e]}getAll(){return Object.assign({},this.cache)}put(e,t){this.cache[e]=t}putAll(e){for(let t of Object.keys(e))this.cache[t]=e[t]}remove(e){delete this.cache[e]}clear(){this.cache={}}load(){let e,t=this.storage.get(this.namespace);try{e=JSON.parse(t)||{}}catch(e){return}let r={};for(let t of Object.keys(e))try{let n;(n=this.transformer?this.transformer(e[t]):e[t])&&(r[t]=n)}catch(e){}this.clear(),this.putAll(r)}store(e=this.cache){this.storage.put(this.namespace,JSON.stringify(e))}}let l9=e=>{if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){let t=e.key,r=e.value,n=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);let s={};return t?s.key=t:r&&(s.key=r),r&&(s.value=r),i&&(s.metadata=i),n&&(s.payload=n),o&&(s.expKey=o),s}};class ue{constructor(){this.globalScope=lN()}get(e){var t;return null==(t=this.globalScope)?void 0:t.sessionStorage.getItem(e)}put(e,t){var r;null==(r=this.globalScope)||r.sessionStorage.setItem(e,t)}delete(e){var t;null==(t=this.globalScope)||t.sessionStorage.removeItem(e)}}let ut=e=>null==e,ur=e=>!!ut(e)||e&&0===Object.keys(e).length,un=e=>{var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"};class ui{constructor(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}start(e){return lY(this,void 0,void 0,function*(){if(this.started)throw Error("Backoff already started");this.started=!0,yield this.backoff(e,0,this.min)})}cancel(){let e;this.done=!0;let t=(null==(e=lN())?void 0:e.clearTimeout)?e.clearTimeout.bind(e):void 0;t&&t(this.timeoutHandle)}backoff(e,t,r){return lY(this,void 0,void 0,function*(){if(this.done)return;let n=lF();n&&(this.timeoutHandle=n(()=>{lY(this,void 0,void 0,function*(){try{yield e()}catch(i){let n=t+1;if(n<this.attempts){let t=Math.min(r*this.scalar,this.max);yield this.backoff(e,n,t)}}})},r))})}}let uo=e=>{var t,r;if(!e)return{};let n={user:e},i=lN();(null==i?void 0:i.location)&&(n.page={url:i.location.href});let o={};if(!e.groups)return n;for(let n of Object.keys(e.groups)){let i=e.groups[n];if(i.length>0&&i[0]){let s=i[0],a={group_name:s},l=null==(r=null==(t=e.group_properties)?void 0:t[n])?void 0:r[s];l&&Object.keys(l).length>0&&(a.group_properties=l),o[n]=a}}return Object.keys(o).length>0&&(n.groups=o),delete n.user.groups,delete n.user.group_properties,n},us=e=>null==e?{}:"string"==typeof e?{key:e,value:e}:e,ua=e=>{let t;if(!e)return{};e.metadata&&(t=e.metadata.experimentKey);let r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r};class ul{constructor(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}track(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))}setUserProperty(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)}unsetUserProperty(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))}}class uu{constructor(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}track(e,t){let r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||(this.tracked={}),this.identity=r;let n=e.flag_key in this.tracked,i=this.tracked[e.flag_key];n&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))}identityEquals(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId}}class uc{constructor(e,t){var r,n,i,o,s;let a;this.engine=new ll,this.isRunning=!1,this.apiKey=e,t=(e=>{if(!e||"object"!=typeof e)return{};let t={};for(let[r,n]of Object.entries(e))ut(n)||(t[r]=n);return t})(t),this.config=Object.assign(Object.assign(Object.assign({},lQ),t),{serverUrl:(null==t?void 0:t.serverUrl)||((null==(r=null==t?void 0:t.serverZone)?void 0:r.toLowerCase())==="eu"?"https://api.lab.eu.amplitude.com":lQ.serverUrl),flagsServerUrl:(null==t?void 0:t.flagsServerUrl)||((null==(n=null==t?void 0:t.serverZone)?void 0:n.toLowerCase())==="eu"?"https://flag.lab.eu.amplitude.com":lQ.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<6e4?6e4:null!=(i=t.flagConfigPollingIntervalMillis)?i:lQ.flagConfigPollingIntervalMillis}),this.logger=new l4(this.config.loggerProvider||new l5,uc.getLogLevel(t));const l=null==(o=this.config)?void 0:o.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new lB(()=>lY(this,void 0,void 0,function*(){try{yield this.doFlags()}catch(e){this.logger.info(e)}}),this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(const e in this.config.initialVariants)this.config.initialVariants[e]=l9(this.config.initialVariants[e]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new ul(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new uu(this.config.exposureTrackingProvider)),this.integrationManager=new l0(this.config,this);const u=new l$(this.config.httpClient||lX);this.flagApi=new lL(this.apiKey,this.config.flagsServerUrl,u),this.evaluationApi=new lD(this.apiKey,this.config.serverUrl,u);const c=l?`${this.config.instanceName}-${String(l)}`:this.config.instanceName;if(this.isWebExperiment){const e=null==(s=this.config)?void 0:s.internalCacheStorage;a=null!=e?e:new ue}else a=new l6;this.variants=((e,t,r)=>{let n=e.substring(e.length-6);return new l7(`amp-exp-${t}-${n}`,r,l9)})(this.apiKey,c,a),this.flags=((e,t,r=new l6)=>{let n=e.substring(e.length-6);return new l7(`amp-exp-${t}-${n}-flags`,r)})(this.apiKey,c,a),this.fetchVariantsOptions=((e,t,r=new l6)=>{let n=e.substring(e.length-6);return new l8(`amp-exp-${t}-${n}-variants-options`,r)})(this.apiKey,c,a);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}start(e){return lY(this,void 0,void 0,function*(){var t;if(!this.isRunning){this.isRunning=!0,this.setUser(e);try{let r=this.doFlags();null==(t=this.config.fetchOnStart)||t?yield Promise.all([this.fetch(e),r]):yield r}catch(e){if(this.config.throwOnError)throw e}this.config.pollOnStart&&this.poller.start()}})}stop(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)}fetch(){return lY(this,arguments,void 0,function*(e=this.user,t){this.setUser(e||{});try{yield this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)}catch(e){if(this.config.throwOnError)throw e;e instanceof lM?this.logger.debug(e):this.logger.error(e)}return this})}variant(e,t){var r,n;if(!this.apiKey)return{value:void 0};let i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug(`[Experiment] variant for ${e} is ${(null==(r=i.variant)?void 0:r.key)||(null==(n=i.variant)?void 0:n.value)}`),i.variant||{}}exposure(e){let t=this.variantAndSource(e);this.exposureInternal(e,t)}all(){if(!this.apiKey)return{};let e=this.evaluate();for(let t in e)un(this.flags.get(t))||delete e[t];return Object.assign(Object.assign(Object.assign({},this.secondaryVariants()),this.sourceVariants()),e)}clear(){this.variants.clear();try{this.variants.store()}catch(e){}}getUser(){var e;if(!this.user)return this.user;if(null==(e=this.user)||!e.user_properties)return Object.assign({},this.user);{let e=Object.assign({},this.user.user_properties);return Object.assign(Object.assign({},this.user),{user_properties:e})}}setUser(e){var t;if(!e){this.user=null;return}if(null==(t=this.user)?void 0:t.user_properties){let t=Object.assign({},e.user_properties);this.user=Object.assign(Object.assign({},e),{user_properties:t})}else this.user=Object.assign({},e)}getUserProvider(){return this.userProvider}setUserProvider(e){return this.userProvider=e,this}mergeInitialFlagsWithStorage(){this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEac
1h(e=>{this.flags.get(e.key)||this.flags.put(e.key,e)})}evaluate(e){let t=this.addContext(this.user),r=lu(this.flags.getAll(),e),n=uo(t),i=this.engine.evaluate(n,r),o={};for(let e of Object.keys(i))o[e]=ua(i[e]);return o}getEvaluationTraces(e){let t=this.addContext(this.user),r=lu(this.flags.getAll(),e),n=uo(t),{traces:i}=this.engine.evaluateWithTraces(n,r);return i}variantAndSource(e,t){let r={};this.config.source===eE.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===eE.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));let n=this.flags.get(e);return(un(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r}localEvaluationVariantAndSource(e,t,r){var n;let i={},o=this.evaluate([t.key])[e],s=ek.LocalEvaluation,a=null==(n=null==o?void 0:o.metadata)?void 0:n.default;if(!ut(o)&&!a)return{variant:us(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:us(o),source:s,hasDefaultVariant:!0}),!ut(r))return{variant:us(r),source:ek.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};let l=this.config.initialVariants[e];if(!ut(l))return{variant:us(l),source:ek.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};let u=us(this.config.fallbackVariant),c={variant:u,source:ek.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return ur(u)?i:c}localStorageVariantAndSource(e,t){var r;let n={},i=this.variants.get(e),o=null==(r=null==i?void 0:i.metadata)?void 0:r.default;if(!ut(i)&&!o)return{variant:us(i),source:ek.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:us(i),source:ek.LocalStorage,hasDefaultVariant:!0}),!ut(t))return{variant:us(t),source:ek.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};let s=this.config.initialVariants[e];if(!ut(s))return{variant:us(s),source:ek.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};let a=us(this.config.fallbackVariant),l={variant:a,source:ek.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ur(a)?n:l}initialVariantsVariantAndSource(e,t){var r;let n={},i=this.config.initialVariants[e];if(!ut(i))return{variant:us(i),source:ek.InitialVariants,hasDefaultVariant:!1};let o=this.variants.get(e),s=null==(r=null==o?void 0:o.metadata)?void 0:r.default;if(!ut(o)&&!s)return{variant:us(o),source:ek.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:us(o),source:ek.LocalStorage,hasDefaultVariant:!0}),!ut(t))return{variant:us(t),source:ek.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};let a=us(this.config.fallbackVariant),l={variant:a,source:ek.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ur(a)?n:l}fetchInternal(e,t,r,n){return lY(this,void 0,void 0,function*(){var i;if(!this.apiKey)throw Error("Experiment API key is empty");
1this.logger.debug(`[Experiment] Fetch all: retry=${String(r)}`),r&&this.stopRetries();try{let r=yield this.doFetch(e,t,Object.assign({trackingOption:null==(i=this.fetchVariantsOptions.get())?void 0:i.trackingOption},n));return yield this.storeVariants(r,n),r}catch(t){throw r&&this.shouldRetryFetch(t)&&this.startRetries(e,n),t}})}setTracksAssignment(e){return lY(this,void 0,void 0,function*(){this.fetchVariantsOptions.put(Object.assign(Object.assign({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store()})}cleanUserPropsForFetch(e){let t=Object.assign({},e);return delete t.cookie,t}doFetch(e,t,r){return lY(this,void 0,void 0,function*(){e=yield this.addContextOrWait(e),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e);let n=yield this.evaluationApi.getVariants(e,Object.assign({timeoutMillis:t},r)),i={};for(let e of Object.keys(n))i[e]=ua(n[e]);return this.logger.debug("[Experiment] Received variants: ",i),i})}doFlags(){return lY(this,void 0,void 0,function*(){try{let e;this.isWebExperiment&&(e=yield this.addContextOrWait(this.getUser()));let t=yield this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:lZ,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0});this.flags.clear(),this.flags.putAll(t)}catch(e){if(e instanceof lM){if(this.logger.debug(e),this.config.throwOnError)throw e}else throw e}try{this.flags.store()}catch(e){}this.mergeInitialFlagsWithStorage()})}storeVariants(e,t){return lY(this,void 0,void 0,function*(){let r=t&&t.flagKeys?t.flagKeys:[];for(let t in 0===r.length&&this.variants.clear(),e)r=r.filter(e=>e!==t),this.variants.put(t,e[t]);for(let e of r)this.variants.remove(e);try{this.variants.store()}catch(e){}this.logger.debug("[Experiment] Stored variants: ",e)})}startRetries(e,t){return lY(this,void 0,void 0,function*(){this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new ui(8,500,1e4,1.5),this.retriesBackoff.start(()=>lY(this,void 0,void 0,function*(){yield this.fetchInternal(e,1e4,!1,t)}))})}stopRetries(){this.retriesBackoff&&this.retriesBackoff.cancel()}addContext(e){var t;let r=null==(t=this.userProvider)?void 0:t.getUser(),n=this.integrationManager.getUser(),i=Object.assign(Object.assign(Object.assign({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return Object.assign(Object.assign(Object.assign(Object.assign({library:`experiment-js-client/${lZ}`},r),n),e),{user_properties:i})}addContextOrWait(e){return lY(this,void 0,void 0,function*(){return yield this.integrationManager.ready(),this.addContext(e)})}sourceVariants(){return this.config.source==eE.LocalStorage?this.variants.getAll():this.config.source==eE.InitialVariants?this.config.initialVariants:void 0}secondaryVariants(){return this.config.source==eE.LocalStorage?this.config.initialVariants:this.config.source==eE.InitialVariants?this.variants.getAll():void 0}exposureInternal(e,t){var r,n,i,o,s,a,l,u,c;if(!(null==(i=null==(n=null==(r=t.variant)?void 0:r.metadata)?void 0:n.trackExposure)||i))return;this.legacyExposureInternal(e,t.variant,t.source);let d={flag_key:e},f=lG(t.source);if(f&&!t.hasDefaultVariant)return;(null==(o=t.variant)?void 0:o.expKey)&&(d.experiment_key=null==(s=t.variant)?void 0:s.expKey);let h=null==(a=t.variant)?void 0:a.metadata;if(f||(null==h?void 0:h.default)||((null==(l=t.variant)?void 0:l.key)?d.variant=t.variant.key:(null==(u=t.variant)?void 0:u.value)&&(d.variant=t.variant.value)),h&&(d.metadata=h),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){let e=lN();if(null==e?void 0:e.location)try{let t=e.location.href;d.metadata.url=t.split("?")[0]||""}catch(e){}}let p=this.addContext(this.getUser());null==(c=this.userSessionExposureTracker)||c.track(d,p),this.integrationManager.track(d,p)}legacyExposureInternal(e,t,r){var n,i,o,s,a,l;if(this.analyticsProvider){let u,c,d=(l=this.addContext(this.getUser()),u=null==t?void 0:t.value,c=`[Experiment] ${e}
1`,{name:"[Experiment] Exposure",user:l,key:e,variant:t,userProperty:c,properties:{key:e,variant:u,source:r},userProperties:{[c]:u}});!lG(r)&&(null==t?void 0:t.value)?(null==t?void 0:t.value)&&(null==(s=null==(o=this.analyticsProvider)?void 0:o.setUserProperty)||s.call(o,d),null==(a=this.analyticsProvider)||a.track(d)):null==(i=null==(n=this.analyticsProvider)?void 0:n.unsetUserProperty)||i.call(n,d)}}static getLogLevel(e){var t;return!0===e.debug?eS.Debug:null!=(t=e.logLevel)?t:eS.Error}shouldRetryFetch(e){return!(e instanceof lR)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}addPlugin(e){"integration"===e.type&&this.integrationManager.setIntegration(e)}}class ud{constructor(e,t,r){var n,i,o;this.globalScope=lN(),this.userAgent=void 0!==(null==(n=this.globalScope)?void 0:n.navigator)?null==(i=this.globalScope)?void 0:i.navigator.userAgent:void 0,this.ua=new lz.UAParser(this.userAgent).getResult(),this.localStorage=new l6,this.sessionStorage=new ue,this.userProvider=e,this.apiKey=t,this.persistenceAllowed=r,this.storageKey=`EXP_${null==(o=this.apiKey)?void 0:o.slice(0,10)}_DEFAULT_USER_PROVIDER`}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}getUser(){var e,t,r,n,i;let o=(null==(e=this.userProvider)?void 0:e.getUser())||{};return Object.assign({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!=(r=null==(t=this.ua.device)?void 0:t.type)?r:"desktop",referring_url:null==(i=null==(n=this.globalScope)?void 0:n.document)?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)}getLanguage(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""}getOs(e){var t,r;return[null==(t=e.browser)?void 0:t.name,null==(r=e.browser)?void 0:r.major].filter(e=>null!=e).join(" ")}getDeviceModel(e){var t;return null==(t=e.os)?void 0:t.name}getBrowser(e){var t;let r=null==(t=e.browser)?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r}getCookie(){var e,t,r,n,i;if(this.canPersist()&&(null==(t=null==(e=this.globalScope)?void 0:e.document)?void 0:t.cookie))return Object.fromEntries(null==(i=null==(n=null==(r=this.globalScope)?void 0:r.document)?void 0:n.cookie)?void 0:i.split("; ").map(e=>e.split("=")))}getLandingUrl(){var e;if(!this.canPersist())return null!=this.gatedLandingUrl||(this.gatedLandingUrl=this.getCurrentUrl()),this.gatedLandingUrl;try{let t=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return t.landing_url||(t.landing_url=null!=(e=this.gatedLandingUrl)?e:this.getCurrentUrl(),this.sessionStorage.put(this.storageKey,JSON.stringify(t))),t.landing_url}catch(e){return}}getCurrentUrl(){var e,t;return null==(t=null==(e=this.globalScope)?void 0:e.location)?void 0:t.href.replace(/\/$/,"")}getFirstSeen(){if(!this.canPersist())return(Date.now()/1e3).toString();try{let e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}}getUrlParam(){var e;if(!this.globalScope)return;let t={};try{for(let[r,n]of new URL(this.globalScope.location.href).searchParams)t[r]=[...null!=(e=t[r])?e:[],...n.split(",")]}catch(e){return}return Object.entries(t).reduce((e,[t,r])=>(e[t]=1==r.length?r[0]:r,e),{})}}let uf=lN();uf&&(uf.experimentInstances={});let uh=null!=(eC=null==uf?void 0:uf.experimentInstances)?eC:{},up=e=>(null==e?void 0:e.instanceName)||lQ.instanceName;var ug=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var r;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(t){var n,i;return this.experiment=((e,t,r)=>{let n,i,o=(n=up(t),(i=null==t?void 0:t.internalInstanceNameSuffix)?`${n}.${e}.${String(i)}`:`${n}.${e}`),s=uh[o];return s?s:(s=new uc(e,Object.assign(Object.assign({},t),{userProvider:new ud(null==t?void 0:t.userProvider,e,null==t?void 0:t.internalPersistenceAllowed)})),r&&s.addPlugin(r()),uh[o]=s,s)})(n=(null==(r=this.config)?void 0:r.deploymentKey)||e.apiKey,i=this.config,()=>new lV(n,e3.getInstance(up(i)),1e4)),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),uv=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:um(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),um=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},uy=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}(),ub=function(){return(ub=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function uw(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
1if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function uS(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}var uE=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=uw(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),l=Array.isArray(t);if(a!==l)return!1;if(a&&l){for(var u=0;u<e.length;u++)if(!uE(e[u],t[u]))return!1}else{if(!uE(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(r){uE(e[r],t[r])||(c=!1)}),c}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var uk=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ub({},this.identity.userProperties),r=ub(ub({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,l=r.userProperties||{};try{for(var u=uw(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=uS(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,uw(Object.entries(h))),g=p.next();!g.done;g=p.next()){var v=uS(g.value,2),m=v[0],y=v[1];l[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,uw(Object.keys(h))),w=b.next();!w.done;w=b.next()){var m=w.value;delete l[m]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return r.userProperties=l,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return ub({},this.identity)},e.prototype.setIdentity=function(e){var t=ub({},this.identity);this.identity=ub({},e),uE(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}(),uC="u">typeof globalThis?globalThis:"u">typeof window?window:self,uI=function(){function e(){this.identityStore=new uk,this.eventBridge=new uy,this.applicationContextProvider=new uv}return e.getInstance=function(t){return uC.analyticsConnectorInstances||(uC.analyticsConnectorInstances={}),uC.analyticsConnectorInstances[t]||(uC.analyticsConnectorInstances[t]=new e),uC.analyticsConnectorInstances[t]},e}(),ux=["boot"],uT=Symbol.for("amplitude-engagement-plugin-caller"),uP=((s=uP||{}).Local="https://local.amplitude.com:3010/",s.Staging="https://apps.stag2.amplitude.com/",s.Production="https://app.amplitude.com/",s.ProductionEU="https://app.eu.amplitude.com/",s),u_=((e=>{if("u">typeof window&&window.opener)for(let t of Object.values(uP))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),U=(e,t,r,n)=>(function(e,t,r,n){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",r&&e.setAttribute("nonce",r),t&&e.setAttribute("type",t),n&&(e.onerror=n);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}})([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,r,n),a="u">typeof window?window.engagement:void 0,l=!1,new Proxy(u={_q:null!=(F=null==a?void 0:a._q)?F:[],_configuration:{apiKey:null!=(q=null==(j=null==a?void 0:a._configuration)?void 0:j.apiKey)?q:"",serverUrl:null==(B=null==a?void 0:a._configuration)?void 0:B.serverUrl,chatUrl:null==(z=null==a?void 0:a._configuration)?void 0:z.chatUrl,mediaUrl:null==(Y=null==a?void 0:a._configuration)?void 0:Y.mediaUrl,serverZone:null!=(W=null==(J=null==a?void 0:a._configuration)?void 0:J.serverZone)?W:"US",autoRefreshIntervalSeconds:null==(V=null==a?void 0:a._configuration)?void 0:V.autoRefreshIntervalSeconds,integrations:null==(K=null==a?void 0:a._configuration)?void 0:K.integrations,options:{...null==($=null==a?void 0:a._configuration)?void 0:$.options}},init(e,t){var r,n,i,o;let s;if(u._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if((null==t?void 0:t.skip)===!0){console.log("Engagement SDK init skipped via `skip: true`. The SDK bundle will not be loaded."),l=!0;return}if(l&&(u._q.length=0),l=!1,null!=t&&t.useEngagementDomain){let e=(null!=(r=t.serverZone)?r:u._configuration.serverZone)==="EU",n="amplitudeengagement.com";t.serverUrl||(t.serverUrl=e?`https://gs.eu.${n}`:`https://gs.${n}`),t.chatUrl||(t.chatUrl=e?`https://houston-chat.eu.${n}`:`https://houston-chat.${n}`),t.mediaUrl||(t.mediaUrl=e?`https://engagement-static.eu.${n}`:`https://engagement-static.${n}`),t.cdnUrl||(t.cdnUrl=e?`https://cdn.eu.${n}`:`https://cdn.${n}`)}if(u._configuration={...u._configuration,...t,apiKey:e,options:{splitting:!0,...u._configuration.options,...null==t?void 0:t.options}},null!=(i=null==(n=u._configuration)?void 0:n.options)&&i.logger&&u._configuration.options.logger.enable(null!=(o=u._configuration.options.logLevel)?o:2),null!=t&&t.cdnUrl)s=u._configuration.options.splitting?`${t.cdnUrl}/engagement-browser/prod/split/index.js`:t.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===u._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";s=u._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let a=null,c=()=>
1{if(l=!0,a&&(clearTimeout(a),a=null),u._q&&u._q.length>0)for(console.warn(`Engagement SDK failed to load within ${d}ms. Resolving pending calls gracefully.`);u._q.length>0;){let e=u._q.shift();if(!e)continue;let t=e[0],r=ux.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${r}); attempting to resolve as no-op.`),r&&e[1]instanceof Function&&e[2]instanceof Function){let r=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),r(void 0)}}};U(s,u._configuration.options.splitting?"module":void 0,null==t?void 0:t.nonce,c);let d=1e4;a=setTimeout(()=>{c()},1e4)},plugin(e){let t=u.init,r=null==e?void 0:e.token,n=(null==e?void 0:e.skip)===!0,i=(e,t,n)=>{let i=n.getIdentity(),o="function"==typeof r?r():r;return{user_id:e.getUserId(),device_id:e.getDeviceId(),version:t.appVersion,user_properties:i.userProperties,getSessionId:e.getSessionId,...o?{token:o}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(r,o){var s;if(n)return void t(r.apiKey,{skip:!0});let a=null!=(s=r.instanceName)?s:"$default_instance",l=uI.getInstance(a).identityStore;u._configuration._installedViaPlugin=!0,t(r.apiKey,{serverZone:r.serverZone,...e,options:{logLevel:r.logLevel,logger:r.loggerProvider,...null==e?void 0:e.options}});let c=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,r,l),integrations:c},uT),l.addIdentityListener(e=>{var t,n,s,a;null!=(t=window.engagement)&&t._.user&&null!=(n=window.engagement)&&n._analytics.hasBooted?(null==(a=null==(s=window.engagement)?void 0:s._.user)?void 0:a.user_id)!==e.userId?(window.engagement.shutdown(uT),window.engagement.boot({user:()=>i(o,r,l),integrations:c},uT)):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(n||window.engagement.forwardEvent(e),e)}}},{get:function(e,t){return t in u?u[t]:"then"!==t?"gs"===t||"rc"===t||"assistant"===t?new Proxy({},{get:function(e,r){return function(){let e=Array.from(arguments),n=`${t}.${r}`;e.unshift(n),u._q.push(e)}}}):ux.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((r,n)=>{e.unshift(t,r,n),u._q.push(e),l&&r(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),u._q.push(e)}:void 0}}));let uO={_setDiagnosticsSampleRate:tc((X=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,eI.C6)(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(ug);return 0===e.length?void this.config.loggerProvider.debug("".concat(ug.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(ug.pluginName," are found."))}},t.prototype.initAll=function(t,r){return(0,eI.sH)(this,void 0,void 0,function(){var n=this;return(0,eI.YH)(this,function(i){return this._initAllPromise||(this._initAllPromise=(0,eI.sH)(n,void 0,void 0,function(){var n,i;return(0,eI.YH)(this,function(o){switch(o.label){case 0:return n={serverZone:null==r?void 0:r.serverZone,instanceName:null==r?void 0:r.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return(0,eI.sH)(this,void 0,void 0,function(){return(0,eI.YH)(this,function(r){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.32","-").concat(null!=(t=e.library)?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,(0,eI.Cl)((0,eI.Cl)({},null==r?void 0:r.analytics),n)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,new aV((0,eI.Cl)((0,eI.Cl)({},null==r?void 0:r.sessionReplay),n))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,new ug((0,eI.Cl)((0,eI.Cl)({},null==r?void 0:r.experiment),n))).promise];case 3:let s;return o.sent(),void 0===(i=this.plugin(aV.pluginName))?this.config.loggerProvider.debug("".concat(aV.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,(s=(0,eI.Cl)((0,eI.Cl)({},null==r?void 0:r.engagement),n),"u">typeof window&&!window.engagement&&(window.engagement=u_),u_.plugin(s))).promise];case 4:return o.sent(),[2]}})}).finally(function(){n._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,r,n){return void 0===t&&(t=""),e.prototype.init.call(this,t,r,n)},t}(o5)))._setDiagnosticsSampleRate.bind(X),"_setDiagnosticsSampleRate",ta(X),tu(X,["config"])),experiment:tc(X.experiment.bind(X),"experiment",ta(X),tu(X,["config"])),sessionReplay:tc(X.sessionReplay.bind(X),"sessionReplay",ta(X),tu(X,["config"])),initAll:tc(X.initAll.bind(X),"initAll",ta(X),tu(X,["config"])),init:tc(X.init.bind(X),"init",ta(X),tu(X,["config"])),add:tc(X.add.bind(X),"add",ta(X),tu(X,["config.apiKey","timeline.plugins"])),remove:tc(X.remove.bind(X),"remove",ta(X),tu(X,["config.apiKey","timeline.plugins"])),track:tc(X.track.bind(X),"track",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),logEvent:tc(X.logEvent.bind(X),"logEvent",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),identify:tc(X.identify.bind(X),"identify",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),groupIdentify:tc(X.groupIdentify.bind(X),"groupIdentify",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),setGroup:tc(X.setGroup.bind(X),"setGroup",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),revenue:tc(X.revenue.bind(X),"revenue",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),flush:tc(X.flush.bind(X),"flush",ta(X),tu(X,["config.apiKey","timeline.queue.length"])),getUserId:tc(X.getUserId.bind(X),"getUserId",ta(X),tu(X,["config","config.userId"])),setUserId:tc(X.setUserId.bind(X),"setUserId",ta(X),tu(X,["config","config.userId"])),getDeviceId:tc(X.getDeviceId.bind(X),"getDeviceId",ta(X),tu(X,["config","config.deviceId"])),setDeviceId:tc(X.setDeviceId.bind(X),"setDeviceId",ta(X),tu(X,["config","config.deviceId"])),reset:tc(X.reset.bind(X),"reset",ta(X),tu(X,["config","config.userId","config.deviceId"])),getSessionId:tc(X.getSessionId.bind(X),"getSessionId",ta(X),tu(X,["config"])),setSessionId:tc(X.setSessionId.bind(X),"setSessionId",ta(X),tu(X,["config"])),extendSession:tc(X.extendSession.bind(X),"extendSession",ta(X),tu(X,["config"])),setOptOut:tc(X.setOptOut.bind(X),"setOptOut",ta(X),tu(X,["config"])),getOptOut:tc(X.getOptOut.bind(X),"getOptOut",ta(X),tu(X,["config"])),setTransport:tc(X.setTransport.bind(X),"setTransport",ta(X),tu(X,["config"])),getIdentity:tc(X.getIdentity.bind(X),"getIdentity",ta(X),tu(X,["config"])),setIdentity:tc(X.setIdentity.bind(X),"setIdentity",ta(X),tu(X,["config","config.userId","config.deviceId"]))};uO._setDiagnosticsSampleRate;var uA=uO.initAll,uR=uO.experiment,uM=(uO.sessionReplay,uO.add,uO.extendSession,uO.flush,uO.getDeviceId),uD=(uO.getIdentity,uO.getOptOut,uO.getSessionId),uL=(uO.getUserId,uO.groupIdentify,uO.identify),uN=(uO.logEvent,uO.remove,uO.reset,uO.revenue,uO.setDeviceId,uO.setGroup,uO.setIdentity,uO.setOptOut,uO.setSessionId,uO.setTransport,uO.setUserId),uH=uO.track},24155:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,l=(1<<a)-1,u=l>>1,c=-7,d=r?i-1:0,f=r?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=a;c>0;o=256*o+e[t+d],d+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+e[t+d],d+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=u}return(h?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,f=5960464477539062e-23*(23===i),h=n?0:o-1,p=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?t+=f/l:t+=f*Math.pow(2,1-d),t*l>=2&&(s++,l/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*l-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+h]=255&s,h+=p,s/=256,u-=8);e[r+h-p]|=128*g}},25501:(e,t,r)=>{"use strict";r.d(t,{E:()=>o,a:()=>i});var n=r(32978),i=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!o(t,r))return!1}return!0},o=function(e,t){var r,o;
1if("string"!=typeof e)return!1;if(Array.isArray(t)){var s=!0;try{for(var a=(0,n.Ju)(t),l=a.next();!l.done;l=a.next()){var u=l.value;if(Array.isArray(u))return!1;if("object"==typeof u)s=s&&i(u);else if(!["number","string"].includes(typeof u))return!1;if(!s)return!1}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}else if(null==t)return!1;else if("object"==typeof t)return i(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0}},27360:function(e,t,r){var n;!function(i){"use strict";var o="function",s="undefined",a="object",l="string",u="model",c="name",d="type",f="vendor",h="version",p="architecture",g="console",v="mobile",m="tablet",y="smarttv",b="wearable",w="embedded",S="Amazon",E="Apple",k="ASUS",C="BlackBerry",I="Browser",x="Chrome",T="Firefox",P="Google",_="Huawei",O="Microsoft",A="Motorola",R="Opera",M="Samsung",D="Sharp",L="Sony",N="Xiaomi",H="Zebra",U="Facebook",F=function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},j=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},q=function(e,t){return typeof e===l&&-1!==B(t).indexOf(B(e))},B=function(e){return e.toLowerCase()},z=function(e,t){if(typeof e===l)return e=e.replace(/^\s\s*/,""),typeof t===s?e:e.substring(0,350)},Y=function(e,t){for(var r,n,i,s,l,u,c=0;c<t.length&&!l;){var d=t[c],f=t[c+1];for(r=n=0;r<d.length&&!l;)if(l=d[r++].exec(e))for(i=0;i<f.length;i++)u=l[++n],typeof(s=f[i])===a&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=u?u.replace(s[1],s[2]):void 0:this[s[0]]=u?s[1].call(this,u,s[2]):void 0:4===s.length&&(this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):void 0):this[s]=u||void 0;c+=2}},J=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(q(t[r][n],e))return"?"===r?void 0:r}else if(q(t[r],e))return"?"===r?void 0:r;return e},W={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},V={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,h],[/opios[\/ ]+([\w\.]+)/i],[h,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[c,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[c,"UC"+I]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+I],h],[/\bfocus\/([\w\.]+)/i],[h,[c,T+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[c,"MIUI "+I]],[/fxios\/([-\w\.]+)/i],[h,[c,T]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+I]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+I],h],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,U],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[c,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[c,x+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,x+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[c,"Android "+I]],[/(chrome|omniweb|arora|[t
vendor: 4,850 bytes, line 1
1izenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[h,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[c,T+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[c,h],[/(cobalt)\/([\w\.]+)/i],[c,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,B]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,B]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[f,M],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[f,M],[d,v]],[/((ipod|iphone)\d+,\d+)/i],[u,[f,E],[d,v]],[/(ipad\d+,\d+)/i],[u,[f,E],[d,m]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[f,E],[d,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[f,E],[d,m]],[/(macintosh);/i],[u,[f,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[f,_],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[f,_],[d,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[f,N],[d,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[f,N],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[f,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[f,"Vivo"],[d,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[f,"Realme"],[d,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[f,A],[d,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[f,A],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[f,"LG"],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[f,"LG"],[d,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[f,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[f,"Nokia"],[d,v]],[/(pixel c)\b/i],[u,[f,P],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[f,P],[d,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[f,L],[d,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[f,L],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[f,"OnePlus"],[d,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[f,S],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[f,S],[d,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,f,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[f,C],[d,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[f,k],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[f,k],[d,v]],[/(nexus 9)/i],[u,[f,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[u,/_/g," "],[d,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[f,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[f,"Meizu"],[d,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[f,D],[d,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 6,557 bytes, line 1
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,u,[d,v]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,u,[d,m]],[/(surface duo)/i],[u,[f,O],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[f,"Fairphone"],[d,v]],[/(u304aa)/i],[u,[f,"AT&T"],[d,v]],[/\bsie-(\w*)/i],[u,[f,"Siemens"],[d,v]],[/\b(rct\w+) b/i],[u,[f,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[f,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[f,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[f,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[u,[f,"NuVision"],[d,m]],[/\b(k88) b/i],[u,[f,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[u,[f,"ZTE"],[d,v]],[/\b(gen\d{3}) b.+49h/i],[u,[f,"Swiss"],[d,v]],[/\b(zur\d{3}) b/i],[u,[f,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[u,[f,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],u,[d,m]],[/\b(ns-?\w{0,9}) b/i],[u,[f,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[f,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],u,[d,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],u,[d,v]],[/\b(ph-1) /i],[u,[f,"Essential"],[d,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[f,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[u,[f,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[u,[f,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[u,[f,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[f,u,[d,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[f,O],[d,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[f,H],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[f,H],[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,u,[d,g]],[/droid.+; (shield) bui/i],[u,[f,"Nvidia"],[d,g]],[/(playstation [345portablevi]+)/i],[u,[f,L],[d,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[f,O],[d,g]],[/smart-tv.+(samsung)/i],[f,[d,y]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[f,M],[d,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,"LG"],[d,y]],[/(apple) ?tv/i],[f,[u,E+" TV"],[d,y]],[/crkey/i],[[u,x+"cast"],[f,P],[d,y]],[/droid.+aft(\w)( bui|\))/i],[u,[f,S],[d,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[f,D],[d,y]],[/(bravia[\w ]+)( bui|\))/i],[u,[f,L],[d,y]],[/(mitv-\w{5}) bui/i],[u,[f,N],[d,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,z],[u,z],[d,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,y]],[/((pebble))app/i],[f,u,[d,b]],[/droid.+; (glass) \d/i],[u,[f,P],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[u,[f,H],[d,b]],[/(quest( 2)?)/i],[u,[f,U],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[c,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[h,J,W]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[h,J,W]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,h],[/\(bb(10);/i],[h,[c,C]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[c,T+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[c,x+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[c,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,h],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[c,h]]},K=function(e,t){if(typeof e===a&&(t=e,e=void 0),!(this instanceof K))return new K(e,t).getResult();var r=e||(typeof i!==s&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),n=t?F(V,t):V;return this.getBrowser=function(){var e,t={};return t[c]=void 0,t[h]=void 0,Y.call(t,r,n.browser),t.major=typeof(e=t.version)===l?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,t},this.getCPU=function(){var e={};return e[p]=void 0,Y.call(e,r,n.cpu),e},this.getDevice=function(){var e={};return e[f]=void 0,e[u]=void 0,e[d]=void 0,Y.call(e,r,n.device),e},this.getEngine=function(){var e={};return e[c]=void 0,e[h]=void 0,Y.call(e,r,n.engine),e},this.getOS=function(){var e={};return e[c]=void 0,e[h]=void 0,Y.call(e,r,n.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===l&&e.length>350?z(e,350):e,this},this.setUA(r),this};K.VERSION="0.7.33",K.BROWSER=j([c,h,"major"]),K.CPU=j([p]),K.DEVICE=j([u,f,d,g,v,y,m,b,w]),K.ENGINE=K.OS=j([c,h]),typeof t!==s?(e.exp
1orts&&(t=e.exports=K),t.UAParser=K):r.amdO?void 0===(n=(function(){return K}).call(t,r,t,e))||(e.exports=n):typeof i!==s&&(i.UAParser=K);var $=typeof i!==s&&(i.jQuery||i.Zepto);if($&&!$.ua){var X=new K;$.ua=X.getResult(),$.ua.get=function(){return X.getUA()},$.ua.set=function(e){X.setUA(e);var t=X.getResult();for(var r in t)$.ua[r]=t[r]}}}("object"==typeof window?window:this)},32978:(e,t,r)=>{"use strict";r.d(t,{C6:()=>i,Cl:()=>o,Ju:()=>u,Tt:()=>s,YH:()=>l,fX:()=>d,sH:()=>a,zs:()=>c});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}function l(e,t){var r,n,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=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=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++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).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],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function d(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError},56642:(e,t,r)=>{"use strict";r.d(t,{Cs:()=>h,Ct:()=>E,F3:()=>P,Gp:()=>x,Jn:()=>p,KY:()=>S,L:()=>O,OP:()=>c,SO:()=>T,VU:()=>g,Wx:()=>v,_9:()=>d,bu:()=>l,e5:()=>s,fL:()=>f,fS:()=>o,h2:()=>m,j7:()=>_,lT:()=>y,mG:()=>n,mJ:()=>a,pL:()=>u,q2:()=>w,qr:()=>k,r:()=>i,tt:()=>I,wX:()=>b,wu:()=>C});var n="-",i="AMP",o="".concat(i,"_unsent"),s="$default_instance",a="https://api2.amplitude.com/2/httpapi",l="https://api.eu.amplitude.com/2/httpapi",u="https://api2.amplitude.com/batch",c="https://api.eu.amplitude.com/batch",d="utm_campaign",f="utm_content",h="utm_id",p="utm_medium",g="utm_source",v="utm_term",m="dclid",y="fbclid",b="gbraid",w="gclid",S="ko_click_id",E="li_fat_id",k="msclkid",C="rdt_cid",I="ttclid",x="twclid",T="wbraid",P={utm_campaign:void 0,utm_c
1ontent: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,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},_=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],O=["authorization","cookie","set-cookie"]},60979:(e,t,r)=>{"use strict";let n,i,o,s;r.d(t,{P2:()=>p});let a=(e,t)=>t.some(t=>e instanceof t),l=new WeakMap,u=new WeakMap,c=new WeakMap,d={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return l.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return f(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function f(e){if(e instanceof IDBRequest){let t;return t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(f(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",o)}),c.set(t,e),t}if(u.has(e))return u.get(e);let t=function(e){if("function"==typeof e)return(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(h(this),t),f(this.request)}:function(...t){return f(e.apply(h(this),t))};return(e instanceof IDBTransaction&&function(e){if(l.has(e))return;let t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),n()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});l.set(e,t)}(e),a(e,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,d):e}(e);return t!==e&&(u.set(e,t),c.set(t,e)),t}let h=e=>c.get(e);function p(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){let s=indexedDB.open(e,t),a=f(s);return n&&s.addEventListener("upgradeneeded",e=>{n(f(s.result),e.oldVersion,e.newVersion,f(s.transaction),e)}),r&&s.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}let g=["get","getKey","getAll","getAllKeys","count"],v=["put","add","delete","clear"],m=new Map;function y(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(m.get(t))return m.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,i=v.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||g.includes(r)))return;let o=async function(e,...t){let o=this.transaction(e,i?"readwrite":"readonly"),s=o.store;return n&&(s=s.index(t.shift())),(await Promise.all([s[r](...t),i&&o.done]))[0]};return m.set(t,o),o}d={...o=d,get:(e,t,r)=>y(e,t)||o.get(e,t,r),has:(e,t)=>!!y(e,t)||o.has(e,t)};let b=["continue","continuePrimaryKey","advance"],w={},S=new WeakMap,E=new WeakMap,k={get(e,t){if(!b.includes(t))return e[t];let r=w[t];return r||(r=w[t]=function(...e){S.set(this,E.get(this)[t](...e))}),r}};async function*C(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let r=new Proxy(t,k);for(E.set(r,t),c.set(r,h(t));t;)yield r,t=await (S.get(r)||t.continue()),S.delete(r)}function I(e,t){return t===Symbol.asyncIterator&&a(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&a(e,[IDBIndex,IDBObjectStore])}d={...s=d,get:(e,t,r)=>I(e,t)?C:s.get(e,t,r),has:(e,t)=>I(e,t)||s.has(e,t)}},64869:e=>{var t=Object.prototype.hasOwnProperty;function r(e){return"[Throws: "+(e?e.message:"?")+"]"}function n(e){var n=[];return function e(i){if(null===i||"object"!=typeof i)return i;if(-1!==n.indexOf(i))return"[Circular]";if(n.push(i),"function"==typeof i.toJSON)try{var o=e(i.toJSON());return n.pop(),o}catch(e){return r(e)}if(Array.isArray(i)){var s=i.map(e);return n.pop(),s}var a=Object.keys(i).reduce(function(n,o){return n[o]=e(function(e,n){if(t.call(e,n))try{return e[n]}catch(e){return r(e)}return e[n]}(i,o)),n},{});return n.pop(),a}(e)}e.exports=function(e,t,r){return JSON.stringify(n(e),t,r)},e.exports.ensureProperties=n},70410:(e,t)=>{"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=l(e),s=o[0],a=o[1],u=new i((s+a)*3/4-a),c=0,d=a>0?s-4:s;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(function(e,t,n){for(var i,o=[],s=t;s<n;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,s,s+16383>a?a:s+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},77447:(e,t)=>{"use strict";t.Observable=void 0;let r=e=>!!Symbol[e],n=e=>r(e)?Symbol[e]:"@@"+e,i=n("iterator"),o=n("observable"),s=n("species");function a(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw TypeError(r+" is not a function");return r}}function l(e){let t=e.constructor;return void 0!==t&&null===(t=t[s])&&(t=void 0),void 0!==t?t:v}function u(e){u.log?u.log(e):setTimeout(()=>{throw e})}function c(e){Promise.resolve().then(()=>{try{e()}catch(e){u(e)}})}function d(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=a(t,"unsubscribe");e&&e.call(t)}}catch(e){u(e)}}function f(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function h(e,t,r){e._state="running";let n=e._observer;try{let i=a(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(f(e),i)i.call(n,r);else throw r;break;case"complete":f(e),i&&i.call(n)}}catch(e){u(e)}"closed"===e._state?d(e):"running"===e._state&&(e._state="ready")}function p(e,t,r){if("closed"!==e._state){if("buffering"===e._state)return void e._queue.push({type:t,value:r});if("ready"!==e._state){e._state="buffering",e._queue=[{type:t,value:r}],c(()=>(function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(h(e,t[r].type,t[r].value),"closed"!==e._state);++r);}})(e));return}h(e,t,r)}}class g{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){p(r,"next",e)},error(e){p(r,"error",e)},complete(){p(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(f(this),d(this))}}class v{constructor(e){if(!(this instanceof v))throw TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new g(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(TypeError(e+" is not a function"));function n(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(l(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(l(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=l(this),r=arguments.length>1,n=!1,i=arguments[1],o=i;return new t(t=>this.subscribe({next(i){let s=!n;if(n=!0,!s||r)try{o=e(o,i)}catch(e){return t.error(e)}else o=i},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=l(this);return new t(r=>{let n,i=0;return!function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}})}flatMap(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=l(this);return new t(r=>{let n=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return r.error(e)}let s=t.from(i).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(s);e>=0&&n.splice(e,1),o()}});n.push(s)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>
1{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[o](){return this}static from(e){let t="function"==typeof this?this:v;if(null==e)throw TypeError(e+" is not an object");let n=a(e,o);if(n){let r=n.call(e);if(Object(r)!==r)throw TypeError(r+" is not an object");return r instanceof v&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(r("iterator")&&(n=a(e,i)))return new t(t=>{c(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{c(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:v)(t=>{c(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[s](){return this}}t.Observable=v,Object.defineProperty(v,Symbol("extensions"),{value:{symbol:o,hostReportError:u},configurable:!0})},78922:(e,t,r)=>{"use strict";r.d(t,{D7:()=>i});var n=r(32978);function i(e,t,r){e&&function e(t){var r,i,o=t.json,a=t.targetObject,l=t.allowlist,u=t.excludelist,c=t.ancestors,d=t.parentObject,f=t.targetKey;a||(a=o);var h=Object.keys(a);try{for(var p=(0,n.Ju)(h),g=p.next();!g.done;g=p.next()){var v,m=g.value,y=(0,n.fX)((0,n.fX)([],(0,n.zs)(c),!1),[m],!1);(v=a[m],"string"==typeof v||"number"==typeof v||"boolean"==typeof v||null==v)?(!s(y,l)||s(y,u))&&delete a[m]:e({json:o,targetObject:a[m],allowlist:l,excludelist:u,ancestors:y,parentObject:a,targetKey:m})}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}0===Object.keys(a).length&&d&&f&&delete d[f]}({json:e,allowlist:t.map(o),excludelist:r.map(o),ancestors:[]})}function o(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function s(e,t){return t.some(function(t){return function e(t,r,n,i){if(void 0===n&&(n=0),void 0===i&&(i=0),i===r.length)return n===t.length;if(n===t.length){for(;i<r.length&&"**"===r[i];)i++;return i===r.length}var o=r[i];if("**"===o){if(i+1===r.length)return!0;for(var s=n;s<=t.length;s++)if(e(t,r,s,i+1))return!0;return!1}return("*"===o||o===t[n])&&e(t,r,n+1,i+1)}(e,t)})}},86141:(e,t,r)=>{"use strict";var n=r(70410),i=r(24155),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|p(n,i),l=s(o),u=l.write(n,i);return u!==o&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e)){var c=e;if(_(c,Uint8Array)){var g=new Uint8Array(c);return f(g.buffer,g.byteOffset,g.byteLength)}return d(c)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(_(e,ArrayBuffer)||e&&_(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(_(e,SharedArrayBuffer)||e&&_(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var v=e.valueOf&&e.valueOf();if(null!=v&&v!==e)return a.from(v,t,r);var m=function(e){if(a.isBuffer(e)){var t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(m)return m;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');
vendor: 17,085 bytes, line 1
1if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),s(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||_(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return x(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(i)return n?-1:x(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var i,o,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=O[e[o]];return i}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,o=t,s=r,0===o&&s===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function v(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){var o;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*s}else -1!==c&&(o-=o-c),c=-1}else for(r+l>a&&(r=a-l),o=r;o>=0;o--){for(var d=!0,f=0;f<l;f++)if(u(e,o+f)!==u(t,f)){d=!1;break}if(d)return o}return -1}function b(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(o=e[i+1]))==128&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],(192&o)==128&&(192&s)==128&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}var f=n,h=f.length;if(h<=4096)return String.fromCharCode.apply(String,f);for(var p="",g=0;g<h;)p+=String.fromCharCode.apply(String,f.slice(g,g+=4096));return p}function w(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function S(e,t,r,n,i,o){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function E(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,o){return t*=1,r>>>=0,o||E(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,o){return t*=1,r>>>=0,o||E(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.hp=a,t.IS=50,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(u(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(_(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),_(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(_(o,Uint8Array))i+o.length>n.length?a.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(a.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)v(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(_(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,l=Math.min(o,s),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){o=u[d],s=c[d];break}return o<s?-1:+(s<o)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,s,a,l,u,c,d,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var h=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a,l=parseInt(t.substr(2*s,2),16);if((a=l)!=a)break;e[r+s]=l}return s}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,P(x(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return s=t,a=r,P(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,s,a);case"base64":return l=t,u=r,P(T(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,P(function(e,t){for(var r,n,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(h)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),h=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;S(this,e,t,r,i,0)}var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;S(this,e,t,r,i,0)}var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);S(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||S(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),l=s.length;
1if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%l]}return this};var I=/[^+/0-9A-Za-z-_]/g;function x(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319||s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function T(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function P(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function _(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var O=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},87158:(e,t,r)=>{e.exports=r(77447).Observable},97345:(e,t,r)=>{"use strict";r.d(t,{m:()=>n});var n=function(){var e="ampIntegrationContext";return"u">typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:void 0!==r.g?r.g:void 0}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.