PageSourceSearch

https://www.kensingtontours.com/_next/static/chunks/5722-a452085bd2ec6fb5.js

js kensingtontours.com collected 2026-10-02 05:49:55 UTC 408,811 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5722],{63:(e,t,r)=>{"use strict";var n=r(7260);r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},431:(e,t,r)=>{"use strict";let n;r.d(t,{Q:()=>n5});var i,o,s,a,u,l,c,d,f,h,p,g,v=r(1450);!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(i||(i={}));var m=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},y=function(e){return function(){var t=(0,v.Cl)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},b=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,v.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},w=function(e,t){return function(){var r,n,i={};try{for(var o=(0,v.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=b(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}},S=function(e,t,r,n,o){return void 0===o&&(o=null),function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];var u=r(),l=u.logger,c=u.logLevel;if(c&&c<i.Debug||!c||!l)return e.apply(o,s);var d={type:"invoke public method",name:t,args:s,stacktrace:m(1),time:{start:new Date().toISOString()},states:{}};n&&d.states&&(d.states.before=n());var f=e.apply(o,s);return f&&f.promise?f.promise.then(function(){n&&d.states&&(d.states.after=n()),d.time&&(d.time.end=new Date().toISOString()),l.debug(JSON.stringify(d,null,2))}):(n&&d.states&&(d.states.after=n()),d.time&&(d.time.end=new Date().toISOString()),l.debug(JSON.stringify(d,null,2))),f}},E=function(e){return{promise:e||Promise.resolve()}},I="Amplitude Logger ",_=function(){function e(){this.logLevel=i.None}return e.prototype.disable=function(){this.logLevel=i.None},e.prototype.enable=function(e){void 0===e&&(e=i.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<i.Verbose||console.log("".concat(I,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<i.Warn||console.warn("".concat(I,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<i.Error||console.error("".concat(I,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<i.Debug||console.log("".concat(I,"[Debug]: ").concat(e.join(" ")))},e}(),k=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}(),T=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==r.g?r.g:void 0},C=(0,v.fX)([],(0,v.zs)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),x=function(e){var t,r=T();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,x);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,(0,v.fX)([],(0,v.zs)(n.entries()),!1).map(function(e){var t=(0,v.zs)(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(C[n]):C[n]}).join("")},P=function(){function e(e,t,r,n){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,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 k(e,t)}return e.prototype.subscribe=function(e,t,r){var n=x(),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,v.sH)(this,void 0,void 0,function(){var e,t=this;return(0,v.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.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,v.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,v.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,v.sH)(this,void 0,void 0,function(){var r,n;return(0,v.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,v.sH)(this,void 0,void 0,function(){var r,n,i,o,s,a,u=this;return(0,v.YH)(this,function(l){switch(l.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,l,c;return(0,v.YH)(this,function(d){switch(d.label){case 0:i=new AbortController,s=setTimeout(function(){return i.abort()},t),d.label=1;case 1:return d.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:if((a=d.sent()).ok)return[3,4];return[4,a.text()];case 3:return l=d.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(a.status,": ").concat(l)),[3,6];case 4:return[4,a.json()];case 5:return[2,{value:{remoteConfig:d.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(c=d.sent())instanceof Error&&"AbortError"===c.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: "),c),[3,9];case 8:return clearTimeout(s),[7];case 9:if(!(n<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(r))})];case 10:d.sent(),d.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];l.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}(),A={TAGS:"tags",COUNTERS:"counters",HISTOGRAMS:"histograms",EVENTS:"events",INTERNAL:"internal"},O={LAST_FLUSH_TIMESTAMP:"last_flush_timestamp"},R=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=T())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.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(t){var r=t.target.result;e.createTables(r)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(A.TAGS)||e.createObjectStore(A.TAGS,{keyPath:"key"}),e.objectStoreNames.contains(A.COUNTERS)||e.createObjectStore(A.COUNTERS,{keyPath:"key"}),e.objectStoreNames.contains(A.HISTOGRAMS)||e.createObjectStore(A.HISTOGRAMS,{keyPath:"key"}),e.objectStoreNames.contains(A.EVENTS)||e.createObjectStore(A.EVENTS,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(A.INTERNAL)||e.createObjectStore(A.INTERNAL,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t,r,n,i=this;
1return(0,v.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([A.TAGS],"readwrite")).objectStore(A.TAGS),[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,v.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,v.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,v.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([A.COUNTERS],"readwrite")).objectStore(A.COUNTERS),[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,v.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,v.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,v.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([A.HISTOGRAMS],"readwrite")).objectStore(A.HISTOGRAMS),[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,v.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,v.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,v.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([A.EVENTS],"readwrite")).objectStore(A.EVENTS),[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,v.sH)(this,void 0,void 0,function(){var r,n,i;return(0,v.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([A.INTERNAL],"readwrite")).objectStore(A.INTERNAL),[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,v.sH)(this,void 0,void 0,function(){var t,r,n;return(0,v.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([A.INTERNAL],"readonly")).objectStore(A.INTERNAL),[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,v.sH)(this,void 0,void 0,function(){var e,t;return(0,v.YH)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(O.LAST_FLUSH_TIMESTAMP)];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,v.sH)(this,void 0,void 0,function(){var t;return(0,v.YH)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(O.LAST_FLUSH_TIMESTAMP,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,v.sH)(this,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,v.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([A.TAGS,A.COUNTERS,A.HISTOGRAMS,A.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(e,A.TAGS),this.getAllFromStore(e,A.COUNTERS),this.getAllFromStore(e,A.HISTOGRAMS),this.getAllFromStore(e,A.EVENTS)])];case 2:return r=(t=v.zs.apply(void 0,[a.sent(),4]))[0],n=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,A.COUNTERS),this.clearTable(e,A.HISTOGRAMS),this.clearTable(e,A.EVENTS)])];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}(),N=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,L=function(e,t){return 31*Math.abs(N(e.toString()))%1e5/1e5<t},M=function(){var e=T();return null==e?void 0:e.__AMPLITUDE_SCRIPT_URL__},D=function(e){var t=T();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",(0,v.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=H({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=U(i),s=H({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!=(t=null==n?void 0:n.message)?t:F(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},H=function(e){var t=M();if(t){if(e.filename&&e.filename.includes(t))return"filename";if(e.stack&&e.stack.includes(t))return"stack"}},U=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},F=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},j=function(){function e(e,t,r,n){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,v.Cl)({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=L(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,R.isSupported()?this.storage=new R(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),D(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,v.sH)(this,void 0,void 0,function(){var e,t,r,n;return(0,v.YH)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,v.Cl)({},this.inMemoryTags),t=(0,v.Cl)({},this.inMemoryCounters),r=(0,v.Cl)({},this.inMemoryHistograms),n=(0,v.fX)([],(0,v.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,v.sH)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l;return(0,v.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}}),u=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===u.length)return[2];return l={tags:o,histogram:a,counters:s,events:u},this.fetch(l),[2]}})})},e.prototype.fetch=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t;return(0,v.YH)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!T())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,v.sH)(this,void 0,void 0,function(){var e,t,r;return(0,v.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=L(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),q=function(){var e,t=T();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=B(r[0]),i=B(r[1]);return i&&(e[n]=i),e},{}):{}},B=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},z=r(4605),Y="".concat("AMP","_unsent"),V="$default_instance",J="https://api2.amplitude.com/2/httpapi",W="dclid",K="fbclid",$="gbraid",G="gclid",X="ko_click_id",Q="li_fat_id",Z="msclkid",ee="rdt_cid",et="ttclid",er="twclid",en="wbraid",ei={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},eo=["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"],es=["authorization","cookie","set-cookie"],ea=function(e){return void 0===e&&(e=V),z.i.getInstance(e)},eu=function(e,t){ea(t).identityStore.editIdentity().setUserId(e).commit()},el=function(e,t){ea(t).identityStore.editIdentity().setDeviceId(e).commit()};!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(o||(o={}));var ec=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},[])},ed=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=o.Unknown),{event:e,code:t,message:r}},ef=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:V,logLevel:i.Warn,loggerProvider:new _,offline:!1,optOut:!1,serverUrl:J,serverZone:"US",useBatch:!1}},eh=function(){function e(e){this._optOut=!1;var t,r,n,i,o=ef();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=ep(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}
1,enumerable:!1,configurable:!0}),e}(),ep=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=ef().serverZone),void 0===r&&(r=ef().useBatch),e)return{serverUrl:e,serverZone:void 0};var n,i=["US","EU"].includes(t)?t:ef().serverZone;return{serverZone:i,serverUrl:(n=r,"EU"===i?n?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":n?"https://api2.amplitude.com/batch":J)}},eg=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function ev(e){return e>=200&&e<300}function em(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var ey=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,v.sH)(this,void 0,void 0,function(){var r,n=this;return(0,v.YH)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(Y,"_").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=x()),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()})},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,v.sH)(this,void 0,void 0,function(){var t,r,n=this;return(0,v.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,ec(t,this.config.flushQueueSize).reduce(function(t,r){return(0,v.sH)(n,void 0,void 0,function(){return(0,v.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,v.sH)(this,void 0,void 0,function(){var n,i,s,a;return(0,v.YH)(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,v.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 eg,u.label=1;case 1:return u.trys.push([1,3,,4]),i=ep(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:if(null===(s=u.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(em(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:var l;return a=(l=u.sent())instanceof Error?l.message:String(l),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:m()}),this.handleResponse({status:o.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){ev(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:em(e),stack_trace:m()});var r,n=e.status;switch(n){case o.Success:this.handleSuccessResponse(e,t);break;case o.Invalid:this.handleInvalidResponse(e,t);break;case o.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case o.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,v.fX)((0,v.fX)((0,v.fX)((0,v.fX)([],(0,v.zs)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,v.zs)(Object.values(e.body.eventsWithMissingFields)),!1),(0,v.zs)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,v.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(em(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(em(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),u=new Set(o),l=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):(u.has(n)&&(t.timeout=r.throttleTimeout),!0)});l.length>0&&this.config.loggerProvider.warn(em(e));var c=this.removeEventsExceedFlushMaxRetries(l);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;ev(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:m()})),this.removeEvents(e),e.forEach(function(e){return e.callback(ed(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}(),eb=function(){function e(){this.name="identity",this.type="before",this.identityStore=ea().identityStore}return e.prototype.execute=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t;return(0,v.YH)(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(t){return e.instanceName&&(this.identityStore=ea(e.instanceName).identityStore),[2]})})},e}(),ew=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!eS(t,r))return!1}return!0},eS=function(e,t){var r,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,v.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&ew(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else if(null==t)return!1;else if("object"==typeof t)return ew(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},eE=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,v.Cl)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(s.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(s.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(s.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(s.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(s.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(s.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(s.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(s.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(s.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[s.CLEAR_ALL]="-",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[s.CLEAR_ALL]||this._propertySet.has(t))&&(e===s.ADD?"number"==typeof r:e===s.UNSET||e===s.REMOVE||eS(t,r))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(s||(s={}));var eI=[s.CLEAR_ALL,s.UNSET,s.SET,s.SET_ONCE,s.ADD,s.APPEND,s.PREPEND,s.PREINSERT,s.POSTINSERT,s.REMOVE];!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(a||(a={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(u||(u={}));var e_=function(e,t){return(0,v.Cl)((0,v.Cl)({},t),{event_type:u.IDENTIFY,user_properties:e.getUserProperties()})},ek=function(e,t,r,n){var i;return(0,v.Cl)((0,v.Cl)({},n),{event_type:u.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:((i={})[e]=t,i)})},eT=function(e,t,r){var n,i=new eE;return i.set(e,t),(0,v.Cl)((0,v.Cl)({},r),{event_type:u.IDENTIFY,user_properties:i.getUserProperties(),groups:((n={})[e]=t,n)})},eC=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){return ew(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?(0,v.Cl)({},this.properties):{};return e[l.REVENUE_PRODUCT_ID]=this.productId,e[l.REVENUE_QUANTITY]=this.quantity,e[l.REVENUE_PRICE]=this.price,e[l.REVENUE_TYPE]=this.revenueType,e[l.REVENUE_CURRENCY]=this.currency,e[l.REVENUE]=this.revenue,e[l.RECEIPT]=this.receipt,e[l.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(l||(l={}));var ex=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},eP=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var r,n;return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(t){return t.name===e.name}))return this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2];return void 0===e.name&&(e.name=x(),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."))),e.type=null!=(r=e.type)?r:"enrichment",[4,null==(n=e.setup)?void 0:n.call(e,t,this.client)];case 1:return i.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e,t){var r;return(0,v.sH)(this,void 0,void 0,function(){var n,i;return(0,v.YH)(this,function(o){switch(o.label){case 0:if(-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.applying=!1,this.plugins.map(function(e){var t;return null==(t=e.teardown)?void 0:t.call(e)}),this.plugins=[],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,v.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s,a,u,l,c,d,f,h,p,g;return(0,v.YH)(this,function(m){switch(m.label){case 0:if(!e)return[2];t=(0,v.zs)(e,1)[0],r=(0,v.zs)(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),n=this.plugins.filter(function(e){return"before"===e.type}),m.label=1;case 1:m.trys.push([1,6,7,8]),o=(i=(0,v.Ju)(n)).next(),m.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,v.Cl)({},t))];case 3:if(null===(a=m.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))),m.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return f={error:m.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:u=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),m.label=9;case 9:m.trys.push([9,14,15,16]),c=(l=(0,v.Ju)(u)).next(),m.label=10;case 10:if(c.done)return[3,13];if(!(s=c.value).execute)return[3,12];return[4,s.execute((0,v.Cl)({},t))];case 11:if(null===(a=m.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))),m.label=12;case 12:return c=l.next(),[3,10];case 13:return[3,16];case 14:return p={error:m.sent()},[3,16];case 15:try{c&&!c.done&&(g=l.return)&&g.call(l)}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,v.Cl)({},t);return e.execute(r).catch(function(e){return ed(r,0,String(e))})})).then(function(e){var n=(0,v.zs)(e,1)[0]||ed(t,100,"Event not tracked, no destination plugins on the instance");r(n)}),[2]}})})},e.prototype.flush=function(){return(0,v.sH)(this,void 0,void 0,function(){var e,t=this;return(0,v.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.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)})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null==(t=e.onReset)||t.call(e)})},e}(),eA=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 eP(this),this.name=e}return e.prototype._init=function(e){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,v.YH)(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),n=(r=(0,v.Ju)(t)).next(),a.label=2;case 2:if(n.done)return[3,7];if(!((i=(0,n.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return a.sent(),[3,6];case 4:return[4,i];case 5:a.sent(),a.label=6;case 6:return n=r.next(),[3,2];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,r){var n=(0,v.Cl)((0,v.Cl)((0,v.Cl)({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t});return E(this.dispatch(n))},e.prototype.identify=function(e,t){var r=e_(e,t);return E(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=ek(e,t,r,n);return E(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=eT(e,t,r);return E(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=(0,v.Cl)((0,v.Cl)({},t),{event_type:u.REVENUE,event_properties:e.getEventProperties()});return E(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),E())},e.prototype._addPlugin=function(e){return E(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)),E())},e.prototype._removePlugin=function(e){return E(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(ed(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t=this;return(0,v.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={};if(void 0===e)return t;var r={};return Object.keys(e).forEach(function(t){Object.values(a).includes(t)||(r[t]=e[t])}),eI.forEach(function(r){if(Object.keys(e).includes(r)){var n=e[r];switch(r){case a.CLEAR_ALL:Object.keys(t).forEach(function(e){delete t[e]});break;
1case a.UNSET:Object.keys(n).forEach(function(e){delete t[e]});break;case a.SET:Object.assign(t,n)}}}),Object.assign(t,r),t},e.prototype.process=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t,r,n;return(0,v.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),this.config.optOut)return[2,ed(e,0,"Event skipped due to optOut config")];return e.event_type===u.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[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=ed(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){if(!this.isReady)return void this.q.push(this._setOptOut.bind(this,!!e));this._setOptOut(e)},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=!!e)},e.prototype.flush=function(){return E(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}(),eO=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},eR=function(e){return eO(e,"attribution")},eN=function(e){return eO(e,"formInteractions")},eL=function(e){return eO(e,"pageViews")},eM=function(e){return eO(e,"sessions")},eD=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},eH=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},eU=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},eF=function(e){if(eH(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},ej=function(e){if(eU(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},eq=function(e){var t;if(eD(e.autocapture)){var r=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?r=e.autocapture.networkTracking:e.networkTrackingOptions&&(r=e.networkTrackingOptions),(0,v.Cl)((0,v.Cl)({},r),{captureRules:null==(t=null==r?void 0:r.captureRules)?void 0:t.map(function(t){var r,n,i;if((null==(r=t.urls)?void 0:r.length)&&(null==(n=t.hosts)?void 0:n.length)){var o=JSON.stringify(t.hosts),s=JSON.stringify(t.urls);return null==(i=e.loggerProvider)||i.warn("Found network capture rule with both urls='".concat(s,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,v.Cl)((0,v.Cl)({},t),{hosts:void 0})}return t})})}},eB=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return eL(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}},ez=function(e){if(eN(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},eY=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 u=a.apply(e,o);"function"==typeof s&&s(null==u?void 0:u.promise)}}return e},eV=function(e){return e&&void 0!==e._q},eJ=function(){if("undefined"==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:""},eW="2.34.0",eK="amplitude-ts",e$=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(eK,"/").concat(eW),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,r;return(0,v.sH)(this,void 0,void 0,function(){var n,i,o;return(0,v.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,v.Cl)((0,v.Cl)((0,v.Cl)((0,v.Cl)((0,v.Cl)((0,v.Cl)((0,v.Cl)((0,v.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:eJ()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:x(),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}(),eG=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t;return(0,v.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,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),eX=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,v.Cl)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,v.sH)(this,void 0,void 0,function(){var t,r;return(0,v.YH)(this,function(n){switch(n.label){case 0:if(!T())return[2,!1];e.testValue=String(Date.now()),t=new e((0,v.Cl)((0,v.Cl)({},this.options),{expirationDays:.003})),r="AMP_TEST_".concat(x().substring(0,8)),n.label=1;case 1:return n.trys.push([1,4,5,7]),[4,t.set(r,e.testValue)];case 2:return n.sent(),[4,t.get(r)];case 3:return[2,n.sent()===e.testValue];case 4:return n.sent(),[2,!1];case 5:return[4,t.remove(r)];case 6:return n.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return(0,v.sH)(this,void 0,void 0,function(){var t,r;return(0,v.YH)(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{if(r=e0(t),void 0===r)return console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)),[2,void 0];return[2,JSON.parse(r)]}catch(r){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t)),[2,void 0]}}})})},e.prototype.getRaw=function(e){var t,r,n,i;return(0,v.sH)(this,void 0,void 0,function(){var o,s,a,u,l,c,d,f,h,p,g,m,y=this;return(0,v.YH)(this,function(b){switch(b.label){case 0:s=o=T(),b.label=1;case 1:if(b.trys.push([1,4,,5]),!(a=null==s?void 0:s.cookieStore))return[3,3];return[4,a.getAll(e)];case 2:if(u=b.sent()){u.length>1&&(null==(t=this.config.diagnosticsClient)||t.recordEvent("cookies.duplicate",{cookies:u.map(function(e){return e.domain})}),null==(r=this.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(c=(l=(0,v.Ju)(u)).next();!c.done;c=l.next())if(d=c.value,e1(d.domain,this.options.domain))return[2,d.value]}catch(e){g={error:e}}finally{try{c&&!c.done&&(m=l.return)&&m.call(l)}finally{if(g)throw g.error}}}b.label=3;case 3:return[3,5];case 4:return b.sent(),[3,5];case 5:if(f=(null!=(i=null==(n=null==o?void 0:o.document)?void 0:n.cookie.split("; "))?i:[]).filter(function(t){return 0===t.indexOf(e+"=")}),h=void 0,"function"==typeof(p=this.config.duplicateResolverFn)&&f.length>1&&(h=f.find(function(t){var r;try{var n=p(t.substring(e.length+1));return n||null==(r=y.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.document.cookie"),n}catch(e){return!1}}
1)),h||(h=f[0]),!h)return[2,void 0];return[2,h.substring(e.length+1)]}})})},e.prototype.set=function(e,t){var r;return(0,v.sH)(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return(0,v.YH)(this,function(c){try{n=null!=(r=this.options.expirationDays)?r:0,i=null!==t?n:-1,o=void 0,i&&((s=new Date).setTime(s.getTime()+24*i*36e5),o=s),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(u=T())&&(u.document.cookie=a)}catch(t){l=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}return[2]})})},e.prototype.remove=function(e){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.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,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(e){return[2]})})},e}(),eQ=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},eZ=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},e0=function(e){var t;return null!=(t=eQ(e))?t:eZ(e)},e1=function(e,t){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()},e2=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},e3=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,r,n,i,s,a,u,l,c,d,f,h,p,g,v,m,y,b,w,S,E,I,_=e.code||0,k=this.buildStatus(_);switch(k){case o.Success:return{status:k,statusCode:_,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 o.Invalid:return{status:k,statusCode:_,body:{error:null!=(i=e.error)?i:"",missingField:null!=(s=e.missing_field)?s:"",eventsWithInvalidFields:null!=(a=e.events_with_invalid_fields)?a:{},eventsWithMissingFields:null!=(u=e.events_with_missing_fields)?u:{},eventsWithInvalidIdLengths:null!=(l=e.events_with_invalid_id_lengths)?l:{},epsThreshold:null!=(c=e.eps_threshold)?c:0,exceededDailyQuotaDevices:null!=(d=e.exceeded_daily_quota_devices)?d:{},silencedDevices:null!=(f=e.silenced_devices)?f:[],silencedEvents:null!=(h=e.silenced_events)?h:[],throttledDevices:null!=(p=e.throttled_devices)?p:{},throttledEvents:null!=(g=e.throttled_events)?g:[]}};case o.PayloadTooLarge:return{status:k,statusCode:_,body:{error:null!=(v=e.error)?v:""}};case o.RateLimit:return{status:k,statusCode:_,body:{error:null!=(m=e.error)?m:"",epsThreshold:null!=(y=e.eps_threshold)?y:0,throttledDevices:null!=(b=e.throttled_devices)?b:{},throttledUsers:null!=(w=e.throttled_users)?w:{},exceededDailyQuotaDevices:null!=(S=e.exceeded_daily_quota_devices)?S:{},exceededDailyQuotaUsers:null!=(E=e.exceeded_daily_quota_users)?E:{},throttledEvents:null!=(I=e.throttled_events)?I:[]}};case o.Timeout:default:return{status:k,statusCode:_}}},e.prototype.buildStatus=function(e){return ev(e)?o.Success:429===e?o.RateLimit:413===e?o.PayloadTooLarge:408===e?o.Timeout:e>=400&&e<500?o.Invalid:e>=500?o.Failed:o.Unknown},e}(),e4=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,v.C6)(t,e),t.prototype.send=function(e,t){return(0,v.sH)(this,void 0,void 0,function(){var r,n;return(0,v.YH)(this,function(i){switch(i.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,v.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}(e3),e6=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,v.sH)(this,void 0,void 0,function(){var t,r,n;return(0,v.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,v.sH)(this,void 0,void 0,function(){var t;return(0,v.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,v.sH)(this,void 0,void 0,function(){return(0,v.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,v.sH)(this,void 0,void 0,function(){return(0,v.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,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(r){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),e5=function(e){function t(t){var r,n,i,o=this;try{i=null==(r=T())?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,v.C6)(t,e),t.prototype.set=function(t,r){var n;return(0,v.sH)(this,void 0,void 0,function(){var i;return(0,v.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}(e6),e8=function(e){function t(){var t;return e.call(this,null==(t=T())?void 0:t.sessionStorage)||this}return(0,v.C6)(t,e),t}(e6),e7=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,v.C6)(t,e),t.prototype.send=function(e,t){return(0,v.sH)(this,void 0,void 0,function(){var r=this;return(0,v.YH)(this,function(n){return[2,new Promise(function(n,i){"undefined"==typeof XMLHttpRequest&&i(Error("XHRTransport is not supported."));var o,s,a=new XMLHttpRequest;a.open("POST",e,!0),a.onreadystatechange=function(){if(a.readyState===r.state.done){var e=a.responseText;try{n(r.buildResponse(JSON.parse(e)))}catch(e){n(r.buildResponse({code:a.status}))}}};var u=(0,v.Cl)({"Content-Type":"application/json",Accept:"*/*"},r.customHeaders);try{for(var l=(0,v.Ju)(Object.entries(u)),c=l.next();!c.done;c=l.next()){var d=(0,v.zs)(c.value,2),f=d[0],h=d[1];a.setRequestHeader(f,h)}}catch(e){o={error:e}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}a.send(JSON.stringify(t))})]})})},t}(e3),e9=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,v.C6)(t,e),t.prototype.send=function(e,t){return(0,v.sH)(this,void 0,void 0,function(){var r=this;return(0,v.YH)(this,function(n){return[2,new Promise(function(n,i){var o=T();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,JSON.stringify(t)))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}(e3),te=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},tt=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},tr="[Amplitude]",tn="".concat(tr," Form Started"),ti="".concat(tr," Form Submitted"),to="".concat(tr," File Downloaded"),ts="session_start",ta="session_end",tu="".concat(tr," File Extension"),tl="".concat(tr," File Name"),tc="".concat(tr," Link ID"),td="".concat(tr," Link Text"),tf="".concat(tr," Link URL"),th="".concat(tr," Form ID"),tp="".concat(tr," Form Name"),tg="".concat(tr," Form Destination"),tv="cookie",tm=function(e){function t(t,r,n,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,w,S,E,I,k,T,C,x,P,A,O,R,N,L,M,D,H,U,F,j,q,B){void 0===n&&(n=new eG),void 0===o&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===l&&(l=1e3),void 0===c&&(c=5),void 0===d&&(d=30),void 0===f&&(f=tv),void 0===m&&(m=new _),void 0===y&&(y=i.Warn),void 0===w&&(w=!1),void 0===S&&(S=!1),void 0===k&&(k=""),void 0===T&&(T="US"),void 0===x&&(x=18e5),void 0===P&&(P=new e5({loggerProvider:m})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===R&&(R=!1),void 0===N&&(N=!0),void 0===F&&(F=!0),void 0===j&&(j=0);var z,Y=this;(Y=e.call(this,{apiKey:t,storageProvider:P,transportProvider:tw(O)})||this).apiKey=t,Y.appVersion=r,Y.cookieOptions=o,Y.defaultTracking=s,Y.autocapture=a,Y.flushIntervalMillis=l,Y.flushMaxRetries=c,Y.flushQueueSize=d,Y.identityStorage=f,Y.ingestionMetadata=h,Y.instanceName=p,Y.loggerProvider=m,Y.logLevel=y,Y.minIdLength=b,Y.offline=w,Y.partnerId=E,Y.plan=I,Y.serverUrl=k,Y.serverZone=T,Y.sessionTimeout=x,Y.storageProvider=P,Y.trackingOptions=A,Y.transport=O,Y.useBatch=R,Y.fetchRemoteConfig=N,Y.networkTrackingOptions=H,Y.identify=U,Y.enableDiagnostics=F,Y.diagnosticsSampleRate=j,Y.diagnosticsClient=q,Y.remoteConfig=B,Y.version=eW,Y._optOut=!1,Y._cookieStorage=n,Y.deviceId=u,Y.lastEventId=g,Y.lastEventTime=v,Y.optOut=S,Y.sessionId=C,Y.pageCounter=M,Y.userId=L,Y.debugLogsEnabled=D,Y.loggerProvider.enable(D?i.Debug:Y.logLevel),Y.networkTrackingOptions=H,Y.identify=U,Y.enableDiagnostics=F,Y.diagnosticsSampleRate=j,Y.diagnosticsClient=q;var V=null!=(z=null==B?void 0:B.fetchRemoteConfig)?z:N;return Y.remoteConfig=Y.remoteConfig||{},Y.remoteConfig.fetchRemoteConfig=V,Y.fetchRemoteConfig=V,Y}return(0,v.C6)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof eX&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(e2(this.apiKey),e)},t}(eh),ty=function(e,t,r){switch(void 0===e&&(e=tv),void 0===t&&(t={}),e){case"localStorage":return new e5;case"sessionStorage":return new e8;case"none":return new eG;default:return new eX((0,v.Cl)((0,v.Cl)({},t),{expirationDays:t.expiration}),r)}},tb=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},tw=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0;return"xhr"===t?new e7(r):"beacon"===t?new e9:new e4(r)},tS="data-amp-mask",tE="*****",tI=/\b(?:\d[ -]*?){13,16}\b/,t_=/(\d{3}-?\d{2}-?\d{4})/g,tk=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,tT=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var r,n,i=e;i=(i=(i=i.replace(tI,tE)).replace(t_,tE)).replace(tk,tE);try{for(var o=(0,v.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,tE)}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},tC=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(tS)?tE:e?e(document.title):document.title},tx=function(){function e(){}return e.prototype.parse=function(){return(0,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(e){return[2,(0,v.Cl)((0,v.Cl)((0,v.Cl)((0,v.Cl)({},ei),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=q();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,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=q();return(e={})[W]=t[W],e[K]=t[K],e[$]=t[$],e[G]=t[G],e[X]=t[X],e[Q]=t[Q],e[Z]=t[Z],e[ee]=t[ee],e[et]=t[et],e[er]=t[er],e[en]=t[en],e},e}(),tP=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},tA=function(e){void 0===e&&(e={});var t,r,n=T(),i=void 0,o=!1,s=e.trackOn,a=e.trackHistoryChanges,u=e.eventType,l=void 0===u?"[Amplitude] Page Viewed":u,c=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},d=function(){return(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r;return(0,v.YH)(this,function(n){switch(n.label){case 0:return e=c("undefined"!=typeof location&&location.href||""),r={event_type:l},t=[{}],[4,tO()];case 1:return[2,(r.event_properties=v.Cl.apply(void 0,[v.Cl.apply(void 0,t.concat([n.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&c(location.pathname)||"","[Amplitude] Page Title":tC(tT),"[Amplitude] Page URL":e.split("?")[0]}]),r)]}})})},f=function(){return void 0===s||"function"==typeof s&&s()},h="undefined"!=typeof location?location.href:null,p=function(){return(0,v.sH)(void 0,void 0,void 0,function(){var e,r,n,o;return(0,v.YH)(this,function(s){switch(s.label){case 0:if(r=tN(a,e=location.href,h||"")&&f(),h=e,!r)return[3,4];if(null==i||i.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return o=(n=t).track,[4,d()];case 2:o.apply(n,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}})})},g=function(){p()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return(0,v.sH)(void 0,void 0,void 0,function(){var a,u;return(0,v.YH)(this,function(l){switch(l.label){case 0:if(t=s,r=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),o=!0,n&&(n.addEventListener("popstate",g),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,v.zs)(r,3),i=n[0],s=n[1],a=n[2];e.apply(t,[i,s,a]),o&&p()}})),!f())return[3,2];return i.log("Tracking page view event"),u=(a=t).track,[4,d()];case 1:u.apply(a,[l.sent()]),l.label=2;case 2:return[2]}})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){var t;return(0,v.YH)(this,function(n){switch(n.label){case 0:if(!("attribution"===s&&tR(e)))return[3,2];
1return null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,d()];case 1:e.event_type=(t=n.sent()).event_type,e.event_properties=(0,v.Cl)((0,v.Cl)({},e.event_properties),t.event_properties),n.label=2;case 2:return r&&e.event_type===l&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=(0,v.Cl)((0,v.Cl)({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(e){return n&&(n.removeEventListener("popstate",g),o=!1),[2]})})}}},tO=function(){return(0,v.sH)(void 0,void 0,void 0,function(){var e;return(0,v.YH)(this,function(t){switch(t.label){case 0:return e=tP,[4,new tx().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},tR=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[a.SET]||{},n=t[a.UNSET]||{},i=(0,v.fX)((0,v.fX)([],(0,v.zs)(Object.keys(r)),!1),(0,v.zs)(Object.keys(n)),!1);return Object.keys(ei).every(function(e){return i.includes(e)})}return!1},tN=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},tL=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,v.sH)(void 0,void 0,void 0,function(){var o,s;return(0,v.YH)(this,function(a){return t=ez(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("undefined"!=typeof document){var o=function(e){var o=!1;n(e,"change",function(){var t,r=tD(e);o||i.track(tn,((t={})[th]=tM(e.id),t[tp]=tM(e.name),t[tg]=r,t)),o=!0}),n(e,"submit",function(n){var s,a,u=tD(e);if(o||i.track(tn,((s={})[th]=tM(e.id),s[tp]=tM(e.name),s[tg]=u,s)),o=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0)if("function"==typeof t.shouldTrackSubmit&&"undefined"!=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(ti,((a={})[th]=tM(e.id),a[tp]=tM(e.name),a[tg]=u,a)),o=!1})};Array.from(document.getElementsByTagName("form")).forEach(o),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&o(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(o)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=T())?s.addEventListener("load",o):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},tM=function(e){if("string"==typeof e)return e},tD=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},tH=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,v.sH)(void 0,void 0,void 0,function(){var i,o;return(0,v.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("undefined"!=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(to,((r={})[tu]=s,r[tl]=t.pathname,r[tc]=e.id,r[td]=e.text,r[tf]=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),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=T())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},tU=!1,tF=function(e){tU||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."),tU=!0)},tj=function(){var e=T(),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,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(n){return"undefined"==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(){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,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(e){return n(),[2]})})}}};function tq(e,t,r){var n,i,o=[];try{for(var s=(0,v.Ju)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var u=a.value;try{o.push(new RegExp(u))}catch(e){r.loggerProvider.warn("Invalid regex pattern: ".concat(u),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 tB=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],tz="data-amp-track-",tY=["div","span","h1","h2","h3","h4","h5","h6"];function tV(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tJ(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function tW(e,t,r){return t&&tJ(e.prototype,t),r&&tJ(e,r),e}var tK=function(){return"function"==typeof Symbol},t$=function(e){return tK()&&!!Symbol[e]},tG=function(e){return t$(e)?Symbol[e]:"@@"+e};tK()&&!t$("observable")&&(Symbol.observable=Symbol("observable"));var tX=tG("iterator"),tQ=tG("observable"),tZ=tG("species");function t0(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw TypeError(r+" is not a function");return r}}function t1(e){var t=e.constructor;return void 0!==t&&null===(t=t[tZ])&&(t=void 0),void 0!==t?t:re}function t2(e){t2.log?t2.log(e):setTimeout(function(){throw e})}function t3(e){Promise.resolve().then(function(){try{e()}catch(e){t2(e)}})}function t4(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=t0(t,"unsubscribe");r&&r.call(t)}}catch(e){t2(e)}}function t6(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function t5(e,t,r){e._state="running";var n=e._observer;try{var i=t0(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(t6(e),i)i.call(n,r);else throw r;break;case"complete":t6(e),i&&i.call(n)}}catch(e){t2(e)}"closed"===e._state?t4(e):"running"===e._state&&(e._state="ready")}function t8(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}],t3(function(){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(t5(e,t[r].type,t[r].value),"closed"!==e._state);++r);}});return}t5(e,t,r)}}var t7=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var r=new t9(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}return e.prototype.unsubscribe=function(){"closed"!==this._state&&(t6(this),t4(this))},tW(e,[{key:"closed",get:function(){return"closed"===this._state}}]),e}(),t9=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){t8(this._subscription,"next",e)},t.error=function(e){t8(this._subscription,"error",e)},t.complete=function(){t8(this._subscription,"complete")},tW(e,[{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),re=function(){function e(t){if(!(this instanceof e))throw TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw TypeError("Observable initializer must be a function");this._subscriber=t}var t=e.prototype;return t.subscribe=function(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new t7(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise(function(r,n){if("function"!=typeof e)return void n(TypeError(e+" is not a function"));function i(){o.unsubscribe(),r()}var o=t.subscribe({next:function(t){try{e(t,i)}catch(e){n(e),o.unsubscribe()}},error:n,complete:r})})},t.map=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");return new(t1(this))(function(r){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})})},t.filter=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");return new(t1(this))(function(r){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})})},t.reduce=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");
1var r=t1(this),n=arguments.length>1,i=!1,o=arguments[1],s=o;return new r(function(r){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||n)try{s=e(s,t)}catch(e){return r.error(e)}else s=t},error:function(e){r.error(e)},complete:function(){if(!i&&!n)return r.error(TypeError("Cannot reduce an empty sequence"));r.next(s),r.complete()}})})},t.concat=function(){for(var e=this,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=t1(this);return new i(function(t){var n,o=0;return!function e(s){n=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===r.length?(n=void 0,t.complete()):e(i.from(r[o++]))}})}(e),function(){n&&(n.unsubscribe(),n=void 0)}})},t.flatMap=function(e){var t=this;if("function"!=typeof e)throw TypeError(e+" is not a function");var r=t1(this);return new r(function(n){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return n.error(e)}var o=r.from(t).subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){n.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&n.complete()}return function(){i.forEach(function(e){return e.unsubscribe()}),o.unsubscribe()}})},t[tQ]=function(){return this},e.from=function(t){var r="function"==typeof this?this:e;if(null==t)throw TypeError(t+" is not an object");var n=t0(t,tQ);if(n){var i=n.call(t);if(Object(i)!==i)throw TypeError(i+" is not an object");return i instanceof re&&i.constructor===r?i:new r(function(e){return i.subscribe(e)})}if(t$("iterator")&&(n=t0(t,tX)))return new r(function(e){t3(function(){if(!e.closed){for(var r,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return tV(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tV(e,t)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(n.call(t));!(r=i()).done;){var o=r.value;if(e.next(o),e.closed)return}e.complete()}})});if(Array.isArray(t))return new r(function(e){t3(function(){if(!e.closed){for(var r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}})});throw TypeError(t+" is not observable")},e.of=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return new("function"==typeof this?this:e)(function(e){t3(function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}})})},tW(e,null,[{key:tZ,get:function(){return this}}]),e}();function rt(e,t){return new re(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 rr(e,t){return new re(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=(0,v.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 rn(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new re(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){try{for(var r,n,i,o=(0,v.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,v.Ju)(t),a=s.next();!a.done;a=s.next()){var u=a.value;null==(o=u.error)||o.call(u,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,v.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)}})}tK()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:tQ,hostReportError:t2},configurable:!0});var ri="1.19.0",ro="[Amplitude] Element Clicked",rs="[Amplitude] Element Tag",ra="[Amplitude] Element Text",ru="[Amplitude] Page URL",rl="https://app.amplitude.com",rc={US:rl,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},rd="data-amp-mask-attributes",rf=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},rh=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},rp=["input","select","textarea"],rg=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},rv=function(e,t,r){return void 0===r&&(r=!1),function(n,i){var o,s,a=e.pageUrlAllowlist,u=e.pageUrlExcludelist,l=e.shouldTrackEventResolver,c=null==(s=null==(o=null==i?void 0:i.tagName)?void 0:o.toLowerCase)?void 0:s.call(o);if(!c)return!1;if(l)return l(n,i);if(!rf(window.location.href,a)||u&&u.length>0&&rf(window.location.href,u))return!1;var d=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=rg(i,n);if(r&&f)return!0;
1if(t&&!t.some(function(e){var t;return!!(null==(t=null==i?void 0:i.matches)?void 0:t.call(i,e))}))return!1;switch(c){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:if(f)return!0;return"click"===n}}},rm=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!rp.includes(i)&&!o},ry=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},{})},rb=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:rb(null==e?void 0:e.parentElement,t):null},rw=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(c||(c={}));var rS=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",rd,tS]),rE=["type"],rI=["svg","path","g"],r_=["password","hidden"],rk=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){}},rT=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}})},rC=function(e,t){var r,n,i,o=this;this.replaceSensitiveString=function(e){return tT(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,n,i,s=performance.now(),a=[];if(!e)return[];for(var u=function(e){var t=[];if(!e)return t;
1t.push(e);for(var r=e.parentElement;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e),l=new Map,c=u.length-1;c>=0;c--){var d=u[c];if(d){var f,h=(f=d.getAttribute(rd))?f.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],p=c===u.length-1?[]:null!=(n=l.get(u[c+1]))?n:new Set,g=new Set((0,v.fX)((0,v.fX)([],(0,v.zs)(p),!1),(0,v.zs)(h),!1));l.set(d,g)}}a=u.map(function(e){var t;return function(e,t){if(null===e)return null;var r,n,i,o,s,a,u=String(e.tagName).toLowerCase(),l={tag:u},c=Array.from(null!=(o=null==(i=e.parentElement)?void 0:i.children)?o:[]);c.length&&(l.index=c.indexOf(e),l.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&&(l.prevSib=String(d));var f=e.getAttribute("id");f&&(l.id=String(f));var h=Array.from(e.classList);h.length&&(l.classes=h);var p={},g=Array.from(e.attributes).filter(function(e){return!rS.has(e.name)}),m=!rm(e);if(!r_.includes(String(e.getAttribute("type")))&&!rI.includes(u))try{for(var y=(0,v.Ju)(g),b=y.next();!b.done;b=y.next()){var w=b.value;if(!m||rE.includes(w.name)){if(t.has(w.name)){p[w.name]=tE;continue}p[w.name]=String(w.value).substring(0,128)}}}catch(e){r={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}return Object.keys(p).length&&(l.attrs=p),l}(e,null!=(t=l.get(e))?t:new Set)});var m=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=(0,v.zs)(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=o.replaceSensitiveString(i))})};try{for(var y=(0,v.Ju)(a),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=o.diagnosticsClient)||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),a},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?o.getText(t):o.getNearestLabel(r)},this.getEventProperties=function(e,t,r){var n,i,s,a,u=null==(s=null==(i=null==t?void 0:t.tagName)?void 0:i.toLowerCase)?void 0:s.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},c=o.getHierarchy(t),d=null==(a=c[0])?void 0:a.attrs,f=o.getNearestLabel(t),h=Object.entries(null!=d?d:{}).reduce(function(e,t){var n=(0,v.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"]=c,n[rs]=u,n[ra]=o.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"]=h,n["[Amplitude] Element Parent Label"]=f,n[ru]=rh(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=tC(o.replaceSensitiveString),n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);if(p["[Amplitude] Element ID"]=t.getAttribute("id")||"",p["[Amplitude] Element Class"]=t.getAttribute("class"),p["[Amplitude] Element Aria Label"]=null==d?void 0:d["aria-label"],"a"===u&&"click"===e&&t instanceof HTMLAnchorElement){var g=t.href.substring(0,128);p["[Amplitude] Element Href"]=o.replaceSensitiveString(g)}return ry(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 s=o.addTypeAndTimestamp(e,t);if(("click"===s.type||"change"===s.type)&&null!==s.event.target){if(i&&rg(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,n),s;var a=rb(s.event.target,r);a&&(s.closestTrackedAncestor=a,s.targetElementProperties=o.getEventProperties(s.type,a,n))}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=rk(e,t);if(r){if("TEXT"===e.elementExtractType)return o.getText(r);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return r.getAttribute(e.attribute)}}},this.getText=function(e){if(null!==e.closest("[".concat(tS,"]")))return tE;var t="";if(e.querySelector("[".concat(tS,"], [contenteditable]"))){var r=e.cloneNode(!0);r.querySelectorAll("[".concat(tS,"], [contenteditable]")).forEac
1h(function(e){e.innerText=tE}),t=r.innerText||""}else t=e.innerText||"";return o.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 ry(((t={})[rs]=i,t[ra]=o.getText(e),t[ru]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var s=null!=(i=e.maskTextRegex)?i:[],a=[];try{for(var u=(0,v.Ju)(s),l=u.next();!l.done;l=u.next()){var c=l.value;if(a.length>=25)break;if(c instanceof RegExp)a.push(c);else if("pattern"in c&&"string"==typeof c.pattern)try{a.push(RegExp(c.pattern,"i"))}catch(e){}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}this.additionalMaskTextPatterns=a},rx=function(){function e(e){var t=(void 0===e?{}:e).origin,r=this;this.endpoint=rl,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=void 0===t?rl: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),(null==r?void 0: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.setup=function(e){var t=this,r=void 0===e?{dataExtractor:new rC({})}:e,n=r.logger,i=r.endpoint,o=r.isElementSelectable,s=r.cssSelectorAllowlist,a=r.actionClickAllowlist,u=r.dataExtractor;this.logger=n,i&&this.endpoint===rl&&(this.endpoint=i);var l=null;window.addEventListener("message",function(e){if(null==(n=null==(r=t.logger)?void 0:r.debug)||n.call(r,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var r,n,i,c,d,f=null==e?void 0:e.data,h=null==f?void 0:f.action;if(h)if("id"in f)null==(c=null==(i=t.logger)?void 0:i.debug)||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===h)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p,g=null==f?void 0:f.data;(p="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise(function(e,t){var r;try{var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=p,n.addEventListener("load",function(){e({status:!0})},{once:!0}),n.addEventListener("error",function(){t({status:!1,message:"Failed to load the script ".concat(p)})}),null==(r=document.head)||r.appendChild(n)}catch(e){t(e)}})).then(function(){var e;l=null==(e=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:e.call(window,{getEventTagProps:u.getEventTagProps,isElementSelectable:function(e){return!o||o((null==g?void 0:g.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:a,extractDataFromDataSource:u.extractDataFromDataSource,dataExtractor:u,diagnostics:{autocapture:{version:ri}}}),t.notify({action:"selector-loaded"})}).catch(function(){var e;null==(e=t.logger)||e.warn("Failed to initialize visual tagging selector")})}else"close-visual-tagging-selector"===h&&(null==(d=null==l?void 0:l.close)||d.call(l))}}),this.notify({action:"page-loaded"})},e}(),rP=T(),rA=null==rP?void 0:rP.console,rO={},rR={},rN=!1,rL={addListener:function(e,t){if(!rA||"function"!=typeof rA[e]||!rR[e]&&(rR[e]=rA[e],rA[e]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{if(rO[e]&&!rN){rN=!0;var n=rO[e];
1n&&n.forEach(function(r){try{r(e,t)}catch(e){}})}}catch(e){}return rN=!1,rR[e].apply(rA,t)},0))return Error("Console override failed");rO[e]?rO[e].push(t):rO[e]=[t]},removeListener:function(e){var t,r;try{for(var n=(0,v.Ju)(Object.values(rO)),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}}}},rM=T(),rD=function(){return new re(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()}})},rH=function(e){return void 0===e&&(e="click"),new re(function(t){var r=function(e){t.next(e)};return rM.document.addEventListener(e,r,{capture:!0}),function(){rM.document.removeEventListener(e,r,{capture:!0})}})},rU=function(){var e=rr(new re(function(e){var t=function(t){var r={kind:"error"};t.error instanceof Error?r=(0,v.Cl)((0,v.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 rM.addEventListener("error",t),function(){rM.removeEventListener("error",t)}}),new re(function(e){var t=function(t){var r={kind:"unhandledrejection"};t.reason instanceof Error?(r.message=t.reason.message,r.stack=t.reason.stack):"string"==typeof t.reason&&(r.message=t.reason),e.next(r)};return rM.addEventListener("unhandledrejection",t),function(){rM.removeEventListener("unhandledrejection",t)}}));return rr(e,new re(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 rL.addListener("error",t),function(){rL.removeListener(t)}}))},rF=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},rj={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},rq=function(e){var t,r,n,i,o=Object.values(rj).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,v.Ju)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{try{for(var l=(n=void 0,(0,v.Ju)(u.definition)),c=l.next();!c.done;c=l.next()){var d=rj[c.value.event_type];d&&o[d].add(u.id)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.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},rB=function(e){var t,r,n,i,o=new Map;try{for(var s=(0,v.Ju)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{for(var l=(n=void 0,(0,v.Ju)(u.conditions)),c=l.next();!c.done;c=l.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(u)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}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},rz=function(e,t){var r,n,i,o,s=new Set;try{for(var a=(0,v.Ju)(e),u=a.next();!u.done;u=a.next()){var l=u.value,c=t.get(l.id);if(c)try{for(var d=(i=void 0,(0,v.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{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Array.from(s)},rY=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=rz(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return rj[t.event_type]===e.type&&t.filters.every(function(t){return rF(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,v.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;rT(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}();!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable"}(d||(d={}));var rV=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ri);var r,n,i,o,s,a,u,l,c=e.dataAttributePrefix,f=void 0===c?tz:c,h=e.visualTaggingOptions,p=void 0===h?{enabled:!0,messenger:new rx}:h;e.cssSelectorAllowlist=null!=(r=e.cssSelectorAllowlist)?r:tB,e.actionClickAllowlist=null!=(n=e.actionClickAllowlist)?n:tY,e.debounceTime=null!=(i=e.debounceTime)?i:0,e.pageUrlExcludelist=null==(o=e.pageUrlExcludelist)?void 0:o.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 g="@amplitude/plugin-autocapture-browser",m=[],y=new rC(e,t),b=function(){var t,r,n=rn(rH().map(function(t){return y.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,f)})),i=rn(new re(function(t){var r,n=function(r){var n=y.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,f);t.next(n)};
1return null==(r=T())||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null==(e=T())?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(r=rn(new re(function(t){var r=function(r){var n=y.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,f);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var o=rn(rD().map(function(t){return y.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,f)}));return(t={})[d.ChangeObservable]=i,t[d.ClickObservable]=n,t[d.MutationObservable]=o,t[d.NavigateObservable]=r,t},w=rq(Object.values(null!=(a=null==(s=e.pageActions)?void 0:s.labeledEvents)?a:{})),S=rB(null!=(l=null==(u=e.pageActions)?void 0:u.triggers)?l:[]),E=new rY(w,S,y,e),I=function(t){var r,n;t&&(e.pageActions=(0,v.Cl)((0,v.Cl)({},e.pageActions),t),w=rq(Object.values(null!=(r=e.pageActions.labeledEvents)?r:{})),S=rB(null!=(n=e.pageActions.triggers)?n:[]),E.update(w,S,e))};return{name:g,type:"enrichment",setup:function(t,r){return(0,v.sH)(void 0,void 0,void 0,function(){var n,i,o,s,a,u,l,c,d,h;return(0,v.YH)(this,function(w){var S,_,k,T,C,x,P,A,O,R,N,L,M,D,H,U,F,j,q,B,z,Y,V,J,W,K;return"undefined"==typeof document?[2]:(t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){I(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),n=rv(e,e.cssSelectorAllowlist),i=rv(e,e.actionClickAllowlist),_=(S={allObservables:o=b(),amplitude:r,shouldTrackEvent:n,evaluateTriggers:E.evaluate.bind(E)}).amplitude,k=S.allObservables,T=S.shouldTrackEvent,C=S.evaluateTriggers,s=k.clickObservable.filter(rw).filter(function(e){return T("click",e.closestTrackedAncestor)}).map(function(e){return C(e)}).subscribe(function(e){null==_||_.track(ro,e.targetElementProperties)}),m.push(s),P=(x={allObservables:o,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.getEventProperties.apply(y,(0,v.fX)((0,v.fX)([],(0,v.zs)(e),!1),[f],!1))},amplitude:r,shouldTrackEvent:n,evaluateTriggers:E.evaluate.bind(E)}).amplitude,A=x.allObservables,O=x.getEventProperties,R=x.shouldTrackEvent,N=x.evaluateTriggers,a=A.changeObservable.filter(rw).filter(function(e){return R("change",e.closestTrackedAncestor)}).map(function(e){return N(e)}).subscribe(function(e){null==P||P.track("[Amplitude] Element Changed",O("change",e.closestTrackedAncestor))}),m.push(a),M=(L={allObservables:o,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.getEventProperties.apply(y,(0,v.fX)((0,v.fX)([],(0,v.zs)(e),!1),[f],!1))},amplitude:r,shouldTrackEvent:n,shouldTrackActionClick:i}).amplitude,D=L.allObservables,H=L.options,U=L.getEventProperties,F=L.shouldTrackEvent,j=L.shouldTrackActionClick,q=D.clickObservable,B=D.mutationObservable,z=D.navigateObservable,Y=q.filter(function(e){return!F("click",e.closestTrackedAncestor)}).map(function(e){var t=rb(e.event.target,H.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=U(e.type,e.closestTrackedAncestor)),e}).filter(rw).filter(function(e){return j("click",e.closestTrackedAncestor)}),V=z?rr(B,z):B,J=rr(Y,V),W=null,K=null,(u=rt(J,function(e){if(W&&(clearTimeout(W),W=null),"click"===e.type)K=e,W=setTimeout(function(){W=null,K=null},500);else if(K){var t=K;return K=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==M||M.track(ro,U("click",e.closestTrackedAncestor)))}))&&m.push(u),null==(d=null==t?void 0:t.loggerProvider)||d.log("".concat(g," has been successfully added.")),window.opener&&p.enabled&&(l=e.cssSelectorAllowlist,c=e.actionClickAllowlist,null==(h=p.messenger)||h.setup((0,v.Cl)((0,v.Cl)({dataExtractor:y,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:rc[t.serverZone]}),{isElementSelectable:rv(e,(0,v.fX)((0,v.fX)([],(0,v.zs)(l),!1),(0,v.zs)(c),!1)),cssSelectorAllowlist:l,actionClickAllowlist:c}))),[2])})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,v.YH)(this,function(i){try{for(t=(e=(0,v.Ju)(m)).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]})})}}},rJ=(0,v.fX)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,v.zs)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),rW=["*"],rK=["mutation","navigate"];function r$(e,t){var r,n,i,o,s=t.event,a=s.pageX,u=s.pageY;e.yMin=Math.min(null!=(r=e.yMin)?r:u,u),e.yMax=Math.max(null!=(n=e.yMax)?n:u,u),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 rG(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:(0,v.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}}function rX(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 rQ=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=rX(e,"rageClicks",rW,s),u=rX(e,"deadClicks",rJ,o),l=rX(e,"errorClicks",rJ,i),f=null!=(t=e.dataAttributePrefix)?t:tz,h=new rC(e),p=(0,v.fX)([],(0,v.zs)(new Set((0,v.fX)((0,v.fX)((0,v.fX)([],(0,v.zs)(a),!1),(0,v.zs)(u),!1),(0,v.zs)(l),!1))),!1),g=function(){var e,t,r=rn(rH("pointerdown").map(function(e){return h.addAdditionalEventProperties(e,"click",p,f,!0)})),n=rn(rU().map(function(e){return h.addTypeAndTimestamp(e,"error")})),i=rn(rD().map(function(e){return h.addAdditionalEventProperties(e,"mutation",p,f)}));window.navigation&&(t=rn(new re(function(e){var t=function(t){e.next((0,v.Cl)((0,v.Cl)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return h.addAdditionalEventProperties(e,"navigate",p,f)}
1)));var o=rn(new re(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)}}));return(e={})[d.ClickObservable]=r,e[d.MutationObservable]=i,e[d.NavigateObservable]=t,e[d.BrowserErrorObservable]=n,e[d.SelectionObservable]=o,e};return{name:r,type:"enrichment",setup:function(t,d){return(0,v.sH)(void 0,void 0,void 0,function(){var p,m,y,b,w;return(0,v.YH)(this,function(S){var E,I,_,k,T,C,x,P,A,O,R,N,L,M,D,H,U,F,j,q,B,z;return"undefined"==typeof document?[2]:(p=g(),s&&(m=function(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.clickObservable,s=n.selectionObservable,a=[],u={},l=null;function c(e){a=[],u={},e&&(r$(u,e),a.push(e))}var d=rt(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,v.sH)(t,void 0,void 0,function(){var t;return(0,v.YH)(this,function(r){var n,i,o,s;return(r$(u,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)||u.isOutOfBounds)?(l&&(t=rG(a)),c(e)):a.push(e),(l&&(clearTimeout(l.timerId),l.resolve(t),l=null),a.length>=4)?[2,new Promise(function(e){l={resolve:e,timerId:setTimeout(function(){e(rG(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:p,amplitude:d,shouldTrackRageClick:rv(e,a)}),n.push(m)),o&&(I=(E={amplitude:d,allObservables:p,getEventProperties:function(e,t){return h.getEventProperties(e,t,f)},shouldTrackDeadClick:rv(e,u)}).amplitude,_=E.allObservables,k=E.getEventProperties,T=E.shouldTrackDeadClick,C=_.clickObservable,x=_.mutationObservable,P=_.navigateObservable,A=C.filter(function(e){return rw(e)&&T("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===c.LEFT_OR_TOUCH_CONTACT}),O=P?rr(x,P):x,R=rr(A,O),N=null,y=rt(R,function(e){if(N&&rK.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};I.track("[Amplitude] Dead Click",(0,v.Cl)((0,v.Cl)({},k("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),n.push(y)),i&&(M=(L={amplitude:d,allObservables:p,shouldTrackErrorClick:rv(e,l)}).amplitude,D=L.allObservables,H=L.shouldTrackErrorClick,U=D.clickObservable,F=D.browserErrorObservable,j=U.filter(function(e){return rw(e)&&H("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===c.LEFT_OR_TOUCH_CONTACT}),q=null,B=null,z=function(){null!==q&&(clearTimeout(q),q=null),B=null},b=rr(j,F).subscribe(function(e){var t;if("click"===e.type){z(),B=e,q=setTimeout(z,2e3);return}"error"===e.type&&B&&(M.track("[Amplitude] Error Click",(0,v.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),B.targetElementProperties)),z())}),n.push(b)),null==(w=null==t?void 0:t.loggerProvider)||w.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r,i;return(0,v.YH)(this,function(o){try{for(t=(e=(0,v.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 rZ(e,t,r){e&&function e(t){var r,n,i=t.json,o=t.targetObject,s=t.allowlist,a=t.excludelist,u=t.ancestors,l=t.parentObject,c=t.targetKey;o||(o=i);var d=Object.keys(o);try{for(var f=(0,v.Ju)(d),h=f.next();!h.done;h=f.next()){var p,g=h.value,m=(0,v.fX)((0,v.fX)([],(0,v.zs)(u),!1),[g],!1);(p=o[g],"string"==typeof p||"number"==typeof p||"boolean"==typeof p||null==p)?(!r1(m,s)||r1(m,a))&&delete o[g]:e({json:i,targetObject:o[g],allowlist:s,excludelist:a,ancestors:m,parentObject:o,targetKey:g})}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}0===Object.keys(o).length&&l&&c&&delete l[c]}({json:e,allowlist:t.map(r0),excludelist:r.map(r0),ancestors:[]})}function r0(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function r1(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)})}var r2=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,v.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,v.Ju)(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=(0,v.zs)(s.value,2),u=a[0],l=a[1];i[u]=l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return r9(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=T();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=r4(t,100),this._bodySize}}
1,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,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(r){return 0===e.length?[2,null]:[2,r8(this.body,e,t)]})})},e}(),r3=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),r9(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return r4(this.bodyRaw,100)},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,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(r){return 0===e.length?[2,null]:[2,r8(this.body,e,t)]})})},e}();function r4(e,t){var r,n,i,o,s=T(),a=null==s?void 0:s.TextEncoder;if(a){if("string"==typeof e)o=e,i=new a().encode(o).length;else if(e instanceof Blob)i=(o=e).size;else if(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(e instanceof FormData){var u=0,l=0;try{for(var c=(0,v.Ju)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,v.zs)(d.value,2),h=f[0],p=f[1];if(u+=h.length,"string"==typeof p)u+=new a().encode(p).length;else{if(!(p instanceof Blob))return;u+=p.size}if(++l>=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=u}else if(e instanceof ReadableStream){o=e;return}return i}}var r6=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}),r9(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,v.sH)(this,void 0,void 0,function(){return(0,v.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,v.sH)(this,void 0,void 0,function(){return(0,v.YH)(this,function(r){switch(r.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,r8(r.sent(),e,t)]}})})},e}(),r5=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,v.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,v.zs)(a.split(": "),2),l=u[0],c=u[1];l&&c&&(n[l]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return r9(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,v.sH)(this,void 0,void 0,function(){var r;return(0,v.YH)(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?(rZ(r,e,t),[2,r]):[2,null]})})},e}();function r8(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return rZ(n,t,r),n}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(f||(f={}));var r7="[REDACTED]",r9=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?f.REMOVE:s,u=(0,v.fX)([],(0,v.zs)(es),!1),l={};try{for(var c=(0,v.Ju)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var h=d.value;!function(t){var r=t.toLowerCase();u.find(function(e){return e.toLowerCase()===r})?a===f.REDACT&&(l[t]=r7):o.find(function(e){return e.toLowerCase()===r})?l[t]=e[t]:a===f.REDACT&&(l[t]=r7)}(h)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return l},ne=function(){function e(e,t,r,n,i,o,s,a,u,l,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=u,this.error=l,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,v.fX)([],(0,v.zs)(eo),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(r=this.responseWrapper)?void 0:r.headers((0,v.fX)([],(0,v.zs)(eo),!1)),responseBodySize:null==(n=this.responseWrapper)?void 0:n.bodySize}).filter(function(e){var t=(0,v.zs)(e,2);return void 0!==(t[0],t[1])}))},e}(),nt=function(e,t){void 0===t&&(t=x()),this.callback=e,this.id=t},nr=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=T();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=T();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,i,o,s,a,u,l,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==(l=null==(u=this.globalScope)?void 0:u.XMLHttpRequest)?void 0:l.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){var n;try{r.callback(e)}catch(e){null==(n=t.logger)||n.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,u,l,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(u=t.url,d=t.method):u=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),u)try{var f=new URL(u);u="".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&&(l=n.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var h=Math.floor(performance.now()-s),p=Math.floor(o+h),g=new ne(e,d,o,o,u,r,l,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,v.sH)(t,void 0,void 0,function(){var t,i,o,s,a;return(0,v.YH)(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){null==(s=this.logger)||s.debug("an unexpected error occurred while retrieving timestamps",e)}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(r,n)];case 2:return i=u.sent(),[3,4];case 3:return o=u.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new r2(n):void 0,i?new r6(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null==(a=this.logger)||a.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,n;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&&(null==(n=t.logger)||n.error("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=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var s=(0,v.zs)(n,2),a=s[0],u=s[1];try{this.$$AmplitudeAnalyticsEvent=(0,v.Cl)({method:a,url:null==(e=null==u?void 0:u.toString)?void 0:e.call(u),headers:{}},o.getTimestamps())}catch(e){null==(r=o.logger)||r.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,n)},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],u=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",function(){var e;try{var t=i.getAllResponseHeaders(),r=i.getResponseHeader("content-length"),n=new r5(i.status,t,r?parseInt(r,10):void 0,s),l=i.$$AmplitudeAnalyticsEvent.headers,c=new r3(a,l);u.status=i.status,o.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(t){null==(e=o.logger)||e.error("an unexpected error occurred while handling xhr send",t)}}),r.apply(i,t)},i.setRequestHeader=function(e,t){var r;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null==(r=o.logger)||r.error("an unexpected error occurred while calling xhr setRequestHeader",e)}n.apply(this,[e,t])}}},e}()),nn="[Amplitude] Network Request",ni="500-599";function no(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function ns(e,t){var r,n,i=t.split(",");try{for(var o=(0,v.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,v.zs)(a.split("-").map(Number),2),l=u[0],c=u[1];if(e===l&&void 0===c||e>=l&&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 na(e){var t;if(e)try{var r=null==(t=T())?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),s=n.href,a=n.host;n.hash="",n.search="";var u=n.href;return{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:u,host:a}}catch(e){return}}function nu(e){return"object"!=typeof e||null===e?e?(0,v.fX)([],(0,v.zs)(eo),!1):void 0:0!==e.length?e:void 0}function nl(e){var t,r;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)}(h||(h={})).NetworkObservable="networkObservable";var nc=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new re(function(e){var r=new nt(function(t){var r={event:t,timestamp:Date.now(),type:"network"};e.next(r)});return nr.subscribe(r,t),function(){nr.unsubscribe(r)}});return(e={})[h.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return(0,v.sH)(void 0,void 0,void 0,function(){var s;return(0,v.YH)(this,function(a){var u,l,c,d,f;return"undefined"==typeof document?[2]:(s=n(),t=null==i?void 0:i.loggerProvider,l=(u={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,c=u.networkTrackingOptions,d=u.amplitude,f=u.loggerProvider,p=l.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var r,n,i=na(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(no(o,"*.amplitude.com")||no(o,"amplitude.com"))||(null==(r=t.ignoreHosts)?void 0:r.find(function(e){return no(o,e)})))&&(!!t.captureRules||void 0===e.status||!!ns(e.status,ni))&&(!t.captureRules||((0,v.fX)([],(0,v.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 no(t,e)}))&&(!n||!e.urls||rf(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!r&&0!==r||!!ns(r,e.statusCodeRange||ni))&&!0}(t,o,e.status,e.url,e.method)){var r=nu(t.responseHeaders);if(e.responseWrapper&&r){var i=e.responseWrapper.headers(r);i&&(e.responseHeaders=i)}var s=nu(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}e.responseWrapper&&t.responseBody&&!nl(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!nl(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}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===nn}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,r,n,i=e.event,o=na(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,v.sH)(this,void 0,void 0,function(){var i,o,s;return(0,v.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=v.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(nn,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,d,f)}}),null==t||t.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(e){return p.unsubscribe(),[2]})})}}};let nd=-1,nf=e=>{addEventListener("pageshow",t=>
vendor: 4,061 bytes, line 1
1{t.persisted&&(nd=t.timeStamp,e(t))},!0)},nh=(e,t,r,n)=>{let i,o;return s=>{t.value>=0&&(s||n)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},np=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ng=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},nv=()=>{let e=ng();return e?.activationStart??0},nm=(e,t=-1)=>{let r=ng(),n="navigate";return nd>=0?n="back-forward-cache":r&&(document.prerendering||nv()>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}},ny=new WeakMap;function nb(e,t){return ny.get(e)||ny.set(e,new t),ny.get(e)}class nw{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 nS=(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{}},nE=e=>{let t=!1;return()=>{t||(e(),t=!0)}},nI=-1,n_=new Set,nk=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,nT=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of n_)e();isFinite(nI)||(nI="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",nT,!0))}},nC=()=>{if(nI<0){let e=nv();nI=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??nk(),addEventListener("visibilitychange",nT,!0),addEventListener("prerenderingchange",nT,!0),nf(()=>{setTimeout(()=>{nI=nk()})})}return{get firstHiddenTime(){return nI},onHidden(e){n_.add(e)}}},nx=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},nP=[1800,3e3],nA=(e,t={})=>{nx(()=>{let r=nC(),n,i=nm("FCP"),o=nS("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-nv(),0),i.entries.push(t),n(!0)))});o&&(n=nh(e,i,nP,t.reportAllChanges),nf(r=>{n=nh(e,i=nm("FCP"),nP,t.reportAllChanges),np(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},nO=[.1,.25],nR=0,nN=1/0,nL=0,nM=e=>{for(let t of e)t.interactionId&&(nN=Math.min(nN,t.interactionId),nR=(nL=Math.max(nL,t.interactionId))?(nL-nN)/7+1:0)},nD=()=>n?nR:performance.interactionCount??0,nH=0;class nU{u=[];l=new Map;m;p;v(){nH=nD(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((nD()-nH)/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 nF=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=nE(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},nj=[200,500];class nq{m;h(e){this.m?.(e)}}let nB=[2500,4e3],nz=[800,1800],nY=e=>{document.prerendering?nx(()=>nY(e)):"complete"!==document.readyState?addEventListener("load",()=>nY(e),!0):setTimeout(e)};function nV(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)}}
1var nJ=function(){var e=null,t=T(),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,v.sH)(void 0,void 0,void 0,function(){var s,a;return(0,v.YH)(this,function(u){return void 0===r||(s=rh((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":rh((null==i?void 0:i.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":rh(s.split("?")[0],t.loggerProvider)},((e,t={})=>{nx(()=>{let r=nC(),n,i=nm("LCP"),o=nb(t,nq),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-nv(),0),i.entries=[s],n())},a=nS("largest-contentful-paint",s);if(a){n=nh(e,i,nB,t.reportAllChanges);let r=nE(()=>{s(a.takeRecords()),a.disconnect(),n(!0)}),o=e=>{e.isTrusted&&(nF(r),removeEventListener(e.type,o,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});nf(r=>{n=nh(e,i=nm("LCP"),nB,t.reportAllChanges),np(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})})(function(e){a["[Amplitude] LCP"]=nV(e)}),nA(function(e){a["[Amplitude] FCP"]=nV(e)}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let r=nC();nx(()=>{"interactionCount"in performance||n||(n=nS("event",nM,{type:"event",buffered:!0,durationThreshold:0}));let i,o=nm("INP"),s=nb(t,nU),a=e=>{nF(()=>{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())})},u=nS("event",a,{durationThreshold:t.durationThreshold??40});i=nh(e,o,nj,t.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),r.onHidden(()=>{a(u.takeRecords()),i(!0)}),nf(()=>{s.v(),i=nh(e,o=nm("INP"),nj,t.reportAllChanges)}))})})(function(e){a["[Amplitude] INP"]=nV(e)}),((e,t={})=>{let r=nC();nA(nE(()=>{let n,i=nm("CLS",0),o=nb(t,nw),s=e=>{for(let t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=nS("layout-shift",s);a&&(n=nh(e,i,nO,t.reportAllChanges),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),nf(()=>{o.i=0,n=nh(e,i=nm("CLS",0),nO,t.reportAllChanges),np(()=>n())}),setTimeout(n))}))})(function(e){a["[Amplitude] CLS"]=nV(e)}),((e,t={})=>{let r=nm("TTFB"),n=nh(e,r,nz,t.reportAllChanges);nY(()=>{let i=ng();i&&(r.value=Math.max(i.responseStart-nv(),0),r.entries=[i],n(!0),nf(()=>{(n=nh(e,r=nm("TTFB",0),nz,t.reportAllChanges))(!0)}))})})(function(e){a["[Amplitude] TTFB"]=nV(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,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){return e&&(null==r||r.removeEventListener("visibilitychange",e)),[2]})})}}},nW=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},nK=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},n$=function(e,t,r,n,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,s=(0,v.Tt)(e,["referrer","referring_domain"]),a=t||{},u=(a.referrer,a.referring_domain),l=(0,v.Tt)(a,["referrer","referring_domain"]);if(nG(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 c=JSON.stringify(s)!==JSON.stringify(l),d=nK(o||"")!==nK(u||""),f=!t||c||d;return f?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."),f},nG=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})},nX=function(e){var t=e;
1return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},nQ=function(){function e(e,t){var r;this.shouldTrackNewCampaign=!1,this.options=(0,v.Cl)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:nX(null==(r=t.cookieOptions)?void 0:r.domain)},e),this.storage=t.cookieStorage,this.storageKey=nW(t.apiKey,"MKTG"),this.webExpStorageKey=nW(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=ei,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,v.sH)(this,void 0,void 0,function(){var e,t;return(0,v.YH)(this,function(r){switch(r.label){case 0:return[4,this.fetchCampaign()];case 1:if(t=v.zs.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||ex(this.sessionTimeout,this.lastEventTime),!n$(this.currentCampaign,this.previousCampaign,this.options,this.logger,e))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,v.sH)(this,void 0,void 0,function(){var e;return(0,v.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 tx().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,e_(Object.entries((0,v.Cl)((0,v.Cl)({},ei),t)).reduce(function(e,t){var n,i=(0,v.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 eE)));return e&&(n.event_id=e),n},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),nZ="AMP_CURRENT_PAGE",n0="AMP_PREVIOUS_PAGE",n1="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(g||(g={}));var n2=new Set([u.IDENTIFY,u.GROUP_IDENTIFY,u.REVENUE]),n3=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=T(),i=void 0,o=!1,s=void 0,a=!1,u=!1,l=function(e){var t;try{var r=rh(e,s);t=new URL(r).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="undefined"!=typeof location&&location.hostname||"",n=e?l(e):void 0;if(!n)return g.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?g.Internal:g.External},d=function(){(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r,n,s;return(0,v.YH)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(n1)];case 1:return e=a.sent(),t=rh("undefined"!=typeof location&&location.href||""),r=(null==e?void 0:e[nZ])||"",n=void 0,n=t===r?(null==e?void 0:e[n0])||"":r||document.referrer||"",[4,i.set(n1,((s={})[nZ]=t,s[n0]=n,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(t){switch(t.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!n)return[3,2];return[4,(i=new e6(n.sessionStorage)).isEnabled()];case 1:o=t.sent(),n.addEventListener("popstate",d),a||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,v.zs)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),n.history.replaceState=new Proxy(n.history.replaceState,{apply:function(e,t,r){var n=(0,v.zs)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),a=!0),t.label=2;case 2:return[2]}})})},execute:function(e){return(0,v.sH)(void 0,void 0,void 0,function(){var t,r,n,s,a;return(0,v.YH)(this,function(u){switch(u.label){case 0:if(t=rh("undefined"!=typeof location&&location.href||""),!(i&&o))return[3,5];return[4,i.get(n1)];case 1:if(null==(r=u.sent())?void 0:r[nZ])return[3,3];return[4,i.set(n1,((a={})[nZ]=t,a[n0]=document.referrer||"",a))];case 2:u.sent(),u.label=3;case 3:return[4,i.get(n1)];case 4:if(n=u.sent(),s="",n&&(s=n[n0]||""),n2.has(e.event_type))return[2,e];e.event_properties=(0,v.Cl)((0,v.Cl)({},e.event_properties||{}),{"[Amplitude] Page Domain":n4(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":n4(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":n4(e,"[Amplitude] Page Path","undefined"!=typeof location&&rh(location.pathname)||""),"[Amplitude] Page Title":n4(e,"[Amplitude] Page Title",tC(tT)),"[Amplitude] Page URL":n4(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":s,"[Amplitude] Previous Page Type":c(s)}),u.label=5;case 5:return[2,e]}})})},teardown:function(){return(0,v.sH)(void 0,void 0,void 0,function(){return(0,v.YH)(this,function(e){switch(e.label){case 0:if(n&&(n.removeEventListener("popstate",d),u=!1),!(i&&o))return[3,2];return[4,i.set(n1,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function n4(e,t,r){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?r:e.event_properties[t]}var n6=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return(0,v.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),E(this._init((0,v.Cl)((0,v.Cl)({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o,s,a,u;return(0,v.sH)(this,void 0,void 0,function(){var l,c,d,f,h,p,g,m,y,b,w,S,E,I=this;return(0,v.YH)(this,function(k){var T,C,A,O,R,N,L;switch(k.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,l=tb(t),c=null!=(r=t.loggerProvider)?r:new _,d=null!=(n=t.serverZone)?n:"US",h=this._diagnosticsSampleRate,p=null==(i=t.enableDiagnostics)||i,!l)return[3,2];return f=new P(t.apiKey,c,d,null==(o=t.remoteConfig)?void 0:o.serverUrl),[4,new Promise(function(e){null==f||f.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(c.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)||(h=i);var o=t.enabled;"boolean"==typeof o&&(p=o)}e()})})];case 1:k.sent(),k.label=2;case 2:return(g=new j(t.apiKey,c,d,{enabled:p,sampleRate:h})).setTag("library","".concat(eK,"/").concat(eW)),"undefined"!=typeof navigator&&g.setTag("user_agent",navigator.userAgent),[4,(T=t.apiKey,C=t,A=this,O=g,R={loggerProvider:c,serverZone:d,enableDiagnostics:p,diagnosticsSampleRate:h},void 0===C&&(C={}),(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l,c,d,f,h,p,g,m,y,b,w,S,E,I,_,k,P,N,L,M,D,H,U,F,j,B,z,Y,V,J,W,K,$,G,X,Q,Z,ee,et,er,en;return(0,v.YH)(this,function(ei){var eo,es,ea;switch(ei.label){case 0:if(e=C.identityStorage||tv,E={},e===tv)return[3,1];return r="",[3,5];case 1:if(null==(_=null==(I=C.cookieOptions)?void 0:I.domain))return[3,2];return n=_,[3,4];case 2:return[4,(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,v.YH)(this,function(a){switch(a.label){case 0:return[4,new eX().isEnabled()];case 1:if(!a.sent()||"undefined"==typeof location||!location.hostname)return[2,""];for(e=(null!=eo?eo:location.hostname).split("."),t=[],r=x(),n="AMP_TLDTEST_".concat(r.substring(0,8)),i=e.length-2;i>=0;--i)t.push(e.slice(i).join("."));i=0,a.label=2;case 2:if(!(i<t.length))return[3,7];return[4,(s=new eX({domain:"."+(o=t[i]),expirationDays:.003})).set(n,1)];case 3:return a.sent(),[4,s.get(n)];case 4:if(!a.sent())return[3,6];return[4,s.remove(n)];case 5:return a.sent(),[2,"."+o];case 6:return i++,[3,2];case 7:return[2,""]}})})];case 3:n=ei.sent(),ei.label=4;case 4:r=n,ei.label=5;case 5:return t=v.Cl.apply(void 0,[(E.domain=r,E.expiration=365,E.sameSite="Lax",E.secure=!1,E.upgrade=!0,E),C.cookieOptions]),i={duplicateResolverFn:function(e){var r=e0(e);return!!r&&e1(JSON.parse(r).cookieDomain,t.domain)},diagnosticsClient:O},[4,(es=o=ty(C.identityStorage,t,i),void 0===(ea=null==(P=null==(k=C.cookieOptions)?void 0:k.upgrade)||P)&&(ea=!0),(0,v.sH)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u;return(0,v.YH)(this,function(l){switch(l.label){case 0:return e="".concat("amp","_").concat(T.substring(0,6)),[4,es.getRaw(e)];case 1:if(!(t=l.sent()))return[2,{optOut:!1}];if(!ea)return[3,3];
1return[4,es.remove(e)];case 2:l.sent(),l.label=3;case 3:return n=(r=(0,v.zs)(t.split("."),6))[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],[2,{deviceId:n,userId:tt(i),sessionId:te(s),lastEventId:te(u),lastEventTime:te(a),optOut:!!o}]}})}))];case 6:return s=ei.sent(),[4,o.get(e2(T))];case 7:return a=ei.sent(),c=!(l=(u=q()).ampTimestamp?Number(u.ampTimestamp):void 0)||Date.now()<l,d=null!=(H=null!=(D=null!=(M=null!=(N=C.deviceId)?N:c?null!=(L=u.ampDeviceId)?L:u.deviceId:void 0)?M:null==a?void 0:a.deviceId)?D:s.deviceId)?H:x(),f=null!=(U=null==a?void 0:a.lastEventId)?U:s.lastEventId,h=null!=(F=null==a?void 0:a.lastEventTime)?F:s.lastEventTime,p=null!=(B=null!=(j=C.optOut)?j:null==a?void 0:a.optOut)?B:s.optOut,g=null!=(z=null==a?void 0:a.sessionId)?z:s.sessionId,m=null!=(V=null!=(Y=C.userId)?Y:null==a?void 0:a.userId)?V:s.userId,A.previousSessionDeviceId=null!=(J=null==a?void 0:a.deviceId)?J:s.deviceId,A.previousSessionUserId=null!=(W=null==a?void 0:a.userId)?W:s.userId,y={ipAddress:null==($=null==(K=C.trackingOptions)?void 0:K.ipAddress)||$,language:null==(X=null==(G=C.trackingOptions)?void 0:G.language)||X,platform:null==(Z=null==(Q=C.trackingOptions)?void 0:Q.platform)||Z},b=null==a?void 0:a.pageCounter,w=null==a?void 0:a.debugLogsEnabled,void 0!==C.autocapture&&(C.defaultTracking=C.autocapture),[4,(S=new tm(T,C.appVersion,o,t,C.defaultTracking,C.autocapture,d,C.flushIntervalMillis,C.flushMaxRetries,C.flushQueueSize,e,C.ingestionMetadata,C.instanceName,f,h,null!=(ee=null==R?void 0:R.loggerProvider)?ee:C.loggerProvider,C.logLevel,C.minIdLength,C.offline,p,C.partnerId,C.plan,C.serverUrl,null!=(et=null==R?void 0:R.serverZone)?et:C.serverZone,g,C.sessionTimeout,C.storageProvider,y,C.transport,C.useBatch,C.fetchRemoteConfig,m,b,w,C.networkTrackingOptions,C.identify,null!=(er=null==R?void 0:R.enableDiagnostics)?er:C.enableDiagnostics,null!=(en=null==R?void 0:R.diagnosticsSampleRate)?en:A._diagnosticsSampleRate,O,C.remoteConfig)).storageProvider.isEnabled()];case 8:return ei.sent()||(S.loggerProvider.warn("Storage provider ".concat(S.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),S.storageProvider=new eG),[2,S]}})}))];case 3:if(m=k.sent(),!(l&&f))return[3,5];return[4,new Promise(function(e){null==f||f.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){if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var r,n,i,o,s,a,u,l,c,d,f,h=Object.keys(t);try{for(var p=(0,v.Ju)(h),g=p.next();!g.done;g=p.next()){var m=g.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{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}try{if(null==(c=null==(l=null==(u=t.autocapture)?void 0:u.networkTracking)?void 0:l.captureRules)?void 0:c.length)try{for(var b=(0,v.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,v.Ju)(["responseHeaders","requestHeaders"])),I=E.next();!I.done;I=E.next()){var _=I.value,k=null!=(d=S[_])?d:{},T=k.captureSafeHeaders,C=k.allowlist;if(T||C){if(void 0!==C&&!Array.isArray(C)){delete S[_];continue}S[_]=(0,v.fX)((0,v.fX)([],(0,v.zs)(T?eo:[]),!1),(0,v.zs)(null!=C?C:[]),!1)}}}catch(e){s={error:e}}finally{try{I&&!I.done&&(a=E.return)&&a.call(E)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}
1finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}catch(e){}var x=null==(f=t.autocapture)?void 0:f.frustrationInteractions;x&&(x.rageClick&&(x.rageClicks=x.rageClick,delete x.rageClick),x.deadClick&&(x.deadClicks=x.deadClick,delete x.deadClick))}}(e);try{var r,n,i,o,s,a,u;if(t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var l=(0,v.Cl)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(i=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:i.length)){l.elementInteractions=(0,v.Cl)({},e.autocapture.elementInteractions);var c=l.elementInteractions,d=null!=(o=c.pageUrlAllowlist)?o:[],f=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=tq(d,f,t),delete c.pageUrlAllowlistRegex}if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null==(s=e.autocapture.networkTracking.captureRules)?void 0:s.length)){l.networkTracking=(0,v.Cl)({},e.autocapture.networkTracking);var h=null!=(a=l.networkTracking.captureRules)?a:[];try{for(var p=(0,v.Ju)(h),g=p.next();!g.done;g=p.next()){var m=g.value;m.urls=tq(null!=(u=m.urls)?u:[],m.urlsRegex,t),delete m.urlsRegex}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=(0,v.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},l)),"object"==typeof t.autocapture&&(t.autocapture=(0,v.Cl)((0,v.Cl)({},t.autocapture),l))}t.defaultTracking=t.autocapture}t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}(t,m),e()})})];case 4:k.sent(),k.label=5;case 5:return[4,e.prototype._init.call(this,m)];case 6:if(k.sent(),this.logBrowserOptions(m),this.config.remoteConfigClient=f,!eR(this.config.defaultTracking))return[3,8];return y=eR((N=this.config).defaultTracking)&&N.defaultTracking&&"object"==typeof N.defaultTracking&&N.defaultTracking.attribution&&"object"==typeof N.defaultTracking.attribution?(0,v.Cl)({},N.defaultTracking.attribution):{},this.webAttribution=new nQ(y,this.config),[4,this.webAttribution.init()];case 7:k.sent(),k.label=8;case 8:if(S=!(!(w=(b=q()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<w)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),this.setSessionId(null!=(u=null!=(a=null!=(s=t.sessionId)?s:S)?a:this.config.sessionId)?u:Date.now()),(E=ea(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(tj()).promise];case 9:k.sent(),k.label=10;case 10:return[4,this.add(new ey({diagnosticsClient:g})).promise];case 11:return k.sent(),[4,this.add(new e$).promise];case 12:return k.sent(),[4,this.add(new eb).promise];case 13:if(k.sent(),tF(this.config),!eO(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(tH()).promise];case 14:k.sent(),k.label=15;case 15:if(!eN(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(tL()).promise];case 16:k.sent(),k.label=17;case 17:if(!eL(this.config.defaultTracking))return[3,19];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(tA(eB(this.config))).promise];case 18:k.sent(),k.label=19;case 19:if(!eH(this.config.autocapture))return[3,21];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(rV(eF(this.config),{diagnosticsClient:g})).promise];case 20:k.sent(),k.label=21;case 21:if(!eU(this.config.autocapture))return[3,23];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(rQ(ej(this.config))).promise];case 22:k.sent(),k.label=23;case 23:if(!eD(this.config.autocapture))return[3,25];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(nc(eq(this.config))).promise];case 24:k.sent(),k.label=25;case 25:if(!("boolean"==typeof(L=this.config.autocapture)?L:"object"==typeof L&&!0===L.webVitals))return[3,27];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(nJ()).promise];case 26:k.sent(),k.label=27;case 27:if(!eO(this.config.autocapture,"pageUrlEnrichment"))return[3,29];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(n3()).promise];case 28:k.sent(),k.label=29;case 29:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 30:return k.sent(),E.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=(0,v.Tt)(t,["time"]);I.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){if(!this.config)return void this.q.push(this.setUserId.bind(this,e));this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),eu(e,this.config.instanceName))},t.prototype.getDeviceId=function(){var e;return null==(e=this.config)?void 0:e.deviceId},t.prototype.setDeviceId=function(e){if(!this.config)return void this.q.push(this.setDeviceId.bind(this,e));this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),el(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(x()),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.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)),E(Promise.resolve());if(e===this.config.sessionId)return E(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,eM(this.config.defaultTracking)&&(n&&i&&r.push(this.track(ta,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(e_(this.config.identify)).promise),eM(this.config.defaultTracking)&&r.push(this.track(ts,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,E(Promise.all(r))},t.prototype.extendSession=function(){if(!this.config)return void this.q.push(this.extendSession.bind(this));
1this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(e){if(!this.config)return void this.q.push(this.setTransport.bind(this,e));this.config.transportProvider=tw(e)},t.prototype.identify=function(t,r){if(eV(t)){var n=t._q;t._q=[],t=eY(new eE,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(eV(n)){var o=n._q;n._q=[],n=eY(new eE,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(eV(t)){var n=t._q;t._q=[],t=eY(new eC,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)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,v.sH)(this,void 0,void 0,function(){var r,n,i;return(0,v.YH)(this,function(o){return r=Date.now(),n=ex(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==ts&&t.event_type!==ta&&(!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()),t.event_type===u.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,v.Cl)((0,v.Cl)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1)&&!(e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t}(eA),n5=function(){var e=new n6;return{init:S(e.init.bind(e),"init",y(e),w(e,["config"])),add:S(e.add.bind(e),"add",y(e),w(e,["config.apiKey","timeline.plugins"])),remove:S(e.remove.bind(e),"remove",y(e),w(e,["config.apiKey","timeline.plugins"])),track:S(e.track.bind(e),"track",y(e),w(e,["config.apiKey","timeline.queue.length"])),logEvent:S(e.logEvent.bind(e),"logEvent",y(e),w(e,["config.apiKey","timeline.queue.length"])),identify:S(e.identify.bind(e),"identify",y(e),w(e,["config.apiKey","timeline.queue.length"])),groupIdentify:S(e.groupIdentify.bind(e),"groupIdentify",y(e),w(e,["config.apiKey","timeline.queue.length"])),setGroup:S(e.setGroup.bind(e),"setGroup",y(e),w(e,["config.apiKey","timeline.queue.length"])),revenue:S(e.revenue.bind(e),"revenue",y(e),w(e,["config.apiKey","timeline.queue.length"])),flush:S(e.flush.bind(e),"flush",y(e),w(e,["config.apiKey","timeline.queue.length"])),getUserId:S(e.getUserId.bind(e),"getUserId",y(e),w(e,["config","config.userId"])),setUserId:S(e.setUserId.bind(e),"setUserId",y(e),w(e,["config","config.userId"])),getDeviceId:S(e.getDeviceId.bind(e),"getDeviceId",y(e),w(e,["config","config.deviceId"])),setDeviceId:S(e.setDeviceId.bind(e),"setDeviceId",y(e),w(e,["config","config.deviceId"])),reset:S(e.reset.bind(e),"reset",y(e),w(e,["config","config.userId","config.deviceId"])),getSessionId:S(e.getSessionId.bind(e),"getSessionId",y(e),w(e,["config"])),setSessionId:S(e.setSessionId.bind(e),"setSessionId",y(e),w(e,["config"])),extendSession:S(e.extendSession.bind(e),"extendSession",y(e),w(e,["config"])),setOptOut:S(e.setOptOut.bind(e),"setOptOut",y(e),w(e,["config"])),setTransport:S(e.setTransport.bind(e),"setTransport",y(e),w(e,["config"])),getIdentity:S(e.getIdentity.bind(e),"getIdentity",y(e),w(e,["config"])),getOptOut:S(e.getOptOut.bind(e),"getOptOut",y(e),w(e,["config"])),_setDiagnosticsSampleRate:S(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",y(e),w(e,["config"]))}};n5()},1029:(e,t,r)=>{"use strict";let n=r(1746),i=r(5459),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>
vendor: 21,072 bytes, line 1
10x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');let 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 u(e,t,r)}function u(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);let r=0|p(n,i),o=s(r),u=o.write(n,i);return u!==r&&(o=o.slice(0,u)),o}if(ArrayBuffer.isView(e)){var o=e;if(H(o,Uint8Array)){let e=new Uint8Array(o);return f(e.buffer,e.byteOffset,e.byteLength)}return d(o)}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(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(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');let u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return a.from(u,t,r);let l=function(e){if(a.isBuffer(e)){let 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(l)return l;if("undefined"!=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 l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),s(e<0?0:0|h(e))}function d(e){let t=e.length<0?0:0|h(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){let 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)||H(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);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return M(e).length;default:if(i)return n?-1:L(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let i=!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){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=U[e[n]];return i}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){let n="";r=Math.min(e.length,r);for(let 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){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":var o,s,a;return o=this,s=t,a=r,0===s&&a===o.length?n.fromByteArray(o):n.fromByteArray(o.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){let n=e.slice(t,r),i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function v(e,t,r){let 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){let o,s=1,a=e.length,u=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,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else -1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(l(e,o+n)!==l(t,n)){r=!1;break}if(r)return o}return -1}function b(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:(192&(r=e[i+1]))==128&&(u=(31&t)<<6|63&r)>127&&(o=u);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(u=(15&t)<<12|(63&r)<<6|63&n)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}var o=n;let s=o.length;if(s<=4096)return String.fromCharCode.apply(String,o);let a="",u=0;for(;u<s;)a+=String.fromCharCode.apply(String,o.slice(u,u+=4096));return a}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){A(t,n,i,e,r,7);let o=Number(t&BigInt(0xffffffff));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function I(e,t,r,n,i){A(t,n,i,e,r,7);let o=Number(t&BigInt(0xffffffff));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function _(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,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function T(e,t,r,n,o){return t*=1,r>>>=0,o||_(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{let 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||"undefined"==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 u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(l(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(H(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),H(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;let r=e.length,n=t.length;for(let 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){let r;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;let n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(H(t,Uint8Array))i+t.length>n.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(a.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)v(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let 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(){let 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(){let 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(H(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;let o=i-n,s=r-t,u=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r);for(let e=0;e<u;++e)if(l[e]!==c[e]){o=l[e],s=c[e];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){var i,o,s,a,u,l,c,d;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");let 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");let h=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;let s=t.length;for(n>s/2&&(n=s/2),i=0;i<n;++i){var a;let n=parseInt(t.substr(2*i,2),16);if((a=n)!=a)break;e[r+i]=n}return i}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,D(L(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return s=t,a=r,D(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,s,a);case"base64":return u=t,l=r,D(M(e),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,D(function(e,t){let r,n,i=[];for(let 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){let 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);let 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);let n=this[e],i=1,o=0;for(;++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);let n=this[e+--t],i=1;for(;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.readBigUInt64LE=F(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&R(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+0x1000000*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+0x1000000*r;return BigInt(n)+(BigInt(i)<<BigInt(32))}),a.prototype.readBigUInt64BE=F(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&R(e,this.length-8);let n=0x1000000*t+65536*this[++e]+256*this[++e]+this[++e],i=0x1000000*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);let n=this[e],i=1,o=0;for(;++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);let n=t,i=1,o=this[e+--n];for(;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);let 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);let 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.readBigInt64LE=F(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&R(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+0x1000000*this[++e])}),a.prototype.readBigInt64BE=F(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&R(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(0x1000000*this[++e]+65536*this[++e]+256*this[++e]+r)}),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){let n=Math.pow(2,8*r)-1;S(this,e,t,r,n,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;S(this,e,t,r,n,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&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.writeBigUInt64LE=F(function(e,t=0){return E(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=F(function(e,t=0){return I(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){let n=Math.pow(2,8*r-1);S(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){let n=Math.pow(2,8*r-1);S(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&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.writeBigInt64LE=F(function(e,t=0){return E(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=F(function(e,t=0){return I(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),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 T(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return T(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);let 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){let i;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){let t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}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{let o=a.isBuffer(e)?e:a.from(e,n),s=o.length;
1if(0===s)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};let C={};function x(e,t,r){C[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function P(e){let t="",r=e.length,n=+("-"===e[0]);for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function A(e,t,r,n,i,o){if(e>r||e<t){let n,i="bigint"==typeof t?"n":"";throw n=o>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new C.ERR_OUT_OF_RANGE("value",n,e)}O(i,"offset"),(void 0===n[i]||void 0===n[i+o])&&R(i,n.length-(o+1))}function O(e,t){if("number"!=typeof e)throw new C.ERR_INVALID_ARG_TYPE(t,"number",e)}function R(e,t,r){if(Math.floor(e)!==e)throw O(e,r),new C.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new C.ERR_BUFFER_OUT_OF_BOUNDS;throw new C.ERR_OUT_OF_RANGE(r||"offset",`>= ${+!!r} and <= ${t}`,e)}x("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),x("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),x("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?i=P(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=P(i)),i+="n"),n+=` It must be ${t}. Received ${i}`},RangeError);let N=/[^+/0-9A-Za-z-_]/g;function L(e,t){let r;t=t||1/0;let n=e.length,i=null,o=[];for(let 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 M(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function D(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let U=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function F(e){return"undefined"==typeof BigInt?j:e}function j(){throw Error("BigInt not supported")}},1410:(e,t,r)=>{"use strict";r.d(t,{aj:()=>e1});var n,i,o,s=r(1029).hp,a=function(e,t){return(a=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 u(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}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var l=function(){return(l=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 c(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function d(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(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function f(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 h(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 p(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;var g={IS:"is",IS_NOT:"is not",CONTAINS:"contains",DOES_NOT_CONTAIN:"does not contain",LESS_THAN:"less",LESS_THAN_EQUALS:"less or equal",GREATER_THAN:"greater",GREATER_THAN_EQUALS:"greater or equal",VERSION_LESS_THAN:"version less",VERSION_LESS_THAN_EQUALS:"version less or equal",VERSION_GREATER_THAN:"version greater",VERSION_GREATER_THAN_EQUALS:"version greater or equal",SET_IS:"set is",SET_IS_NOT:"set is not",SET_CONTAINS:"set contains",SET_DOES_NOT_CONTAIN:"set does not contain",SET_CONTAINS_ANY:"set contains any",SET_DOES_NOT_CONTAIN_ANY:"set does not contain any",REGEX_MATCH:"regex match",REGEX_DOES_NOT_MATCH:"regex does not match"},v=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var 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)},m=function(e,t){void 0===t&&(t=0);for(var r=v(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++)o=y(S(r,s<<2),o);var a=i<<2,u=0;switch(n-a){case 3:u^=r[a+2]<<16,u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=w(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=w(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=r[a],o^=u=Math.imul(u=w(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return b(o^=n)>>>0},y=function(e,t){var r=e,n=t;return n^=r=Math.imul(r=w(r=Math.imul(r,-0x3361d2af),15),0x1b873593),(n=Math.imul(n=w(n,13),5))+-0x19ab949c|0},b=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-0x7a143595),t^=t>>>13,t=Math.imul(t,-0x3d4d51cb),t^=t>>>16},w=function(e,t,r){void 0===r&&(r=32),t>r&&(t%=r);var n=(e&0xffffffff<<r-t>>>0)>>>0>>>r-t>>>0;return(e<<t|n)>>>0},S=function(e,t){return void 0===t&&(t=0),E(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},E=function(e){return(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24},I=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=f(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof 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}}if(null==e)return;return e}},_="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),k=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(_).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!(isNaN(n)||isNaN(i)))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(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},e}(),T=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=f(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=this.evaluateFlag(o,u);l&&(i[u.key]=l)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlag=function(e,t){try{for(var r,n,i,o=f(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var u=l(l(l({},t.metadata),a.metadata),i.metadata);i=l(l({},i),{metadata:u});break}}}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.prototype.evaluateSegment=function(e,t,r){if(!r.conditions){var n=this.bucket(e,r);return void 0!==n?t.variants[n]:void 0}if(this.evaluateConditions(e,r.conditions)){var n=this.bucket(e,r);if(void 0!==n)return t.variants[n]}},e.prototype.evaluateConditions=function(e,t){var r,n,i,o;try{for(var s=f(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=!0;try{for(var c=(i=void 0,f(u)),d=c.next();!d.done;d=c.next()){var h=d.value;if(!(l=this.matchCondition(e,h)))break}}catch(e){i={error:e}}
1finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}if(l)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=I(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)},e.prototype.getHash=function(e){return m(e)},e.prototype.bucket=function(e,t){if(!t.bucket)return t.variant;var r,n,i,o,s=this.coerceString(I(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),u=this.getHash(a),l=u%100,c=Math.floor(u/100);try{for(var d=f(t.bucket.allocations),h=d.next();!h.done;h=d.next()){var p=h.value,g=p.range[0],v=p.range[1];if(l>=g&&l<v)try{for(var m=(i=void 0,f(p.distributions)),y=m.next();!y.done;y=m.next()){var b=y.value,w=b.range[0],S=b.range[1];if(c>=w&&c<S)return b.variant}}catch(e){i={error:e}}finally{try{y&&!y.done&&(o=m.return)&&o.call(m)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case g.IS:case g.CONTAINS:case g.LESS_THAN:case g.LESS_THAN_EQUALS:case g.GREATER_THAN:case g.GREATER_THAN_EQUALS:case g.VERSION_LESS_THAN:case g.VERSION_LESS_THAN_EQUALS:case g.VERSION_GREATER_THAN:case g.VERSION_GREATER_THAN_EQUALS:case g.SET_IS:case g.SET_CONTAINS:case g.SET_CONTAINS_ANY:return r;case g.IS_NOT:case g.DOES_NOT_CONTAIN:case g.SET_DOES_NOT_CONTAIN:case g.SET_DOES_NOT_CONTAIN_ANY:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case g.SET_IS:return this.setEquals(e,r);case g.SET_IS_NOT:return!this.setEquals(e,r);case g.SET_CONTAINS:return this.matchesSetContainsAll(e,r);case g.SET_DOES_NOT_CONTAIN:return!this.matchesSetContainsAll(e,r);case g.SET_CONTAINS_ANY:return this.matchesSetContainsAny(e,r);case g.SET_DOES_NOT_CONTAIN_ANY:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case g.IS:return this.matchesIs(e,r);case g.IS_NOT:return!this.matchesIs(e,r);case g.CONTAINS:return this.matchesContains(e,r);case g.DOES_NOT_CONTAIN:return!this.matchesContains(e,r);case g.LESS_THAN:case g.LESS_THAN_EQUALS:case g.GREATER_THAN:case g.GREATER_THAN_EQUALS:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case g.VERSION_LESS_THAN:case g.VERSION_LESS_THAN_EQUALS:case g.VERSION_GREATER_THAN:case g.VERSION_GREATER_THAN_EQUALS:return this.matchesComparable(e,t,r,function(e){return k.parse(e)},this.versionComparator);case g.REGEX_MATCH:return this.matchesRegex(e,r);case g.REGEX_DOES_NOT_MATCH:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=f(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case g.LESS_THAN:case g.VERSION_LESS_THAN:return e<r;case g.LESS_THAN_EQUALS:case g.VERSION_LESS_THAN_EQUALS:return e<=r;case g.GREATER_THAN:case g.VERSION_GREATER_THAN:return e>r;case g.GREATER_THAN_EQUALS:case g.VERSION_GREATER_THAN_EQUALS:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case g.LESS_THAN:case g.VERSION_LESS_THAN:return n<0;case g.LESS_THAN_EQUALS:case g.VERSION_LESS_THAN_EQUALS:return n<=0;case g.GREATER_THAN:case g.VERSION_GREATER_THAN:return n>0;case g.GREATER_THAN_EQUALS:case g.VERSION_GREATER_THAN_EQUALS:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return!!new RegExp(t).exec(e)})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!=(t=Number(e))?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e)){var r=e;return r.map(function(e){return t.coerceString(e)}
1).filter(Boolean)}var n=String(e);try{var i=JSON.parse(n);if(Array.isArray(i)){var r=e;return r.map(function(e){return t.coerceString(e)}).filter(Boolean)}var o=this.coerceString(n);return o?[o]:void 0}catch(e){var o=this.coerceString(n);return o?[o]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case g.SET_IS:case g.SET_IS_NOT:case g.SET_CONTAINS:case g.SET_DOES_NOT_CONTAIN:case g.SET_CONTAINS_ANY:case g.SET_DOES_NOT_CONTAIN_ANY:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&p([],h(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=f(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,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},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=f(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}(),C=function(e,t){var r,n,i=l({},e),o=[],s=t||Object.keys(i);try{for(var a=f(s),u=a.next();!u.done;u=a.next()){var c=u.value,d=x(c,i);d&&o.push.apply(o,p([],h(d),!1))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},x=function(e,t,r){void 0===r&&(r=[]);var n,i,o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var s=[],a=function(e){if(r.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(r));var n=x(e,t,r);n&&s.push.apply(s,p([],h(n),!1))};try{for(var u=f(o.dependencies),l=u.next();!l.done;l=u.next()){var c=l.value;a(c)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return s.push(o),r.pop(),delete t[o.key],s}};let P="function"==typeof s,A="function"==typeof TextDecoder?new TextDecoder:void 0,O="function"==typeof TextEncoder?new TextEncoder:void 0,R=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),N=(e=>{let t={};return e.forEach((e,r)=>t[e]=r),t})(R),L=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,M=String.fromCharCode.bind(String),D="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),H=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),U=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),F="function"==typeof btoa?e=>btoa(e):P?e=>s.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+=R[(t=r<<16|n<<8|i)>>18&63]+R[t>>12&63]+R[t>>6&63]+R[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},j=P?e=>s.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(M.apply(null,e.subarray(r,r+4096)));return F(t.join(""))},q=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?M(192|t>>>6)+M(128|63&t):M(224|t>>>12&15)+M(128|t>>>6&63)+M(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return M(240|t>>>18&7)+M(128|t>>>12&63)+M(128|t>>>6&63)+M(128|63&t)},B=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,z=P?e=>s.from(e,"utf8").toString("base64"):O?e=>j(O.encode(e)):e=>F(e.replace(B,q)),Y=(e,t=!1)=>t?H(z(e)):z(e),V=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,J=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 M((t>>>10)+55296)+M((1023&t)+56320);case 3:return M((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return M((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},W="function"==typeof atob?e=>atob(U(e)):P?e=>s.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!L.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r="",n,i;for(let o=0;o<e.length;)t=N[e.charAt(o++)]<<18|N[e.charAt(o++)]<<12|(n=N[e.charAt(o++)])<<6|(i=N[e.charAt(o++)]),r+=64===n?M(t>>16&255):64===i?M(t>>16&255,t>>8&255):M(t>>16&255,t>>8&255,255&t);return r},K=P?e=>D(s.from(e,"base64")):e=>D(W(e).split("").map(e=>e.charCodeAt(0))),$=P?e=>s.from(e,"base64").toString("utf8"):A?e=>A.decode(K(e)):e=>W(e).replace(V,J),G={encodeURL:e=>Y(e,!0)};var X=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return u(t,e),t}(Error),Q=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return u(t,e),t}(Error),Z=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return c(this,void 0,void 0,function(){var r,n,i,o;return d(this,function(s){switch(s.label){case 0:return r=G.encodeURL(JSON.stringify(e)),n={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=G.encodeURL(JSON.stringify(t.flagKeys))),(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),i=new URL("".concat(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),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.t
1imeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new X(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),ee=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return c(this,void 0,void 0,function(){var t,r;return d(this,function(n){switch(n.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=G.encodeURL(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=n.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),et="undefined"!=typeof globalThis?globalThis:r.g||self,er=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==r.g?r.g:void 0},en=function(){var e=er();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1},ei=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=et.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(et.clearInterval(this.poller),this.poller=void 0)},e}(),eo=r(4605),es=r(6760);!function(){function e(e){this.amplitudeInstance=e}e.prototype.getUser=function(){var e,t,r,n,i,o,s,a,u,l;return{device_id:null==(t=null==(e=this.amplitudeInstance)?void 0:e.options)?void 0:t.deviceId,user_id:null==(n=null==(r=this.amplitudeInstance)?void 0:r.options)?void 0:n.userId,version:null==(o=null==(i=this.amplitudeInstance)?void 0:i.options)?void 0:o.versionName,language:null==(a=null==(s=this.amplitudeInstance)?void 0:s.options)?void 0:a.language,platform:null==(l=null==(u=this.amplitudeInstance)?void 0:u.options)?void 0:l.platform,os:this.getOs(),device_model:this.getDeviceModel()}},e.prototype.getOs=function(){var e,t,r,n,i,o;return[null==(r=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.browser)?void 0:r.name,null==(o=null==(i=null==(n=this.amplitudeInstance)?void 0:n._ua)?void 0:i.browser)?void 0:o.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(){var e,t,r;return null==(r=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.os)?void 0:r.name}}(),function(){function e(e){this.amplitudeInstance=e}e.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},e.prototype.setUserProperty=function(e){var t,r;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null==(r=e.variant)?void 0:r.value,t))},e.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:((t={})[e.userProperty]="-",t)})}}();var ea=function(){return(ea=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 eu(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function el(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(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function ec(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 ed(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 ef(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;var eh=function(e,t){void 0===t&&(t=!1);var r,n,i=ev(e,t),o=void 0,s=et.document.cookie.split("; ");try{for(var a=ec(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=ed(l.split("=",2),2),d=c[0],f=c[1];d===i&&(o=decodeURIComponent(f))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),g=void 0;return p.length>=2&&p[1]&&(g=atob(p[1])),{deviceId:p[0],userId:g}}catch(e){return}},ep=function(e){var t=ev(e,!0);try{var r=et.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},eg=function(e){var t=ev(e,!0);try{var r=et.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},ev=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},em=function(){function e(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)}return e.prototype.setup=function(e,t){return eu(this,void 0,void 0,function(){return el(this,function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=eh(this.apiKey,!0);return!!(e||(e=eh(this.apiKey,!1))||(e=ep(this.apiKey))||(e=eg(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return eu(this,void 0,void 0,function(){var t,r=this;return el(this,function(n){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)}),new Promise(function(t,r){et.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}(),ey=et.fetch||function(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],s=[],a={},u=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:u,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 l 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(u())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)})},eb=function(){function e(e){this.client=e}return e.prototype.request=function(e){return eu(this,void 0,void 0,function(){return el(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),ew={request:function(e,t,r,n,i){var o;return o=eu(void 0,void 0,void 0,function(){var i,o;return el(this,function(s){switch(s.label){case 0:return[4,ey(e,{method:t,headers:r,body:n})];case 1:return o={status:(i=s.sent()).status},[4,i.text()];case 2:return o.body=s.sent(),[2,o]}})}),null==i||i<=0?o:new Promise(function(e,t){et.setTimeout(function(){t(new Q("Request timeout after "+i+" milliseconds"))},i),o.then(e,t)})}};!function(e){e[e.Disable=0]="Disable",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose"}(n||(n={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(i||(i={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(o||(o={}));var eS=function(e){return!e||e===o.FallbackInline||e===o.FallbackConfig||e===o.SecondaryInitialVariants},eE={debug:!1,logLevel:n.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:i.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:ew},eI="1.20.3",e_=function(){function e(e,t){var r,n=this;this.isReady=new Promise(function(e){n.resolve=e}),this.config=e,this.client=t;var i=null!=(r=e.instanceName)?r:eE.instanceName;this.queue=new eT(i),this.cache=new ek(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Prom
1ise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e,t){if(this.cache.shouldTrack(e,t)){var r=this.getExposureEvent(e);this.queue.push(r)}},e.prototype.getExposureEvent=function(e){var t,r,n,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},e}(),ek=function(){function e(e){this.isSessionStorageAvailable=eC(),this.inMemoryCache={},this.identity={},this.storageKey="EXP_sent_v3_".concat(e),this.isSessionStorageAvailable&&(et.sessionStorage.removeItem("EXP_sent_".concat(e)),et.sessionStorage.removeItem("EXP_sent_v2_".concat(e)))}return e.prototype.shouldTrack=function(e,t){if((null==(r=e.metadata)?void 0:r.deliveryMethod)==="web")return!0;var r,n,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();var o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!=(n=e.variant)?n:null,u=!1;return o&&(null!=s?s:null)===a||(u=!0,this.inMemoryCache[e.flag_key]=a),this.storeCache(),u},e.prototype.clearCache=function(){this.inMemoryCache={},this.isSessionStorageAvailable&&et.sessionStorage.removeItem(this.storageKey)},e.prototype.identityEquals=function(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=et.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){if(this.isSessionStorageAvailable)try{et.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}},e}(),eT=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=en(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=et.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){if(this.tracker&&0!==this.inMemoryQueue.length){for(var e=0;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller&&(et.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=et.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),et.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),eC=function(){var e=er();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1},ex=function(){function e(e,t){void 0===t&&(t=n.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=n.Error&&(t=this.logger).error.apply(t,ef([e],ed(r),!1))},e.prototype.warn=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=n.Warn&&(t=this.logger).warn.apply(t,ef([e],ed(r),!1))},e.prototype.info=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=n.Info&&(t=this.logger).info.apply(t,ef([e],ed(r),!1))},e.prototype.debug=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=n.Debug&&(t=this.logger).debug.apply(t,ef([e],ed(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=n.Verbose&&(t=this.logger).verbose.apply(t,ef([e],ed(r),!1))},e}(),eP=function(){function e(){}return e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,ef([e],ed(t),!1))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,ef([e],ed(t),!1))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.info.apply(console,ef([e],ed(t),!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,ef([e],ed(t),!1))},e.prototype.verbose=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,ef([e],ed(t),!1))},e}(),eA=function(){function e(){this.globalScope=er()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null==(r=this.globalScope)||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.localStorage.removeItem(e)},e}(),eO=function(e,t,r){var n=e.substring(e.length-6);return new eM("amp-exp-".concat(t,"-").concat(n),r,eD)},eR=function(e,t,r){void 0===r&&(r=new eA);var n=e.substring(e.length-6);return new eM("amp-exp-".concat(t,"-").concat(n,"-flags"),r)},eN=function(e,t,r){void 0===r&&(r=new eA);var n=e.substring(e.length-6);return new eL("amp-exp-".concat(t,"-").concat(n,"-variants-options"),r)},eL=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),eM=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return ea({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=ec(Object.keys(e)),i=n.next();!i.done;i=n.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,n=this.storage.get(this.namespace);try{r=JSON.parse(n)||{}}catch(e){return}var i={};try{for(var o=ec(Object.keys(r)),s=o.next();!s.done;s=o.next()){var a=s.value;try{var u=void 0;(u=this.transformer?this.transformer(r[a]):r[a])&&(i[a]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),eD=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var 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);var 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}},eH=function(){function e(){this.globalScope=er()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null==(r=this.globalScope)||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.sessionStorage.removeItem(e)},e}(),eU=function(e,t,r,n){var i,o=null==r?void 0:r.value,s="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:s,properties:{key:t,variant:o,source:n},userProperties:((i={})[s]=o,i)}},eF=function(e){return null==e},ej=function(e){return!!eF(e)||e&&0===Object.keys(e).length},eq=function(e){if(!e||"object"!=typeof e)return{};var t,r,n={};try{for(var i=ec(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=ed(o.value,2),a=s[0],u=s[1];eF(u)||(n[a]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n},eB=function(e){var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"},ez=function(){function e(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}return e.prototype.start=function(e){return eu(this,void 0,void 0,function(){return el(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return eu(this,void 0,void 0,function(){var n=this;return el(this,function(i){return this.done||(this.timeoutHandle=et.setTimeout(function(){return eu(n,void 0,void 0,function(){var n,i;return el(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(n=t+1)<this.attempts&&(i=Math.min(r*this.scalar,this.max),this.backoff(e,n,i)
1),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),eY=function(e){if(!e)return{};var t,r,n,i,o={user:e},s=er();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var u=ec(Object.keys(e.groups)),l=u.next();!l.done;l=u.next()){var c=l.value,d=e.groups[c];if(d.length>0&&d[0]){var f=d[0],h={group_name:f},p=null==(i=null==(n=e.group_properties)?void 0:n[c])?void 0:i[f];p&&Object.keys(p).length>0&&(h.group_properties=p),a[c]=h}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(o.groups=a),delete o.user.groups,delete o.user.group_properties,o},eV=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},eJ=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var 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},eW=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),eK=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var 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;var 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))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),e$=function(){function e(t,r){var n,i,o,s,a,u=this;this.engine=new T,this.isRunning=!1,this.apiKey=t,r=eq(r),this.config=ea(ea(ea({},eE),r),{serverUrl:(null==r?void 0:r.serverUrl)||((null==(n=null==r?void 0:r.serverZone)?void 0:n.toLowerCase())==="eu"?"https://api.lab.eu.amplitude.com":eE.serverUrl),flagsServerUrl:(null==r?void 0:r.flagsServerUrl)||((null==(i=null==r?void 0:r.serverZone)?void 0:i.toLowerCase())==="eu"?"https://flag.lab.eu.amplitude.com":eE.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!=(o=r.flagConfigPollingIntervalMillis)?o:eE.flagConfigPollingIntervalMillis}),this.logger=new ex(this.config.loggerProvider||new eP,e.getLogLevel(r));var l=null==(s=this.config)?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new ei(function(){return u.doFlags()},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var c in this.config.initialVariants)this.config.initialVariants[c]=eD(this.config.initialVariants[c]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new eW(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new eK(this.config.exposureTrackingProvider)),this.integrationManager=new e_(this.config,this);var d=new eb(this.config.httpClient||ew);this.flagApi=new ee(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new Z(this.apiKey,this.config.serverUrl,d);var f=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;a=this.isWebExperiment?new eH:new eA,this.variants=eO(this.apiKey,f,a),this.flags=eR(this.apiKey,f,a),this.fetchVariantsOptions=eN(this.apiKey,f,a);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return eu(this,void 0,void 0,function(){var t,r,n;return el(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:if(i.trys.push([1,6,,7]),t=this.doFlags(),!(null==(n=this.config.fetchOnStart)||n))return[3,3];return[4,Promise.all([this.fetch(e),t])];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(r=i.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return eu(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),el(this,function(n){switch(n.label){case 0:this.setUser(e||{}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return n.sent(),[3,4];case 3:if(r=n.sent(),this.config.throwOnError)throw r;return r instanceof Q?this.logger.debug(r):this.logger.error(r),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){if(!this.apiKey)return{value:void 0};var r,n,i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null==(r=i.variant)?void 0:r.key)||(null==(n=i.variant)?void 0:n.value))),i.variant||{}}
1,e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e)eB(this.flags.get(t))||delete e[t];return ea(ea(ea({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){if(!this.user)return this.user;if(null==(e=this.user)||!e.user_properties)return ea({},this.user);var e,t=ea({},this.user.user_properties);return ea(ea({},this.user),{user_properties:t})},e.prototype.setUser=function(e){var t;if(!e){this.user=null;return}if(null==(t=this.user)?void 0:t.user_properties){var r=ea({},e.user_properties);this.user=ea(ea({},e),{user_properties:r})}else this.user=ea({},e)},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,r,n=this.addContext(this.user),i=C(this.flags.getAll(),e),o=eY(n),s=this.engine.evaluate(o,i),a={};try{for(var u=ec(Object.keys(s)),l=u.next();!l.done;l=u.next()){var c=l.value;a[c]=eJ(s[c])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return a},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===i.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===i.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(eB(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var n,i={},s=this.evaluate([t.key])[e],a=o.LocalEvaluation,u=null==(n=null==s?void 0:s.metadata)?void 0:n.default;if(!eF(s)&&!u)return{variant:eV(s),source:a,hasDefaultVariant:!1};if(u&&(i={variant:eV(s),source:a,hasDefaultVariant:!0}),!eF(r))return{variant:eV(r),source:o.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var l=this.config.initialVariants[e];if(!eF(l))return{variant:eV(l),source:o.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var c=eV(this.config.fallbackVariant),d={variant:c,source:o.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return ej(c)?i:d},e.prototype.localStorageVariantAndSource=function(e,t){var r,n={},i=this.variants.get(e),s=null==(r=null==i?void 0:i.metadata)?void 0:r.default;if(!eF(i)&&!s)return{variant:eV(i),source:o.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:eV(i),source:o.LocalStorage,hasDefaultVariant:!0}),!eF(t))return{variant:eV(t),source:o.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=this.config.initialVariants[e];if(!eF(a))return{variant:eV(a),source:o.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var u=eV(this.config.fallbackVariant),l={variant:u,source:o.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ej(u)?n:l},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!eF(i))return{variant:eV(i),source:o.InitialVariants,hasDefaultVariant:!1};var s=this.variants.get(e),a=null==(r=null==s?void 0:s.metadata)?void 0:r.default;if(!eF(s)&&!a)return{variant:eV(s),source:o.LocalStorage,hasDefaultVariant:!1};if(a&&(n={variant:eV(s),source:o.LocalStorage,hasDefaultVariant:!0}),!eF(t))return{variant:eV(t),source:o.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var u=eV(this.config.fallbackVariant),l={variant:u,source:o.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return ej(u)?n:l},e.prototype.fetchInternal=function(e,t,r,n){return eu(this,void 0,void 0,function(){var i,o,s;return el(this,function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,ea({trackingOption:null==(s=this.fetchVariantsOptions.get())?void 0:s.trackingOption},n))];case 2:return i=a.sent(),[4,this.storeVariants(i,n)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,n),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return eu(this,void 0,void 0,function(){return el(this,function(t){return this.fetchVariantsOptions.put(ea(ea({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"}
1)),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=ea({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return eu(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return el(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,ea({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(s=(o=ec(Object.keys(n))).next();!s.done;s=o.next())i[a=s.value]=eJ(n[a])}catch(e){u={error:e}}finally{try{s&&!s.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.logger.debug("[Experiment] Received variants: ",i),[2,i]}})})},e.prototype.doFlags=function(){return eu(this,void 0,void 0,function(){var e,t,r;return el(this,function(n){switch(n.label){case 0:if(n.trys.push([0,4,,5]),e=void 0,!this.isWebExperiment)return[3,2];return[4,this.addContextOrWait(this.getUser())];case 1:e=n.sent(),n.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:eI,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})];case 3:return t=n.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if((r=n.sent())instanceof Q){if(this.logger.debug(r),this.config.throwOnError)throw r}else throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return eu(this,void 0,void 0,function(){var r,n,i,o;return el(this,function(s){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),n=function(t){r=r.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)n(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return eu(this,void 0,void 0,function(){var r=this;return el(this,function(n){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new ez(8,500,1e4,1.5),this.retriesBackoff.start(function(){return eu(r,void 0,void 0,function(){return el(this,function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null==(t=this.userProvider)?void 0:t.getUser(),n=this.integrationManager.getUser(),i=ea(ea(ea({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return ea(ea(ea(ea({library:"experiment-js-client/".concat(eI)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return eu(this,void 0,void 0,function(){return el(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==i.LocalStorage?this.variants.getAll():this.config.source==i.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==i.LocalStorage?this.config.initialVariants:this.config.source==i.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){if(null==(i=null==(n=null==(r=t.variant)?void 0:r.metadata)?void 0:n.trackExposure)||i){this.legacyExposureInternal(e,t.variant,t.source);var r,n,i,o,s,a,u,l,c,d={flag_key:e},f=eS(t.source);if(!f||t.hasDefaultVariant){(null==(o=t.variant)?void 0:o.expKey)&&(d.experiment_key=null==(s=t.variant)?void 0:s.expKey);var h=null==(a=t.variant)?void 0:a.metadata;if(f||(null==h?void 0:h.default)||((null==(u=t.variant)?void 0:u.key)?d.variant=t.variant.key:(null==(l=t.variant)?void 0:l.value)&&(d.variant=t.variant.value)),h&&(d.metadata=h),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){var p=er();if(null==p?void 0:p.location)try{var g=p.location.href;d.metadata.url=g.split("?")[0]||""}catch(e){}}var v=this.addContext(this.getUser());null==(c=this.userSessionExposureTracker)||c.track(d,v),this.integrationManager.track(d,v)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,s,a;if(this.analyticsProvider){var u=eU(this.addContext(this.getUser()),e,t,r);!eS(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,u),null==(a=this.analyticsProvider)||a.track(u)):null==(i=null==(n=this.analyticsProvider)?void 0:n.unsetUserProperty)||i.call(n,u)}},e.getLogLevel=function(e){var t;return!0===e.debug?n.Debug:null!=(t=e.logLevel)?t:n.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof X)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}
1,e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),eG=function(){function e(e,t){var r,n,i;this.globalScope=er(),this.userAgent=void 0!==(null==(r=this.globalScope)?void 0:r.navigator)?null==(n=this.globalScope)?void 0:n.navigator.userAgent:void 0,this.ua=new es.UAParser(this.userAgent).getResult(),this.localStorage=new eA,this.sessionStorage=new eH,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null==(i=this.apiKey)?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,n,i,o=(null==(e=this.userProvider)?void 0:e.getUser())||{};return ea({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)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null==(t=e.browser)?void 0:t.name,null==(r=e.browser)?void 0:r.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null==(t=e.os)?void 0:t.name},e.prototype.getBrowser=function(e){var t,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},e.prototype.getCookie=function(){var e,t,r,n,i;if(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(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null==(t=null==(e=this.globalScope)?void 0:e.location)?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var 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}},e.prototype.getUrlParam=function(){if(this.globalScope){var e,t,r,n={};try{var i=new URL(this.globalScope.location.href);try{for(var o=ec(i.searchParams),s=o.next();!s.done;s=o.next()){var a=ed(s.value,2),u=a[0],l=a[1];n[u]=ef(ef([],ed(null!=(r=n[u])?r:[]),!1),ed(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(n).reduce(function(e,t){var r=ed(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e},{})}},e}();et.experimentInstances={};var eX=et.experimentInstances,eQ=function(e){return(null==e?void 0:e.instanceName)||eE.instanceName},eZ=function(e,t){var r=eQ(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e)},e0=function(e,t,r){var n=eZ(e,t),i=eX[n];return i?i:(i=new e$(e,ea(ea({},t),{userProvider:new eG(null==t?void 0:t.userProvider,e)})),r&&i.addPlugin(r()),eX[n]=i,i)},e1={initialize:function(e,t){return e0(e,t)},initializeWithAmplitudeAnalytics:function(e,t){return e0(e,t,function(){return new em(e,eo.i.getInstance(eQ(t)),1e4)})}};!function(){function e(){}e.prototype.getUser=function(){return{}},e.prototype.start=function(e){return eu(this,void 0,void 0,function(){return el(this,function(e){return[2]})})},e.prototype.stop=function(){},e.prototype.setUser=function(e){},e.prototype.fetch=function(e,t){return eu(this,void 0,void 0,function(){return el(this,function(e){return[2,this]})})},e.prototype.getUserProvider=function(){return null},e.prototype.setUserProvider=function(e){return this},e.prototype.variant=function(e,t){return eE.fallbackVariant},e.prototype.all=function(){return{}},e.prototype.clear=function(){}
1,e.prototype.exposure=function(e){}}()},1450:(e,t,r)=>{"use strict";r.d(t,{C6:()=>i,Cl:()=>o,Ju:()=>l,Tt:()=>s,YH:()=>u,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{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function u(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(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function l(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))}Object.create;Object.create,"function"==typeof SuppressedError&&SuppressedError},1746:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=u(e),s=o[0],a=o[1],l=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)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},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="undefined"!=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 u(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},3899:(e,t,r)=>{"use strict";let n,i;r.d(t,{P2:()=>f});let o=(e,t)=>t.some(t=>e instanceof t),s=new WeakMap,a=new WeakMap,u=new WeakMap,l={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return s.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return c(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function c(e){if(e instanceof IDBRequest){let t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(c(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",o)});return u.set(t,e),t}if(a.has(e))return a.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(d(this),t),c(this.request)}:function(...t){return c(e.apply(d(this),t))};return(e instanceof IDBTransaction&&function(e){if(s.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)});s.set(e,t)}(e),o(e,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,l):e}(e);return t!==e&&(a.set(e,t),u.set(t,e)),t}let d=e=>u.get(e);function f(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){let s=indexedDB.open(e,t),a=c(s);return n&&s.addEventListener("upgradeneeded",e=>{n(c(s.result),e.oldVersion,e.newVersion,c(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 h=["get","getKey","getAll","getAllKeys","count"],p=["put","add","delete","clear"],g=new Map;function v(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(g.get(t))return g.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,i=p.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||h.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 g.set(t,o),o}l=(e=>({...e,get:(t,r,n)=>v(t,r)||e.get(t,r,n),has:(t,r)=>!!v(t,r)||e.has(t,r)}))(l);let m=["continue","continuePrimaryKey","advance"],y={},b=new WeakMap,w=new WeakMap,S={get(e,t){if(!m.includes(t))return e[t];let r=y[t];return r||(r=y[t]=function(...e){b.set(this,w.get(this)[t](...e))}),r}};async function*E(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let r=new Proxy(t,S);for(w.set(r,t),u.set(r,d(t));t;)yield r,t=await (b.get(r)||t.continue()),b.delete(r)}function I(e,t){return t===Symbol.asyncIterator&&o(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&o(e,[IDBIndex,IDBObjectStore])}l=(e=>({...e,get:(t,r,n)=>I(t,r)?E:e.get(t,r,n),has:(t,r)=>I(t,r)||e.has(t,r)}))(l)},4605:(e,t,r)=>{"use strict";r.d(t,{i:()=>l});class n{getApplicationContext(){return{versionName:this.versionName,language:i(),platform:"Web",os:void 0,deviceModel:void 0}}}let i=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class o{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 s=(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;
1if(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(!s(e[r],t[r]))return!1}else{if(!s(Object.keys(e).sort(),Object.keys(t).sort()))return!1;let r=!0;return Object.keys(e).forEach(n=>{s(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 a{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({},e),s(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}let u="undefined"!=typeof globalThis?globalThis:void 0!==r.g?r.g:self;class l{constructor(){this.identityStore=new a,this.eventBridge=new o,this.applicationContextProvider=new n}static getInstance(e){return u.analyticsConnectorInstances||(u.analyticsConnectorInstances={}),u.analyticsConnectorInstances[e]||(u.analyticsConnectorInstances[e]=new l),u.analyticsConnectorInstances[e]}}},5459:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,l=u>>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-l;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=l}return(h?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,l=8*o-i-1,c=(1<<l)-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*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+d>=1?t+=f/u:t+=f*Math.pow(2,1-d),t*u>=2&&(s++,u/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*u-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,l+=i;l>0;e[r+h]=255&s,h+=p,s/=256,l-=8);e[r+h-p]|=128*g}},6242:(e,t,r)=>{"use strict";r.d(t,{jO:()=>tM});var n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y=r(1450);!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(n||(n={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var b=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==r.g?r.g:void 0};!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(o||(o={}));var w=function(e,t,r,n,i){return void 0===i&&(i=null),function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];var u=r(),l=u.logger,c=u.logLevel;if(c&&c<o.Debug||!c||!l)return e.apply(i,s);var d={type:"invoke public method",name:t,args:s,stacktrace:(Error().stack||"").split("\n").slice(3).map(function(e){return e.trim()}),time:{start:new Date().toISOString()},states:{}};n&&d.states&&(d.states.before=n());var f=e.apply(i,s);return f&&f.promise?f.promise.then(function(){n&&d.states&&(d.states.after=n()),d.time&&(d.time.end=new Date().toISOString()),l.debug(JSON.stringify(d,null,2))}):(n&&d.states&&(d.states.after=n()),d.time&&(d.time.end=new Date().toISOString()),l.debug(JSON.stringify(d,null,2))),f}},S="Amplitude Logger ",E=function(){function e(){this.logLevel=o.None}return e.prototype.disable=function(){this.logLevel=o.None},e.prototype.enable=function(e){void 0===e&&(e=o.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Verbose||console.log("".concat(S,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Warn||console.warn("".concat(S,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Error||console.error("".concat(S,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Debug||console.log("".concat(S,"[Debug]: ").concat(e.join(" ")))},e}();!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(s||(s={}));var I=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,a,u,l,c,d,f,h,p,g,v,m,y,b,w,S,E,I,_=e.code||0,k=this.buildStatus(_);switch(k){case s.Success:return{status:k,statusCode:_,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 s.Invalid:return{status:k,statusCode:_,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(a=e.events_with_invali
1d_fields)?a:{},eventsWithMissingFields:null!=(u=e.events_with_missing_fields)?u:{},eventsWithInvalidIdLengths:null!=(l=e.events_with_invalid_id_lengths)?l:{},epsThreshold:null!=(c=e.eps_threshold)?c:0,exceededDailyQuotaDevices:null!=(d=e.exceeded_daily_quota_devices)?d:{},silencedDevices:null!=(f=e.silenced_devices)?f:[],silencedEvents:null!=(h=e.silenced_events)?h:[],throttledDevices:null!=(p=e.throttled_devices)?p:{},throttledEvents:null!=(g=e.throttled_events)?g:[]}};case s.PayloadTooLarge:return{status:k,statusCode:_,body:{error:null!=(v=e.error)?v:""}};case s.RateLimit:return{status:k,statusCode:_,body:{error:null!=(m=e.error)?m:"",epsThreshold:null!=(y=e.eps_threshold)?y:0,throttledDevices:null!=(b=e.throttled_devices)?b:{},throttledUsers:null!=(w=e.throttled_users)?w:{},exceededDailyQuotaDevices:null!=(S=e.exceeded_daily_quota_devices)?S:{},exceededDailyQuotaUsers:null!=(E=e.exceeded_daily_quota_users)?E:{},throttledEvents:null!=(I=e.throttled_events)?I:[]}};case s.Timeout:default:return{status:k,statusCode:_}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?s.Success:429===e?s.RateLimit:413===e?s.PayloadTooLarge:408===e?s.Timeout:e>=400&&e<500?s.Invalid:e>=500?s.Failed:s.Unknown},e}(),_=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,y.C6)(t,e),t.prototype.send=function(e,t){return(0,y.sH)(this,void 0,void 0,function(){var r,n;return(0,y.YH)(this,function(i){switch(i.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,y.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}(I),k="$default_instance",T="https://api2.amplitude.com/2/httpapi",C=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:k,logLevel:o.Warn,loggerProvider:new E,offline:!1,optOut:!1,serverUrl:T,serverZone:"US",useBatch:!1}},x=function(){function e(e){this._optOut=!1;var t,r,n,i,o=C();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=P(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}(),P=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=C().serverZone),void 0===r&&(r=C().useBatch),e)return{serverUrl:e,serverZone:void 0};var n,i=["US","EU"].includes(t)?t:C().serverZone;return{serverZone:i,serverUrl:(n=r,"EU"===i?n?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":n?"https://api2.amplitude.com/batch":T)}};(function(){this.sdk={metrics:{histogram:{}}}}).prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(a||(a={}));var A="[Amplitude]",O="".concat(A," Session Replay ID"),R=a.US,N={enabled:!0},L="".concat(A," Session Replay Debug"),M="amp-mask",D="amp-unmask",H="https://api-sr.amplitude.com/sessions/v2/track",U="https://api-sr.eu.amplitude.com/sessions/v2/track",F="https://api-sr.stag2.amplitude.com/sessions/v2/track",j=/payload.*exceed/i,q="amplitude-sr-iframe";!function(e){e.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"}(u||(u={}));var B=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}(),z=r(8334),Y="medium",V=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 V(e,Y,r)}},J=function(e,t){if(e&&t.urlMaskLevels)try{for(var r,n,i,o=(0,y.Ju)(t.urlMaskLevels),s=o.next();!s.done;s=o.next()){var a=s.value;if(X(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:Y},W=function(e,t,r,n){var i,o;if(void 0===t&&(t={defaultMaskLevel:Y}),r){if(r.closest("."+M)||(null!=(i=t.maskSelector)?i:[]).some(function(e){return r.closest(e)}))return!0;
1if(r.closest("."+D)||(null!=(o=t.unmaskSelector)?o:[]).some(function(e){return r.closest(e)}))return!1}return V(e,J(n,t),r)},K=function(e,t,r){return function(n,i){return W(e,t,i,null==r?void 0:r())?n.replace(/[^\s]/g,"*"):n}},$=function(){var e=(0,z.m)();return(null==e?void 0:e.location)?e.location.href:""},G=new Map,X=function(e){var t=G.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 u=new RegExp("^".concat(a,"$"));return G.set(e,u),u},Q=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")},Z=function(e,t){var r,n;try{for(var i=(0,y.Ju)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=X(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},ee=function(){return(0,y.sH)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,y.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,z.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:""}]}})})},et=function(e){var t=(0,y.Cl)({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},er=function(){return{flushMaxRetries:2,logLevel:o.Warn,loggerProvider:new E,transportProvider:new _}},en=function(e){function t(t,r){var n,i,o,s,a,u,l,c,d,f,h=this,p=er();return(h=e.call(this,(0,y.Cl)((0,y.Cl)({transportProvider:p.transportProvider,loggerProvider:new B(r.loggerProvider||p.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=p.flushMaxRetries?r.flushMaxRetries:p.flushMaxRetries,h.apiKey=t,h.sampleRate=r.sampleRate||0,h.serverZone=r.serverZone||R,h.configServerUrl=r.configServerUrl,h.trackServerUrl=r.trackServerUrl,h.shouldInlineStylesheet=r.shouldInlineStylesheet,h.version=r.version,h.performanceConfig=r.performanceConfig||N,h.storeType=null!=(n=r.storeType)?n:"memory",h.applyBackgroundColorToBlockedElements=null!=(i=r.applyBackgroundColorToBlockedElements)&&i,h.enableUrlChangePolling=null!=(o=r.enableUrlChangePolling)&&o,h.urlChangePollingInterval=null!=(s=r.urlChangePollingInterval)?s:1e3,h.captureDocumentTitle=null!=(a=r.captureDocumentTitle)&&a,void 0!==r.fullSnapshotIntervalMs&&(h.fullSnapshotIntervalMs=r.fullSnapshotIntervalMs),h.privacyConfig=(0,y.Cl)((0,y.Cl)({},null!=(u=r.privacyConfig)?u:{}),{unmaskSelector:Array.from(new Set((0,y.fX)([".".concat(D)],(0,y.zs)(null!=(c=null==(l=r.privacyConfig)?void 0:l.unmaskSelector)?c:[]),!1)))}),r.interactionConfig&&(h.interactionConfig=r.interactionConfig,h.interactionConfig.ugcFilterRules&&Q(h.interactionConfig.ugcFilterRules)),r.debugMode&&(h.debugMode=r.debugMode),void 0!==r.useWebWorker?h.useWebWorker=r.useWebWorker:(null==(d=r.experimental)?void 0:d.useWebWorker)!==void 0&&(h.useWebWorker=r.experimental.useWebWorker),h.captureAdoptedStyleSheets=null==(f=r.captureAdoptedStyleSheets)||f,r.crossOriginIframes&&(h.crossOriginIframes=r.crossOriginIframes),r.flushIntervalConfig&&(h.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,h.loggerProvider)),h}return(0,y.C6)(t,e),t}(x);!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(l||(l={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(c||(c={}));var ei=function(e){return{promise:e||Promise.resolve()}},eo="https://app.amplitude.com",es={US:eo,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},ea="__AMPLITUDE_MESSENGER_INSTANCE__",eu="__AMPLITUDE_MESSENGER__",el=function(){function e(e){var t=(void 0===e?{}:e).origin;this[d]=!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?eo: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,y.Ju)(s),u=a.next();!u.done;u=a.next()){var l=u.value;t(l)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return(0,y.sH)(this,void 0,void 0,function(){var t,r,n;return(0,y.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===eo&&(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,u=null==a?void 0:a.action;if(u)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"===u)return void n.notify({action:"pong"});var l=n.actionHandlers.get(u);if(l)l(a.data);else{var c=null!=(s=n.pendingMessages.get(u))?s:[];c.push(a.data),n.pendingMessages.set(u,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,z.m)();(null==e?void 0:e[eu])===this&&delete e[eu]},e}();d=ea;var ec="__AMPLITUDE_BACKGROUND_CAPTURE__",ed=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},ef=r(4605),eh=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(eh||{}),ep=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ep||{}),eg=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(eg||{}),ev=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ev||{}),em=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(em||{}),ey=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ey||{}),eb=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e.SeekStart="seek-start",e.SeekEnd="seek-end",e))(eb||{}),ew=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ew||{}),eS=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}(),eE=(0,y.fX)([],(0,y.zs)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),eI=function(e){var t,r=(0,z.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,eI);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,(0,y.fX)([],(0,y.zs)(n.entries()),!1).map(function(e){var t=(0,y.zs)(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(eE[n]):eE[n]}).join("")}
1,e_={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},ek=function(){function e(e,t,r,n){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!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 eS(e,t)}return e.prototype.subscribe=function(e,t,r){var n=eI(),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,y.sH)(this,void 0,void 0,function(){var e,t=this;return(0,y.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,y.sH)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,y.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,y.sH)(this,void 0,void 0,function(){var r,n;return(0,y.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,y.sH)(this,void 0,void 0,function(){var r,n,i,o,s,a,u=this;return(0,y.YH)(this,function(l){switch(l.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,l,c,d;return(0,y.YH)(this,function(f){switch(f.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),f.label=1;case 1:return f.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:s.signal})];case 2:if((l=f.sent()).ok)return[3,4];return[4,l.text()];case 3:return c=f.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(c)),l.status===e_.INVALID_API_KEY||l.status===e_.FORBIDDEN?(o.logger.error("Remote config client fetch failed with ".concat(l.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&l.status!==e_.RATE_LIMIT&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:f.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=f.sent())instanceof Error&&"AbortError"===d.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: "),d),[3,9];case 8:return clearTimeout(a),[7];case 9:if(!i)return[2,"break"];if(!(n<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(r))})];case 10:f.sent(),f.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];if("break"===a)return[3,4];l.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}(),eT=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},eC=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,y.sH)(this,void 0,void 0,function(){var a,u,l,c,d,f,h,p,g,v,m,b,w,S,E,I,_,k=this;return(0,y.YH)(this,function(T){switch(T.label){case 0:(a=(0,y.Cl)({},this.localConfig)).optOut=this.localConfig.optOut,a.captureEnabled=!0,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,new Promise(function(e,t){k.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(r,n){if(k.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,l=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||l)&&(u={},o&&(u.sr_sampling_config=o),s&&(u.sr_privacy_config=s),l&&(u.sr_targeting_config=l)),e()})})];
1case 2:return T.sent(),[3,4];case 3:return l=T.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",l),a.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:void 0}];case 4:if(!u)return[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:u}];if(c=u.sr_sampling_config,d=u.sr_privacy_config,f=u.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,y.fX)([],(0,y.zs)(new Set((0,y.fX)((0,y.fX)([],(0,y.zs)(null!=(n=h.maskAttributes)?n:[]),!1),(0,y.zs)(null!=(i=d.maskAttributes)?i:[]),!1))),!1),urlMaskLevels:(0,y.fX)((0,y.fX)([],(0,y.zs)(null!=(o=d.urlMaskLevels)?o:[]),!1),(0,y.zs)(null!=(s=h.urlMaskLevels)?s:[]),!1)},g=function(e){var t,r,n,i,o,s,a,u,l,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,y.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,y.Ju)(null!=(u=e.maskSelector)?u:[]),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,y.Ju)(null!=(l=e.unmaskSelector)?l:[]),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,y.Cl)((0,y.Cl)({},g(h)),g(d));try{for(b=(m=(0,y.Ju)(Object.entries(v))).next();!b.done;b=m.next())S=(w=(0,y.zs)(b.value,2))[0],E=w[1],"mask"===E?p.maskSelector.push(S):"block"===E?p.blockSelector.push(S):"unmask"===E&&p.unmaskSelector.push(S)}catch(e){I={error:e}}finally{try{b&&!b.done&&(_=m.return)&&_.call(m)}finally{if(I)throw I.error}}a.privacyConfig=eT(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:et(a)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:u}]}})})},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>ex?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(ex,"ms ceiling; clamping.")),ex):e:void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),ex=6e4;function eP(e,t){return t||("STAGING"===e?F:"EU"===e?U:H)}function eA(e){if(e.type!==eh.IncrementalSnapshot)return!1;var t=e.data;return t.source===ep.Mutation&&!t.isAttachIframe}var eO=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=new Blob([e]).size;if(r>9e6)return void s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(r/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,y.fX)([],(0,y.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,z.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 u=new Blob([n],{type:"application/javascript"}),l=URL.createObjectURL(u),c=new Worker(l);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===eh.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,y.fX)((0,y.fX)([],(0,y.zs)(this.taskQueue.splice(0)),!1),(0,y.zs)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var a=(0,y.Ju)(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=this.compressEvent(l.event);this.addCompressedEventToManager(c,l.sessionId)}}catch(e){r={error:e}}finally{try{u&&!u.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,y.fX)([],(0,y.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)||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 u=function(e){if(e.length<=1)return e;for(var t=[],r=0;r<e.length;){if(!eA(e[r])){t.push(e[r]),r++;continue}for(var n=r+1;n<e.length&&eA(e[n]);)n++;t.push(n>r+1?function(e){var t,r,n,i,o=e[0],s=new Map,a=new Map,u=new Map,l=new Map,c=new Map;e.forEach(function(e,t){var r,n,i,o,d=e.data;try{for(var f=(0,y.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,y.Ju)(d.removes),v=g.next();!v.done;v=g.next()){var m=v.value;u.has(m.id)||u.set(m.id,t),l.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,y.Ju)(s),p=h.next();!p.done;p=h.next()){var g=(0,y.zs)(p.value,2),v=g[0],m=g[1],b=u.get(v);if(void 0!==b){var w=a.get(v),S=l.get(v);!(w>=S)&&(m<b?d.add(v):b<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 E=new Set;if(d.size>0||f.size>0)for(var I=!0;I;){I=!1;try{for(var _=(n=void 0,(0,y.Ju)(c)),k=_.next();!k.done;k=_.next()){var T=(0,y.zs)(k.value,2),C=T[0],x=T[1];if(!d.has(C)&&!f.has(C)&&!E.has(C)&&(d.has(x)||f.has(x)||E.has(x))){var P=u.get(C),A=s.get(C);void 0!==P&&void 0!==A&&P<A?f.add(C):void 0!==P&&void 0!==A&&P===A?E.add(C):d.add(C),I=!0}}}catch(e){n={error:e}}finally{try{k&&!k.done&&(i=_.return)&&i.call(_)}finally{if(n)throw n.error}}}var O=d.size>0||f.size>0||E.size>0,R=[];e.forEach(function(e,t){var r,n;try{for(var i=(0,y.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))&&(E.has(a.id)&&(d.has(a.parentId)||f.has(a.parentId)||E.has(a.parentId))||R.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 N=e.flatMap(function(e){return e.data.adds}),L=e.flatMap(function(e){return e.data.texts}),M=e.flatMap(function(e){return e.data.attributes}),D={source:ep.Mutation,removes:R,adds:O?N.filter(function(e){return!d.has(e.node.id)&&!f.has(e.node.id)&&!E.has(e.node.id)}):N,texts:O?L.filter(function(e){return!d.has(e.id)&&!f.has(e.id)&&!E.has(e.id)}):L,attributes:O?M.filter(function(e){return!d.has(e.id)&&!f.has(e.id)&&!E.has(e.id)}):M};return(0,y.Cl)((0,y.Cl)({},o),{data:D})}(e.slice(r,n)):e[r]),r=n}return t}(e.slice(o,a).map(function(e){return e.event}));try{for(var l=(t=void 0,(0,y.Ju)(u)),c=l.next();!c.done;c=l.next()){var d=c.value;i.push({event:d,sessionId:s})}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}o=a}return i},e}(),eR="Session replay event batch rejected due to exceeded retry count",eN="Failed to store session replay events in IndexedDB",eL="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",eM="1.44.0",eD=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher,i=e.workerScript,o=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.flushPauseUntilMs=0,this.mergeOnNextFlush=!1,this.mergeLogFiredThisPause=!1,this.killedSessions=new Set,this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t,i)try{var s=new Blob([i],{type:"application/javascript"}),a=URL.createObjectURL(s),u=new Worker(a);u.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,")")),u.terminate(),o.worker=void 0;try{for(var i=(0,y.Ju)(o.pendingWorkerRequests),s=i.next();!s.done;s=i.next()){var a=(0,y.zs)(s.value,2)[1];r.warn("Session replay event send failed due to worker crash: ".concat(e.message)),a.resolve()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}o.pendingWorkerRequests.clear()},u.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=o.pendingWorkerRequests.get(t.id);n&&(o.handlePayloadTooLargeResponse(n.context,t.isWaf),n.resolve(),o.pendingWorkerRequests.delete(t.id))}else if("complete"===t.type){var i=o.pendingWorkerRequests.get(t.id);i&&(void 0!==t.skipCode&&o.applyServerDirective(i.context.sessionId,t.skipCode),o.completeRequest({context:i.context}),i.resolve(),o.pendingWorkerRequests.delete(t.id))}},this.worker=u}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,y.Cl)((0,y.Cl)({},e),{attempts:0,timeout:0}))},e.prototype.sendBeacon=function(e){var t,r,n=e.events,i=e.sessionId,o=e.deviceId,s=e.apiKey,a=e.serverZone,u=function(e){return new Blob([e]).size},l=n,c=JSON.stringify({version:2,events:l});if(u(c)>65536){for(var d=0,f=l.length;d<f;){var h=Math.floor((d+f+1)/2);65536>=u(JSON.stringify({version:2,events:l.slice(0,h)}))?d=h:f=h-1}c=JSON.stringify({version:2,events:l=l.slice(0,d)}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(n.length," to ").concat(l.length," events"))}if(0!==l.length){var p=new URLSearchParams({device_id:o,session_id:String(i),type:"replay",api_key:s}),g="".concat(eP(a,this.trackServerUrl),"?").concat(p.toString()),v=(0,z.m)();
1try{var m=new Blob([c],{type:"application/json"}),y=null==(r=null==(t=null==v?void 0:v.navigator)?void 0:t.sendBeacon)?void 0:r.call(t,g,m);!1===y&&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:eL}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:eR}),!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,y.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,y.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,t=this.mergeQueueAfterThrottle(t)),a.label=1;case 1:a.trys.push([1,6,7,8]),n=(r=(0,y.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,r,n,i,o,s,a,u,l,c,d,f=this;if(e.length<=1)return e;var h=new Map;try{for(var p=(0,y.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!=(l=null==(u=v.version)?void 0:u.type)?l:"",null!=(d=null==(c=v.version)?void 0:c.version)?d:""].join("|"),b=h.get(m);b?b.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 w=[];try{for(var S=(0,y.Ju)(h.values()),E=S.next();!E.done;E=S.next()){var I=E.value;!function(e){if(1===e.length)return w.push(e[0]);var t,r,n=null,i=0,o=function(){n&&w.push(n),n=null,i=0};try{for(var s=(t=void 0,(0,y.Ju)(e)),a=s.next();!a.done;a=s.next()){var u=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,y.Cl)((0,y.Cl)({},e),{events:(0,y.fX)([],(0,y.zs)(e.events),!1),attempts:0}),i=t;if(i+t>14e5)return o(),n=(0,y.Cl)((0,y.Cl)({},e),{events:(0,y.fX)([],(0,y.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,y.sH)(f,void 0,void 0,function(){return(0,y.YH)(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([r(),s()])];case 1:return e.sent(),[2]}})})}}(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}o()}(I)}}catch(e){n={error:e}}finally{try{E&&!E.done&&(i=S.return)&&i.call(S)}finally{if(n)throw n.error}}return w.length<e.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(e.length," queued batches into ").concat(w.length," request(s)"))),w},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,y.sH)(this,void 0,void 0,function(){var r,n,i,o;return(0,y.YH)(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:eL})]:(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,y.sH)(this,void 0,void 0,function(){var i,o=this;return(0,y.YH)(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a;o.pendingWorkerRequests.set(i,{context:t,resolve:s}
1),e.postMessage({type:"send",id:i,payload:r,useRetry:n,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:$(),sdkVersion:eM}})})]})})},e.prototype.sendOnMainThread=function(e,t,r,n,i){var o,s,a,u,l,c,d;return(0,y.sH)(this,void 0,void 0,function(){var f,h,p,g,v,m,b,w,S,E,I,_,k,T,C,x;return(0,y.YH)(this,function(P){switch(P.label){case 0:f=$(),h=eM,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!=(u=null==(a=r.version)?void 0:a.version)?u:h),P.label=1;case 1:if(P.trys.push([1,13,,14]),m=JSON.stringify(n),!((b=(0,z.m)())&&"CompressionStream"in b))return[3,3];return[4,function(e,t){return(0,y.sH)(this,void 0,void 0,function(){var r,n,i,o,s,a,u,l,c,d,f,h,p=this;return(0,y.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,y.sH)(p,void 0,void 0,function(){var e,t,r;return(0,y.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)),u=0;try{for(c=(l=(0,y.Ju)(o)).next();!c.done;c=l.next())d=c.value,a.set(d,u),u+=d.length}catch(e){f={error:e}}finally{try{c&&!c.done&&(h=l.return)&&h.call(l)}finally{if(f)throw f.error}}return[2,a];case 4:return g.sent(),[2,null];case 5:return[2]}})})}(m,b)];case 2:return S=P.sent(),[3,4];case 3:S=null,P.label=4;case 4:if(E=(w=S)?w.byteLength:new Blob([m]).size,I={headers:(0,y.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"},w?{"Content-Encoding":"gzip"}:{}),body:null!=w?w:m,method:"POST",keepalive:E<=65536},_="".concat(eP(r.serverZone,this.trackServerUrl),"?").concat(g.toString()),0===n.events.length)return this.completeRequest({context:r}),[2];return[4,fetch(_,I)];case 5:if(null===(k=P.sent()))return this.completeRequest({context:r,err:"Unexpected error occurred"}),[2];if(k.status>=200&&k.status<300&&(T=null!=(d=null==(c=null==(l=k.headers)?void 0:l.get)?void 0:c.call(l,"X-Session-Replay-Event-Skipped"))?d:null,this.applyServerDirective(r.sessionId,T)),i)return[3,6];C="";try{C=JSON.stringify(k.body,null,2)}catch(e){}return this.completeRequest({context:r,success:"".concat(k.status,": ").concat(C)}),[3,12];case 6:if(C="",413!==k.status)return[3,10];P.label=7;case 7:return P.trys.push([7,9,,10]),[4,k.text()];case 8:return C=P.sent(),[3,10];case 9:return P.sent(),[3,10];case 10:return[4,this.handleReponse(k.status,r,C)];case 11:P.sent(),P.label=12;case 12:return[3,14];case 13:return x=P.sent(),this.completeRequest({context:r,err:x}),[3,14];case 14:return[2]}})})},e.prototype.handleReponse=function(e,t,r){return void 0===r&&(r=""),(0,y.sH)(this,void 0,void 0,function(){return(0,y.YH)(this,function(n){switch(n.label){case 0:switch(new I().buildStatus(e)){case s.Success:return[3,1];case s.Failed:case s.Timeout:case s.RateLimit:return[3,2];case s.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,j.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,y.Cl)((0,y.Cl)({},e),{events:e.events.slice(0,o),onComplete:i})),this.sendEventsList((0,y.Cl)((0,y.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,y.sH)(this,void 0,void 0,function(){var t;return(0,y.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:eR}),[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)){
1if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var r,n,i,o,s=(0,y.Ju)(this.killedSessions),a=s.next();!a.done;a=s.next()){var u=a.value;this.killedSessions.delete(u);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 l=[];try{for(var c=(0,y.Ju)(this.queue),d=c.next();!d.done;d=c.next()){var f=d.value;f.sessionId===e?this.completeRequest({context:f,err:eL}):l.push(f)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}this.queue=l}},e}(),eH=r(3899),eU=function(){function e(e){var t,r,n,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=7e5,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,y.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}(),eF=function(e,t,r){"object"==typeof r&&null!==r&&"AbortError"===r.name?e.debug(t):e.warn(t)},ej="sessionCurrentSequence",eq="sequencesToSend";function eB(e,t,r){var n=setTimeout(r,t);return e.then(function(){return clearTimeout(n)},function(){return clearTimeout(n)}),function(){return clearTimeout(n)}}var ez=function(e){var t,r;return e.objectStoreNames.contains(ej)||(r=e.createObjectStore(ej,{keyPath:"sessionId"})),e.objectStoreNames.contains(eq)||(t=e.createObjectStore(eq,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},eY=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,y.sH)(n,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l,c=this;return(0,y.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||(eF(c.loggerProvider,"".concat(eN,": ").concat(r),r),c.recordFailure())}),i=eB(n.done,5e3,function(){e||t||(t=!0,eF(c.loggerProvider,"".concat(eN,": 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!==(u=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:u,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 l=d.sent(),t||(e=!0,eF(this.loggerProvider,"".concat(eN,": ").concat(l),l),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return(0,y.sH)(n,void 0,void 0,function(){var t,r,n,i,o,s,a,u,l=this;return(0,y.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([ej,eq],"readwrite")).done.catch(function(e){t||r||(eF(l.loggerProvider,"".concat(eN,": ").concat(e),e),l.recordFailure())}),i=eB(n.done,5e3,function(){t||r||(r=!0,eF(l.loggerProvider,"".concat(eN,": transaction timed out")),l.recordFailure())}
1),[4,n.objectStore(ej).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(eq).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return s=c.sent(),[4,n.objectStore(ej).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return c.sent(),this.recordSuccess(),i(),o.tabId,a=(0,y.Tt)(o,["tabId"]),[2,(0,y.Cl)((0,y.Cl)({},a),{sessionId:e,sequenceId:s})];case 5:return u=c.sent(),r||(t=!0,eF(this.loggerProvider,"".concat(eN,": ").concat(u),u),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return(0,y.sH)(n,void 0,void 0,function(){var r,n,i,o,s,a,u,l,c,d=this;return(0,y.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([ej,eq],"readwrite")).done.catch(function(e){r||n||(eF(d.loggerProvider,"".concat(eN,": ").concat(e),e),d.recordFailure())}),o=eB(i.done,5e3,function(){r||n||(n=!0,eF(d.loggerProvider,"".concat(eN,": transaction timed out")),d.recordFailure())}
1),[4,i.objectStore(ej).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(eq).put({sessionId:e,events:s.events,tabId:s.tabId})];case 3:f.sent(),f.label=4;case 4:case 12:return[4,i.objectStore(ej).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(ej).put({sessionId:e,events:[t],tabId:this.tabId})];case 8:if(this.shouldSplitEventsList(a.events,t))return[3,10];return[4,i.objectStore(ej).put({sessionId:e,events:a.events.concat(t),tabId:this.tabId})];case 10:if(0!==(u=a.events).length)return[3,12];return this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore(ej).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return f.sent(),[4,i.objectStore(eq).put({sessionId:e,events:u,tabId:this.tabId})];case 14:return l=f.sent(),this.recordSuccess(),o(),[2,{events:u,sessionId:e,sequenceId:l}];case 15:return c=f.sent(),n||(r=!0,eF(this.loggerProvider,"".concat(eN,": ").concat(c),c),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return(0,y.sH)(n,void 0,void 0,function(){var r,n;return(0,y.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(eq,{sessionId:e,events:t,tabId:this.tabId})];case 1:return r=i.sent(),this.recordSuccess(),[2,r];case 2:return n=i.sent(),eF(this.loggerProvider,"".concat(eN,": ").concat(n),n),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return(0,y.sH)(n,void 0,void 0,function(){var e;return(0,y.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(eq,t)];case 2:return r.sent(),this.recordSuccess(),[3,4];case 3:return e=r.sent(),eF(this.loggerProvider,"".concat(eN,": ").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,y.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,y.sH)(this,void 0,void 0,function(){var i,o,s,a;return(0,y.YH)(this,function(u){switch(u.label){case 0:var l;return u.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),[4,(l="".concat(r.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),(0,y.sH)(void 0,void 0,void 0,function(){return(0,y.YH)(this,function(e){switch(e.label){case 0:var t;return[4,(t=(0,eH.P2)(l,1,{upgrade:ez}),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=u.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,y.Cl)((0,y.Cl)({},r),{db:o,tabId:s}))];case 2:return a=u.sent(),eF(r.loggerProvider,"".concat(eN,": ").concat(a),a),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,y.sH)(this,void 0,void 0,function(){var t,r,n,i,o,s,a;return(0,y.YH)(this,function(u){switch(u.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=u.sent())||t.tabId&&t.tabId!==this.tabId)return[2,void 0];return t.tabId,[2,[r=(0,y.Tt)(t,["tabId"])]];case 2:n=[],u.label=3;case 3:return u.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:o=(i=y.Ju.apply(void 0,[u.sent()])).next(),u.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,y.Tt)(t,["tabId"]),n.push(r),u.label=6;case 6:return o=i.next(),[3,5];case 7:return[3,10];case 8:return s={error:u.sent()},[3,10];case 9:try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}
1return[7];case 10:return[2,n]}})})},t}(eU),eV=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,y.C6)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=(0,y.fX)([],(0,y.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,y.sH)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l;return(0,y.YH)(this,function(c){e=[];try{for(r=(t=(0,y.Ju)(Object.entries(this.finalizedSequences))).next();!r.done;r=t.next()){if(i=(n=(0,y.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){u={error:e}}finally{try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(u)throw u.error}}return[2,e]})})},t.prototype.storeCurrentSequence=function(e){return(0,y.sH)(this,void 0,void 0,function(){var t;return(0,y.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,y.sH)(this,void 0,void 0,function(){var r;return(0,y.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,y.sH)(this,void 0,void 0,function(){return(0,y.YH)(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,y.sH)(this,void 0,void 0,function(){return(0,y.YH)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(eU),eJ=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.type,o=e.payloadBatcher,s=e.storeType,a=e.trackDestinationWorkerScript,u=e.shouldSend;return(0,y.sH)(void 0,void 0,void 0,function(){var e,l,c,d,f,h,p,g,v,m;function b(t){return void 0===t&&(t=!1),(0,y.sH)(this,void 0,void 0,function(){return(0,y.YH)(this,function(r){return[2,e.flush(t)]})})}return(0,y.YH)(this,function(w){switch(w.label){case 0:if(e=new eD((0,y.Cl)((0,y.Cl)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o,workerScript:a})),l=function(){return new eV({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r})},d=!1,"idb"!==s)return[3,2];return[4,(0,y.sH)(void 0,void 0,void 0,function(){var e;return(0,y.YH)(this,function(o){switch(o.label){case 0:return[4,eY.new(i,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,apiKey:t.apiKey,onPersistentFailure:function(){(0,y.sH)(void 0,void 0,void 0,function(){var e,r,n;return(0,y.YH)(this,function(i){switch(i.label){case 0:if(!d)return[2];if(d=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),!c)return[3,2];return[4,f.getSequencesToSend()];case 1:return r=i.sent(),[3,3];case 2:r=void 0,i.label=3;case 3:return e=r,f=l(),e&&c&&(n=c,e.forEach(function(e){m({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})})),[2]}})})}})];case 1:if(!(e=o.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,l()];return d=!0,[2,e]}})})];case 1:return h=w.sent(),[3,3];case 2:h=l(),w.label=3;case 3:return f=h,p=[],g=0,v=function(e){if(!(e<=g)){var t=Math.min(e-g,p.length);t>0&&(p.splice(0,t),g=e)}},m=function(r){var n=r.events,o=r.sessionId,s=r.deviceId,a=r.sequenceId,u=n.map(function(e){return{event:e,bytes:new Blob([e]).size}}
1),l=u.filter(function(e){return e.bytes>9e6});l.length>0&&t.loggerProvider.warn("Dropping ".concat(l.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(l.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 c=l.length>0?u.filter(function(e){return e.bytes<=9e6}).map(function(e){return e.event}):n;if(0===c.length)return void f.cleanUpSessionEventsStore(o,a).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)});t.debugMode&&ee().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(){}),e.sendEventsList({events:c,sessionId:o,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return(0,y.sH)(void 0,void 0,void 0,function(){return(0,y.YH)(this,function(e){switch(e.label){case 0:return[4,f.cleanUpSessionEventsStore(o,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var r=e.sessionId,n=e.deviceId;if(c=n,!u||u()){var i=g+p.length;f.storeCurrentSequence(r).then(function(e){e&&(v(i),m({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;c=i;var o=!u||u(),s=g+p.length;p.push(r.data),f.addEventToCurrentSequence(n,r.data).then(function(e){if(e){if(!o){f.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch(function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)}),v(s);return}v(s),m({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,y.sH)(void 0,void 0,void 0,function(){var e;return(0,y.YH)(this,function(n){switch(n.label){case 0:return c=r,[4,f.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.forEach(function(e){m({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}),[2]}})})},flush:b,getBeaconEvents:function(){return(0,y.fX)([],(0,y.zs)(p),!1)},dropPendingBeaconEvents:function(){v(g+p.length)},trackDestination:e}]}})})},eW=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,y.sH)(this,void 0,void 0,function(){var t;return(0,y.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,y.sH)(this,void 0,void 0,function(){var t;return(0,y.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 eK(e,t,r){for(var n=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,u,l,c=new Date().getTime()-p.getTime();if(void 0!==f.timeoutMs&&c>f.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=e2((e=o.getAttribute("id"))&&f.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||e2.apply(void 0,(0,y.fX)([],(0,y.zs)(Array.from(o.attributes).filter(function(e){return f.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||e2.apply(void 0,(0,y.fX)([],(0,y.zs)(Array.from(o.classList).filter(f.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||e2((a=o.tagName.toLowerCase(),f.tagName(a)?{name:a,penalty:2}:null))||[eZ()],h=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)h&&(d=d.concat(d.filter(e1).map(function(e){return e0(e,h)})));else if("two"==t)d=d.slice(0,1),h&&(d=d.concat(d.filter(e1).map(function(e){return e0(e,h)})));else if("one"==t){var g=(0,y.zs)(d=d.slice(0,1),1)[0];h&&e1(g)&&(d=[e0(g,h)])}else"none"==t&&(d=[eZ()],h&&(d=[e0(d[0],h)]));try{for(var v=(u=void 0,(0,y.Ju)(d)),m=v.next();!m.done;m=v.next()){var g=m.value;g.level=s}}catch(e){u={error:e}}finally{try{m&&!m.done&&(l=v.return)&&l.call(v)}finally{if(u)throw u.error}}if(i.push(d),i.length>=f.seedMinLength&&(n=e$(i,r)))return"break";o=o.parentElement,s++}(););return(n||(n=e$(i,r)),!n&&r)?r():n}function e$(e,t){var r,n,i=e4(function e(t,r){var n,i,o,s,a;return void 0===r&&(r=[]),(0,y.YH)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(n=(0,y.Ju)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,y.Ju)(e(t.slice(1,t.length),r.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}
1return[7];case 8:return[3,11];case 9:return[4,r];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>f.threshold)return t?t():null;try{for(var o=(0,y.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(eQ(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 eG(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 eX(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function eQ(e){var t=eG(e);switch(h.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 eZ(){return{name:"*",penalty:3}}function e0(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function e1(e){return"html"!==e.name&&!e.name.startsWith("#")}function e2(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(e3);return r.length>0?r:null}function e3(e){return null!=e}function e4(e){return(0,y.fX)([],(0,y.zs)(e),!1).sort(function(e,t){return eX(e)-eX(t)})}var e6=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}},e5=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,y.Cl)((0,y.Cl)({},t),{timestamp:s,count:1}),e},{}))}},e8=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!==eg.Click)return;var u,l=(0,z.m)();if(l){var c=l.location,d=l.innerHeight,g=l.innerWidth;if(c){var v=e.x,m=e.y;if(void 0!==v&&void 0!==m){var b=o.getNode(e.id);if(b)try{u=function(e,t){if(p=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=(f=(0,y.Cl)((0,y.Cl)({},i),t)).root,n=i,h=r.nodeType===Node.DOCUMENT_NODE?r:r===n.root?r.ownerDocument:r;var o=eK(e,"all",function(){return eK(e,"two",function(){return eK(e,"one",function(){return eK(e,"none")})})});if(o){var s=e4(function e(t,r,n){var i,o,s;return void 0===n&&(n={counter:0,visited:new Map}),(0,y.YH)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>f.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u,l;if(!(i<t.length-1))return[3,5];if(n.counter>f.maxNumberOfTries||(n.counter+=1,(o=(0,y.fX)([],(0,y.zs)(t),!1)).splice(i,1),s=eG(o),n.visited.has(s)))return[2];if(!(eQ(o)&&(u=o,l=r,h.querySelector(eG(u))===l)))return[3,4];return[4,o];case 2:return a.sent(),n.visited.set(s,!0),[5,(0,y.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]),eG(o)}throw Error("Selector was not found.")}(b,a)}catch(e){r.logger.debug("error resolving selector from finder")}var w=Z(c.href,s),S={x:v+r.scrollWatcher.currentScrollX,y:m+r.scrollWatcher.currentScrollY,selector:u,viewportHeight:d,viewportWidth:g,pageUrl:w,timestamp:Date.now(),type:"click"},E=i();E&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(S)},deviceId:E})}}}}},this.logger=e,this.scrollWatcher=t};function e7(){var e=(0,z.m)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function e9(){var e=(0,z.m)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var te=function(){function e(e,t){var r=(0,z.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=eP(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var r=this.context,n=r.sessionId,i=r.type,o=new URLSearchParams({device_id:e,session_id:String(n),type:String(i),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(o.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),tt=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(),u=(0,z.m)();if(u&&a){var l=null!=(n=u.scrollX)?n:0,c=null!=(i=u.scrollY)?i:0;(l>0||c>0)&&r.update({id:1,x:l,y:c}),r.transport.send(a,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHe
1ight:e7(),viewportWidth:e9(),pageUrl:Z(u.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=e9(),this._maxScrollHeight=e7(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new te(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},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=e9();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=e7();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),tr=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId="".concat(r,"/").concat(t))},tn=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},ti=function(e,t){return"".concat(tn(e)).concat(t)},to=function(){try{var e=(0,z.m)();return null==e?void 0:e.localStorage}catch(e){return}},ts=function(e,t,r,n){var i=to();if(i){var o=ti(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}}},ta=function(e,t,r,n){var i=to();if(i)try{i.setItem(ti(e,t),String(r))}catch(e){null==n||n.debug("Failed to write replay start time to storage: ".concat(String(e)))}},tu=function(e,t,r){var n=to();if(n)try{n.removeItem(ti(e,t))}catch(e){null==r||r.debug("Failed to remove replay start time from storage: ".concat(String(e)))}},tl=function(e,t,r){var n,i,o=to();if(o){var s=tn(e);try{for(var a=[],u=0;u<o.length;u++){var l=o.key(u);if(l&&l.startsWith(s)){var c=o.getItem(l);if(null!==c){var d=Number(c);(!Number.isFinite(d)||d<=0||t-d>=864e5)&&a.push(l)}}}try{for(var f=(0,y.Ju)(a),h=f.next();!h.done;h=f.next()){var l=h.value;o.removeItem(l)}}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)))}}},tc=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,y.sH)(e,void 0,void 0,function(){return(0,y.YH)(this,function(e){switch(e.label){case 0:return[4,(0,eH.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,y.sH)(e,void 0,void 0,function(){var e,r;return(0,y.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,y.sH)(e,void 0,void 0,function(){var e,t,o,s;return(0,y.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(),eF(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,y.sH)(e,void 0,void 0,function(){var e,t,s;return(0,y.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(),eF(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,y.sH)(e,void 0,void 0,function(){var e,t,o,s,a,u,l,c;return(0,y.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(u=s[a],l=Date.now()-u.lastUpdated,!(u.sessionId!==t&&l>1728e5))return[3,5];return[4,o.store.delete(u.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(),eF(r,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},td=function(e){var t=e.sessionId,n=e.targetingConfig,i=e.loggerProvider,o=e.apiKey,s=e.targetingParams,a=e.urlChange,u=void 0!==a&&a;return(0,y.sH)(void 0,void 0,void 0,function(){var e,a,l;return(0,y.YH)(this,function(c){switch(c.label){case 0:return[4,tc.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:t})];case 1:return c.sent(),[4,tc.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t})];case 2:if(!0===c.sent()&&!u)return[2,!0];e=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,r.e(9384).then(r.bind(r,9384))];case 4:return[4,(0,c.sent().evaluateTargeting)((0,y.Cl)((0,y.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),tc.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t,targetingMatch:e}),[3,7];case 6:return l=c.sent(),i.warn(l.message),[3,7];case 7:return[2,e]}})})};function tf(e,t){return(e<<t|e>>>32-t)>>>0}function th(e,t){return Math.imul(e=tf(e=e+Math.imul(t,0x85ebca77)>>>0,13),0x9e3779b1)>>>0}function tp(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var tg="__amplitude_url_tracking_patched__",tv=new WeakMap;function tm(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 u=tv.get(e);if(!u){var l=void 0,c=new Set,d=function(){var t;return null!=(t=e.location.href)?t:""},f=function(){var e=d();
1(void 0===l||e!==l)&&(l=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[tg]=!0,t},p=e.history;if(null==p?void 0:p.pushState){var g=Reflect.get(p,"pushState");g[tg]||(p.pushState=h(g))}if(null==p?void 0:p.replaceState){var v=Reflect.get(p,"replaceState");v[tg]||(p.replaceState=h(v))}u={callbacks:c,notify:f,onPopStateOrHashChange:function(){return f()},listenersAttached:!1},tv.set(e,u)}var m=u;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 ty(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,s,a=(0,y.Cl)((0,y.Cl)({},e),n),u=a.ugcFilterRules||[],l=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:u.length>0?Z(i,u):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=tm(r,function(){return g()},l?{enablePolling:!0,pollingInterval:c}:{});return g(),function(){return v()}},options:e}}ty();var tb=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null==(e=this.mutationObserver)||e.disconnect(),(0,z.m)()&&(this.sendToAllIframes({type:q,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var r,n,i,o,s,a;try{for(var u=(0,y.Ju)(e),l=u.next();!l.done;l=u.next()){var c=l.value;try{for(var d=(i=void 0,(0,y.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,y.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{l&&!l.done&&(n=u.return)&&n.call(u)}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:q,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,r=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:q,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}(),tw=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.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,z.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(){if(e.recordCancelCallback&&e.recordFunction)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,y.sH)(e,void 0,void 0,function(){var e,o,s,a,u,l,d,f,h,p,g,v;return(0,y.YH)(this,function(m){switch(m.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(c).includes(s.event_type)&&(s=void 0),a=null!=(g=null!=(f=null==(d=t.page)?void 0:d.url)?f:null==(p=null==(h=(0,z.m)())?void 0:h.location)?void 0:p.href)?g:"",u=null!=(v=t.page)?v:""!==a?{url:a}:void 0,[4,td({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:u},urlChange:i})];case 1:if(l=m.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||l,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),m.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:m.sent(),m.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),(0,y.sH)(e,void 0,void 0,function(){var e,i,o,s;return(0,y.YH)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==u.METADATA)||(e={config:et(i),version:eM},!n))return[3,2];return[4,ee()];case 1:o=a.sent(),e=(0,y.Cl)((0,y.Cl)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,y.Cl)((0,y.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 B(new E)}return e.prototype.init=function(e,t){return ei(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,r=this;null==(e=this.urlChangeCleanup)||e.call(this);var n=(0,z.m)();if(null==n?void 0:n.location){var i=!!(null==(t=this.config)?void 0:t.targetingConfig),o=tm(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,z.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,u,l,c,d,f,h,p,g,v;return(0,y.sH)(this,void 0,void 0,function(){var m,b,w,S,I,_,k,T,C,x,P,A,O,R,N,L,M,D,H,U,F,j,q,Y,V,J,W,K,G=this;return(0,y.YH)(this,function(X){switch(X.label){case 0:return null==(n=this.urlChangeCleanup)||n.call(this),this.loggerProvider=new B(t.loggerProvider||new E),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=$(),this.identifiers=new tr({sessionId:t.sessionId,deviceId:t.deviceId}),tl(e,m=Date.now(),this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!=(i=ts(e,t.sessionId,m,this.loggerProvider))?i:m,b=this,[4,(0,y.sH)(void 0,void 0,void 0,function(){var r;return(0,y.YH)(this,function(n){return r=new en(e,t),[2,new eC(new ek(e,r.loggerProvider,r.serverZone,t.configServerUrl),r)]})})];case 1:return b.joinedConfigGenerator=X.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:if(S=(w=X.sent()).joinedConfig,I=w.localConfig,_=w.remoteConfig,this.config=S,this.setMetadata(t.sessionId,S,I,_,null==(o=t.version)?void 0:o.version,eM,null==(s=t.version)?void 0:s.type),this.pageLeaveFns=[],t.sessionId&&(null==(a=this.config.interactionConfig)?void 0:a.enabled)&&(k=tt.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 e8(this.loggerProvider,k)),T=[],"idb"!==(C=this.config.storeType)||(null==(u=(0,z.m)())?void 0:u.indexedDB)||(C="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(C," for event storage.")),A=(0,z.m)(),!(this.config.useWebWorker&&A&&A.Worker))return[3,4];return[4,r.e(9961).then(r.bind(r,9961))];case 3:R=(O=X.sent()).compressionScript,N=O.trackDestinationScript,x=R,P=N,X.label=4;case 4:return X.trys.push([4,6,,7]),[4,eJ({config:this.config,type:"replay",minInterval:null==(l=this.config.flushIntervalConfig)?void 0:l.minIntervalMs,maxInterval:null==(c=this.config.flushIntervalConfig)?void 0:c.maxIntervalMs,storeType:C,trackDestinationWorkerScript:P,shouldSend:function(){return!G.isBelowMinSessionDuration()}})];case 5:return L=X.sent(),this.rrwebEventManager=L,T.push({name:"replay",manager:L}),[3,7];case 6:return M=X.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?e5:e6,X.label=8;case 8:return X.trys.push([8,10,,11]),[4,eJ({config:this.config,type:"interaction",minInterval:null!=(f=this.config.interactionConfig.trackEveryNms)?f:3e4,maxInterval:6e4,payloadBatcher:D,storeType:C,trackDestinationWorkerScript:P})];case 9:return H=X.sent(),T.push({name:"interaction",manager:H}),[3,11];case 10:return M=X.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(M.toString())),[3,11];case 11:if(this.eventsManager=new(eW.bind.apply(eW,(0,y.fX)([void 0],(0,y.zs)(T),!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new eO(this.eventsManager,this.config,this.getDeviceId(),x,function(){return G.sendEvents()}),this.pendingEmitEvents.length>0){U=this.pendingEmitEvents.splice(0);try{for(j=(F=(0,y.Ju)(U)).next();!j.done;j=F.next())Y=(q=j.value).event,V=q.sessionId,this.eventCompressor.enqueueEvent(Y,V)}catch(e){W={error:e}}finally{try{j&&!j.done&&(K=F.return)&&K.call(F)}finally{if(W)throw W.error}}}return this.pageLeaveFns=(0,y.fX)((0,y.fX)([],(0,y.zs)(this.pageLeaveFns),!1),[function(){if(!G.config||!(null==(e=G.identifiers)?void 0:e.sessionId)||!L)return;var e,t=L.getBeaconEvents();if(t.length){var r=G.getDeviceId();r&&(G.isBelowMinSessionDuration()||L.trackDestination.sendBeacon({events:t,sessionId:G.identifiers.sessionId,deviceId:r,apiKey:G.config.apiKey,serverZone:G.config.serverZone}))}}],!1),[4,this.initializeNetworkObservers()];case 12:return X.sent(),(null==(h=(0,z.m)())?void 0:h.opener)&&(!function(e,t){if(!0!==e[ec]){e[ec]=!0;var r="https://cdn.amplitude.com/libs/background-capture-1.0.1.js.gz",n=null,i=function(t,r){var n,i;"background-capture-complete"===t&&(null==(i=null==(n=e.logger)?void 0:n.debug)||i.call(n,"Backgroun
1d capture complete"),e.notify({action:"background-capture-complete",data:r}))};e.registerActionHandler("initialize-background-capture",function(){null==(o=null==(t=e.logger)?void 0:t.debug)||o.call(t,"Initializing background capture (external script)");var t,o,s=new URL(r,e.endpoint).toString();e.loadScriptOnce(s).then(function(){var t,r,o;null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Background capture script loaded (external)"),n=null==(o=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:o.call(window,{messenger:e,onBackgroundCapture:i}),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==n?void 0:n.close)||e.call(n),n=null})}}(J=function(e){var t=(0,z.m)(),r=null==t?void 0:t[eu];if("object"==typeof r&&null!==r&&ea in r&&!0===r[ea])return r;var n=new el(void 0);return t&&(t[eu]=n),n}()),J.setup((0,y.Cl)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:es[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 X.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 ei(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,r){var n,i,o;return(0,y.sH)(this,void 0,void 0,function(){var s,a,u,l;return(0,y.YH)(this,function(c){switch(c.label){case 0:if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(s=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(s),(a=s!==e)&&(null==(n=this.rrwebEventManager)||n.dropPendingBeaconEvents()),u=t||this.getDeviceId(),this.identifiers=new tr({sessionId:e,deviceId:u}),a&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null==(i=this.config)?void 0:i.apiKey)&&(ta(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==s&&tu(this.config.apiKey,s,this.loggerProvider))),!(this.joinedConfigGenerator&&s))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:l=c.sent().joinedConfig,this.config=l,c.label=2;case 2:if(!(null==(o=this.config)?void 0:o.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==r?void 0:r.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return c.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:c.sent(),c.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={})[O]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[L]=JSON.stringify({appHash:ed(t.apiKey).toString()}))),this.addCustomRRWebEvent(u.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();if(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(u.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,y.sH)(this,void 0,void 0,function(){var r;return(0,y.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==(t=this.config)?void 0:t.instanceName){var e,t,r,n;n=(void 0===(e=this.config.instanceName)&&(e=k),ef.i.getInstance(e)).identityStore.getIdentity().optOut}return void 0!==n?n:null==(r=this.config)?void 0:r.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.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,u=t>>>0,l=t-0x9e3779b1>>>0;o<=i-16;)s=th(s,tp(n,o)),o+=4,a=th(a,tp(n,o)),o+=4,u=th(u,tp(n,o)),o+=4,l=th(l,tp(n,o)),o+=4;r=tf(s,1)+tf(a,7)+tf(u,12)+tf(l,18)>>>0}else r=t+0x165667b1>>>0;for(r=r+i>>>0;o<=i-4;)r=Math.imul(tf(r=r+Math.imul(tp(n,o),0xc2b2ae3d)>>>0,17),0x27d4eb2f)>>>0,o+=4;for(;o<i;)r=Math.imul(tf(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(u.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?J(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,y.sH)(this,void 0,void 0,function(){var u,l,c,d;return(0,y.YH)(this,function(f){switch(f.label){case 0:u=[];try{l=ty({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}),u.push(l)}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(6851).then(r.bind(r,7434))];case 2:return c=f.sent().getRecordConsolePlugin,u.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,u.length>0?u:void 0]}})})},e.prototype.getRecordFunction=function(){return(0,y.sH)(this,void 0,void 0,function(){var e,t;return(0,y.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(8950).then(r.bind(r,8770))];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,y.sH)(this,void 0,void 0,function(){var t;return(0,y.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._recordEvents=function(e){var t,r,n,i,o,s,a,l;return void 0===e&&(e=!0),(0,y.sH)(this,void 0,void 0,function(){var c,d,f,h,p,g,v,m,b,w,S,E,I,_,k,T,C,x,P=this;return(0,y.YH)(this,function(A){switch(A.label){case 0:if(c=this.config,d=this.getShouldRecord(),f=null==(t=this.identifiers)?void 0:t.sessionId,!d||!f||!c)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(h=A.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:A.sent(),p=null==(r=c.loggingConfig)?void 0:r.network,g=[H,U,F,eP(c.serverZone,c.trackServerUrl)],null==(n=this.networkObservers)||n.start(function(e){g.some(function(t){return e.url.
1startsWith(t)})||P.addCustomRRWebEvent(u.FETCH_REQUEST,e)},p),v=c.interactionConfig,m=c.loggingConfig,b=(null==v?void 0:v.enabled)?{mouseInteraction:this.eventsManager&&(null==(i=this.clickHandler)?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:f,deviceIdFn:this.getDeviceId.bind(this),mirror:h.mirror,ugcFilterRules:null!=(o=v.ugcFilterRules)?o:[],performanceOptions:null==(s=c.performanceConfig)?void 0:s.interaction})),scroll:this.scrollHook}:{},w=(null==v?void 0:v.enabled)&&v.ugcFilterRules?v.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(f,".")),A.label=3;case 3:if(A.trys.push([3,5,,6]),S=!!(null==(a=c.crossOriginIframes)?void 0:a.enabled),E=(null==(l=c.crossOriginIframes)?void 0:l.coordinateChildren)!==!1,(I=S&&function(){try{var e=(0,z.m)();if(!e)return!1;return e.parent!==e}catch(e){return!0}}())&&E)return this.crossOriginParentSignalCleanup=function(e){var t=(0,z.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)===q&&("start"===n.action?e.onStart():"stop"===n.action&&e.onStop())}}return t.addEventListener("message",n),function(){return t.removeEventListener("message",n)}}({onStart:function(){return P._recordEventsInChildMode(h,f,c,b)},onStop:function(){try{P.recordCancelCallback&&P.recordCancelCallback(),P.recordCancelCallback=null}catch(e){P.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),[2];return _=this,k=h,T=[(0,y.Cl)({},this.buildRRWebRecordOptions(c,b,function(e){if(P.shouldOptOut()){P.loggerProvider.log("Opting session ".concat(f," out of recording due to optOut config.")),P.stopRecordingEvents(),P.sendEvents();return}e.type===eh.Meta&&(e.data.href=Z(e.data.href,w)),P.eventCompressor?P.eventCompressor.enqueueEvent(e,f):P.pendingEmitEvents.push({event:e,sessionId:f})},"Error while capturing replay: "))],x={},[4,this.getRecordingPlugins(m)];case 4:return _.recordCancelCallback=k.apply(void 0,[y.Cl.apply(void 0,T.concat([(x.plugins=A.sent(),x.recordCrossOriginIframes=S,x)]))]),S&&!I&&E&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new tb),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(u.DEBUG_INFO),e&&this.addCustomRRWebEvent(u.METADATA,this.metadata),[3,6];case 5:return C=A.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,y.Cl)((0,y.Cl)({emit:r,inlineStylesheet:e.shouldInlineStylesheet,hooks:t,maskAllInputs:!0,maskTextClass:M,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements,maskInputFn:K("input",s,function(){return o.currentPageUrl}),maskTextFn:K("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)?W(["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,y.Cl)((0,y.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.flush=function(e){var t;return void 0===e&&(e=!1),(0,y.sH)(this,void 0,void 0,function(){return(0,y.YH)(this,function(r){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e,t;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())?ed(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,y.sH)(this,void 0,void 0,function(){var i,o;return(0,y.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(1091).then(r.bind(r,1091))];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}(),tS=function(e){return function(){var t=e.config||er();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let tE=function(){var e=new tw;return{init:w(e.init.bind(e),"init",tS(e)),evaluateTargetingAndCapture:w(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",tS(e)),setSessionId:w(e.setSessionId.bind(e),"setSessionId",tS(e)),getSessionId:w(e.getSessionId.bind(e),"getSessionId",tS(e)),getSessionReplayProperties:w(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",tS(e)),flush:w(e.flush.bind(e),"flush",tS(e)),shutdown:w(e.shutdown.bind(e),"shutdown",tS(e))}}();var tI=tE.init,t_=tE.setSessionId,tk=tE.getSessionId,tT=tE.getSessionReplayProperties,tC=tE.flush,tx=tE.shutdown,tP=tE.evaluateTargetingAndCapture;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(g||(g={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(v||(v={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(m||(m={}));var tA=[g.SET,g.SET_ONCE,g.ADD,g.APPEND,g.PREPEND,g.POSTINSERT],tO=function(e){if(e.user_properties){var t={};
1return Object.keys(e.user_properties).forEach(function(r){if(tA.includes(r)){var n=e.user_properties&&e.user_properties[r];t=(0,y.Cl)((0,y.Cl)({},t),n)}}),t}},tR="1.31.0",tN="".concat("[Amplitude]"," Session Replay ID"),tL=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:tC,getSessionId:tk,getSessionReplayProperties:tT,init:tI,setSessionId:t_,shutdown:tx,evaluateTargetingAndCapture:tP},this.options=(0,y.Cl)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var r,n,i,o,s,a,u,l;return(0,y.sH)(this,void 0,void 0,function(){var t,c;return(0,y.YH)(this,function(d){switch(d.label){case 0:var f;return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(tR,".")),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,y.Cl)((0,y.Cl)({},e.defaultTracking),{sessions:!0})),t=(void 0===(f=this.config.instanceName)&&(f="$default_instance"),ef.i.getInstance(f)).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,version:{type:"plugin",version:tR},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!=(u=this.options.useWebWorker)?u:null==(l=this.options.experimental)?void 0:l.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},[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,y.sH)(this,void 0,void 0,function(){return(0,y.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,y.sH)(this,void 0,void 0,function(){return(0,y.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,y.sH)(this,void 0,void 0,function(){var o,s,a,u,l;return(0,y.YH)(this,function(c){switch(c.label){case 0:if(c.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(o=this.options.customSessionId(e)))return[3,3];if(o===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(o).promise];case 1:c.sent(),c.label=2;case 2:s=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,y.Cl)((0,y.Cl)({},e.event_properties),s),c.label=3;case 3:return[3,8];case 4:if(!((o=null==(t=this.config)?void 0:t.sessionId)&&o!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(o).promise];case 5:c.sent(),c.label=6;case 6:if(!(o&&o===e.session_id))return[3,8];return a=void 0,e.event_type===i.IDENTIFY&&(a=tO(e)),u=b(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:a,page:(null==(r=null==u?void 0:u.location)?void 0:r.href)!=null?{url:u.location.href}:void 0})];case 7:c.sent(),s=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,y.Cl)((0,y.Cl)({},e.event_properties),s),c.label=8;case 8:return e.event_type===i.IDENTIFY&&e.event_properties&&delete e.event_properties[tN],[2,Promise.resolve(e)];case 9:return l=c.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,y.sH)(this,void 0,void 0,function(){return(0,y.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.pluginName="@amplitude/plugin-session-replay-browser",e}(),tM=function(e){return new tL(e)}},6760:function(e,t,r){var n;!function(i,o){"use strict";var s="function",a="undefined",u="object",l="string",c="model",d="name",f="type",h="vendor",p="version",g
vendor: 4,116 bytes, line 1
1="architecture",v="console",m="mobile",y="tablet",b="smarttv",w="wearable",S="embedded",E="Amazon",I="Apple",_="ASUS",k="BlackBerry",T="Browser",C="Chrome",x="Firefox",P="Google",A="Huawei",O="Microsoft",R="Motorola",N="Opera",L="Samsung",M="Sharp",D="Sony",H="Xiaomi",U="Zebra",F="Facebook",j=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},q=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},B=function(e,t){return typeof e===l&&-1!==z(t).indexOf(z(e))},z=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===l)return e=e.replace(/^\s\s*/,""),typeof t===a?e:e.substring(0,350)},V=function(e,t){for(var r,n,i,a,l,c,d=0;d<t.length&&!l;){var f=t[d],h=t[d+1];for(r=n=0;r<f.length&&!l;)if(l=f[r++].exec(e))for(i=0;i<h.length;i++)c=l[++n],typeof(a=h[i])===u&&a.length>0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=c?c.replace(a[1],a[2]):void 0:this[a[0]]=c?a[1].call(this,c,a[2]):void 0:4===a.length&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):o):this[a]=c||o;d+=2}},J=function(e,t){for(var r in t)if(typeof t[r]===u&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(B(t[r][n],e))return"?"===r?o:r}else if(B(t[r],e))return"?"===r?o: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"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,p],[/opios[\/ ]+([\w\.]+)/i],[p,[d,N+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[d,N]],[/(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],[d,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[d,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[d,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[d,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[d,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+T],p],[/\bfocus\/([\w\.]+)/i],[p,[d,x+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[d,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[d,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[d,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[p,[d,x]],[/\bqihu|(qi?ho?o?|360)browser/i],[[d,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1 "+T],p],[/(comodo_dragon)\/([\w\.]+)/i],[[d,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[d,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,F],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[d,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[d,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[d,C+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,C+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[d,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[p,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","?":"/"}
vendor: 4,519 bytes, line 1
1]],[/(webkit|khtml)\/([\w\.]+)/i],[d,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[d,x+" 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],[d,p],[/(cobalt)\/([\w\.]+)/i],[d,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,z]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,z]]],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],[c,[h,L],[f,y]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[h,L],[f,m]],[/((ipod|iphone)\d+,\d+)/i],[c,[h,I],[f,m]],[/(ipad\d+,\d+)/i],[c,[h,I],[f,y]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[h,I],[f,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[h,I],[f,y]],[/(macintosh);/i],[c,[h,I]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[h,A],[f,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[h,A],[f,m]],[/\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],[[c,/_/g," "],[h,H],[f,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[h,H],[f,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[h,"OPPO"],[f,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[h,"Vivo"],[f,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[h,"Realme"],[f,m]],[/\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],[c,[h,R],[f,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[h,R],[f,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[h,"LG"],[f,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[h,"LG"],[f,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[h,"Lenovo"],[f,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[h,"Nokia"],[f,m]],[/(pixel c)\b/i],[c,[h,P],[f,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[h,P],[f,m]],[/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],[c,[h,D],[f,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[h,D],[f,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[h,"OnePlus"],[f,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[h,E],[f,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[h,E],[f,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,h,[f,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[h,k],[f,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[h,_],[f,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[h,_],[f,m]],[/(nexus 9)/i],[c,[h,"HTC"],[f,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[c,/_/g," "],[f,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[h,"Acer"],[f,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[h,"Meizu"],[f,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[h,M],[f,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 7,174 bytes, line 1
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,c,[f,m]],[/(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],[h,c,[f,y]],[/(surface duo)/i],[c,[h,O],[f,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[h,"Fairphone"],[f,m]],[/(u304aa)/i],[c,[h,"AT&T"],[f,m]],[/\bsie-(\w*)/i],[c,[h,"Siemens"],[f,m]],[/\b(rct\w+) b/i],[c,[h,"RCA"],[f,y]],[/\b(venue[\d ]{2,7}) b/i],[c,[h,"Dell"],[f,y]],[/\b(q(?:mv|ta)\w+) b/i],[c,[h,"Verizon"],[f,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[h,"Barnes & Noble"],[f,y]],[/\b(tm\d{3}\w+) b/i],[c,[h,"NuVision"],[f,y]],[/\b(k88) b/i],[c,[h,"ZTE"],[f,y]],[/\b(nx\d{3}j) b/i],[c,[h,"ZTE"],[f,m]],[/\b(gen\d{3}) b.+49h/i],[c,[h,"Swiss"],[f,m]],[/\b(zur\d{3}) b/i],[c,[h,"Swiss"],[f,y]],[/\b((zeki)?tb.*\b) b/i],[c,[h,"Zeki"],[f,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],c,[f,y]],[/\b(ns-?\w{0,9}) b/i],[c,[h,"Insignia"],[f,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[h,"NextBook"],[f,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],c,[f,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],c,[f,m]],[/\b(ph-1) /i],[c,[h,"Essential"],[f,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[h,"Envizen"],[f,y]],[/\b(trio[-\w\. ]+) b/i],[c,[h,"MachSpeed"],[f,y]],[/\btu_(1491) b/i],[c,[h,"Rotor"],[f,y]],[/(shield[\w ]+) b/i],[c,[h,"Nvidia"],[f,y]],[/(sprint) (\w+)/i],[h,c,[f,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[h,O],[f,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[h,U],[f,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[h,U],[f,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,c,[f,v]],[/droid.+; (shield) bui/i],[c,[h,"Nvidia"],[f,v]],[/(playstation [345portablevi]+)/i],[c,[h,D],[f,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[h,O],[f,v]],[/smart-tv.+(samsung)/i],[h,[f,b]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[h,L],[f,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,"LG"],[f,b]],[/(apple) ?tv/i],[h,[c,I+" TV"],[f,b]],[/crkey/i],[[c,C+"cast"],[h,P],[f,b]],[/droid.+aft(\w)( bui|\))/i],[c,[h,E],[f,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[h,M],[f,b]],[/(bravia[\w ]+)( bui|\))/i],[c,[h,D],[f,b]],[/(mitv-\w{5}) bui/i],[c,[h,H],[f,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[h,Y],[c,Y],[f,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[f,b]],[/((pebble))app/i],[h,c,[f,w]],[/droid.+; (glass) \d/i],[c,[h,P],[f,w]],[/droid.+; (wt63?0{2,3})\)/i],[c,[h,U],[f,w]],[/(quest( 2)?)/i],[c,[h,F],[f,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[f,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[f,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[f,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[f,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[f,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[d,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[d,"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],[d,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[d,[p,J,W]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,"Windows"],[p,J,W]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,p],[/\(bb(10);/i],[p,[d,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[d,x+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[d,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[d,C+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[d,"Chromium OS"],p],[/(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],[d,p],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[d,p]]},$=function(e,t){if(typeof e===u&&(t=e,e=o),!(this instanceof $))return new $(e,t).getResult();var r=e||(typeof i!==a&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),n=t?j(K,t):K;return this.getBrowser=function(){var e,t={};return t[d]=o,t[p]=o,V.call(t,r,n.browser),t.major=typeof(e=t.version)===l?e.replace(/[^\d\.]/g,"").split(".")[0]:o,t},this.getCPU=function(){var e={};return e[g]=o,V.call(e,r,n.cpu),e},this.getDevice=function(){var e={};return e[h]=o,e[c]=o,e[f]=o,V.call(e,r,n.device),e},this.getEngine=function(){var e={};return e[d]=o,e[p]=o,V.call(e,r,n.engine),e},this.getOS=function(){var e={};return e[d]=o,e[p]=o,V.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?Y(e,350):e,this},this.setUA(r),this};$.VERSION="0.7.33",$.BROWSER=q([d,p,"major"]),$.CPU=q([g]),$.DEVICE=q([c,h,f,v,m,b,y,w,S]),$.ENGINE=$.OS=q([d,p]),typeof t!==a?(e.exports&&(t=e.exports=$),t.UAParser=$):r.amdO?o===(n=(function(){return $}).call(t,r,t,e))||(e.exports=n):typeof i!==a&&(i.UAParser=$);var G=typeof i!==a&&(i.jQuery||i.Zepto);if(G&&!G.ua){var X=new $;G.ua=X.getResult(),G.ua.get=function(){return X.getUA()},G.ua.set=function(e){X.setUA(e);var t=X.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==typeof window?window:this)},8334:(e,t,r)=>{"use strict";r.d(t,{m:()=>n});var n=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self: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.