PageSourceSearch

https://www.themoonlight.io/_next/static/chunks/5223-687590e4c3981108.js

js themoonlight.io collected 2026-10-02 04:20:25 UTC 343,292 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d658c369-9d06-4a90-98a3-533b02c010aa",e._sentryDebugIdIdentifier="sentry-dbid-d658c369-9d06-4a90-98a3-533b02c010aa")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5223],{22356:function(e,t,n){n.d(t,{IH:function(){return Po},yl:function(){return _o},Zw:function(){return xo},n5:function(){return Ro},yV:function(){return Oo},S1:function(){return Ao},Od:function(){return Mo},mc:function(){return Lo},$z:function(){return Do},Iv:function(){return No},j:function(){return jo}});var r,i=n(69802);!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"}(r||(r={}));var o,s=function(e){return function(){var t=(0,i.pi)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},a=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var o=(0,i.XA)(t.split(".")),s=o.next();!s.done;s=o.next()){var a=s.value;if(!(a in e))return;e=e[a]}}catch(u){n={error:u}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return e},u=function(e,t){return function(){var n,r,o={};try{for(var s=(0,i.XA)(t),u=s.next();!u.done;u=s.next()){var c=u.value;o[c]=a(e,c)}}catch(l){n={error:l}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}},c=function(e,t,n,i,o){return void 0===o&&(o=null),function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];var u=n(),c=u.logger,l=u.logLevel;if(l&&l<r.Debug||!l||!c)return e.apply(o,s);var d,f={type:"invoke public method",name:t,args:s,stacktrace:(d=1,void 0===d&&(d=0),((new Error).stack||"").split("\n").slice(2+d).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};i&&f.states&&(f.states.before=i());var v=e.apply(o,s);return v&&v.promise?v.promise.then((function(){i&&f.states&&(f.states.after=i()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))})):(i&&f.states&&(f.states.after=i()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))),v}},l=function(e){return{promise:e||Promise.resolve()}},d=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(r){return this.logger.debug("Remote config localstorage failed to access: ",r),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 n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(r){return this.logger.debug("Remote config localstorage failed to parse: ",r),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(t){this.logger.debug("Remote config localstorage failed to set: ",t)}return Promise.resolve(!1)},e}(),f=function(){var e="ampIntegrationContext";return"undefined"!==typeof globalThis&&"undefined"!==typeof globalThis[e]?globalThis[e]:"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof self?self:"undefined"!==typeof n.g?n.g:void 0},v=(0,i.ev)([],(0,i.CR)(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),h=function(e){var t,n=f();if(!(null===(t=null===n||void 0===n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,h)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,i.ev)([],(0,i.CR)(r.entries()),!1).map((function(e){var t=(0,i.CR)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(v[r]):v[r]})).join("")},p=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.callbackInfos=[],this.apiKey=e,this.serverUrl=r||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new d(e,t)}return e.prototype.subscribe=function(e,t,n){var r=h(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},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,i.mG)(this,void 0,void 0,(function(){var e,t=this;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return[4,this.fetch()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach((function(n){t.sendCallback(n,e,"remote")})),[2]}}))}))},e.prototype.subscribeAll=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o=this;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return t=this.fetch().then((function(t){o.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),o.sendCallback(e,t,"remote"),o.storage.setConfig(t)})),n=this.storage.fetchConfig().then((function(e){return e})),[4,Promise.race([t,n])];case 1:return void 0!==(r=i.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),this.sendCallback(e,r,"cache")),[4,t];case 2:return i.sent(),[2]}}))}))},e.prototype.subscribeWaitForRemote=function(e,t){return(0,i.mG)(this,void 0,void 0,(function(){var n,r;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:n=new Promise((function(e,n){setTimeout((function(){n("Timeout exceeded")}),t)}
1)),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.fetch(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[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!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}}))}))},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=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(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,i.mG)(this,void 0,void 0,(function(){var n,r,o,s,a,u,c=this;return(0,i.Jh)(this,(function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},o=function(r){var o,a,u,l,d;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:o=new AbortController,a=setTimeout((function(){return o.abort()}),t),i.label=1;case 1:return i.trys.push([1,7,8,9]),[4,fetch(s.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:o.signal})];case 2:return(u=i.sent()).ok?[3,4]:[4,u.text()];case 3:return l=i.sent(),s.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(u.status,": ").concat(l)),[3,6];case 4:return[4,u.json()];case 5:return[2,{value:{remoteConfig:i.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=i.sent())instanceof Error&&"AbortError"===d.name?s.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):s.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:return r<e-1?[4,new Promise((function(e){return setTimeout(e,c.getJitterDelay(n))}))]:[3,11];case 10:i.sent(),i.label=11;case 11:return[2]}}
1))},s=this,a=0,l.label=1;case 1:return a<e?[5,o(a)]:[3,4];case 2:if("object"===typeof(u=l.sent()))return[2,u.value];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}}))}))},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}(),g="tags",m="counters",y="histograms",b="events",w="internal",S="last_flush_timestamp",I=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 void 0!==(null===(e=f())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(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,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;
1n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(t){var n=t.target.result;e.createTables(n)}}))},e.prototype.createTables=function(e){(e.objectStoreNames.contains(g)||e.createObjectStore(g,{keyPath:"key"}),e.objectStoreNames.contains(m)||e.createObjectStore(m,{keyPath:"key"}),e.objectStoreNames.contains(y)||e.createObjectStore(y,{keyPath:"key"}),e.objectStoreNames.contains(b))||e.createObjectStore(b,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(w)||e.createObjectStore(w,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o,s=this;return(0,i.Jh)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([g],"readwrite"),r=n.objectStore(g),[2,new Promise((function(t){var o=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},o.forEach((function(e){var t=(0,i.CR)(e,2),n=t[0],o=t[1];r.put({key:n,value:o}).onerror=function(e){s.logger.debug("DiagnosticsStorage: Failed to set tag",n,o,e)}}))}))];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",o),[3,3];case 3:return[2]}}
1))}))},e.prototype.incrementCounters=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o,s=this;return(0,i.Jh)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([m],"readwrite"),r=n.objectStore(m),[2,new Promise((function(t){var o=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},o.forEach((function(e){var t=(0,i.CR)(e,2),n=t[0],o=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+o}).onerror=function(e){s.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){s.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}}))}))];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",o),[3,3];case 3:return[2]}}))}))},e.prototype.setHistogramStats=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o,s=this;return(0,i.Jh)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([y],"readwrite"),r=n.objectStore(y),[2,new Promise((function(t){var o=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},o.forEach((function(e){var t=(0,i.CR)(e,2),n=t[0],o=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.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){s.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){s.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}}))}))];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",o),[3,3];case 3:return[2]}}
1))}))},e.prototype.addEventRecords=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o,s=this;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=i.sent(),n=t.transaction([b],"readwrite"),r=n.objectStore(b),[2,new Promise((function(t){n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&s.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach((function(e){r.add(e).onerror=function(e){s.logger.debug("DiagnosticsStorage: Failed to add event record",e)}}))},i.onerror=function(e){s.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}}))];case 2:return o=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",o),[3,3];case 3:return[2]}}))}))},e.prototype.setInternal=function(e,t){return(0,i.mG)(this,void 0,void 0,(function(){var n,r,o,s;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=i.sent(),r=n.transaction([w],"readwrite"),o=r.objectStore(w),[2,new Promise((function(n,i){r.onabort=function(){return i(new Error("Failed to set internal value"))};var s=o.put({key:e,value:t});s.onsuccess=function(){return n()},s.onerror=function(){return i(new Error("Failed to set internal value"))}}))];case 2:return s=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",s),[3,3];case 3:return[2]}}
1))}))},e.prototype.getInternal=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=i.sent(),n=t.transaction([w],"readonly"),r=n.objectStore(w),[2,new Promise((function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}}))];case 2:return o=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",o),[2,void 0];case 3:return[2]}}))}))},e.prototype.getLastFlushTimestamp=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e,t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(S)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}}
1))}))},e.prototype.setLastFlushTimestamp=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(S,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.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(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}}))},e.prototype.getAllAndClear=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e,t,n,r,o,s,a,u;return(0,i.Jh)(this,(function(c){switch(c.label){case 0:return c.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=c.sent(),t=e.transaction([g,m,y,b],"readwrite"),[4,Promise.all([this.getAllFromStore(t,g),this.getAllFromStore(t,m),this.getAllFromStore(t,y),this.getAllFromStore(t,b)])];case 2:return n=i.CR.apply(void 0,[c.sent(),4]),r=n[0],o=n[1],s=n[2],a=n[3],[4,Promise.all([this.clearTable(t,m),this.clearTable(t,y),this.clearTable(t,b)])];case 3:return c.sent(),[2,{tags:r,counters:o,histogramStats:s,events:a}];case 4:return u=c.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",u),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}}
1))}))},e.prototype.getAllFromStore=function(e,t){return new Promise((function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}}))},e}(),E=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},k=function(e,t){var n=E(e.toString());return 31*Math.abs(n)%1e5/1e5<t},C=3e5,T=1e4,P=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"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(r,null,2)),this.config=(0,i.pi)({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=k(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,I.isSupported()?this.storage=new I(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval()}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=T?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=T?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>=T)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?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}))}),C))},e.prototype.saveAllDataToStorage=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e,t,n,r;return(0,i.Jh)(this,(function(o){switch(o.label){case 0:return this.storage?(e=(0,i.pi)({},this.inMemoryTags),t=(0,i.pi)({},this.inMemoryCounters),n=(0,i.pi)({},this.inMemoryHistograms),r=(0,i.ev)([],(0,i.CR)(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(n),this.storage.addEventRecords(r)])]):[2];case 1:return o.sent(),[2]}}))}))},e.prototype._flush=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e,t,n,r,o,s,a,u,c,l;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return i.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=i.sent(),t=e.tags,n=e.counters,r=e.histogramStats,o=e.events,this.storage.setLastFlushTimestamp(Date.now()),s={},t.forEach((function(e){s[e.key]=e.value})),a={}
1,n.forEach((function(e){a[e.key]=e.value})),u={},r.forEach((function(e){u[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}})),c=o.map((function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}})),0===Object.keys(a).length&&0===Object.keys(u).length&&0===c.length?[2]:(l={tags:s,histogram:u,counters:a,events:c},this.fetch(l),[2])}}))}))},e.prototype.fetch=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!f())throw new 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:return n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}}
1))}))},e.prototype.initializeFlushInterval=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e,t,n;return(0,i.Jh)(this,(function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(C),[2]):(n=e-t)>=C?(this._flush(),[2]):(this._setFlushTimer(C-n),[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=k(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),_=function(){var e,t=f();return(null===(e=null===t||void 0===t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=x(n[0]),i=x(n[1]);return i?(e[r]=i,e):e}),{}):{}},x=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(t){return""}},R=n(69635),O=n(7126),A=function(e){return void 0===e&&(e=O.JE),R.V.getInstance(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"}(o||(o={}));var M=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=o.Unknown),{event:e,code:t,message:n}},L="Amplitude Logger ",D=function(){function e(){this.logLevel=r.None}return e.prototype.disable=function(){this.logLevel=r.None},e.prototype.enable=function(e){void 0===e&&(e=r.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Verbose||console.log("".concat(L,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Warn||console.warn("".concat(L,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Error||console.error("".concat(L,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Debug||console.log("".concat(L,"[Debug]: ").concat(e.join(" ")))},e}(),N=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:O.JE,logLevel:r.Warn,loggerProvider:new D,offline:!1,optOut:!1,serverUrl:O.EG,serverZone:"US",useBatch:!1}},j=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=N();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=q(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}(),F=function(e,t){return"EU"===e?t?O.RE:O.y_:t?O.h8:O.EG},q=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=N().serverZone),void 0===n&&(n=N().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:N().serverZone;return{serverZone:r,serverUrl:F(r,n)}},U=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function G(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(n){}return t}var J,B=function(){function 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=[]}return e.prototype.setup=function(e){var t;return(0,i.mG)(this,void 0,void 0,(function(){var n,r=this;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(O.f1,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map((function(e){return r.execute(e)}
1))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=h()),new Promise((function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),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)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout((function(){t.queue=t.queue.map((function(e){return e.timeout=0,e})),t.flush(!0)}),e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,i.mG)(this,void 0,void 0,(function(){var t,n,r=this;return(0,i.Jh)(this,(function(o){switch(o.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),[4,function(e,t){var n=Math.max(t,1);return e.reduce((function(e,t,r){var i=Math.floor(r/n);return e[i]||(e[i]=[]),e[i].push(t),e}),[])}(t,this.config.flushQueueSize).reduce((function(t,n){return(0,i.mG)(r,void 0,void 0,(function(){return(0,i.Jh)(this,(function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}}))}))}),Promise.resolve())]);case 1:return o.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,i.mG)(this,void 0,void 0,(function(){var n,r,s,a,u;return(0,i.Jh)(this,(function(c){switch(c.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;t.extra;return(0,i._T)(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new U,c.label=1;case 1:return c.trys.push([1,3,,4]),r=q(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(s=c.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(G(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return a=c.sent(),u=(l=a)instanceof Error?l.message:String(l),this.config.loggerProvider.error(u),this.handleResponse({status:o.Failed,statusCode:0},e),[3,4];case 4:return[2]}var l}))}))},e.prototype.handleResponse=function(e,t){var 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 n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=(0,i.ev)((0,i.ev)((0,i.ev)((0,i.ev)([],(0,i.CR)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,i.CR)(Object.values(e.body.eventsWithMissingFields)),!1),(0,i.CR)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,i.CR)(e.body.silencedEvents),!1).flat(),o=new Set(r),s=t.filter((function(t,r){if(!o.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));s.length>0&&this.config.loggerProvider.warn(G(e));
1var a=this.removeEventsExceedFlushMaxRetries(s);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(G(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),a=new Set(i),u=new Set(o),c=t.filter((function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(G(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(M(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),H=function(){function e(){this.name="identity",this.type="before",this.identityStore=A().identityStore}return e.prototype.execute=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t;return(0,i.Jh)(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return e.instanceName&&(this.identityStore=A(e.instanceName).identityStore),[2]}))}))},e}(),W=n(80493),z=n(12785),K=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(0,z.L)(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?(0,i.pi)({},this.properties):{};return e[J.REVENUE_PRODUCT_ID]=this.productId,e[J.REVENUE_QUANTITY]=this.quantity,e[J.REVENUE_PRICE]=this.price,e[J.REVENUE_TYPE]=this.revenueType,e[J.REVENUE_CURRENCY]=this.currency,e[J.REVENUE]=this.revenue,e[J.RECEIPT]=this.receipt,e[J.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"}(J||(J={}));var X,V,$=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>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"}(X||(X={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(V||(V={}));var Z=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=h(),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!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e,t){var n;return(0,i.mG)(this,void 0,void 0,(function(){var r,o;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return r=this.plugins.findIndex((function(t){return t.name===e})),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(o=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=o.teardown)||void 0===n?void 0:n.call(o)]);case 1:return i.sent(),[2]}}))}))},e.prototype.reset=function(e){this.applying=!1,this.plugins.map((function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)})),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o,s,a,u,c,l,d,f,v,h,p,g,m,y,b,w,S;return(0,i.Jh)(this,(function(I){switch(I.label){case 0:if(!e)return[2];t=(0,i.CR)(e,1),n=t[0],r=(0,i.CR)(e,2),o=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),s=this.plugins.filter((function(e){return"before"===e.type})),I.label=1;case 1:I.trys.push([1,6,7,8]),a=(0,i.XA)(s),u=a.next(),I.label=2;case 2:return u.done?[3,5]:(v=u.value).execute?[4,v.execute((0,i.pi)({},n))]:[3,4];case 3:if(null===(h=I.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=h,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),I.label=4;case 4:return u=a.next(),[3,2];case 5:return[3,8];case 6:return c=I.sent(),y={error:c},[3,8];case 7:try{u&&!u.done&&(b=a.return)&&b.call(a)}finally{if(y)throw y.error}
1return[7];case 8:l=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),I.label=9;case 9:I.trys.push([9,14,15,16]),d=(0,i.XA)(l),f=d.next(),I.label=10;case 10:return f.done?[3,13]:(v=f.value).execute?[4,v.execute((0,i.pi)({},n))]:[3,12];case 11:if(null===(h=I.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=h,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),I.label=12;case 12:return f=d.next(),[3,10];case 13:return[3,16];case 14:return p=I.sent(),w={error:p},[3,16];case 15:try{f&&!f.done&&(S=d.return)&&S.call(d)}finally{if(w)throw w.error}return[7];case 16:return g=this.plugins.filter((function(e){return"destination"===e.type})),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),m=g.map((function(e){var t=(0,i.pi)({},n);return e.execute(t).catch((function(e){return M(t,0,String(e))}))})),Promise.all(m).then((function(e){var t=(0,i.CR)(e,1)[0]||M(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e,t,n,r=this;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return r.apply(e)})))];case 1:return i.sent(),t=this.plugins.filter((function(e){return"destination"===e.type})),n=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(n)];case 2:return i.sent(),[2]}}))}))},e.prototype.onIdentityChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)}))},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)}))},e.prototype.onOptOutChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}))},e}(),Q=function(e,t){return(0,i.pi)((0,i.pi)({},t),{event_type:V.IDENTIFY,user_properties:e.getUserProperties()})},Y=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 Z(this),this.name=e}return e.prototype._init=function(e){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(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,i.mG)(this,void 0,void 0,(function(){var t,n,r,o,s,a,u,c;return(0,i.Jh)(this,(function(l){switch(l.label){case 0:t=this[e],this[e]=[],l.label=1;case 1:l.trys.push([1,8,9,10]),n=(0,i.XA)(t),r=n.next(),l.label=2;case 2:return r.done?[3,7]:(o=r.value,(s=o())&&"promise"in s?[4,s.promise]:[3,4]);case 3:return l.sent(),[3,6];case 4:return[4,s];case 5:l.sent(),l.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return a=l.sent(),u={error:a},[3,10];case 9:try{r&&!r.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:l.sent(),l.label=12;case 12:return[2]}}
1))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){var r="string"===typeof e?{event_type:e}:e;return(0,i.pi)((0,i.pi)((0,i.pi)({},r),n),t&&{event_properties:t})}(e,t,n);return l(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Q(e,t);return l(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var o=function(e,t,n,r){var o;return(0,i.pi)((0,i.pi)({},r),{event_type:V.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n,r);return l(this.dispatch(o))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,o=new W.h2;return o.set(e,t),(0,i.pi)((0,i.pi)({},n),{event_type:V.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return l(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return(0,i.pi)((0,i.pi)({},t),{event_type:V.REVENUE,event_properties:e.getEventProperties()})}(e,t);return l(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),l())},e.prototype._addPlugin=function(e){return l(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)),l())},e.prototype._removePlugin=function(e){return l(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(M(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t=this;return(0,i.Jh)(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.getOperationAppliedUserProperties=function(e){var t={};if(void 0===e)return t;var n={};return Object.keys(e).forEach((function(t){Object.values(X).includes(t)||(n[t]=e[t])}
1)),W.rk.forEach((function(n){if(Object.keys(e).includes(n)){var r=e[n];switch(n){case X.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case X.UNSET:Object.keys(r).forEach((function(e){delete t[e]}));break;case X.SET:Object.assign(t,r)}}})),Object.assign(t,n),t},e.prototype.process=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r,o;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,M(e,0,"Event skipped due to optOut config")]:(e.event_type===V.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)]);case 1:return 200===(o=i.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=i.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=M(e,0,r)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=Boolean(e))},e.prototype.flush=function(){return l(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find((function(t){return t.name===e}));if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter((function(t){return t instanceof e}))},e}(),ee=function(e,t){return"boolean"===typeof e?e:!1!==(null===e||void 0===e?void 0:e[t])},te=function(e){return ee(e,"attribution")},ne=function(e){return ee(e,"pageViews")},re=function(e){return ee(e,"sessions")},ie=function(e){return"boolean"===typeof e?e:"object"===typeof e&&(!0===e.networkTracking||"object"===typeof e.networkTracking)},oe=function(e){return"boolean"===typeof e?e:"object"===typeof e&&(!0===e.elementInteractions||"object"===typeof e.elementInteractions)},se=function(e){return"boolean"===typeof e?e:"object"===typeof e&&(!0===e.frustrationInteractions||"object"===typeof e.frustrationInteractions)},ae=function(e){if(oe(e.autocapture)&&"object"===typeof e.autocapture&&"object"===typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},ue=function(e){if(se(e.autocapture)&&"object"===typeof e.autocapture&&"object"===typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},ce=function(e){var t;if(ie(e.autocapture)){var n=void 0;return"object"===typeof e.autocapture&&"object"===typeof e.autocapture.networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),(0,i.pi)((0,i.pi)({},n),{captureRules:null===(t=null===n||void 0===n?void 0:n.captureRules)||void 0===t?void 0:t.map((function(t){var n,r,o;if((null===(n=t.urls)||void 0===n?void 0:n.length)&&(null===(r=t.hosts)||void 0===r?void 0:r.length)){var s=JSON.stringify(t.hosts),a=JSON.stringify(t.urls);return null===(o=e.loggerProvider)||void 0===o||o.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(s,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,i.pi)((0,i.pi)({},t),{hosts:void 0})}return t}))})}},le=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return ne(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"===typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"===typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},de=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.resolve,a=e&&e[i];if("function"===typeof a){var u=a.apply(e,o);"function"===typeof s&&s(null===u||void 0===u?void 0:u.promise)}}return e},fe=function(e){return e&&void 0!==e._q},ve=function(){var e,t,n,r;if("undefined"===typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},he="2.29.0",pe="amplitude-ts",ge=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(pe,"/").concat(he),"undefined"!==typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return(0,i.mG)(this,void 0,void 0,(function(){var r,o,s;return(0,i.Jh)(this,(function(a){return r=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,s=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=r),[2,(0,i.pi)((0,i.pi)((0,i.pi)((0,i.pi)((0,i.pi)((0,i.pi)((0,i.pi)((0,i.pi)({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:ve()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:h(),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:s,library:this.library,user_agent:this.userAgent})]}))}))},e}(),me=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}
1))},e.prototype.remove=function(e){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),ye=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[O.xp,t,e.substring(0,n)].filter(Boolean).join("_")},be=function(){function e(e){this.options=(0,i.pi)({},e)}return e.prototype.isEnabled=function(){return(0,i.mG)(this,void 0,void 0,(function(){var t,n;return(0,i.Jh)(this,(function(r){switch(r.label){case 0:if(!f())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return r.sent(),[4,t.get(n)];case 3:return[2,r.sent()===e.testValue];case 4:return r.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){var t;return(0,i.mG)(this,void 0,void 0,(function(){var n,r;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=i.sent()))return[2,void 0];try{return void 0===(r=null!==(t=we(n))&&void 0!==t?t:Se(n))?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(r)]}catch(o){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}}
1))}))},e.prototype.getRaw=function(e){var t,n;return(0,i.mG)(this,void 0,void 0,(function(){var r,o,s;return(0,i.Jh)(this,(function(i){return r=f(),o=null!==(n=null===(t=null===r||void 0===r?void 0:r.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],s=o.find((function(t){return 0===t.indexOf(e+"=")})),s?[2,s.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return(0,i.mG)(this,void 0,void 0,(function(){var r,o,s,a,u,c,l;return(0,i.Jh)(this,(function(i){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,s=void 0,(o=null!==t?r:-1)&&((a=new Date).setTime(a.getTime()+24*o*60*60*1e3),s=a),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(u+="; expires=".concat(s.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(c=f())&&(c.document.cookie=u)}catch(d){l=d instanceof Error?d.message:String(d),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,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(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,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(e){return[2]}))}))},e}(),we=function(e){try{return decodeURIComponent(atob(e))}catch(t){return}},Se=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(t){return}},Ie=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,s,a,u,c,l,d,f,v,h,p,g,m,y,b,w,S,I,E;if("object"!==typeof e)return null;var k=e.code||0,C=this.buildStatus(k);switch(C){case o.Success:return{status:C,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case o.Invalid:return{status:C,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(s=e.missing_field)&&void 0!==s?s:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(v=e.silenced_events)&&void 0!==v?v:[],throttledDevices:null!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case o.PayloadTooLarge:return{status:C,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case o.RateLimit:return{status:C,statusCode:k,body:{error:null!==(m=e.error)&&void 0!==m?m:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(I=e.exceeded_daily_quota_users)&&void 0!==I?I:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case o.Timeout:default:return{status:C,statusCode:k}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?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}(),Ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,i.ZT)(t,e),t.prototype.send=function(e,t){return(0,i.mG)(this,void 0,void 0,(function(){var n,r,o;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:if("undefined"===typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"}
1,[4,fetch(e,n)];case 1:return[4,(r=i.sent()).text()];case 2:o=i.sent();try{return[2,this.buildResponse(JSON.parse(o))]}catch(s){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},t}(Ie),ke=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,i.mG)(this,void 0,void 0,(function(){var t,n,r;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return(0,i.mG)(this,void 0,void 0,(function(){var t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}}
1))}))},e.prototype.getRaw=function(e){var t;return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(i){}return[2]}))}))},e.prototype.remove=function(e){var t;return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(r){}return[2]}))}))},e.prototype.reset=function(){var e;return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(n){}return[2]}))}))},e}(),Ce=1e3,Te=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=f())||void 0===n?void 0:n.localStorage}catch(Ti){null===(r=null===t||void 0===t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(Ti))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null===t||void 0===t?void 0:t.loggerProvider,o}return(0,i.ZT)(t,e),t.prototype.set=function(t,n){var r;return(0,i.mG)(this,void 0,void 0,(function(){var o;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return Array.isArray(n)&&n.length>Ce?(o=n.length-Ce,[4,e.prototype.set.call(this,t,n.slice(0,Ce))]):[3,2];case 1:return i.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Ce,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:i.sent(),i.label=4;case 4:return[2]}}
1))}))},t}(ke),Pe=function(e){function t(){var t;return e.call(this,null===(t=f())||void 0===t?void 0:t.sessionStorage)||this}return(0,i.ZT)(t,e),t}(ke),_e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return(0,i.ZT)(t,e),t.prototype.send=function(e,t){return(0,i.mG)(this,void 0,void 0,(function(){var n=this;return(0,i.Jh)(this,(function(r){return[2,new Promise((function(i,o){"undefined"===typeof XMLHttpRequest&&o(new Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",e,!0),s.onreadystatechange=function(){if(s.readyState===n.state.done){var e=s.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(r){i(n.buildResponse({code:s.status}))}}},s.setRequestHeader("Content-Type","application/json"),s.setRequestHeader("Accept","*/*"),s.send(JSON.stringify(t))}))]}))}))},t}(Ie),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,i.ZT)(t,e),t.prototype.send=function(e,t){return(0,i.mG)(this,void 0,void 0,(function(){var n=this;return(0,i.Jh)(this,(function(r){return[2,new Promise((function(r,i){var o=f();if(!(null===o||void 0===o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return r(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(Ti){i(Ti)}}))]}))}))},t}(Ie),Re=function(e,t,n){return void 0===n&&(n=!0),(0,i.mG)(void 0,void 0,void 0,(function(){var r,o,s,a,u,c,l,d,f;return(0,i.Jh)(this,(function(v){switch(v.label){case 0:return r=function(e){return"".concat(O.xp.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(o=v.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:v.sent(),v.label=3;case 3:return s=(0,i.CR)(o.split("."),6),a=s[0],u=s[1],c=s[2],l=s[3],d=s[4],f=s[5],[2,{deviceId:a,userId:Ae(u),sessionId:Oe(l),lastEventId:Oe(f),lastEventTime:Oe(d),optOut:Boolean(c)}]}}))}))},Oe=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ae=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(t){return}},Me="[Amplitude]",Le=("".concat(Me," Page Viewed"),"".concat(Me," Form Started")),De="".concat(Me," Form Submitted"),Ne="".concat(Me," File Downloaded"),je="session_start",Fe="session_end",qe="".concat(Me," File Extension"),Ue="".concat(Me," File Name"),Ge="".concat(Me," Link ID"),Je="".concat(Me," Link Text"),Be="".concat(Me," Link URL"),He="".concat(Me," Form ID"),We="".concat(Me," Form Name"),ze="".concat(Me," Form Destination"),Ke="cookie",Xe=function(e){function t(t,n,i,o,s,a,u,c,l,d,f,v,h,p,g,m,y,b,w,S,I,E,k,C,T,P,_,x,R,O,A,M,L,N,j,F,q,U,G,J){void 0===i&&(i=new me),void 0===o&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===c&&(c=1e3),void 0===l&&(l=5),void 0===d&&(d=30),void 0===f&&(f=Ke),void 0===m&&(m=new D),void 0===y&&(y=r.Warn),void 0===w&&(w=!1),void 0===S&&(S=!1),void 0===k&&(k=""),void 0===C&&(C="US"),void 0===P&&(P=18e5),void 0===_&&(_=new Te({loggerProvider:m})),void 0===x&&(x={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===O&&(O=!1),void 0===A&&(A=!0),void 0===q&&(q=!0),void 0===U&&(U=0);var B=e.call(this,{apiKey:t,storageProvider:_,transportProvider:Ze(R)})||this;return B.apiKey=t,B.appVersion=n,B.cookieOptions=o,B.defaultTracking=s,B.autocapture=a,B.flushIntervalMillis=c,B.flushMaxRetries=l,B.flushQueueSize=d,B.identityStorage=f,B.ingestionMetadata=v,B.instanceName=h,B.loggerProvider=m,B.logLevel=y,B.minIdLength=b,B.offline=w,B.partnerId=I,B.plan=E,B.serverUrl=k,B.serverZone=C,B.sessionTimeout=P,B.storageProvider=_,B.trackingOptions=x,B.transport=R,B.useBatch=O,B.fetchRemoteConfig=A,B.networkTrackingOptions=j,B.identify=F,B.enableDiagnostics=q,B.diagnosticsSampleRate=U,B.diagnosticsClient=G,B.remoteConfig=J,B.version=he,B._optOut=!1,B._cookieStorage=i,B.deviceId=u,B.lastEventId=p,B.lastEventTime=g,B.optOut=S,B.sessionId=T,B.pageCounter=L,B.userId=M,B.debugLogsEnabled=N,B.loggerProvider.enable(N?r.Debug:B.logLevel),B.networkTrackingOptions=j,B.identify=F,B.enableDiagnostics=q,B.diagnosticsSampleRate=U,B.diagnosticsClient=G,A&&(B.remoteConfig||(B.remoteConfig={fetchRemoteConfig:A}),B.remoteConfig.fetchRemoteConfig||(B.remoteConfig.fetchRemoteConfig=A)),B}return(0,i.ZT)(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};this.cookieStorage.set(ye(this.apiKey),e)},t}(j),Ve=function(e,t,n){return void 0===t&&(t={}),(0,i.mG)(void 0,void 0,void 0,(function(){var r,o,s,a,u,c,l,d,f,v,p,g,m,y,b,w,S,I,E,k,C,T,P,x,R,O,A,M,L,D,N,j,F,q,U,G,J,B,H,W,z,K,X,V,$;return(0,i.Jh)(this,(function(Z){switch(Z.label){case 0:return r=t.identityStorage||Ke,C={},r===Ke?[3,1]:(s="",[3,5]);case 1:return null===(P=null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)||void 0===P?[3,2]:(a=P,[3,4]);case 2:return[4,Qe()];case 3:a=Z.sent(),Z.label=4;case 4:s=a,Z.label=5;case 5:return o=i.pi.apply(void 0,[(C.domain=s,C.expiration=365,C.sameSite="Lax",C.secure=!1,C.upgrade=!0,C),t.cookieOptions]),u=$e(t.identityStorage,o),[4,Re(e,u,null===(R=null===(x=t.cookieOptions)||void 0===x?void 0:x.upgrade)||void 0===R||R)];case 6:return c=Z.sent(),[4,u.get(ye(e))];case 7:return l=Z.sent(),d=_(),f=d.ampTimestamp?Number(d.ampTimestamp):void 0,v=!f||Date.now()<f,p=null!==(D=null!==(L=null!==(M=null!==(O=t.deviceId)&&void 0!==O?O:v?null!==(A=d.ampDeviceId)&&void 0!==A?A:d.deviceId:void 0)&&void 0!==M?M:null===l||void 0===l?void 0:l.deviceId)&&void 0!==L?L:c.deviceId)&&void 0!==D?D:h(),g=null!==(N=null===l||void 0===l?void 0:l.lastEventId)&&void 0!==N?N:c.lastEventId,m=null!==(j=null===l||void 0===l?void 0:l.lastEventTime)&&void 0!==j?j:c.lastEventTime,y=null!==(q=null!==(F=t.optOut)&&void 0!==F?F:null===l||void 0===l?void 0:l.optOut)&&void 0!==q?q:c.optOut,b=null!==(U=null===l||void 0===l?void 0:l.sessionId)&&void 0!==U?U:c.sessionId,w=null!==(J=null!==(G=t.userId)&&void 0!==G?G:null===l||void 0===l?void 0:l.userId)&&void 0!==J?J:c.userId,n.previousSessionDeviceId=null!==(B=null===l||void 0===l?void 0:l.deviceId)&&void 0!==B?B:c.deviceId,n.previousSessionUserId=null!==(H=null===l||void 0===l?void 0:l.userId)&&void 0!==H?H:c.userId,S={ipAddress:null===(z=null===(W=t.trackingOptions)||void 0===W?void 0:W.ipAddress)||void 0===z||z,language:null===(X=null===(K=t.trackingOptions)||void 0===K?void 0:K.language)||void 0===X||X,platform:null===($=null===(V=t.trackingOptions)||void 0===V?void 0:V.platform)||void 0===$||$},I=null===l||void 0===l?void 0:l.pageCounter,E=null===l||void 0===l?void 0:l.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(k=new Xe(e,t.appVersion,u,o,t.defaultTracking,t.autocapture,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,g,m,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,b,t.sessionTimeout,t.storageProvider,S,t.transport,t.useBatch,t.fetchRemoteConfig,w,I,E,t.networkTrackingOptions,t.identify,t.enableDiagnostics,void 0,void 0,t.remoteConfig)).storageProvider.isEnabled()];case 8:return Z.sent()||(k.loggerProvider.warn("Storage provider ".concat(k.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),k.storageProvider=new me),[2,k]}}))}))},$e=function(e,t){switch(void 0===e&&(e=Ke),void 0===t&&(t={}),e){case"localStorage":return new Te;case"sessionStorage":return new Pe;case"none":return new me;default:return new be((0,i.pi)((0,i.pi)({},t),{expirationDays:t.expiration}))}},Ze=function(e){return"xhr"===e?new _e:"beacon"===e?new xe:new Ee},Qe=function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){var t,n,r,o,s,a,u;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return[4,(ne
1w be).isEnabled()];case 1:if(!i.sent()||!e&&("undefined"===typeof location||!location.hostname))return[2,""];for(t=null!==e&&void 0!==e?e:location.hostname,n=t.split("."),r=[],o="AMP_TLDTEST",s=n.length-2;s>=0;--s)r.push(n.slice(s).join("."));s=0,i.label=2;case 2:return s<r.length?(a=r[s],[4,(u=new be({domain:"."+a})).set(o,1)]):[3,7];case 3:return i.sent(),[4,u.get(o)];case 4:return i.sent()?[4,u.remove(o)]:[3,6];case 5:return i.sent(),[2,"."+a];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},Ye="data-amp-mask",et="*****",tt=/\b(?:\d[ -]*?){13,16}\b/,nt=/(\d{3}-?\d{2}-?\d{4})/g,rt=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,it=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!==typeof e)return"";var o=e;o=(o=(o=o.replace(tt,et)).replace(nt,et)).replace(rt,et);try{for(var s=(0,i.XA)(t),a=s.next();!a.done;a=s.next()){var u=a.value;try{o=o.replace(u,et)}catch(c){}}}catch(l){n={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o},ot=function(e){if("undefined"===typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(Ye)?et:e?e(document.title):document.title},st=function(){function e(){}return e.prototype.parse=function(){return(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(e){return[2,(0,i.pi)((0,i.pi)((0,i.pi)((0,i.pi)({},O.Lo),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=_();return{utm_campaign:e[O.VX],utm_content:e[O.fZ],utm_id:e[O.KI],utm_medium:e[O.lP],utm_source:e[O.b3],utm_term:e[O.NE]}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(r){}return n},e.prototype.getClickIds=function(){var e,t=_();return(e={})[O.ah]=t[O.ah],e[O.rV]=t[O.rV],e[O.fC]=t[O.fC],e[O.Ji]=t[O.Ji],e[O.bz]=t[O.bz],e[O.tS]=t[O.tS],e[O.pr]=t[O.pr],e[O.Kh]=t[O.Kh],e[O.cl]=t[O.cl],e[O.oZ]=t[O.oZ],e[O.pG]=t[O.pG],e},e}(),at=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},ut=function(e){var t;void 0===e&&(e={});var n,r=f(),o=void 0,s=!1,a=e.trackOn,u=e.trackHistoryChanges,c=e.eventType,l=void 0===c?"[Amplitude] Page Viewed":c,d=function(e){var t=e;try{t=decodeURI(e)}catch(Ti){null===o||void 0===o||o.error("Malformed URI sequence: ",Ti)}return t},v=function(){return(0,i.mG)(void 0,void 0,void 0,(function(){var e,t,n;return(0,i.Jh)(this,(function(r){switch(r.label){case 0:return e=d("undefined"!==typeof location&&location.href||""),n={event_type:l},t=[{}],[4,ct()];case 1:return[2,(n.event_properties=i.pi.apply(void 0,[i.pi.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"undefined"!==typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!==typeof location&&d(location.pathname)||"","[Amplitude] Page Title":ot(it),"[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},h=function(){return"undefined"===typeof a||"function"===typeof a&&a()},p="undefined"!==typeof location?location.href:null,g=function(){return(0,i.mG)(void 0,void 0,void 0,(function(){var e,n,r,s;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return e=location.href,n=dt(u,e,p||"")&&h(),p=e,n?(null===o||void 0===o||o.log("Tracking page view event"),null!==t&&void 0!==t?[3,1]:(void 0,[3,3])):[3,4];case 1:return s=(r=t).track,[4,v()];case 2:s.apply(r,[i.sent()]),i.label=3;case 3:i.label=4;case 4:return[2]}}
1))}))},m=function(){g()},y={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return(0,i.mG)(void 0,void 0,void 0,(function(){var u,c;return(0,i.Jh)(this,(function(l){switch(l.label){case 0:return t=a,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,r&&(r.addEventListener("popstate",m),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=(0,i.CR)(n,3),o=r[0],a=r[1],u=r[2];e.apply(t,[o,a,u]),s&&g()}})),h()?(o.log("Tracking page view event"),c=(u=t).track,[4,v()]):[3,2];case 1:c.apply(u,[l.sent()]),l.label=2;case 2:return[2]}}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){var t;return(0,i.Jh)(this,(function(r){switch(r.label){case 0:return"attribution"===a&&lt(e)?(null===o||void 0===o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,v()]):[3,2];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=(0,i.pi)((0,i.pi)({},e.event_properties),t.event_properties),r.label=2;case 2:return n&&e.event_type===l&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=(0,i.pi)((0,i.pi)({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(e){return r&&(r.removeEventListener("popstate",m),s=!1),[2]}))}))}};return y},ct=function(){return(0,i.mG)(void 0,void 0,void 0,(function(){var e;return(0,i.Jh)(this,(function(t){switch(t.label){case 0:return e=at,[4,(new st).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},lt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[X.SET]||{},r=t[X.UNSET]||{},o=(0,i.ev)((0,i.ev)([],(0,i.CR)(Object.keys(n)),!1),(0,i.CR)(Object.keys(r)),!1);return Object.keys(O.Lo).every((function(e){return o.includes(e)}))}return!1},dt=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},ft=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return(0,i.mG)(void 0,void 0,void 0,(function(){var o,s;return(0,i.Jh)(this,(function(i){return o=function(){if(r){if("undefined"!==typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n,i=ht(e);t||r.track(Le,((n={})[He]=vt(e.id),n[We]=vt(e.name),n[ze]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=ht(e);t||r.track(Le,((n={})[He]=vt(e.id),n[We]=vt(e.name),n[ze]=o,n)),r.track(De,((i={})[He]=vt(e.id),i[We]=vt(e.name),i[ze]=o,i)),t=!1}))};Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!==typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"===typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(s=f())?s.addEventListener("load",o):t.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,e]}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return null===e||void 0===e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null===t||void 0===t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},vt=function(e){if("string"===typeof e)return e},ht=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!==t&&void 0!==t?t:""),window.location.href).href}catch(n){}return t},pt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return(0,i.mG)(void 0,void 0,void 0,(function(){var o,s;return(0,i.Jh)(this,(function(i){return o=function(){if(r){if("undefined"!==typeof document){var o=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(i){return}var o=s.exec(n.href),a=null===o||void 0===o?void 0:o[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",(function(){var t;a&&r.track(Ne,((t={})[qe]=a,t[Ue]=n.pathname,t[Ge]=e.id,t[Je]=e.text,t[Be]=e.href,t))}))},s=/\.(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(o),"undefined"!==typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&o(e),"querySelectorAll"in e&&"function"===typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(o)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?o():(s=f())?s.addEventListener("load",o):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,e]}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return null===e||void 0===e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null===t||void 0===t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},gt=!1,mt=function(){var e=f(),t=[],n=function(n,r){(null===e||void 0===e?void 0:e.addEventListener)&&(null===e||void 0===e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(r){return"undefined"===typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",(function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout((function(){t.flush()}),e.flushIntervalMillis)})),n("offline",(function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2])}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;null===e||void 0===e||e.removeEventListener(n,r)})),t=[],[2]}))}))}}};function yt(e){var t,n,r,o,s,a,u,c,l,d,f;if("object"===typeof e&&null!==e&&!Array.isArray(e)){var v=Object.keys(e);try{for(var h=(0,i.XA)(v),p=h.next();!p.done;p=h.next()){var g=p.value;try{var m=e[g];"boolean"===typeof(null===m||void 0===m?void 0:m.enabled)&&(m.enabled?(delete m.enabled,0===Object.keys(m).length&&(e[g]=!0)):e[g]=!1),yt(m)}catch(Ti){}}}catch(_){t={error:_}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}try{if(null===(l=null===(c=null===(u=e.autocapture)||void 0===u?void 0:u.networkTracking)||void 0===c?void 0:c.captureRules)||void 0===l?void 0:l.length)try{for(var y=(0,i.XA)(e.autocapture.networkTracking.captureRules),b=y.next();!b.done;b=y.next()){var w=b.value;try{for(var S=(s=void 0,(0,i.XA)(["responseHeaders","requestHeaders"])),I=S.next();!I.done;I=S.next()){var E=I.value,k=null!==(d=w[E])&&void 0!==d?d:{},C=k.captureSafeHeaders,T=k.allowlist;(C||T)&&(void 0===T||Array.isArray(T)?w[E]=(0,i.ev)((0,i.ev)([],(0,i.CR)(C?O.Wb:[]),!1),(0,i.CR)(null!==T&&void 0!==T?T:[]),!1):delete w[E])}}catch(x){s={error:x}}finally{try{I&&!I.done&&(a=S.return)&&a.call(S)}finally{if(s)throw s.error}}}}catch(R){r={error:R}}finally{try{b&&!b.done&&(o=y.return)&&o.call(y)}finally{if(r)throw r.error}}}catch(Ti){}var P=null===(f=e.autocapture)||void 0===f?void 0:f.frustrationInteractions;P&&(P.rageClick&&(P.rageClicks=P.rageClick,delete P.rageClick),P.deadClick&&(P.deadClicks=P.deadClick,delete P.deadClick))}}function bt(e,t,n){var r,o,s=[];try{for(var a=(0,i.XA)(null!==t&&void 0!==t?t:[]),u=a.next();!u.done;u=a.next()){var c=u.value;try{s.push(new RegExp(c))}catch(l){n.loggerProvider.warn("Invalid regex pattern: ".concat(c),l)}}}catch(d){r={error:d}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return e.concat(s)}function wt(e,t){var n,r,o,s,a,u,c;if(e){yt(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e));var l=e;if(l&&"autocapture"in l){if("boolean"===typeof l.autocapture&&(t.autocapture=l.autocapture),"object"===typeof l.autocapture&&null!==l.autocapture){var d=(0,i.pi)({},l.autocapture);if(void 0===t.autocapture&&(t.autocapture=l.autocapture),"object"===typeof l.autocapture.elementInteractions&&null!==l.autocapture.elementInteractions&&(null===(o=l.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===o?void 0:o.length)){d.elementInteractions=(0,i.pi)({},l.autocapture.elementInteractions);var f=d.elementInteractions,v=null!==(s=f.pageUrlAllowlist)&&void 0!==s?s:[],h=l.autocapture.elementInteractions.pageUrlAllowlistRegex;f.pageUrlAllowlist=bt(v,h,t),delete f.pageUrlAllowlistRegex}
1if("object"===typeof l.autocapture.networkTracking&&null!==l.autocapture.networkTracking&&(null===(a=l.autocapture.networkTracking.captureRules)||void 0===a?void 0:a.length)){d.networkTracking=(0,i.pi)({},l.autocapture.networkTracking);var p=null!==(u=d.networkTracking.captureRules)&&void 0!==u?u:[];try{for(var g=(0,i.XA)(p),m=g.next();!m.done;m=g.next()){var y=m.value;y.urls=bt(null!==(c=y.urls)&&void 0!==c?c:[],y.urlsRegex,t),delete y.urlsRegex}}catch(b){n={error:b}}finally{try{m&&!m.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}}"boolean"===typeof t.autocapture&&(t.autocapture=(0,i.pi)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},d)),"object"===typeof t.autocapture&&(t.autocapture=(0,i.pi)((0,i.pi)({},t.autocapture),d))}t.defaultTracking=t.autocapture}t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(Ti){t.loggerProvider.error("Failed to apply remote configuration because of error: ",Ti)}}}var St=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],It="data-amp-track-",Et=["div","span","h1","h2","h3","h4","h5","h6"],kt="[Amplitude] Element Clicked",Ct="[Amplitude] Rage Click",Tt="[Amplitude] Element Tag",Pt="[Amplitude] Element Text",_t="[Amplitude] Page URL",xt="https://app.amplitude.com",Rt={US:xt,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},Ot="data-amp-mask-attributes";function At(e){return"function"===typeof e}function Mt(e){return function(t){if(function(e){return At(null===e||void 0===e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(n){this.error(n)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Lt(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Dt=Lt((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t}}));function Nt(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var jt=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=(0,i.XA)(s),u=a.next();!u.done;u=a.next()){u.value.remove(this)}}catch(h){e={error:h}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(At(c))try{c()}catch(Ti){o=Ti instanceof Dt?Ti.errors:[Ti]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=(0,i.XA)(l),f=d.next();!f.done;f=d.next()){var v=f.value;try{Ut(v)}catch(p){o=null!==o&&void 0!==o?o:[],p instanceof Dt?o=(0,i.ev)((0,i.ev)([],(0,i.CR)(o)),(0,i.CR)(p.errors)):o.push(p)}}}catch(g){n={error:g}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}if(o)throw new Dt(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Ut(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Nt(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Nt(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),Ft=jt.EMPTY;function qt(e){return e instanceof jt||e&&"closed"in e&&At(e.remove)&&At(e.add)&&At(e.unsubscribe)}function Ut(e){At(e)?e():e.unsubscribe()}var Gt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNext
1Context:!1},Jt={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=Jt.delegate;return(null===o||void 0===o?void 0:o.setTimeout)?o.setTimeout.apply(o,(0,i.ev)([e,t],(0,i.CR)(n))):setTimeout.apply(void 0,(0,i.ev)([e,t],(0,i.CR)(n)))},clearTimeout:function(e){var t=Jt.delegate;return((null===t||void 0===t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Bt(e){Jt.setTimeout((function(){var t=Gt.onUnhandledError;if(!t)throw e;t(e)}))}function Ht(){}var Wt=zt("C",void 0,void 0);function zt(e,t,n){return{kind:e,value:t,error:n}}var Kt=null;function Xt(e){if(Gt.useDeprecatedSynchronousErrorHandling){var t=!Kt;if(t&&(Kt={errorThrown:!1,error:null}),e(),t){var n=Kt,r=n.errorThrown,i=n.error;if(Kt=null,r)throw i}}else e()}var Vt=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,qt(t)&&t.add(n)):n.destination=nn,n}return(0,i.ZT)(t,e),t.create=function(e,t,n){return new Yt(e,t,n)},t.prototype.next=function(e){this.isStopped?tn(function(e){return zt("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?tn(zt("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?tn(Wt,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(jt),$t=Function.prototype.bind;function Zt(e,t){return $t.call(e,t)}var Qt=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){en(n)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){en(n)}else en(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){en(t)}},e}(),Yt=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;At(t)||!t?i={next:null!==t&&void 0!==t?t:void 0,error:null!==n&&void 0!==n?n:void 0,complete:null!==r&&void 0!==r?r:void 0}:s&&Gt.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&Zt(t.next,o),error:t.error&&Zt(t.error,o),complete:t.complete&&Zt(t.complete,o)}):i=t;return s.destination=new Qt(i),s}return(0,i.ZT)(t,e),t}(Vt);function en(e){var t;Gt.useDeprecatedSynchronousErrorHandling?(t=e,Gt.useDeprecatedSynchronousErrorHandling&&Kt&&(Kt.errorThrown=!0,Kt.error=t)):Bt(e)}function tn(e,t){var n=Gt.onStoppedNotification;n&&Jt.setTimeout((function(){return n(e,t)}))}var nn={closed:!0,next:Ht,error:function(e){throw e},complete:Ht};function rn(e,t,n,r,i){return new on(e,t,n,r,i)}var on=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(r){t.error(r)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return(0,i.ZT)(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Vt);function sn(e,t){return Mt((function(n,r){var i=0;n.subscribe(rn(r,(function(n){r.next(e.call(t,n,i++))})))}))}var an=function(e){return e&&"number"===typeof e.length&&"function"!==typeof e};function un(e){return At(null===e||void 0===e?void 0:e.then)}var cn="function"===typeof Symbol&&Symbol.observable||"@@observable";function ln(e){return e}function dn(e){return 0===e.length?ln:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var fn=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof Vt||function(e){return e&&At(e.next)&&At(e.error)&&At(e.complete)}
1(r)&&qt(r)?e:new Yt(e,t,n);return Xt((function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=vn(t))((function(t,r){var i=new Yt({next:function(t){try{e(t)}catch(n){r(n),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[cn]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dn(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=vn(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function vn(e){var t;return null!==(t=null!==e&&void 0!==e?e:Gt.Promise)&&void 0!==t?t:Promise}function hn(e){return At(e[cn])}function pn(e){return Symbol.asyncIterator&&At(null===e||void 0===e?void 0:e[Symbol.asyncIterator])}function gn(e){return new TypeError("You provided "+(null!==e&&"object"===typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var mn="function"===typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function yn(e){return At(null===e||void 0===e?void 0:e[mn])}function bn(e){return(0,i.FC)(this,arguments,(function(){var t,n,r;return(0,i.Jh)(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,(0,i.qq)(t.read())];case 3:return n=o.sent(),r=n.value,n.done?[4,(0,i.qq)(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,(0,i.qq)(r)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}
1))}))}function wn(e){return At(null===e||void 0===e?void 0:e.getReader)}function Sn(e){if(e instanceof fn)return e;if(null!=e){if(hn(e))return o=e,new fn((function(e){var t=o[cn]();if(At(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(an(e))return r=e,new fn((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(un(e))return n=e,new fn((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Bt)}));if(pn(e))return In(e);if(yn(e))return t=e,new fn((function(e){var n,r;try{for(var o=(0,i.XA)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(u){n={error:u}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()}));if(wn(e))return In(bn(e))}var t,n,r,o;throw gn(e)}function In(e){return new fn((function(t){(function(e,t){var n,r,o,s;return(0,i.mG)(this,void 0,void 0,(function(){var a,u;return(0,i.Jh)(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=(0,i.KL)(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(a=r.value,t.next(a),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),o={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}var En=Lt((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),kn=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,i.ZT)(t,e),t.prototype.lift=function(e){var t=new Cn(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new En},t.prototype.next=function(e){var t=this;Xt((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=(0,i.XA)(t.currentObservers),s=o.next();!s.done;s=o.next()){s.value.next(e)}}catch(a){n={error:a}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;Xt((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;Xt((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?Ft:(this.currentObservers=null,o.push(e),new jt((function(){t.currentObservers=null,Nt(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new fn;return e.source=this,e},t.create=function(e,t){return new Cn(e,t)},t}(fn),Cn=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,i.ZT)(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:Ft},t}(kn);function Tn(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new kn}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,u=void 0===a||a;return function(e){var t,r,o,a=0,c=!1,l=!1,d=function(){null===r||void 0===r||r.unsubscribe(),r=void 0},f=function(){d(),t=o=void 0,c=l=!1},v=function(){var e=t;f(),null===e||void 0===e||e.unsubscribe()};return Mt((function(e,h){a++,l||c||d();var p=o=null!==o&&void 0!==o?o:n();
1h.add((function(){0!==--a||l||c||(r=Pn(v,u))})),p.subscribe(h),!t&&a>0&&(t=new Yt({next:function(e){return p.next(e)},error:function(e){l=!0,d(),r=Pn(f,i,e),p.error(e)},complete:function(){c=!0,d(),r=Pn(f,s),p.complete()}}),Sn(e).subscribe(t))}))(e)}}function Pn(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var o=new Yt({next:function(){o.unsubscribe(),e()}});return Sn(t.apply(void 0,(0,i.ev)([],(0,i.CR)(n)))).subscribe(o)}}else e()}function _n(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(o),!i)return o}function xn(e,t,n){return void 0===n&&(n=1/0),At(t)?xn((function(n,r){return sn((function(e,i){return t(n,e,r,i)}))(Sn(e(n,r)))}),n):("number"===typeof t&&(n=t),Mt((function(t,r){return function(e,t,n,r,i,o,s,a){var u=[],c=0,l=0,d=!1,f=function(){!d||u.length||c||t.complete()},v=function(e){return c<r?h(e):u.push(e)},h=function(e){o&&t.next(e),c++;var a=!1;Sn(n(e,l++)).subscribe(rn(t,(function(e){null===i||void 0===i||i(e),o?v(e):t.next(e)}),(function(){a=!0}),void 0,(function(){if(a)try{c--;for(var e=function(){var e=u.shift();s?_n(t,s,(function(){return h(e)})):h(e)};u.length&&c<r;)e();f()}catch(n){t.error(n)}})))};return e.subscribe(rn(t,v,(function(){d=!0,f()}))),function(){null===a||void 0===a||a()}}(t,r,e,n)})))}var Rn=Array.isArray;function On(e){return sn((function(t){return function(e,t){return Rn(t)?e.apply(void 0,(0,i.ev)([],(0,i.CR)(t))):e(t)}(e,t)}))}var An=["addListener","removeListener"],Mn=["addEventListener","removeEventListener"],Ln=["on","off"];function Dn(e,t,n,r){if(At(n)&&(r=n,n=void 0),r)return Dn(e,t,n).pipe(On(r));var o=(0,i.CR)(function(e){return At(e.addEventListener)&&At(e.removeEventListener)}(e)?Mn.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return At(e.addListener)&&At(e.removeListener)}(e)?An.map(Nn(e,t)):function(e){return At(e.on)&&At(e.off)}(e)?Ln.map(Nn(e,t)):[],2),s=o[0],a=o[1];if(!s&&an(e))return xn((function(e){return Dn(e,t,n)}))(Sn(e));if(!s)throw new TypeError("Invalid event target");return new fn((function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return s(t),function(){return a(t)}}))}function Nn(e,t){return function(n){return function(r){return e[n](t,r)}}}var jn=function(e,t){return!t||!t.length||t.some((function(t){return"string"===typeof t?e===t:e.match(t)}))},Fn=function(e,t){var n=e;try{n=decodeURI(e)}catch(Ti){null===t||void 0===t||t.error("Malformed URI sequence: ",Ti)}return n},qn=["input","select","textarea"],Un=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null===r||void 0===r?void 0:r.getPropertyValue("cursor"))&&"click"===t},Gn=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,a=e.pageUrlAllowlist,u=e.pageUrlExcludelist,c=e.shouldTrackEventResolver,l=null===(s=null===(o=null===i||void 0===i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===s?void 0:s.call(o);if(!l)return!1;if(c)return c(r,i);if(!jn(window.location.href,a))return!1;if(u&&u.length>0&&jn(window.location.href,u))return!1;var d=String(null===i||void 0===i?void 0:i.getAttribute("type"))||"";if("string"===typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=Un(i,r);if(n&&f)return!0;if(t){var v=t.some((function(e){var t;return!!(null===(t=null===i||void 0===i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}));if(!v)return!1}switch(l){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},Jn=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return void 0===e||null===e||"object"===typeof e&&0===Object.keys(e).length||"string"===typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},Bn=function(e,t){return e?t.some((function(t){var n;return null===(n=null===e||void 0===e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:Bn(null===e||void 0===e?void 0:e.parentElement,t):null};var Hn=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};var Wn=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Ot,Ye]),zn=["type"],Kn=["svg","path","g"],Xn=["password","hidden"];function Vn(e,t){var n,r,o,s,a,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),l={tag:c},d=Array.from(null!==(s=null===(o=e.parentElement)||void 0===o?void 0:o.children)&&void 0!==s?s:[]);d.length&&(l.index=d.indexOf(e),l.indexOfType=d.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var f=null===(u=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===u?void 0:u.toLowerCase();f&&(l.prevSib=String(f));var v=e.getAttribute("id");v&&(l.id=String(v));var h=Array.from(e.classList);h.length&&(l.classes=h);var p={},g=Array.from(e.attributes).filter((function(e){return!Wn.has(e.name)})),m=!function(e){var t,n,r,i=null===(n=null===(t=null===e||void 0===e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!qn.includes(i)&&!o}(e);if(!Xn.includes(String(e.getAttribute("type")))&&!Kn.includes(c))try{for(var y=(0,i.XA)(g),b=y.next();!b.done;b=y.next()){var w=b.value;m&&!zn.includes(w.name)||(t.has(w.name)?p[w.name]=et:p[w.name]=String(w.value).substring(0,128))}}catch(S){n={error:S}}finally{try{b&&!b.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}return Object.keys(p).length&&(l.attrs=p),l}var $n=function(e,t,n){e.forEach((function(e){if("string"!==typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}}))},Zn=function(e,t){var n,r,o,s=this;
1this.replaceSensitiveString=function(e){return it(e,s.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,o,a,u=performance.now();if(!e)return[];for(var c,l=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),d=new Map,f=l.length-1;f>=0;f--){var v=l[f];if(v){var h=(c=v.getAttribute(Ot))?c.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0&&"id"!==e&&"class"!==e})):[],p=f===l.length-1?[]:null!==(r=d.get(l[f+1]))&&void 0!==r?r:new Set,g=new Set((0,i.ev)((0,i.ev)([],(0,i.CR)(p),!1),(0,i.CR)(h),!1));d.set(v,g)}}a=l.map((function(e){var t;return Vn(e,null!==(t=d.get(e))&&void 0!==t?t:new Set)}));var m=function(e){(null===e||void 0===e?void 0:e.attrs)&&Object.entries(e.attrs).forEach((function(t){var n=(0,i.CR)(t,2),r=n[0],o=n[1];e.attrs&&(e.attrs[r]=s.replaceSensitiveString(o))}))};try{for(var y=(0,i.XA)(a),b=y.next();!b.done;b=y.next())m(b.value)}catch(S){t={error:S}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}var w=performance.now();return null===(o=s.diagnosticsClient)||void 0===o||o.recordHistogram("autocapturePlugin.getHierarchy",w-u),a},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(r){t=null}return t?s.getText(t):s.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,o,a,u,c,l,d=null===(a=null===(o=null===t||void 0===t?void 0:t.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===a?void 0:a.call(o),f="function"===typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=s.getHierarchy(t),h=null===(u=v[0])||void 0===u?void 0:u.attrs,p=s.getNearestLabel(t),g=(c=null!==h&&void 0!==h?h:{},l=n,Object.entries(c).reduce((function(e,t){var n=(0,i.CR)(t,2),r=n[0],o=n[1];if(r.startsWith(l)){var s=r.replace(l,"");s&&(e[s]=o||"")}return e}),{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[Tt]=d,r[Pt]=s.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Parent Label"]=p,r[_t]=Fn(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=ot(s.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null===h||void 0===h?void 0:h["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement&&(m["[Amplitude] Element Href"]=s.replaceSensitiveString(t.href)),Jn(m)},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i&&Un(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=s.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var a=Bn(o.event.target,n);return a&&(o.closestTrackedAncestor=a,o.targetElementProperties=s.getEventProperties(o.type,a,r)),o}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(r){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?s.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getText=function(e){if(null!==e.closest("[".concat(Ye,"]")))return et;var t="";if(e.querySelector("[".concat(Ye,"], [contenteditable]"))){var n=e.cloneNode(!0);n.querySelectorAll("[".concat(Ye,"], [contenteditable]")).forEach((function(e){e.innerText=et})),t=n.innerText||""}else t=e.innerText||"";return s.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null===e||void 0===e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[Tt]=i,t[Pt]=s.getText(e),t[_t]=window.location.href.split("?")[0],t);return Jn(o)},this.diagnosticsClient=null===t||void 0===t?void 0:t.diagnosticsClient;var a=null!==(o=e.maskTextRegex)&&void 0!==o?o:[],u=[];try{for(var c=(0,i.XA)(a),l=c.next();!l.done;l=c.next()){var d=l.value;if(u.length>=25)break;if(d instanceof RegExp)u.push(d);else if("pattern"in d&&"string"===typeof d.pattern)try{u.push(new RegExp(d.pattern,"i"))}catch(f){}}}catch(v){n={error:v}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u},Qn=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?xt:t,r=this;this.endpoint=xt,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null===n||void 0===n?void 0:n.timeout)>0&&setTimeout((function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{dataExtractor:new Zn({})}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,a=n.actionClickAllowlist,u=n.dataExtractor;this.logger=r,i&&this.endpoint===xt&&(this.endpoint=i);var c=null;window.addEventListener("message",(function(e){var n,r,i,l,d;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var f,v=null===e||void 0===e?void 0:e.data,h=null===v||void 0===v?void 0:v.action;if(h)if("id"in v)null===(l=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===l||l.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(v);else if("ping"===h)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=null===v||void 0===v?void 0:v.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(i){t(i)}}))).then((function(){var e;c=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:u.getEventTagProps,isElementSelectable:function(e){return!o||o((null===p||void 0===p?void 0:p.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:"1.16.2"}}}),t.notify({action:"selector-loaded"})})).catch((function(){var e;
1null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===h&&(null===(d=null===c||void 0===c?void 0:c.close)||void 0===d||d.call(c))}})),this.notify({action:"page-loaded"})},e}();function Yn(e,t){return Mt((function(n,r){var i=0;n.subscribe(rn(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}var er=function(e){function t(t,n){return e.call(this)||this}return(0,i.ZT)(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(jt),tr={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=tr.delegate;return(null===o||void 0===o?void 0:o.setInterval)?o.setInterval.apply(o,(0,i.ev)([e,t],(0,i.CR)(n))):setInterval.apply(void 0,(0,i.ev)([e,t],(0,i.CR)(n)))},clearInterval:function(e){var t=tr.delegate;return((null===t||void 0===t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},nr=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return(0,i.ZT)(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),tr.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&tr.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(Ti){r=!0,n=Ti||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Nt(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(er),rr={now:function(){return(rr.delegate||Date).now()},delegate:void 0},ir=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=rr.now,e}(),or=new(function(e){function t(t,n){void 0===n&&(n=ir.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return(0,i.ZT)(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(ir))(nr),sr=or;function ar(e){return void 0===e&&(e=1/0),xn(ln,e)}var ur=new fn((function(e){return e.complete()}));function cr(e){return e&&At(e.schedule)}function lr(e){return e[e.length-1]}function dr(e){return cr(lr(e))?e.pop():void 0}function fr(e,t){return void 0===t&&(t=0),Mt((function(n,r){n.subscribe(rn(r,(function(n){return _n(r,e,(function(){return r.next(n)}),t)}),(function(){return _n(r,e,(function(){return r.complete()}),t)}),(function(n){return _n(r,e,(function(){return r.error(n)}),t)})))}))}function vr(e,t){return void 0===t&&(t=0),Mt((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function hr(e,t){if(!e)throw new Error("Iterable cannot be null");return new fn((function(n){_n(n,t,(function(){var r=e[Symbol.asyncIterator]();_n(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function pr(e,t){if(null!=e){if(hn(e))return function(e,t){return Sn(e).pipe(vr(t),fr(t))}(e,t);if(an(e))return function(e,t){return new fn((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(un(e))return function(e,t){return Sn(e).pipe(vr(t),fr(t))}(e,t);if(pn(e))return hr(e,t);if(yn(e))return function(e,t){return new fn((function(n){var r;return _n(n,t,(function(){r=e[mn](),_n(n,t,(function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(o){return void n.error(o)}i?n.complete():n.next(t)}),0,!0)})),function(){return At(null===r||void 0===r?void 0:r.return)&&r.return()}}))}(e,t);if(wn(e))return function(e,t){return hr(bn(e),t)}(e,t)}throw gn(e)}
1function gr(e,t){return t?pr(e,t):Sn(e)}function mr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=dr(e),r=function(e,t){return"number"===typeof lr(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Sn(i[0]):ar(r)(gr(i,n)):ur}function yr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ar(1)(gr(e,dr(e)))}function br(e){return e<=0?function(){return ur}:Mt((function(t,n){var r=0;t.subscribe(rn(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function wr(e,t){return t?function(n){return yr(t.pipe(br(1),Mt((function(e,t){e.subscribe(rn(t,Ht))}))),n.pipe(wr(e)))}:xn((function(t,n){return Sn(e(t,n)).pipe(br(1),function(e){return sn((function(){return e}))}(t))}))}function Sr(e){return e instanceof Date&&!isNaN(e)}function Ir(e,t,n){void 0===e&&(e=0),void 0===n&&(n=sr);var r=-1;return null!=t&&(cr(t)?n=t:r=t),new fn((function(t){var i=Sr(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}function Er(e){var t,n,r,o=e.amplitude,s=e.allObservables,a=e.options,u=e.shouldTrackEvent,c=e.evaluateTriggers,l=s.clickObservable,d=l.pipe(Mt((function(e,t){var n,r=!1;e.subscribe(rn(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),Yn((function(e){var t=(0,i.CR)(e,2),n=t[0],r=t[1],o=n.event.target!==r.event.target,s=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return o&&!s}))),f=mr(d,l.pipe((t=a.debounceTime,void 0===n&&(n=or),Mt((function(e,r){var i=null,o=null,s=null,a=function(){if(i){i.unsubscribe(),i=null;var e=o;o=null,r.next(e)}};function u(){var e=s+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);a()}e.subscribe(rn(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(u,t),r.add(i))}),(function(){a(),r.complete()}),void 0,(function(){o=i=null})))}))),sn((function(){return"timeout"})))),v=l.pipe(function(e,t){void 0===t&&(t=or);var n=Ir(e,t);return wr((function(){return n}))}(0),Yn(Hn),Yn((function(e){return u("click",e.closestTrackedAncestor)})),sn((function(e){return c(e)})),(r=f,Mt((function(e,t){var n=[];return e.subscribe(rn(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Sn(r).subscribe(rn(t,(function(){var e=n;n=[],t.next(e)}),Ht)),function(){n=null}}))));return v.subscribe((function(e){var t,n,r=(e.length,kt);try{for(var s=(0,i.XA)(e),a=s.next();!a.done;a=s.next()){var u=a.value;null===o||void 0===o||o.track(r,u.targetElementProperties)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}}))}var kr=Lt((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function Cr(e){throw new kr(e)}function Tr(e){var t=e.amplitude,n=e.allObservables,r=e.options,o=e.getEventProperties,s=e.shouldTrackEvent,a=e.shouldTrackActionClick,u=n.clickObservable,c=n.mutationObservable,l=n.navigateObservable,d=u.pipe(Yn((function(e){return!s("click",e.closestTrackedAncestor)})),sn((function(e){var t=Bn(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=o(e.type,e.closestTrackedAncestor)),e})),Yn(Hn),Yn((function(e){return a("click",e.closestTrackedAncestor)}))),f=[c];l&&f.push(l);var v,h,p=mr.apply(void 0,(0,i.ev)([],(0,i.CR)(f),!1)),g=d.pipe((v=function(e){return p.pipe(br(1),function(e,t){var n=Sr(e)?{first:e}:"number"===typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?Cr:o,a=n.scheduler,u=void 0===a?null!==t&&void 0!==t?t:or:a,c=n.meta,l=void 0===c?null:c;if(null==r&&null==i)throw new TypeError("No timeout provided.");return Mt((function(e,t){var n,o,a=null,c=0,d=function(e){o=_n(t,u,(function(){try{n.unsubscribe(),Sn(s({meta:l,lastValue:a,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(rn(t,(function(e){null===o||void 0===o||o.unsubscribe(),c++,t.next(a=e),i>0&&d(i)}),void 0,void 0,(function(){(null===o||void 0===o?void 0:o.closed)||null===o||void 0===o||o.unsubscribe(),a=null}))),!c&&d(null!=r?"number"===typeof r?r:+r-u.now():i)}))}({first:500,with:function(){return ur}}),sn((function(){return e})))},Mt((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(rn(t,(function(e){null===n||void 0===n||n.unsubscribe();var i=0,s=r++;Sn(v(e,s)).subscribe(n=rn(t,(function(n){return t.next(h?h(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return g.subscribe((function(e){null===t||void 0===t||t.track(kt,o("click",e.closestTrackedAncestor))}))}var Pr,_r=function(){return new fn((function(e){var t=new MutationObserver((function(t){e.next(t)}));return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}}))},xr=function(e){return void 0===e&&(e="click"),Dn(document,e,{capture:!0})},Rr={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Or=function(e){var t,n,r,o,s=Object.values(Rr).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return s;try{for(var a=(0,i.XA)(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{try{for(var l=(r=void 0,(0,i.XA)(c.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,v=Rr[f.event_type];v&&s[v].add(c.id)}}catch(h){r={error:h}}
1finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}catch(Ti){console.warn("Skipping Labeled Event due to malformed definition",null===c||void 0===c?void 0:c.id,Ti)}}}catch(p){t={error:p}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return s},Ar=function(e){var t,n,r,o,s=new Map;try{for(var a=(0,i.XA)(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var l=(r=void 0,(0,i.XA)(c.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,h=s.get(v);h||(h=[],s.set(v,h)),h.push(c)}}}catch(p){r={error:p}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}}catch(g){t={error:g}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return s},Mr=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return Rr[t.event_type]===e.type&&t.filters.every((function(t){return 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(n){return console.error("Error matching event to filter",n),!1}return!1}(e,t)}))}))}))},Lr=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var o=function(e,t){var n,r,o,s,a=new Set;try{for(var u=(0,i.XA)(e),c=u.next();!c.done;c=u.next()){var l=c.value,d=t.get(l.id);if(d)try{for(var f=(o=void 0,(0,i.XA)(d)),v=f.next();!v.done;v=f.next()){var h=v.value;a.add(h)}}catch(p){o={error:p}}finally{try{v&&!v.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}}}catch(g){n={error:g}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(a)}(Mr(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var s=(0,i.XA)(o),a=s.next();!a.done;a=s.next()){var u=a.value;$n(u.actions,e,this.dataExtractor)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}();!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(Pr||(Pr={}));var Dr=function(e,t){var n,r,o,s,a,u,c,l;void 0===e&&(e={});var d=e.dataAttributePrefix,f=void 0===d?It:d,v=e.visualTaggingOptions,h=void 0===v?{enabled:!0,messenger:new Qn}:v;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:St,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Et,e.debounceTime=null!==(o=e.debounceTime)&&void 0!==o?o:0,e.pageUrlExcludelist=null===(s=e.pageUrlExcludelist)||void 0===s?void 0:s.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(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e}),[]);var p="@amplitude/plugin-autocapture-browser",g=[],m=new Zn(e,t),y=Or(Object.values(null!==(u=null===(a=e.pageActions)||void 0===a?void 0:a.labeledEvents)&&void 0!==u?u:{})),b=Ar(null!==(l=null===(c=e.pageActions)||void 0===c?void 0:c.triggers)&&void 0!==l?l:[]),w=function(e,t,n,r){return new Lr(e,t,n,r)}(y,b,m,e);return{name:p,type:"enrichment",setup:function(t,n){return(0,i.mG)(void 0,void 0,void 0,(function(){var r,o,s,a,u,c,l,d,v,S;return(0,i.Jh)(this,(function(I){return"undefined"===typeof document||(t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("analyticsSDK.pageActions","all",(function(t){!function(t){var n,r;t&&(e.pageActions=(0,i.pi)((0,i.pi)({},e.pageActions),t),y=Or(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),b=Ar(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),w.update(y,b,e))}(t)})):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),r=Gn(e,e.cssSelectorAllowlist),o=Gn(e,e.actionClickAllowlist),s=function(){var t,n,r=xr().pipe(sn((function(t){return m.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,f)})),Tn()),i=Dn(document,"change",{capture:!0}).pipe(sn((function(t){return m.addAdditionalEventProperties(t,"change",e.cssSelectorAllowlist,f)})),Tn());window.navigation&&(n=Dn(window.navigation,"navigate").pipe(sn((function(t){return m.addAdditionalEventProperties(t,"navigate",e.cssSelectorAllowlist,f)}
1)),Tn()));var o=_r().pipe(sn((function(t){return m.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,f)})),Tn());return(t={})[Pr.ClickObservable]=r,t[Pr.ChangeObservable]=i,t[Pr.NavigateObservable]=n,t[Pr.MutationObservable]=o,t}(),a=Er({allObservables:s,options:e,amplitude:n,shouldTrackEvent:r,evaluateTriggers:w.evaluate.bind(w)}),g.push(a),u=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(Yn(Hn),Yn((function(e){return i("change",e.closestTrackedAncestor)})),sn((function(e){return o(e)}))).subscribe((function(e){null===t||void 0===t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:s,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return m.getEventProperties.apply(m,(0,i.ev)((0,i.ev)([],(0,i.CR)(e),!1),[f],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:w.evaluate.bind(w)}),g.push(u),c=Tr({allObservables:s,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return m.getEventProperties.apply(m,(0,i.ev)((0,i.ev)([],(0,i.CR)(e),!1),[f],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:o}),g.push(c),null===(v=null===t||void 0===t?void 0:t.loggerProvider)||void 0===v||v.log("".concat(p," has been successfully added.")),window.opener&&h.enabled&&(l=e.cssSelectorAllowlist,d=e.actionClickAllowlist,null===(S=h.messenger)||void 0===S||S.setup((0,i.pi)((0,i.pi)({dataExtractor:m,logger:null===t||void 0===t?void 0:t.loggerProvider},(null===t||void 0===t?void 0:t.serverZone)&&{endpoint:Rt[t.serverZone]}),{isElementSelectable:Gn(e,(0,i.ev)((0,i.ev)([],(0,i.CR)(l),!1),(0,i.CR)(d),!1)),cssSelectorAllowlist:l,actionClickAllowlist:d})))),[2]}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,e]}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){var e,t,n,r;return(0,i.Jh)(this,(function(o){try{for(e=(0,i.XA)(g),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(s){n={error:s}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},Nr=(0,i.ev)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,i.CR)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),jr=["*"],Fr=Array.isArray;function qr(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&Fr(e[0])?e[0]:e).length?Sn(t[0]):new fn(function(e){return function(t){for(var n=[],r=function(r){n.push(Sn(e[r]).subscribe(rn(t,(function(e){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}t.next(e)}))))},i=0;n&&!t.closed&&i<e.length;i++)r(i)}}(t))}function Ur(e,t,n){void 0===t&&(t=or);var r=Ir(e,t);return function(e,t){return Mt((function(n,r){var i=null!==t&&void 0!==t?t:{},o=i.leading,s=void 0===o||o,a=i.trailing,u=void 0!==a&&a,c=!1,l=null,d=null,f=!1,v=function(){null===d||void 0===d||d.unsubscribe(),d=null,u&&(g(),f&&r.complete())},h=function(){d=null,f&&r.complete()},p=function(t){return d=Sn(e(t)).subscribe(rn(r,v,h))},g=function(){if(c){c=!1;var e=l;l=null,r.next(e),!f&&p(e)}};n.subscribe(rn(r,(function(e){c=!0,l=e,(!d||d.closed)&&(s?g():p(e))}),(function(){f=!0,(!(u&&c&&d)||d.closed)&&r.complete()})))}))}((function(){return r}),n)}var Gr=3e3;var Jr=4,Br=1e3,Hr=50;function Wr(e,t){var n,r,i,o,s=t.event,a=s.clientX,u=s.clientY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>Hr||e.xMax-e.xMin>Hr}function zr(e){var t=e[0],n=e[e.length-1];return{rageClickEvent:(0,i.pi)({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Kr(e){var t,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,s=[],a={};function u(e){s=[],a={},e&&(Wr(a,e),s.push(e))}
1return o.pipe(Yn(Hn),Yn((function(e){return i("click",e.closestTrackedAncestor)})),sn((function(e){if(t&&clearTimeout(t),Wr(a,e),0===s.length)return s.push(e),null;if(function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(s,e)||function(e,t){var n=e[Math.max(0,e.length-Jr+1)];return t.timestamp-n.timestamp>=Br}(s,e)||a.isOutOfBounds){var r=s.length>=Jr?zr(s):null;return u(e),r}return s.push(e),s.length>=Jr&&(t=setTimeout((function(){var e=zr(s),t=e.rageClickEvent,r=e.time;n.track(Ct,t,{time:r}),u()}),Br)),null})),Yn((function(e){return null!==e}))).subscribe((function(e){null!==e&&n.track(Ct,e.rageClickEvent,{time:e.time})}))}var Xr=function(e){var t,n,r,o,s;void 0===e&&(e={});var a="@amplitude/plugin-frustration-browser",u=[],c=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:jr,l=null!==(o=null===(r=e.deadClicks)||void 0===r?void 0:r.cssSelectorAllowlist)&&void 0!==o?o:Nr,d=null!==(s=e.dataAttributePrefix)&&void 0!==s?s:It,f=new Zn(e),v=(0,i.ev)([],(0,i.CR)(new Set((0,i.ev)((0,i.ev)([],(0,i.CR)(c),!1),(0,i.CR)(l),!1))),!1);return{name:a,type:"enrichment",setup:function(t,n){return(0,i.mG)(void 0,void 0,void 0,(function(){var r,o,s,h,p,g;return(0,i.Jh)(this,(function(m){return"undefined"===typeof document||(r=Gn(e,c),o=Gn(e,l),s=function(){var e,t,n=xr("pointerdown").pipe(sn((function(e){return f.addAdditionalEventProperties(e,"click",v,d,!0)})),Tn());window.navigation&&(t=Dn(window.navigation,"navigate").pipe(sn((function(e){return f.addAdditionalEventProperties(e,"navigate",v,d)})),Tn()));var r=_r().pipe(sn((function(e){return f.addAdditionalEventProperties(e,"mutation",v,d)})),Tn());return(e={})[Pr.ClickObservable]=n,e[Pr.ChangeObservable]=new fn,e[Pr.NavigateObservable]=t,e[Pr.MutationObservable]=r,e}(),h=Kr({allObservables:s,amplitude:n,shouldTrackRageClick:r}),u.push(h),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,o=e.shouldTrackDeadClick,s=n.clickObservable,a=n.mutationObservable,u=n.navigateObservable,c=s.pipe(Yn(Hn),Yn((function(e){return o("click",e.closestTrackedAncestor)})),Yn((function(e){return null===e.event.target.closest('a[target="_blank"]')}))),l=[a];u&&l.push(u);var d=mr.apply(void 0,(0,i.ev)([],(0,i.CR)(l),!1));return c.pipe(xn((function(e){var t;return qr(new fn((function(n){return t=setTimeout((function(){return n.next(e)}),Gr),function(){clearTimeout(t)}})),d.pipe(br(1),sn((function(){return null})))).pipe(Yn((function(e){return null!==e})))})),Ur(Gr)).subscribe((function(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",(0,i.pi)((0,i.pi)({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}))}({amplitude:n,allObservables:s,getEventProperties:function(e,t){return f.getEventProperties(e,t,d)},shouldTrackDeadClick:o}),u.push(p),null===(g=null===t||void 0===t?void 0:t.loggerProvider)||void 0===g||g.log("".concat(a," has been successfully added."))),[2]}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,e]}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){var e,t,n,r;return(0,i.Jh)(this,(function(o){try{for(e=(0,i.XA)(u),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(s){n={error:s}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};function Vr(e){return"string"===typeof e||"number"===typeof e||"boolean"===typeof e||null===e||void 0===e}function $r(e,t,n){e&&Zr({json:e,allowlist:t.map(Qr),excludelist:n.map(Qr),ancestors:[]})}function Zr(e){var t,n,r=e.json,o=e.targetObject,s=e.allowlist,a=e.excludelist,u=e.ancestors,c=e.parentObject,l=e.targetKey;o||(o=r);var d=Object.keys(o);try{for(var f=(0,i.XA)(d),v=f.next();!v.done;v=f.next()){var h=v.value,p=(0,i.ev)((0,i.ev)([],(0,i.CR)(u),!1),[h],!1);Vr(o[h])?ei(p,s)&&!ei(p,a)||delete o[h]:Zr({json:r,targetObject:o[h],allowlist:s,excludelist:a,ancestors:p,parentObject:o,targetKey:h})}}catch(g){t={error:g}}finally{try{v&&!v.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}0===Object.keys(o).length&&c&&l&&delete c[l]}function Qr(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function Yr(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];
1if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Yr(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Yr(e,t,n+1,r+1)}function ei(e,t){return t.some((function(t){return Yr(e,t)}))}var ti=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,o={};if(Array.isArray(r))r.forEach((function(e){var t=(0,i.CR)(e,2),n=t[0],r=t[1];o[n]=r}));else if(r instanceof Headers)r.forEach((function(e,t){o[t]=e}));else if("object"===typeof r&&null!==r)try{for(var s=(0,i.XA)(Object.entries(r)),a=s.next();!a.done;a=s.next()){var u=(0,i.CR)(a.value,2),c=u[0],l=u[1];o[c]=l}}catch(d){t={error:d}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return ci(o,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"===typeof this._bodySize)return this._bodySize;var e=f();if(null===e||void 0===e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=ri(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"===typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return 0===e.length?[2,null]:[2,ai(this.body,e,t)]}))}))},e}(),ni=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),ci(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return ri(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,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){return 0===e.length?[2,null]:[2,ai(this.body,e,t)]}))}))},e}();function ri(e,t){var n,r,o,s=f(),a=null===s||void 0===s?void 0:s.TextEncoder;if(a){var u;if("string"===typeof e)u=e,o=(new a).encode(u).length;else if(e instanceof Blob)o=(u=e).size;else if(e instanceof URLSearchParams)u=e,o=(new a).encode(u.toString()).length;else if(ArrayBuffer.isView(e))o=(u=e).byteLength;else if(e instanceof ArrayBuffer)o=(u=e).byteLength;else if(e instanceof FormData){var c=e,l=0,d=0;try{for(var v=(0,i.XA)(c.entries()),h=v.next();!h.done;h=v.next()){var p=(0,i.CR)(h.value,2),g=p[0],m=p[1];if(l+=g.length,"string"===typeof m)l+=(new a).encode(m).length;else{if(!(m instanceof Blob))return;l+=m.size}if(++d>=t)return}}catch(y){n={error:y}}finally{try{h&&!h.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}o=l}else if(e instanceof ReadableStream)return void(u=e);return o}}var ii,oi=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 n=this.response.headers,r={};return null===(t=null===n||void 0===n?void 0:n.forEach)||void 0===t||t.call(n,(function(e,t){r[t]=e})),ci(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},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,i.mG)(this,void 0,void 0,(function(){var e,t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}}
1))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,i.mG)(this,void 0,void 0,(function(){return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,ai(n.sent(),e,t)]}}))}))},e}(),si=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}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){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},o=this.headersString.split("\r\n");try{for(var s=(0,i.XA)(o),a=s.next();!a.done;a=s.next()){var u=a.value,c=(0,i.CR)(u.split(": "),2),l=c[0],d=c[1];l&&d&&(r[l]=d)}}catch(f){t={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return ci(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,i.mG)(this,void 0,void 0,(function(){var n;return(0,i.Jh)(this,(function(r){return 0===e.length?[2,null]:(n=this.getJson())?($r(n,e,t),[2,n]):[2,null]}))}))},e}();function ai(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return $r(r,t,n),r}catch(i){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(ii||(ii={}));var ui="[REDACTED]",ci=function(e,t){var n,r,o=t.allow,s=void 0===o?[]:o,a=t.strategy,u=void 0===a?ii.REMOVE:a,c=(0,i.ev)([],(0,i.CR)(O.EK),!1),l={},d=function(t){var n=t.toLowerCase();c.find((function(e){return e.toLowerCase()===n}))?u===ii.REDACT&&(l[t]=ui):s.find((function(e){return e.toLowerCase()===n}))?l[t]=e[t]:u===ii.REDACT&&(l[t]=ui)};try{for(var f=(0,i.XA)(Object.keys(e)),v=f.next();!v.done;v=f.next()){d(v.value)}}catch(h){n={error:h}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}return l},li=function(){function e(e,t,n,r,i,o,s,a,u,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=s,this.duration=a,this.responseWrapper=u,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,o={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?void 0:e.headers((0,i.ev)([],(0,i.CR)(O.Wb),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers((0,i.ev)([],(0,i.CR)(O.Wb),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(o).filter((function(e){var t=(0,i.CR)(e,2);t[0];return void 0!==t[1]})))},e}();var di,fi=function(e,t){void 0===t&&(t=h()),this.callback=e,this.id=t},vi=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=f();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=f();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,a,u,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(a=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===a?void 0:a.send,h=null===(l=null===(c=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&v&&h&&this.observeXhr(f,v,h);var p=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;p&&this.observeFetch(p),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(n){var r;try{n.callback(e)}catch(i){null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",i)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){var a;if(void 0!==o&&void 0!==s){var u,c,l,d="GET";if(!function(e){return"object"===typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(a=null===t||void 0===t?void 0:t.toString)||void 0===a?void 0:a.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(g){}d=(null===n||void 0===n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var v=Math.floor(performance.now()-s),h=Math.floor(o+v),p=new li(e,d,o,o,u,n,c,v,r,l,h);this.triggerEventCallbacks(p)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return(0,i.mG)(t,void 0,void 0,(function(){var t,o,s,a,u,c;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:try{t=this.getTimestamps()}catch(l){null===(u=this.logger)||void 0===u||u.debug("an unexpected error occurred while retrieving timestamps",l)}i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e(n,r)];case 2:return o=i.sent(),[3,4];case 3:return a=i.sent(),s=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new ti(r):void 0,o?new oi(o):void 0,s,null===t||void 0===t?void 0:t.startTime,null===t||void 0===t?void 0:t.durationStart)}catch(d){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",d)}if(o)return[2,o];throw s}}))}))})},e.createXhrJsonParser=function(e,t){return function(){var n,r;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(i){return i instanceof Error&&"InvalidStateError"===i.name&&(null===(r=t.logger)||void 0===r||r.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var o=this.globalScope.XMLHttpRequest.prototype,s=this;o.open=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var a=(0,i.CR)(r,2),u=a[0],c=a[1];try{this.$$AmplitudeAnalyticsEvent=(0,i.pi)({method:u,url:null===(e=null===c||void 0===c?void 0:c.toString)||void 0===e?void 0:e.call(c),headers:{}},s.getTimestamps())}catch(l){null===(n=s.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr open",l)}return t.apply(this,r)},o.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,s),a=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",(function(){var e;try{var t=i.getAllResponseHeaders(),n=i.getResponseHeader("content-length"),r=new si(i.status,t,n?parseInt(n,10):void 0,o),c=i.$$AmplitudeAnalyticsEvent.headers,l=new ni(a,c);u.status=i.status,s.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},l,r,void 0,u.startTime,u.durationStart)}catch(d){null===(e=s.logger)||void 0===e||e.error("an unexpected error occurred while handling xhr send",d)}})),n.apply(i,t)},o.setRequestHeader=function(e,t){var n;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(i){null===(n=s.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr setRequestHeader",i)}r.apply(this,[e,t])}}},e}
1(),hi=new vi,pi="[Amplitude] Network Request",gi=!0,mi="500-599";function yi(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function bi(e,t){var n,r,o=t.split(",");try{for(var s=(0,i.XA)(o),a=s.next();!a.done;a=s.next()){var u=a.value,c=(0,i.CR)(u.split("-").map(Number),2),l=c[0],d=c[1];if(e===l&&void 0===d)return!0;if(e>=l&&e<=d)return!0}}catch(f){n={error:f}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!1}function wi(e){var t;if(e)try{var n=null===(t=f())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,a=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:r.href,host:a}}catch(Ti){return}}function Si(e){return"object"!==typeof e||null===e?e?(0,i.ev)([],(0,i.CR)(O.Wb),!1):void 0===e?gi?void 0:(0,i.ev)([],(0,i.CR)(O.Wb),!1):void 0:0!==e.length?e:void 0}function Ii(e){var t,n;return!(null===(t=null===e||void 0===e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null===e||void 0===e?void 0:e.blocklist)||void 0===n?void 0:n.length)}function Ei(e,t){var n;void 0===t&&(t={});var r=wi(e.url);if(!r)return!1;var o,s=r.host;if(!1!==t.ignoreAmplitudeRequests&&(yi(s,"*.amplitude.com")||yi(s,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return yi(s,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!bi(e.status,mi))return!1;if(t.captureRules&&((0,i.ev)([],(0,i.CR)(t.captureRules),!1).reverse().find((function(t){if(o=function(e,t,n,r,i){if((!e.hosts||e.hosts.find((function(e){return yi(t,e)})))&&(!r||!e.urls||jn(r,e.urls))&&(!i||!e.methods||e.methods.find((function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((n||0===n)&&!bi(n,e.statusCodeRange||mi))}(t,s,e.status,e.url,e.method),o){var n=Si(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var i=Si(t.requestHeaders);if(e.requestWrapper&&i){var a=e.requestWrapper.headers(i);a&&(e.requestHeaders=a)}e.responseWrapper&&t.responseBody&&!Ii(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!Ii(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==o})),!o))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!==typeof n)return!1;if(JSON.parse(n).events.find((function(e){return e.event_type===pi})))return!0}catch(Ti){}return!1}(s,e.requestWrapper)}function ki(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,o=e.loggerProvider;return t.networkObservable.pipe(Yn((function(e){return Ei(e.event,n)}))).subscribe((function(e){var t,n,s,a=e.event,u=wi(a.url);if(u){var c=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,l=null===(s=a.requestWrapper)||void 0===s?void 0:s.bodySize;!function(e,t,n,r){(0,i.mG)(this,void 0,void 0,(function(){var o,s,a;return(0,i.Jh)(this,(function(u){switch(u.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(o=i.CR.apply(void 0,[u.sent(),2]),s=o[0],a=o[1],s)try{e["[Amplitude] Request Body"]=JSON.stringify(s)}catch(Ti){null===r||void 0===r||r.debug("Failed to stringify request body",Ti)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(Ti){null===r||void 0===r||r.debug("Failed to stringify response body")}u.label=2;case 2:return null===n||void 0===n||n.track(pi,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=u.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=u.query,t["[Amplitude] URL Fragment"]=u.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=l,t["[Amplitude] Response Body Size"]=c,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,o)}}))}!function(e){e.NetworkObservable="networkObservable"}(di||(di={}));var Ci=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],o=function(){var e,n=new fn((function(e){var n=new fi((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return hi.subscribe(n,t),function(){hi.unsubscribe(n)}}));return(e={})[di.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(s,a){return(0,i.mG)(void 0,void 0,void 0,(function(){var u,c;return(0,i.Jh)(this,(function(i){return"undefined"===typeof document||(u=o(),t=null===s||void 0===s?void 0:s.loggerProvider,c=ki({allObservables:u,networkTrackingOptions:e,amplitude:a,loggerProvider:t}),r.push(c),null===t||void 0===t||t.log("".concat(n," has been successfully added."))),[2]}))}
1))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,e]}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){var e,t,n,o;return(0,i.Jh)(this,(function(s){try{for(e=(0,i.XA)(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(a){n={error:a}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};let Ti=-1;const Pi=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Ti=t.timeStamp,e(t))}),!0)},_i=(e,t,n,r)=>{let i,o;return s=>{t.value>=0&&(s||r)&&(o=t.value-(i??0),(o||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,n),e(t)))}},xi=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Ri=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Oi=()=>{const e=Ri();return e?.activationStart??0},Ai=(e,t=-1)=>{const n=Ri();let r="navigate";return Ti>=0?r="back-forward-cache":n&&(document.prerendering||Oi()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},Mi=new WeakMap;function Li(e,t){return Mi.get(e)||Mi.set(e,new t),Mi.get(e)}class Di{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.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)}}const Ni=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe({type:e,buffered:!0,...n}),r}}catch{}},ji=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Fi=-1;const qi=new Set,Ui=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Gi=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of qi)e();isFinite(Fi)||(Fi="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Gi,!0))}},Ji=()=>
1{if(Fi<0){const e=Oi(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;Fi=t??Ui(),addEventListener("visibilitychange",Gi,!0),addEventListener("prerenderingchange",Gi,!0),Pi((()=>{setTimeout((()=>{Fi=Ui()}))}))}return{get firstHiddenTime(){return Fi},onHidden(e){qi.add(e)}}},Bi=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},Hi=[1800,3e3],Wi=(e,t={})=>{Bi((()=>{const n=Ji();let r,i=Ai("FCP");const o=Ni("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Oi(),0),i.entries.push(t),r(!0)))}));o&&(r=_i(e,i,Hi,t.reportAllChanges),Pi((n=>{i=Ai("FCP"),r=_i(e,i,Hi,t.reportAllChanges),xi((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},zi=[.1,.25];let Ki=0,Xi=1/0,Vi=0;const $i=e=>{for(const t of e)t.interactionId&&(Xi=Math.min(Xi,t.interactionId),Vi=Math.max(Vi,t.interactionId),Ki=Vi?(Vi-Xi)/7+1:0)};let Zi;const Qi=()=>Zi?Ki:performance.interactionCount??0;let Yi=0;class eo{u=[];l=new Map;m;p;v(){Yi=Qi(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((Qi()-Yi)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.P-e.P)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const to=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=ji(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})})))},no=[200,500],ro=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Ji();Bi((()=>{"interactionCount"in performance||Zi||(Zi=Ni("event",$i,{type:"event",buffered:!0,durationThreshold:0}));let r,i=Ai("INP");const o=Li(t,eo),s=e=>{to((()=>{for(const n of e)o.h(n);const t=o.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,r())}))},a=Ni("event",s,{durationThreshold:t.durationThreshold??40});r=_i(e,i,no,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),n.onHidden((()=>{s(a.takeRecords()),r(!0)})),Pi((()=>{o.v(),i=Ai("INP"),r=_i(e,i,no,t.reportAllChanges)})))}))};class io{m;h(e){this.m?.(e)}}const oo=[2500,4e3],so=[800,1800],ao=e=>{document.prerendering?Bi((()=>ao(e))):"complete"!==document.readyState?addEventListener("load",(()=>ao(e)),!0):setTimeout(e)};function uo(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function co(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(uo(e)),navigationStart:Math.floor(performance.timeOrigin)}}var lo,fo=function(){var e=null,t=f(),n=null===t||void 0===t?void 0:t.document,r=null===t||void 0===t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,o){return(0,i.mG)(void 0,void 0,void 0,(function(){var s,a,u;return(0,i.Jh)(this,(function(i){return s=function(e){var n;if(!e)return"";var r=e;try{r=decodeURI(e)}catch(Ti){null===(n=t.loggerProvider)||void 0===n||n.error("Malformed URI sequence: ",Ti)}return r},void 0===n||(a=s(null===r||void 0===r?void 0:r.href),u={"[Amplitude] Page Domain":(null===r||void 0===r?void 0:r.hostname)||"","[Amplitude] Page Location":a,"[Amplitude] Page Path":s(null===r||void 0===r?void 0:r.pathname),"[Amplitude] Page Title":"undefined"!==typeof document&&document.title||"","[Amplitude] Page URL":a.split("?")[0]},((e,t={})=>{Bi((()=>{const n=Ji();let r,i=Ai("LCP");const o=Li(t,io),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Oi(),0),i.entries=[t],r())},a=Ni("largest-contentful-paint",s);if(a){r=_i(e,i,oo,t.reportAllChanges);const n=ji((()=>{s(a.takeRecords()),a.disconnect(),r(!0)})),o=e=>{e.isTrusted&&(to(n),removeEventListener(e.type,o,{capture:!0}))};
1for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});Pi((n=>{i=Ai("LCP"),r=_i(e,i,oo,t.reportAllChanges),xi((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((function(e){u["[Amplitude] LCP"]=co(e)})),Wi((function(e){u["[Amplitude] FCP"]=co(e)})),ro((function(e){u["[Amplitude] INP"]=co(e)})),((e,t={})=>{const n=Ji();Wi(ji((()=>{let r,i=Ai("CLS",0);const o=Li(t,Di),s=e=>{for(const t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,r())},a=Ni("layout-shift",s);a&&(r=_i(e,i,zi,t.reportAllChanges),n.onHidden((()=>{s(a.takeRecords()),r(!0)})),Pi((()=>{o.i=0,i=Ai("CLS",0),r=_i(e,i,zi,t.reportAllChanges),xi((()=>r()))})),setTimeout(r))})))})((function(e){u["[Amplitude] CLS"]=co(e)})),((e,t={})=>{let n=Ai("TTFB"),r=_i(e,n,so,t.reportAllChanges);ao((()=>{const i=Ri();i&&(n.value=Math.max(i.responseStart-Oi(),0),n.entries=[i],r(!0),Pi((()=>{n=Ai("TTFB",0),r=_i(e,n,so,t.reportAllChanges),r(!0)})))}))})((function(e){u["[Amplitude] TTFB"]=co(e)})),e=function(){"hidden"===n.visibilityState&&e&&(o.track("[Amplitude] Web Vitals",u),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return[2,e]}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(t){return e&&(null===n||void 0===n||n.removeEventListener("visibilitychange",e)),[2]}))}))}}},vo=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[O.xp,t,e.substring(0,n)].filter(Boolean).join("_")},ho=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},po=function(e,t,n,r,o){void 0===o&&(o=!0);e.referrer;var s=e.referring_domain,a=(0,i._T)(e,["referrer","referring_domain"]),u=t||{},c=(u.referrer,u.referring_domain),l=(0,i._T)(u,["referrer","referring_domain"]);if(go(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!o&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(a)!==JSON.stringify(l),f=ho(s||"")!==ho(c||""),v=!t||d||f;return v?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),v},go=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}))},mo=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},yo=function(){function e(e,t){var n;this.shouldTrackNewCampaign=!1,this.options=(0,i.pi)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:mo(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)},e),this.storage=t.cookieStorage,this.storageKey=vo(t.apiKey,"MKTG"),this.webExpStorageKey=vo(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=O.Lo,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,i.mG)(this,void 0,void 0,(function(){var e,t;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=i.CR.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||$(this.sessionTimeout,this.lastEventTime),po(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}
1))}))},e.prototype.fetchCampaign=function(){return(0,i.mG)(this,void 0,void 0,(function(){var e;return(0,i.Jh)(this,(function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new st).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t=function(e,t){var n=(0,i.pi)((0,i.pi)({},O.Lo),e),r=Object.entries(n).reduce((function(e,n){var r,o=(0,i.CR)(n,2),s=o[0],a=o[1];return e.setOnce("initial_".concat(s),null!==(r=null!==a&&void 0!==a?a:t.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(s,a):e.unset(s)}),new W.h2);return Q(r)}(this.currentCampaign,this.options);return e&&(t.event_id=e),t},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),bo="AMP_CURRENT_PAGE",wo="AMP_PREVIOUS_PAGE",So="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(lo||(lo={}));var Io=new Set([V.IDENTIFY,V.GROUP_IDENTIFY,V.REVENUE]),Eo=function(){var e=f(),t=void 0,n=!1,r=void 0,o=!1,s=!1,a=function(e){var t="undefined"!==typeof location&&location.hostname||"",n=e?function(e){var t;try{var n=Fn(e,r);t=new URL(n).hostname}catch(Ti){null===r||void 0===r||r.error("Could not parse URL: ",Ti)}return t}(e):void 0;switch(n){case void 0:return lo.Direct;case t:return lo.Internal;default:return lo.External}},u=function(){(0,i.mG)(void 0,void 0,void 0,(function(){var e,r,o,s,a;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return t&&n?[4,t.get(So)]:[3,3];case 1:return e=i.sent(),r=Fn("undefined"!==typeof location&&location.href||""),o=(null===e||void 0===e?void 0:e[bo])||"",s=void 0,s=r===o?(null===e||void 0===e?void 0:e[wo])||"":o||document.referrer||"",[4,t.set(So,(a={},a[bo]=r,a[wo]=s,a))];case 2:i.sent(),i.label=3;case 3:return[2]}}
1))}))},c={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(a,c){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(c){switch(c.label){case 0:return(r=a.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),s=!0,e?[4,(t=new ke(e.sessionStorage)).isEnabled()]:[3,2];case 1:n=c.sent(),e.addEventListener("popstate",u),o||(e.history.pushState=new Proxy(e.history.pushState,{apply:function(e,t,n){var r=(0,i.CR)(n,3),o=r[0],a=r[1],c=r[2];e.apply(t,[o,a,c]),s&&u()}}),e.history.replaceState=new Proxy(e.history.replaceState,{apply:function(e,t,n){var r=(0,i.CR)(n,3),o=r[0],a=r[1],c=r[2];e.apply(t,[o,a,c]),s&&u()}}),o=!0),c.label=2;case 2:return[2]}}))}))},execute:function(e){return(0,i.mG)(void 0,void 0,void 0,(function(){var r,o,s,u,c;return(0,i.Jh)(this,(function(l){switch(l.label){case 0:return r=Fn("undefined"!==typeof location&&location.href||""),t&&n?[4,t.get(So)]:[3,5];case 1:return(null===(o=l.sent())||void 0===o?void 0:o[bo])?[3,3]:[4,t.set(So,(c={},c[bo]=r,c[wo]=document.referrer||"",c))];case 2:l.sent(),l.label=3;case 3:return[4,t.get(So)];case 4:if(s=l.sent(),u="",s&&(u=s[wo]||""),Io.has(e.event_type))return[2,e];e.event_properties=(0,i.pi)((0,i.pi)({},e.event_properties||{}),{"[Amplitude] Page Domain":ko(e,"[Amplitude] Page Domain","undefined"!==typeof location&&location.hostname||""),"[Amplitude] Page Location":ko(e,"[Amplitude] Page Location",r),"[Amplitude] Page Path":ko(e,"[Amplitude] Page Path","undefined"!==typeof location&&Fn(location.pathname)||""),"[Amplitude] Page Title":ko(e,"[Amplitude] Page Title",ot(it)),"[Amplitude] Page URL":ko(e,"[Amplitude] Page URL",r.split("?")[0]),"[Amplitude] Previous Page Location":u,"[Amplitude] Previous Page Type":a(u)}),l.label=5;case 5:return[2,e]}}))}))},teardown:function(){return(0,i.mG)(void 0,void 0,void 0,(function(){return(0,i.Jh)(this,(function(r){switch(r.label){case 0:return e&&(e.removeEventListener("popstate",u),s=!1),t&&n?[4,t.set(So,{})]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}
1))}))}};return c};function ko(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var Co=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return(0,i.ZT)(t,e),t.prototype.init=function(e,t,n){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=n):"string"===typeof t?(r=t,o=void 0):(r=null===t||void 0===t?void 0:t.userId,o=t),l(this._init((0,i.pi)((0,i.pi)({},o),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,o,s,a;return(0,i.mG)(this,void 0,void 0,(function(){var u,c,l,d,f,v,h,g,m,y=this;return(0,i.Jh)(this,(function(b){switch(b.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Ve(t.apiKey,t,this)]);case 1:return u=b.sent(),(null===(n=u.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)?(c=new p(u.apiKey,u.loggerProvider,u.serverZone,null===(r=u.remoteConfig)||void 0===r?void 0:r.serverUrl),[4,new Promise((function(e){null===c||void 0===c||c.subscribe("configs.analyticsSDK.browserSDK","all",(function(t,n,r){u.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&wt(t,u),e()}))}))]):[3,3];case 2:b.sent(),b.label=3;case 3:return(l=new P(u.apiKey,u.loggerProvider,u.serverZone,{enabled:u.enableDiagnostics,sampleRate:u.diagnosticsSampleRate||this._diagnosticsSampleRate})).setTag("library","".concat(pe,"/").concat(he)),[4,e.prototype._init.call(this,u)];case 4:return b.sent(),this.logBrowserOptions(u),this.config.diagnosticsClient=l,this.config.remoteConfigClient=c,te(this.config.defaultTracking)?(d=function(e){return te(e.defaultTracking)&&e.defaultTracking&&"object"===typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"===typeof e.defaultTracking.attribution?(0,i.pi)({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new yo(d,this.config),[4,this.webAttribution.init()]):[3,6];case 5:b.sent(),b.label=6;case 6:return f=_(),v=f.ampTimestamp?Number(f.ampTimestamp):void 0,h=!v||Date.now()<v,this.config.identify&&this.identify(this.config.identify),g=h&&
1!Number.isNaN(Number(f.ampSessionId))?Number(f.ampSessionId):void 0,this.setSessionId(null!==(a=null!==(s=null!==(o=t.sessionId)&&void 0!==o?o:g)&&void 0!==s?s:this.config.sessionId)&&void 0!==a?a:Date.now()),(m=A(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,8]:[4,this.add(mt()).promise];case 7:b.sent(),b.label=8;case 8:return[4,this.add(new B).promise];case 9:return b.sent(),[4,this.add(new ge).promise];case 10:return b.sent(),[4,this.add(new H).promise];case 11:return b.sent(),function(e){gt||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."),gt=!0)}(this.config),w=this.config.defaultTracking,ee(w,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(pt()).promise]):[3,13];case 12:b.sent(),b.label=13;case 13:return function(e){return ee(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(ft()).promise]):[3,15];case 14:b.sent(),b.label=15;case 15:return ne(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(ut(le(this.config))).promise]):[3,17];case 16:b.sent(),b.label=17;case 17:return oe(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Dr(ae(this.config),{diagnosticsClient:l})).promise]):[3,19];case 18:b.sent(),b.label=19;case 19:return se(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Xr(ue(this.config))).promise]):[3,21];case 20:b.sent(),b.label=21;case 21:return ie(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Ci(ce(this.config))).promise]):[3,23];case 22:b.sent(),b.label=23;case 23:return function(e){return"boolean"===typeof e?e:"object"===typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(fo()).promise]):[3,25];case 24:b.sent(),b.label=25;case 25:return function(e){return ee(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Eo()).promise]):[3,27];case 26:b.sent(),b.label=27;case 27:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 28:return b.sent(),m.eventBridge.setEventReceiver((function(e){var t=e.eventProperties||{},n=t.time,r=(0,i._T)(t,["time"]),o="number"===typeof n?{time:n}:void 0;y.track(e.eventType,r,o)})),[2]}var w}))}))},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){A(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){A(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(h()),this.setUserId(void 0)},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),l(Promise.resolve());if(e===this.config.sessionId)return l(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,re(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Fe,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return re(this.config.defaultTracking)&&n.push(this.track(je,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,l(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=
1Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ze(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(fe(t)){var r=t._q;t._q=[],t=de(new W.h2,r)}return(null===n||void 0===n?void 0:n.user_id)&&this.setUserId(n.user_id),(null===n||void 0===n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(fe(r)){var o=r._q;r._q=[],r=de(new W.h2,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(fe(t)){var r=t._q;t._q=[],t=de(new K,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,i.mG)(this,void 0,void 0,(function(){var n,r,o;return(0,i.Jh)(this,(function(i){return n=Date.now(),r=$(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===je||t.event_type===Fe||t.session_id&&t.session_id!==this.getSessionId()||(r||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),t.event_type===V.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,i.pi)((0,i.pi)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(Ti){this.config.loggerProvider.error("Error logging browser config",Ti)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(Y),To=function(){var e=new Co;return{init:c(e.init.bind(e),"init",s(e),u(e,["config"])),add:c(e.add.bind(e),"add",s(e),u(e,["config.apiKey","timeline.plugins"])),remove:c(e.remove.bind(e),"remove",s(e),u(e,["config.apiKey","timeline.plugins"])),track:c(e.track.bind(e),"track",s(e),u(e,["config.apiKey","timeline.queue.length"])),logEvent:c(e.logEvent.bind(e),"logEvent",s(e),u(e,["config.apiKey","timeline.queue.length"])),identify:c(e.identify.bind(e),"identify",s(e),u(e,["config.apiKey","timeline.queue.length"])),groupIdentify:c(e.groupIdentify.bind(e),"groupIdentify",s(e),u(e,["config.apiKey","timeline.queue.length"])),setGroup:c(e.setGroup.bind(e),"setGroup",s(e),u(e,["config.apiKey","timeline.queue.length"])),revenue:c(e.revenue.bind(e),"revenue",s(e),u(e,["config.apiKey","timeline.queue.length"])),flush:c(e.flush.bind(e),"flush",s(e),u(e,["config.apiKey","timeline.queue.length"])),getUserId:c(e.getUserId.bind(e),"getUserId",s(e),u(e,["config","config.userId"])),setUserId:c(e.setUserId.bind(e),"setUserId",s(e),u(e,["config","config.userId"])),getDeviceId:c(e.getDeviceId.bind(e),"getDeviceId",s(e),u(e,["config","config.deviceId"])),setDeviceId:c(e.setDeviceId.bind(e),"setDeviceId",s(e),u(e,["config","config.deviceId"])),reset:c(e.reset.bind(e),"reset",s(e),u(e,["config","config.userId","config.deviceId"])),getSessionId:c(e.getSessionId.bind(e),"getSessionId",s(e),u(e,["config"])),setSessionId:c(e.setSessionId.bind(e),"setSessionId",s(e),u(e,["config"])),extendSession:c(e.extendSession.bind(e),"extendSession",s(e),u(e,["config"])),setOptOut:c(e.setOptOut.bind(e),"setOptOut",s(e),u(e,["config"])),setTransport:c(e.setTransport.bind(e),"setTransport",s(e),u(e,["config"])),getIdentity:c(e.getIdentity.bind(e),"getIdentity",s(e),u(e,["config"])),getOptOut:c(e.getOptOut.bind(e),"getOptOut",s(e),u(e,["config"])),_setDiagnosticsSampleRate:c(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",s(e),u(e,["config"]))}}(),Po=To.add,_o=(To.extendSession,To.flush),xo=To.getDeviceId,Ro=(To.getIdentity,To.getOptOut,To.getSessionId,To.getUserId),Oo=(To.groupIdentify,To.identify),Ao=To.init,Mo=(To.logEvent,To.remove),Lo=To.reset,Do=(To.revenue,To.setDeviceId,To.setGroup,To.setOptOut),No=(To.setSessionId,To.setTransport,To.setUserId),jo=To.track;To._setDiagnosticsSampleRate},69635:function(e,t,n){n.d(t,{V:function(){return f}});var r=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:i(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),i=function(){return"undefined"!==typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},o=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};function a(e){var t="function"===typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
1if(e&&"number"===typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(a){i={error:a}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"===typeof SuppressedError&&SuppressedError;var c=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=a(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(p){n={error:p}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var u=Array.isArray(e),l=Array.isArray(t);if(u!==l)return!1;if(!u||!l){var d=Object.keys(e).sort(),f=Object.keys(t).sort();if(!c(d,f))return!1;var v=!0;return Object.keys(e).forEach((function(n){c(e[n],t[n])||(v=!1)})),v}for(var h=0;h<e.length;h++)if(!c(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var l=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=s({},this.identity.userProperties),n=s(s({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,c,l=n.userProperties||{};try{for(var d=a(Object.entries(e)),f=d.next();!f.done;f=d.next()){var v=u(f.value,2),h=v[0],p=v[1];switch(h){case"$set":try{for(var g=(i=void 0,a(Object.entries(p))),m=g.next();!m.done;m=g.next()){var y=u(m.value,2),b=y[0],w=y[1];l[b]=w}}catch(E){i={error:E}}finally{try{m&&!m.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}break;case"$unset":try{for(var S=(s=void 0,a(Object.keys(p))),I=S.next();!I.done;I=S.next()){delete l[b=I.value]}}catch(k){s={error:k}}finally{try{I&&!I.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(C){t={error:C}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}return n.userProperties=l,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return s({},this.identity)},e.prototype.setIdentity=function(e){var t=s({},this.identity);this.identity=s({},e),c(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),d="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof n.g?n.g:self,f=function(){function e(){this.identityStore=new l,this.eventBridge=new o,this.applicationContextProvider=new r}return e.getInstance=function(t){return d.analyticsConnectorInstances||(d.analyticsConnectorInstances={}),d.analyticsConnectorInstances[t]||(d.analyticsConnectorInstances[t]=new e),d.analyticsConnectorInstances[t]},e}()},80493:function(e,t,n){n.d(t,{h2:function(){return a},rk:function(){return u}});var r,i=n(69802),o=n(7126),s=n(12785),a=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,i.pi)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(r.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(r.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(r.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(r.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(r.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(r.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(r.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(r.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(r.UNSET,e,o.q$),this},e.prototype.clearAll=function(){return this._properties={},this._properties[r.CLEAR_ALL]=o.q$,this}
1,e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[r.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===r.ADD?"number"===typeof n:e===r.UNSET||e===r.REMOVE||(0,s.T)(t,n)))},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"}(r||(r={}));var u=[r.CLEAR_ALL,r.UNSET,r.SET,r.SET_ONCE,r.ADD,r.APPEND,r.PREPEND,r.PREINSERT,r.POSTINSERT,r.REMOVE]},7126:function(e,t,n){n.d(t,{EG:function(){return a},EK:function(){return R},JE:function(){return s},Ji:function(){return w},KI:function(){return v},Kh:function(){return k},Lo:function(){return _},NE:function(){return g},RE:function(){return l},VX:function(){return d},Wb:function(){return x},ah:function(){return m},b3:function(){return p},bz:function(){return S},cl:function(){return C},f1:function(){return o},fC:function(){return b},fZ:function(){return f},h8:function(){return c},lP:function(){return h},oZ:function(){return T},pG:function(){return P},pr:function(){return E},q$:function(){return r},rV:function(){return y},tS:function(){return I},xp:function(){return i},y_:function(){return u}});var r="-",i="AMP",o="".concat(i,"_unsent"),s="$default_instance",a="https://api2.amplitude.com/2/httpapi",u="https://api.eu.amplitude.com/2/httpapi",c="https://api2.amplitude.com/batch",l="https://api.eu.amplitude.com/batch",d="utm_campaign",f="utm_content",v="utm_id",h="utm_medium",p="utm_source",g="utm_term",m="dclid",y="fbclid",b="gbraid",w="gclid",S="ko_click_id",I="li_fat_id",E="msclkid",k="rdt_cid",C="ttclid",T="twclid",P="wbraid",_={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},x=["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"],R=["authorization","cookie","set-cookie"]},12785:function(e,t,n){n.d(t,{L:function(){return i},T:function(){return o}});var r=n(69802),i=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!o(t,n))return!1}return!0},o=function(e,t){var n,o;if("string"!==typeof e)return!1;if(Array.isArray(t)){var s=!0;try{for(var a=(0,r.XA)(t),u=a.next();!u.done;u=a.next()){var c=u.value;if(Array.isArray(c))return!1;if("object"===typeof c)s=s&&i(c);else if(!["number","string"].includes(typeof c))return!1;if(!s)return!1}}catch(l){n={error:l}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}else{if(null===t||void 0===t)return!1;if("object"===typeof t)return i(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0}},81650:function(e,t,n){n.d(t,{l:function(){return r}});var r=function(){var e="ampIntegrationContext";return"undefined"!==typeof globalThis&&"undefined"!==typeof globalThis[e]?globalThis[e]:"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof self?self:"undefined"!==typeof n.g?n.g:void 0}},69075:function(e,t,n){n.d(t,{kG:function(){return an}});var r,i,o=n(69802);!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"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var s,a=n(81650);!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"}(s||(s={}));var u,c=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var u=n(),c=u.logger,l=u.logLevel;if(l&&l<s.Debug||!l||!c)return e.apply(i,o);var d,f={type:"invoke public method",name:t,args:o,stacktrace:(d=1,void 0===d&&(d=0),((new Error).stack||"").split("\n").slice(2+d).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};r&&f.states&&(f.states.before=r());var v=e.apply(i,o);return v&&v.promise?v.promise.then((function(){r&&f.states&&(f.states.after=r()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))})):(r&&f.states&&(f.states.after=r()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))),v}},l="Amplitude Logger ",d=function(){function e(){this.logLevel=s.None}return e.prototype.disable=function(){this.logLevel=s.None},e.prototype.enable=function(e){void 0===e&&(e=s.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Verbose||console.log("".concat(l,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Warn||console.warn("".concat(l,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Error||console.error("".concat(l,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Debug||console.log("".concat(l,"[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"}(u||(u={}));var f,v=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,a,c,l,d,f,v,h,p,g,m,y,b,w,S,I,E;if("object"!==typeof e)return null;var k=e.code||0,C=this.buildStatus(k);switch(C){case u.Success:return{status:C,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case u.Invalid:return{status:C,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invali
1d_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(v=e.silenced_events)&&void 0!==v?v:[],throttledDevices:null!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case u.PayloadTooLarge:return{status:C,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case u.RateLimit:return{status:C,statusCode:k,body:{error:null!==(m=e.error)&&void 0!==m?m:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(I=e.exceeded_daily_quota_users)&&void 0!==I?I:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case u.Timeout:default:return{status:C,statusCode:k}}},e.prototype.buildStatus=function(e){return function(e){return e>=200&&e<300}(e)?u.Success:429===e?u.RateLimit:413===e?u.PayloadTooLarge:408===e?u.Timeout:e>=400&&e<500?u.Invalid:e>=500?u.Failed:u.Unknown},e}(),h=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return(0,o.ZT)(t,e),t.prototype.send=function(e,t){return(0,o.mG)(this,void 0,void 0,(function(){var n,r,i;return(0,o.Jh)(this,(function(s){switch(s.label){case 0:if("undefined"===typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:(0,o.pi)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=s.sent()).text()];case 2:i=s.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(a){return[2,this.buildResponse({code:r.status})]}return[2]}}
1))}))},t}(v),p=("".concat("AMP","_unsent"),"$default_instance"),g="https://api2.amplitude.com/2/httpapi",m=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:p,logLevel:s.Warn,loggerProvider:new d,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},y=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=m();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=w(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}(),b=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":g},w=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=m().serverZone),void 0===n&&(n=m().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:m().serverZone;return{serverZone:r,serverUrl:b(r,n)}};!function(){function e(){this.sdk={metrics:{histogram:{}}}}e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t}}();!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(f||(f={}));var S,I="[Amplitude]",E="".concat(I," Session Replay ID"),k=f.US,C={enabled:!0},T=1e3,P="".concat(I," Session Replay Debug"),_="amp-mask",x="amp-unmask",R="https://api-sr.amplitude.com/sessions/v2/track",O="https://api-sr.eu.amplitude.com/sessions/v2/track",A="https://api-sr.stag2.amplitude.com/sessions/v2/track",M=("".concat("AMP","_replay_unsent"),7e5),L=9e6,D=/payload.*exceed/i,N=500,j=1e4,F=1024,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"}(S||(S={}));var U=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){var t;if(!this.logger)return function(){};var n=this.logger[e];return"function"===typeof n?(null!==(t=n.__rrweb_original__)&&void 0!==t?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),G="medium";var J=function(e,t,n){switch(t){case"light":if("input"!==e)return!1;var r=n?function(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}(n):"";return!!r&&(!!["password","hidden","email","tel"].includes(r)||!!n.autocomplete.startsWith("cc-"));case"medium":return"input"===e;case"conservative":return!0;default:return J(e,G,n)}},B=function(e,t){var n,r,i;if(e&&t.urlMaskLevels)try{for(var s=(0,o.XA)(t.urlMaskLevels),a=s.next();!a.done;a=s.next()){var u=a.value;if(V(u.match).test(e))return u.maskLevel}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return null!==(i=t.defaultMaskLevel)&&void 0!==i?i:G},H=function(e,t,n,r){var i,o;if(void 0===t&&(t={defaultMaskLevel:G}),n){if(n.closest("."+_))return!0;var s=(null!==(i=t.maskSelector)&&void 0!==i?i:[]).some((function(e){return n.closest(e)}));if(s)return!0;
1if(n.closest("."+x))return!1;var a=(null!==(o=t.unmaskSelector)&&void 0!==o?o:[]).some((function(e){return n.closest(e)}));if(a)return!1}return J(e,B(r,t),n)},W=function(e,t,n){return function(r,i){return H(e,t,i,null===n||void 0===n?void 0:n())?r.replace(/[^\s]/g,"*"):r}},z=function(e,t){return function(n,r,i){var o;if("style"===n)return r;if(!(null!==(o=null===e||void 0===e?void 0:e.maskAttributes)&&void 0!==o?o:[]).includes(n))return r;var s=["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text";return H(s,e,i,null===t||void 0===t?void 0:t())?r.replace(/[^\s]/g,"*"):r}},K=function(){var e=(0,a.l)();return(null===e||void 0===e?void 0:e.location)?e.location.href:""},X=new Map,V=function(e){var t=X.get(e);if(t)return t;var n="\0TRAIL\0",r="\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(/\/\*\*$/,n)).replace(/\/\*\*\//g,r)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(n).join("(/.*)?")).split(r).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var u=new RegExp("^".concat(a,"$"));return X.set(e,u),u},$=function(e,t){var n,r;try{for(var i=(0,o.XA)(t),s=i.next();!s.done;s=i.next()){var a=s.value,u=V(a.selector);if(u.test(e))return e.replace(u,a.replacement)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},Z=function(){return(0,o.mG)(void 0,void 0,void 0,(function(){var e,t,n,r,i,s,u;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),(e=(0,a.l)())?[4,e.navigator.storage.estimate()]:[3,2];case 1:return t=o.sent(),n=t.usage,r=t.quota,i=t.usageDetails,s=n?Math.round(n/F):0,u=n&&r?Math.round(1e3*(n/r+Number.EPSILON))/1e3:0,[2,{totalStorageSize:s,percentOfQuota:u,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return o.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}}))}))},Q=function(e){var t=(0,o.pi)({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},Y=function(){return{flushMaxRetries:2,logLevel:s.Warn,loggerProvider:new d,transportProvider:new h}},ee=function(e){function t(t,n){var r,i,s,a,u,c,l,d,f,v,h=this,p=Y();if((h=e.call(this,(0,o.pi)((0,o.pi)({transportProvider:p.transportProvider,loggerProvider:new U(n.loggerProvider||p.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=p.flushMaxRetries?n.flushMaxRetries:p.flushMaxRetries,h.apiKey=t,h.sampleRate=n.sampleRate||0,h.serverZone=n.serverZone||k,h.configServerUrl=n.configServerUrl,h.trackServerUrl=n.trackServerUrl,h.shouldInlineStylesheet=n.shouldInlineStylesheet,h.version=n.version,h.performanceConfig=n.performanceConfig||C,h.storeType=null!==(r=n.storeType)&&void 0!==r?r:"memory",h.applyBackgroundColorToBlockedElements=null!==(i=n.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,h.enableUrlChangePolling=null!==(s=n.enableUrlChangePolling)&&void 0!==s&&s,h.urlChangePollingInterval=null!==(a=n.urlChangePollingInterval)&&void 0!==a?a:T,h.captureDocumentTitle=null!==(u=n.captureDocumentTitle)&&void 0!==u&&u,void 0!==n.fullSnapshotIntervalMs&&(h.fullSnapshotIntervalMs=n.fullSnapshotIntervalMs),h.privacyConfig=(0,o.pi)((0,o.pi)({},null!==(c=n.privacyConfig)&&void 0!==c?c:{}),{unmaskSelector:Array.from(new Set((0,o.ev)([".".concat(x)],(0,o.CR)(null!==(d=null===(l=n.privacyConfig)||void 0===l?void 0:l.unmaskSelector)&&void 0!==d?d:[]),!1)))}),n.interactionConfig&&(h.interactionConfig=n.interactionConfig,h.interactionConfig.ugcFilterRules&&function(e){if(!e.every((function(e){return"string"===typeof e.selector&&"string"===typeof e.replacement})))throw new Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every((function(e){return"string"===typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t);var t})))throw new Error("ugcFilterRules must be an array of objects with valid globs")}(h.interactionConfig.ugcFilterRules)),n.debugMode&&(h.debugMode=n.debugMode),void 0!==n.useWebWorker)h.useWebWorker=n.useWebWorker;else{var g=n;void 0!==(null===(f=g.experimental)||void 0===f?void 0:f.useWebWorker)&&(h.useWebWorker=g.experimental.useWebWorker)}return h.captureAdoptedStyleSheets=null===(v=n.captureAdoptedStyleSheets)||void 0===v||v,n.crossOriginIframes&&(h.crossOriginIframes=n.crossOriginIframes),n.flushIntervalConfig&&(h.flushIntervalConfig=function(e,t){var n,r,i={};void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<te?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(te,"ms; clamping.")),i.minIntervalMs=te):i.minIntervalMs=e.minIntervalMs);void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<te?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(te,"ms; clamping.")),i.maxIntervalMs=te):i.maxIntervalMs=e.maxIntervalMs);if(void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!==(n=i.minIntervalMs)&&void 0!==n?n:N,s=null!==(r=i.maxIntervalMs)&&void 0!==r?r:j;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(j,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(N,"); 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}(n.flushIntervalConfig,h.loggerProvider)),h}return(0,o.ZT)(t,e),t}(y),te=100;var ne,re=function(e){return{promise:e||Promise.resolve()}},ie="https://app.amplitude.com",oe={US:ie,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var se="__AMPLITUDE_MESSENGER_INSTANCE__",ae="__AMPLITUDE_MESSENGER__",ue=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?ie:t;this[ne]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),n.timeout>0&&setTimeout((function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,i,s;this.actionHandlers.has(e)&&(null===(s=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===s||s.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var u=(0,o.XA)(a),c=u.next();!c.done;c=u.next()){t(c.value)}}catch(l){n={error:l}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return(0,o.mG)(this,void 0,void 0,(function(){var t,n,r;return(0,o.Jh)(this,(function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise((function(t,n){var r;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(){n({status:!1,message:"Failed to load the script ".concat(e)})})),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(o){n(o)}}))}(e).then((function(){})),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}}
1))}))},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===ie&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,s;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var a=e.data,u=null===a||void 0===a?void 0:a.action;if(u)if("id"in a&&a.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(a.data);else{var l=null!==(s=r.pendingMessages.get(u))&&void 0!==s?s:[];l.push(a.data),r.pendingMessages.set(u,l)}}}},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,a.l)();(null===e||void 0===e?void 0:e[ae])===this&&delete e[ae]},e}();function ce(e){var t,n=(0,a.l)(),r=null===n||void 0===n?void 0:n[ae];if("object"===typeof(t=r)&&null!==t&&se in t&&!0===t[se])return r;var i=new ue(e);return n&&(n[ae]=i),i}ne=se;var le="__AMPLITUDE_BACKGROUND_CAPTURE__";var de=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},fe=n(69635),ve=function(e){return void 0===e&&(e=p),fe.V.getInstance(e)},he=(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))(he||{}),pe=(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))(pe||{}),ge=(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))(ge||{}),me=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(r){return this.logger.debug("Remote config localstorage failed to access: ",r),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 n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(r){return this.logger.debug("Remote config localstorage failed to parse: ",r),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(t){this.logger.debug("Remote config localstorage failed to set: ",t)}return Promise.resolve(!1)},e}(),ye=(0,o.ev)([],(0,o.CR)(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),be=function(e){var t,n=(0,a.l)();if(!(null===(t=null===n||void 0===n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,be)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,o.ev)([],(0,o.CR)(r.entries()),!1).map((function(e){var t=(0,o.CR)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(ye[r]):ye[r]})).join("")},we=401,Se=403,Ie=429,Ee=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvali
1dApiKey=!1,this.apiKey=e,this.serverUrl=r||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new me(e,t)}return e.prototype.subscribe=function(e,t,n){var r=be(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},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,o.mG)(this,void 0,void 0,(function(){var e,t=this;return(0,o.Jh)(this,(function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach((function(n){t.sendCallback(n,e,"remote")})),[2]}}))}))},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?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.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,o.mG)(this,void 0,void 0,(function(){var t,n,r,i=this;return(0,o.Jh)(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)})),n=this.storage.fetchConfig().then((function(e){return e})),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"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,o.mG)(this,void 0,void 0,(function(){var n,r;return(0,o.Jh)(this,(function(i){switch(i.label){case 0:n=new Promise((function(e,n){setTimeout((function(){n("Timeout exceeded")}),t)})),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[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!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}}
1))}))},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=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(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,o.mG)(this,void 0,void 0,(function(){var n,r,i,s,a,u,c=this;return(0,o.Jh)(this,(function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,u,l,d,f;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:i=!0,a=new AbortController,u=setTimeout((function(){return a.abort()}),t),o.label=1;case 1:return o.trys.push([1,7,8,9]),[4,fetch(s.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:a.signal})];case 2:return(l=o.sent()).ok?[3,4]:[4,l.text()];case 3:return d=o.sent(),s.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(d)),l.status===we||l.status===Se?(s.logger.error("Remote config client fetch failed with ".concat(l.status,". Invalid API key; future fetches will be skipped.")),s.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&l.status!==Ie&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:o.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(f=o.sent())instanceof Error&&"AbortError"===f.name?s.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):s.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),f),[3,9];case 8:return clearTimeout(u),[7];case 9:return i?r<e-1?[4,new Promise((function(e){return setTimeout(e,c.getJitterDelay(n))}))]:[3,11]:[2,"break"];case 10:o.sent(),o.label=11;case 11:return[2]}}
1))},s=this,a=0,l.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"===typeof(u=l.sent()))return[2,u.value];if("break"===u)return[3,4];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}}))}))},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}(),ke=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,n,r,i,s,a;return(0,o.mG)(this,void 0,void 0,(function(){var u,c,l,d,f,v,h,p,g,m,y,b,w,S,I,E,k,C=this;return(0,o.Jh)(this,(function(T){switch(T.label){case 0:(u=(0,o.pi)({},this.localConfig)).optOut=this.localConfig.optOut,u.captureEnabled=!0,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,new Promise((function(e,t){C.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},(function(n,r){var i;if(C.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(r,":"),JSON.stringify(n,null,2)),n){var o=n,s=o.sr_sampling_config,a=o.sr_privacy_config,l=o.sr_targeting_config,d=null===(i=u.interactionConfig)||void 0===i?void 0:i.ugcFilterRules;u.interactionConfig=o.sr_interaction_config,u.interactionConfig&&d&&(u.interactionConfig.ugcFilterRules=d),u.loggingConfig=o.sr_logging_config,(s||a||l)&&(c={},s&&(c.sr_sampling_config=s),a&&(c.sr_privacy_config=a),l&&(c.sr_targeting_config=l)),e()}else t(new Error("No remote config received"))}))}))];case 2:return T.sent(),[3,4];case 3:return l=T.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",l),u.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:u,remoteConfig:void 0}];case 4:if(!c)return[2,{localConfig:this.localConfig,joinedConfig:u,remoteConfig:c}];if(d=c.sr_sampling_config,f=c.sr_privacy_config,v=c.sr_targeting_config,d&&Object.keys(d).length>0?(Object.prototype.hasOwnProperty.call(d,"capture_enabled")?u.captureEnabled=d.capture_enabled:u.captureEnabled=!1,Object.prototype.hasOwnProperty.call(d,"sample_rate")&&(u.sampleRate=d.sample_rate),Object.prototype.hasOwnProperty.call(d,"min_session_duration_ms")&&(u.minSessionDurationMs=this.sanitizeMinSessionDurationMs(d.min_session_duration_ms))):(u.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),f){h=null!==(e=u.privacyConfig)&&void 0!==e?e:{},p={defaultMaskLevel:null!==(n=null!==(t=f.defaultMaskLevel)&&void 0!==t?t:h.defaultMaskLevel)&&void 0!==n?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,o.ev)([],(0,o.CR)(new Set((0,o.ev)((0,o.ev)([],(0,o.CR)(null!==(r=h.maskAttributes)&&void 0!==r?r:[]),!1),(0,o.CR)(null!==(i=f.maskAttributes)&&void 0!==i?i:[]),!1))),!1),urlMaskLevels:(0,o.ev)((0,o.ev)([],(0,o.CR)(null!==(s=f.urlMaskLevels)&&void 0!==s?s:[]),!1),(0,o.CR)(null!==(a=h.urlMaskLevels)&&void 0!==a?a:[]),!1)},g=function(e){var t,n,r,i,s,a,u,c,l,d={};"string"===typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var f=(0,o.XA)(null!==(u=e.blockSelector)&&void 0!==u?u:[]),v=f.next();!v.done;v=f.next()){d[v.value]="block"}}catch(y){t={error:y}}finally{try{v&&!v.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}try{for(var h=(0,o.XA)(null!==(c=e.maskSelector)&&void 0!==c?c:[]),p=h.next();!p.done;p=h.next()){d[p.value]="mask"}}catch(b){r={error:b}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}try{for(var g=(0,o.XA)(null!==(l=e.unmaskSelector)&&void 0!==l?l:[]),m=g.next();!m.done;m=g.next()){d[m.value]="unmask"}}catch(w){s={error:w}}finally{try{m&&!m.done&&(a=g.return)&&a.call(g)}finally{if(s)throw s.error}}return d},m=(0,o.pi)((0,o.pi)({},g(h)),g(f));try{for(y=(0,o.XA)(Object.entries(m)),b=y.next();!b.done;b=y.next())w=(0,o.CR)(b.value,2),S=w[0],"mask"===(I=w[1])?p.maskSelector.push(S):"block"===I?p.blockSelector.push(S):"unmask"===I&&p.unmaskSelector.push(S)}catch(P){E={error:P}}finally{try{b&&!b.done&&(k=y.return)&&k.call(y)}finally{if(E)throw E.error}}u.privacyConfig=function(t,n){var r=document.createDocumentFragment(),i=function(t){if(void 0===t&&(t=[]),"string"===typeof t&&(t=[t]),t=t.filter((function(t){try{r.querySelector(t)}catch(e){return n.warn('[session-replay-browser] omitting selector "'.concat(t,'" because it is invali
1d')),!1}return!0})),0!==t.length)return t};return t.blockSelector=i(t.blockSelector),t.maskSelector=i(t.maskSelector),t.unmaskSelector=i(t.unmaskSelector),t}(p,this.localConfig.loggerProvider)}return v&&Object.keys(v).length>0&&(u.targetingConfig=v),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:Q(u)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:u,remoteConfig:c}]}}))}))},e.prototype.sanitizeMinSessionDurationMs=function(e){if("number"===typeof e&&Number.isFinite(e)){if(!(e<0))return e>Ce?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(Ce,"ms ceiling; clamping.")),Ce):e;this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(e,"); ignoring."))}else this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),Ce=6e4,Te=function(e,t){return(0,o.mG)(void 0,void 0,void 0,(function(){var n,r;return(0,o.Jh)(this,(function(i){return n=new ee(e,t),r=new Ee(e,n.loggerProvider,n.serverZone,t.configServerUrl),[2,new ke(r,n)]}))}))};function Pe(e,t){return t||("STAGING"===e?A:"EU"===e?O:R)}function _e(e){if(e.type!==he.IncrementalSnapshot)return!1;var t=e.data;return t.source===pe.Mutation&&!t.isAttachIframe}function xe(e){var t,n,r,i,s=e[0],a=new Map,u=new Map,c=new Map,l=new Map,d=new Map;e.forEach((function(e,t){var n,r,i,s,f=e.data;try{for(var v=(0,o.XA)(f.adds),h=v.next();!h.done;h=v.next()){var p=h.value;a.has(p.node.id)||a.set(p.node.id,t),u.set(p.node.id,t),d.set(p.node.id,p.parentId)}}catch(b){n={error:b}}finally{try{h&&!h.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}try{for(var g=(0,o.XA)(f.removes),m=g.next();!m.done;m=g.next()){var y=m.value;c.has(y.id)||c.set(y.id,t),l.set(y.id,t)}}catch(w){i={error:w}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(i)throw i.error}}}));var f=new Set,v=new Set;try{for(var h=(0,o.XA)(a),p=h.next();!p.done;p=h.next()){var g=(0,o.CR)(p.value,2),m=g[0],y=g[1],b=c.get(m);if(void 0!==b)u.get(m)>=l.get(m)||(y<b?f.add(m):b<y&&v.add(m))}}catch(D){t={error:D}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}var w=new Set;if(f.size>0||v.size>0)for(var S=!0;S;){S=!1;try{for(var I=(r=void 0,(0,o.XA)(d)),E=I.next();!E.done;E=I.next()){var k=(0,o.CR)(E.value,2),C=k[0],T=k[1];if(!f.has(C)&&!v.has(C)&&!w.has(C)&&(f.has(T)||v.has(T)||w.has(T))){var P=c.get(C),_=a.get(C);void 0!==P&&void 0!==_&&P<_?v.add(C):void 0!==P&&void 0!==_&&P===_?w.add(C):f.add(C),S=!0}}}catch(N){r={error:N}}finally{try{E&&!E.done&&(i=I.return)&&i.call(I)}finally{if(r)throw r.error}}}var x=f.size>0||v.size>0||w.size>0,R=[];e.forEach((function(e,t){var n,r;try{for(var i=(0,o.XA)(e.data.removes),s=i.next();!s.done;s=i.next()){var u=s.value;f.has(u.id)||(v.has(u.id)&&t>=a.get(u.id)||w.has(u.id)&&(f.has(u.parentId)||v.has(u.parentId)||w.has(u.parentId))||R.push(u))}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}));var O=e.flatMap((function(e){return e.data.adds})),A=e.flatMap((function(e){return e.data.texts})),M=e.flatMap((function(e){return e.data.attributes})),L={source:pe.Mutation,removes:R,adds:x?O.filter((function(e){return!f.has(e.node.id)&&!v.has(e.node.id)&&!w.has(e.node.id)})):O,texts:x?A.filter((function(e){return!f.has(e.id)&&!v.has(e.id)&&!w.has(e.id)})):A,attributes:x?M.filter((function(e){return!f.has(e.id)&&!v.has(e.id)&&!w.has(e.id)})):M};return(0,o.pi)((0,o.pi)({},s),{data:L})}function Re(e){if(e.length<=1)return e;for(var t=[],n=0;n<e.length;)if(_e(e[n])){for(var r=n+1;r<e.length&&_e(e[r]);)r++;t.push(r>n+1?xe(e.slice(n,r)):e[n]),n=r}else t.push(e[n]),n++;return t}var Oe=function(){function e(e,t,n,r,i){var s,u=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e,n=t.type,r=t.timestamp,i=t.delay,o=t.data;return null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o})},this.addCompressedEventToManager=function(e,t){var n=new Blob([e]).size;n>L?u.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(n/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")):u.eventsManager&&u.deviceId&&u.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:u.deviceId})},this.addCompressedEvent=function(e,t){if(u.worker)try{u.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?u.worker.postMessage(JSON.stringify({event:e,sessionId:t})):u.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var n=u.compressEvent(e);u.addCompressedEventToManager(n,t)}},this.flushQueue=function(){var e;
1for(u.pendingQueue.length>0&&(e=u.taskQueue).push.apply(e,(0,o.ev)([],(0,o.CR)(u.mergeMutationTasks(u.pendingQueue.splice(0))),!1));u.taskQueue.length>0;){var t=u.taskQueue.shift();if(t){var n=t.event,r=t.sessionId,i=u.compressEvent(n);u.addCompressedEventToManager(i,r)}}u.isProcessing=!1},this.terminate=function(){var e;null===(e=u.worker)||void 0===e||e.terminate()};var c=(0,a.l)();if(this.canUseIdleCallback=c&&"requestIdleCallback"in c,this.eventsManager=e,this.config=t,this.deviceId=n,this.timeout=(null===(s=t.performanceConfig)||void 0===s?void 0:s.timeout)||2e3,this.onFullSnapshotProcessed=i,r){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([r],{type:"application/javascript"}),d=URL.createObjectURL(l),f=new Worker(d);f.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,")")),f.terminate(),u.worker=void 0},f.onmessage=function(e){var t=e.data,n=t.compressedEvent,r=t.sessionId;u.addCompressedEventToManager(n,r)},this.worker=f}catch(v){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",v)}}}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){var n,r,i,s;if(e.type===he.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var a=(0,o.ev)((0,o.ev)([],(0,o.CR)(this.taskQueue.splice(0)),!1),(0,o.CR)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var u=(0,o.XA)(a),c=u.next();!c.done;c=u.next()){var l=c.value,d=this.compressEvent(l.event);this.addCompressedEventToManager(d,l.sessionId)}}catch(v){n={error:v}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.isProcessing=!1}var f=this.compressEvent(e);return this.addCompressedEventToManager(f,t),void(null===(i=this.onFullSnapshotProcessed)||void 0===i||i.call(this))}this.canUseIdleCallback&&(null===(s=this.config.performanceConfig)||void 0===s?void 0:s.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,n=this;for(this.pendingQueue.length>0&&(t=this.taskQueue).push.apply(t,(0,o.ev)([],(0,o.CR)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1));this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var r=this.taskQueue.shift();if(r){var i=r.event,s=r.sessionId;this.addCompressedEvent(i,s)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback((function(e){n.processQueue(e)}),{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){var t,n,r;if(!(null===(r=this.config.performanceConfig)||void 0===r?void 0:r.mergeMutations))return e;if(e.length<=1)return e;for(var i=[],s=0;s<e.length;){for(var a=e[s].sessionId,u=s+1;u<e.length&&e[u].sessionId===a;)u++;var c=Re(e.slice(s,u).map((function(e){return e.event})));try{for(var l=(t=void 0,(0,o.XA)(c)),d=l.next();!d.done;d=l.next()){var f=d.value;i.push({event:f,sessionId:a})}}catch(v){t={error:v}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}s=u}return i},e}(),Ae="Session replay event batch rejected due to exceeded retry count",Me="Failed to store session replay events in IndexedDB",Le="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",De="1.44.0";function Ne(e,t){return(0,o.mG)(this,void 0,void 0,(function(){var n,r,i,s,a,u,c,l,d,f,v,h,p,g,m=this;return(0,o.Jh)(this,(function(y){switch(y.label){case 0:return y.trys.push([0,4,,5]),n=t.CompressionStream,r=new n("gzip"),i=r.writable.getWriter(),s=r.readable.getReader(),a=[],u=(0,o.mG)(m,void 0,void 0,(function(){var e,t,n;return(0,o.Jh)(this,(function(r){switch(r.label){case 0:return[4,s.read()];case 1:if(e=r.sent(),t=e.done,n=e.value,t)return[3,3];a.push(n),r.label=2;case 2:return[3,0];case 3:return[2]}}
1))})),[4,i.write((new TextEncoder).encode(e))];case 1:return y.sent(),[4,i.close()];case 2:return y.sent(),[4,u];case 3:y.sent(),c=a.reduce((function(e,t){return e+t.length}),0),l=new Uint8Array(c),d=0;try{for(f=(0,o.XA)(a),v=f.next();!v.done;v=f.next())h=v.value,l.set(h,d),d+=h.length}catch(b){p={error:b}}finally{try{v&&!v.done&&(g=f.return)&&g.call(f)}finally{if(p)throw p.error}}return[2,l];case 4:return y.sent(),[2,null];case 5:return[2]}}))}))}var je=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher,i=e.workerScript,s=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=n,this.payloadBatcher=r||function(e){return e},this.trackServerUrl=t,i)try{var a=new Blob([i],{type:"application/javascript"}),u=URL.createObjectURL(a),c=new Worker(u);c.onerror=function(e){var t,r;e.preventDefault(),n.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0;try{for(var i=(0,o.XA)(s.pendingWorkerRequests),a=i.next();!a.done;a=i.next()){var u=(0,o.CR)(a.value,2)[1];n.warn("Session replay event send failed due to worker crash: ".concat(e.message)),u.resolve()}}
1catch(l){t={error:l}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}s.pendingWorkerRequests.clear()},c.onmessage=function(e){var t=e.data;if("log"===t.type)n.log(t.message);else if("warn"===t.type)n.warn(t.message);else if("payload_too_large"===t.type){var r=s.pendingWorkerRequests.get(t.id);r&&(s.handlePayloadTooLargeResponse(r.context,t.isWaf),r.resolve(),s.pendingWorkerRequests.delete(t.id))}else if("complete"===t.type){var i=s.pendingWorkerRequests.get(t.id);i&&(void 0!==t.skipCode&&s.applyServerDirective(i.context.sessionId,t.skipCode),s.completeRequest({context:i.context}),i.resolve(),s.pendingWorkerRequests.delete(t.id))}},this.worker=c}catch(l){n.error("Failed to create track destination worker, falling back to main-thread sending:",l)}}return e.prototype.sendEventsList=function(e){this.addToQueue((0,o.pi)((0,o.pi)({},e),{attempts:0,timeout:0}))},e.prototype.sendBeacon=function(e){var t,n,r=e.events,i=e.sessionId,o=e.deviceId,s=e.apiKey,u=e.serverZone,c=function(e){return new Blob([e]).size},l=r,d=JSON.stringify({version:2,events:l});if(c(d)>65536){for(var f=0,v=l.length;f<v;){var h=Math.floor((f+v+1)/2);c(JSON.stringify({version:2,events:l.slice(0,h)}))<=65536?f=h:v=h-1}l=l.slice(0,f),d=JSON.stringify({version:2,events:l}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(r.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(Pe(u,this.trackServerUrl),"?").concat(p.toString()),m=(0,a.l)();try{var y=new Blob([d],{type:"application/json"});!1===(null===(n=null===(t=null===m||void 0===m?void 0:m.navigator)||void 0===t?void 0:t.sendBeacon)||void 0===n?void 0:n.call(t,g,y))&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(b){}}},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter((function(t){return e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:Le}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:Ae}),!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 n=this.flushPauseUntilMs-Date.now(),r=n>e?n:e;n>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),r)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,o.mG)(this,void 0,void 0,(function(){var t,n,r,i,s,a,u;return(0,o.Jh)(this,(function(c){switch(c.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)),c.label=1;case 1:c.trys.push([1,6,7,8]),n=(0,o.XA)(t),r=n.next(),c.label=2;case 2:return r.done?[3,5]:(i=r.value,[4,this.send(i,e)]);case 3:c.sent(),c.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return s=c.sent(),a={error:s},[3,8];case 7:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(a)throw a.error}return[7];case 8:return[2]}}
1))}))},e.prototype.mergeQueueAfterThrottle=function(e){var t,n,r,i,s,a,u,c,l,d,f,v=this;if(e.length<=1)return e;var h=new Map;try{for(var p=(0,o.XA)(e),g=p.next();!g.done;g=p.next()){var m=g.value,y=[m.sessionId,null!==(s=m.deviceId)&&void 0!==s?s:"",null!==(a=m.apiKey)&&void 0!==a?a:"",m.type,null!==(u=m.serverZone)&&void 0!==u?u:"",m.sampleRate,null!==(l=null===(c=m.version)||void 0===c?void 0:c.type)&&void 0!==l?l:"",null!==(f=null===(d=m.version)||void 0===d?void 0:d.version)&&void 0!==f?f:""].join("|"),b=h.get(y);b?b.push(m):h.set(y,[m])}}catch(k){t={error:k}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var w=[],S=function(e){var t,n;if(1===e.length)return w.push(e[0]),"continue";var r=null,i=0,s=function(){r&&w.push(r),r=null,i=0},a=function(e){var t=e.events.reduce((function(e,t){return e+new Blob([t]).size}),0);if(null===r)return r=(0,o.pi)((0,o.pi)({},e),{events:(0,o.ev)([],(0,o.CR)(e.events),!1),attempts:0}),i=t,"continue";if(i+t>14e5)return s(),r=(0,o.pi)((0,o.pi)({},e),{events:(0,o.ev)([],(0,o.CR)(e.events),!1),attempts:0}),i=t,"continue";var n=r.onComplete,a=e.onComplete;r.events=r.events.concat(e.events),i+=t,r.onComplete=function(){return(0,o.mG)(v,void 0,void 0,(function(){return(0,o.Jh)(this,(function(e){switch(e.label){case 0:return[4,Promise.allSettled([n(),a()])];case 1:return e.sent(),[2]}}))}))}};try{for(var u=(t=void 0,(0,o.XA)(e)),c=u.next();!c.done;c=u.next()){a(c.value)}}
1catch(l){t={error:l}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}s()};try{for(var I=(0,o.XA)(h.values()),E=I.next();!E.done;E=I.next()){S(E.value)}}catch(C){r={error:C}}finally{try{E&&!E.done&&(i=I.return)&&i.call(I)}finally{if(r)throw r.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,o.mG)(this,void 0,void 0,(function(){var n,r,i,s;return(0,o.Jh)(this,(function(o){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:Le})]:(n=e.apiKey)?(r=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(s=this.worker)?[2,this.sendViaWorker(s,e,i,t)]:[2,this.sendOnMainThread(n,r,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,n,r){return(0,o.mG)(this,void 0,void 0,(function(){var i,s=this;return(0,o.Jh)(this,(function(o){return i="".concat(++this.sendIdCounter),[2,new Promise((function(o){var a;s.pendingWorkerRequests.set(i,{context:t,resolve:o}),e.postMessage({type:"send",id:i,payload:n,useRetry:r,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!==(a=t.flushMaxRetries)&&void 0!==a?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:s.trackServerUrl,version:t.version,currentUrl:K(),sdkVersion:De}})}))]}))}))},e.prototype.sendOnMainThread=function(e,t,n,r,i){var s,u,c,l,d,f,v;return(0,o.mG)(this,void 0,void 0,(function(){var h,p,g,m,y,b,w,S,I,E,k,C,T,P,_,x;return(0,o.Jh)(this,(function(R){switch(R.label){case 0:h=K(),p=De,g=n.sampleRate,m=new URLSearchParams({device_id:t,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),y="".concat(null!==(u=null===(s=n.version)||void 0===s?void 0:s.type)&&void 0!==u?u:"standalone","/").concat(null!==(l=null===(c=n.version)||void 0===c?void 0:c.version)&&void 0!==l?l:p),R.label=1;case 1:return R.trys.push([1,13,,14]),b=JSON.stringify(r),(w=(0,a.l)())&&"CompressionStream"in w?[4,Ne(b,w)]:[3,3];case 2:return I=R.sent(),[3,4];case 3:I=null,R.label=4;case 4:return E=(S=I)?S.byteLength:new Blob([b]).size,k={headers:(0,o.pi)({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":p,"X-Client-Library":y,"X-Client-Url":h.substring(0,1e3),"X-Client-Sample-Rate":"".concat(g),"X-Sampling-Hash-Alg":"xxhash32"},S?{"Content-Encoding":"gzip"}:{}),body:null!==S&&void 0!==S?S:b,method:"POST",keepalive:E<=65536},C="".concat(Pe(n.serverZone,this.trackServerUrl),"?").concat(m.toString()),0===r.events.length?(this.completeRequest({context:n}),[2]):[4,fetch(C,k)];case 5:if(null===(T=R.sent()))return this.completeRequest({context:n,err:"Unexpected error occurred"}),[2];if(T.status>=200&&T.status<300&&(P=null!==(v=null===(f=null===(d=T.headers)||void 0===d?void 0:d.get)||void 0===f?void 0:f.call(d,"X-Session-Replay-Event-Skipped"))&&void 0!==v?v:null,this.applyServerDirective(n.sessionId,P)),i)return[3,6];_="";try{_=JSON.stringify(T.body,null,2)}catch(O){}return this.completeRequest({context:n,success:"".concat(T.status,": ").concat(_)}),[3,12];case 6:if(_="",413!==T.status)return[3,10];R.label=7;case 7:return R.trys.push([7,9,,10]),[4,T.text()];case 8:return _=R.sent(),[3,10];case 9:return R.sent(),[3,10];case 10:return[4,this.handleReponse(T.status,n,_)];case 11:R.sent(),R.label=12;case 12:return[3,14];case 13:return x=R.sent(),this.completeRequest({context:n,err:x}),[3,14];case 14:return[2]}}
1))}))},e.prototype.handleReponse=function(e,t,n){return void 0===n&&(n=""),(0,o.mG)(this,void 0,void 0,(function(){var r;return(0,o.Jh)(this,(function(i){switch(i.label){case 0:switch(r=(new v).buildStatus(e),r){case u.Success:return[3,1];case u.Failed:case u.Timeout:case u.RateLimit:return[3,2];case u.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(t),[3,8];case 2:return[4,this.handleOtherResponse(t)];case 3:return i.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(t,D.test(n)),[3,8];case 5:return 499!==e?[3,7]:[4,this.handleOtherResponse(t)];case 6:return i.sent(),[3,8];case 7:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),i.label=8;case 8:return[2]}}))}))},e.prototype.handlePayloadTooLargeResponse=function(e,t){var n=t?"WAF (compressed payload too large)":"server (event too large)",r=Math.round(e.events.reduce((function(e,t){return e+t.length}),0)/F);if(t)if(1!==e.events.length){this.loggerProvider.warn("Session replay event batch rejected by ".concat(n," (").concat(e.events.length," events, ").concat(r," KB total) \u2014 splitting and retrying")),e.onComplete();var i=function(){return Promise.resolve()},s=Math.floor(e.events.length/2);this.sendEventsList((0,o.pi)((0,o.pi)({},e),{events:e.events.slice(0,s),onComplete:i})),this.sendEventsList((0,o.pi)((0,o.pi)({},e),{events:e.events.slice(s),onComplete:i}))}else this.completeRequest({context:e,err:"Session replay event dropped: single event (".concat(r," KB, 1 event) rejected by ").concat(n," \u2014 cannot split further")});else this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(n," rejected payload (").concat(e.events.length," events, ").concat(r," KB) \u2014 not retrying non-WAF 413")})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/F);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,o.mG)(this,void 0,void 0,(function(){var t;return(0,o.Jh)(this,(function(n){switch(n.label){case 0:return t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:Ae}),[2]):[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return n.sent(),[4,this.send(e,!0)];case 2:return n.sent(),[2]}}))}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e.prototype.applyServerDirective=function(e,t){if(null===t)return this.flushPauseUntilMs=0,void(this.mergeLogFiredThisPause=!1);if("429"===t){var n=this.flushPauseUntilMs>Date.now();return this.flushPauseUntilMs=Date.now()+6e4,void(n||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(60,"s")))}"4005"!==t&&"4004"!==t||this.killSession(e,t)},e.prototype.killSession=function(e,t){var n,r,i,s;if(!this.killedSessions.has(e)){if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var a=(0,o.XA)(this.killedSessions),u=a.next();!u.done;u=a.next()){var c=u.value;this.killedSessions.delete(c);break}}catch(h){n={error:h}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.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 d=(0,o.XA)(this.queue),f=d.next();!f.done;f=d.next()){var v=f.value;v.sessionId===e?this.completeRequest({context:v,err:Le}):l.push(v)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(i)throw i.error}}this.queue=l}},e}(),Fe=n(39096),qe=function(){function e(e){var t,n,r,i=this;this.minInterval=N,this.maxInterval=j,this.maxPersistedEventsSize=M,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var n=i.getStringSize(t);return i.getEventsArraySize(e)+n>=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)&&void 0!==t?t:this.minInterval,this.maxInterval=null!==(n=e.maxInterval)&&void 0!==n?n:this.maxInterval,this.maxPer
1sistedEventsSize=null!==(r=e.maxPersistedEventsSize)&&void 0!==r?r: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,n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t++;else if(r<=2047)t+=2;else if(r>=55296&&r<=56319){var i=n+1<e.length?e.charCodeAt(n+1):NaN;i>=56320&&i<=57343?(t+=4,n++):t+=3}else t+=3}return t},e.prototype.getEventsArraySize=function(e){var t,n,r=0;try{for(var i=(0,o.XA)(e),s=i.next();!s.done;s=i.next()){var a=s.value;r+=this.getStringSize(a)}}catch(u){t={error:u}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r+(2+Math.max(0,e.length-1)+2*e.length)},e}(),Ue=function(e,t,n){var r;"object"===typeof(r=n)&&null!==r&&"AbortError"===r.name?e.debug(t):e.warn(t)};var Ge="sessionCurrentSequence",Je="sequencesToSend",Be=5e3;function He(e,t,n){var r=setTimeout(n,t);return e.then((function(){return clearTimeout(r)}),(function(){return clearTimeout(r)})),function(){return clearTimeout(r)}}var We,ze,Ke,Xe=function(e){var t,n;return e.objectStoreNames.contains(Ge)||(n=e.createObjectStore(Ge,{keyPath:"sessionId"})),e.objectStoreNames.contains(Je)||(t=e.createObjectStore(Je,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},Ve=function(e){return(0,o.mG)(void 0,void 0,void 0,(function(){return(0,o.Jh)(this,(function(t){switch(t.label){case 0:return[4,(n=(0,Fe.X3)(e,1,{upgrade:Xe}),r=2e3,i="IDB openDB timed out",void 0===i&&(i="IDB operation timed out"),new Promise((function(e,t){var o=setTimeout((function(){return t(new Error("".concat(i," after ").concat(r,"ms")))}),r);n.then((function(t){clearTimeout(o),e(t)}),(function(e){clearTimeout(o),t(e)}))})))];case 1:return[2,t.sent()]}var n,r,i}))}))},$e=function(e){function t(t){var n,r=this;return(r=e.call(this,t)||this).consecutiveFailures=0,r.hasTriggeredFallback=!1,r.emptyFilteredCount=0,r.getSequencesToSend=function(){return(0,o.mG)(r,void 0,void 0,(function(){var e,t,n,r,i,s,a,u,c,l,d=this;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:e=!1,t=!1,o.label=1;case 1:return o.trys.push([1,9,,10]),n=[],(r=this.db.transaction("sequencesToSend","readwrite")).done.catch((function(n){e||t||(Ue(d.loggerProvider,"".concat(Me,": ").concat(n),n),d.recordFailure())})),i=He(r.done,Be,(function(){e||t||(t=!0,Ue(d.loggerProvider,"".concat(Me,": transaction timed out")),d.recordFailure())})),[4,r.store.openCursor()];case 2:s=o.sent(),o.label=3;case 3:return s?(a=s.value,u=a.sessionId,0!==(c=a.events).length?[3,5]:(this.maybeLogEmptyFiltered("getSequencesToSend"),[4,s.delete()])):[3,8];case 4:return o.sent(),[3,6];case 5:n.push({events:c,sequenceId:s.key,sessionId:u}),o.label=6;case 6:return[4,s.continue()];case 7:return s=o.sent(),[3,3];case 8:return this.recordSuccess(),i(),[2,n];case 9:return l=o.sent(),t||(e=!0,Ue(this.loggerProvider,"".concat(Me,": ").concat(l),l),this.recordFailure()),[3,10];case 10:return[2,void 0]}}))}))},r.storeCurrentSequence=function(e){return(0,o.mG)(r,void 0,void 0,(function(){var t,n,r,i,s,a,u,c,l=this;return(0,o.Jh)(this,(function(d){switch(d.label){case 0:t=!1,n=!1,d.label=1;case 1:return d.trys.push([1,5,,6]),(r=this.db.transaction([Ge,Je],"readwrite")).done.catch((function(e){t||n||(Ue(l.loggerProvider,"".concat(Me,": ").concat(e),e),l.recordFailure())})),i=He(r.done,Be,(function(){t||n||(n=!0,Ue(l.loggerProvider,"".concat(Me,": transaction timed out")),l.recordFailure())})),[4,r.objectStore(Ge).get(e)];case 2:return!(s=d.sent())||s.tabId&&s.tabId!==this.tabId?(i(),[2,void 0]):0===s.events.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),i(),[2,void 0]):[4,r.objectStore(Je).put({sessionId:e,events:s.events,tabId:this.tabId})];case 3:return a=d.sent(),[4,r.objectStore(Ge).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return d.sent(),this.recordSuccess(),i(),s.tabId,u=(0,o._T)(s,["tabId"]),[2,(0,o.pi)((0,o.pi)({},u),{sessionId:e,sequenceId:a})];case 5:return c=d.sent(),n||(t=!0,Ue(this.loggerProvider,"".concat(Me,": ").concat(c),c),this.recordFailure()),[3,6];case 6:return[2,void 0]}}))}))},r.addEventToCurrentSequence=function(e,t){return(0,o.mG)(r,void 0,void 0,(function(){var n,r,i,s,a,u,c,l,d,f=this;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:n=!1,r=!1,o.label=1;case 1:return o.trys.push([1,15,,16]),(i=this.db.transaction([Ge,Je],"readwrite")).done.catch((function(e){n||r||(Ue(f.loggerProvider,"".concat(Me,": ").concat(e),e),f.recordFailure())}
1)),s=He(i.done,Be,(function(){n||r||(r=!0,Ue(f.loggerProvider,"".concat(Me,": transaction timed out")),f.recordFailure())})),[4,i.objectStore(Ge).get(e)];case 2:return(null===(a=o.sent())||void 0===a?void 0:a.tabId)&&a.tabId!==this.tabId?a.events.length>0?[4,i.objectStore(Je).put({sessionId:e,events:a.events,tabId:a.tabId})]:[3,4]:[3,6];case 3:o.sent(),o.label=4;case 4:return[4,i.objectStore(Ge).put({sessionId:e,events:[t],tabId:this.tabId})];case 5:return o.sent(),this.recordSuccess(),s(),[2,void 0];case 6:return(u=a)?[3,8]:[4,i.objectStore(Ge).put({sessionId:e,events:[t],tabId:this.tabId})];case 7:return o.sent(),this.recordSuccess(),s(),[2,void 0];case 8:return this.shouldSplitEventsList(u.events,t)?[3,10]:[4,i.objectStore(Ge).put({sessionId:e,events:u.events.concat(t),tabId:this.tabId})];case 9:return o.sent(),this.recordSuccess(),s(),[2,void 0];case 10:return 0!==(c=u.events).length?[3,12]:(this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore(Ge).put({sessionId:e,events:[t],tabId:this.tabId})]);case 11:return o.sent(),this.recordSuccess(),s(),[2,void 0];case 12:return[4,i.objectStore(Ge).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return o.sent(),[4,i.objectStore(Je).put({sessionId:e,events:c,tabId:this.tabId})];case 14:return l=o.sent(),this.recordSuccess(),s(),[2,{events:c,sessionId:e,sequenceId:l}];case 15:return d=o.sent(),r||(n=!0,Ue(this.loggerProvider,"".concat(Me,": ").concat(d),d),this.recordFailure()),[3,16];case 16:return[2,void 0]}}))}))},r.storeSendingEvents=function(e,t){return(0,o.mG)(r,void 0,void 0,(function(){var n,r;return(0,o.Jh)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(Je,{sessionId:e,events:t,tabId:this.tabId})];case 1:return n=i.sent(),this.recordSuccess(),[2,n];case 2:return r=i.sent(),Ue(this.loggerProvider,"".concat(Me,": ").concat(r),r),this.recordFailure(),[3,3];case 3:return[2,void 0]}}))}))},r.cleanUpSessionEventsStore=function(e,t){return(0,o.mG)(r,void 0,void 0,(function(){var e;return(0,o.Jh)(this,(function(n){switch(n.label){case 0:if(!t)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.db.delete(Je,t)];case 2:return n.sent(),this.recordSuccess(),[3,4];case 3:return e=n.sent(),Ue(this.loggerProvider,"".concat(Me,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}}
1))}))},r.db=t.db,r.tabId=t.tabId,r.onPersistentFailure=t.onPersistentFailure,r.consecutiveFailureThreshold=null!==(n=t.consecutiveFailureThreshold)&&void 0!==n?n:1,r}return(0,o.ZT)(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)||void 0===e||e.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(e,n){var r;return(0,o.mG)(this,void 0,void 0,(function(){var i,s,a,u,c;return(0,o.Jh)(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),s="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),[4,Ve(s)];case 1:return a=l.sent(),u=null!==(r=n.tabId)&&void 0!==r?r:function(){try{return crypto.randomUUID()}catch(r){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,o.pi)((0,o.pi)({},n),{db:a,tabId:u}))];case 2:return c=l.sent(),Ue(n.loggerProvider,"".concat(Me,": ").concat(c),c),[3,3];case 3:return[2]}}
1))}))},t.prototype.getCurrentSequenceEvents=function(e){return(0,o.mG)(this,void 0,void 0,(function(){var t,n,r,i,s,a,u,c;return(0,o.Jh)(this,(function(l){switch(l.label){case 0:return e?[4,this.db.get("sessionCurrentSequence",e)]:[3,2];case 1:return(i=l.sent())?i.tabId&&i.tabId!==this.tabId?[2,void 0]:(i.tabId,[2,[s=(0,o._T)(i,["tabId"])]]):[2,void 0];case 2:t=[],l.label=3;case 3:return l.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:n=o.XA.apply(void 0,[l.sent()]),r=n.next(),l.label=5;case 5:if(r.done)return[3,7];if((i=r.value).tabId&&i.tabId!==this.tabId)return[3,6];i.tabId,s=(0,o._T)(i,["tabId"]),t.push(s),l.label=6;case 6:return r=n.next(),[3,5];case 7:return[3,10];case 8:return a=l.sent(),u={error:a},[3,10];case 9:try{r&&!r.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 10:return[2,t]}}))}))},t}(qe),Ze=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,o.ZT)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=(0,o.ev)([],(0,o.CR)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,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,o.mG)(this,void 0,void 0,(function(){var e,t,n,r,i,s,a,u,c,l;return(0,o.Jh)(this,(function(d){e=[];try{for(t=(0,o.XA)(Object.entries(this.finalizedSequences)),n=t.next();!n.done;n=t.next())r=(0,o.CR)(n.value,2),i=r[0],s=r[1],a=s.sessionId,0!==(u=s.events).length?e.push({sequenceId:Number(i),sessionId:a,events:u}):(this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(i)])}catch(f){c={error:f}}finally{try{n&&!n.done&&(l=t.return)&&l.call(t)}finally{if(c)throw c.error}}return[2,e]}))}))},t.prototype.storeCurrentSequence=function(e){return(0,o.mG)(this,void 0,void 0,(function(){var t;return(0,o.Jh)(this,(function(n){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,o.mG)(this,void 0,void 0,(function(){var n;return(0,o.Jh)(this,(function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):n=this.addSequence(e)),this.sequences[e].push(t),[2,n]}))}))},t.prototype.storeSendingEvents=function(e,t){return(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]}))}))},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]}))}))},t}(qe),Qe=function(e){var t=e.config,n=e.minInterval,r=e.maxInterval,i=e.type,s=e.payloadBatcher,a=e.storeType,u=e.trackDestinationWorkerScript,c=e.shouldSend;return(0,o.mG)(void 0,void 0,void 0,(function(){function e(e){return void 0===e&&(e=!1),(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(t){return[2,l.flush(e)]}))}))}var l,d,f,v,h,p,g,m,y,b,w,S,I,E,k;return(0,o.Jh)(this,(function(C){switch(C.label){case 0:return l=new je((0,o.pi)((0,o.pi)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:s,workerScript:u})),d=function(){return new Ze({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n})},v=!1,p=function(){return(0,o.mG)(void 0,void 0,void 0,(function(){var e,n,r;return(0,o.Jh)(this,(function(i){switch(i.label){case 0:return v?(v=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),f?[4,h.getSequencesToSend()]:[3,2]):[2];case 1:return n=i.sent(),[3,3];case 2:n=void 0,i.label=3;
1case 3:return e=n,h=d(),e&&f&&(r=f,e.forEach((function(e){S({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}))),[2]}}))}))},g=function(){return(0,o.mG)(void 0,void 0,void 0,(function(){var e;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:return[4,$e.new(i,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,apiKey:t.apiKey,onPersistentFailure:function(){p()}})];case 1:return(e=o.sent())?(v=!0,[2,e]):(t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,d()])}}))}))},"idb"!==a?[3,2]:[4,g()];case 1:return m=C.sent(),[3,3];case 2:m=d(),C.label=3;case 3:return h=m,y=[],b=0,w=function(e){if(!(e<=b)){var t=Math.min(e-b,y.length);t>0&&(y.splice(0,t),b=e)}},S=function(e){var n=e.events,r=e.sessionId,s=e.deviceId,a=e.sequenceId,u=n.map((function(e){return{event:e,bytes:new Blob([e]).size}})),c=u.filter((function(e){return e.bytes>L}));c.length>0&&t.loggerProvider.warn("Dropping ".concat(c.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(c.map((function(e){return"".concat(Math.round(e.bytes/1024)," KB")})).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var d=c.length>0?u.filter((function(e){return e.bytes<=L})).map((function(e){return e.event})):n;0!==d.length?(t.debugMode&&Z().then((function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(i))})).catch((function(){})),l.sendEventsList({events:d,sessionId:r,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return(0,o.mG)(void 0,void 0,void 0,(function(){return(0,o.Jh)(this,(function(e){switch(e.label){case 0:return[4,h.cleanUpSessionEventsStore(r,a)];case 1:return e.sent(),[2]}}))}))}})):h.cleanUpSessionEventsStore(r,a).catch((function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)}))},I=function(e){var n=e.sessionId,r=e.deviceId;if(f=r,!c||c()){var i=b+y.length;h.storeCurrentSequence(n).then((function(e){e&&(w(i),S({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r}))})).catch((function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)}))}},E=function(e){var n=e.deviceId;return(0,o.mG)(void 0,void 0,void 0,(function(){var e;return(0,o.Jh)(this,(function(r){switch(r.label){case 0:return f=n,[4,h.getSequencesToSend()];case 1:return(null===(e=r.sent())||void 0===e?void 0:e.length)?(t.loggerProvider.log("Draining ".concat(e.length," stored sequence(s) from previous session.")),e.forEach((function(e){S({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})})),[2]):[2]}}))}))},k=function(e){var n=e.event,r=e.sessionId,i=e.deviceId;f=i;var o=!c||c(),s=b+y.length;y.push(n.data),h.addEventToCurrentSequence(r,n.data).then((function(e){if(e){if(!o)return h.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch((function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)})),void w(s);w(s),S({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)}))},[2,{sendCurrentSequenceEvents:I,addEvent:k,sendStoredEvents:E,flush:e,getBeaconEvents:function(){return(0,o.ev)([],(0,o.CR)(y),!1)},dropPendingBeaconEvents:function(){w(b+y.length)},trackDestination:l}]}}))}))},Ye=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Map;e.forEach((function(e){n.set(e.name,e.manager)})),this.managers=n}return e.prototype.sendStoredEvents=function(e){return(0,o.mG)(this,void 0,void 0,(function(){var t;return(0,o.Jh)(this,(function(n){switch(n.label){case 0:return t=[],this.managers.forEach((function(n){t.push(n.sendStoredEvents(e))})),[4,Promise.all(t)];case 1:return n.sent(),[2]}}))}))},e.prototype.addEvent=function(e){var t,n=e.sessionId,r=e.event,i=e.deviceId;null===(t=this.managers.get(r.type))||void 0===t||t.addEvent({sessionId:n,event:r,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;
1this.managers.forEach((function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})}))},e.prototype.flush=function(e){return(0,o.mG)(this,void 0,void 0,(function(){var t;return(0,o.Jh)(this,(function(n){switch(n.label){case 0:return t=[],this.managers.forEach((function(n){t.push(n.flush(e))})),[4,Promise.all(t)];case 1:return n.sent(),[2]}}))}))},e}();function et(e,t){if(Ke=new Date,e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};We=(0,o.pi)((0,o.pi)({},n),t),ze=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(We.root,n);var r=tt(e,"all",(function(){return tt(e,"two",(function(){return tt(e,"one",(function(){return tt(e,"none")}))}))}));if(r){var i=dt(ft(r,e));return i.length>0&&(r=i[0]),rt(r)}throw new Error("Selector was not found.")}function tt(e,t,n){for(var r=null,i=[],s=e,a=0,u=function(){var e,u,c=(new Date).getTime()-Ke.getTime();if(void 0!==We.timeoutMs&&c>We.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var l=ut(function(e){var t=e.getAttribute("id");if(t&&We.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(s))||ut.apply(void 0,(0,o.ev)([],(0,o.CR)(function(e){var t=Array.from(e.attributes).filter((function(e){return We.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(s)),!1))||ut.apply(void 0,(0,o.ev)([],(0,o.CR)(function(e){var t=Array.from(e.classList).filter(We.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(s)),!1))||ut(function(e){var t=e.tagName.toLowerCase();if(We.tagName(t))return{name:t,penalty:2};return null}(s))||[{name:"*",penalty:3}],d=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(s);if("all"==t)d&&(l=l.concat(l.filter(at).map((function(e){return st(e,d)}))));else if("two"==t)l=l.slice(0,1),d&&(l=l.concat(l.filter(at).map((function(e){return st(e,d)}))));else if("one"==t){var f=(0,o.CR)(l=l.slice(0,1),1)[0];d&&at(f)&&(l=[st(f,d)])}else"none"==t&&(l=[{name:"*",penalty:3}],d&&(l=[st(l[0],d)]));try{for(var v=(e=void 0,(0,o.XA)(l)),h=v.next();!h.done;h=v.next()){(f=h.value).level=a}}catch(p){e={error:p}}finally{try{h&&!h.done&&(u=v.return)&&u.call(v)}finally{if(e)throw e.error}}if(i.push(l),i.length>=We.seedMinLength&&(r=nt(i,n)))return"break";s=s.parentElement,a++};s;){if("break"===u())break}return r||(r=nt(i,n)),!r&&n?n():r}function nt(e,t){var n,r,i=dt(lt(e));if(i.length>We.threshold)return t?t():null;try{for(var s=(0,o.XA)(i),a=s.next();!a.done;a=s.next()){var u=a.value;if(ot(u))return u}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return null}function rt(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function it(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function ot(e){var t=rt(e);switch(ze.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function st(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function at(e){return"html"!==e.name&&!e.name.startsWith("#")}function ut(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(ct);return n.length>0?n:null}function ct(e){return null!==e&&void 0!==e}function lt(e,t){var n,r,i,s,a,u;return void 0===t&&(t=[]),(0,o.Jh)(this,(function(c){switch(c.label){case 0:if(!(e.length>0))return[3,9];c.label=1;case 1:c.trys.push([1,6,7,8]),n=(0,o.XA)(e[0]),r=n.next(),c.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,(0,o.XA)(lt(e.slice(1,e.length),t.concat(i)))]);case 3:c.sent(),c.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return s=c.sent(),a={error:s},[3,8];case 7:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(a)throw a.error}
1return[7];case 8:return[3,11];case 9:return[4,t];case 10:c.sent(),c.label=11;case 11:return[2]}}))}function dt(e){return(0,o.ev)([],(0,o.CR)(e),!1).sort((function(e,t){return it(e)-it(t)}))}function ft(e,t,n){var r,i,s;return void 0===n&&(n={counter:0,visited:new Map}),(0,o.Jh)(this,(function(a){switch(a.label){case 0:if(!(e.length>2&&e.length>We.optimizedMinLength))return[3,5];r=1,a.label=1;case 1:return r<e.length-1?n.counter>We.maxNumberOfTries?[2]:(n.counter+=1,(i=(0,o.ev)([],(0,o.CR)(e),!1)).splice(r,1),s=rt(i),n.visited.has(s)?[2]:ot(i)&&function(e,t){return ze.querySelector(rt(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return a.sent(),n.visited.set(s,!0),[5,(0,o.XA)(ft(i,t,n))];case 3:a.sent(),a.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}var vt=function(e){var t=e.version,n=e.events,r=[];return n.forEach((function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)})),{version:t,events:r}},ht=function(e){var t=e.version,n=e.events,r=[];n.forEach((function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)}));var i=r.reduce((function(e,t){var n=t.x,r=t.y,i=t.selector,s=t.timestamp,a=s-s%36e5,u="".concat(n,":").concat(r,":").concat(null!==i&&void 0!==i?i:"",":").concat(a);return e[u]?e[u].count+=1:e[u]=(0,o.pi)((0,o.pi)({},t),{timestamp:a,count:1}),e}),{});return{version:t,events:Object.values(i)}},pt=function(e,t){var n=this;this.createHook=function(e){var t=e.eventsManager,r=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,u=e.performanceOptions;return function(e){if(e.type===ge.Click){var c=(0,a.l)();if(c){var l=c.location,d=c.innerHeight,f=c.innerWidth;if(l){var v=e.x,h=e.y;if(void 0!==v&&void 0!==h){var p,g=o.getNode(e.id);if(g)try{p=et(g,u)}catch(w){n.logger.debug("error resolving selector from finder")}var m=$(l.href,s),y={x:v+n.scrollWatcher.currentScrollX,y:h+n.scrollWatcher.currentScrollY,selector:p,viewportHeight:d,viewportWidth:f,pageUrl:m,timestamp:Date.now(),type:"click"},b=i();b&&t.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(y)},deviceId:b})}}}}}},this.logger=e,this.scrollWatcher=t};function gt(){var e=(0,a.l)();return(null===e||void 0===e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function mt(){var e=(0,a.l)();return(null===e||void 0===e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var yt=function(){function e(e,t){var n=(0,a.l)();n&&n.navigator&&"function"===typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(r){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=Pe(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var n=this.context,r=n.sessionId,i=n.type,o=new URLSearchParams({device_id:e,session_id:String(r),type:String(i),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(o.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),bt=function(){function e(e,t){var n=this;this.timestamp=Date.now(),this.hook=function(e){n.update(e)},this.send=function(e){return function(t){var r,i,o,s,u=e(),c=(0,a.l)();if(c&&u){var l=null!==(r=c.scrollX)&&void 0!==r?r:0,d=null!==(i=c.scrollY)&&void 0!==i?i:0;(l>0||d>0)&&n.update({id:1,x:l,y:d}),n.transport.send(u,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:gt(),viewportWidth:mt(),pageUrl:$(c.location.href,null!==(s=null===(o=n.config.interactionConfig)||void 0===o?void 0:o.ugcFilterRules)&&void 0!==s?s:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=mt(),this._maxScrollHeight=gt(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new yt(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var n=mt();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var i=gt();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),wt=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId=function(e,t){return"".concat(t,"/").concat(e)}(t,n))},St=864e5,It=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},Et=function(e,t){return"".concat(It(e)).concat(t)},kt=function(){try{var e=(0,a.l)();return null===e||void 0===e?void 0:e.localStorage}catch(ne){return}},Ct=function(){var e=this;this.dbs={},this.createStore=function(t){return(0,o.mG)(e,void 0,void 0,(function(){return(0,o.Jh)(this,(function(e){switch(e.label){case 0:return[4,(0,Fe.X3)(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,o.mG)(e,void 0,void 0,(function(){var e,n;return(0,o.Jh)(this,(function(r){switch(r.label){case 0:return this.dbs&&this.dbs[t]?[2,this.dbs[t]]:(e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)]);case 1:return n=r.sent(),this.dbs[t]=n,[2,n]}}))}))},this.getTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId;return(0,o.mG)(e,void 0,void 0,(function(){var e,t,s,a;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=o.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null===(s=o.sent())||void 0===s?void 0:s.targetingMatch];case 3:return a=o.sent(),Ue(n,"Failed to get targeting match for session id ".concat(i,": ").concat(a),a),[3,4];case 4:return[2,void 0]}}))}))},this.storeTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId,s=t.targetingMatch;return(0,o.mG)(e,void 0,void 0,(function(){var e,t,a;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=o.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:s,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,o.sent()];case 3:return a=o.sent(),Ue(n,"Failed to store targeting match for session id ".concat(i,": ").concat(a),a),[3,4];case 4:return[2,void 0]}}))}))},this.clearStoreOfOldSessions=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.currentSessionId;return(0,o.mG)(e,void 0,void 0,(function(){var e,t,s,a,u,c,l,d;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,8,,9]),[4,this.openOrCreateDB(r)];case 1:return e=o.sent(),t=String(i),[4,(s=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:a=o.sent(),u=0,o.label=3;case 3:return u<a.length?(c=a[u],l=Date.now()-c.lastUpdated,c.sessionId!==t&&l>1728e5?[4,s.store.delete(c.sessionId)]:[3,5]):[3,6];case 4:o.sent(),o.label=5;case 5:return u++,[3,3];case 6:return[4,s.done];case 7:return o.sent(),[3,9];case 8:return d=o.sent(),Ue(n,"Failed to clear old targeting matches for sessions: ".concat(d),d),[3,9];case 9:return[2]}}
1))}))}},Tt=new Ct,Pt=function(e){var t=e.sessionId,r=e.targetingConfig,i=e.loggerProvider,s=e.apiKey,a=e.targetingParams,u=e.urlChange,c=void 0!==u&&u;return(0,o.mG)(void 0,void 0,void 0,(function(){var e,u,l,d,f,v;return(0,o.Jh)(this,(function(h){switch(h.label){case 0:return[4,Tt.clearStoreOfOldSessions({loggerProvider:i,apiKey:s,currentSessionId:t})];case 1:return h.sent(),[4,Tt.getTargetingMatchForSession({loggerProvider:i,apiKey:s,sessionId:t})];case 2:if(!0===h.sent()&&!c)return[2,!0];e=!0,h.label=3;case 3:return h.trys.push([3,6,,7]),[4,Promise.all([n.e(4492),n.e(6381)]).then(n.bind(n,36381))];case 4:return u=h.sent().evaluateTargeting,l=(0,o.pi)((0,o.pi)({},a),{flag:r,sessionId:"string"===typeof t?parseInt(t,10):t,apiKey:s,loggerProvider:i}),[4,u(l)];case 5:return(d=h.sent())&&d.sr_targeting_config&&(e="on"===d.sr_targeting_config.key),Tt.storeTargetingMatchForSession({loggerProvider:i,apiKey:s,sessionId:t,targetingMatch:e}),[3,7];case 6:return f=h.sent(),v=f,i.warn(v.message),[3,7];case 7:return[2,e]}}))}))},_t=2654435761,xt=2246822519,Rt=3266489917,Ot=668265263,At=374761393;function Mt(e,t){return(e<<t|e>>>32-t)>>>0}function Lt(e,t){return e=Mt(e=e+Math.imul(t,xt)>>>0,13),e=Math.imul(e,_t)>>>0}function Dt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nt(e,t){void 0===t&&(t=0);var n,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){var i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(r=i-56320+(r-55296<<10)+65536,n++)}r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<65536?t.push(224|r>>12,128|r>>6&63,128|63&r):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r)}return new Uint8Array(t)}(e),i=r.length,o=0;if(i>=16){for(var s=t+_t+xt>>>0,a=t+xt>>>0,u=t>>>0,c=t-_t>>>0;o<=i-16;)s=Lt(s,Dt(r,o)),a=Lt(a,Dt(r,o+=4)),u=Lt(u,Dt(r,o+=4)),c=Lt(c,Dt(r,o+=4)),o+=4;n=Mt(s,1)+Mt(a,7)+Mt(u,12)+Mt(c,18)>>>0}else n=t+At>>>0;for(n=n+i>>>0;o<=i-4;)n=n+Math.imul(Dt(r,o),Rt)>>>0,n=Math.imul(Mt(n,17),Ot)>>>0,o+=4;for(;o<i;)n=n+Math.imul(r[o],At)>>>0,n=Math.imul(Mt(n,11),_t)>>>0,o++;return n^=n>>>15,n=Math.imul(n,xt)>>>0,n^=n>>>13,n=Math.imul(n,Rt)>>>0,(n^=n>>>16)>>>0}var jt="__amplitude_url_tracking_patched__",Ft=new WeakMap;function qt(e,t,n){if(void 0===n&&(n={}),!(null===e||void 0===e?void 0:e.location))return function(){};var r=n.enablePolling,i=void 0!==r&&r,o=n.pollingInterval,s=void 0===o?T:o;if(i){var a=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""},u=a(),c=e.setInterval((function(){var e=a();e!==u&&(u=e,t(e))}),s);return function(){null!=c&&e.clearInterval(c)}}var l=Ft.get(e);if(!l){var d=void 0,f=new Set,v=function(){var t=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""}();void 0!==d&&t===d||(d=t,f.forEach((function(e){return e(t)})))},h=function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t);return v(),r};return t[jt]=!0,t},p=e.history;if(null===p||void 0===p?void 0:p.pushState){var g=Reflect.get(p,"pushState");g[jt]||(p.pushState=h(g))}if(null===p||void 0===p?void 0:p.replaceState){var m=Reflect.get(p,"replaceState");m[jt]||(p.replaceState=h(m))}l={callbacks:f,notify:v,onPopStateOrHashChange:function(){return v()},listenersAttached:!1},Ft.set(e,l)}var y=l;return y.listenersAttached||(e.addEventListener("popstate",y.onPopStateOrHashChange),e.addEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!0),y.callbacks.add(t),function(){y.callbacks.delete(t),0===y.callbacks.size&&y.listenersAttached&&(e.removeEventListener("popstate",y.onPopStateOrHashChange),e.removeEventListener("hashchange",y.onPopStateOrHashChange),y.listenersAttached=!1)}}function Ut(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,s,a,u=(0,o.pi)((0,o.pi)({},e),r),c=u.ugcFilterRules||[],l=null!==(i=u.enablePolling)&&void 0!==i&&i,d=null!==(s=u.pollingInterval)&&void 0!==s?s:T,f=null!==(a=u.captureDocumentTitle)&&void 0!==a&&a;if(!n)return function(){};var v=void 0,h=function(){return n.location&&n.location.href||""},p=function(){var e=h();if(void 0===v||e!==v){v=e;var r=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=h(),o="";return f&&(o=(null===r||void 0===r?void 0:r.title)||""),{href:c.length>
10?$(i,c):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}}();t(r)}},g=qt(n,(function(){return p()}),l?{enablePolling:!0,pollingInterval:d}:{});return p(),function(){return g()}},options:e}}Ut();var Gt=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null===(e=this.mutationObserver)||void 0===e||e.disconnect(),(0,a.l)()&&(this.sendToAllIframes({type:q,action:"start"}),this.mutationObserver=new MutationObserver((function(e){var n,r,i,s,a,u;try{for(var c=(0,o.XA)(e),l=c.next();!l.done;l=c.next()){var d=l.value;try{for(var f=(i=void 0,(0,o.XA)(Array.from(d.addedNodes))),v=f.next();!v.done;v=f.next()){(g=v.value)instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(g):g instanceof Element&&g.querySelectorAll("iframe").forEach((function(e){t.sendToIframeAfterLoad(e)}))}}catch(y){i={error:y}}finally{try{v&&!v.done&&(s=f.return)&&s.call(f)}finally{if(i)throw i.error}}try{for(var h=(a=void 0,(0,o.XA)(Array.from(d.removedNodes))),p=h.next();!p.done;p=h.next()){var g;if((g=p.value)instanceof HTMLIFrameElement){var m=t.pendingLoadListeners.get(g);m&&(g.removeEventListener("load",m),t.pendingLoadListeners.delete(g))}}}catch(b){a={error:b}}finally{try{p&&!p.done&&(u=h.return)&&u.call(h)}finally{if(a)throw a.error}}}}catch(w){n={error:w}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}})),this.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},e.prototype.stop=function(){var e;null===(e=this.mutationObserver)||void 0===e||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,n=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:q,action:"start"})};this.pendingLoadListeners.set(e,n),e.addEventListener("load",n,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach((function(n){return t.sendToIframe(n,e)}))},e.prototype.sendToIframe=function(e,t){var n;try{null===(n=e.contentWindow)||void 0===n||n.postMessage(t,"*")}catch(r){}},e}();var Jt,Bt,Ht,Wt=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.crossOriginIframeCoordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var n=(0,a.l)();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),!t&&n.addEventListener("blur",e.blurListener),!t&&n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),!t&&n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),!t&&n.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 n;null===(n=e.eventCompressor)||void 0===n||n.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach((function(e){e(t)}))},this.evaluateTargetingAndCapture=function(t,n,r,s){return void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===s&&(s=!1),(0,o.mG)(e,void 0,void 0,(function(){var e,u,c,l,d,f,v,h,p,g,m,y;return(0,o.Jh)(this,(function(o){switch(o.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(!n)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.")}return this.lastTargetingParams=t,e=this.config.targetingConfig,e&&!this.sessionTargetingMatch?(u=s?this.latestUrlChangeTargetingEvaluationId:void 0,(c=t.event)&&Object.values(i).includes(c.event_type)&&(c=void 0),l=null!==(m=null!==(h=null===(v=t.page)||void 0===v?void 0:v.url)&&void 0!==h?h:null===(g=null===(p=(0,a.l)())||void 0===p?void 0:p.location)||void 0===g?void 0:g.href)&&void 0!==m?m:"",d=null!==(y=t.page)&&void 0!==y?y:""!==l?{url:l}:void 0,[4,Pt({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:c,page:d},urlChange:s})]):[3,2];case 1:if(f=o.sent(),s&&void 0!==u&&u!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(u,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||f,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:c,targetingParams:t},null,2)),o.label=2;case 2:return n?(this.initialize(!0),[3,5]):[3,3];case 3:return!r&&this.recordCancelCallback?[3,5]:(this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()]);case 4:o.sent(),o.label=5;case 5:return[2]}}
1))}))},this.addCustomRRWebEvent=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r=!0),(0,o.mG)(e,void 0,void 0,(function(){var e,i,s,a;return(0,o.Jh)(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),e=void 0,(i=this.config)&&t!==S.METADATA?(e={config:Q(i),version:De},r?[4,Z()]:[3,2]):[3,2];case 1:s=u.sent(),e=(0,o.pi)((0,o.pi)({},s),e),u.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,o.pi)((0,o.pi)({},n),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return a=u.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",a),[3,4];case 4:return[2]}}))}))},this.stopRecordingEvents=function(){var t,n,r;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null===(t=e.networkObservers)||void 0===t||t.stop(),null===(n=e.crossOriginIframeCoordinator)||void 0===n||n.stop(),e.crossOriginIframeCoordinator=null,null===(r=e.crossOriginParentSignalCleanup)||void 0===r||r.call(e),e.crossOriginParentSignalCleanup=null}catch(o){var i=o;e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(i.toString()))}},this.loggerProvider=new U(new d)}return e.prototype.init=function(e,t){return re(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,n=this;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this);var r=(0,a.l)();if(null===r||void 0===r?void 0:r.location){var i=!!(null===(t=this.config)||void 0===t?void 0:t.targetingConfig),o=qt(r,(function(e){if(n.currentPageUrl=e,i){var t=++n.latestUrlChangeTargetingEvaluationId;n.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),n.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}}));this.urlChangeCleanup=function(){o(),n.urlChangeCleanup=null}}},e.prototype.isBelowMinSessionDuration=function(){var e,t=null===(e=this.config)||void 0===e?void 0:e.minSessionDurationMs;return void 0!==t&&void 0!==this.sessionStartTime&&Date.now()-this.sessionStartTime<t},e.prototype.getCurrentPageForTargeting=function(){var e,t,n=null===(t=null===(e=(0,a.l)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href;return null!=n?{url:n}:void 0},e.prototype._init=function(e,t){var r,i,s,u,c,l,f,v,h,p,g,m,y,b;return(0,o.mG)(this,void 0,void 0,(function(){var w,S,I,E,k,C,T,P,_,x,R,O,A,M,L,D,N,j,F,q,G,J,B,H,W,z,X,V,$,Z,Q=this;return(0,o.Jh)(this,(function(Y){switch(Y.label){case 0:return null===(r=this.urlChangeCleanup)||void 0===r||r.call(this),this.loggerProvider=new U(t.loggerProvider||new d),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=K(),this.identifiers=new wt({sessionId:t.sessionId,deviceId:t.deviceId}),w=Date.now(),function(e,t,n){var r,i,s=kt();if(s){var a=It(e);try{for(var u=[],c=0;c<s.length;c++)if((h=s.key(c))&&h.startsWith(a)){var l=s.getItem(h);if(null!==l){var d=Number(l);(!Number.isFinite(d)||d<=0||t-d>=St)&&u.push(h)}}try{for(var f=(0,o.XA)(u),v=f.next();!v.done;v=f.next()){var h=v.value;s.removeItem(h)}}catch(p){r={error:p}}finally{try{v&&!v.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}catch(g){null===n||void 0===n||n.debug("Failed to prune stale replay start times: ".concat(String(g)))}}}(e,w,this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!==(i=function(e,t,n,r){var i=kt();if(i){var o=Et(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=n&&n-a<St)return a}return i.setItem(o,String(n)),n}catch(u){return void(null===r||void 0===r||r.debug("Failed to read/write replay start time from storage: ".concat(String(u))))}}}(e,t.sessionId,w,this.loggerProvider))&&void 0!==i?i:w,S=this,[4,Te(e,t)];case 1:return S.joinedConfigGenerator=Y.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:return I=Y.sent(),E=I.joinedConfig,k=I.localConfig,C=I.remoteConfig,this.config=E,this.setMetadata(t.sessionId,E,k,C,null===(s=t.version)||void 0===s?void 0:s.version,De,null===(u=t.version)||void 0===u?void 0:u.type),this.pageLeaveFns=[],t.sessionId&&(null===(c=this.config.interactionConfig)||void 0===c?void 0:c.enabled)&&(T=bt.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[T.send(this.getDeviceId.bind(this)).bind(T)],this.scrollHook=T.hook.bind(T),this.clickHandler=new pt(this.loggerProvider,T)),P=[],"idb"!==(_=this.config.storeType)||(null===(l=(0,a.l)())||void 0===l?void 0:l.indexedDB)||(_="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(_," for event storage.")),O=(0,a.l)(),this.config.useWebWorker&&O&&O.Worker?[4,n.e(6757).then(n.bind(n,26757))]:[3,4];case 3:A=Y.sent(),M=A.compressionScript,L=A.trackDestinationScript,x=M,R=L,Y.label=4;case 4:return Y.trys.push([4,6,,7]),[4,Qe({config:this.config,type:"replay",minInterval:null===(f=this.config.flushIntervalConfig)||void 0===f?void 0:f.minIntervalMs,maxInterval:null===(v=this.config.flushIntervalConfig)||void 0===v?void 0:v.maxIntervalMs,storeType:_,trackDestinationWorkerScript:R,shouldSe
1nd:function(){return!Q.isBelowMinSessionDuration()}})];case 5:return D=Y.sent(),this.rrwebEventManager=D,P.push({name:"replay",manager:D}),[3,7];case 6:return N=Y.sent(),G=N,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(G.toString())),[3,7];case 7:if(!(null===(h=this.config.interactionConfig)||void 0===h?void 0:h.enabled))return[3,11];j=this.config.interactionConfig.batch?ht:vt,Y.label=8;case 8:return Y.trys.push([8,10,,11]),[4,Qe({config:this.config,type:"interaction",minInterval:null!==(p=this.config.interactionConfig.trackEveryNms)&&void 0!==p?p:3e4,maxInterval:6e4,payloadBatcher:j,storeType:_,trackDestinationWorkerScript:R})];case 9:return F=Y.sent(),P.push({name:"interaction",manager:F}),[3,11];case 10:return q=Y.sent(),G=q,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(G.toString())),[3,11];case 11:if(this.eventsManager=new(Ye.bind.apply(Ye,(0,o.ev)([void 0],(0,o.CR)(P),!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new Oe(this.eventsManager,this.config,this.getDeviceId(),x,(function(){return Q.sendEvents()})),this.pendingEmitEvents.length>0){J=this.pendingEmitEvents.splice(0);try{for(B=(0,o.XA)(J),H=B.next();!H.done;H=B.next())W=H.value,z=W.event,X=W.sessionId,this.eventCompressor.enqueueEvent(z,X)}catch(ee){$={error:ee}}finally{try{H&&!H.done&&(Z=B.return)&&Z.call(B)}finally{if($)throw $.error}}}return this.pageLeaveFns=(0,o.ev)((0,o.ev)([],(0,o.CR)(this.pageLeaveFns),!1),[function(){var e;if(Q.config&&(null===(e=Q.identifiers)||void 0===e?void 0:e.sessionId)&&D){var t=D.getBeaconEvents();if(t.length){var n=Q.getDeviceId();n&&(Q.isBelowMinSessionDuration()||D.trackDestination.sendBeacon({events:t,sessionId:Q.identifiers.sessionId,deviceId:n,apiKey:Q.config.apiKey,serverZone:Q.config.serverZone}))}}}],!1),[4,this.initializeNetworkObservers()];case 12:return Y.sent(),(null===(g=(0,a.l)())||void 0===g?void 0:g.opener)&&(function(e,t){var n,r=e;if(!0!==r[le]){r[le]=!0;var i=null!==(n=null===t||void 0===t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.1.js.gz",o=null,s=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",(function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then((function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:s}),e.notify({action:"background-capture-loaded"})})).catch((function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")}))})),e.registerActionHandler("close-background-capture",(function(){var e;null===(e=null===o||void 0===o?void 0:o.close)||void 0===e||e.call(o),o=null}))}}(V=ce()),V.setup((0,o.pi)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:oe[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 Y.sent(),(this.config.targetingConfig||(null!==(b=null===(y=null===(m=this.config.privacyConfig)||void 0===m?void 0:m.urlMaskLevels)||void 0===y?void 0:y.length)&&void 0!==b?b:0)>0)&&this.setupUrlChangeListener(),[2]}}))}))},e.prototype.setSessionId=function(e,t){return re(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){var r,i,s;return(0,o.mG)(this,void 0,void 0,(function(){var a,u,c,l;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:return this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(a=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(a),(u=a!==e)&&(null===(r=this.rrwebEventManager)||void 0===r||r.dropPendingBeaconEvents()),c=t||this.getDeviceId(),this.identifiers=new wt({sessionId:e,deviceId:c}),u&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null===(i=this.config)||void 0===i?void 0:i.apiKey)&&(function(e,t,n,r){var i=kt();if(i)try{i.setItem(Et(e,t),String(n))}catch(o){null===r||void 0===r||r.debug("Failed to write replay start time to storage: ".concat(String(o)))}}(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==a&&function(e,t,n){var r=kt();if(r)try{r.removeItem(Et(e,t))}catch(i){null===n||void 0===n||n.debug("Failed to remove replay start time from storage: ".concat(String(i)))}}(this.config.apiKey,a,this.loggerProvider))),this.joinedConfigGenerator&&a?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2];case 1:l=o.sent().joinedConfig,this.config=l,o.label=2;case 2:return(null===(s=this.config)||void 0===s?void 0:s.targetingConfig)?[4,this.evaluateTargetingAndCapture({userProperties:null===n||void 0===n?void 0:n.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)]:[3,4];case 3:return o.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:o.sent(),o.label=6;case 6:return[2]}}
1))}))},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,n=this.identifiers;if(!t||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var r=this.getShouldRecord(),i={};return r&&((e={})[E]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[P]=JSON.stringify({appHash:de(t.apiKey).toString()}))),this.addCustomRRWebEvent(S.GET_SR_PROPS,{shouldRecord:r,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,n,r=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),i=this.getDeviceId();if(this.eventsManager&&r&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;return this.loggerProvider.log("Session ".concat(r," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),void this.suppressedSendCount++}if(!this.hasEmittedGateDecision&&void 0!==(null===(n=this.config)||void 0===n?void 0:n.minSessionDurationMs)&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(S.REPLAY_GATE_DECISION,{sessionId:r,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:r,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,o.mG)(this,void 0,void 0,(function(){var n;return(0,o.Jh)(this,(function(r){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[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(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=ve(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.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,n=!1,r="",i=!1;this.config.targetingConfig?this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),n=!0,i=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),n=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,Nt(e.toString())%1e6/1e6<t)?(n=!0,i=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),n=!1,i=!1);return this.lastShouldRecordDecision!==n&&this.config.targetingConfig&&(this.addCustomRRWebEvent(S.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=n),n},e.prototype.getBlockSelectors=function(){var e,t,n,r=null!==(n=null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector)&&void 0!==n?n:[];if(0!==r.length)return r},e.prototype.getMaskTextSelectors=function(){var e,t,n=null===(e=this.config)||void 0===e?void 0:e.privacyConfig;if("conservative"===(n?B(this.currentPageUrl,n):void 0))return"*";if(null===(t=null===n||void 0===n?void 0:n.urlMaskLevels)||void 0===t?void 0:t.some((function(e){return"conservative"===e.maskLevel})))return"*";var r=null===n||void 0===n?void 0:n.urlMaskLevels;if("conservative"===(null===n||void 0===n?void 0:n.defaultMaskLevel)&&r&&r.length>0)return"*";var i=null===n||void 0===n?void 0:n.maskSelector;return i||void 0},e.prototype.getRecordingPlugins=function(e){var t,r,i,s,a,u;return(0,o.mG)(this,void 0,void 0,(function(){var c,l,d,f;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:c=[];try{l=Ut({ugcFilterRules:(null===(r=null===(t=this.config)||void 0===t?void 0:t.interactionConfig)||void 0===r?void 0:r.ugcFilterRules)||[],enablePolling:(null===(i=this.config)||void 0===i?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null===(s=this.config)||void 0===s?void 0:s.urlChangePollingInterval,captureDocumentTitle:null===(a=this.config)||void 0===a?void 0:a.captureDocumentTitle}),c.push(l)}catch(v){this.loggerProvider.warn("Failed to create URL tracking plugin:",v)}if(!(null===(u=null===e||void 0===e?void 0:e.console)||void 0===u?void 0:u.enabled))return[3,4];o.label=1;
1case 1:return o.trys.push([1,3,,4]),[4,Promise.all([n.e(9520),n.e(4492),n.e(2608)]).then(n.bind(n,26450))];case 2:return d=o.sent().getRecordConsolePlugin,c.push(d({level:e.console.levels})),[3,4];case 3:return f=o.sent(),this.loggerProvider.warn("Failed to load console plugin:",f),[3,4];case 4:return[2,c.length>0?c:void 0]}}))}))},e.prototype.getRecordFunction=function(){return(0,o.mG)(this,void 0,void 0,(function(){var e,t;return(0,o.Jh)(this,(function(r){switch(r.label){case 0:if(this.recordFunction)return[2,this.recordFunction];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.all([n.e(2802),n.e(4492),n.e(4848)]).then(n.bind(n,70309))];case 2:return e=r.sent().record,this.recordFunction=e,[2,e];case 3:return t=r.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,o.mG)(this,void 0,void 0,(function(){var t;return(0,o.Jh)(this,(function(n){switch(n.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,n.label=1;case 1:return n.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:n.sent(),n.label=3;case 3:return null===this.recordEventsPendingShouldLogMetadata?[3,5]:(t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)]);case 4:return n.sent(),[3,3];case 5:return[3,7];case 6:return this.recordEventsInFlight=!1,this.recordEventsPendingShouldLogMetadata=null,[7];case 7:return[2]}}
1))}))},e.prototype._recordEvents=function(e){var t,n,r,i,s,u,c,l;return void 0===e&&(e=!0),(0,o.mG)(this,void 0,void 0,(function(){var d,f,v,h,p,g,m,y,b,w,I,E,k,C,T,P,_,x,M,L=this;return(0,o.Jh)(this,(function(D){switch(D.label){case 0:return d=this.config,f=this.getShouldRecord(),v=null===(t=this.identifiers)||void 0===t?void 0:t.sessionId,f&&v&&d?(this.stopRecordingEvents(),[4,this.getRecordFunction()]):[2];case 1:return(h=D.sent())?[4,this.initializeNetworkObservers()]:[2];case 2:D.sent(),p=null===(n=d.loggingConfig)||void 0===n?void 0:n.network,g=Pe(d.serverZone,d.trackServerUrl),m=[R,O,A,g],null===(r=this.networkObservers)||void 0===r||r.start((function(e){m.some((function(t){return e.url.startsWith(t)}))||L.addCustomRRWebEvent(S.FETCH_REQUEST,e)}),p),y=d.interactionConfig,b=d.loggingConfig,w=(null===y||void 0===y?void 0:y.enabled)?{mouseInteraction:this.eventsManager&&(null===(i=this.clickHandler)||void 0===i?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:v,deviceIdFn:this.getDeviceId.bind(this),mirror:h.mirror,ugcFilterRules:null!==(s=y.ugcFilterRules)&&void 0!==s?s:[],performanceOptions:null===(u=d.performanceConfig)||void 0===u?void 0:u.interaction})),scroll:this.scrollHook}:{},I=(null===y||void 0===y?void 0:y.enabled)&&y.ugcFilterRules?y.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(v,".")),D.label=3;case 3:return D.trys.push([3,5,,6]),E=!!(null===(c=d.crossOriginIframes)||void 0===c?void 0:c.enabled),k=!1!==(null===(l=d.crossOriginIframes)||void 0===l?void 0:l.coordinateChildren),(C=E&&function(){try{var e=(0,a.l)();return!!e&&e.parent!==e}catch(t){return!0}}())&&k?(this.crossOriginParentSignalCleanup=function(e){var t=(0,a.l)();if(!t)return function(){};var n=t.parent;function r(t){if(t.source===n){var r=t.data;(null===r||void 0===r?void 0:r.type)===q&&("start"===r.action?e.onStart():"stop"===r.action&&e.onStop())}}return t.addEventListener("message",r),function(){return t.removeEventListener("message",r)}}({onStart:function(){return L._recordEventsInChildMode(h,v,d,w)},onStop:function(){try{L.recordCancelCallback&&L.recordCancelCallback(),L.recordCancelCallback=null}catch(t){var e=t;L.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),[2]):(T=this,P=h,_=[(0,o.pi)({},this.buildRRWebRecordOptions(d,w,(function(e){if(L.shouldOptOut())return L.loggerProvider.log("Opting session ".concat(v," out of recording due to optOut config.")),L.stopRecordingEvents(),void L.sendEvents();e.type===he.Meta&&(e.data.href=$(e.data.href,I)),L.eventCompressor?L.eventCompressor.enqueueEvent(e,v):L.pendingEmitEvents.push({event:e,sessionId:v})}),"Error while capturing replay: "))],M={},[4,this.getRecordingPlugins(b)]);case 4:return T.recordCancelCallback=P.apply(void 0,[o.pi.apply(void 0,_.concat([(M.plugins=D.sent(),M.recordCrossOriginIframes=E,M)]))]),E&&!C&&k&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new Gt),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(S.DEBUG_INFO),e&&this.addCustomRRWebEvent(S.METADATA,this.metadata),[3,6];case 5:return x=D.sent(),this.loggerProvider.warn("Failed to initialize session replay:",x),[3,6];case 6:return[2]}}
1))}))},e.prototype.buildRRWebRecordOptions=function(e,t,n,r){var i=this,s=e.privacyConfig;return(0,o.pi)((0,o.pi)({emit:n,inlineStylesheet:e.shouldInlineStylesheet,hooks:t,maskAllInputs:!0,maskTextClass:_,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements,maskInputFn:W("input",s,(function(){return i.currentPageUrl})),maskTextFn:W("text",s,(function(){return i.currentPageUrl})),maskAttributeFn:z(s,(function(){return i.currentPageUrl})),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){var t=e;if(t.message.includes("insertRule")&&t.message.includes("CSSStyleSheet"))throw t;if(t._external_)throw t;return i.loggerProvider.warn(r,t.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,n,r){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e((0,o.pi)((0,o.pi)({},this.buildRRWebRecordOptions(n,r,(function(){}),"Error while capturing replay (child iframe): ")),{recordCrossOriginIframes:!0})),this.loggerProvider.log("Session Replay child iframe capture beginning for session ".concat(t,"."))}catch(i){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",i)}},e.prototype.getDeviceId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(n){return[2,null===(t=this.eventsManager)||void 0===t?void 0:t.flush(e)]}))}))},e.prototype.shutdown=function(){var e,t;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this),null===(t=this.crossOriginParentSignalCleanup)||void 0===t||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,n,r,i,o,s){var a=(null===e||void 0===e?void 0:e.toString())?de(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,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,r;return(0,o.mG)(this,void 0,void 0,(function(){var i,s;return(0,o.Jh)(this,(function(o){switch(o.label){case 0:if(!(null===(r=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===r?void 0:r.enabled)||this.networkObservers)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.e(5509).then(n.bind(n,47256))];case 2:return i=o.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return s=o.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",s),[3,4];case 4:return[2]}}
1))}))},e}(),zt=function(e){return function(){var t=e.config||Y();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Kt=function(){var e=new Wt;return{init:c(e.init.bind(e),"init",zt(e)),evaluateTargetingAndCapture:c(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",zt(e)),setSessionId:c(e.setSessionId.bind(e),"setSessionId",zt(e)),getSessionId:c(e.getSessionId.bind(e),"getSessionId",zt(e)),getSessionReplayProperties:c(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",zt(e)),flush:c(e.flush.bind(e),"flush",zt(e)),shutdown:c(e.shutdown.bind(e),"shutdown",zt(e))}}(),Xt=Kt.init,Vt=Kt.setSessionId,$t=Kt.getSessionId,Zt=Kt.getSessionReplayProperties,Qt=Kt.flush,Yt=Kt.shutdown,en=Kt.evaluateTargetingAndCapture,tn=function(e){return void 0===e&&(e="$default_instance"),fe.V.getInstance(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"}(Jt||(Jt={})),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"}(Bt||(Bt={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(Ht||(Ht={}));var nn=[Jt.SET,Jt.SET_ONCE,Jt.ADD,Jt.APPEND,Jt.PREPEND,Jt.POSTINSERT],rn="1.31.0",on="".concat("[Amplitude]"," Session Replay ID"),sn=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:Qt,getSessionId:$t,getSessionReplayProperties:Zt,init:Xt,setSessionId:Vt,shutdown:Yt,evaluateTargetingAndCapture:en},this.options=(0,o.pi)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,s,a,u,c,l;return(0,o.mG)(this,void 0,void 0,(function(){var t,d,f;return(0,o.Jh)(this,(function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),null===e||void 0===e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(rn,".")),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,o.pi)((0,o.pi)({},e.defaultTracking),{sessions:!0})),t=tn(this.config.instanceName).identityStore,d=t.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!==(n=this.options.deviceId)&&void 0!==n?n: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===(r=this.config.remoteConfig)||void 0===r?void 0:r.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(i=this.options.privacyConfig)||void 0===i?void 0:i.blockSelector,maskSelector:null===(s=this.options.privacyConfig)||void 0===s?void 0:s.maskSelector,unmaskSelector:null===(a=this.options.privacyConfig)||void 0===a?void 0:a.unmaskSelector,defaultMaskLevel:null===(u=this.options.privacyConfig)||void 0===u?void 0:u.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:rn},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!==(c=this.options.useWebWorker)&&void 0!==c?c:null===(l=this.options.experimental)||void 0===l?void 0:l.useWebWorker,userProperties:d,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 v.sent(),[3,3];case 2:return f=v.sent(),null===e||void 0===e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(f.message)),[3,3];case 3:return[2]}}
1))}))},e.prototype.onSessionIdChanged=function(e){var t;return(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(n){switch(n.label){case 0:return null===(t=this.config)||void 0===t||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 n.sent(),[2]}}))}))},e.prototype.onOptOutChanged=function(e){var t;return(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(n){switch(n.label){case 0:return null===(t=this.config)||void 0===t||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),e?(this.sessionReplay.shutdown(),[3,4]):[3,1];case 1:return null!=this.config?[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise]:[3,3];case 2:n.sent(),n.label=3;case 3:n.label=4;case 4:return[2]}}))}))},e.prototype.execute=function(e){var t,n,r;return(0,o.mG)(this,void 0,void 0,(function(){var s,u,c,l,d;return(0,o.Jh)(this,(function(f){switch(f.label){case 0:return f.trys.push([0,9,,10]),this.options.customSessionId?(s=this.options.customSessionId(e))?s===this.sessionReplay.getSessionId()?[3,2]:[4,this.sessionReplay.setSessionId(s).promise]:[3,3]:[3,4];case 1:f.sent(),f.label=2;case 2:l=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,o.pi)((0,o.pi)({},e.event_properties),l),f.label=3;case 3:return[3,8];case 4:return(s=null===(t=this.config)||void 0===t?void 0:t.sessionId)&&s!==this.sessionReplay.getSessionId()?[4,this.sessionReplay.setSessionId(s).promise]:[3,6];case 5:f.sent(),f.label=6;case 6:return s&&s===e.session_id?(u=void 0,e.event_type===i.IDENTIFY&&(u=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach((function(n){if(nn.includes(n)){var r=e.user_properties&&e.user_properties[n];t=(0,o.pi)((0,o.pi)({},t),r)}})),t}}(e)),c=(0,a.l)(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:u,page:null!=(null===(n=null===c||void 0===c?void 0:c.location)||void 0===n?void 0:n.href)?{url:c.location.href}:void 0})]):[3,8];case 7:f.sent(),l=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,o.pi)((0,o.pi)({},e.event_properties),l),f.label=8;case 8:return e.event_type===i.IDENTIFY&&e.event_properties&&delete e.event_properties[on],[2,Promise.resolve(e)];case 9:return d=f.sent(),null===(r=this.config)||void 0===r||r.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(d.message)),[2,Promise.resolve(e)];case 10:return[2]}}
1))}))},e.prototype.teardown=function(){var e;return(0,o.mG)(this,void 0,void 0,(function(){return(0,o.Jh)(this,(function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(n){null===(e=this.config)||void 0===e||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(n.message))}return[2]}))}))},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),an=function(e){return new sn(e)}},6176:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});const r=n(30826),i=n(28192);t.default=function(e){let{html:t,height:n=null,width:o=null,children:s,dataNtpc:a=""}=e;return(0,i.useEffect)((()=>{a&&performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-".concat(a)}})}),[a]),(0,r.jsxs)(r.Fragment,{children:[s,t?(0,r.jsx)("div",{style:{height:null!=n?"".concat(n,"px"):"auto",width:null!=o?"".concat(o,"px"):"auto"},"data-ntpc":a,dangerouslySetInnerHTML:{__html:t}}):null]})}},29329:function(e,t,n){var r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendGAEvent=t.GoogleAnalytics=void 0;const i=n(30826),o=n(28192),s=r(n(40230));let a;t.GoogleAnalytics=function(e){const{gaId:t,dataLayerName:n="dataLayer"}=e;return void 0===a&&(a=n),(0,o.useEffect)((()=>{performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-ga"}})}),[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.default,{id:"_next-ga-init",dangerouslySetInnerHTML:{__html:"\n          window['".concat(n,"'] = window['").concat(n,"'] || [];\n          function gtag(){window['").concat(n,"'].push(arguments);}\n          gtag('js', new Date());\n\n          gtag('config', '").concat(t,"');")}}),(0,i.jsx)(s.default,{id:"_next-ga",src:"https://www.googletagmanager.com/gtag/js?id=".concat(t)})]})},t.sendGAEvent=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];void 0!==a?window[a]?window[a].push(arguments):console.warn("@next/third-parties: GA dataLayer ".concat(a," does not exist")):console.warn("@next/third-parties: GA has not been initialized")}},23988:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(30826),o=n(93174),s=r(n(6176));t.default=function(e){const{apiKey:t,...n}=e,r={...n,key:t},{html:a}=(0,o.GoogleMapsEmbed)(r);return(0,i.jsx)(s.default,{height:r.height||null,width:r.width||null,html:a,dataNtpc:"GoogleMapsEmbed"})}},90857:function(e,t,n){var r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendGTMEvent=t.GoogleTagManager=void 0;const i=n(30826),o=n(28192),s=r(n(40230));let a;t.GoogleTagManager=function(e){const{gtmId:t,dataLayerName:n="dataLayer",auth:r,preview:u,dataLayer:c}=e;void 0===a&&(a=n);const l="dataLayer"!==n?"&l=".concat(n):"",d=r?"&gtm_auth=".concat(r):"",f=u?"&gtm_preview=".concat(u,"&gtm_cookies_win=x"):"";return(0,o.useEffect)((()=>{performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-gtm"}})}),[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.default,{id:"_next-gtm-init",dangerouslySetInnerHTML:{__html:"\n      (function(w,l){\n        w[l]=w[l]||[];\n        w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});\n        ".concat(c?"w[l].push(".concat(JSON.stringify(c),")"):"","\n      })(window,'").concat(n,"');")}}),(0,i.jsx)(s.default,{id:"_next-gtm","data-ntpc":"GTM",src:"https://www.googletagmanager.com/gtm.js?id=".concat(t).concat(l).concat(d).concat(f)})]})};t.sendGTMEvent=e=>{void 0!==a?window[a]?window[a].push(e):console.warn("@next/third-parties: GTM dataLayer ".concat(a," does not exist")):console.warn("@next/third-parties: GTM has not been initialized")}},31842:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendGAEvent=t.GoogleAnalytics=t.sendGTMEvent=t.GoogleTagManager=t.YouTubeEmbed=t.GoogleMapsEmbed=void 0;var i=n(23988);Object.defineProperty(t,"GoogleMapsEmbed",{enumerable:!0,get:function(){return r(i).default}});var o=n(63062);Object.defineProperty(t,"YouTubeEmbed",{enumerable:!0,get:function(){return r(o).default}});var s=n(90857);Object.defineProperty(t,"GoogleTagManager",{enumerable:!0,get:function(){return s.GoogleTagManager}}),Object.defineProperty(t,"sendGTMEvent",{enumerable:!0,get:function(){return s.sendGTMEvent}});var a=n(29329);Object.defineProperty(t,"GoogleAnalytics",{enumerable:!0,get:function(){return a.GoogleAnalytics}}),Object.defineProperty(t,"sendGAEvent",{enumerable:!0,get:function(){return a.sendGAEvent}})},63062:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esMo
1dule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(30826),o=r(n(40230)),s=n(93174),a=r(n(6176)),u={server:"beforeInteractive",client:"afterInteractive",idle:"lazyOnload",worker:"worker"};t.default=function(e){const{html:t,scripts:n,stylesheets:r}=(0,s.YouTubeEmbed)(e);return(0,i.jsx)(a.default,{height:e.height||null,width:e.width||null,html:t,dataNtpc:"YouTubeEmbed",children:null===n||void 0===n?void 0:n.map((e=>(0,i.jsx)(o.default,{src:e.url,strategy:u[e.strategy],stylesheets:r},e.url)))})}},79953:function(e,t,n){n.d(t,{default:function(){return i.a}});var r=n(32527),i=n.n(r)},85021:function(e,t,n){var r=n(38871);n.o(r,"useParams")&&n.d(t,{useParams:function(){return r.useParams}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},40230:function(e,t,n){n.r(t),n.d(t,{default:function(){return i.a}});var r=n(89626),i=n.n(r),o={};for(var s in r)"default"!==s&&(o[s]=function(e){return r[e]}.bind(0,s));n.d(t,o)},45272:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DOMAttributeNames:function(){return n},default:function(){return s},isEqualNode:function(){return i}});const n={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv",noModule:"noModule"};function r(e){let{type:t,props:r}=e;const i=document.createElement(t);for(const a in r){if(!r.hasOwnProperty(a))continue;if("children"===a||"dangerouslySetInnerHTML"===a)continue;if(void 0===r[a])continue;const e=n[a]||a.toLowerCase();"script"!==t||"async"!==e&&"defer"!==e&&"noModule"!==e?i.setAttribute(e,r[a]):i[e]=!!r[a]}const{children:o,dangerouslySetInnerHTML:s}=r;return s?i.innerHTML=s.__html||"":o&&(i.textContent="string"===typeof o?o:Array.isArray(o)?o.join(""):""),i}function i(e,t){if(e instanceof HTMLElement&&t instanceof HTMLElement){const n=t.getAttribute("nonce");if(n&&!e.getAttribute("nonce")){const r=t.cloneNode(!0);return r.setAttribute("nonce",""),r.nonce=n,n===e.nonce&&e.isEqualNode(r)}}return e.isEqualNode(t)}let o;function s(){return{mountedInstances:new Set,updateHead:e=>{const t={};e.forEach((e=>{if("link"===e.type&&e.props["data-optimized-fonts"]){if(document.querySelector('style[data-href="'+e.props["data-href"]+'"]'))return;e.props.href=e.props["data-href"],e.props["data-href"]=void 0}const n=t[e.type]||[];n.push(e),t[e.type]=n}));const n=t.title?t.title[0]:null;let r="";if(n){const{children:e}=n.props;r="string"===typeof e?e:Array.isArray(e)?e.join(""):""}r!==document.title&&(document.title=r),["meta","base","link","style","script"].forEach((e=>{o(e,t[e]||[])}))}}}o=(e,t)=>{const n=document.getElementsByTagName("head")[0],o=n.querySelector("meta[name=next-head-count]");const s=Number(o.content),a=[];for(let r=0,i=o.previousElementSibling;r<s;r++,i=(null==i?void 0:i.previousElementSibling)||null){var u;(null==i||null==(u=i.tagName)?void 0:u.toLowerCase())===e&&a.push(i)}const c=t.map(r).filter((e=>{for(let t=0,n=a.length;t<n;t++){if(i(a[t],e))return a.splice(t,1),!1}return!0}));a.forEach((e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)})),c.forEach((e=>n.insertBefore(e,o))),o.content=(s-a.length+c.length).toString()},("function"===typeof t.default||"object"===typeof t.default&&null!==t.default)&&"undefined"===typeof t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},89626:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return y},handleClientScriptLoad:function(){return p},initScriptLoader:function(){return g}});const r=n(56878),i=n(19818),o=n(30826),s=r._(n(53265)),a=i._(n(28192)),u=n(48538),c=n(45272),l=n(99131),d=new Map,f=new Set,v=["onLoad","onReady","dangerouslySetInnerHTML","children","onError","strategy","stylesheets"],h=e=>{const{src:t,id:n,onLoad:r=(()=>{}),onReady:i=null,dangerouslySetInnerHTML:o,children:a="",strategy:u="afterInteractive",onError:l,stylesheets:h}=e,p=n||t;if(p&&f.has(p))return;if(d.has(t))return f.add(p),void d.get(t).then(r,l);const g=()=>{i&&i(),f.add(p)},m=document.createElement("script"),y=new Promise(((e,t)=>{m.addEventListener("load",(function(t){e(),r&&r.call(this,t),g()})),m.addEventListener("error",(function(e){t(e)}))})).catch((function(e){l&&l(e)}
1));o?(m.innerHTML=o.__html||"",g()):a?(m.textContent="string"===typeof a?a:Array.isArray(a)?a.join(""):"",g()):t&&(m.src=t,d.set(t,y));for(const[s,d]of Object.entries(e)){if(void 0===d||v.includes(s))continue;const e=c.DOMAttributeNames[s]||s.toLowerCase();m.setAttribute(e,d)}"worker"===u&&m.setAttribute("type","text/partytown"),m.setAttribute("data-nscript",u),h&&(e=>{if(s.default.preinit)e.forEach((e=>{s.default.preinit(e,{as:"style"})}));else if("undefined"!==typeof window){let t=document.head;e.forEach((e=>{let n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.appendChild(n)}))}})(h),document.body.appendChild(m)};function p(e){const{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",(()=>{(0,l.requestIdleCallback)((()=>h(e)))})):h(e)}function g(e){e.forEach(p),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach((e=>{const t=e.id||e.getAttribute("src");f.add(t)}))}function m(e){const{id:t,src:n="",onLoad:r=(()=>{}),onReady:i=null,strategy:c="afterInteractive",onError:d,stylesheets:v,...p}=e,{updateScripts:g,scripts:m,getIsSsr:y,appDir:b,nonce:w}=(0,a.useContext)(u.HeadManagerContext),S=(0,a.useRef)(!1);(0,a.useEffect)((()=>{const e=t||n;S.current||(i&&e&&f.has(e)&&i(),S.current=!0)}),[i,t,n]);const I=(0,a.useRef)(!1);if((0,a.useEffect)((()=>{I.current||("afterInteractive"===c?h(e):"lazyOnload"===c&&function(e){"complete"===document.readyState?(0,l.requestIdleCallback)((()=>h(e))):window.addEventListener("load",(()=>{(0,l.requestIdleCallback)((()=>h(e)))}))}(e),I.current=!0)}),[e,c]),"beforeInteractive"!==c&&"worker"!==c||(g?(m[c]=(m[c]||[]).concat([{id:t,src:n,onLoad:r,onReady:i,onError:d,...p}]),g(m)):y&&y()?f.add(t||n):y&&!y()&&h(e)),b){if(v&&v.forEach((e=>{s.default.preinit(e,{as:"style"})})),"beforeInteractive"===c)return n?(s.default.preload(n,p.integrity?{as:"script",integrity:p.integrity,nonce:w,crossOrigin:p.crossOrigin}:{as:"script",nonce:w,crossOrigin:p.crossOrigin}),(0,o.jsx)("script",{nonce:w,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([n,{...p,id:t}])+")"}})):(p.dangerouslySetInnerHTML&&(p.children=p.dangerouslySetInnerHTML.__html,delete p.dangerouslySetInnerHTML),(0,o.jsx)("script",{nonce:w,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([0,{...p,id:t}])+")"}}));"afterInteractive"===c&&n&&s.default.preload(n,p.integrity?{as:"script",integrity:p.integrity,nonce:w,crossOrigin:p.crossOrigin}:{as:"script",nonce:w,crossOrigin:p.crossOrigin})}return null}Object.defineProperty(m,"__nextScript",{value:!0});const y=m;("function"===typeof t.default||"object"===typeof t.default&&null!==t.default)&&"undefined"===typeof t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},93174:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeEmbed=t.GoogleMapsEmbed=t.GoogleAnalytics=void 0;var r=n(5269);Object.defineProperty(t,"GoogleAnalytics",{enumerable:!0,get:function(){return r.GoogleAnalytics}});var i=n(52839);Object.defineProperty(t,"GoogleMapsEmbed",{enumerable:!0,get:function(){return i.GoogleMapsEmbed}});var o=n(71360);Object.defineProperty(t,"YouTubeEmbed",{enumerable:!0,get:function(){return o.YouTubeEmbed}})},5269:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleAnalytics=void 0;const o=i(n(68063)),s=n(9721);t.GoogleAnalytics=e=>{var t=r(e,[]);return(0,s.formatData)(o.default,t)}},52839:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}
1,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleMapsEmbed=void 0;const o=i(n(76596)),s=n(9721);t.GoogleMapsEmbed=e=>{var t=r(e,[]);return(0,s.formatData)(o.default,t)}},71360:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeEmbed=void 0;const o=i(n(4424)),s=n(9721);t.YouTubeEmbed=e=>{var t=r(e,[]);return(0,s.formatData)(o.default,t)}},9721:function(e,t){function n(e,t,n=!1){return t?Object.keys(e).filter((e=>n?!t.includes(e):t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):{}}function r(e,t,n,r){const i=r&&Object.keys(r).length>0?new URL(Object.values(r)[0],e):new URL(e);return t&&n&&t.forEach((e=>{n[e]&&i.searchParams.set(e,n[e])})),i.toString()}function i(e,t,n,i,o){var s;if(!t)return`<${e}></${e}>`;const a=(null===(s=t.src)||void 0===s?void 0:s.url)?Object.assign(Object.assign({},t),{src:r(t.src.url,t.src.params,i,o)}):t;return`<${e}${Object.keys(Object.assign(Object.assign({},a),n)).reduce(((e,t)=>{const r=null===n||void 0===n?void 0:n[t],i=a[t],o=null!==r&&void 0!==r?r:i;return o?e+` ${!0===o?t:`${t}="${o}"`}`:e}),"")}></${e}>`}Object.defineProperty(t,"__esModule",{value:!0}),t.formatData=t.createHtml=t.formatUrl=void 0,t.formatUrl=r,t.createHtml=i,t.formatData=function(e,t){var o,s,a,u,c;const l=n(t,null===(o=e.scripts)||void 0===o?void 0:o.reduce(((e,t)=>[...e,...Array.isArray(t.params)?t.params:[]]),[])),d=n(t,null===(a=null===(s=e.html)||void 0===s?void 0:s.attributes.src)||void 0===a?void 0:a.params),f=n(t,[null===(c=null===(u=e.html)||void 0===u?void 0:u.attributes.src)||void 0===c?void 0:c.slugParam]),v=n(t,[...Object.keys(l),...Object.keys(d),...Object.keys(f)],!0);return Object.assign(Object.assign({},e),{html:e.html?i(e.html.element,e.html.attributes,v,d,f):null,scripts:e.scripts?e.scripts.map((e=>Object.assign(Object.assign({},e),{url:r(e.url,e.params,l)}))):null})}},39096:function(e,t,n){n.d(t,{X3:function(){return p}});const r=(e,t)=>t.some((t=>e instanceof t));let i,o;const s=new WeakMap,a=new WeakMap,u=new WeakMap;let c={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return s.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return v(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function l(e){c=e(c)}function d(e){return(o||(o=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(h(this),t),v(this.request)}:function(...t){return v(e.apply(h(this),t))}}function f(e){return"function"===typeof e?d(e):(e instanceof IDBTransaction&&function(e){if(s.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)}));s.set(e,t)}(e),r(e,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,c):e)}function v(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(v(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}));return u.set(t,e),t}(e);if(a.has(e))return a.get(e);const t=f(e);return t!==e&&(a.set(e,t),u.set(t,e)),t}const h=e=>u.get(e);function p(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=v(s);return r&&s.addEventListener("upgradeneeded",(e=>{r(v(s.result),e.oldVersion,e.newVersion,v(s.transaction),e)})),n&&s.addEventListener("blocked",(e=>n(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}const g=["get","getKey","getAll","getAllKeys","count"],m=["put","add","delete","clear"],y=new Map;function b(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(y.get(t))return y.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=m.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!g.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;
1return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return y.set(t,o),o}l((e=>({...e,get:(t,n,r)=>b(t,n)||e.get(t,n,r),has:(t,n)=>!!b(t,n)||e.has(t,n)})));const w=["continue","continuePrimaryKey","advance"],S={},I=new WeakMap,E=new WeakMap,k={get(e,t){if(!w.includes(t))return e[t];let n=S[t];return n||(n=S[t]=function(...e){I.set(this,E.get(this)[t](...e))}),n}};async function*C(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,k);for(E.set(n,t),u.set(n,h(t));t;)yield n,t=await(I.get(n)||t.continue()),I.delete(n)}function T(e,t){return t===Symbol.asyncIterator&&r(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&r(e,[IDBIndex,IDBObjectStore])}l((e=>({...e,get:(t,n,r)=>T(t,n)?C:e.get(t,n,r),has:(t,n)=>T(t,n)||e.has(t,n)})))},69802:function(e,t,n){n.d(t,{CR:function(){return l},FC:function(){return v},Jh:function(){return u},KL:function(){return h},XA:function(){return c},ZT:function(){return i},_T:function(){return s},ev:function(){return d},mG:function(){return a},pi:function(){return o},qq:function(){return f}});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function i(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(t){o(t)}}function a(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"===typeof Iterator?Iterator:Object).prototype);return s.next=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){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(u){a=[6,u],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function c(e){var t="function"===typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"===typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(a){i={error:a}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function f(e){return this instanceof f?(this.v=e,this):new f(e)}function v(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"===typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=i[e](t)).value instanceof f?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(r){l(o[0][3],r)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=c(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}Object.create;"function"===typeof SuppressedError&&SuppressedError},68063:function(e){e.exports=JSON.parse('{"id":"google-analytics","description":"Install a Google Analytics tag on your website","website":"https://analytics.google.com/analytics/web/","scripts":[{"url":"https://www.googletagmanager.com/gtag/js","params":["id"],"strategy":"worker","location":"head","action":"append"},{"code":"window.dataLayer=window.dataLayer||[];window.gtag=function gtag(){window.dataLayer.push(arguments);};gtag(\'js\',new Date());gtag(\'config\',\'${args.id}\')","strategy":"worker","location":"head","action":"append"}]}')},76596:function(e){e.exports=JSON.parse('{"id":"google-maps-embed","description":"Embed a Google Maps embed on your webpage","website":"https://developers.google.com/maps/documentation/embed/get-started","html":{"element":"iframe","attributes":{"loading":"lazy","src":{"url":"https://www.google.com/maps/embed/v1/place","slugParam":"mode","params":["key","q","center","zoom","maptype","language","regi
1on"]},"referrerpolicy":"no-referrer-when-downgrade","frameborder":"0","style":"border:0","allowfullscreen":true,"width":null,"height":null}}}')},4424:function(e){e.exports=JSON.parse('{"id":"youtube-embed","description":"Embed a YouTube embed on your webpage.","website":"https://github.com/paulirish/lite-youtube-embed","html":{"element":"lite-youtube","attributes":{"videoid":null,"playlabel":null}},"stylesheets":["https://cdn.jsdelivr.net/gh/paulirish/lite-youtube-embed@master/src/lite-yt-embed.css"],"scripts":[{"url":"https://cdn.jsdelivr.net/gh/paulirish/lite-youtube-embed@master/src/lite-yt-embed.js","strategy":"idle","location":"head","action":"append"}]}')}}]);

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.