1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7125],{13492:(e,t)=>{"use strict";t.Observable=void 0;let n=e=>!!Symbol[e],r=e=>n(e)?Symbol[e]:"@@"+e,i=r("iterator"),o=r("observable"),s=r("species");function a(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw TypeError(n+" is not a function");return n}}function u(e){let t=e.constructor;return void 0!==t&&null===(t=t[s])&&(t=void 0),void 0!==t?t:g}function l(e){l.log?l.log(e):setTimeout(()=>{throw e})}function c(e){Promise.resolve().then(()=>{try{e()}catch(e){l(e)}})}function d(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=a(t,"unsubscribe");e&&e.call(t)}}catch(e){l(e)}}function f(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function h(e,t,n){e._state="running";let r=e._observer;try{let i=a(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(f(e),i)i.call(r,n);else throw n;break;case"complete":f(e),i&&i.call(r)}}catch(e){l(e)}"closed"===e._state?d(e):"running"===e._state&&(e._state="ready")}function p(e,t,n){if("closed"!==e._state){if("buffering"===e._state)return void e._queue.push({type:t,value:n});if("ready"!==e._state){e._state="buffering",e._queue=[{type:t,value:n}],c(()=>(function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(h(e,t[n].type,t[n].value),"closed"!==e._state);++n);}})(e));return}h(e,t,n)}}class v{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){p(n,"next",e)},error(e){p(n,"error",e)},complete(){p(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(f(this),d(this))}}class g{constructor(e){if(!(this instanceof g))throw TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new v(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=u(this),n=arguments.length>1,r=!1,i=arguments[1],o=i;return new t(t=>this.subscribe({next(i){let s=!r;if(r=!0,!s||n)try{o=e(o,i)}catch(e){return t.error(e)}else o=i},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=u(this);return new t(n=>{let r,i=0;return!function o(s){r=s.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=u(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let s=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(s);e>=0&&r.splice(e,1),o()}});r.push(s)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[o](){return this}static from(e){let t="function"==typeof this?this:g;if(null==e)throw TypeError(e+" is not an object");let r=a(e,o);if(r){let n=r.call(e);
1if(Object(n)!==n)throw TypeError(n+" is not an object");return n instanceof g&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(n("iterator")&&(r=a(e,i)))return new t(t=>{c(()=>{if(!t.closed){for(let n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{c(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:g)(t=>{c(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[s](){return this}}t.Observable=g,Object.defineProperty(g,Symbol("extensions"),{value:{symbol:o,hostReportError:l},configurable:!0})},27125:(e,t,n)=>{"use strict";let r,i,o,s,a,u;n.d(t,{Q:()=>lx});var l,c,d,f,h,p,v,g,m,y,b,w,S,k,E,C,I,x,_,T,P,O,A,R,M,D,L,H,N,U,F,j,q,z,Y,B,V,J,K,W,X,$,G,Q,Z,ee,et,en,er,ei,eo,es,ea,eu,el,ec,ed,ef,eh,ep,ev,eg,em,ey,eb=n(29024),ew=function(e){return{promise:e||Promise.resolve()}},eS=n(92487),ek="Amplitude Logger ",eE=function(){function e(){this.logLevel=eS.$.None}return e.prototype.disable=function(){this.logLevel=eS.$.None},e.prototype.enable=function(e){void 0===e&&(e=eS.$.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<eS.$.Verbose||console.log("".concat(ek,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<eS.$.Warn||console.warn("".concat(ek,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<eS.$.Error||console.error("".concat(ek,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<eS.$.Debug||console.log("".concat(ek,"[Debug]: ").concat(e.join(" ")))},e}(),eC=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var 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(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),eI=n(37187),ex=(0,eb.fX)([],(0,eb.zs)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),e_=function(e){var t,n=(0,eI.m)();if(!(null==(t=null==n?void 0:n.crypto)?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,e_);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,eb.fX)([],(0,eb.zs)(r.entries()),!1).map(function(e){var t=(0,eb.zs)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(ex[r]):ex[r]}).join("")},eT=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!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 eC(e,t)}return e.prototype.subscribe=function(e,t,n){var r=e_(),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,eb.sH)(this,void 0,void 0,function(){var e,t=this;return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5)return this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2];return[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;
1return this.fetchPromise||(this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null})):this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null})),this.fetchPromise},e.prototype.subscribeAll=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),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,eb.sH)(this,void 0,void 0,function(){var n,r;return(0,eb.YH)(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]}})})},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,eb.sH)(this,void 0,void 0,function(){var n,r,i,o,s,a,u=this;return(0,eb.YH)(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,l,c,d;return(0,eb.YH)(this,function(f){switch(f.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),f.label=1;case 1:return f.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:s.signal})];case 2:if((l=f.sent()).ok)return[3,4];return[4,l.text()];case 3:return c=f.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(c)),401===l.status||403===l.status?(o.logger.error("Remote config client fetch failed with ".concat(l.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&429!==l.status&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:f.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=f.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(a),[7];case 9:if(!i)return[2,"break"];if(!(r<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(n))})];case 10:f.sent(),f.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];if("break"===a)return[3,4];l.label=3;case 3:return s++,[3,1];case 4:return[2,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}(),eP="tags",eO="counters",eA="histograms",eR="events",eM="internal",eD="last_flush_timestamp",eL=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return(null==(e=(0,eI.m)())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(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(eP)||e.createObjectStore(eP,{keyPath:"key"}),e.objectStoreNames.contains(eO)||e.createObjectStore(eO,{keyPath:"key"}),e.objectStoreNames.contains(eA)||e.createObjectStore(eA,{keyPath:"key"}),e.objectStoreNames.contains(eR)||e.createObjectStore(eR,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(eM)||e.createObjectStore(eM,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([eP],"readwrite")).objectStore(eP),[2,new Promise(function(r){var o=Object.entries(e);t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tags",e),r()},o.forEach(function(e){var t=(0,eb.zs)(e,2),r=t[0],o=t[1];n.put({key:r,value:o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tag",r,o,e)}})})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",r),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([eO],"readwrite")).objectStore(eO),[2,new Promise(function(r){var o=Object.entries(e);t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to increment counters",e),r()},o.forEach(function(e){var t=(0,eb.zs)(e,2),r=t[0],o=t[1],s=n.get(r);s.onsuccess=function(){var e=s.result,t=e?e.value:0;n.put({key:r,value:t+o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to update counter",r,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing counter",r,e)}})})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",r),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([eA],"readwrite")).objectStore(eA),[2,new Promise(function(r){var o=Object.entries(e);t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),r()},o.forEach(function(e){var t=(0,eb.zs)(e,2),r=t[0],o=t[1],s=n.get(r);s.onsuccess=function(){var e,t=s.result;e=t?{key:r,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:r,count:o.count,min:o.min,max:o.max,sum:o.sum},n.put(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",r,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",r,e)}})})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",r),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===e.length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([eR],"readwrite")).objectStore(eR),[2,new Promise(function(r){t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event records",e),r()};var o=n.count();o.onsuccess=function(){var t=Math.max(0,10-o.result);t<e.length&&i.logger.debug("DiagnosticsStorage: Only added ".concat(t," of ").concat(e.length," events due to storage limit")),e.slice(0,t).forEach(function(e){n.add(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},o.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",r),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return(0,eb.sH)(this,void 0,void 0,function(){var n,r,i;return(0,eb.YH)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=(n=o.sent().transaction([eM],"readwrite")).objectStore(eM),[2,new Promise(function(i,o){n.onabort=function(){return o(Error("Failed to set internal value"))};var s=r.put({key:e,value:t});s.onsuccess=function(){return i()},s.onerror=function(){return o(Error("Failed to set internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",i),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=(t=i.sent().transaction([eM],"readonly")).objectStore(eM),[2,new Promise(function(r,i){t.onabort=function(){return i(Error("Failed to get internal value"))};var o=n.get(e);o.onsuccess=function(){return r(o.result)},o.onerror=function(){return i(Error("Failed to get internal value"))}})];case 2:return r=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",r),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(eD)];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]}})})},e.prototype.setLastFlushTimestamp=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(eD,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(Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=a.sent().transaction([eP,eO,eA,eR],"readwrite"),[4,Promise.all([this.getAllFromStore(e,eP),this.getAllFromStore(e,eO),this.getAllFromStore(e,eA),this.getAllFromStore(e,eR)])];case 2:return n=(t=eb.zs.apply(void 0,[a.sent(),4]))[0],r=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,eO),this.clearTable(e,eA),this.clearTable(e,eR)])];case 3:return a.sent(),[2,{tags:n,counters:r,histogramStats:i,events:o}];case 4:return s=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(Error("Failed to get all from ".concat(t)))}})},e}(),eH=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)|0;return t}
1,eN=function(e,t){return 31*Math.abs(eH(e.toString()))%1e5/1e5<t},eU=function(){var e=(0,eI.m)();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},eF=function(e){var t=(0,eI.m)();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",(0,eb.Cl)({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=ej({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=eq(i),s=ej({filename:o,stack:i});s&&n({type:"unhandledrejection",message:null!=(t=null==r?void 0:r.message)?t:ez(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},ej=function(e){var t,n,r=eU();if(0!==r.length)try{for(var i=(0,eb.Ju)(r),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},eq=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},ez=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},eY=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,eb.Cl)({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=eN(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,eL.isSupported()?this.storage=new eL(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),eF(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(void 0===t&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");var 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){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=10)return void this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},3e5))},e.prototype.saveAllDataToStorage=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t,n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,eb.Cl)({},this.inMemoryTags),t=(0,eb.Cl)({},this.inMemoryCounters),n=(0,eb.Cl)({},this.inMemoryHistograms),r=(0,eb.fX)([],(0,eb.zs)(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,l;return(0,eb.YH)(this,function(c){switch(c.label){case 0:if(!this.storage)return[2];return[4,this.saveAllDataToStorage()];case 1:return c.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:if(t=(e=c.sent()).tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={}
1,n.forEach(function(e){s[e.key]=e.value}),a={},r.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),u=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===u.length)return[2];return l={tags:o,histogram:a,counters:s,events:u},this.fetch(l),[2]}})})},e.prototype.fetch=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!(0,eI.m)())throw Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:if(!n.sent().ok)return this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2];return this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t,n;return(0,eb.YH)(this,function(r){switch(r.label){case 0:if(!this.storage)return[2];return e=Date.now(),[4,this.storage.getLastFlushTimestamp()];case 1:if(-1===(t=r.sent()||-1))return this.storage.setLastFlushTimestamp(e),this._setFlushTimer(3e5),[2];return(n=e-t)>=3e5?this._flush():this._setFlushTimer(3e5-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=eN(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),eB=function(){var e,t=(0,eI.m)();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=eV(n[0]),i=eV(n[1]);return i&&(e[r]=i),e},{}):{}},eV=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},eJ=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:eK(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),eK=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},eW=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}(),eX=function(){return(eX=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}).apply(this,arguments)};function e$(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function eG(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var eQ=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=e$(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;
1if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),u=Array.isArray(t);if(a!==u)return!1;if(a&&u){for(var l=0;l<e.length;l++)if(!eQ(e[l],t[l]))return!1}else{if(!eQ(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(n){eQ(e[n],t[n])||(c=!1)}),c}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var eZ=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=eX({},this.identity.userProperties),n=eX(eX({},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,a,u=n.userProperties||{};try{for(var l=e$(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=eG(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,e$(Object.entries(h))),v=p.next();!v.done;v=p.next()){var g=eG(v.value,2),m=g[0],y=g[1];u[m]=y}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,e$(Object.keys(h))),w=b.next();!w.done;w=b.next()){var m=w.value;delete u[m]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return n.userProperties=u,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return eX({},this.identity)},e.prototype.setIdentity=function(e){var t=eX({},this.identity);this.identity=eX({},e),eQ(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}(),e0="u">typeof globalThis?globalThis:void 0!==n.g?n.g:self,e1=function(){function e(){this.identityStore=new eZ,this.eventBridge=new eW,this.applicationContextProvider=new eJ}return e.getInstance=function(t){return e0.analyticsConnectorInstances||(e0.analyticsConnectorInstances={}),e0.analyticsConnectorInstances[t]||(e0.analyticsConnectorInstances[t]=new e),e0.analyticsConnectorInstances[t]},e}(),e2="".concat("AMP","_unsent"),e3="$default_instance",e4="https://api2.amplitude.com/2/httpapi",e6="https://api.eu.amplitude.com/2/httpapi",e5="https://api2.amplitude.com/batch",e8="https://api.eu.amplitude.com/batch",e7="dclid",e9="fbclid",te="gbraid",tt="gclid",tn="ko_click_id",tr="li_fat_id",ti="msclkid",to="rdt_cid",ts="ttclid",ta="twclid",tu="wbraid",tl={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},tc=["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"],td=["authorization","cookie","set-cookie"],tf=function(e){return void 0===e&&(e=e3),e1.getInstance(e)},th=function(e,t){tf(t).identityStore.editIdentity().setUserId(e).commit()},tp=function(e,t){tf(t).identityStore.editIdentity().setDeviceId(e).commit()};(l=W||(W={})).Unknown="unknown",l.Skipped="skipped",l.Success="success",l.RateLimit="rate_limit",l.PayloadTooLarge="payload_too_large",l.Invalid="invalid",l.Failed="failed",l.Timeout="Timeout",l.SystemError="SystemError";var tv=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},[])},tg=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=W.Unknown),{event:e,code:t,message:n}},tm=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:e3,logLevel:eS.$.Warn,loggerProvider:new eE,offline:!1,optOut:!1,serverUrl:e4,serverZone:"US",useBatch:!1}},ty=function(){function e(e){this._optOut=!1;var t,n,r,i,o=tm();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!=(n=e.logLevel)?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)?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)?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=tb(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e}
1,enumerable:!1,configurable:!0}),e}(),tb=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=tm().serverZone),void 0===n&&(n=tm().useBatch),e)return{serverUrl:e,serverZone:void 0};var r,i=["US","EU"].includes(t)?t:tm().serverZone;return{serverZone:i,serverUrl:(r=n,"EU"===i?r?e8:e6:r?e5:e4)}},tw=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function tS(e){return e>=200&&e<300}var tk=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},tE=function(e){return function(){var t=(0,eb.Cl)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},tC=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,eb.Ju)(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},tI=function(e,t){return function(){var n,r,i={};try{for(var o=(0,eb.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=tC(e,a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},tx=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=n(),u=a.logger,l=a.logLevel;if(l&&l<eS.$.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:tk(1),time:{start:new Date().toISOString()},states:{}};r&&c.states&&(c.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))}):(r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))),d}},t_=new Set([e4,e6,e5,e8]);function tT(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var tP=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return(0,eb.sH)(this,void 0,void 0,function(){var n,r=this;return(0,eb.YH)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(e2,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=e_()),new Promise(function(n){t.queue.push({event:e,attempts:0,callback:function(e){return n(e)},timeout:0}),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,eb.sH)(this,void 0,void 0,function(){var t,n,r=this;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if(this.config.offline)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2];if(this.flushId)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2];return this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),[4,tv(t,this.config.flushQueueSize).reduce(function(t,n){return(0,eb.sH)(r,void 0,void 0,function(){return(0,eb.YH)(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 i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),(0,eb.sH)(this,void 0,void 0,function(){var r,i,o,s,a;return(0,eb.YH)(this,function(u){var l,c,d;switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,eb.Tt)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new tw,u.label=1;case 1:return u.trys.push([1,3,,4]),l=i=tb(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(c=this.config.enableRequestBodyCompression)&&(c=!1),o=!!t_.has(l)||c,[4,this.config.transportProvider.send(i,r,o)];case 2:if(null===(s=u.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(tT(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:return a=(d=u.sent())instanceof Error?d.message:String(d),this.config.loggerProvider.error(a),null==(n=this.diagnosticsClient)||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:a,stack_trace:tk()}),this.handleResponse({status:W.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){tS(e.statusCode)||null==(n=this.diagnosticsClient)||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:tT(e),stack_trace:tk()});var n,r=e.status;switch(r){case W.Success:this.handleSuccessResponse(e,t);break;case W.Invalid:this.handleInvalidResponse(e,t);break;case W.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case W.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' 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"))return void this.fulfillRequest(t,e.statusCode,e.body.error);var r=new Set((0,eb.fX)((0,eb.fX)((0,eb.fX)((0,eb.fX)([],(0,eb.zs)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,eb.zs)(Object.values(e.body.eventsWithMissingFields)),!1),(0,eb.zs)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,eb.zs)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){return!r.has(i)||void n.fulfillRequest([t],e.statusCode,e.body.error)});i.length>0&&this.config.loggerProvider.warn(tT(e));
1var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(tT(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)},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),l=t.filter(function(t,r){return t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)?void n.fulfillRequest([t],e.statusCode,e.body.error):(u.has(r)&&(t.timeout=n.throttleTimeout),!0)});l.length>0&&this.config.loggerProvider.warn(tT(e));var c=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(c)},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){var r,i,o;tS(t)?null==(o=this.diagnosticsClient)||o.increment("analytics.events.sent",e.length):(null==(r=this.diagnosticsClient)||r.increment("analytics.events.dropped",e.length),null==(i=this.diagnosticsClient)||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:tk()})),this.removeEvents(e),e.forEach(function(e){return e.callback(tg(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}(),tO=function(){function e(){this.name="identity",this.type="before",this.identityStore=tf().identityStore}return e.prototype.execute=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return e.instanceName&&(this.identityStore=tf(e.instanceName).identityStore),[2]})})},e}(),tA=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!tR(t,n))return!1}return!0},tR=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,eb.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&tA(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else if(null==t)return!1;else if("object"==typeof t)return tA(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},tM=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,eb.Cl)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(X.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(X.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(X.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(X.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(X.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(X.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(X.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(X.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(X.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[X.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return!(void 0!==this._properties[X.CLEAR_ALL]||this._propertySet.has(t))&&(e===X.ADD?"number"==typeof n:e===X.UNSET||e===X.REMOVE||tR(t,n))},e}();(c=X||(X={})).SET="$set",c.SET_ONCE="$setOnce",c.ADD="$add",c.APPEND="$append",c.PREPEND="$prepend",c.REMOVE="$remove",c.PREINSERT="$preInsert",c.POSTINSERT="$postInsert",c.UNSET="$unset",c.CLEAR_ALL="$clearAll";var tD=[X.CLEAR_ALL,X.UNSET,X.SET,X.SET_ONCE,X.ADD,X.APPEND,X.PREPEND,X.PREINSERT,X.POSTINSERT,X.REMOVE];(d=$||($={})).SET="$set",d.SET_ONCE="$setOnce",d.ADD="$add",d.APPEND="$append",d.PREPEND="$prepend",d.REMOVE="$remove",d.PREINSERT="$preInsert",d.POSTINSERT="$postInsert",d.UNSET="$unset",d.CLEAR_ALL="$clearAll",(f=G||(G={})).IDENTIFY="$identify",f.GROUP_IDENTIFY="$groupidentify",f.REVENUE="revenue_amount";var tL=function(e,t){return(0,eb.Cl)((0,eb.Cl)({},t),{event_type:G.IDENTIFY,user_properties:e.getUserProperties()})},tH=function(e,t,n,r){var i;return(0,eb.Cl)((0,eb.Cl)({},r),{event_type:G.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:((i={})[e]=t,i)})},tN=function(e,t,n){var r,i=new tM;return i.set(e,t),(0,eb.Cl)((0,eb.Cl)({},n),{event_type:G.IDENTIFY,user_properties:i.getUserProperties(),groups:((r={})[e]=t,r)}
1)},tU=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));tA(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?(0,eb.Cl)({},this.properties):{};return e[Q.REVENUE_PRODUCT_ID]=this.productId,e[Q.REVENUE_QUANTITY]=this.quantity,e[Q.REVENUE_PRICE]=this.price,e[Q.REVENUE_TYPE]=this.revenueType,e[Q.REVENUE_CURRENCY]=this.currency,e[Q.REVENUE]=this.revenue,e[Q.RECEIPT]=this.receipt,e[Q.RECEIPT_SIG]=this.receiptSig,e},e}();(h=Q||(Q={})).REVENUE_PRODUCT_ID="$productId",h.REVENUE_QUANTITY="$quantity",h.REVENUE_PRICE="$price",h.REVENUE_TYPE="$revenueType",h.REVENUE_CURRENCY="$currency",h.REVENUE="$revenue",h.RECEIPT="$receipt",h.RECEIPT_SIG="$receiptSig";var tF=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},tj=n(58013),tq=n.n(tj)()||tj,tz=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return(0,eb.sH)(this,void 0,void 0,function(){var i;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(void 0===e.name&&(e.name=e_(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i))return this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2];return e.type=null!=(n=e.type)?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null==(r=e.setup)?void 0:r.call(e,t,this.client)];case 1:if(o.sent(),"locked"!==this.pluginStatus.get(i))return[2];return this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2]}})})},e.prototype.deregister=function(e,t){var n;return(0,eb.sH)(this,void 0,void 0,function(){var r,i;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(this.pluginStatus.delete(e),-1===(r=this.plugins.findIndex(function(t){return t.name===e})))return t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2];return i=this.plugins[r],this.plugins.splice(r,1),[4,null==(n=i.teardown)?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null==(t=e.teardown)?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(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,eb.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s,a,u,l,c,d,f,h,p,v;return(0,eb.YH)(this,function(g){switch(g.label){case 0:if(!e)return[2];t=(0,eb.zs)(e,1)[0],n=(0,eb.zs)(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),r=this.plugins.filter(function(e){return"before"===e.type}),g.label=1;case 1:g.trys.push([1,6,7,8]),o=(i=(0,eb.Ju)(r)).next(),g.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,eb.Cl)({},t))];case 3:if(null===(a=g.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),n({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),g.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return f={error:g.sent()},[3,8];case 7:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(f)throw f.error}
1return[7];case 8:u=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),g.label=9;case 9:g.trys.push([9,14,15,16]),c=(l=(0,eb.Ju)(u)).next(),g.label=10;case 10:if(c.done)return[3,13];if(!(s=c.value).execute)return[3,12];return[4,s.execute((0,eb.Cl)({},t))];case 11:if(null===(a=g.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),n({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),g.label=12;case 12:return c=l.next(),[3,10];case 13:return[3,16];case 14:return p={error:g.sent()},[3,16];case 15:try{c&&!c.done&&(v=l.return)&&v.call(l)}finally{if(p)throw p.error}return[7];case 16:return d=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(t))),Promise.all(d.map(function(e){var n=(0,eb.Cl)({},t);return e.execute(n).catch(function(e){return tg(n,0,String(e))})})).then(function(e){var r=(0,eb.zs)(e,1)[0]||tg(t,100,"Event not tracked, no destination plugins on the instance");n(r)}),[2]}})})},e.prototype.flush=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t=this;return(0,eb.YH)(this,function(n){switch(n.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return n.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return n.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onIdentityChanged)||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onSessionIdChanged)||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onOptOutChanged)||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=(t=(0,eb.Ju)(this._optOutListeners)).next(),a.label=1;case 1:if(n.done)return[3,6];r=n.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,r(e)];case 3:return a.sent(),[3,5];case 4:return i=a.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o={error:a.sent()},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null==(t=e.onReset)||t.call(e)})},e}(),tY=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 tz(this),this.name=e}return e.prototype._init=function(e){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),r=(n=(0,eb.Ju)(t)).next(),a.label=2;case 2:if(r.done)return[3,7];if(!((i=(0,r.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return a.sent(),[3,6];case 4:return[4,i];case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}
1return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,n){var r=(0,eb.Cl)((0,eb.Cl)((0,eb.Cl)({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ew(this.dispatch(r))},e.prototype.identify=function(e,t){var n=tL(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ew(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=tH(e,t,n,r);return ew(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=tN(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ew(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=(0,eb.Cl)((0,eb.Cl)({},t),{event_type:G.REVENUE,event_properties:e.getEventProperties()});return ew(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ew())},e.prototype._addPlugin=function(e){return ew(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)),ew())},e.prototype._removePlugin=function(e){return ew(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(tg(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t=this;return(0,eb.YH)(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,n=null!=(t=this.userProperties)?t:{},r=(0,eb.Cl)({},n);if(void 0===e)return r;var i={};return Object.keys(e).forEach(function(t){Object.values($).includes(t)||(i[t]=e[t])}),tD.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case $.CLEAR_ALL:Object.keys(r).forEach(function(e){delete r[e]});break;case $.UNSET:Object.keys(n).forEach(function(e){delete r[e]});break;case $.SET:Object.assign(r,n)}}}),Object.assign(r,i),r},e.prototype.process=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n;return(0,eb.YH)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),this.config.optOut)return[2,tg(e,0,"Event skipped due to optOut config")];return e.event_type===G.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)];case 1:return 200===(t=r.sent()).code?this.config.loggerProvider.log(t.message):100===t.code?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return n=String(r.sent()),this.config.loggerProvider.error(n),[2,t=tg(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,!!e))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ew(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});return void 0===t?void this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e)):t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),tB=function(e,t){var n,r,i;return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1&&("string"!=typeof(null==(r=null==(n=null==(i=(0,eI.m)())?void 0:i.chrome)?void 0:n.runtime)?void 0:r.id)||!!(null==e?void 0:e[t]))},tV=function(e){return tB(e,"attribution")},tJ=function(e){return tB(e,"formInteractions")},tK=function(e){return tB(e,"pageViews")},tW=function(e){return tB(e,"sessions")},tX=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},t$=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},tG=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tQ=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;if(!0===t)return{mainThreadBlock:!0};if("object"==typeof t&&null!==t)return t}},tZ=function(e){if(t$(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},t0=function(e){if(tG(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},t1=function(e){var t;if(tX(e.autocapture)){var n=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.
1networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),(0,eb.Cl)((0,eb.Cl)({},n),{captureRules:null==(t=null==n?void 0:n.captureRules)?void 0:t.map(function(t){var n,r,i;if((null==(n=t.urls)?void 0:n.length)&&(null==(r=t.hosts)?void 0:r.length)){var o=JSON.stringify(t.hosts),s=JSON.stringify(t.urls);return null==(i=e.loggerProvider)||i.warn("Found network capture rule with both urls='".concat(s,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,eb.Cl)((0,eb.Cl)({},t),{hosts:void 0})}return t})})}},t2=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return tK(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}},t3=function(e){if(tJ(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},t4=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.promise)}}return e},t6=function(e){return e&&void 0!==e._q},t5=function(){if("u"<typeof navigator)return"";var e,t,n,r,i=navigator.userLanguage;return null!=(r=null!=(n=null!=(t=null==(e=navigator.languages)?void 0:e[0])?t:navigator.language)?n:i)?r:""},t8="2.43.0",t7="amplitude-ts",t9=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(t7,"/").concat(t8),"u">typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return(0,eb.sH)(this,void 0,void 0,function(){var r,i,o;return(0,eb.YH)(this,function(s){return r=new Date().getTime(),i=null!=(t=this.config.lastEventId)?t:-1,o=null!=(n=e.event_id)?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[2,(0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)({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:t5()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:e_(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]})})},e}(),ne=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(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,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),nt=function(){var e,t=(0,eI.m)();return null==(e=null==t?void 0:t.navigator)?void 0:e.locks},nn=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,eb.Cl)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:return t="AMP_TEST",n=new e((0,eb.Cl)({},this.options)),r=String(Date.now()),[4,n.transaction(t,function(e){var n,o;try{e.set(r);var s=e.get()===r;return!s&&i.config.diagnosticsClient&&(null==(n=i.config.diagnosticsClient)||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:r,sync:!0})),s}catch(e){if(i.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null==(o=i.config.diagnosticsClient)||o.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:r,error:a,sync:!0})}return!1}
1finally{e.set(null)}})];case 1:return[2,o.sent()]}})})},e.prototype.get=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=no(t);if(void 0===n)return void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t));return JSON.parse(n)}catch(n){console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t));return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return(0,eb.sH)(this,void 0,void 0,function(){var r,i,o,s,a,u,l,c;return(0,eb.YH)(this,function(d){switch(d.label){case 0:r=(0,eI.m)(),d.label=1;case 1:if(d.trys.push([1,4,,5]),!(i=null==r?void 0:r.cookieStore))return[3,3];return[4,i.getAll(e)];case 2:if(o=d.sent()){o.length>1&&(null==(t=this.config.diagnosticsClient)||t.recordEvent("cookies.duplicate",{cookies:o.map(function(e){return e.domain})}),null==(n=this.config.diagnosticsClient)||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(s=(0,eb.Ju)(o)).next();!a.done;a=s.next())if(u=a.value,ns(u.domain,this.options.domain))return[2,u.value]}catch(e){l={error:e}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(l)throw l.error}}}d.label=3;case 3:return[3,5];case 4:return d.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=(0,eI.m)(),o=(null!=(n=null==(t=null==i?void 0:i.document)?void 0:t.cookie.split("; "))?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var n;try{var i=a(t.substring(e.length+1));return i||null==(n=r.config.diagnosticsClient)||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=(0,eI.m)();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!=(n=this.options.expirationDays)?n:0,o=null!==t?i:-1,s=void 0;if(o){var a=new Date;a.setTime(a.getTime()+24*o*36e5),s=a}var u="".concat(e,"=").concat(r.btoa(r.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)),r.document.cookie=u}catch(t){var l=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}},e.prototype.remove=function(e){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return[2]})})},e.isDomainWritable=function(t){return(0,eb.sH)(this,void 0,void 0,function(){var n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return(0,eb.sH)(this,void 0,void 0,function(){var n,r,i=this;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(n=nt(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),nr=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},ni=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},no=function(e){var t;return null!=(t=nr(e))?t:ni(e)},ns=function(e,t){if(""===e&&""===t)return!0;
1if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},na=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),["AMP",t,e.substring(0,n)].filter(Boolean).join("_")},nu=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r;return(0,eb.YH)(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,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];return[2,JSON.parse(t)];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return[2,(null==(t=this.storage)?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(r){try{null==(n=this.storage)||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),nl=function(e){function t(t){var n,r,i,o=this;try{i=null==(n=(0,eI.m)())?void 0:n.localStorage}catch(e){null==(r=null==t?void 0:t.loggerProvider)||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return(0,eb.C6)(t,e),t.prototype.set=function(t,n){var r;return(0,eb.sH)(this,void 0,void 0,function(){var i;return(0,eb.YH)(this,function(o){switch(o.label){case 0:if(!(Array.isArray(n)&&n.length>1e3))return[3,2];return i=n.length-1e3,[4,e.prototype.set.call(this,t,n.slice(0,1e3))];case 1:return o.sent(),null==(r=this.loggerProvider)||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(nu),nc=function(e){function t(){var t;return e.call(this,null==(t=(0,eI.m)())?void 0:t.sessionStorage)||this}return(0,eb.C6)(t,e),t}(nu);function nd(){return"u">typeof CompressionStream}function nf(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new Response(new Blob([e]).stream().pipeThrough(new t("gzip"))).arrayBuffer()];case 2:return[2,n.sent()];case 3:return n.sent(),[2,void 0];case 4:return[2]}})})}var nh=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,n,r,i,o,s,a,u,l,c,d,f,h,p,v,g,m,y,b,w,S,k,E=e.code||0,C=this.buildStatus(E);switch(C){case W.Success:return{status:C,statusCode:E,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(n=e.payload_size_bytes)?n:0,serverUploadTime:null!=(r=e.server_upload_time)?r:0}};case W.Invalid:return{status:C,statusCode:E,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(s=e.events_with_invalid_fields)?s:{},eventsWithMissingFields:null!=(a=e.events_with_missing_fields)?a:{}
1,eventsWithInvalidIdLengths:null!=(u=e.events_with_invalid_id_lengths)?u:{},epsThreshold:null!=(l=e.eps_threshold)?l:0,exceededDailyQuotaDevices:null!=(c=e.exceeded_daily_quota_devices)?c:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(f=e.silenced_events)?f:[],throttledDevices:null!=(h=e.throttled_devices)?h:{},throttledEvents:null!=(p=e.throttled_events)?p:[]}};case W.PayloadTooLarge:return{status:C,statusCode:E,body:{error:null!=(v=e.error)?v:""}};case W.RateLimit:return{status:C,statusCode:E,body:{error:null!=(g=e.error)?g:"",epsThreshold:null!=(m=e.eps_threshold)?m:0,throttledDevices:null!=(y=e.throttled_devices)?y:{},throttledUsers:null!=(b=e.throttled_users)?b:{},exceededDailyQuotaDevices:null!=(w=e.exceeded_daily_quota_devices)?w:{},exceededDailyQuotaUsers:null!=(S=e.exceeded_daily_quota_users)?S:{},throttledEvents:null!=(k=e.throttled_events)?k:[]}};case W.Timeout:default:return{status:C,statusCode:E}}},e.prototype.buildStatus=function(e){return tS(e)?W.Success:429===e?W.RateLimit:413===e?W.PayloadTooLarge:408===e?W.Timeout:e>=400&&e<500?W.Invalid:e>=500?W.Failed:W.Unknown},e}(),np=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return(0,eb.C6)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,eb.sH)(this,void 0,void 0,function(){var r=this;return(0,eb.YH)(this,function(i){return[2,new Promise(function(i,o){"u"<typeof XMLHttpRequest&&o(Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",e,!0),s.onreadystatechange=function(){if(s.readyState===r.state.done){var e=s.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:s.status}))}}};var a={"Content-Type":"application/json",Accept:"*/*"},u=JSON.stringify(t),l=n&&u.length>=2048&&nd(),c=function(e){var t,n;a=(0,eb.Cl)((0,eb.Cl)({},r.customHeaders),a);try{for(var i=(0,eb.Ju)(Object.entries(a)),o=i.next();!o.done;o=i.next()){var u=(0,eb.zs)(o.value,2),l=u[0],c=u[1];s.setRequestHeader(l,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}s.send(e)};(0,eb.sH)(r,void 0,void 0,function(){var e;return(0,eb.YH)(this,function(t){switch(t.label){case 0:if(!l)return[3,2];return[4,nf(u)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(u),[3,3];case 2:c(u),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(nh),nv=function(e){function t(t,n){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r.enableKeepalive=!1!==n,r}return(0,eb.C6)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,eb.sH)(this,void 0,void 0,function(){var r,i,o,s,a,u,l,c;return(0,eb.YH)(this,function(d){switch(d.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");if(r=JSON.stringify(t),i=n&&r.length>=2048&&nd(),o=r,s={"Content-Type":"application/json",Accept:"*/*"},!i)return[3,2];return[4,nf(r)];case 1:(a=d.sent())&&(s["Content-Encoding"]="gzip",o=a),d.label=2;case 2:return s=(0,eb.Cl)((0,eb.Cl)({},this.customHeaders),s),u="string"==typeof o?o.length:o.byteLength,[4,fetch(e,{headers:s,body:o,method:"POST",keepalive:this.enableKeepalive&&u<=16384})];case 3:return[4,(l=d.sent()).text()];case 4:c=d.sent();try{return[2,this.buildResponse(JSON.parse(c))]}catch(e){return[2,this.buildResponse({code:l.status})]}}})})},t}(nh),ng=function(e){function t(){return e.call(this)||this}return(0,eb.C6)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,eb.sH)(this,void 0,void 0,function(){var n=this;return(0,eb.YH)(this,function(r){return[2,new Promise(function(r,i){var o=(0,eI.m)();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,s))return r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(nh),nm=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},ny=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},nb="[Amplitude]",nw="".concat(nb," Form Started"),nS="".concat(nb," Form Submitted"),nk="".concat(nb," File Downloaded"),nE="session_start",nC="session_end",nI="".concat(nb," File Extension"),nx="".concat(nb," File Name"),n_="".concat(nb," Link ID"),nT="".concat(nb," Link Text"),nP="".concat(nb," Link URL"),nO="".concat(nb," Form ID"),nA="".concat(nb," Form Name"),nR="".concat(nb," Form Destination"),nM="c
1ookie",nD={always:"always",ifEmptyCampaign:"ifEmptyCampaign"},nL=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},nH=function(e,t,n,r,i,o){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,a=(0,eb.Tt)(e,["referrer","referring_domain"]),u=t||{},l=(u.referrer,u.referring_domain),c=(0,eb.Tt)(u,["referrer","referring_domain"]),d=n.excludeInternalReferrers;if(d){var f=nj(d,r);if(!(f instanceof TypeError)&&e.referring_domain&&nB(e.referring_domain,o)){if("always"===f)return nq(f,e.referring_domain,r),!1;else if("ifEmptyCampaign"===f&&Object.values((0,eb.Cl)((0,eb.Cl)({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e}))return nq(f,e.referring_domain,r),!1}}if(nN(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(!i&&Object.values(e).every(function(e){return!e})&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var h=JSON.stringify(a)!==JSON.stringify(c),p=nL(s||"")!==nL(l||""),v=!t||h||p;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},nN=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})},nU=function(e,t){var n=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(n)},nF=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},nj=function(e,t){if(!0===e)return nD.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(nD).includes(n))return n;if(void 0===n)return nD.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),TypeError(r)};function nq(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var nz=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],nY=function(e){var t,n,r=e||(null==(n=null==(t=(0,eI.m)())?void 0:t.location)?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],s=i[i.length-2];return(nz.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s)?"".concat(s,".").concat(o):o},nB=function(e,t){var n=(0,eI.m)();return!!n&&nU(e,(t||"").trim()||nY(n.location.hostname))},nV=function(e){function t(t,n,r,i,o,s,a,u,l,c,d,f,h,p,v,g,m,y,b,w,S,k,E,C,I,x,_,T,P,O,A,R,M,D,L,H,N,U,F,j,q,z,Y,B){void 0===r&&(r=new ne),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===l&&(l=5),void 0===c&&(c=30),void 0===d&&(d=nM),void 0===g&&(g=new eE),void 0===m&&(m=eS.$.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===E&&(E=""),void 0===C&&(C="US"),void 0===_&&(_=18e5),void 0===T&&(T=new nl({loggerProvider:g})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===Y&&(Y=!1);var V,J=this;(J=e.call(this,{apiKey:t,storageProvider:T,transportProvider:nW(O)})||this).apiKey=t,J.appVersion=n,J.cookieOptions=i,J.defaultTracking=o,J.autocapture=s,J.flushIntervalMillis=u,J.flushMaxRetries=l,J.flushQueueSize=c,J.identityStorage=d,J.ingestionMetadata=f,J.instanceName=h,J.loggerProvider=g,J.logLevel=m,J.minIdLength=y,J.offline=b,J.partnerId=S,J.plan=k,J.serverUrl=E,J.serverZone=C,J.sessionTimeout=_,J.storageProvider=T,J.trackingOptions=P,J.transport=O,J.useBatch=A,J.fetchRemoteConfig=R,J.networkTrackingOptions=H,J.identify=N,J.enableDiagnostics=U,J.diagnosticsSampleRate=F,J.diagnosticsClient=j,J.remoteConfig=q,J.topLevelDomain=z,J.enableRequestBodyCompression=Y,J.customEnrichment=B,J.version=t8,J._optOut=!1,J._cookieStorage=r,J.deviceId=a,J.lastEventId=p,J.lastEventTime=v,J.optOut=w,J.deferredSessionId=x,J.sessionId=I,J.pageCounter=D,J.userId=M,J.debugLogsEnabled=L,J.loggerProvider.enable(L?eS.$.Debug:J.logLevel),J.networkTrackingOptions=H,J.identify=N,J.enableDiagnostics=U,J.diagnosticsSampleRate=F,J.diagnosticsClient=j;var K=null!=(V=null==q?void 0:q.fetchRemoteConfig)?V:R;return J.remoteConfig=J.remoteConfig||{},J.remoteConfig.fetchRemoteConfig=K,J.fetchRemoteConfig=K,J.topLevelDomain=z||nY(),J}return(0,eb.C6)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof nn&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(na(this.apiKey),e)},t}(ty),nJ=function(e,t,n){switch(void 0===e&&(e=nM),void 0===t&&(t={}),e){case"localStorage":return new nl;case"sessionStorage":return new nc;case"none":return new ne;default:return new nn((0,eb.Cl)((0,eb.Cl)({},t),{expirationDays:t.expiration}),n)}},nK=function(e){var t,n;return void 0===e&&(e={}),(null==(t=e.remoteConfig)?void 0:t.fetchRemoteConfig)===!0||(null==(n=e.remoteConfig)?void 0:n.fetchRemoteConfig)!==!1&&!1!==e.fetchRemoteConfig},nW=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0;return"xhr"===t?new np(n):"beacon"===t?new ng:new nv(n,r)},nX="data-amp-mask",n$="*****",nG=/\b(?:\d[ -]*?){13,16}\b/,nQ=/(\d{3}-?\d{2}-?\d{4})/g,nZ=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,n0=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var n,r,i=e;i=(i=(i=i.replace(nG,n$)).replace(nQ,n$)).replace(nZ,n$);try{for(var o=(0,eb.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,n$)}catch(e){}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},n1=function(e){if("u"<typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(nX)?n$:e?e(document.title):document.title},n2=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},n3=function(){function e(){}return e.prototype.parse=function(){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return[2,(0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)({},tl),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=eB();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!=(t=null==(e=n.referrer)?void 0:e.split("/")[2])?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=eB();return(e={})[e7]=t[e7],e[e9]=t[e9],e[te]=t[te],e[tt]=t[tt],e[tn]=t[tn],e[tr]=t[tr],e[ti]=t[ti],e[to]=t[to],e[ts]=t[ts],e[ta]=t[ta],e[tu]=t[tu],e},e}(),n4="AMP_PAGE_VIEW",n6=function(e){void 0===e&&(e={});var t,n,r,i=(0,eI.m)(),o=void 0,s=!1,a=e.trackOn,u=e.trackHistoryChanges,l=e.eventType,c=void 0===l?"[Amplitude] Page Viewed":l,d=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},f=function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){var t,n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:return t=d("u">typeof location&&location.href||""),r={event_type:c},n=[{}],[4,n5()];case 1:return[2,(r.event_properties=eb.Cl.apply(void 0,[eb.Cl.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":"u">typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"u">typeof location&&d(location.pathname)||"","[Amplitude] Page Title":n1(n0),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),r)]}})})},h=function(){return void 0===a||"function"==typeof a&&a()},p="u">typeof location?location.href:null,v=function(){(0,eb.sH)(void 0,void 0,void 0,function(){var e,n,i,s,a;return(0,eb.YH)(this,function(l){switch(l.label){case 0:if(n=n7(u,e=location.href,p||"")&&h(),p=e,!n)return[3,4];if(i=void 0,r&&(i=e_(),r.set(n4,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return a=(s=t).track,[4,f(i)];case 2:a.apply(s,[l.sent()]),l.label=3;case 3:l.label=4;case 4:return[2]}})})};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return(0,eb.sH)(void 0,void 0,void 0,function(){var u,l,c;return(0,eb.YH)(this,function(d){switch(d.label){case 0:if(t=a,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,i){try{r=new nu(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",v),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=(0,eb.zs)(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),s&&v()}})}if(!h())return[3,2];return o.log("Tracking page view event"),u=void 0,r&&(u=e_(),r.set(n4,{pageViewId:u})),c=(l=t).track,[4,f(u)];case 1:c.apply(l,[d.sent()]),d.label=2;case 2:return[2]}})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){var t,i,s;return(0,eb.YH)(this,function(u){switch(u.label){case 0:if(!("attribution"===a&&n8(e)))return[3,4];
1if(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,!r)return[3,2];return[4,r.get(n4)];case 1:t=null==(i=u.sent())?void 0:i.pageViewId,u.label=2;case 2:return[4,f(t)];case 3:e.event_type=(s=u.sent()).event_type,e.event_properties=(0,eb.Cl)((0,eb.Cl)({},e.event_properties),s.event_properties),u.label=4;case 4:return n&&e.event_type===c&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=(0,eb.Cl)((0,eb.Cl)({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return i&&(i.removeEventListener("popstate",v),s=!1),[2]})})}}},n5=function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e;return(0,eb.YH)(this,function(t){switch(t.label){case 0:return e=n2,[4,new n3().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},n8=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[$.SET]||{},r=t[$.UNSET]||{},i=(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(Object.keys(n)),!1),(0,eb.zs)(Object.keys(r)),!1);return Object.keys(tl).every(function(e){return i.includes(e)})}return!1},n7=function(e,t,n){if("pathOnly"!==e)return t!==n;if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname},n9=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})},i=function(){n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return(0,eb.sH)(void 0,void 0,void 0,function(){var o,s;return(0,eb.YH)(this,function(a){return t=t3(n),o=function(){if(!i)return void n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");if("u">typeof document){var o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;r(e,"change",function(){var t,n=rt(e);s||i.track(nw,((t={})[nO]=re(e.id),t[nA]=re(e.name),t[nR]=n,t)),s=!0}),r(e,"submit",function(r){var o,a,u=rt(e);if(s||i.track(nw,((o={})[nO]=re(e.id),o[nA]=re(e.name),o[nR]=u,o)),s=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0)if("function"==typeof t.shouldTrackSubmit&&"u">typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(nS,((a={})[nO]=re(e.id),a[nA]=re(e.name),a[nR]=u,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(s)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=(0,eI.m)())?s.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},re=function(e){if("string"==typeof e)return e},rt=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},rn=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})},r=function(){t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,r){return(0,eb.sH)(void 0,void 0,void 0,function(){var i,o;return(0,eb.YH)(this,function(s){return i=function(){if(!r)return void t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");if("u">typeof document){var i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&n(e,"click",function(){var n;s&&r.track(nk,((n={})[nI]=s,n[nx]=t.pathname,n[n_]=e.id,n[nT]=e.text,n[nP]=e.href,n))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;
1Array.from(document.getElementsByTagName("a")).forEach(i),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=(0,eI.m)())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},rr=!1,ri=function(e){rr||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."),rr=!0)},ro=function(){var e=(0,eI.m)(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))},r=function(){t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(r){return"u"<typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1):(e.offline=!navigator.onLine,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,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return r(),[2]})})}}};function rs(e,t,n){var r,i,o=[];try{for(var s=(0,eb.Ju)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var u=a.value;try{o.push(new RegExp(u))}catch(e){n.loggerProvider.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(o)}var ra=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],ru="data-amp-track-",rl=["div","span","h1","h2","h3","h4","h5","h6"],rc=n(42043),rd=n.n(rc);function rf(e,t){return new(rd())(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function rh(e,t){return new(rd())(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=(0,eb.Ju)(i),o=n.next();!o.done;o=n.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return s(e),s(t),o})}function rp(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new(rd())(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){try{for(var n,r,i,o=(0,eb.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.next)||i.call(a,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){try{for(var n,i,o,s=(0,eb.Ju)(t),a=s.next();!a.done;a=s.next()){var u=a.value;null==(o=u.error)||o.call(u,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}r()},complete:function(){try{for(var e,n,i,o=(0,eb.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.complete)||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var rv="https://app.amplitude.com",rg={US:rv,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},rm="__AMPLITUDE_MESSENGER_INSTANCE__",ry="__AMPLITUDE_MESSENGER__",rb=function(){function e(e){var t=(void 0===e?{}:e).origin;this[Z]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=void 0===t?rv:t}return e.prototype.notify=function(e){var t,n,r,i;null==(n=null==(t=this.logger)?void 0:t.debug)||n.call(t,"Message sent: ",JSON.stringify(e)),null==(i=null==(r=window.opener)?void 0:r.postMessage)||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(Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null==(t=this.logger)||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){this.actionHandlers.has(e)&&(null==(o=null==(i=this.logger)?void 0:i.warn)||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var n,r,i,o,s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=(0,eb.Ju)(s),u=a.next();!u.done;u=a.next()){var l=u.value;t(l)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=(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)||r.appendChild(i)}catch(e){n(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]}})})},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===rv&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null==(n=null==(t=this.logger)?void 0:t.debug)||n.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null==(n=null==(t=r.logger)?void 0:t.debug)||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var t,n,i,o,s,a=e.data,u=null==a?void 0:a.action;if(u)if("id"in a&&a.id)null==(o=null==(i=r.logger)?void 0:i.debug)||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a
1);else{if("ping"===u)return void r.notify({action:"pong"});var l=r.actionHandlers.get(u);if(l)l(a.data);else{var c=null!=(s=r.pendingMessages.get(u))?s:[];c.push(a.data),r.pendingMessages.set(u,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=(0,eI.m)();(null==e?void 0:e[ry])===this&&delete e[ry]},e}();function rw(e){var t=(0,eI.m)(),n=null==t?void 0:t[ry];if("object"==typeof n&&null!==n&&rm in n&&!0===n[rm])return n;var r=new rb(e);return t&&(t[ry]=r),r}Z=rm;var rS="__AMPLITUDE_BACKGROUND_CAPTURE__";function rk(e,t){var n;if(!0!==e[rS]){e[rS]=!0;var r=null!=(n=null==t?void 0:t.scriptUrl)?n:"https://cdn.amplitude.com/libs/background-capture-1.0.1.js.gz",i=null,o=function(t,n){var r,i;"background-capture-complete"===t&&(null==(i=null==(r=e.logger)?void 0:r.debug)||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){null==(n=null==(t=e.logger)?void 0:t.debug)||n.call(t,"Initializing background capture (external script)");var t,n,s=new URL(r,e.endpoint).toString();e.loadScriptOnce(s).then(function(){var t,n,r;null==(n=null==(t=e.logger)?void 0:t.debug)||n.call(t,"Background capture script loaded (external)"),i=null==(r=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:r.call(window,{messenger:e,onBackgroundCapture:o}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null==(e=null==i?void 0:i.close)||e.call(i),i=null})}}var rE="1.27.3",rC="[Amplitude] Element Clicked",rI="[Amplitude] Element Tag",rx="[Amplitude] Element Text",r_="[Amplitude] Page URL",rT="[Amplitude] Viewport Height",rP="[Amplitude] Viewport Width",rO="[Amplitude] Page View ID",rA="data-amp-mask-attributes",rR=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},rM=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},rD=["input","select","textarea"],rL=function(e,t){var n,r=null==(n=null==window?void 0:window.getComputedStyle)?void 0:n.call(window,e);return(null==r?void 0:r.getPropertyValue("cursor"))==="pointer"&&"click"===t},rH=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&rR(window.location.href,n))&&!!rR(window.location.href,t)},rN=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,a=e.shouldTrackEventResolver,u=null==(s=null==(o=null==i?void 0:i.tagName)?void 0:o.toLowerCase)?void 0:s.call(o);if(!u)return!1;if(a)return a(r,i);if(!rH(e))return!1;var l=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}var c=rL(i,r);if(n&&c)return!0;if(t&&!t.some(function(e){var t;return!!(null==(t=null==i?void 0:i.matches)?void 0:t.call(i,e))}))return!1;switch(u){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:if(c)return!0;return"click"===r}}},rU=function(e){var t,n,r,i=null==(n=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:n.call(t),o=e instanceof HTMLElement&&(null==(r=e.getAttribute("contenteditable"))?void 0:r.toLowerCase())==="true";return!rD.includes(i)&&!o},rF=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return null!=r&&("object"!=typeof r||0!==Object.keys(r).length)&&("string"!=typeof r||0!==r.trim().length)&&(t[n]=r),t},{})},rj=function(){var e;try{var t=(0,eI.m)(),n=null==(e=null==t?void 0:t.sessionStorage)?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},rq=function(e,t){return e?t.some(function(t){var n;return null==(n=null==e?void 0:e.matches)?void 0:n.call(e,t)})?e:rq(null==e?void 0:e.parentElement,t):null},rz=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};(p=ee||(ee={}))[p.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",p[p.MIDDLE=1]="MIDDLE",p[p.RIGHT=2]="RIGHT";var rY="__AMPLITUDE_VISUAL_TAGGING__",rB=(0,eI.m)(),rV=null==rB?void 0:rB.console,rJ={},rK={},rW=!1,rX=function(e,t){if(!rV||"function"!=typeof rV[e]||!rK[e]&&(rK[e]=rV[e],rV[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if(rJ[e]&&!rW){rW=!0;var r=rJ[e];r&&r.forEach(function(n){try{n(e,t)}catch(e){}})}}catch(e){}return rW=!1,rK[e].apply(rV,t)},0))return Error("Console override failed");rJ[e]?rJ[e].push(t):rJ[e]=[t]},r$=function(e){var t,n;try{for(var r=(0,eb.Ju)(Object.values(rJ)),i=r.next();!i.done;i=r.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},rG=(0,eI.m)(),rQ=function(){return new(rd())(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},rZ=function(e){return void 0===e&&(e="click"),new(rd())(function(t){var n,r=function(e){t.next(e)};return null==(n=(0,eI.m)())||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null==(t=(0,eI.m)())||t.document.removeEventListener(e,r,{capture:!0})}})},r0=function(){var e=rh(new(rd())(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=(0,eb.Cl)((0,eb.Cl)({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return rG.addEventListener("error",t),function(){rG.removeEventListener("error",t)}}),new(rd())(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return rG.addEventListener("unhandledrejection",t),function(){rG.removeEventListener("unhandledrejection",t)}}));return rh(e,new(rd())(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return rX("error",t),function(){r$(t)}}))},r1=function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){console.error("Error matching event to filter",e)}return!1},r2=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;if(e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector)return n.querySelector(e.selector);return n}}catch(e){}},r3=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}})},r4={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},r6=function(e){var t,n,r,i,o=Object.values(r4).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,eb.Ju)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{try{for(var l=(r=void 0,(0,eb.Ju)(u.definition)),c=l.next();!c.done;c=l.next()){var d=r4[c.value.event_type];d&&o[d].add(u.id)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r5=function(e){var t,n,r,i,o=new Map;try{for(var s=(0,eb.Ju)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{for(var l=(r=void 0,(0,eb.Ju)(u.conditions)),c=l.next();!c.done;c=l.next()){var d=c.value;if("LABELED_EVENT"===d.type){var f=d.match.eventId,h=o.get(f);h||(h=[],o.set(f,h)),h.push(u)}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r8=function(e,t){var n,r,i,o,s=new Set;try{for(var a=(0,eb.Ju)(e),u=a.next();!u.done;u=a.next()){var l=u.value,c=t.get(l.id);if(c)try{for(var d=(i=void 0,(0,eb.Ju)(c)),f=d.next();!f.done;f=d.next()){var h=f.value;s.add(h)}}catch(e){i={error:e}}
1finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return Array.from(s)},r7=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 i=r8(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return r4[t.event_type]===e.type&&t.filters.every(function(t){return r1(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,eb.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;r3(a.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}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}(),r9=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",rA,nX]),ie=["type"],it=["svg","path","g"],ir=["password","hidden"],ii=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),io=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=is(r,!!t,r===e);if(!i||(n.push(i),i.optimized))break;r=r.parentElement}return n.reverse(),n.join(" > ")},is=function(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE)return null;var r,i,o=e.getAttribute("id");if(t){if(o)return new ii(c(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new ii(s,!0)}var a=e.tagName.toLowerCase();if(o)return new ii(a+c(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new ii(a,!0);function l(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]}function c(e){return"#"+CSS.escape(e)}for(var d=l(e),f=!1,h=!1,p=-1,v=-1,g=u.children,m=0;g&&(-1===p||!h)&&m<g.length;++m){var y=g[m];if(y.nodeType===Node.ELEMENT_NODE){if(v+=1,y===e){p=v;continue}if(!h&&y.tagName.toLowerCase()===a){f=!0;var b=new Set(d);if(!b.size){h=!0;continue}for(var w=l(y),S=0;S<w.length;++S){var k=w[S];if(b.has(k)&&(b.delete(k),!b.size)){h=!0;break}}}}}var E=a;if(n&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(E+="[type="+CSS.escape(e.getAttribute("type")||"")+"]"),h)E+=":nth-child("+String(p+1)+")";else if(f)try{for(var C=(0,eb.Ju)(d),I=C.next();!I.done;I=C.next()){var x=I.value;E+="."+CSS.escape(x.slice(1))}}catch(e){r={error:e}}finally{try{I&&!I.done&&(i=C.return)&&i.call(C)}finally{if(r)throw r.error}}return new ii(E,!1)},ia=function(e,t){var n,r,i,o=this;this.replaceSensitiveString=function(e){return n0(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,s=performance.now(),a=[];if(!e)return[];for(var u=function(e){var t=[];if(!e)return t;
1t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),l=new Map,c=u.length-1;c>=0;c--){var d=u[c];if(d){var f,h=(f=d.getAttribute(rA))?f.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],p=c===u.length-1?[]:null!=(r=l.get(u[c+1]))?r:new Set,v=new Set((0,eb.fX)((0,eb.fX)([],(0,eb.zs)(p),!1),(0,eb.zs)(h),!1));l.set(d,v)}}a=u.map(function(e){var t;return function(e,t){if(null===e)return null;var n,r,i,o,s,a,u=String(e.tagName).toLowerCase(),l={tag:u},c=Array.from(null!=(o=null==(i=e.parentElement)?void 0:i.children)?o:[]);c.length&&(l.index=c.indexOf(e),l.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null==(a=null==(s=e.previousElementSibling)?void 0:s.tagName)?void 0:a.toLowerCase();d&&(l.prevSib=String(d));var f=e.getAttribute("id");f&&(l.id=String(f));var h=Array.from(e.classList);h.length&&(l.classes=h);var p={},v=Array.from(e.attributes).filter(function(e){return!r9.has(e.name)}),g=!rU(e);if(!ir.includes(String(e.getAttribute("type")))&&!it.includes(u))try{for(var m=(0,eb.Ju)(v),y=m.next();!y.done;y=m.next()){var b=y.value;if(!g||ie.includes(b.name)){if(t.has(b.name)){p[b.name]=n$;continue}p[b.name]=String(b.value).substring(0,128)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(p).length&&(l.attrs=p),l}(e,null!=(t=l.get(e))?t:new Set)});var g=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=(0,eb.zs)(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=o.replaceSensitiveString(i))})};try{for(var m=(0,eb.Ju)(a),y=m.next();!y.done;y=m.next()){var b=y.value;g(b)}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}var w=performance.now();return null==(i=o.diagnosticsClient)||i.recordHistogram("autocapturePlugin.getHierarchy",w-s),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(e){t=null}return t?o.getText(t):o.getNearestLabel(n)},this.getElementPath=function(e){if(!e)return"";var t,n=performance.now(),r=io(e),i=performance.now();return null==(t=o.diagnosticsClient)||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.getEventProperties=function(e,t,n){var r,i,s,a,u=null==(s=null==(i=null==t?void 0:t.tagName)?void 0:i.toLowerCase)?void 0:s.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},c=o.getHierarchy(t),d=null==(a=c[0])?void 0:a.attrs,f=o.getNearestLabel(t),h=Object.entries(null!=d?d:{}).reduce(function(e,t){var r=(0,eb.zs)(t,2),i=r[0],o=r[1];if(i.startsWith(n)){var s=i.replace(n,"");s&&(e[s]=o||"")}return e},{}),p=((r={})["[Amplitude] Element Hierarchy"]=c,r[rI]=u,r[rx]=o.getText(t),r["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),r["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),r["[Amplitude] Element Attributes"]=h,r["[Amplitude] Element Path"]=o.getElementPath(t),r["[Amplitude] Element Parent Label"]=f,r[r_]=rM(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=n1(o.replaceSensitiveString),r[rT]=window.innerHeight,r[rP]=window.innerWidth,r),v=rj();if(v&&(p[rO]=v),p["[Amplitude] Element ID"]=t.getAttribute("id")||"",p["[Amplitude] Element Class"]=t.getAttribute("class"),p["[Amplitude] Element Aria Label"]=null==d?void 0:d["aria-label"],"a"===u&&"click"===e&&t instanceof HTMLAnchorElement){var g=t.href.substring(0,128);p["[Amplitude] Element Href"]=o.replaceSensitiveString(g)}return rF(p)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var s=o.addTypeAndTimestamp(e,t);if(("click"===s.type||"change"===s.type)&&null!==s.event.target){if(i&&rL(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,r),s;var a=rq(s.event.target,n);a&&(s.closestTrackedAncestor=a,s.targetElementProperties=o.getEventProperties(s.type,a,r))}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=r2(e,t);if(n){if("TEXT"===e.elementExtractType)return o.getText(n);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return n.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(nX,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",s=Array.from(e.childNodes);try{for(var a=(0,eb.Ju)(s),u=a.next();!u.done;u=a.next()){var l=u.value;if(l.nodeType===Node.TEXT_NODE){i+=l.textContent||"";continue}if(l instanceof Element){if(l.hasAttribute(nX)||l.hasAttribute("contenteditable")){i+=n$;continue}i+=o.getTextWithMaskedDescendants(l)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},this.getText=function(e){if(null!==e.closest("[".concat(nX,"]")))return n$;var t="";return t=e.querySelector("[".concat(nX,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveStr
1ing(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){if(!e)return{};var t,n,r,i=null==(r=null==(n=null==e?void 0:e.tagName)?void 0:n.toLowerCase)?void 0:r.call(n);return rF(((t={})[rI]=i,t[rx]=o.getText(e),t[r_]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var s=null!=(i=e.maskTextRegex)?i:[],a=[];try{for(var u=(0,eb.Ju)(s),l=u.next();!l.done;l=u.next()){var c=l.value;if(a.length>=25)break;if(c instanceof RegExp)a.push(c);else if("pattern"in c&&"string"==typeof c.pattern)try{a.push(RegExp(c.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=a};(v=et||(et={})).ClickObservable="clickObservable",v.ChangeObservable="changeObservable",v.NavigateObservable="navigateObservable",v.MutationObservable="mutationObservable",v.ScrollObservable="scrollObservable",v.ExposureObservable="exposureObservable",v.BrowserErrorObservable="browserErrorObservable",v.SelectionObservable="selectionObservable",v.MouseMoveObservable="mouseMoveObservable";var iu=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",rE);var n,r,i,o,s,a,u,l,c,d,f,h,p,v=e.dataAttributePrefix,g=void 0===v?ru:v,m=e.visualTaggingOptions,y=void 0===m?{enabled:!0}:m;e.cssSelectorAllowlist=null!=(n=e.cssSelectorAllowlist)?n:ra,e.actionClickAllowlist=null!=(r=e.actionClickAllowlist)?r:rl,e.debounceTime=null!=(i=e.debounceTime)?i:0;var b=(null==(o=e.viewportContentUpdated)?void 0:o.enabled)!==!1,w=null!=(u=null!=(a=null==(s=e.viewportContentUpdated)?void 0:s.exposureDuration)?a:e.exposureDuration)?u:150;e.viewportContentUpdated=(0,eb.Cl)((0,eb.Cl)({},e.viewportContentUpdated),{exposureDuration:w}),e.pageUrlExcludelist=null==(l=e.pageUrlExcludelist)?void 0:l.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(e){console.warn("Invalid regex pattern: ".concat(t.pattern),e)}return e},[]);var S="@amplitude/plugin-autocapture-browser",k=[],E=new ia(e,t),C=new Set,I=new Set,x=function(){var t,n,r,i=rp(rZ().map(function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,g)})),o=rp(new(rd())(function(t){var n,r=function(n){var r=E.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,g);t.next(r)};return null==(n=(0,eI.m)())||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null==(e=(0,eI.m)())?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(r=rp(new(rd())(function(t){var n=function(n){var r=E.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,g);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var s=rp(rQ().map(function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,g)})),a=new(rd())(function(e){var t,n=function(t){e.next(t)};return null==(t=(0,eI.m)())||t.addEventListener("scroll",n),function(){var e;null==(e=(0,eI.m)())||e.removeEventListener("scroll",n)}}),u=(t=e.cssSelectorAllowlist,new(rd())(function(e){var n,r=(0,eI.m)();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var i=new IntersectionObserver(function(t){t.forEach(function(t){e.next(t)})},{root:null,rootMargin:"0px",threshold:1}),o=t.join(",");(null!=(n=null==r?void 0:r.document.querySelectorAll(o))?n:[]).forEach(function(e){i.observe(e)});var a=s.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(o)&&i.observe(e),e.querySelectorAll(o).forEach(function(e){i.observe(e)}))})})});return function(){a.unsubscribe(),i.disconnect()}}));return(n={})[et.ChangeObservable]=o,n[et.ClickObservable]=i,n[et.MutationObservable]=s,n[et.NavigateObservable]=r,n[et.ScrollObservable]=a,n[et.ExposureObservable]=u,n},_=r6(Object.values(null!=(d=null==(c=e.pageActions)?void 0:c.labeledEvents)?d:{})),T=r5(null!=(h=null==(f=e.pageActions)?void 0:f.triggers)?h:[]),P=new r7(_,T,E,e),O=function(t){var n,r;t&&(e.pageActions=(0,eb.Cl)((0,eb.Cl)({},e.pageActions),t),_=r6(Object.values(null!=(n=e.pageActions.labeledEvents)?n:{})),T=r5(null!=(r=e.pageActions.triggers)?r:[]),P.update(_,T,e))};return{name:S,type:"enrichment",setup:function(t,n){return(0,eb.sH)(void 0,void 0,void 0,function(){var r,i,o,s,a,u,l,c,d,f,h,v,m,_,T,A,R,M,D,L,H;return(0,eb.YH)(this,function(N){var U,F,j,q,z,Y,B,V,J,K,W,X,$,G,Q,Z,ee,en,er,ei,eo,es,ea,eu,el,ec,ed,ef,eh,ep,ev,eg,em,ey,ew,eS,ek,eE,eC;return"u"<typeof document?[2]:(r=!1,i={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){O(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),o=rN(e,e.cssSelectorAllowlist),s=rN(e,e.actionClickAllowlist),F=(U={allObservables:a=x(),amplitude:n,shouldTrackEvent:o,evaluateTriggers:P.evaluate.bind(P)}).amplitude,j=U.allObservables,q=U.shouldTrackEvent,z=U.evaluateTriggers,u=j.clickObservable.filter(rz).filter(function(e){return q("click",e.closestTrackedAncestor)}).map(function(e){return z(e)}).subscribe(function(e){null==F||F.track(rC,e.targetElementProperties)}),k.push(u),B=(Y={allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:o,evaluateTriggers:P.evaluate.bind(P)}).amplitude,V=Y.allObservables,J=Y.getEventProperties,K=Y.shouldTrackEvent,W=Y.evaluateTriggers,l=V.changeObservable.filter(rz).filter(function(e){return K("change",e.closestTrackedAncestor)}).map(function(e){return W(e)}).subscribe(function(e){null==B||B.track("[Amplitude] Element Changed",J("change",e.closestTrackedAncestor))}),k.push(l),$=(X={allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:o,shouldTrackActionClick:s}).amplitude,G=X.allObservables,Q=X.options,Z=X.getEventProperties,ee=X.shouldTrackEvent,en=X.shouldTrackActionClick,er=G.clickObservable,ei=G.mutationObservable,eo=G.navigateObservable,es=er.filter(function(e){return!ee("click",e.closestTrackedAncestor)}).map(function(e){var t=rq(e.event.target,Q.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=Z(e.type,e.closestTrackedAncestor)),e}).filter(rz).filter(function(e){return en("click",e.closestTrackedAncestor)}),ea=eo?rh(ei,eo):ei,eu=rh(es,ea),el=null,ec=null,(c=rf(eu,function(e){if(el&&(clearTimeout(el),el=null),"click"===e.type)ec=e,el=setTimeout(function(){el=null,ec=null},500);else if(ec){var t=ec;return ec=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==$||$.track(rC,Z("click",e.closestTrackedAncestor)))}))&&k.push(c),(ed={allObservables:a,amplitude:n}).amplitude,ef=ed.allObservables.scrollObservable,eh={maxX:0,maxY:0},ep=ef.subscribe(function(){var e,t,n,r,i=(0,eI.m)(),o=Math.floor(null!=(t=null!=(e=null==i?void 0:i.scrollX)?e:null==i?void 0:i.pageXOffset)?t:0),s=Math.floor(null!=(r=null!=(n=null==i?void 0:i.scrollY)?n:null==i?void 0:i.pageYOffset)?r:0);eh.maxX=Math.max(eh.maxX,o),eh.maxY=Math.max(eh.maxY,s)}),d={unsubscribe:function(){ep.unsubscribe()},getState:function(){return eh},reset:function(){eh.maxX=0,eh.maxY=0}},k.push(d),f={},h=(0,eI.m)(),v=function(e){e&&r||(setTimeout(function(){r=!1},100),r=!0,function(e){var t,n,r,i,o,s,a=e.amplitude,u=e.scrollTracker,l=e.currentElementExposed,c=e.elementExposedForPage,d=e.exposureTracker,f=e.isPageEnd,h=e.lastScroll,p=u.getState(),v=(0,eI.m)(),g=null!=(n=null==v?void 0:v.innerWidth)?n:0,m=null!=(r=null==v?void 0:v.innerHe
1ight)?r:0,y=((t={})[r_]=rM(null!=(s=null==(o=null==(i=null==v?void 0:v.location)?void 0:i.href)?void 0:o.split("?")[0])?s:""),t["[Amplitude] Max Page X"]=p.maxX+g,t["[Amplitude] Max Page Y"]=p.maxY+m,t[rT]=m,t[rP]=g,t["[Amplitude] Element Exposed"]=Array.from(l),t),b=rj();if(b&&(y[rO]=b),0===l.size&&p.maxX===h.maxX&&p.maxY===h.maxY){f&&(u.reset(),c.clear(),null==d||d.reset());return}null==a||a.track("[Amplitude] Viewport Content Updated",y),h.maxX=p.maxX,h.maxY=p.maxY,l.clear(),f&&(u.reset(),c.clear(),null==d||d.reset())}({amplitude:n,scrollTracker:d,currentElementExposed:I,elementExposedForPage:C,exposureTracker:f.exposure,isPageEnd:e,lastScroll:i}))},m=function(e){!C.has(e)&&(C.add(e),I.add(e),JSON.stringify(Array.from(I)).length>=18e3&&v(!1))},b&&(eg=(ev={allObservables:a,onExposure:m,dataExtractor:E,exposureDuration:w}).allObservables,em=ev.onExposure,ey=ev.dataExtractor,eS=void 0===(ew=ev.exposureDuration)?150:ew,ek=new Map,eE=new Map,eC=eg.exposureObservable.subscribe(function(e){var t=e.target;if(e.isIntersecting){if(!ek.get(t)){var n=setTimeout(function(){ek.set(t,!0),em(ey.getElementPath(t)),eE.set(t,null)},eS);eE.set(t,n)}}else if(!e.isIntersecting&&e.intersectionRatio<1){var n=eE.get(t);n&&(clearTimeout(n),eE.set(t,null))}}),f.exposure={unsubscribe:function(){eC.unsubscribe()},reset:function(){eE.forEach(function(e){e&&clearTimeout(e)}),eE.clear(),ek.clear()}},f.exposure&&k.push(f.exposure),_=function(){v(!0)},null==h||h.addEventListener("beforeunload",_),p=function(){null==h||h.removeEventListener("beforeunload",_)},k.push({unsubscribe:function(){return p()}}),(T=a[et.NavigateObservable])?k.push(T.subscribe(function(){v(!0)})):h&&(A=function(){v(!0)},h.addEventListener("popstate",A),R=h.history.pushState,h.history&&R&&(h.history.pushState=new Proxy(R,{apply:function(e,t,n){var r=(0,eb.zs)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),v(!0)}})),k.push({unsubscribe:function(){h.removeEventListener("popstate",A),h.history&&R&&(h.history.pushState=R)}}))),null==(H=null==t?void 0:t.loggerProvider)||H.log("".concat(S," has been successfully added.")),window.opener&&y.enabled&&(M=e.cssSelectorAllowlist,D=e.actionClickAllowlist,!function(e,t){if(!0!==e[rY]){e[rY]=!0;var n=t.dataExtractor,r=t.isElementSelectable,i=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,a=function(t){e.notify({action:"element-selected",data:t})},u=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var l;s=null==(l=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:l.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(e){return!r||r((null==t?void 0:t.actionType)||"click",e)},onTrack:u,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:i,actionClickAllowlist:o,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:rE}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null==(e=null==s?void 0:s.close)||e.call(s)})}}(L=rw(),{dataExtractor:E,isElementSelectable:rN(e,(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(M),!1),(0,eb.zs)(D),!1)),cssSelectorAllowlist:M,actionClickAllowlist:D}),rk(L),L.setup((0,eb.Cl)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:rg[t.serverZone]}))),[2])})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,eb.YH)(this,function(i){try{for(t=(e=(0,eb.Ju)(k)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},il=(0,eb.fX)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,eb.zs)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),ic=["*"],id=["mutation","navigate"];function ih(e,t){var n,r,i,o,s=t.event,a=s.pageX,u=s.pageY;e.yMin=Math.min(null!=(n=e.yMin)?n:u,u),e.yMax=Math.max(null!=(r=e.yMax)?r:u,u),e.xMin=Math.min(null!=(i=e.xMin)?i:a,a),e.xMax=Math.max(null!=(o=e.xMax)?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function ip(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:(0,eb.Cl)({"[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.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}(g=en||(en={})).INCREASING="increasing",g.DECREASING="decreasing",(m=er||(er={})).X="x",m.Y="y";var iv=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new(rd())(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};if(null===n){n=o;return}o.x>n.x?(r===en.DECREASING&&e.next(er.X),r=en.INCREASING):o.x<n.x&&(r===en.INCREASING&&e.next(er.X),r=en.DECREASING),o.y>n.y?(i===en.DECREASING&&e.next(er.Y),i=en.INCREASING):o.y<n.y&&(i===en.INCREASING&&e.next(er.Y),i=en.DECREASING),n=o})})};function ig(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function im(e){e.changes=[],e.startTime=void 0}function iy(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length&&!(i-t[r]<n);r++);0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var ib=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new(rd())(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},s=void 0,a=null;function u(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),im(n),im(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===er.X?n:i,r=+Date.now(),t.startTime=t.startTime||r,l=t.changes,c=t.changesThreshold,l.push(r),l.length>c&&l.shift();var t,r,l,c,d=function(e,t){var n=void 0;if(ig(e)&&(n=e.startTime),ig(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return d?(s=s||d,a=setTimeout(function(){u(),a=null},o)):u(),iy(n),iy(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},iw=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=e.thresholdMs;return ib({mouseDirectionChangeObservable:iv({allWindowObservables:r}),directionChanges:void 0===i?20:i,thresholdMs:void 0===o?2e3:o}).subscribe(function(e){rH(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function iS(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var ik=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,s=!1!==e.rageClicks&&null!==e.rageClicks,a=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(a=!1);var u=iS(e,"rageClicks",ic,s),l=iS(e,"deadClicks",il,o),c=iS(e,"errorClicks",il,i),d=null!=(t=e.dataAttributePrefix)?t:ru,f=new ia(e),h=(0,eb.fX)([],(0,eb.zs)(new Set((0,eb.fX)((0,eb.fX)((0,eb.fX)([],(0,eb.zs)(u),!1),(0,eb.zs)(l),!1),(0,eb.zs)(c),!1))),!1),p=function(){var e,t,n=rp(rZ("pointerdown").map(function(e){return f.addAdditionalEventProperties(e,"click",h,d,!0)})),r=rp(r0().map(function(e){return f.addTypeAndTimestamp(e,"error")})),i=rp(rQ().map(function(e){return f.addAdditionalEventProperties(e,"mutation",h,d)}));window.navigation&&(t=rp(new(rd())(function(e){var t=function(t){e.next((0,eb.Cl)((0,eb.Cl)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return f.addAdditionalEventProperties(e,"navigate",h,d)})));var o=rp(new(rd())(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){var n=void 0,r=void 0;try{if(n=t.selectionStart,r=t.selectionEnd,n===r)return}catch(e){return}return e.next()}var i=window.getSelection();if(i&&!i.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),s=rp(new(rd())(function(e){var t=function(t){e.next(t)},n={capture:!0};return rG.document.addEventListener("mousemove",t,n),function(){rG.document.removeEventListener("mousemove",t,n)}}));return(e={})[et.ClickObservable]=n,e[et.MutationObservable]=i,e[et.NavigateObservable]=t,e[et.BrowserErrorObservable]=r,e[et.SelectionObservable]=o,e[et.MouseMoveObservable]=s,e};return{name:n,type:"enrichment",setup:function(t,h){return(0,eb.sH)(void 0,void 0,void 0,function(){var v,g,m,y,b,w,S,k;return(0,eb.YH)(this,function(E){var C,I,x,_,T,P,O,A,R,M,D,L,H,N,U,F,j,q,z,Y,B,V;return"u"<typeof document?[2]:(v=p(),s&&(g=function(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,s=r.selectionObservable,a=[],u={},l=null;function c(e){a=[],u={},e&&(ih(u,e),a.push(e))}var d=rf(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,eb.sH)(t,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){var r,i,o,s;return(ih(u,e),t=null,0===a.length||(r=a).length>0&&r[r.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(o=Math.max(0,(i=a).length-4+1),s=i[o],e.timestamp-s.timestamp>=1e3)||u.isOutOfBounds)?(l&&(t=ip(a)),c(e)):a.push(e),(l&&(clearTimeout(l.timerId),l.resolve(t),l=null),a.length>=4)?[2,new Promise(function(e){l={resolve:e,timerId:setTimeout(function(){e(ip(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){c()}),h=d.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==f||f.unsubscribe()}}}({allObservables:v,amplitude:h,shouldTrackRageClick:rN(e,u)}),r.push(g)),o&&(I=(C={amplitude:h,allObservables:v,getEventProperties:function(e,t){return f.getEventProperties(e,t,d)},shouldTrackDeadClick:rN(e,l)}).amplitude,x=C.allObservables,_=C.getEventProperties,T=C.shouldTrackDeadClick,P=x.clickObservable,O=x.mutationObservable,A=x.navigateObservable,R=P.filter(function(e){return rz(e)&&T("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===ee.LEFT_OR_TOUCH_CONTACT}),M=A?rh(O,A):O,D=rh(R,M),L=null,m=rf(D,function(e){if(L&&id.includes(e.type))clearTimeout(L),L=null;else if("click"===e.type)return L?Promise.resolve(null):new Promise(function(t){L=setTimeout(function(){t(e),L=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};I.track("[Amplitude] Dead Click",(0,eb.Cl)((0,eb.Cl)({},_("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),r.push(m)),i&&(N=(H={amplitude:h,allObservables:v,shouldTrackErrorClick:rN(e,c)}).amplitude,U=H.allObservables,F=H.shouldTrackErrorClick,j=U.clickObservable,q=U.browserErrorObservable,z=j.filter(function(e){return rz(e)&&F("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===ee.LEFT_OR_TOUCH_CONTACT}),Y=null,B=null,V=function(){null!==Y&&(clearTimeout(Y),Y=null),B=null},y=rh(z,q).subscribe(function(e){var t;if("click"===e.type){V(),B=e,Y=setTimeout(V,2e3);return}"error"===e.type&&B&&(N.track("[Amplitude] Error Click",(0,eb.Cl)(((t={})["[Amplitude] Kind"]=e.event.kind,t["[Amplitude] Message"]=e.event.message,t["[Amplitude] Stack"]=e.event.stack,t["[Amplitude] Filename"]=e.event.filename,t["[Amplitude] Line Number"]=e.event.lineNumber,t["[Amplitude] Column Number"]=e.event.columnNumber,t),B.targetElementProperties)),V())}),r.push(y)),a&&(b=void 0,w=void 0,"object"==typeof e.thrashedCursor&&(b=e.thrashedCursor.directionChanges,w=e.thrashedCursor.threshold,b&&b<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(b," is below the minimum of ").concat(5,", setting to ").concat(5)),b=5),w&&w>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(w," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),w=4e3)),S=iw({amplitude:h,options:e,allObservables:v,directionChanges:b,thresholdMs:w}),r.push(S)),null==(k=null==t?void 0:t.loggerProvider)||k.log("".concat(n," has been successfully added.")),[2])})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,i;return(0,eb.YH)(this,function(o){try{for(t=(e=(0,eb.Ju)(r)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function iE(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}var iC=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return(0,eb.sH)(void 0,void 0,void 0,function(){var s,a,u;return(0,eb.YH)(this,function(l){return"u"<typeof document||(r&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=function(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("u"<typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var s=[],a=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=(0,eb.Ju)(e.getEntries()),o=i.next();!o.done;o=i.next()){var a=o.value;s.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;s.length>0&&s[0].startTime<u;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,a;try{for(var u=(0,eb.Ju)(e.getEntries()),l=u.next();!l.done;l=u.next()){var c=l.value;if(!rH(n))return;if(!(c.duration<i)){var d="long-animation-frame"===o?function(e,t){var n,r=iE(e,t),i=null!=(n=e.scripts)?n:[],o=i.map(function(e){return e.sourceURL}
1).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),a=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),u=i.map(function(e){return e.invokerType}).filter(Boolean),l=i.map(function(e){return e.invoker}).filter(Boolean);return(0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)((0,eb.Cl)({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),a.length>0&&{"[Amplitude] Main Thread Block Script Positions":a}),u.length>0&&{"[Amplitude] Main Thread Block Invoker Types":u}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}(c,s):function(e,t){var n,r=iE(e,t),i=null!=(n=e.attribution)?n:[];return(0,eb.Cl)((0,eb.Cl)({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}(c,s);t.track("[Amplitude] Main Thread Block",d)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),a.disconnect()}}}({amplitude:o,options:e,durationThreshold:s}),n.push(a)),null==(u=null==i?void 0:i.loggerProvider)||u.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,r,i;return(0,eb.YH)(this,function(o){try{for(t=(e=(0,eb.Ju)(n)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}};function iI(e,t,n){e&&function e(t){var n,r,i=t.json,o=t.targetObject,s=t.allowlist,a=t.excludelist,u=t.ancestors,l=t.parentObject,c=t.targetKey;o||(o=i);var d=Object.keys(o);try{for(var f=(0,eb.Ju)(d),h=f.next();!h.done;h=f.next()){var p,v=h.value,g=(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(u),!1),[v],!1);(p=o[v],"string"==typeof p||"number"==typeof p||"boolean"==typeof p||null==p)?(!i_(g,s)||i_(g,a))&&delete o[v]:e({json:i,targetObject:o[v],allowlist:s,excludelist:a,ancestors:g,parentObject:o,targetKey:v})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}0===Object.keys(o).length&&l&&c&&delete l[c]}({json:e,allowlist:t.map(ix),excludelist:n.map(ix),ancestors:[]})}function ix(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function i_(e,t){return t.some(function(t){return function e(t,n,r,i){if(void 0===r&&(r=0),void 0===i&&(i=0),i===n.length)return r===t.length;if(r===t.length){for(;i<n.length&&"**"===n[i];)i++;return i===n.length}var o=n[i];if("**"===o){if(i+1===n.length)return!0;for(var s=r;s<=t.length;s++)if(e(t,n,s,i+1))return!0;return!1}return("*"===o||o===t[r])&&e(t,n,r+1,i+1)}(e,t)})}var iT=function(){function e(e){this.request=e}return e.prototype.headers=function(e){void 0===e&&(e=[]);var t,n,r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=(0,eb.zs)(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=(0,eb.Ju)(Object.entries(r)),s=o.next();!s.done;s=o.next()){var a=(0,eb.zs)(s.value,2),u=a[0],l=a[1];i[u]=l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return iL(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=(0,eI.m)();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=iO(t,100),this._bodySize}}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return 0===e.length?[2,null]:[2,iM(this.body,e,t)]})})},e}(),iP=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),iL(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return iO(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,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return 0===e.length?[2,null]:[2,iM(this.body,e,t)]})})},e}();function iO(e,t){var n,r,i,o,s=(0,eI.m)(),a=null==s?void 0:s.TextEncoder;if(a){if("string"==typeof e)o=e,i=new a().encode(o).length;else if(e instanceof Blob)i=(o=e).size;else if(e instanceof URLSearchParams)o=e,i=new a().encode(o.toString()).length;else if(ArrayBuffer.isView(e))i=(o=e).byteLength;else if(e instanceof ArrayBuffer)i=(o=e).byteLength;else if(e instanceof FormData){var u=0,l=0;try{for(var c=(0,eb.Ju)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,eb.zs)(d.value,2),h=f[0],p=f[1];if(u+=h.length,"string"==typeof p)u+=new a().encode(p).length;else{if(!(p instanceof Blob))return;u+=p.size}if(++l>=t)return}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}i=u}else if(e instanceof ReadableStream){o=e;return}return i}}var iA=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.forEach)||t.call(n,function(e,t){r[t]=e}),iL(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(void 0!==this._bodySize)return this._bodySize;var e,t,n=null==(t=null==(e=this.response.headers)?void 0:e.get)?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,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,Promise.race([this.clonedResponse.text(),new Promise(function(e){return setTimeout(function(){return e(null)},500)})])];case 2:return[2,e.sent()];case 3:return e.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,iM(n.sent(),e,t)]}})})},e}(),iR=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){if(void 0===e&&(e=[]),!this.headersString)return{};var t,n,r={},i=this.headersString.split("\r\n");try{for(var o=(0,eb.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,eb.zs)(a.split(": "),2),l=u[0],c=u[1];l&&c&&(r[l]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return iL(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,eb.sH)(this,void 0,void 0,function(){var n;return(0,eb.YH)(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(iI(n,e,t),[2,n]):[2,null]})})},e}();function iM(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return iI(r,t,n),r}catch(e){return null}}(y=ei||(ei={})).REDACT="redact",y.REMOVE="remove";var iD="[REDACTED]",iL=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?ei.REMOVE:s,u=(0,eb.fX)([],(0,eb.zs)(td),!1),l={};try{for(var c=(0,eb.Ju)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var f=d.value;!function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?a===ei.REDACT&&(l[t]=iD):o.find(function(e){return e.toLowerCase()===n})?l[t]=e[t]:a===ei.REDACT&&(l[t]=iD)}(f)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return l},iH=function(){function e(e,t,n,r,i,o,s,a,u,l,c){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=l,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,n,r;
1return Object.fromEntries(Object.entries({type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null==(e=this.requestWrapper)?void 0:e.headers((0,eb.fX)([],(0,eb.zs)(tc),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(n=this.responseWrapper)?void 0:n.headers((0,eb.fX)([],(0,eb.zs)(tc),!1)),responseBodySize:null==(r=this.responseWrapper)?void 0:r.bodySize}).filter(function(e){var t=(0,eb.zs)(e,2);return void 0!==(t[0],t[1])}))},e}(),iN=function(e,t){void 0===t&&(t=e_()),this.callback=e,this.id=t};function iU(e){try{e()}catch(e){}}var iF=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=(0,eI.m)();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=(0,eI.m)();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,a,u,l,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null==(i=null==(r=null==(n=this.globalScope)?void 0:n.XMLHttpRequest)?void 0:r.prototype)?void 0:i.open,h=null==(a=null==(s=null==(o=this.globalScope)?void 0:o.XMLHttpRequest)?void 0:s.prototype)?void 0:a.send,p=null==(c=null==(l=null==(u=this.globalScope)?void 0:u.XMLHttpRequest)?void 0:l.prototype)?void 0:c.setRequestHeader;f&&h&&p&&this.observeXhr(f,h,p);var v=null==(d=this.globalScope)?void 0:d.fetch;v&&this.observeFetch(v),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){try{n.callback(e)}catch(e){iU(function(){var n;null==(n=t.logger)||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){if(void 0!==o&&void 0!==s){var a,u,l,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(u=t.url,d=t.method):u=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(l=r.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var h=Math.floor(performance.now()-s),p=Math.floor(o+h),v=new iH(e,d,o,o,u,n,l,h,r,c,p);this.triggerEventCallbacks(v)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null==(e=Date.now)?void 0:e.call(Date),durationStart:null==(t=null==performance?void 0:performance.now)?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return(0,eb.sH)(t,void 0,void 0,function(){var t,i,o,s=this;return(0,eb.YH)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){iU(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new iT(r):void 0,i?new iA(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){iU(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null==(n=t.globalScope)?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){n instanceof Error&&"InvalidStateError"===n.name&&iU(function(){var n;return null==(n=t.logger)?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))})}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=(0,eb.zs)(n,2),s=i[0],a=i[1];try{this.$$AmplitudeAnalyticsEvent=(0,eb.Cl)({method:s,url:null==(e=null==a?void 0:a.toString)?void 0:e.call(a),headers:{}},o.getTimestamps())}catch(e){iU(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new iR(i.status,e,t?parseInt(t,10):void 0,s),r=i.$$AmplitudeAnalyticsEvent.headers,l=new iP(a,r);u.status=i.status,o.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},l,n,void 0,u.startTime,u.durationStart)}catch(e){iU(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){iU(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}()),ij="[Amplitude] Network Request",iq="500-599";function iz(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function iY(e,t){var n,r,i=t.split(",");try{for(var o=(0,eb.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,eb.zs)(a.split("-").map(Number),2),l=u[0],c=u[1];if(e===l&&void 0===c||e>=l&&e<=c)return!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function iB(e){var t;if(e)try{var n=null==(t=(0,eI.m)())?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,a=r.host;r.hash="",r.search="";var u=r.href;return{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:u,host:a}}catch(e){return}}function iV(e){return"object"!=typeof e||null===e?e?(0,eb.fX)([],(0,eb.zs)(tc),!1):void 0:0!==e.length?e:void 0}function iJ(e){var t,n,r;return!(null==(t=null==e?void 0:e.allowlist)?void 0:t.length)&&!(null==(n=null==e?void 0:e.blocklist)?void 0:n.length)&&!(null==(r=null==e?void 0:e.excludelist)?void 0:r.length)}(eo||(eo={})).NetworkObservable="networkObservable";var iK=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new(rd())(function(e){var n=new iN(function(t){var n={event:t,timestamp:Date.now(),type:"network"};e.next(n)});return iF.subscribe(n,t),function(){iF.unsubscribe(n)}});return(e={})[eo.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return(0,eb.sH)(void 0,void 0,void 0,function(){var s;return(0,eb.YH)(this,function(a){var u,l,c,d,f;return"u"<typeof document?[2]:(s=r(),t=null==i?void 0:i.loggerProvider,l=(u={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,c=u.networkTrackingOptions,d=u.amplitude,f=u.loggerProvider,es=l.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var n,r,i=iB(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(iz(o,"*.amplitude.com")||iz(o,"amplitude.com"))||(null==(n=t.ignoreHosts)?void 0:n.find(function(e){return iz(o,e)})))&&(!!t.captureRules||void 0===e.status||!!iY(e.status,iq))&&(!t.captureRules||((0,eb.fX)([],(0,eb.zs)(t.captureRules),!1).reverse().find(function(t){if(r=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return iz(t,e)}))&&(!r||!e.urls||rR(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!n&&0!==n||!!iY(n,e.statusCodeRange||iq))&&!0}(t,o,e.status,e.url,e.method)){var n=iV(t.responseHeaders);if(e.responseWrapper&&n){var i=e.responseWrapper.headers(n);i&&(e.responseHeaders=i)}var s=iV(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!iJ(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!iJ(t.requestBody)){var u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==r}),!!r))&&!(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===ij}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,n,r,i=e.event,o=iB(i.url);if(o){var s=null==(n=i.responseWrapper)?void 0:n.bodySize,a=null==(r=i.requestWrapper)?void 0:r.bodySize;!function(e,t,n,r){(0,eb.sH)(this,void 0,void 0,function(){var i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:if(!(t.requestBodyJson||t.responseBodyJson))return[3,2];return[4,Promise.all([t.requestBodyJson,t.responseBodyJson])];case 1:if(o=(i=eb.zs.apply(void 0,[a.sent(),2]))[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==r||r.debug("Failed to stringify response body")}a.label=2;case 2:return null==n||n.track(ij,e),[2]}})})}(((t={})["[Amplitude] URL"]=o.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=o.query,t["[Amplitude] URL Fragment"]=o.fragment,t["[Amplitude] Request Method"]=i.method,t["[Amplitude] Status Code"]=i.status,t["[Amplitude] Start Time"]=i.startTime,t["[Amplitude] Completion Time"]=i.endTime,t["[Amplitude] Duration"]=i.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=s,t["[Amplitude] Request Type"]=i.type,t["[Amplitude] Request Headers"]=i.requestHeaders,t["[Amplitude] Response Headers"]=i.responseHeaders,t),i,d,f)}}),null==t||t.log("".concat(n," has been successfully added.")),[2])})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return es.unsubscribe(),[2]})})}}};let iW=-1,iX=e=>{addEventListener("pageshow",t=>{t.persisted&&(iW=t.timeStamp,e(t))},!0)},i$=(e,t,n,r)=>{let i,o;return s=>{let a;t.value>=0&&(s||r)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,a=t.value,t.rating=a>n[1]?"poor":a>n[0]?"needs-improvement":"good",e(t))}},iG=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},iQ=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},iZ=()=>{let e=iQ();return e?.activationStart??0},i0=(e,t=-1)=>{let n=iQ(),r="navigate";return iW>=0?r="back-forward-cache":n&&(document.prerendering||iZ()>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(0x82f79cd8fff*Math.random())+1e12}`,navigationType:r}},i1=new WeakMap;function i2(e,t){return i1.get(e)||i1.set(e,new t),i1.get(e)}class i3{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let 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)}}let i4=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},i6=e=>{let t=!1;return()=>{t||(e(),t=!0)}},i5=-1,i8=new Set,i7=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,i9=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of i8)e();isFinite(i5)||(i5="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",i9,!0))}},oe=()=>{if(i5<0){let e=iZ();i5=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??i7(),addEventListener("visibilitychange",i9,!0),addEventListener("prerenderingchange",i9,!0),iX(()=>{setTimeout(()=>{i5=i7()})})}return{get firstHiddenTime(){return i5},onHidden(e){i8.add(e)}}},ot=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},on=[1800,3e3],or=(e,t={})=>{ot(()=>{let n=oe(),r,i=i0("FCP"),o=i4("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-iZ(),0),i.entries.push(t),r(!0)))});o&&(r=i$(e,i,on,t.reportAllChanges),iX(n=>{r=i$(e,i=i0("FCP"),on,t.reportAllChanges),iG(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},oi=[.1,.25],oo=0,os=1/0,oa=0,ou=e=>{for(let t of e)t.interactionId&&(os=Math.min(os,t.interactionId),oo=(oa=Math.max(oa,t.interactionId))?(oa-os)/7+1:0)},ol=()=>r?oo:performance.interactionCount??0,oc=0;class od{u=[];l=new Map;m;p;v(){oc=ol(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((ol()-oc)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;let t=this.u.at(-1),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)=>
1t.P-e.P),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);this.p?.(n)}}}let of=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=i6(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},oh=[200,500];class op{m;h(e){this.m?.(e)}}let ov=[2500,4e3],og=[800,1800],om=e=>{document.prerendering?ot(()=>om(e)):"complete"!==document.readyState?addEventListener("load",()=>om(e),!0):setTimeout(e)};function oy(e){var t,n;return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor((n=(null==(t=e.entries[0])?void 0:t.startTime)||0,performance.timeOrigin+n)),navigationStart:Math.floor(performance.timeOrigin)}}var ob=function(){var e=null,t=(0,eI.m)(),n=null==t?void 0:t.document,i=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,o){return(0,eb.sH)(void 0,void 0,void 0,function(){var s,a;return(0,eb.YH)(this,function(u){return void 0===n||(s=rM((null==i?void 0:i.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==i?void 0:i.hostname)||"","[Amplitude] Page Location":s,"[Amplitude] Page Path":rM((null==i?void 0:i.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"u">typeof document&&document.title||"","[Amplitude] Page URL":rM(s.split("?")[0],t.loggerProvider)},((e,t={})=>{ot(()=>{let n=oe(),r,i=i0("LCP"),o=i2(t,op),s=e=>{for(let s of(t.reportAllChanges||(e=e.slice(-1)),e))o.h(s),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-iZ(),0),i.entries=[s],r())},a=i4("largest-contentful-paint",s);if(a){r=i$(e,i,ov,t.reportAllChanges);let n=i6(()=>{s(a.takeRecords()),a.disconnect(),r(!0)}),o=e=>{e.isTrusted&&(of(n),removeEventListener(e.type,o,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});iX(n=>{r=i$(e,i=i0("LCP"),ov,t.reportAllChanges),iG(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})})(function(e){a["[Amplitude] LCP"]=oy(e)}),or(function(e){a["[Amplitude] FCP"]=oy(e)}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=oe();ot(()=>{"interactionCount"in performance||r||(r=i4("event",ou,{type:"event",buffered:!0,durationThreshold:0}));let i,o=i0("INP"),s=i2(t,od),a=e=>{of(()=>{for(let t of e)s.h(t);let t=s.L();t&&t.P!==o.value&&(o.value=t.P,o.entries=t.entries,i())})},u=i4("event",a,{durationThreshold:t.durationThreshold??40});i=i$(e,o,oh,t.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{a(u.takeRecords()),i(!0)}),iX(()=>{s.v(),i=i$(e,o=i0("INP"),oh,t.reportAllChanges)}))})})(function(e){a["[Amplitude] INP"]=oy(e)}),((e,t={})=>{let n=oe();or(i6(()=>{let r,i=i0("CLS",0),o=i2(t,i3),s=e=>{for(let t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,r())},a=i4("layout-shift",s);a&&(r=i$(e,i,oi,t.reportAllChanges),n.onHidden(()=>{s(a.takeRecords()),r(!0)}),iX(()=>{o.i=0,r=i$(e,i=i0("CLS",0),oi,t.reportAllChanges),iG(()=>r())}),setTimeout(r))}))})(function(e){a["[Amplitude] CLS"]=oy(e)}),((e,t={})=>{let n=i0("TTFB"),r=i$(e,n,og,t.reportAllChanges);om(()=>{let i=iQ();i&&(n.value=Math.max(i.responseStart-iZ(),0),n.entries=[i],r(!0),iX(()=>{(r=i$(e,n=i0("TTFB",0),og,t.reportAllChanges))(!0)}))})})(function(e){a["[Amplitude] TTFB"]=oy(e)}),e=function(){"hidden"===n.visibilityState&&e&&(o.track("[Amplitude] Web Vitals",a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},ow=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),["AMP",t,e.substring(0,n)].filter(Boolean).join("_")},oS=function(){function e(e,t){var n;this.shouldTrackNewCampaign=!1,this.options=(0,eb.Cl)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:nF((null==(n=t.cookieOptions)?void 0:n.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=ow(t.apiKey,"MKTG"),this.webExpStorageKey=ow(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=tl,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=eb.zs.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||tF(this.sessionTimeout,this.lastEventTime),!nH(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e;return(0,eb.YH)(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:if(!(e=t.sent()))return[3,3];return[4,this.storage.remove(this.webExpStorageKey)];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new n3().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r=(t=this.currentCampaign,n=this.options,tL(Object.entries((0,eb.Cl)((0,eb.Cl)({},tl),t)).reduce(function(e,t){var r,i=(0,eb.zs)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!=(r=null!=s?s:n.initialEmptyValue)?r:"EMPTY"),s)?e.set(o,s):e.unset(o)},new tM)));return e&&(r.event_id=e),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ok=new Set([G.IDENTIFY,G.GROUP_IDENTIFY]),oE=function(e){void 0===e&&(e={});var t,n,r,i,o,s,a,u=null!=(t=e.fallbackAttributionEvent)&&t,l=(0,eI.m)(),c={},d=!1,f=!1,h=function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:return[4,new n3().parse()];case 1:return c=n2(e.sent()),u&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",c)),[2]}})})},p=function(){h()},v=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),d&&p()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(u){switch(u.label){case 0:return n=t,r=e.loggerProvider,d=!0,r.log("Installing event property attribution tracking."),[4,h()];case 1:if(u.sent(),!l)return[2];if(l.addEventListener("popstate",p),!f){if(i=Reflect.get(l.history,"pushState"),o=Reflect.get(l.history,"replaceState"),!i||!o)return[2];s=v(i),l.history.pushState=s,a=v(o),l.history.replaceState=a,f=!0}return[2]}})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return ok.has(e.event_type)||(e.event_properties=(0,eb.Cl)((0,eb.Cl)({},c),e.event_properties)),[2,e]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e,t;return(0,eb.YH)(this,function(n){return l&&(l.removeEventListener("popstate",p),e=Reflect.get(l.history,"pushState"),t=Reflect.get(l.history,"replaceState"),f&&e===s&&i&&(l.history.pushState=i),f&&t===a&&o&&(l.history.replaceState=o)),d=!1,f=!1,i=void 0,o=void 0,s=void 0,a=void 0,c={},[2]})})}}},oC="AMP_CURRENT_PAGE",oI="AMP_PREVIOUS_PAGE",ox="AMP_URL_INFO";(b=ea||(ea={})).Direct="direct",b.Internal="internal",b.External="external";var o_=new Set([G.IDENTIFY,G.GROUP_IDENTIFY,G.REVENUE]),oT=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=(0,eI.m)(),i=void 0,o=!1,s=void 0,a=!1,u=!1,l=function(e){var t;try{var n=rM(e,s);
1t=new URL(n).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="u">typeof location&&location.hostname||"",r=e?l(e):void 0;if(!r)return ea.Direct;var i=n.some(function(e){return -1!==t.indexOf(e)}),o=n.some(function(e){return -1!==r.indexOf(e)});return t===r||o&&i?ea.Internal:ea.External},d=function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,r,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(ox)];case 1:return e=a.sent(),t=rM("u">typeof location&&location.href||""),n=(null==e?void 0:e[oC])||"",r=void 0,r=t===n?(null==e?void 0:e[oI])||"":n||document.referrer||"",[4,i.set(ox,((s={})[oC]=t,s[oI]=r,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},f=function(){d()};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,eb.sH)(void 0,void 0,void 0,function(){var t,n,c,h,p,v,g,m;return(0,eb.YH)(this,function(y){switch(y.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!r)return[3,7];try{i=new nu(r.sessionStorage)}catch(e){null==s||s.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:if(o=null!=(m=y.sent())&&m,!(i&&o))return[3,6];return n=(t="u">typeof document&&document.referrer||"")?l(t):void 0,c="u">typeof location&&location.hostname||"",h=rM("u">typeof location&&location.href||""),[4,i.get(ox)];case 2:if(v=(null==(p=y.sent())?void 0:p[oC])||"",!(n&&n!==c&&v!==h))return[3,4];return[4,i.set(ox,((g={})[oC]=h,g[oI]=t,g))];case 3:return y.sent(),[3,6];case 4:return[4,d()];case 5:y.sent(),y.label=6;case 6:r.addEventListener("popstate",f),a||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=(0,eb.zs)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),u&&f()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=(0,eb.zs)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),u&&f()}}),a=!0),y.label=7;case 7:return[2]}})})},execute:function(e){return(0,eb.sH)(void 0,void 0,void 0,function(){var t,n,r;return(0,eb.YH)(this,function(s){switch(s.label){case 0:if(t=rM("u">typeof location&&location.href||""),!(i&&o))return[3,2];return[4,i.get(ox)];case 1:if(r=(null==(n=s.sent())?void 0:n[oI])||"",o_.has(e.event_type))return[2,e];e.event_properties=(0,eb.Cl)((0,eb.Cl)({},e.event_properties||{}),{"[Amplitude] Page Domain":oP(e,"[Amplitude] Page Domain","u">typeof location&&location.hostname||""),"[Amplitude] Page Location":oP(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":oP(e,"[Amplitude] Page Path","u">typeof location&&rM(location.pathname)||""),"[Amplitude] Page Title":oP(e,"[Amplitude] Page Title",n1(n0)),"[Amplitude] Page URL":oP(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":c(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:if(r&&(r.removeEventListener("popstate",f),u=!1),!(i&&o))return[3,2];return[4,i.set(ox,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function oP(e,t,n){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?n:e.event_properties[t]}var oO=function(){var e,t,n;function r(t){if(t)try{var n=Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}return{name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return(0,eb.sH)(void 0,void 0,void 0,function(){var o,s;return(0,eb.YH)(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null==(s=i.remoteConfig)?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body?r(e.body||""):r("")}),t=function(){var e;return null==(e=i.remoteConfigClient)?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return(0,eb.sH)(void 0,void 0,void 0,function(){var r;return(0,eb.YH)(this,function(i){if(n)try{return[2,null!=(r=n(t))?r:null]}catch(t){null==e||e.error("Could not execute custom enrichment function",t)}return[2,t]})})},teardown:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return t&&t(),[2]})})}}},oA="userProperty",oR="eventProperty",oM=function(e){return e===oA||e===oR},oD=function(e){var t=(0,eb.fX)([],(0,eb.zs)(new Set((Array.isArray(e)?e:[e]).filter(oM))),!1);return t.length>0?t:[oA]},oL=function(e,t){return oD(e.trackingMethod).includes(t)},oH=function(e){return oL(e,oA)},oN=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return(0,eb.C6)(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>
12?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ew(this._init((0,eb.Cl)((0,eb.Cl)({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,o,s,a,u,l;return(0,eb.sH)(this,void 0,void 0,function(){var c,d,f,h,p,v,g,m,y,b,w,S,k,E,C=this;return(0,eb.YH)(this,function(I){var x,_,T,P,O,A,R,M,D;switch(I.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,c=nK(t),d=null!=(n=t.loggerProvider)?n:new eE,t.loggerProvider||d.enable(null!=(r=t.logLevel)?r:eS.$.Warn),f=null!=(i=t.serverZone)?i:"US",p=this._diagnosticsSampleRate,v=null==(o=t.enableDiagnostics)||o,!c)return[3,2];return h=new eT(t.apiKey,d,f,null==(s=t.remoteConfig)?void 0:s.serverUrl),[4,new Promise(function(e){null==h||h.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(p=i);var o=t.enabled;"boolean"==typeof o&&(v=o)}e()})})];case 1:I.sent(),I.label=2;case 2:return(g=new eY(t.apiKey,d,f,{enabled:v,sampleRate:p})).setTag("library","".concat(t7,"/").concat(t8)),"u">typeof navigator&&g.setTag("user_agent",navigator.userAgent),[4,(x=t.apiKey,_=t,T=this,P=g,O={loggerProvider:d,serverZone:f,enableDiagnostics:v,diagnosticsSampleRate:p},void 0===_&&(_={}),(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,l,c,d,f,h,p,v,g,m,y,b,w,S,k,E,C,I,A,R,M,D,L,H,N,U,F,j,q,z,Y,B,V,J,K,W,X,$,G,Q,Z,ee,et;return(0,eb.YH)(this,function(en){var er,ei,eo,es;switch(en.label){case 0:if(e=_.identityStorage||nM,t="",!(e===nM&&!(null==(S=_.cookieOptions)?void 0:S.domain)&&(null==(k=_.cookieOptions)?void 0:k.domain)!==""))return[3,2];return[4,(er=void 0,ei=P,(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:return[4,new nn(void 0,{diagnosticsClient:ei}).isEnabled()];case 1:if(!a.sent()||!er&&("u"<typeof location||!location.hostname)||1===(t=(e=null!=er?er:location.hostname).split(".")).length)return[2,""];for(n=[],r=1,nz.find(function(t){return e.endsWith(".".concat(t))})&&(r=2),i=t.length-r-1;i>=0;--i)n.push(t.slice(i).join("."));i=0,a.label=2;case 2:if(!(i<n.length))return[3,7];o=n[i],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,nn.isDomainWritable(o)];case 4:if(a.sent())return[2,"."+o];return[3,6];case 5:return s=a.sent(),ei&&ei.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(o),error:s instanceof Error?s.message:String(s)}),[3,6];case 6:return i++,[3,2];case 7:return ei&&ei.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=en.sent(),en.label=2;case 2:return n=(0,eb.Cl)({domain:null!=(C=null==(E=_.cookieOptions)?void 0:E.domain)?C:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},_.cookieOptions),r={duplicateResolverFn:function(e){var t=no(e);return!!t&&ns(JSON.parse(t).cookieDomain,n.domain)},diagnosticsClient:P},[4,(eo=i=nJ(_.identityStorage,n,r),void 0===(es=null==(A=null==(I=_.cookieOptions)?void 0:I.upgrade)||A)&&(es=!0),(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u;return(0,eb.YH)(this,function(l){switch(l.label){case 0:return e="".concat("amp","_").concat(x.substring(0,6)),[4,eo.getRaw(e)];case 1:if(!(t=l.sent()))return[2,{optOut:!1}];if(!es)return[3,3];return[4,eo.remove(e)];case 2:l.sent(),l.label=3;case 3:return r=(n=(0,eb.zs)(t.split("."),6))[0],i=n[1],o=n[2],s=n[3],a=n[4],u=n[5],[2,{deviceId:r,userId:ny(i),sessionId:nm(s),lastEventId:nm(u),lastEventTime:nm(a),optOut:!!o}]}})}))];case 3:return o=en.sent(),[4,i.get(na(x))];case 4:return s=en.sent(),l=!(u=(a=eB()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<u,c=null!=(H=null!=(L=null!=(D=null!=(R=_.deviceId)?R:l?null!=(M=a.ampDeviceId)?M:a.deviceId:void 0)?D:null==s?void 0:s.deviceId)?L:o.deviceId)?H:e_(),d=null!=(N=null==s?void 0:s.lastEventId)?N:o.lastEventId,f=null!=(U=null==s?void 0:s.lastEventTime)?U:o.lastEventTime,h=null!=(j=null!=(F=_.optOut)?F:null==s?void 0:s.optOut)?j:o.optOut,p=null!=(q=null==s?void 0:s.sessionId)?q:o.sessionId,v=null==s?void 0:s.deferredSessionId,g=null!=(Y=null!=(z=_.userId)?z:null==s?void 0:s.userId)?Y:o.userId,T.previousSessionDeviceId=null!=(B=null==s?void 0:s.deviceId)?B:o.deviceId,T.previousSessionUserId=null!=(V=null==s?void 0:s.userId)?V:o.userId,m={ipAddress:null==(K=null==(J=_.trackingOptions)?void 0:J.ipAddress)||K,language:null==(X=null==(W=_.trackingOptions)?void 0:W.language)||X,platform:null==(G=null==($=_.trackingOptions)?void 0:$.platform)||G},y=null==s?void 0:s.pageCounter,b=null==s?void 0:s.debugLogsEnabled,void 0!==_.autocapture&&(_.defaultTracking=_.autocapture),[4,(w=new nV(x,_.appVersion,i,n,_.defaultTracking,_.autocapture,c,_.flushIntervalMillis,_.flushMaxRetries,_.flushQueueSize,e,_.ingestionMetadata,_.instanceName,d,f,null!=(Q=null==O?void 0:O.loggerProvider)?Q:_.loggerProvider,_.logLevel,_.minIdLength,_.offline,h,_.partnerId,_.plan,_.serverUrl,null!=(Z=null==O?void 0:O.serverZone)?Z:_.serverZone,p,v,_.sessionTimeout,_.storageProvider,m,_.transport,_.useBatch,_.fetchRemoteConfig,g,y,b,_.networkTrackingOptions,_.identify,null!=(ee=null==O?void 0:O.enableDiagnostics)?ee:_.enableDiagnostics,null!=(et=null==O?void 0:O.diagnosticsSampleRate)?et:T._diagnosticsSampleRate,P,_.remoteConfig,t,_.enableRequestBodyCompression,_.customEnrichment)).storageProvider.isEnabled()];case 5:return en.sent()||(w.loggerProvider.warn("Storage provider ".concat(w.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),w.storageProvider=new ne),[2,w]}})}))];case 3:if(m=I.sent(),!(c&&h))return[3,5];return[4,new Promise(function(e){null==h||h.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){m.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&function(e,t){if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var n,r,i,o,s,a,u,l,c,d,f,h,p=Object.keys(t);try{for(var v=(0,eb.Ju)(p),g=v.next();!g.done;g=v.next()){var m=g.value;try{var y=t[m];"boolean"==typeof(null==y?void 0:y.enabled)&&(y.enabled?(delete y.enabled,0===Object.keys(y).length&&(t[m]=!0)):t[m]=!1),e(y)}catch(e){}}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}
1try{if(null==(c=null==(l=null==(u=t.autocapture)?void 0:u.networkTracking)?void 0:l.captureRules)?void 0:c.length)try{for(var b=(0,eb.Ju)(t.autocapture.networkTracking.captureRules),w=b.next();!w.done;w=b.next()){var S=w.value;try{for(var k=(s=void 0,(0,eb.Ju)(["responseHeaders","requestHeaders"])),E=k.next();!E.done;E=k.next()){var C=E.value,I=null!=(d=S[C])?d:{},x=I.captureSafeHeaders,_=I.allowlist;if(x||_){if(void 0!==_&&!Array.isArray(_)){delete S[C];continue}S[C]=(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(x?tc:[]),!1),(0,eb.zs)(null!=_?_:[]),!1)}}}catch(e){s={error:e}}finally{try{E&&!E.done&&(a=k.return)&&a.call(k)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}catch(e){}var T=null==(f=t.autocapture)?void 0:f.frustrationInteractions;T&&(T.rageClick&&(T.rageClicks=T.rageClick,delete T.rageClick),T.deadClick&&(T.deadClicks=T.deadClick,delete T.deadClick));try{var P=null==(h=t.autocapture)?void 0:h.elementInteractions;if(P&&"object"==typeof P&&(!0===P.viewportContentUpdated&&(P.viewportContentUpdated={}),!1===P.viewportContentUpdated&&(P.viewportContentUpdated={enabled:!1}),void 0!==P.exposureDuration)){var O=P.viewportContentUpdated;void 0===O?P.viewportContentUpdated={exposureDuration:P.exposureDuration}:"object"==typeof O&&void 0===O.exposureDuration&&!1!==O.enabled&&(O.exposureDuration=P.exposureDuration),delete P.exposureDuration}}catch(e){}}}(e);try{var n,r,i,o,s,a,u;if(t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var l=(0,eb.Cl)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(i=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:i.length)){l.elementInteractions=(0,eb.Cl)({},e.autocapture.elementInteractions);var c=l.elementInteractions,d=null!=(o=c.pageUrlAllowlist)?o:[],f=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=rs(d,f,t),delete c.pageUrlAllowlistRegex}if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null==(s=e.autocapture.networkTracking.captureRules)?void 0:s.length)){l.networkTracking=(0,eb.Cl)({},e.autocapture.networkTracking);var h=null!=(a=l.networkTracking.captureRules)?a:[];try{for(var p=(0,eb.Ju)(h),v=p.next();!v.done;v=p.next()){var g=v.value;g.urls=rs(null!=(u=g.urls)?u:[],g.urlsRegex,t),delete g.urlsRegex}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=(0,eb.Cl)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},l)),"object"==typeof t.autocapture&&(t.autocapture=(0,eb.Cl)((0,eb.Cl)({},t.autocapture),l))}t.defaultTracking=t.autocapture}"customEnrichment"in e&&null!==e.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=e.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}(t,m),e()})})];case 4:I.sent(),I.label=5;case 5:return[4,e.prototype._init.call(this,m)];case 6:if(I.sent(),this.logBrowserOptions(m),this.config.remoteConfigClient=h,y=tV((A=this.config).defaultTracking)&&A.defaultTracking&&"object"==typeof A.defaultTracking&&A.defaultTracking.attribution&&"object"==typeof A.defaultTracking.attribution?(0,eb.Cl)({},A.defaultTracking.attribution):{},!(tV(this.config.defaultTracking)&&oH(y)))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,eb.sH)(C,void 0,void 0,function(){return(0,eb.YH)(this,function(t){switch(t.label){case 0:if(e)return[3,2];return this.webAttribution=new oS(y,this.config),[4,this.webAttribution.init()];case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new oS(y,this.config),[4,this.webAttribution.init()];case 7:I.sent(),I.label=8;case 8:if(S=!(!(w=(b=eB()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<w)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),-1!==(k=this.config.deferredSessionId)||this.config.optOut||(k=Date.now()),this.setSessionId(null!=(l=null!=(u=null!=(a=t.sessionId)?a:S)?u:k)?l:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,eb.sH)(C,void 0,void 0,function(){return(0,eb.YH)(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(E=tf(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(ro()).promise];case 9:I.sent(),I.label=10;case 10:return[4,this.add(new tP({diagnosticsClient:g})).promise];case 11:return I.sent(),[4,this.add(new t9).promise];case 12:return I.sent(),[4,this.add(new tO).promise];case 13:if(I.sent(),ri(this.config),!tB(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(rn()).promise];case 14:I.sent(),I.label=15;case 15:if(!tJ(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(n9()).promise];case 16:I.sent(),I.label=17;case 17:if(!tK(this.config.defaultTracking))return[3,20];if(this.config.optOut)return[3,19];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(n6(t2(this.config))).promise];case 18:return I.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return(0,eb.sH)(C,void 0,void 0,function(){return(0,eb.YH)(this,function(t){switch(t.label){case 0:if(e)return[2];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(n6(t2(this.config))).promise];case 1:return t.sent(),[2]}})})}),I.label=20;case 20:if(!(tV(this.config.defaultTracking)&&oL(y,oR)))return[3,22];return this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(oE(y)).promise];case 21:I.sent(),I.label=22;case 22:if(!t$(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(iu(tZ(this.config),{diagnosticsClient:g})).promise];case 23:I.sent(),I.label=24;case 24:if(!tG(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(ik(t0(this.config))).promise];
1case 25:I.sent(),I.label=26;case 26:if(!tX(this.config.autocapture))return[3,28];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(iK(t1(this.config))).promise];case 27:I.sent(),I.label=28;case 28:if(!("boolean"==typeof(R=this.config.autocapture)?R:"object"==typeof R&&!0===R.webVitals))return[3,30];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(ob()).promise];case 29:I.sent(),I.label=30;case 30:if("object"!=typeof(M=this.config.autocapture)||!0!==M.performanceTracking&&"object"!=typeof M.performanceTracking)return[3,32];return this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(iC(tQ(this.config))).promise];case 31:I.sent(),I.label=32;case 32:if(!tB(this.config.autocapture,"pageUrlEnrichment"))return[3,34];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(oT()).promise];case 33:I.sent(),I.label=34;case 34:if(!("boolean"==typeof(D=this.config.customEnrichment)?D:"object"==typeof D&&null!==D&&!1!==D.enabled))return[3,36];return this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(oO()).promise];case 35:I.sent(),I.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return I.sent(),E.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=(0,eb.Tt)(t,["time"]);C.track(e.eventType,r,"number"==typeof n?{time:n}:void 0)}),[2]}})})},t.prototype.getUserId=function(){var e;return null==(e=this.config)?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),th(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null==(e=this.config)?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),tp(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(e_()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null==(e=this.config)?void 0:e.deviceId,userId:null==(t=this.config)?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var t,n,r,i=new tM,o=null!=(r=e.userProperties)?r:{};try{for(var s=(0,eb.Ju)(Object.entries(o)),a=s.next();!a.done;a=s.next()){var u=(0,eb.zs)(a.value,2),l=u[0],c=u[1];i.set(l,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null==(e=this.config)?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null==(e=this.config)?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ew(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ew(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ew(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)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,tW(this.config.defaultTracking)&&(r&&i&&n.push(this.track(nC,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 this.config.identify&&n.push(this.track(tL(this.config.identify)).promise),tW(this.config.defaultTracking)&&n.push(this.track(nE,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,ew(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=nW(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(t6(t)){var r=t._q;t._q=[],t=t4(new tM,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(t6(r)){var o=r._q;r._q=[],r=t4(new tM,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(t6(t)){var r=t._q;t._q=[],t=t4(new tU,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!oH(this.webAttribution.options))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,eb.sH)(this,void 0,void 0,function(){var n,r,i;return(0,eb.YH)(this,function(o){return n=Date.now(),r=tF(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==nE&&t.event_type!==nC&&(!t.session_id||t.session_id===this.getSessionId())&&(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,eb.Cl)((0,eb.Cl)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",tq(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1)&&!(e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t}(tY),oU=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return(0,eb.C6)(t,e),t.prototype.send=function(e,t){return(0,eb.sH)(this,void 0,void 0,function(){var n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,eb.Cl)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"})];case 1:return[4,(n=i.sent()).text()];case 2:r=i.sent();try{return[2,this.buildResponse(JSON.parse(r))]}catch(e){return[2,this.buildResponse({code:n.status})]}}})})},t}(nh);(w=eu||(eu={})).US="US",w.EU="EU",w.STAGING="STAGING";var oF="[Amplitude]",oj="".concat(oF," Session Replay ID"),oq=eu.US,oz={enabled:!0},oY="".concat(oF," Session Replay Debug"),oB="amp-mask",oV="amp-unmask",oJ="https://api-sr.amplitude.com/sessions/v2/track",oK="https://api-sr.eu.amplitude.com/sessions/v2/track",oW="https://api-sr.stag2.amplitude.com/sessions/v2/track",oX=/payload.*exceed/i,o$="amplitude-sr-iframe";(S=el||(el={})).GET_SR_PROPS="get-sr-props",S.DEBUG_INFO="debug-info",S.FETCH_REQUEST="fetch-request",S.METADATA="metadata",S.TARGETING_DECISION="targeting-decision",S.REPLAY_GATE_DECISION="replay-gate-decision";var oG=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){if(!this.logger)return function(){};var t,n=this.logger[e];return"function"==typeof n?(null!=(t=n.__rrweb_original__)?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),oQ="medium",oZ=function(e,t,n){switch(t){case"light":if("input"!==e)return!1;var r,i,o=n?(i=(r=n).type,r.hasAttribute("data-rr-is-password")?"password":i?i.toLowerCase():null):"";if(!o)return!1;if(["password","hidden","email","tel"].includes(o)||n.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":return"input"===e;case"conservative":return!0;default:return oZ(e,oQ,n)}},o0=function(e,t){if(e&&t.urlMaskLevels)try{for(var n,r,i,o=(0,eb.Ju)(t.urlMaskLevels),s=o.next();!s.done;s=o.next()){var a=s.value;if(o6(a.match).test(e))return a.maskLevel}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null!=(i=t.defaultMaskLevel)?i:oQ},o1=function(e,t,n,r){var i,o;if(void 0===t&&(t={defaultMaskLevel:oQ}),n){if(n.closest("."+oB)||(null!=(i=t.maskSelector)?i:[]).some(function(e){return n.closest(e)}))return!0;
1if(n.closest("."+oV)||(null!=(o=t.unmaskSelector)?o:[]).some(function(e){return n.closest(e)}))return!1}return oZ(e,o0(r,t),n)},o2=function(e,t,n){return function(r,i){return o1(e,t,i,null==n?void 0:n())?r.replace(/[^\s]/g,"*"):r}},o3=function(){var e=(0,eI.m)();return(null==e?void 0:e.location)?e.location.href:""},o4=new Map,o6=function(e){var t=o4.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 o4.set(e,u),u},o5=function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){var t;return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t)}))throw Error("ugcFilterRules must be an array of objects with valid globs")},o8=function(e,t){var n,r;try{for(var i=(0,eb.Ju)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=o6(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},o7=function(){return(0,eb.sH)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,eI.m)()))return[3,2];return[4,e.navigator.storage.estimate()];case 1:return n=(t=i.sent()).usage,r=t.quota,[2,{totalStorageSize:n?Math.round(n/1024):0,percentOfQuota:n&&r?Math.round((n/r+Number.EPSILON)*1e3)/1e3:0,usageDetails:JSON.stringify(t.usageDetails)}];case 2:return[3,4];case 3:return i.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},o9=function(e){var t=(0,eb.Cl)({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},se=function(){return{flushMaxRetries:2,logLevel:eS.$.Warn,loggerProvider:new eE,transportProvider:new oU}},st=function(e){function t(t,n){var r,i,o,s,a,u,l,c,d,f,h,p=this,v=se();return(p=e.call(this,(0,eb.Cl)((0,eb.Cl)({transportProvider:v.transportProvider,loggerProvider:new oG(n.loggerProvider||v.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=v.flushMaxRetries?n.flushMaxRetries:v.flushMaxRetries,p.apiKey=t,p.sampleRate=n.sampleRate||0,p.serverZone=n.serverZone||oq,p.configServerUrl=n.configServerUrl,p.trackServerUrl=n.trackServerUrl,p.shouldInlineStylesheet=n.shouldInlineStylesheet,p.version=n.version,p.performanceConfig=n.performanceConfig||oz,p.storeType=null!=(r=n.storeType)?r:"memory",p.applyBackgroundColorToBlockedElements=null!=(i=n.applyBackgroundColorToBlockedElements)&&i,p.enableUrlChangePolling=null!=(o=n.enableUrlChangePolling)&&o,p.urlChangePollingInterval=null!=(s=n.urlChangePollingInterval)?s:1e3,p.captureDocumentTitle=null!=(a=n.captureDocumentTitle)&&a,void 0!==n.fullSnapshotIntervalMs&&(p.fullSnapshotIntervalMs=n.fullSnapshotIntervalMs),p.privacyConfig=(0,eb.Cl)((0,eb.Cl)({},null!=(u=n.privacyConfig)?u:{}),{unmaskSelector:Array.from(new Set((0,eb.fX)([".".concat(oV)],(0,eb.zs)(null!=(c=null==(l=n.privacyConfig)?void 0:l.unmaskSelector)?c:[]),!1)))}),n.interactionConfig&&(p.interactionConfig=n.interactionConfig,p.interactionConfig.ugcFilterRules&&o5(p.interactionConfig.ugcFilterRules)),n.debugMode&&(p.debugMode=n.debugMode),void 0!==n.useWebWorker?p.useWebWorker=n.useWebWorker:(null==(d=n.experimental)?void 0:d.useWebWorker)!==void 0&&(p.useWebWorker=n.experimental.useWebWorker),p.enableTransportCompression=null==(f=n.enableTransportCompression)||f,p.captureAdoptedStyleSheets=null==(h=n.captureAdoptedStyleSheets)||h,n.crossOriginIframes&&(p.crossOriginIframes=n.crossOriginIframes),n.flushIntervalConfig&&(p.flushIntervalConfig=function(e,t){var n,r,i={};if(void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<100?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(100,"ms; clamping.")),i.minIntervalMs=100):i.minIntervalMs=e.minIntervalMs),void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<100?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(100,"ms; clamping.")),i.maxIntervalMs=100):i.maxIntervalMs=e.maxIntervalMs),void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!=(n=i.minIntervalMs)?n:500,s=null!=(r=i.maxIntervalMs)?r:1e4;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(1e4,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(500,"); lowering min to match max.")),i.minIntervalMs=s):(t.warn("flushIntervalConfig.maxIntervalMs (".concat(i.maxIntervalMs,") is less than minIntervalMs (").concat(i.minIntervalMs,"); raising max to match min.")),i.maxIntervalMs=i.minIntervalMs))}return i}(n.flushIntervalConfig,p.loggerProvider)),p}return(0,eb.C6)(t,e),t}(ty),sn=((k=sn||{})[k.DomContentLoaded=0]="DomContentLoaded",k[k.Load=1]="Load",k[k.FullSnapshot=2]="FullSnapshot",k[k.IncrementalSnapshot=3]="IncrementalSnapshot",k[k.Meta=4]="Meta",k[k.Custom=5]="Custom",k[k.Plugin=6]="Plugin",k),sr=((E=sr||{})[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),si=((C=si||{})[C.MouseUp=0]="MouseUp",C[C.MouseDown=1]="MouseDown",C[C.Click=2]="Click",C[C.ContextMenu=3]="ContextMenu",C[C.DblClick=4]="DblClick",C[C.Focus=5]="Focus",C[C.Blur=6]="Blur",C[C.TouchStart=7]="TouchStart",C[C.TouchMove_Departed=8]="TouchMove_Departed",C[C.TouchEnd=9]="TouchEnd",C[C.TouchCancel=10]="TouchCancel",C),so=((I=so||{})[I.Mouse=0]="Mouse",I[I.Pen=1]="Pen",I[I.Touch=2]="Touch",I),ss=((x=ss||{})[x["2D"]=0]="2D",x[x.WebGL=1]="WebGL",x[x.WebGL2=2]="WebGL2",x),sa=((_=sa||{})[_.Play=0]="Play",_[_.Pause=1]="Pause",_[_.Seeked=2]="Seeked",_[_.VolumeChange=3]="VolumeChange",_[_.RateChange=4]="RateChange",_),su=((T=su||{}).Start="start",T.Pause="pause",T.Resume="resume",T.Resize="resize",T.Finish="finish",T.FullsnapshotRebuilded="fullsnapshot-rebuilded",T.LoadStylesheetStart="load-stylesheet-start",T.Loa
1dStylesheetEnd="load-stylesheet-end",T.SkipStart="skip-start",T.SkipEnd="skip-end",T.MouseInteraction="mouse-interaction",T.EventCast="event-cast",T.CustomEvent="custom-event",T.Flush="flush",T.StateChange="state-change",T.PlayBack="play-back",T.Destroy="destroy",T.SeekStart="seek-start",T.SeekEnd="seek-end",T),sl=((P=sl||{})[P.Document=0]="Document",P[P.DocumentType=1]="DocumentType",P[P.Element=2]="Element",P[P.Text=3]="Text",P[P.CDATA=4]="CDATA",P[P.Comment=5]="Comment",P),sc=function(e,t){var n=document.createDocumentFragment(),r=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),0!==(e=e.filter(function(e){try{n.querySelector(e)}catch(n){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})).length)return e};return e.blockSelector=r(e.blockSelector),e.maskSelector=r(e.maskSelector),e.unmaskSelector=r(e.unmaskSelector),e},sd=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,n,r,i,o,s;return(0,eb.sH)(this,void 0,void 0,function(){var a,u,l,c,d,f,h,p,v,g,m,y,b,w,S,k,E,C=this;return(0,eb.YH)(this,function(I){switch(I.label){case 0:(a=(0,eb.Cl)({},this.localConfig)).optOut=this.localConfig.optOut,a.captureEnabled=!0,I.label=1;case 1:return I.trys.push([1,3,,4]),[4,new Promise(function(e,t){C.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(n,r){if(C.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(r,":"),JSON.stringify(n,null,2)),!n)return void t(Error("No remote config received"));var i,o=n.sr_sampling_config,s=n.sr_privacy_config,l=n.sr_targeting_config,c=null==(i=a.interactionConfig)?void 0:i.ugcFilterRules;a.interactionConfig=n.sr_interaction_config,a.interactionConfig&&c&&(a.interactionConfig.ugcFilterRules=c),a.loggingConfig=n.sr_logging_config,(o||s||l)&&(u={},o&&(u.sr_sampling_config=o),s&&(u.sr_privacy_config=s),l&&(u.sr_targeting_config=l)),e()})})];case 2:return I.sent(),[3,4];case 3:return l=I.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",l),a.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:void 0}];case 4:if(!u)return[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:u}];if(c=u.sr_sampling_config,d=u.sr_privacy_config,f=u.sr_targeting_config,c&&Object.keys(c).length>0?(Object.prototype.hasOwnProperty.call(c,"capture_enabled")?a.captureEnabled=c.capture_enabled:a.captureEnabled=!1,Object.prototype.hasOwnProperty.call(c,"sample_rate")&&(a.sampleRate=c.sample_rate),Object.prototype.hasOwnProperty.call(c,"min_session_duration_ms")&&(a.minSessionDurationMs=this.sanitizeMinSessionDurationMs(c.min_session_duration_ms))):(a.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),d){h=null!=(e=a.privacyConfig)?e:{},p={defaultMaskLevel:null!=(n=null!=(t=d.defaultMaskLevel)?t:h.defaultMaskLevel)?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,eb.fX)([],(0,eb.zs)(new Set((0,eb.fX)((0,eb.fX)([],(0,eb.zs)(null!=(r=h.maskAttributes)?r:[]),!1),(0,eb.zs)(null!=(i=d.maskAttributes)?i:[]),!1))),!1),urlMaskLevels:(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(null!=(o=d.urlMaskLevels)?o:[]),!1),(0,eb.zs)(null!=(s=h.urlMaskLevels)?s:[]),!1)},v=function(e){var t,n,r,i,o,s,a,u,l,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,eb.Ju)(null!=(a=e.blockSelector)?a:[]),f=d.next();!f.done;f=d.next()){var h=f.value;c[h]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}try{for(var p=(0,eb.Ju)(null!=(u=e.maskSelector)?u:[]),v=p.next();!v.done;v=p.next()){var h=v.value;c[h]="mask"}}catch(e){r={error:e}}finally{try{v&&!v.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}try{for(var g=(0,eb.Ju)(null!=(l=e.unmaskSelector)?l:[]),m=g.next();!m.done;m=g.next()){var h=m.value;c[h]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}return c},g=(0,eb.Cl)((0,eb.Cl)({},v(h)),v(d));try{for(y=(m=(0,eb.Ju)(Object.entries(g))).next();!y.done;y=m.next())w=(b=(0,eb.zs)(y.value,2))[0],S=b[1],"mask"===S?p.maskSelector.push(w):"block"===S?p.blockSelector.push(w):"unmask"===S&&p.unmaskSelector.push(w)}catch(e){k={error:e}}finally{try{y&&!y.done&&(E=m.return)&&E.call(m)}finally{if(k)throw k.error}}a.privacyConfig=sc(p,this.localConfig.loggerProvider)}return f&&Object.keys(f).length>0&&(a.targetingConfig=f),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:o9(a)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:u}]}})})},e.prototype.sanitizeMinSessionDurationMs=function(e){return"number"==typeof e&&Number.isFinite(e)?e<0?void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(e,"); ignoring.")):e>sf?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(sf,"ms ceiling; clamping.")),sf):e:void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),sf=6e4;function sh(e,t){return t||("STAGING"===e?oW:"EU"===e?oK:oJ)}function sp(e){if(e.type!==sn.IncrementalSnapshot)return!1;var t=e.data;return t.source===sr.Mutation&&!t.isAttachIframe}var sv=function(){function e(e,t,n,r,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e.type,n=e.timestamp,r=e.delay,i=e.data;return null!=r?JSON.stringify({type:t,timestamp:n,delay:r,data:i}):JSON.stringify({type:t,timestamp:n,data:i})},this.addCompressedEventToManager=function(e,t){var n=new Blob([e]).size;n>9e6?s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(n/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support.")):s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId})},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(n){"DataCloneError"===n.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",n)}else{var n=s.compressEvent(e);s.addCompressedEventToManager(n,t)}},this.flushQueue=function(){var e;
1for(s.pendingQueue.length>0&&(e=s.taskQueue).push.apply(e,(0,eb.fX)([],(0,eb.zs)(s.mergeMutationTasks(s.pendingQueue.splice(0))),!1));s.taskQueue.length>0;){var t=s.taskQueue.shift();if(t){var n=t.event,r=t.sessionId,i=s.compressEvent(n);s.addCompressedEventToManager(i,r)}}s.isProcessing=!1},this.terminate=function(){var e;null==(e=s.worker)||e.terminate()};var a=(0,eI.m)();if(this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=n,this.timeout=(null==(o=t.performanceConfig)?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,r){t.loggerProvider.log("Enabling web worker for compression");try{var u=new Blob([r],{type:"application/javascript"}),l=URL.createObjectURL(u),c=new Worker(l);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0},c.onmessage=function(e){var t=e.data,n=t.compressedEvent,r=t.sessionId;s.addCompressedEventToManager(n,r)},this.worker=c}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){if(e.type===sn.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var n,r,i,o,s=(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(this.taskQueue.splice(0)),!1),(0,eb.zs)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var a=(0,eb.Ju)(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=this.compressEvent(l.event);this.addCompressedEventToManager(c,l.sessionId)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}this.isProcessing=!1}var d=this.compressEvent(e);this.addCompressedEventToManager(d,t),null==(i=this.onFullSnapshotProcessed)||i.call(this);return}this.canUseIdleCallback&&(null==(o=this.config.performanceConfig)?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.pendingQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){var t,n=this;for(this.pendingQueue.length>0&&(t=this.taskQueue).push.apply(t,(0,eb.fX)([],(0,eb.zs)(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,o=r.sessionId;this.addCompressedEvent(i,o)}}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){if(!(null==(r=this.config.performanceConfig)?void 0:r.mergeMutations)||e.length<=1)return e;for(var t,n,r,i=[],o=0;o<e.length;){for(var s=e[o].sessionId,a=o+1;a<e.length&&e[a].sessionId===s;)a++;var u=function(e){if(e.length<=1)return e;for(var t=[],n=0;n<e.length;){if(!sp(e[n])){t.push(e[n]),n++;continue}for(var r=n+1;r<e.length&&sp(e[r]);)r++;t.push(r>n+1?function(e){var t,n,r,i,o=e[0],s=new Map,a=new Map,u=new Map,l=new Map,c=new Map;e.forEach(function(e,t){var n,r,i,o,d=e.data;try{for(var f=(0,eb.Ju)(d.adds),h=f.next();!h.done;h=f.next()){var p=h.value;s.has(p.node.id)||s.set(p.node.id,t),a.set(p.node.id,t),c.set(p.node.id,p.parentId)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}try{for(var v=(0,eb.Ju)(d.removes),g=v.next();!g.done;g=v.next()){var m=g.value;u.has(m.id)||u.set(m.id,t),l.set(m.id,t)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}});var d=new Set,f=new Set;try{for(var h=(0,eb.Ju)(s),p=h.next();!p.done;p=h.next()){var v=(0,eb.zs)(p.value,2),g=v[0],m=v[1],y=u.get(g);if(void 0!==y){var b=a.get(g),w=l.get(g);!(b>=w)&&(m<y?d.add(g):y<m&&f.add(g))}}}catch(e){t={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}var S=new Set;if(d.size>0||f.size>0)for(var k=!0;k;){k=!1;try{for(var E=(r=void 0,(0,eb.Ju)(c)),C=E.next();!C.done;C=E.next()){var I=(0,eb.zs)(C.value,2),x=I[0],_=I[1];if(!d.has(x)&&!f.has(x)&&!S.has(x)&&(d.has(_)||f.has(_)||S.has(_))){var T=u.get(x),P=s.get(x);void 0!==T&&void 0!==P&&T<P?f.add(x):void 0!==T&&void 0!==P&&T===P?S.add(x):d.add(x),k=!0}}}catch(e){r={error:e}}finally{try{C&&!C.done&&(i=E.return)&&i.call(E)}finally{if(r)throw r.error}}}var O=d.size>0||f.size>0||S.size>0,A=[];e.forEach(function(e,t){var n,r;try{for(var i=(0,eb.Ju)(e.data.removes),o=i.next();!o.done;o=i.next()){var a=o.value;!(d.has(a.id)||f.has(a.id)&&t>=s.get(a.id))&&(S.has(a.id)&&(d.has(a.parentId)||f.has(a.parentId)||S.has(a.parentId))||A.push(a))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}});var R=e.flatMap(function(e){return e.data.adds}),M=e.flatMap(function(e){return e.data.texts}),D=e.flatMap(function(e){return e.data.attributes}),L={source:sr.Mutation,removes:A,adds:O?R.filter(function(e){return!d.has(e.node.id)&&!f.has(e.node.id)&&!S.has(e.node.id)}):R,texts:O?M.filter(function(e){return!d.has(e.id)&&!f.has(e.id)&&!S.has(e.id)}):M,attributes:O?D.filter(function(e){return!d.has(e.id)&&!f.has(e.id)&&!S.has(e.id)}):D};return(0,eb.Cl)((0,eb.Cl)({},o),{data:L})}(e.slice(n,r)):e[n]),n=r}return t}(e.slice(o,a).map(function(e){return e.event}));try{for(var l=(t=void 0,(0,eb.Ju)(u)),c=l.next();!c.done;c=l.next()){var d=c.value;i.push({event:d,sessionId:s})}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}o=a}return i},e}(),sg="Session replay event batch rejected due to exceeded retry count",sm="Failed to store session replay events in IndexedDB",sy="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",sb="1.44.1",sw=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher,i=e.workerScript,o=e.enableTransportCompression,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,this.enableTransportCompression=null==o||o,i)try{var a=new Blob([i],{type:"application/javascript"}),u=URL.createObjectURL(a),l=new Worker(u);l.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,")")),l.terminate(),s.worker=void 0;try{for(var i=(0,eb.Ju)(s.pendingWorkerRequests),o=i.next();!o.done;o=i.next()){var a=(0,eb.zs)(o.value,2)[1];n.warn("Session replay event send failed due to worker crash: ".concat(e.message)),a.resolve()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}s.pendingWorkerRequests.clear()},l.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.pe
1ndingWorkerRequests.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=l}catch(e){n.error("Failed to create track destination worker, falling back to main-thread sending:",e)}}return e.prototype.sendEventsList=function(e){this.addToQueue((0,eb.Cl)((0,eb.Cl)({},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,a=e.serverZone,u=function(e){return new Blob([e]).size},l=r,c=JSON.stringify({version:2,events:l});if(u(c)>65536){for(var d=0,f=l.length;d<f;){var h=Math.floor((d+f+1)/2);65536>=u(JSON.stringify({version:2,events:l.slice(0,h)}))?d=h:f=h-1}c=JSON.stringify({version:2,events:l=l.slice(0,d)}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(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}),v="".concat(sh(a,this.trackServerUrl),"?").concat(p.toString()),g=(0,eI.m)();try{var m=new Blob([c],{type:"application/json"}),y=null==(n=null==(t=null==g?void 0:g.navigator)?void 0:t.sendBeacon)?void 0:n.call(t,v,m);!1===y&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(e){}}},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:sy}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:sg}),!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,eb.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),this.mergeOnNextFlush&&(this.mergeOnNextFlush=!1,t=this.mergeQueueAfterThrottle(t)),a.label=1;case 1:a.trys.push([1,6,7,8]),r=(n=(0,eb.Ju)(t)).next(),a.label=2;case 2:if(r.done)return[3,5];return i=r.value,[4,this.send(i,e)];case 3:a.sent(),a.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o={error:a.sent()},[3,8];case 7:try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.mergeQueueAfterThrottle=function(e){var t,n,r,i,o,s,a,u,l,c,d,f=this;if(e.length<=1)return e;var h=new Map;try{for(var p=(0,eb.Ju)(e),v=p.next();!v.done;v=p.next()){var g=v.value,m=[g.sessionId,null!=(o=g.deviceId)?o:"",null!=(s=g.apiKey)?s:"",g.type,null!=(a=g.serverZone)?a:"",g.sampleRate,null!=(l=null==(u=g.version)?void 0:u.type)?l:"",null!=(d=null==(c=g.version)?void 0:c.version)?d:""].join("|"),y=h.get(m);y?y.push(g):h.set(m,[g])}}catch(e){t={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var b=[];try{for(var w=(0,eb.Ju)(h.values()),S=w.next();!S.done;S=w.next()){var k=S.value;!function(e){if(1===e.length)return b.push(e[0]);var t,n,r=null,i=0,o=function(){r&&b.push(r),r=null,i=0};try{for(var s=(t=void 0,(0,eb.Ju)(e)),a=s.next();!a.done;a=s.next()){var u=a.value;!function(e){var t=e.events.reduce(function(e,t){return e+new Blob([t]).size},0);if(null===r)return r=(0,eb.Cl)((0,eb.Cl)({},e),{events:(0,eb.fX)([],(0,eb.zs)(e.events),!1),attempts:0}),i=t;if(i+t>14e5)return o(),r=(0,eb.Cl)((0,eb.Cl)({},e),{events:(0,eb.fX)([],(0,eb.zs)(e.events),!1),attempts:0}),i=t;var n=r.onComplete,s=e.onComplete;r.events=r.events.concat(e.events),i+=t,r.onComplete=function(){return(0,eb.sH)(f,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([n(),s()])];case 1:return e.sent(),[2]}})})}}(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}o()}(k)}}catch(e){r={error:e}}finally{try{S&&!S.done&&(i=w.return)&&i.call(w)}finally{if(r)throw r.error}}return b.length<e.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(e.length," queued batches into ").concat(b.length," request(s)"))),b},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,eb.sH)(this,void 0,void 0,function(){var n,r,i,o;return(0,eb.YH)(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:sy})]:(n=e.apiKey)?(r=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(o=this.worker)?[2,this.sendViaWorker(o,e,i,t)]:[2,this.sendOnMainThread(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,eb.sH)(this,void 0,void 0,function(){var i,o=this;return(0,eb.YH)(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a;o.pendingWorkerRequests.set(i,{context:t,resolve:s}
1),e.postMessage({type:"send",id:i,payload:n,useRetry:r,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!=(a=t.flushMaxRetries)?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:o3(),sdkVersion:sb,enableTransportCompression:o.enableTransportCompression}})})]})})},e.prototype.sendOnMainThread=function(e,t,n,r,i){var o,s,a,u,l,c,d;return(0,eb.sH)(this,void 0,void 0,function(){var f,h,p,v,g,m,y,b,w,S,k,E,C,I,x,_;return(0,eb.YH)(this,function(T){switch(T.label){case 0:f=o3(),h=sb,p=n.sampleRate,v=new URLSearchParams({device_id:t,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),g="".concat(null!=(s=null==(o=n.version)?void 0:o.type)?s:"standalone","/").concat(null!=(u=null==(a=n.version)?void 0:a.version)?u:h),T.label=1;case 1:if(T.trys.push([1,13,,14]),m=JSON.stringify(r),y=(0,eI.m)(),!(this.enableTransportCompression&&y&&"CompressionStream"in y))return[3,3];return[4,function(e,t){return(0,eb.sH)(this,void 0,void 0,function(){var n,r,i,o,s,a,u,l,c,d,f,h,p=this;return(0,eb.YH)(this,function(v){switch(v.label){case 0:return v.trys.push([0,4,,5]),r=(n=new t.CompressionStream("gzip")).writable.getWriter(),i=n.readable.getReader(),o=[],s=(0,eb.sH)(p,void 0,void 0,function(){var e,t,n;return(0,eb.YH)(this,function(r){switch(r.label){case 0:return[4,i.read()];case 1:if(t=(e=r.sent()).done,n=e.value,t)return[3,3];o.push(n),r.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,r.write(new TextEncoder().encode(e))];case 1:return v.sent(),[4,r.close()];case 2:return v.sent(),[4,s];case 3:v.sent(),a=new Uint8Array(o.reduce(function(e,t){return e+t.length},0)),u=0;try{for(c=(l=(0,eb.Ju)(o)).next();!c.done;c=l.next())d=c.value,a.set(d,u),u+=d.length}catch(e){f={error:e}}finally{try{c&&!c.done&&(h=l.return)&&h.call(l)}finally{if(f)throw f.error}}return[2,a];case 4:return v.sent(),[2,null];case 5:return[2]}})})}(m,y)];case 2:return w=T.sent(),[3,4];case 3:w=null,T.label=4;case 4:if(S=(b=w)?b.byteLength:new Blob([m]).size,k={headers:(0,eb.Cl)({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":h,"X-Client-Library":g,"X-Client-Url":f.substring(0,1e3),"X-Client-Sample-Rate":"".concat(p),"X-Sampling-Hash-Alg":"xxhash32"},b?{"Content-Encoding":"gzip"}:{}),body:null!=b?b:m,method:"POST",keepalive:S<=65536},E="".concat(sh(n.serverZone,this.trackServerUrl),"?").concat(v.toString()),0===r.events.length)return this.completeRequest({context:n}),[2];return[4,fetch(E,k)];case 5:if(null===(C=T.sent()))return this.completeRequest({context:n,err:"Unexpected error occurred"}),[2];if(C.status>=200&&C.status<300&&(I=null!=(d=null==(c=null==(l=C.headers)?void 0:l.get)?void 0:c.call(l,"X-Session-Replay-Event-Skipped"))?d:null,this.applyServerDirective(n.sessionId,I)),i)return[3,6];x="";try{x=JSON.stringify(C.body,null,2)}catch(e){}return this.completeRequest({context:n,success:"".concat(C.status,": ").concat(x)}),[3,12];case 6:if(x="",413!==C.status)return[3,10];T.label=7;case 7:return T.trys.push([7,9,,10]),[4,C.text()];case 8:return x=T.sent(),[3,10];case 9:return T.sent(),[3,10];case 10:return[4,this.handleReponse(C.status,n,x)];case 11:T.sent(),T.label=12;case 12:return[3,14];case 13:return _=T.sent(),this.completeRequest({context:n,err:_}),[3,14];case 14:return[2]}})})},e.prototype.handleReponse=function(e,t,n){return void 0===n&&(n=""),(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(r){switch(r.label){case 0:switch(new nh().buildStatus(e)){case W.Success:return[3,1];case W.Failed:case W.Timeout:case W.RateLimit:return[3,2];case W.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(t),[3,8];case 2:return[4,this.handleOtherResponse(t)];case 3:case 6:return r.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(t,oX.test(n)),[3,8];case 5:if(499!==e)return[3,7];return[4,this.handleOtherResponse(t)];case 7:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),r.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)/1024);if(!t)return void this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(n," rejected payload (").concat(e.events.length," events, ").concat(r," KB) — not retrying non-WAF 413")});if(1===e.events.length)return void this.completeRequest({context:e,err:"Session replay event dropped: single event (".concat(r," KB, 1 event) rejected by ").concat(n," — cannot split further")});this.loggerProvider.warn("Session replay event batch rejected by ".concat(n," (").concat(e.events.length," events, ").concat(r," KB total) — splitting and retrying")),e.onComplete();var i=function(){return Promise.resolve()},o=Math.floor(e.events.length/2);this.sendEventsList((0,eb.Cl)((0,eb.Cl)({},e),{events:e.events.slice(0,o),onComplete:i})),this.sendEventsList((0,eb.Cl)((0,eb.Cl)({},e),{events:e.events.slice(o),onComplete:i}))},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0))return this.completeRequest({context:e,err:sg}),[2];return[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){this.flushPauseUntilMs=0,this.mergeLogFiredThisPause=!1;return}if("429"===t){var n=this.flushPauseUntilMs>Date.now();this.flushPauseUntilMs=Date.now()+6e4,n||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(60,"s"));return}("4005"===t||"4004"===t)&&this.killSession(e,t)},e.prototype.killSession=function(e,t){if(!this.killedSessions.has(e)){
1if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var n,r,i,o,s=(0,eb.Ju)(this.killedSessions),a=s.next();!a.done;a=s.next()){var u=a.value;this.killedSessions.delete(u);break}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}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 c=(0,eb.Ju)(this.queue),d=c.next();!d.done;d=c.next()){var f=d.value;f.sessionId===e?this.completeRequest({context:f,err:sy}):l.push(f)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}this.queue=l}},e}(),sS=n(87909),sk=function(){function e(e){var t,n,r,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=7e5,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)?t:this.minInterval,this.maxInterval=null!=(n=e.maxInterval)?n:this.maxInterval,this.maxPersistedEventsSize=null!=(r=e.maxPersistedEventsSize)?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,eb.Ju)(e),o=i.next();!o.done;o=i.next()){var s=o.value;r+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.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}(),sE=function(e,t,n){"object"==typeof n&&null!==n&&"AbortError"===n.name?e.debug(t):e.warn(t)},sC="sessionCurrentSequence",sI="sequencesToSend";function sx(e,t,n){var r=setTimeout(n,t);return e.then(function(){return clearTimeout(r)},function(){return clearTimeout(r)}),function(){return clearTimeout(r)}}var s_=function(e){var t,n;return e.objectStoreNames.contains(sC)||(n=e.createObjectStore(sC,{keyPath:"sessionId"})),e.objectStoreNames.contains(sI)||(t=e.createObjectStore(sI,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},sT=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,eb.sH)(r,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,l,c=this;return(0,eb.YH)(this,function(d){switch(d.label){case 0:e=!1,t=!1,d.label=1;case 1:return d.trys.push([1,9,,10]),n=[],(r=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(n){e||t||(sE(c.loggerProvider,"".concat(sm,": ").concat(n),n),c.recordFailure())}),i=sx(r.done,5e3,function(){e||t||(t=!0,sE(c.loggerProvider,"".concat(sm,": transaction timed out")),c.recordFailure())}),[4,r.store.openCursor()];case 2:o=d.sent(),d.label=3;case 3:if(!o)return[3,8];if(a=(s=o.value).sessionId,0!==(u=s.events).length)return[3,5];return this.maybeLogEmptyFiltered("getSequencesToSend"),[4,o.delete()];case 4:return d.sent(),[3,6];case 5:n.push({events:u,sequenceId:o.key,sessionId:a}),d.label=6;case 6:return[4,o.continue()];case 7:return o=d.sent(),[3,3];case 8:return this.recordSuccess(),i(),[2,n];case 9:return l=d.sent(),t||(e=!0,sE(this.loggerProvider,"".concat(sm,": ").concat(l),l),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return(0,eb.sH)(r,void 0,void 0,function(){var t,n,r,i,o,s,a,u,l=this;return(0,eb.YH)(this,function(c){switch(c.label){case 0:t=!1,n=!1,c.label=1;case 1:return c.trys.push([1,5,,6]),(r=this.db.transaction([sC,sI],"readwrite")).done.catch(function(e){t||n||(sE(l.loggerProvider,"".concat(sm,": ").concat(e),e),l.recordFailure())}),i=sx(r.done,5e3,function(){t||n||(n=!0,sE(l.loggerProvider,"".concat(sm,": transaction timed out")),l.recordFailure())}),[4,r.objectStore(sC).get(e)];case 2:if(!(o=c.sent())||o.tabId&&o.tabId!==this.tabId)return i(),[2,void 0];if(0===o.events.length)return this.maybeLogEmptyFiltered("storeCurrentSequence"),i(),[2,void 0];return[4,r.objectStore(sI).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return s=c.sent(),[4,r.objectStore(sC).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return c.sent(),this.recordSuccess(),i(),o.tabId,a=(0,eb.Tt)(o,["tabId"]),[2,(0,eb.Cl)((0,eb.Cl)({},a),{sessionId:e,sequenceId:s})];case 5:return u=c.sent(),n||(t=!0,sE(this.loggerProvider,"".concat(sm,": ").concat(u),u),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return(0,eb.sH)(r,void 0,void 0,function(){var n,r,i,o,s,a,u,l,c,d=this;return(0,eb.YH)(this,function(f){switch(f.label){case 0:n=!1,r=!1,f.label=1;case 1:return f.trys.push([1,15,,16]),(i=this.db.transaction([sC,sI],"readwrite")).done.catch(function(e){n||r||(sE(d.loggerProvider,"".concat(sm,": ").concat(e),e),d.recordFailure())}),o=sx(i.done,5e3,function(){n||r||(r=!0,sE(d.loggerProvider,"".concat(sm,": transaction timed out")),d.recordFailure())}),[4,i.objectStore(sC).get(e)];case 2:if(!((null==(s=f.sent())?void 0:s.tabId)&&s.tabId!==this.tabId))return[3,6];if(!(s.events.length>0))return[3,4];return[4,i.objectStore(sI).put({sessionId:e,events:s.events,tabId:s.tabId})];case 3:f.sent(),f.label=4;case 4:case 12:return[4,i.objectStore(sC).put({sessionId:e,events:[t],tabId:this.tabId})];case 5:case 7:case 9:case 11:return f.sent(),this.recordSuccess(),o(),[2,void 0];case 6:if(a=s)return[3,8];return[4,i.objectStore(sC).put({sessionId:e,events:[t],tabId:this.tabId})];case 8:if(this.shouldSplitEventsList(a.events,t))return[3,10];return[4,i.objectStore(sC).put({sessionId:e,events:a.events.concat(t),tabId:this.tabId})];case 10:if(0!==(u=a.events).length)return[3,12];return this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore(sC).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return f.sent(),[4,i.objectStore(sI).put({sessionId:e,events:u,tabId:this.tabId})];case 14:return l=f.sent(),this.recordSuccess(),o(),[2,{events:u,sessionId:e,sequenceId:l}];case 15:return c=f.sent(),r||(n=!0,sE(this.loggerProvider,"".concat(sm,": ").concat(c),c),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return(0,eb.sH)(r,void 0,void 0,function(){var n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(sI,{sessionId:e,events:t,tabId:this.tabId})];case 1:return n=i.sent(),this.recordSuccess(),[2,n];case 2:return r=i.sent(),sE(this.loggerProvider,"".concat(sm,": ").concat(r),r),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return(0,eb.sH)(r,void 0,void 0,function(){var e;return(0,eb.YH)(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(sI,t)];case 2:return n.sent(),this.recordSuccess(),[3,4];case 3:return e=n.sent(),sE(this.loggerProvider,"".concat(sm,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},r.db=t.db,r.tabId=t.tabId,r.onPersistentFailure=t.onPersistentFailure,r.consecutiveFailureThreshold=null!=(n=t.consecutiveFailureThreshold)?n:1,r}return(0,eb.C6)(t,e),t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (idb store)"))},t.prototype.recordFailure=function(){var e;this.consecutiveFailures++,!this.hasTriggeredFallback&&this.consecutiveFailures>=this.consecutiveFailureThreshold&&(this.hasTriggeredFallback=!0,null==(e=this.onPersistentFailure)||e.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(e,n){var r;return(0,eb.sH)(this,void 0,void 0,function(){var i,o,s,a;return(0,eb.YH)(this,function(u){switch(u.label){case 0:var l;return u.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),[4,(l="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:var t;return[4,(t=(0,sS.P2)(l,1,{upgrade:s_}),new Promise(function(e,n){var r=setTimeout(function(){return n(Error("".concat("IDB openDB timed out"," after ").concat(2e3,"ms")))},2e3);t.then(function(t){clearTimeout(r),e(t)},function(e){clearTimeout(r),n(e)})}))];case 1:return[2,e.sent()]}})}))];case 1:return o=u.sent(),s=null!=(r=n.tabId)?r:function(){try{return crypto.randomUUID()}catch(e){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}(),[2,new t((0,eb.Cl)((0,eb.Cl)({},n),{db:o,tabId:s}
1))];case 2:return a=u.sent(),sE(n.loggerProvider,"".concat(sm,": ").concat(a),a),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s,a;return(0,eb.YH)(this,function(u){switch(u.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=u.sent())||t.tabId&&t.tabId!==this.tabId)return[2,void 0];return t.tabId,[2,[n=(0,eb.Tt)(t,["tabId"])]];case 2:r=[],u.label=3;case 3:return u.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:o=(i=eb.Ju.apply(void 0,[u.sent()])).next(),u.label=5;case 5:if(o.done)return[3,7];if((t=o.value).tabId&&t.tabId!==this.tabId)return[3,6];t.tabId,n=(0,eb.Tt)(t,["tabId"]),r.push(n),u.label=6;case 6:return o=i.next(),[3,5];case 7:return[3,10];case 8:return s={error:u.sent()},[3,10];case 9:try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}return[7];case 10:return[2,r]}})})},t}(sk),sP=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,eb.C6)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=(0,eb.fX)([],(0,eb.zs)(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,eb.sH)(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,l;return(0,eb.YH)(this,function(c){e=[];try{for(n=(t=(0,eb.Ju)(Object.entries(this.finalizedSequences))).next();!n.done;n=t.next()){if(i=(r=(0,eb.zs)(n.value,2))[0],s=(o=r[1]).sessionId,a=o.events,0===a.length){this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(i)];continue}e.push({sequenceId:Number(i),sessionId:s,events:a})}}catch(e){u={error:e}}finally{try{n&&!n.done&&(l=t.return)&&l.call(t)}finally{if(u)throw u.error}}return[2,e]})})},t.prototype.storeCurrentSequence=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(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,eb.sH)(this,void 0,void 0,function(){var n;return(0,eb.YH)(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,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(sk),sO=function(e){var t=e.config,n=e.minInterval,r=e.maxInterval,i=e.type,o=e.payloadBatcher,s=e.storeType,a=e.trackDestinationWorkerScript,u=e.shouldSend;return(0,eb.sH)(void 0,void 0,void 0,function(){var e,l,c,d,f,h,p,v,g,m;function y(t){return void 0===t&&(t=!1),(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return[2,e.flush(t)]})})}return(0,eb.YH)(this,function(b){switch(b.label){case 0:if(e=new sw((0,eb.Cl)((0,eb.Cl)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o,workerScript:a})),l=function(){return new sP({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n})},d=!1,"idb"!==s)return[3,2];return[4,(0,eb.sH)(void 0,void 0,void 0,function(){var e;return(0,eb.YH)(this,function(o){switch(o.label){case 0:return[4,sT.new(i,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,apiKey:t.apiKey,onPersistentFailure:function(){(0,eb.sH)(void 0,void 0,void 0,function(){var e,n,r;return(0,eb.YH)(this,function(i){switch(i.label){case 0:if(!d)return[2];if(d=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),!c)return[3,2];return[4,f.getSequencesToSend()];case 1:return n=i.sent(),[3,3];case 2:n=void 0,i.label=3;case 3:return e=n,f=l(),e&&c&&(r=c,e.forEach(function(e){m({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})})),[2]}})})}})];case 1:if(!(e=o.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,l()];return d=!0,[2,e]}})})];case 1:return h=b.sent(),[3,3];case 2:h=l(),b.label=3;case 3:return f=h,p=[],v=0,g=function(e){if(!(e<=v)){var t=Math.min(e-v,p.length);t>0&&(p.splice(0,t),v=e)}},m=function(n){var r=n.events,o=n.sessionId,s=n.deviceId,a=n.sequenceId,u=r.map(function(e){return{event:e,bytes:new Blob([e]).size}}
1),l=u.filter(function(e){return e.bytes>9e6});l.length>0&&t.loggerProvider.warn("Dropping ".concat(l.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(l.map(function(e){return"".concat(Math.round(e.bytes/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var c=l.length>0?u.filter(function(e){return e.bytes<=9e6}).map(function(e){return e.event}):r;0===c.length?f.cleanUpSessionEventsStore(o,a).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)}):(t.debugMode&&o7().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(){}),e.sendEventsList({events:c,sessionId:o,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return(0,eb.sH)(void 0,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:return[4,f.cleanUpSessionEventsStore(o,a)];case 1:return e.sent(),[2]}})})}}))},[2,{sendCurrentSequenceEvents:function(e){var n=e.sessionId,r=e.deviceId;if(c=r,!u||u()){var i=v+p.length;f.storeCurrentSequence(n).then(function(e){e&&(g(i),m({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)})}},addEvent:function(e){var n=e.event,r=e.sessionId,i=e.deviceId;c=i;var o=!u||u(),s=v+p.length;p.push(n.data),f.addEventToCurrentSequence(r,n.data).then(function(e){if(e){if(!o){f.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch(function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)}),g(s);return}g(s),m({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i})}}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var n=e.deviceId;return(0,eb.sH)(void 0,void 0,void 0,function(){var e;return(0,eb.YH)(this,function(r){switch(r.label){case 0:return c=n,[4,f.getSequencesToSend()];case 1:if(!(null==(e=r.sent())?void 0:e.length))return[2];return t.loggerProvider.log("Draining ".concat(e.length," stored sequence(s) from previous session.")),e.forEach(function(e){m({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})}),[2]}})})},flush:y,getBeaconEvents:function(){return(0,eb.fX)([],(0,eb.zs)(p),!1)},dropPendingBeaconEvents:function(){g(v+p.length)},trackDestination:e}]}})})},sA=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,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(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))||t.addEvent({sessionId:n,event:r,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})})},e.prototype.flush=function(e){return(0,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(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 sR(e,t,n){for(var r=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,u,l,c=new Date().getTime()-ef.getTime();if(void 0!==ec.timeoutMs&&c>ec.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=sj((e=o.getAttribute("id"))&&ec.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||sj.apply(void 0,(0,eb.fX)([],(0,eb.zs)(Array.from(o.attributes).filter(function(e){return ec.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||sj.apply(void 0,(0,eb.fX)([],(0,eb.zs)(Array.from(o.classList).filter(ec.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||sj((a=o.tagName.toLowerCase(),ec.tagName(a)?{name:a,penalty:2}:null))||[sN()],f=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;for(var r=0;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)f&&(d=d.concat(d.filter(sF).map(function(e){return sU(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(sF).map(function(e){return sU(e,f)})));else if("one"==t){var h=(0,eb.zs)(d=d.slice(0,1),1)[0];f&&sF(h)&&(d=[sU(h,f)])}else"none"==t&&(d=[sN()],f&&(d=[sU(d[0],f)]));try{for(var p=(u=void 0,(0,eb.Ju)(d)),v=p.next();!v.done;v=p.next()){var h=v.value;h.level=s}}catch(e){u={error:e}}finally{try{v&&!v.done&&(l=p.return)&&l.call(p)}finally{if(u)throw u.error}}if(i.push(d),i.length>=ec.seedMinLength&&(r=sM(i,n)))return"break";o=o.parentElement,s++}(););return(r||(r=sM(i,n)),!r&&n)?n():r}function sM(e,t){var n,r,i=sz(function e(t,n){var r,i,o,s,a;return void 0===n&&(n=[]),(0,eb.YH)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(r=(0,eb.Ju)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,eb.Ju)(e(t.slice(1,t.length),n.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}
1return[7];case 8:return[3,11];case 9:return[4,n];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>ec.threshold)return t?t():null;try{for(var o=(0,eb.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(sH(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function sD(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 sL(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function sH(e){var t=sD(e);switch(ed.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function sN(){return{name:"*",penalty:3}}function sU(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function sF(e){return"html"!==e.name&&!e.name.startsWith("#")}function sj(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(sq);return n.length>0?n:null}function sq(e){return null!=e}function sz(e){return(0,eb.fX)([],(0,eb.zs)(e),!1).sort(function(e,t){return sL(e)-sL(t)})}var sY=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}},sB=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)}),{version:t,events:Object.values(r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,o=t.timestamp,s=o-o%36e5,a="".concat(n,":").concat(r,":").concat(null!=i?i:"",":").concat(s);return e[a]?e[a].count+=1:e[a]=(0,eb.Cl)((0,eb.Cl)({},t),{timestamp:s,count:1}),e},{}))}},sV=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,a=e.performanceOptions;return function(e){if(e.type!==si.Click)return;var u,l=(0,eI.m)();if(l){var c=l.location,d=l.innerHeight,f=l.innerWidth;if(c){var h=e.x,p=e.y;if(void 0!==h&&void 0!==p){var v=o.getNode(e.id);if(v)try{u=function(e,t){if(ef=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n,r,i={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};n=(ec=(0,eb.Cl)((0,eb.Cl)({},i),t)).root,r=i,ed=n.nodeType===Node.DOCUMENT_NODE?n:n===r.root?n.ownerDocument:n;var o=sR(e,"all",function(){return sR(e,"two",function(){return sR(e,"one",function(){return sR(e,"none")})})});if(o){var s=sz(function e(t,n,r){var i,o,s;return void 0===r&&(r={counter:0,visited:new Map}),(0,eb.YH)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>ec.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u,l;if(!(i<t.length-1))return[3,5];if(r.counter>ec.maxNumberOfTries||(r.counter+=1,(o=(0,eb.fX)([],(0,eb.zs)(t),!1)).splice(i,1),s=sD(o),r.visited.has(s)))return[2];if(!(sH(o)&&(u=o,l=n,ed.querySelector(sD(u))===l)))return[3,4];return[4,o];case 2:return a.sent(),r.visited.set(s,!0),[5,(0,eb.Ju)(e(o,n,r))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(o,e));return s.length>0&&(o=s[0]),sD(o)}throw Error("Selector was not found.")}(v,a)}catch(e){n.logger.debug("error resolving selector from finder")}var g=o8(c.href,s),m={x:h+n.scrollWatcher.currentScrollX,y:p+n.scrollWatcher.currentScrollY,selector:u,viewportHeight:d,viewportWidth:f,pageUrl:g,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}},this.logger=e,this.scrollWatcher=t};function sJ(){var e=(0,eI.m)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function sK(){var e=(0,eI.m)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var sW=function(){function e(e,t){var n=(0,eI.m)();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(e){}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=sh(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}(),sX=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,a=e(),u=(0,eI.m)();if(u&&a){var l=null!=(r=u.scrollX)?r:0,c=null!=(i=u.scrollY)?i:0;(l>0||c>0)&&n.update({id:1,x:l,y:c}),n.transport.send(a,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHe
1ight:sJ(),viewportWidth:sK(),pageUrl:o8(u.location.href,null!=(s=null==(o=n.config.interactionConfig)?void 0:o.ugcFilterRules)?s:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=sK(),this._maxScrollHeight=sJ(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new sW(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var n=sK();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=sJ();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),s$=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId="".concat(n,"/").concat(t))},sG=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},sQ=function(e,t){return"".concat(sG(e)).concat(t)},sZ=function(){try{var e=(0,eI.m)();return null==e?void 0:e.localStorage}catch(e){return}},s0=function(e,t,n,r){var i=sZ();if(i){var o=sQ(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<864e5)return a}return i.setItem(o,String(n)),n}catch(e){null==r||r.debug("Failed to read/write replay start time from storage: ".concat(String(e)));return}}},s1=function(e,t,n,r){var i=sZ();if(i)try{i.setItem(sQ(e,t),String(n))}catch(e){null==r||r.debug("Failed to write replay start time to storage: ".concat(String(e)))}},s2=function(e,t,n){var r=sZ();if(r)try{r.removeItem(sQ(e,t))}catch(e){null==n||n.debug("Failed to remove replay start time from storage: ".concat(String(e)))}},s3=function(e,t,n){var r,i,o=sZ();if(o){var s=sG(e);try{for(var a=[],u=0;u<o.length;u++){var l=o.key(u);if(l&&l.startsWith(s)){var c=o.getItem(l);if(null!==c){var d=Number(c);(!Number.isFinite(d)||d<=0||t-d>=864e5)&&a.push(l)}}}try{for(var f=(0,eb.Ju)(a),h=f.next();!h.done;h=f.next()){var l=h.value;o.removeItem(l)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}catch(e){null==n||n.debug("Failed to prune stale replay start times: ".concat(String(e)))}}},s4=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,eb.sH)(e,void 0,void 0,function(){return(0,eb.YH)(this,function(e){switch(e.label){case 0:return[4,(0,sS.P2)(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return(0,eb.sH)(e,void 0,void 0,function(){var e,n;return(0,eb.YH)(this,function(r){switch(r.label){case 0:if(this.dbs&&this.dbs[t])return[2,this.dbs[t]];return e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)];case 1:return 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,eb.sH)(e,void 0,void 0,function(){var e,t,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),sE(n,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId,o=t.targetingMatch;return(0,eb.sH)(e,void 0,void 0,function(){var e,t,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),sE(n,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.currentSessionId;return(0,eb.sH)(e,void 0,void 0,function(){var e,t,o,s,a,u,l,c;return(0,eb.YH)(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.openOrCreateDB(r)];case 1:return e=d.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=d.sent(),a=0,d.label=3;case 3:if(!(a<s.length))return[3,6];if(u=s[a],l=Date.now()-u.lastUpdated,!(u.sessionId!==t&&l>1728e5))return[3,5];return[4,o.store.delete(u.sessionId)];case 4:d.sent(),d.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),sE(n,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},s6=function(e){var t=e.sessionId,r=e.targetingConfig,i=e.loggerProvider,o=e.apiKey,s=e.targetingParams,a=e.urlChange,u=void 0!==a&&a;return(0,eb.sH)(void 0,void 0,void 0,function(){var e,a,l;return(0,eb.YH)(this,function(c){switch(c.label){case 0:return[4,s4.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:t})];case 1:return c.sent(),[4,s4.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t})];case 2:if(!0===c.sent()&&!u)return[2,!0];e=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,n.e(7462).then(n.bind(n,27462))];case 4:return[4,(0,c.sent().evaluateTargeting)((0,eb.Cl)((0,eb.Cl)({},s),{flag:r,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:o,loggerProvider:i}))];case 5:return(a=c.sent())&&a.sr_targeting_config&&(e="on"===a.sr_targeting_config.key),s4.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t,targetingMatch:e}),[3,7];case 6:return l=c.sent(),i.warn(l.message),[3,7];case 7:return[2,e]}})})};function s5(e,t){return(e<<t|e>>>32-t)>>>0}function s8(e,t){return Math.imul(e=s5(e=e+Math.imul(t,0x85ebca77)>>>0,13),0x9e3779b1)>>>0}function s7(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var s9="__amplitude_url_tracking_patched__",ae=new WeakMap;function at(e,t,n){if(void 0===n&&(n={}),!(null==e?void 0:e.location))return function(){};var r=n.enablePolling,i=n.pollingInterval;if(void 0!==r&&r){var o=function(){var t;return null!=(t=e.location.href)?t:""},s=o(),a=e.setInterval(function(){var e=o();e!==s&&(s=e,t(e))},void 0===i?1e3:i);return function(){null!=a&&e.clearInterval(a)}}var u=ae.get(e);if(!u){var l=void 0,c=new Set,d=function(){var t;return null!=(t=e.location.href)?t:""},f=function(){var e=d();
1(void 0===l||e!==l)&&(l=e,c.forEach(function(t){return t(e)}))},h=function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t);return f(),r};return t[s9]=!0,t},p=e.history;if(null==p?void 0:p.pushState){var v=Reflect.get(p,"pushState");v[s9]||(p.pushState=h(v))}if(null==p?void 0:p.replaceState){var g=Reflect.get(p,"replaceState");g[s9]||(p.replaceState=h(g))}u={callbacks:c,notify:f,onPopStateOrHashChange:function(){return f()},listenersAttached:!1},ae.set(e,u)}var m=u;return m.listenersAttached||(e.addEventListener("popstate",m.onPopStateOrHashChange),e.addEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!0),m.callbacks.add(t),function(){m.callbacks.delete(t),0===m.callbacks.size&&m.listenersAttached&&(e.removeEventListener("popstate",m.onPopStateOrHashChange),e.removeEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!1)}}function an(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,o,s,a=(0,eb.Cl)((0,eb.Cl)({},e),r),u=a.ugcFilterRules||[],l=null!=(i=a.enablePolling)&&i,c=null!=(o=a.pollingInterval)?o:1e3,d=null!=(s=a.captureDocumentTitle)&&s;if(!n)return function(){};var f=void 0,h=function(){return n.location&&n.location.href||""},p=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=h(),o="";return d&&(o=(null==r?void 0:r.title)||""),{href:u.length>0?o8(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},v=function(){var e=h();(void 0===f||e!==f)&&(f=e,t(p()))},g=at(n,function(){return v()},l?{enablePolling:!0,pollingInterval:c}:{});return v(),function(){return g()}},options:e}}an();var ar=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null==(e=this.mutationObserver)||e.disconnect(),(0,eI.m)()&&(this.sendToAllIframes({type:o$,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var n,r,i,o,s,a;try{for(var u=(0,eb.Ju)(e),l=u.next();!l.done;l=u.next()){var c=l.value;try{for(var d=(i=void 0,(0,eb.Ju)(Array.from(c.addedNodes))),f=d.next();!f.done;f=d.next()){var h=f.value;h instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(h):h instanceof Element&&h.querySelectorAll("iframe").forEach(function(e){t.sendToIframeAfterLoad(e)})}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}try{for(var p=(s=void 0,(0,eb.Ju)(Array.from(c.removedNodes))),v=p.next();!v.done;v=p.next()){var h=v.value;if(h instanceof HTMLIFrameElement){var g=t.pendingLoadListeners.get(h);g&&(h.removeEventListener("load",g),t.pendingLoadListeners.delete(h))}}}catch(e){s={error:e}}finally{try{v&&!v.done&&(a=p.return)&&a.call(p)}finally{if(s)throw s.error}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}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)||e.disconnect(),this.mutationObserver=void 0,this.pendingLoadListeners.forEach(function(e,t){t.removeEventListener("load",e)}),this.pendingLoadListeners.clear(),this.sendToAllIframes({type:o$,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,n=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:o$,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)||n.postMessage(t,"*")}catch(e){}},e}(),ai=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,this.recordFunction=null,this.recordEventsInFlight=!1,this.pendingEmitEvents=[],this.currentPageUrl="",this.recordEventsPendingShouldLogMetadata=null,this.urlChangeCleanup=null,this.crossOriginIframeC
1oordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var n=(0,eI.m)();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)||n.flushQueue(),e.sendEvents(),e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,n,r,i){return void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),(0,eb.sH)(e,void 0,void 0,function(){var e,o,s,a,u,l,c,d,f,h,p,v;return(0,eb.YH)(this,function(g){switch(g.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];else this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.");if(this.lastTargetingParams=t,!((e=this.config.targetingConfig)&&!this.sessionTargetingMatch))return[3,2];return o=i?this.latestUrlChangeTargetingEvaluationId:void 0,(s=t.event)&&Object.values(G).includes(s.event_type)&&(s=void 0),a=null!=(p=null!=(d=null==(c=t.page)?void 0:c.url)?d:null==(h=null==(f=(0,eI.m)())?void 0:f.location)?void 0:h.href)?p:"",u=null!=(v=t.page)?v:""!==a?{url:a}:void 0,[4,s6({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:u},urlChange:i})];case 1:if(l=g.sent(),i&&void 0!==o&&o!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(o,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||l,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),g.label=2;case 2:if(!n)return[3,3];return this.initialize(!0),[3,5];case 3:if(!(r||!this.recordCancelCallback))return[3,5];return this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()];case 4:g.sent(),g.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r=!0),(0,eb.sH)(e,void 0,void 0,function(){var e,i,o,s;return(0,eb.YH)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==el.METADATA)||(e={config:o9(i),version:sb},!r))return[3,2];return[4,o7()];case 1:o=a.sent(),e=(0,eb.Cl)((0,eb.Cl)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,eb.Cl)((0,eb.Cl)({},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 s=a.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",s),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t,n,r;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null==(t=e.networkObservers)||t.stop(),null==(n=e.crossOriginIframeC
1oordinator)||n.stop(),e.crossOriginIframeCoordinator=null,null==(r=e.crossOriginParentSignalCleanup)||r.call(e),e.crossOriginParentSignalCleanup=null}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new oG(new eE)}return e.prototype.init=function(e,t){return ew(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,n=this;null==(e=this.urlChangeCleanup)||e.call(this);var r=(0,eI.m)();if(null==r?void 0:r.location){var i=!!(null==(t=this.config)?void 0:t.targetingConfig),o=at(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.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,eI.m)())?void 0:e.location)?void 0:t.href;return null!=n?{url:n}:void 0},e.prototype._init=function(e,t){var r,i,o,s,a,u,l,c,d,f,h,p,v,g;return(0,eb.sH)(this,void 0,void 0,function(){var m,y,b,w,S,k,E,C,I,x,_,T,P,O,A,R,M,D,L,H,N,U,F,j,q,z,Y,B,V=this;return(0,eb.YH)(this,function(J){switch(J.label){case 0:return null==(r=this.urlChangeCleanup)||r.call(this),this.loggerProvider=new oG(t.loggerProvider||new eE),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=o3(),this.identifiers=new s$({sessionId:t.sessionId,deviceId:t.deviceId}),s3(e,m=Date.now(),this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!=(i=s0(e,t.sessionId,m,this.loggerProvider))?i:m,y=this,[4,(0,eb.sH)(void 0,void 0,void 0,function(){var n;return(0,eb.YH)(this,function(r){return n=new st(e,t),[2,new sd(new eT(e,n.loggerProvider,n.serverZone,t.configServerUrl),n)]})})];case 1:return y.joinedConfigGenerator=J.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:if(w=(b=J.sent()).joinedConfig,S=b.localConfig,k=b.remoteConfig,this.config=w,this.setMetadata(t.sessionId,w,S,k,null==(o=t.version)?void 0:o.version,sb,null==(s=t.version)?void 0:s.type),this.pageLeaveFns=[],t.sessionId&&(null==(a=this.config.interactionConfig)?void 0:a.enabled)&&(E=sX.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[E.send(this.getDeviceId.bind(this)).bind(E)],this.scrollHook=E.hook.bind(E),this.clickHandler=new sV(this.loggerProvider,E)),C=[],"idb"!==(I=this.config.storeType)||(null==(u=(0,eI.m)())?void 0:u.indexedDB)||(I="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(I," for event storage.")),T=(0,eI.m)(),!(this.config.useWebWorker&&T&&T.Worker))return[3,4];return[4,n.e(7303).then(n.bind(n,47303))];case 3:O=(P=J.sent()).compressionScript,A=P.trackDestinationScript,x=O,_=A,J.label=4;case 4:return J.trys.push([4,6,,7]),[4,sO({config:this.config,type:"replay",minInterval:null==(l=this.config.flushIntervalConfig)?void 0:l.minIntervalMs,maxInterval:null==(c=this.config.flushIntervalConfig)?void 0:c.maxIntervalMs,storeType:I,trackDestinationWorkerScript:_,shouldSend:function(){return!V.isBelowMinSessionDuration()}})];case 5:return R=J.sent(),this.rrwebEventManager=R,C.push({name:"replay",manager:R}),[3,7];case 6:return M=J.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(M.toString())),[3,7];case 7:if(!(null==(d=this.config.interactionConfig)?void 0:d.enabled))return[3,11];D=this.config.interactionConfig.batch?sB:sY,J.label=8;case 8:return J.trys.push([8,10,,11]),[4,sO({config:this.config,type:"interaction",minInterval:null!=(f=this.config.interactionConfig.trackEveryNms)?f:3e4,maxInterval:6e4,payloadBatcher:D,storeType:I,trackDestinationWorkerScript:_})];case 9:return L=J.sent(),C.push({name:"interaction",manager:L}),[3,11];case 10:return M=J.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(M.toString())),[3,11];case 11:if(this.eventsManager=new(sA.bind.apply(sA,(0,eb.fX)([void 0],(0,eb.zs)(C),!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new sv(this.eventsManager,this.config,this.getDeviceId(),x,function(){return V.sendEvents()}),this.pendingEmitEvents.length>0){H=this.pendingEmitEvents.splice(0);try{for(U=(N=(0,eb.Ju)(H)).next();!U.done;U=N.next())j=(F=U.value).event,q=F.sessionId,this.eventCompressor.enqueueEvent(j,q)}catch(e){Y={error:e}}finally{try{U&&!U.done&&(B=N.return)&&B.call(N)}finally{if(Y)throw Y.error}}}return this.pageLeaveFns=(0,eb.fX)((0,eb.fX)([],(0,eb.zs)(this.pageLeaveFns),!1),[function(){if(V.config&&(null==(e=V.identifiers)?void 0:e.sessionId)&&R){var e,t=R.getBeaconEvents();if(t.length){var n=V.getDeviceId();!n||V.isBelowMinSessionDuration()||R.trackDestination.sendBeacon({events:t,sessionId:V.identifiers.sessionId,deviceId:n,apiKey:V.config.apiKey,serverZone:V.config.serverZone})}}}],!1),[4,this.initializeNetworkObservers()];case 12:return J.sent(),(null==(h=(0,eI.m)())?void 0:h.opener)&&(rk(z=rw()),z.setup((0,eb.Cl)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:rg[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 J.sent(),(this.config.targetingConfig||(null!=(g=null==(v=null==(p=this.config.privacyConfig)?void 0:p.urlMaskLevels)?void 0:v.length)?g:0)>0)&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(e,t){return ew(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){var r,i,o;return(0,eb.sH)(this,void 0,void 0,function(){var s,a,u,l;return(0,eb.YH)(this,function(c){switch(c.label){case 0:if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(s=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(s),(a=s!==e)&&(null==(r=this.rrwebEventManager)||r.dropPendingBeaconEvents()),u=t||this.getDeviceId(),this.identifiers=new s$({sessionId:e,deviceId:u}),a&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null==(i=this.config)?void 0:i.apiKey)&&(s1(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==s&&s2(this.config.apiKey,s,this.loggerProvider))),!(this.joinedConfigGenerator&&s))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:l=c.sent().joinedConfig,this.config=l,c.label=2;case 2:if(!(null==(o=this.config)?void 0:o.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==n?void 0:n.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return c.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:c.sent(),c.label=6;case 6:return[2]}})})},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,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={})[oj]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[oY]=JSON.stringify({appHash:eH(t.apiKey).toString()}))),this.addCustomRRWebEvent(el.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.sessionId),i=this.getDeviceId();if(this.eventsManager&&r&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;this.loggerProvider.log("Session ".concat(r," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),this.suppressedSendCount++;return}if(!this.hasEmittedGateDecision&&(null==(n=this.config)?void 0:n.minSessionDurationMs)!==void 0&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(el.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,eb.sH)(this,void 0,void 0,function(){var n;return(0,eb.YH)(this,function(r){return(null==(t=this.identifiers)?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(){if(null==(e=this.config)?void 0:e.instanceName){var e,t,n;n=tf(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==n?n:null==(t=this.config)?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.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;return 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,function(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=(r-55296<<10)+(i-56320)+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+0x9e3779b1+0x85ebca77>>>0,a=t+0x85ebca77>>>0,u=t>>>0,l=t-0x9e3779b1>>>0;o<=i-16;)s=s8(s,s7(r,o)),o+=4,a=s8(a,s7(r,o)),o+=4,u=s8(u,s7(r,o)),o+=4,l=s8(l,s7(r,o)),o+=4;n=s5(s,1)+s5(a,7)+s5(u,12)+s5(l,18)>>>0}else n=t+0x165667b1>>>0;for(n=n+i>>>0;o<=i-4;)n=Math.imul(s5(n=n+Math.imul(s7(r,o),0xc2b2ae3d)>>>0,17),0x27d4eb2f)>>>0,o+=4;for(;o<i;)n=Math.imul(s5(n=n+Math.imul(r[o],0x165667b1)>>>0,11),0x9e3779b1)>>>0,o++;return n^=n>>>15,n=Math.imul(n,0x85ebca77)>>>0,n^=n>>>13,n=Math.imul(n,0xc2b2ae3d)>>>0,(n^=n>>>16)>>>0}(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),this.lastShouldRecordDecision!==n&&this.config.targetingConfig&&(this.addCustomRRWebEvent(el.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.privacyConfig)?void 0:t.blockSelector)?n:[];if(0!==r.length)return r},e.prototype.getMaskTextSelectors=function(){var e,t,n=null==(e=this.config)?void 0:e.privacyConfig;if("conservative"===(n?o0(this.currentPageUrl,n):void 0)||(null==(t=null==n?void 0:n.urlMaskLevels)?void 0:t.some(function(e){return"conservative"===e.maskLevel})))return"*";var r=null==n?void 0:n.urlMaskLevels;if((null==n?void 0:n.defaultMaskLevel)==="conservative"&&r&&r.length>0)return"*";var i=null==n?void 0:n.maskSelector;if(i)return i},e.prototype.getRecordingPlugins=function(e){var t,r,i,o,s,a;return(0,eb.sH)(this,void 0,void 0,function(){var u,l,c,d;return(0,eb.YH)(this,function(f){switch(f.label){case 0:u=[];try{l=an({ugcFilterRules:(null==(r=null==(t=this.config)?void 0:t.interactionConfig)?void 0:r.ugcFilterRules)||[],enablePolling:(null==(i=this.config)?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null==(o=this.config)?void 0:o.urlChangePollingInterval,captureDocumentTitle:null==(s=this.config)?void 0:s.captureDocumentTitle}),u.push(l)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null==(a=null==e?void 0:e.console)?void 0:a.enabled))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,n.e(2908).then(n.bind(n,12853))];case 2:return c=f.sent().getRecordConsolePlugin,u.push(c({level:e.console.levels})),[3,4];case 3:return d=f.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,u.length>0?u:void 0]}})})},e.prototype.getRecordFunction=function(){return(0,eb.sH)(this,void 0,void 0,function(){var e,t;return(0,eb.YH)(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,n.e(238).then(n.bind(n,306))];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,eb.sH)(this,void 0,void 0,function(){var t;return(0,eb.YH)(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:if(null===this.recordEventsPendingShouldLogMetadata)return[3,5];return 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]}})})},e.prototype._recordEvents=function(e){var t,n,r,i,o,s,a,u;return void 0===e&&(e=!0),(0,eb.sH)(this,void 0,void 0,function(){var l,c,d,f,h,p,v,g,m,y,b,w,S,k,E,C,I,x,_=this;return(0,eb.YH)(this,function(T){switch(T.label){case 0:if(l=this.config,c=this.getShouldRecord(),d=null==(t=this.identifiers)?void 0:t.sessionId,!c||!d||!l)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(f=T.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:T.sent(),h=null==(n=l.loggingConfig)?void 0:n.network,p=[oJ,oK,oW,sh(l.serverZone,l.trackServerUrl)],null==(r=this.networkObservers)||r.start(function(e){p.some(function(t){return e.url.
1startsWith(t)})||_.addCustomRRWebEvent(el.FETCH_REQUEST,e)},h),v=l.interactionConfig,g=l.loggingConfig,m=(null==v?void 0:v.enabled)?{mouseInteraction:this.eventsManager&&(null==(i=this.clickHandler)?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:f.mirror,ugcFilterRules:null!=(o=v.ugcFilterRules)?o:[],performanceOptions:null==(s=l.performanceConfig)?void 0:s.interaction})),scroll:this.scrollHook}:{},y=(null==v?void 0:v.enabled)&&v.ugcFilterRules?v.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),T.label=3;case 3:if(T.trys.push([3,5,,6]),b=!!(null==(a=l.crossOriginIframes)?void 0:a.enabled),w=(null==(u=l.crossOriginIframes)?void 0:u.coordinateChildren)!==!1,(S=b&&function(){try{var e=(0,eI.m)();if(!e)return!1;return e.parent!==e}catch(e){return!0}}())&&w)return this.crossOriginParentSignalCleanup=function(e){var t=(0,eI.m)();if(!t)return function(){};var n=t.parent;function r(t){if(t.source===n){var r=t.data;(null==r?void 0:r.type)===o$&&("start"===r.action?e.onStart():"stop"===r.action&&e.onStop())}}return t.addEventListener("message",r),function(){return t.removeEventListener("message",r)}}({onStart:function(){return _._recordEventsInChildMode(f,d,l,m)},onStop:function(){try{_.recordCancelCallback&&_.recordCancelCallback(),_.recordCancelCallback=null}catch(e){_.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),[2];return k=this,E=f,C=[(0,eb.Cl)({},this.buildRRWebRecordOptions(l,m,function(e){if(_.shouldOptOut()){_.loggerProvider.log("Opting session ".concat(d," out of recording due to optOut config.")),_.stopRecordingEvents(),_.sendEvents();return}e.type===sn.Meta&&(e.data.href=o8(e.data.href,y)),_.eventCompressor?_.eventCompressor.enqueueEvent(e,d):_.pendingEmitEvents.push({event:e,sessionId:d})},"Error while capturing replay: "))],x={},[4,this.getRecordingPlugins(g)];case 4:return k.recordCancelCallback=E.apply(void 0,[eb.Cl.apply(void 0,C.concat([(x.plugins=T.sent(),x.recordCrossOriginIframes=b,x)]))]),b&&!S&&w&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new ar),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(el.DEBUG_INFO),e&&this.addCustomRRWebEvent(el.METADATA,this.metadata),[3,6];case 5:return I=T.sent(),this.loggerProvider.warn("Failed to initialize session replay:",I),[3,6];case 6:return[2]}})})},e.prototype.buildRRWebRecordOptions=function(e,t,n,r){var i,o=this,s=e.privacyConfig;return(0,eb.Cl)((0,eb.Cl)({emit:n,inlineStylesheet:e.shouldInlineStylesheet,hooks:t,maskAllInputs:!0,maskTextClass:oB,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements,maskInputFn:o2("input",s,function(){return o.currentPageUrl}),maskTextFn:o2("text",s,function(){return o.currentPageUrl}),maskAttributeFn:(i=function(){return o.currentPageUrl},function(e,t,n){var r;return"style"!==e&&(null!=(r=null==s?void 0:s.maskAttributes)?r:[]).includes(e)?o1(["INPUT","SELECT","TEXTAREA"].includes(n.tagName)?"input":"text",s,n,null==i?void 0:i())?t.replace(/[^\s]/g,"*"):t:t}),maskTextSelector:this.getMaskTextSelectors()},void 0!==e.fullSnapshotIntervalMs&&{checkoutEveryNms:e.fullSnapshotIntervalMs}),{recordCanvas:!1,captureAdoptedStyleSheets:e.captureAdoptedStyleSheets,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return o.loggerProvider.warn(r,e.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,n,r){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e((0,eb.Cl)((0,eb.Cl)({},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(e){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",e)}},e.prototype.getDeviceId=function(){var e;return null==(e=this.identifiers)?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null==(e=this.identifiers)?void 0:e.sessionId},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e,t;null==(e=this.urlChangeCleanup)||e.call(this),null==(t=this.crossOriginParentSignalCleanup)||t.call(this),this.crossOriginParentSignalCleanup=null,this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,n,r,i,o,s){var a=(null==e?void 0:e.toString())?eH(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,eb.sH)(this,void 0,void 0,function(){var i,o;return(0,eb.YH)(this,function(s){switch(s.label){case 0:if(!((null==(r=null==(t=null==(e=this.config)?void 0:e.loggingConfig)?void 0:t.network)?void 0:r.enabled)&&!this.networkObservers))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.e(3893).then(n.bind(n,33893))];case 2:return i=s.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return o=s.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",o),[3,4];case 4:return[2]}})})},e}(),ao=function(e){return function(){var t=e.config||se();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let as={init:tx((O=new ai).init.bind(O),"init",ao(O)),evaluateTargetingAndCapture:tx(O.evaluateTargetingAndCapture.bind(O),"evaluateTargetingAndRecord",ao(O)),setSessionId:tx(O.setSessionId.bind(O),"setSessionId",ao(O)),getSessionId:tx(O.getSessionId.bind(O),"getSessionId",ao(O)),getSessionReplayProperties:tx(O.getSessionReplayProperties.bind(O),"getSessionReplayProperties",ao(O)),flush:tx(O.flush.bind(O),"flush",ao(O)),shutdown:tx(O.shutdown.bind(O),"shutdown",ao(O))};var aa=as.init,au=as.setSessionId,al=as.getSessionId,ac=as.getSessionReplayProperties,ad=as.flush,af=as.shutdown,ah=as.evaluateTargetingAndCapture;(A=eh||(eh={})).SET="$set",A.SET_ONCE="$setOnce",A.ADD="$add",A.APPEND="$append",A.PREPEND="$prepend",A.REMOVE="$remove",A.PREINSERT="$preInsert",A.POSTINSERT="$postInsert",A.UNSET="$unset",A.CLEAR_ALL="$clearAll",(R=ep||(ep={})).REVENUE_PRODUCT_ID="$productId",R.REVENUE_QUANTITY="$quantity",R.REVENUE_PRICE="$price",R.REVENUE_TYPE="$revenueType",R.REVENUE_CURRENCY="$currency",R.REVENUE="$revenue",(M=ev||(ev={})).IDENTIFY="$identify",M.GROUP_IDENTIFY="$groupidentify",M.REVENUE="revenue_amount";var ap=[eh.SET,eh.SET_ONCE,eh.ADD,eh.APPEND,eh.PREPEND,eh.POSTINSERT],av=function(e){if(e.user_properties){var t={};
1return Object.keys(e.user_properties).forEach(function(n){if(ap.includes(n)){var r=e.user_properties&&e.user_properties[n];t=(0,eb.Cl)((0,eb.Cl)({},t),r)}}),t}},ag="1.31.1",am="".concat("[Amplitude]"," Session Replay ID"),ay=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:ad,getSessionId:al,getSessionReplayProperties:ac,init:aa,setSessionId:au,shutdown:af,evaluateTargetingAndCapture:ah},this.options=(0,eb.Cl)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,o,s,a,u,l;return(0,eb.sH)(this,void 0,void 0,function(){var t,c;return(0,eb.YH)(this,function(d){switch(d.label){case 0:var f;return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(ag,".")),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,eb.Cl)((0,eb.Cl)({},e.defaultTracking),{sessions:!0})),t=(void 0===(f=this.config.instanceName)&&(f="$default_instance"),e1.getInstance(f)).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!=(n=this.options.deviceId)?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.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null==(i=this.options.privacyConfig)?void 0:i.blockSelector,maskSelector:null==(o=this.options.privacyConfig)?void 0:o.maskSelector,unmaskSelector:null==(s=this.options.privacyConfig)?void 0:s.unmaskSelector,defaultMaskLevel:null==(a=this.options.privacyConfig)?void 0:a.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:ag},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!=(u=this.options.useWebWorker)?u:null==(l=this.options.experimental)?void 0:l.useWebWorker,userProperties:t,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval,captureAdoptedStyleSheets:this.options.captureAdoptedStyleSheets,crossOriginIframes:this.options.crossOriginIframes,flushIntervalConfig:this.options.flushIntervalConfig},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return d.sent(),[3,3];case 2:return c=d.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(c.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){switch(n.label){case 0:return null==(t=this.config)||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return n.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){switch(n.label){case 0:if(null==(t=this.config)||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),!e)return[3,1];return this.sessionReplay.shutdown(),[3,4];case 1:if(null==this.config)return[3,3];return[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise];case 2: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,eb.sH)(this,void 0,void 0,function(){var i,o,s,a,u;return(0,eb.YH)(this,function(l){switch(l.label){case 0:if(l.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(i=this.options.customSessionId(e)))return[3,3];if(i===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(i).promise];case 1:l.sent(),l.label=2;case 2:o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,eb.Cl)((0,eb.Cl)({},e.event_properties),o),l.label=3;case 3:return[3,8];case 4:if(!((i=null==(t=this.config)?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(i).promise];case 5:l.sent(),l.label=6;case 6:if(!(i&&i===e.session_id))return[3,8];return s=void 0,e.event_type===G.IDENTIFY&&(s=av(e)),a=(0,eI.m)(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:s,page:(null==(n=null==a?void 0:a.location)?void 0:n.href)!=null?{url:a.location.href}:void 0})];case 7:l.sent(),o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,eb.Cl)((0,eb.Cl)({},e.event_properties),o),l.label=8;case 8:return e.event_type===G.IDENTIFY&&e.event_properties&&delete e.event_properties[am],[2,Promise.resolve(e)];case 9:return u=l.sent(),null==(r=this.config)||r.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(u.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null==(e=this.config)||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName="@amplitude/plugin-session-replay-browser",e}
1(),ab=n(9291).Buffer,aw=function(e,t){return(aw=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])})(e,t)};function aS(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}aw(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var ak=function(){return(ak=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}).apply(this,arguments)};function aE(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})}function aC(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){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function aI(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 TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ax(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function a_(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"==typeof SuppressedError&&SuppressedError;var aT="is not",aP="contains",aO="does not contain",aA="less",aR="less or equal",aM="greater",aD="greater or equal",aL="version less",aH="version less or equal",aN="version greater",aU="version greater or equal",aF="set is",aj="set is not",aq="set contains",az="set does not contain",aY="set contains any",aB="set does not contain any",aV=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:((64512&i)==55296&&r+1<e.length&&(64512&e.charCodeAt(r+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return Uint8Array.from(t)},aJ=function(e,t){void 0===t&&(t=0);for(var n=aV(e),r=n.length,i=r>>2,o=t,s=0;s<i;s++)o=aK(a$(n,s<<2),o);var a=i<<2,u=0;switch(r-a){case 3:u^=n[a+2]<<16,u^=n[a+1]<<8,u^=n[a],o^=u=Math.imul(u=aX(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=n[a+1]<<8,u^=n[a],o^=u=Math.imul(u=aX(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=n[a],o^=u=Math.imul(u=aX(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return aW(o^=r)>>>0},aK=function(e,t){var n=e,r=t;return r^=n=Math.imul(n=aX(n=Math.imul(n,-0x3361d2af),15),0x1b873593),(r=Math.imul(r=aX(r,13),5))+-0x19ab949c|0},aW=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-0x7a143595),t^=t>>>
113,t=Math.imul(t,-0x3d4d51cb),t^=t>>>16},aX=function(e,t,n){void 0===n&&(n=32),t>n&&(t%=n);var r=(e&0xffffffff<<n-t>>>0)>>>0>>>n-t>>>0;return(e<<t|r)>>>0},a$=function(e,t){return void 0===t&&(t=0),aG(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},aG=function(e){return(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24},aQ=function(e,t){var n,r;if(t&&0!==t.length){try{for(var i=aI(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}if(null==e)return;return e}},aZ="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),a0=function(){function e(e,t,n,r){void 0===r&&(r=void 0),this.major=e,this.minor=t,this.patch=n,this.preRelease=r}return e.parse=function(t){if(t){var n=new RegExp(aZ).exec(t);if(n){var r=Number(n[1]),i=Number(n[2]);if(!(isNaN(r)||isNaN(i)))return new e(r,i,Number(n[4])||0,n[5]||void 0)}}},e.prototype.compareTo=function(e){if(this.major>e.major)return 1;if(this.major<e.major)return -1;if(this.minor>e.minor)return 1;if(this.minor<e.minor)return -1;if(this.patch>e.patch)return 1;if(this.patch<e.patch||this.preRelease&&!e.preRelease)return -1;if(!this.preRelease&&e.preRelease)return 1;if(this.preRelease&&e.preRelease){if(this.preRelease>e.preRelease)return 1;if(this.preRelease<e.preRelease)return -1}return 0},e}(),a1=function(){function e(){}return e.prototype.evaluate=function(e,t){var n,r,i={},o={context:e,result:i};try{for(var s=aI(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=this.evaluateFlag(o,u);l&&(i[u.key]=l)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i},e.prototype.evaluateWithTraces=function(e,t){var n,r,i={},o={},s={context:e,result:i};try{for(var a=aI(t),u=a.next();!u.done;u=a.next()){var l=u.value,c=this.evaluateFlagWithTrace(s,l),d=c.variant,f=c.trace;d&&(i[l.key]=d),o[l.key]=f}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return{results:i,traces:o}},e.prototype.evaluateFlag=function(e,t){try{for(var n,r,i,o=aI(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var u=ak(ak(ak({},t.metadata),a.metadata),i.metadata);i=ak(ak({},i),{metadata:u});break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},e.prototype.evaluateFlagWithTrace=function(e,t){var n,r,i,o,s,a,u,l,c,d,f,h=[];try{for(var p=aI(t.segments),v=p.next();!v.done;v=p.next()){var g=v.value;if(!g.conditions){var m=this.bucket(e,g),y=void 0!==m;h.push({segmentMetadata:g.metadata,conditionsPassed:!0,bucketed:y,bucketVariant:m,conditionResult:void 0,matched:y}),c||void 0===m||(c=t.variants[m],d=g,f=null==(u=g.metadata)?void 0:u.segmentName);continue}var b=[],w=!1;try{for(var S=(i=void 0,aI(g.conditions)),k=S.next();!k.done;k=S.next()){var E=k.value,C=!0,I=[];try{for(var x=(s=void 0,aI(E)),_=x.next();!_.done;_=x.next()){var T=_.value,P=aQ(e,T.selector),O=this.matchCondition(e,T);if(I.push({propValue:P,condition:T,matched:O}),!O){C=!1;break}}}catch(e){s={error:e}}finally{try{_&&!_.done&&(a=x.return)&&a.call(x)}finally{if(s)throw s.error}}if(b.push(I),C){w=!0;break}}}catch(e){i={error:e}}finally{try{k&&!k.done&&(o=S.return)&&o.call(S)}finally{if(i)throw i.error}}var A=!1,R=void 0;w&&(R=this.bucket(e,g),A=void 0!==R),h.push({segmentMetadata:g.metadata,conditionsPassed:w,bucketed:A,bucketVariant:R,conditionResult:b,matched:w&&A}),w&&void 0!==R&&!c&&(c=t.variants[R],d=g,f=null==(l=g.metadata)?void 0:l.segmentName)}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}if(c&&d){var M=ak(ak(ak({},t.metadata),d.metadata),c.metadata);c=ak(ak({},c),{metadata:M})}var D={flagKey:t.key,matched:void 0!==c,matchedSegment:f,steps:h};return{variant:c,trace:D}},e.prototype.evaluateSegment=function(e,t,n){if(!n.conditions){var r=this.bucket(e,n);return void 0!==r?t.variants[r]:void 0}if(this.evaluateConditions(e,n.conditions)){var r=this.bucket(e,n);if(void 0!==r)return t.variants[r]}},e.prototype.evaluateConditions=function(e,t){var n,r,i,o;try{for(var s=aI(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=!0;try{for(var c=(i=void 0,aI(u)),d=c.next();!d.done;d=c.next()){var f=d.value;if(!(l=this.matchCondition(e,f)))break}}catch(e){i={error:e}}
1finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}if(l)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!1},e.prototype.matchCondition=function(e,t){var n=aQ(e,t.selector);if(null==n)return this.matchNull(t.op,t.values);var r=this.coerceStringArray(n);if(this.isSetOperator(t.op))return!!r&&this.matchSet(r,t.op,t.values);if(r)return this.matchStringsNonSet(r,t.op,t.values);var i=this.coerceString(n);return void 0!==i&&this.matchString(i,t.op,t.values)},e.prototype.getHash=function(e){return aJ(e)},e.prototype.bucket=function(e,t){if(!t.bucket)return t.variant;var n,r,i,o,s=this.coerceString(aQ(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),u=this.getHash(a),l=u%100,c=Math.floor(u/100);try{for(var d=aI(t.bucket.allocations),f=d.next();!f.done;f=d.next()){var h=f.value,p=h.range[0],v=h.range[1];if(l>=p&&l<v)try{for(var g=(i=void 0,aI(h.distributions)),m=g.next();!m.done;m=g.next()){var y=m.value,b=y.range[0],w=y.range[1];if(c>=b&&c<w)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return t.variant},e.prototype.matchNull=function(e,t){var n=this.containsNone(t);switch(e){case"is":case aP:case aA:case aR:case aM:case aD:case aL:case aH:case aN:case aU:case aF:case aq:case aY:return n;case aT:case aO:case az:case aB:return!n;default:return!1}},e.prototype.matchSet=function(e,t,n){switch(t){case aF:return this.setEquals(e,n);case aj:return!this.setEquals(e,n);case aq:return this.matchesSetContainsAll(e,n);case az:return!this.matchesSetContainsAll(e,n);case aY:return this.matchesSetContainsAny(e,n);case aB:return!this.matchesSetContainsAny(e,n);default:return!1}},e.prototype.matchString=function(e,t,n){var r=this;switch(t){case"is":return this.matchesIs(e,n);case aT:return!this.matchesIs(e,n);case aP:return this.matchesContains(e,n);case aO:return!this.matchesContains(e,n);case aA:case aR:case aM:case aD:return this.matchesComparable(e,t,n,function(e){return r.parseNumber(e)},this.comparator);case aL:case aH:case aN:case aU:return this.matchesComparable(e,t,n,function(e){return a0.parse(e)},this.versionComparator);case"regex match":return this.matchesRegex(e,n);case"regex does not match":return!this.matchesRegex(e,n);default:return!1}},e.prototype.matchStringsNonSet=function(e,t,n){var r=this;return e.some(function(e){return r.matchString(e,t,n)})},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var n=e.toLowerCase();if("true"===n||"false"===n)return t.some(function(e){return e.toLowerCase()===n})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var n,r;try{for(var i=aI(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.prototype.matchesComparable=function(e,t,n,r,i){var o=this,s=r(e),a=n.map(function(e){return r(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?n.some(function(n){return o.comparator(e,t,n)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,n){switch(t){case aA:case aL:return e<n;case aR:case aH:return e<=n;case aM:case aN:return e>n;case aD:case aU:return e>=n;default:return!1}},e.prototype.versionComparator=function(e,t,n){var r=e.compareTo(n);switch(t){case aA:case aL:return r<0;case aR:case aH:return r<=0;case aM:case aN:return r>0;case aD:case aU:return r>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return!!new RegExp(t).exec(e)})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!=(t=Number(e))?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map(function(e){return t.coerceString(e)}
1).filter(Boolean);var n=String(e);if(n.startsWith("["))try{var r=JSON.parse(n);if(Array.isArray(r))return r.map(function(e){return t.coerceString(e)}).filter(Boolean);return}catch(e){return}},e.prototype.isSetOperator=function(e){switch(e){case aF:case aj:case aq:case az:case aY:case aB:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var n=new Set(e),r=new Set(t);return n.size===r.size&&a_([],ax(r),!1).every(function(e){return n.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var n,r;if(e.length<t.length)return!1;try{for(var i=aI(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var n,r;try{for(var i=aI(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e}(),a2=function(e,t){var n,r,i=ak({},e),o=[],s=t||Object.keys(i);try{for(var a=aI(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=a3(l,i);c&&o.push.apply(o,a_([],ax(c),!1))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},a3=function(e,t,n){void 0===n&&(n=[]);var r,i,o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];n.push(o.key);var s=[],a=function(e){if(n.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(n));var r=a3(e,t,n);r&&s.push.apply(s,a_([],ax(r),!1))};try{for(var u=aI(o.dependencies),l=u.next();!l.done;l=u.next()){var c=l.value;a(c)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return s.push(o),n.pop(),delete t[o.key],s}};let a4="function"==typeof ab,a6="function"==typeof TextDecoder?new TextDecoder:void 0,a5="function"==typeof TextEncoder?new TextEncoder:void 0,a8=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),a7=(i={},a8.forEach((e,t)=>i[e]=t),i),a9=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ue=String.fromCharCode.bind(String),ut="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),un=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),ur="function"==typeof btoa?e=>btoa(e):a4?e=>ab.from(e,"binary").toString("base64"):e=>{let t,n,r,i,o="",s=e.length%3;for(let s=0;s<e.length;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw TypeError("invalid character found");o+=a8[(t=n<<16|r<<8|i)>>18&63]+a8[t>>12&63]+a8[t>>6&63]+a8[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},ui=a4?e=>ab.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(ue.apply(null,e.subarray(n,n+4096)));return ur(t.join(""))},uo=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?ue(192|t>>>6)+ue(128|63&t):ue(224|t>>>12&15)+ue(128|t>>>6&63)+ue(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return ue(240|t>>>18&7)+ue(128|t>>>12&63)+ue(128|t>>>6&63)+ue(128|63&t)},us=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ua=a4?e=>ab.from(e,"utf8").toString("base64"):a5?e=>ui(a5.encode(e)):e=>ur(e.replace(us,uo)),uu=(e,t=!1)=>t?un(ua(e)):ua(e),ul=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,uc=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return ue((t>>>10)+55296)+ue((1023&t)+56320);case 3:return ue((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return ue((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},ud="function"==typeof atob?e=>atob(e.replace(/[^A-Za-z0-9\+\/]/g,"")):a4?e=>ab.from(e,"base64").toString("binary"):e=>{let t,n,r;if(e=e.replace(/\s+/g,""),!a9.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let i=[];for(let o=0;o<e.length;)t=a7[e.charAt(o++)]<<18|a7[e.charAt(o++)]<<12|(n=a7[e.charAt(o++)])<<6|(r=a7[e.charAt(o++)]),64===n?i.push(ue(t>>16&255)):64===r?i.push(ue(t>>16&255,t>>8&255)):i.push(ue(t>>16&255,t>>8&255,255&t));return i.join("")},uf=a4?e=>ut(ab.from(e,"base64")):e=>ut(ud(e).split("").map(e=>e.charCodeAt(0))),uh=a4?e=>ab.from(e,"base64").toString("utf8"):a6?e=>a6.decode(uf(e)):e=>ud(e).replace(ul,uc);var up=function(e){function t(n,r){var i=e.call(this,r)||this;return i.statusCode=n,Object.setPrototypeOf(i,t.prototype),i}return aS(t,e),t}(Error),uv=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return aS(t,e),t}(Error),ug=function(){function e(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}return e.prototype.getVariants=function(e,t){return aE(this,void 0,void 0,function(){var n,r,i,o;return aC(this,function(s){switch(s.label){case 0:return n=uu(JSON.stringify(e),!0),r={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":n},(null==t?void 0:t.flagKeys)&&(r["X-Amp-Exp-Flag-Keys"]=uu(JSON.stringify(t.flagKeys),!0)),(null==t?void 0:t.trackingOption)&&(r["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(r["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption),i=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:r,timeoutMillis:null==t?void 0:t.t
1imeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new up(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),um=function(){function e(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}return e.prototype.getFlags=function(e){return aE(this,void 0,void 0,function(){var t,n;return aC(this,function(r){switch(r.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=uu(JSON.stringify(e.user),!0)),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(n=r.sent()).status)throw Error("Flags error response: status=".concat(n.status));return[2,JSON.parse(n.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),uy="u">typeof globalThis?globalThis:n.g||self,ub=function(){return"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:void 0!==n.g?n.g:void 0},uw=function(){var e=ub();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1},uS=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=uy.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(uy.clearInterval(this.poller),this.poller=void 0)},e}(),uk=n(46880);function uE(e){this.amplitudeInstance=e}function uC(e){this.amplitudeInstance=e}uE.prototype.getUser=function(){var e,t,n,r,i,o,s,a,u,l;return{device_id:null==(t=null==(e=this.amplitudeInstance)?void 0:e.options)?void 0:t.deviceId,user_id:null==(r=null==(n=this.amplitudeInstance)?void 0:n.options)?void 0:r.userId,version:null==(o=null==(i=this.amplitudeInstance)?void 0:i.options)?void 0:o.versionName,language:null==(a=null==(s=this.amplitudeInstance)?void 0:s.options)?void 0:a.language,platform:null==(l=null==(u=this.amplitudeInstance)?void 0:u.options)?void 0:l.platform,os:this.getOs(),device_model:this.getDeviceModel()}},uE.prototype.getOs=function(){var e,t,n,r,i,o;return[null==(n=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.browser)?void 0:n.name,null==(o=null==(i=null==(r=this.amplitudeInstance)?void 0:r._ua)?void 0:i.browser)?void 0:o.major].filter(function(e){return null!=e}).join(" ")},uE.prototype.getDeviceModel=function(){var e,t,n;return null==(n=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.os)?void 0:n.name},uC.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},uC.prototype.setUserProperty=function(e){var t,n;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null==(n=e.variant)?void 0:n.value,t))},uC.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:((t={})[e.userProperty]="-",t)})};var uI=function(){return(uI=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}).apply(this,arguments)};function ux(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)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){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function uT(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 TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function uP(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function uO(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"==typeof SuppressedError&&SuppressedError;var uA=function(e,t){void 0===t&&(t=!1);var n,r,i=uD(e,t),o=void 0,s=uy.document.cookie.split("; ");try{for(var a=uT(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=uP(l.split("=",2),2),d=c[0],f=c[1];d===i&&(o=decodeURIComponent(f))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),v=void 0;return p.length>=2&&p[1]&&(v=atob(p[1])),{deviceId:p[0],userId:v}}catch(e){return}},uR=function(e){var t=uD(e,!0);try{var n=uy.localStorage.getItem(t);if(!n)return;var r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}},uM=function(e){var t=uD(e,!0);try{var n=uy.sessionStorage.getItem(t);if(!n)return;var r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}},uD=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},uL=function(){function e(e,t,n){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=n,this.loadPersistedState(),n<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return ux(this,void 0,void 0,function(){return u_(this,function(n){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=uA(this.apiKey,!0);return!!(e||(e=uA(this.apiKey,!1))||(e=uR(this.apiKey))||(e=uM(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return ux(this,void 0,void 0,function(){var t,n=this;return u_(this,function(r){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),n.identityStore.removeIdentityListener(t)};n.identityStore.addIdentityListener(t)}),new Promise(function(t,n){uy.setTimeout(n,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}(),uH=uy.fetch||function(e,t){return t=t||{},new Promise(function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var l in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n}),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)})},uN=function(){function e(e){this.client=e}return e.prototype.request=function(e){return ux(this,void 0,void 0,function(){return u_(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),uU={request:function(e,t,n,r,i){var o;return o=ux(void 0,void 0,void 0,function(){var i,o;return u_(this,function(s){switch(s.label){case 0:return[4,uH(e,{method:t,headers:n,body:r})];case 1:return o={status:(i=s.sent()).status},[4,i.text()];case 2:return o.body=s.sent(),[2,o]}})}),null==i||i<=0?o:new Promise(function(e,t){uy.setTimeout(function(){t(new uv("Request timeout after "+i+" milliseconds"))},i),o.then(e,t)})}};(D=eg||(eg={}))[D.Disable=0]="Disable",D[D.Error=1]="Error",D[D.Warn=2]="Warn",D[D.Info=3]="Info",D[D.Debug=4]="Debug",D[D.Verbose
1=5]="Verbose",(L=em||(em={})).LocalStorage="localStorage",L.InitialVariants="initialVariants",(H=ey||(ey={})).LocalStorage="storage",H.InitialVariants="initial",H.SecondaryLocalStorage="secondary-storage",H.SecondaryInitialVariants="secondary-initial",H.FallbackInline="fallback-inline",H.FallbackConfig="fallback-config",H.LocalEvaluation="local-evaluation";var uF=function(e){return!e||e===ey.FallbackInline||e===ey.FallbackConfig||e===ey.SecondaryInitialVariants},uj={debug:!1,logLevel:eg.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:em.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:uU},uq="1.21.1",uz=function(){function e(e,t){var n,r=this;this.isReady=new Promise(function(e){r.resolve=e}),this.config=e,this.client=t;var i=null!=(n=e.instanceName)?n:uj.instanceName;this.queue=new uB(i),this.cache=new uY(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e,t){if(this.cache.shouldTrack(e,t)){var n=this.getExposureEvent(e);this.queue.push(n)}},e.prototype.getExposureEvent=function(e){var t,n,r,i={eventType:"$exposure",eventProperties:e};return(null==(t=e.metadata)?void 0:t.exposureEvent)?i={eventType:null==(n=e.metadata)?void 0:n.exposureEvent,eventProperties:e}:(null==(r=e.metadata)?void 0:r.deliveryMethod)==="web"&&(i={eventType:"$impression",eventProperties:e}),i},e}(),uY=function(){function e(e){this.isSessionStorageAvailable=uV(),this.inMemoryCache={},this.identity={},this.storageKey="EXP_sent_v3_".concat(e),this.isSessionStorageAvailable&&(uy.sessionStorage.removeItem("EXP_sent_".concat(e)),uy.sessionStorage.removeItem("EXP_sent_v2_".concat(e)))}return e.prototype.shouldTrack=function(e,t){if((null==(n=e.metadata)?void 0:n.deliveryMethod)==="web")return!0;var n,r,i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();var o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!=(r=e.variant)?r:null,u=!1;return o&&(null!=s?s:null)===a||(u=!0,this.inMemoryCache[e.flag_key]=a),this.storeCache(),u},e.prototype.clearCache=function(){this.inMemoryCache={},this.isSessionStorageAvailable&&uy.sessionStorage.removeItem(this.storageKey)},e.prototype.identityEquals=function(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=uy.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){if(this.isSessionStorageAvailable)try{uy.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}},e}(),uB=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=uw(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=uy.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){if(this.tracker&&0!==this.inMemoryQueue.length){for(var e=0;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller&&(uy.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=uy.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),uy.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),uV=function(){var e=ub();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1},uJ=function(){function e(e,t){void 0===t&&(t=eg.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.logLevel>=eg.Error&&(t=this.logger).error.apply(t,uO([e],uP(n),!1))},e.prototype.warn=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.logLevel>=eg.Warn&&(t=this.logger).warn.apply(t,uO([e],uP(n),!1))},e.prototype.info=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.logLevel>=eg.Info&&(t=this.logger).info.apply(t,uO([e],uP(n),!1))},e.prototype.debug=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.logLevel>=eg.Debug&&(t=this.logger).debug.apply(t,uO([e],uP(n),!1))},e.prototype.verbose=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.logLevel>=eg.Verbose&&(t=this.logger).verbose.apply(t,uO([e],uP(n),!1))},e}(),uK=function(){function e(){}return e.prototype.error=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];console.error.apply(console,uO([e],uP(t),!1))},e.prototype.warn=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];console.warn.apply(console,uO([e],uP(t),!1))},e.prototype.info=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];console.info.apply(console,uO([e],uP(t),!1))},e.prototype.debug=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];console.debug.apply(console,uO([e],uP(t),!1))},e.prototype.verbose=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];console.debug.apply(console,uO([e],uP(t),!1))},e}(),uW=function(){function e(){this.globalScope=ub()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var n;null==(n=this.globalScope)||n.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.localStorage.removeItem(e)},e}(),uX=function(e,t,n){var r=e.substring(e.length-6);return new uZ("amp-exp-".concat(t,"-").concat(r),n,u0)},u$=function(e,t,n){void 0===n&&(n=new uW);var r=e.substring(e.length-6);return new uZ("amp-exp-".concat(t,"-").concat(r,"-flags"),n)},uG=function(e,t,n){void 0===n&&(n=new uW);var r=e.substring(e.length-6);return new uQ("amp-exp-".concat(t,"-").concat(r,"-variants-options"),n)},uQ=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),uZ=function(){function e(e,t,n){this.cache={},this.namespace=e,this.storage=t,this.transformer=n}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return uI({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,n;try{for(var r=uT(Object.keys(e)),i=r.next();!i.done;i=r.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,n,r=this.storage.get(this.namespace);try{n=JSON.parse(r)||{}}catch(e){return}var i={};try{for(var o=uT(Object.keys(n)),s=o.next();!s.done;s=o.next()){var a=s.value;try{var u=void 0;(u=this.transformer?this.transformer(n[a]):n[a])&&(i[a]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),u0=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,n=e.value,r=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);var s={};return t?s.key=t:n&&(s.key=n),n&&(s.value=n),i&&(s.metadata=i),r&&(s.payload=r),o&&(s.expKey=o),s}},u1=function(){function e(){this.globalScope=ub()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var n;null==(n=this.globalScope)||n.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.sessionStorage.removeItem(e)},e}(),u2=function(e,t,n,r){var i,o=null==n?void 0:n.value,s="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:n,userProperty:s,properties:{key:t,variant:o,source:r},userProperties:((i={})[s]=o,i)}},u3=function(e){return null==e}
1,u4=function(e){return!!u3(e)||e&&0===Object.keys(e).length},u6=function(e){if(!e||"object"!=typeof e)return{};var t,n,r={};try{for(var i=uT(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=uP(o.value,2),a=s[0],u=s[1];u3(u)||(r[a]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r},u5=function(e){var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"},u8=function(){function e(e,t,n,r){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=n,this.scalar=r}return e.prototype.start=function(e){return ux(this,void 0,void 0,function(){return u_(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,n){return ux(this,void 0,void 0,function(){var r=this;return u_(this,function(i){return this.done||(this.timeoutHandle=uy.setTimeout(function(){return ux(r,void 0,void 0,function(){var r,i;return u_(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(r=t+1)<this.attempts&&(i=Math.min(n*this.scalar,this.max),this.backoff(e,r,i)),[3,3];case 3:return[2]}})})},n)),[2]})})},e}(),u7=function(e){if(!e)return{};var t,n,r,i,o={user:e},s=ub();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var u=uT(Object.keys(e.groups)),l=u.next();!l.done;l=u.next()){var c=l.value,d=e.groups[c];if(d.length>0&&d[0]){var f=d[0],h={group_name:f},p=null==(i=null==(r=e.group_properties)?void 0:r[c])?void 0:i[f];p&&Object.keys(p).length>0&&(h.group_properties=p),a[c]=h}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(o.groups=a),delete o.user.groups,delete o.user.group_properties,o},u9=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},le=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var n={};return e.key&&(n.key=e.key),e.value&&(n.value=e.value),e.payload&&(n.payload=e.payload),t&&(n.expKey=t),e.metadata&&(n.metadata=e.metadata),n},lt=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),ln=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var n={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,n)||(this.tracked={}),this.identity=n;var r=e.flag_key in this.tracked,i=this.tracked[e.flag_key];r&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),lr=function(){function e(t,n){var r,i,o,s,a,u=this;this.engine=new a1,this.isRunning=!1,this.apiKey=t,n=u6(n),this.config=uI(uI(uI({},uj),n),{serverUrl:(null==n?void 0:n.serverUrl)||((null==(r=null==n?void 0:n.serverZone)?void 0:r.toLowerCase())==="eu"?"https://api.lab.eu.amplitude.com":uj.serverUrl),flagsServerUrl:(null==n?void 0:n.flagsServerUrl)||((null==(i=null==n?void 0:n.serverZone)?void 0:i.toLowerCase())==="eu"?"https://flag.lab.eu.amplitude.com":uj.flagsServerUrl),flagConfigPollingIntervalMillis:n.flagConfigPollingIntervalMillis<6e4?6e4:null!=(o=n.flagConfigPollingIntervalMillis)?o:uj.flagConfigPollingIntervalMillis}),this.logger=new uJ(this.config.loggerProvider||new uK,e.getLogLevel(n));var l=null==(s=this.config)?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new uS(function(){return ux(u,void 0,void 0,function(){var e;return u_(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.doFlags()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this.logger.info(e),[3,3];case 3:return[2]}})})},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var c in this.config.initialVariants)this.config.initialVariants[c]=u0(this.config.initialVariants[c]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new lt(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new ln(this.config.exposureTrackingProvider)),this.integrationManager=new uz(this.config,this);var d=new uN(this.config.httpClient||uU);this.flagApi=new um(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new ug(this.apiKey,this.config.serverUrl,d);var f=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;a=this.isWebExperiment?new u1:new uW,this.variants=uX(this.apiKey,f,a),this.flags=u$(this.apiKey,f,a),this.fetchVariantsOptions=uG(this.apiKey,f,a);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return ux(this,void 0,void 0,function(){var t,n,r;return u_(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:if(i.trys.push([1,6,,7]),t=this.doFlags(),!(null==(r=this.config.fetchOnStart)||r))return[3,3];return[4,Promise.all([this.fetch(e),t])];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(n=i.sent(),this.config.throwOnError)throw n;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return ux(this,arguments,void 0,function(e,t){var n;return void 0===e&&(e=this.user),u_(this,function(r){switch(r.label){case 0:this.setUser(e||{}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return r.sent(),[3,4];case 3:if(n=r.sent(),this.config.throwOnError)throw n;return n instanceof uv?this.logger.debug(n):this.logger.error(n),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){if(!this.apiKey)return{value:void 0};var n,r,i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null==(n=i.variant)?void 0:n.key)||(null==(r=i.variant)?void 0:r.value))),i.variant||{}}
1,e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e)u5(this.flags.get(t))||delete e[t];return uI(uI(uI({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){if(!this.user)return this.user;if(null==(e=this.user)||!e.user_properties)return uI({},this.user);var e,t=uI({},this.user.user_properties);return uI(uI({},this.user),{user_properties:t})},e.prototype.setUser=function(e){var t;if(!e){this.user=null;return}if(null==(t=this.user)?void 0:t.user_properties){var n=uI({},e.user_properties);this.user=uI(uI({},e),{user_properties:n})}else this.user=uI({},e)},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,n,r=this.addContext(this.user),i=a2(this.flags.getAll(),e),o=u7(r),s=this.engine.evaluate(o,i),a={};try{for(var u=uT(Object.keys(s)),l=u.next();!l.done;l=u.next()){var c=l.value;a[c]=le(s[c])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return a},e.prototype.getEvaluationTraces=function(e){var t=this.addContext(this.user),n=a2(this.flags.getAll(),e),r=u7(t);return this.engine.evaluateWithTraces(r,n).traces},e.prototype.variantAndSource=function(e,t){var n={};this.config.source===em.LocalStorage?n=this.localStorageVariantAndSource(e,t):this.config.source===em.InitialVariants&&(n=this.initialVariantsVariantAndSource(e,t));var r=this.flags.get(e);return(u5(r)||!n.variant&&r)&&(n=this.localEvaluationVariantAndSource(e,r,t)),n},e.prototype.localEvaluationVariantAndSource=function(e,t,n){var r,i={},o=this.evaluate([t.key])[e],s=ey.LocalEvaluation,a=null==(r=null==o?void 0:o.metadata)?void 0:r.default;if(!u3(o)&&!a)return{variant:u9(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:u9(o),source:s,hasDefaultVariant:!0}),!u3(n))return{variant:u9(n),source:ey.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var u=this.config.initialVariants[e];if(!u3(u))return{variant:u9(u),source:ey.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var l=u9(this.config.fallbackVariant),c={variant:l,source:ey.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return u4(l)?i:c},e.prototype.localStorageVariantAndSource=function(e,t){var n,r={},i=this.variants.get(e),o=null==(n=null==i?void 0:i.metadata)?void 0:n.default;if(!u3(i)&&!o)return{variant:u9(i),source:ey.LocalStorage,hasDefaultVariant:!1};if(o&&(r={variant:u9(i),source:ey.LocalStorage,hasDefaultVariant:!0}),!u3(t))return{variant:u9(t),source:ey.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};var s=this.config.initialVariants[e];if(!u3(s))return{variant:u9(s),source:ey.SecondaryInitialVariants,hasDefaultVariant:r.hasDefaultVariant};var a=u9(this.config.fallbackVariant),u={variant:a,source:ey.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return u4(a)?r:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var n,r={},i=this.config.initialVariants[e];if(!u3(i))return{variant:u9(i),source:ey.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),s=null==(n=null==o?void 0:o.metadata)?void 0:n.default;if(!u3(o)&&!s)return{variant:u9(o),source:ey.LocalStorage,hasDefaultVariant:!1};if(s&&(r={variant:u9(o),source:ey.LocalStorage,hasDefaultVariant:!0}),!u3(t))return{variant:u9(t),source:ey.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};var a=u9(this.config.fallbackVariant),u={variant:a,source:ey.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return u4(a)?r:u},e.prototype.fetchInternal=function(e,t,n,r){return ux(this,void 0,void 0,function(){var i,o,s;return u_(this,function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(n)),n&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,uI({trackingOption:null==(s=this.fetchVariantsOptions.get())?void 0:s.trackingOption},r))];case 2:return i=a.sent(),[4,this.storeVariants(i,r)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),n&&this.shouldRetryFetch(o)&&this.startRetries(e,r),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return ux(this,void 0,void 0,function(){return u_(this,function(t){return this.fetchVariantsOptions.put(uI(uI({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"}
1)),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=uI({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,n){return ux(this,void 0,void 0,function(){var r,i,o,s,a,u,l;return u_(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,uI({timeoutMillis:t},n))];case 2:r=c.sent(),i={};try{for(s=(o=uT(Object.keys(r))).next();!s.done;s=o.next())i[a=s.value]=le(r[a])}catch(e){u={error:e}}finally{try{s&&!s.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.logger.debug("[Experiment] Received variants: ",i),[2,i]}})})},e.prototype.doFlags=function(){return ux(this,void 0,void 0,function(){var e,t,n;return u_(this,function(r){switch(r.label){case 0:if(r.trys.push([0,4,,5]),e=void 0,!this.isWebExperiment)return[3,2];return[4,this.addContextOrWait(this.getUser())];case 1:e=r.sent(),r.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:uq,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=r.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if((n=r.sent())instanceof uv){if(this.logger.debug(n),this.config.throwOnError)throw n}else throw n;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return ux(this,void 0,void 0,function(){var n,r,i,o;return u_(this,function(s){for(o in 0===(n=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),r=function(t){n=n.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)r(o);for(o in n)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return ux(this,void 0,void 0,function(){var n=this;return u_(this,function(r){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new u8(8,500,1e4,1.5),this.retriesBackoff.start(function(){return ux(n,void 0,void 0,function(){return u_(this,function(n){switch(n.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return n.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,n=null==(t=this.userProvider)?void 0:t.getUser(),r=this.integrationManager.getUser(),i=uI(uI(uI({},null==n?void 0:n.user_properties),r.user_properties),null==e?void 0:e.user_properties);return uI(uI(uI(uI({library:"experiment-js-client/".concat(uq)},n),r),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return ux(this,void 0,void 0,function(){return u_(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==em.LocalStorage?this.variants.getAll():this.config.source==em.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==em.LocalStorage?this.config.initialVariants:this.config.source==em.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){if(null==(i=null==(r=null==(n=t.variant)?void 0:n.metadata)?void 0:r.trackExposure)||i){this.legacyExposureInternal(e,t.variant,t.source);var n,r,i,o,s,a,u,l,c,d={flag_key:e},f=uF(t.source);if(!f||t.hasDefaultVariant){(null==(o=t.variant)?void 0:o.expKey)&&(d.experiment_key=null==(s=t.variant)?void 0:s.expKey);var h=null==(a=t.variant)?void 0:a.metadata;if(f||(null==h?void 0:h.default)||((null==(u=t.variant)?void 0:u.key)?d.variant=t.variant.key:(null==(l=t.variant)?void 0:l.value)&&(d.variant=t.variant.value)),h&&(d.metadata=h),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){var p=ub();if(null==p?void 0:p.location)try{var v=p.location.href;d.metadata.url=v.split("?")[0]||""}catch(e){}}var g=this.addContext(this.getUser());null==(c=this.userSessionExposureTracker)||c.track(d,g),this.integrationManager.track(d,g)}}},e.prototype.legacyExposureInternal=function(e,t,n){var r,i,o,s,a;if(this.analyticsProvider){var u=u2(this.addContext(this.getUser()),e,t,n);!uF(n)&&(null==t?void 0:t.value)?(null==t?void 0:t.value)&&(null==(s=null==(o=this.analyticsProvider)?void 0:o.setUserProperty)||s.call(o,u),null==(a=this.analyticsProvider)||a.track(u)):null==(i=null==(r=this.analyticsProvider)?void 0:r.unsetUserProperty)||i.call(r,u)}},e.getLogLevel=function(e){var t;return!0===e.debug?eg.Debug:null!=(t=e.logLevel)?t:eg.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof up)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}
1,e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),li=function(){function e(e,t){var n,r,i;this.globalScope=ub(),this.userAgent=void 0!==(null==(n=this.globalScope)?void 0:n.navigator)?null==(r=this.globalScope)?void 0:r.navigator.userAgent:void 0,this.ua=new uk.UAParser(this.userAgent).getResult(),this.localStorage=new uW,this.sessionStorage=new u1,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null==(i=this.apiKey)?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,n,r,i,o=(null==(e=this.userProvider)?void 0:e.getUser())||{};return uI({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!=(n=null==(t=this.ua.device)?void 0:t.type)?n:"desktop",referring_url:null==(i=null==(r=this.globalScope)?void 0:r.document)?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,n;return[null==(t=e.browser)?void 0:t.name,null==(n=e.browser)?void 0:n.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null==(t=e.os)?void 0:t.name},e.prototype.getBrowser=function(e){var t,n=null==(t=e.browser)?void 0:t.name;return(null==n?void 0:n.includes("Chrom"))&&(n="Chrome"),(null==n?void 0:n.includes("Firefox"))&&(n="Firefox"),(null==n?void 0:n.includes("Safari"))&&(n="Safari"),(null==n?void 0:n.includes("Edge"))&&(n="Edge"),(null==n?void 0:n.includes("Opera"))&&(n="Opera"),n},e.prototype.getCookie=function(){var e,t,n,r,i;if(null==(t=null==(e=this.globalScope)?void 0:e.document)?void 0:t.cookie)return Object.fromEntries(null==(i=null==(r=null==(n=this.globalScope)?void 0:n.document)?void 0:r.cookie)?void 0:i.split("; ").map(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var n=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return n.landing_url||(n.landing_url=null==(t=null==(e=this.globalScope)?void 0:e.location)?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(n))),n.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){if(this.globalScope){var e,t,n,r={};try{var i=new URL(this.globalScope.location.href);try{for(var o=uT(i.searchParams),s=o.next();!s.done;s=o.next()){var a=uP(s.value,2),u=a[0],l=a[1];r[u]=uO(uO([],uP(null!=(n=r[u])?n:[]),!1),uP(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(r).reduce(function(e,t){var n=uP(t,2),r=n[0],i=n[1];return e[r]=1==i.length?i[0]:i,e},{})}},e}();uy.experimentInstances={};var lo=uy.experimentInstances,ls=function(e){return(null==e?void 0:e.instanceName)||uj.instanceName},la=function(e,t){var n=ls(t),r=null==t?void 0:t.internalInstanceNameSuffix;return r?"".concat(n,".").concat(e,".").concat(r):"".concat(n,".").concat(e)},lu=function(e,t,n){var r=la(e,t),i=lo[r];return i?i:(i=new lr(e,uI(uI({},t),{userProvider:new li(null==t?void 0:t.userProvider,e)})),n&&i.addPlugin(n()),lo[r]=i,i)};function ll(){}ll.prototype.getUser=function(){return{}},ll.prototype.start=function(e){return ux(this,void 0,void 0,function(){return u_(this,function(e){return[2]})})},ll.prototype.stop=function(){},ll.prototype.setUser=function(e){},ll.prototype.fetch=function(e,t){return ux(this,void 0,void 0,function(){return u_(this,function(e){return[2,this]})})},ll.prototype.getUserProvider=function(){return null},ll.prototype.setUserProvider=function(e){return this},ll.prototype.variant=function(e,t){return uj.fallbackVariant},ll.prototype.all=function(){return{}},ll.prototype.clear=function(){}
1,ll.prototype.exposure=function(e){};var lc=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var n;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(t){var r,i;return this.experiment=lu(r=(null==(n=this.config)?void 0:n.deploymentKey)||e.apiKey,i=this.config,function(){return new uL(r,e1.getInstance(ls(i)),1e4)}),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),ld=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:lf(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),lf=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},lh=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}(),lp=function(){return(lp=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}).apply(this,arguments)};function lv(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 TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function lg(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}var lm=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=lv(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),u=Array.isArray(t);if(a!==u)return!1;if(a&&u){for(var l=0;l<e.length;l++)if(!lm(e[l],t[l]))return!1}else{if(!lm(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(n){lm(e[n],t[n])||(c=!1)}),c}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var ly=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=lp({},this.identity.userProperties),n=lp(lp({},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,a,u=n.userProperties||{};try{for(var l=lv(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=lg(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,lv(Object.entries(h))),v=p.next();!v.done;v=p.next()){var g=lg(v.value,2),m=g[0],y=g[1];u[m]=y}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,lv(Object.keys(h))),w=b.next();!w.done;w=b.next()){var m=w.value;delete u[m]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return n.userProperties=u,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return lp({},this.identity)},e.prototype.setIdentity=function(e){var t=lp({},this.identity);this.identity=lp({},e),lm(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}(),lb="u">typeof globalThis?globalThis:"u">typeof window?window:self,lw=function(){function e(){this.identityStore=new ly,this.eventBridge=new lh,this.applicationContextProvider=new ld}return e.getInstance=function(t){return lb.analyticsConnectorInstances||(lb.analyticsConnectorInstances={}
1),lb.analyticsConnectorInstances[t]||(lb.analyticsConnectorInstances[t]=new e),lb.analyticsConnectorInstances[t]},e}(),lS=["boot"],lk=Symbol.for("amplitude-engagement-plugin-caller"),lE=((o=lE||{}).Local="https://local.amplitude.com:3010/",o.Staging="https://apps.stag2.amplitude.com/",o.Production="https://app.amplitude.com/",o.ProductionEU="https://app.eu.amplitude.com/",o),lC=((e=>{if("u">typeof window&&window.opener)for(let t of Object.values(lE))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),N=(e,t,n,r)=>(function(e,t,n,r){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",n&&e.setAttribute("nonce",n),t&&e.setAttribute("type",t),r&&(e.onerror=r);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}})([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,n,r),s="u">typeof window?window.engagement:void 0,a=!1,new Proxy(u={_q:null!=(U=null==s?void 0:s._q)?U:[],_configuration:{apiKey:null!=(j=null==(F=null==s?void 0:s._configuration)?void 0:F.apiKey)?j:"",serverUrl:null==(q=null==s?void 0:s._configuration)?void 0:q.serverUrl,chatUrl:null==(z=null==s?void 0:s._configuration)?void 0:z.chatUrl,mediaUrl:null==(Y=null==s?void 0:s._configuration)?void 0:Y.mediaUrl,serverZone:null!=(V=null==(B=null==s?void 0:s._configuration)?void 0:B.serverZone)?V:"US",autoRefreshIntervalSeconds:null==(J=null==s?void 0:s._configuration)?void 0:J.autoRefreshIntervalSeconds,options:{...null==(K=null==s?void 0:s._configuration)?void 0:K.options}},init(e,t){var n,r,i,o;let s;if(u._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if((null==t?void 0:t.skip)===!0){console.log("Engagement SDK init skipped via `skip: true`. The SDK bundle will not be loaded."),a=!0;return}if(a&&(u._q.length=0),a=!1,null!=t&&t.useEngagementDomain){let e=(null!=(n=t.serverZone)?n:u._configuration.serverZone)==="EU",r="amplitudeengagement.com";t.serverUrl||(t.serverUrl=e?`https://gs.eu.${r}`:`https://gs.${r}`),t.chatUrl||(t.chatUrl=e?`https://houston-chat.eu.${r}`:`https://houston-chat.${r}`),t.mediaUrl||(t.mediaUrl=e?`https://engagement-static.eu.${r}`:`https://engagement-static.${r}`),t.cdnUrl||(t.cdnUrl=e?`https://cdn.eu.${r}`:`https://cdn.${r}`)}if(u._configuration={...u._configuration,...t,apiKey:e,options:{splitting:!0,...u._configuration.options,...null==t?void 0:t.options}},null!=(i=null==(r=u._configuration)?void 0:r.options)&&i.logger&&u._configuration.options.logger.enable(null!=(o=u._configuration.options.logLevel)?o:2),null!=t&&t.cdnUrl)s=u._configuration.options.splitting?`${t.cdnUrl}/engagement-browser/prod/split/index.js`:t.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===u._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";s=u._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let l=null,c=()=>{if(a=!0,l&&(clearTimeout(l),l=null),u._q&&u._q.length>0)for(console.warn(`Engagement SDK failed to load within ${d}ms. Resolving pending calls gracefully.`);u._q.length>0;){let e=u._q.shift();if(!e)continue;let t=e[0],n=lS.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${n}); attempting to resolve as no-op.`),n&&e[1]instanceof Function&&e[2]instanceof Function){let n=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),n(void 0)}}};N(s,u._configuration.options.splitting?"module":void 0,null==t?void 0:t.nonce,c);let d=1e4;l=setTimeout(()=>{c()},1e4)},plugin(e){let t=u.init,n=null==e?void 0:e.token,r=(null==e?void 0:e.skip)===!0,i=(e,t)=>{let r=t.getIdentity(),i="function"==typeof n?n():n;return{user_id:e.getUserId(),device_id:e.getDeviceId(),user_properties:r.userProperties,getSessionId:e.getSessionId,...i?{token:i}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(n,o){var s;if(r)return void t(n.apiKey,{skip:!0});let a=null!=(s=n.instanceName)?s:"$default_instance",l=lw.getInstance(a).identityStore;u._configuration._installedViaPlugin=!0,t(n.apiKey,{serverZone:n.serverZone,...e,options:{logLevel:n.logLevel,logger:n.loggerProvider,...null==e?void 0:e.options}});let c=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,l),integrations:c},lk),l.addIdentityListener(e=>{var t,n,r,s;null!=(t=window.engagement)&&t._.user&&null!=(n=window.engagement)&&n._analytics.hasBooted?(null==(s=null==(r=window.engagement)?void 0:r._.user)?void 0:s.user_id
1)!==e.userId?(window.engagement.shutdown(lk),window.engagement.boot({user:()=>i(o,l),integrations:c},lk)):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(r||window.engagement.forwardEvent(e),e)}}},{get:function(e,t){return t in u?u[t]:"then"!==t?"gs"===t||"rc"===t||"assistant"===t?new Proxy({},{get:function(e,n){return function(){let e=Array.from(arguments),r=`${t}.${n}`;e.unshift(r),u._q.push(e)}}}):lS.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((n,r)=>{e.unshift(t,n,r),u._q.push(e),a&&n(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),u._q.push(e)}:void 0}})),lI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,eb.C6)(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(lc);return 0===e.length?void this.config.loggerProvider.debug("".concat(lc.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(lc.pluginName," are found."))}},t.prototype.initAll=function(t,n){return(0,eb.sH)(this,void 0,void 0,function(){var r=this;return(0,eb.YH)(this,function(i){return this._initAllPromise||(this._initAllPromise=(0,eb.sH)(r,void 0,void 0,function(){var r,i;return(0,eb.YH)(this,function(o){switch(o.label){case 0:return r={serverZone:null==n?void 0:n.serverZone,instanceName:null==n?void 0:n.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return(0,eb.sH)(this,void 0,void 0,function(){return(0,eb.YH)(this,function(n){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.12","-").concat(null!=(t=e.library)?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,(0,eb.Cl)((0,eb.Cl)({},null==n?void 0:n.analytics),r)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,new ay((0,eb.Cl)((0,eb.Cl)({},null==n?void 0:n.sessionReplay),r))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,new lc((0,eb.Cl)((0,eb.Cl)({},null==n?void 0:n.experiment),r))).promise];case 3:let s;return o.sent(),void 0===(i=this.plugin(ay.pluginName))?this.config.loggerProvider.debug("".concat(ay.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,(s=(0,eb.Cl)((0,eb.Cl)({},null==n?void 0:n.engagement),r),"u">typeof window&&!window.engagement&&(window.engagement=lC),lC.plugin(s))).promise];case 4:return o.sent(),[2]}})}).finally(function(){r._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,n,r){return void 0===t&&(t=""),e.prototype.init.call(this,t,n,r)},t}(oN),lx=function(){var e=new lI;return{_setDiagnosticsSampleRate:tx(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",tE(e),tI(e,["config"])),experiment:tx(e.experiment.bind(e),"experiment",tE(e),tI(e,["config"])),sessionReplay:tx(e.sessionReplay.bind(e),"sessionReplay",tE(e),tI(e,["config"])),initAll:tx(e.initAll.bind(e),"initAll",tE(e),tI(e,["config"])),init:tx(e.init.bind(e),"init",tE(e),tI(e,["config"])),add:tx(e.add.bind(e),"add",tE(e),tI(e,["config.apiKey","timeline.plugins"])),remove:tx(e.remove.bind(e),"remove",tE(e),tI(e,["config.apiKey","timeline.plugins"])),track:tx(e.track.bind(e),"track",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),logEvent:tx(e.logEvent.bind(e),"logEvent",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),identify:tx(e.identify.bind(e),"identify",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),groupIdentify:tx(e.groupIdentify.bind(e),"groupIdentify",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),setGroup:tx(e.setGroup.bind(e),"setGroup",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),revenue:tx(e.revenue.bind(e),"revenue",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),flush:tx(e.flush.bind(e),"flush",tE(e),tI(e,["config.apiKey","timeline.queue.length"])),getUserId:tx(e.getUserId.bind(e),"getUserId",tE(e),tI(e,["config","config.userId"])),setUserId:tx(e.setUserId.bind(e),"setUserId",tE(e),tI(e,["config","config.userId"])),getDeviceId:tx(e.getDeviceId.bind(e),"getDeviceId",tE(e),tI(e,["config","config.deviceId"])),setDeviceId:tx(e.setDeviceId.bind(e),"setDeviceId",tE(e),tI(e,["config","config.deviceId"])),reset:tx(e.reset.bind(e),"reset",tE(e),tI(e,["config","config.userId","config.deviceId"])),getSessionId:tx(e.getSessionId.bind(e),"getSessionId",tE(e),tI(e,["config"])),setSessionId:tx(e.setSessionId.bind(e),"setSessionId",tE(e),tI(e,["config"])),extendSession:tx(e.extendSession.bind(e),"extendSession",tE(e),tI(e,["config"])),setOptOut:tx(e.setOptOut.bind(e),"setOptOut",tE(e),tI(e,["config"])),getOptOut:tx(e.getOptOut.bind(e),"getOptOut",tE(e),tI(e,["config"])),setTransport:tx(e.setTransport.bind(e),"setTransport",tE(e),tI(e,["config"])),getIdentity:tx(e.getIdentity.bind(e),"getIdentity",tE(e),tI(e,["config"])),setIdentity:tx(e.setIdentity.bind(e),"setIdentity",tE(e),tI(e,["config","config.userId","config.deviceId"]))}};lx()},37187:(e,t,n)=>{"use strict";n.d(t,{m:()=>r});var r=function(){var e="ampIntegrationContext";return"u">typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:void 0!==n.g?n.g:void 0}}
vendor: 4,343 bytes, line 1
1,42043:(e,t,n)=>{e.exports=n(13492).Observable},46880:function(e,t,n){var r;!function(i){"use strict";var o="function",s="undefined",a="object",u="string",l="model",c="name",d="type",f="vendor",h="version",p="architecture",v="console",g="mobile",m="tablet",y="smarttv",b="wearable",w="embedded",S="Amazon",k="Apple",E="ASUS",C="BlackBerry",I="Browser",x="Chrome",_="Firefox",T="Google",P="Huawei",O="Microsoft",A="Motorola",R="Opera",M="Samsung",D="Sharp",L="Sony",H="Xiaomi",N="Zebra",U="Facebook",F=function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},j=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},q=function(e,t){return typeof e===u&&-1!==z(t).indexOf(z(e))},z=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,""),typeof t===s?e:e.substring(0,350)},B=function(e,t){for(var n,r,i,s,u,l,c=0;c<t.length&&!u;){var d=t[c],f=t[c+1];for(n=r=0;n<d.length&&!u;)if(u=d[n++].exec(e))for(i=0;i<f.length;i++)l=u[++r],typeof(s=f[i])===a&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0):this[s]=l||void 0;c+=2}},V=function(e,t){for(var n in t)if(typeof t[n]===a&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(q(t[n][r],e))return"?"===n?void 0:n}else if(q(t[n],e))return"?"===n?void 0:n;return e},J={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,h],[/opios[\/ ]+([\w\.]+)/i],[h,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[c,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[c,"UC"+I]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+I],h],[/\bfocus\/([\w\.]+)/i],[h,[c,_+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[c,"MIUI "+I]],[/fxios\/([-\w\.]+)/i],[h,[c,_]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+I]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+I],h],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,U],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[c,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[c,x+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,x+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[c,"Android "+I]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[h,V,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}
vendor: 4,519 bytes, line 1
1]],[/(webkit|khtml)\/([\w\.]+)/i],[c,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[c,_+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[c,h],[/(cobalt)\/([\w\.]+)/i],[c,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,z]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[f,M],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[f,M],[d,g]],[/((ipod|iphone)\d+,\d+)/i],[l,[f,k],[d,g]],[/(ipad\d+,\d+)/i],[l,[f,k],[d,m]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[f,k],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[f,k],[d,m]],[/(macintosh);/i],[l,[f,k]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[f,P],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[f,P],[d,g]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[f,H],[d,g]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[f,H],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[f,"OPPO"],[d,g]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[f,"Vivo"],[d,g]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[f,"Realme"],[d,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[f,A],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[f,A],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[f,"LG"],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[f,"LG"],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[f,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[f,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[f,T],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[f,T],[d,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[f,L],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[f,L],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[f,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[f,S],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[f,S],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,f,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[f,C],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[f,E],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[f,E],[d,g]],[/(nexus 9)/i],[l,[f,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[l,/_/g," "],[d,g]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[f,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[f,"Meizu"],[d,g]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[f,D],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 6,557 bytes, line 1
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,l,[d,g]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,l,[d,m]],[/(surface duo)/i],[l,[f,O],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[f,"Fairphone"],[d,g]],[/(u304aa)/i],[l,[f,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[l,[f,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[l,[f,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[l,[f,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[f,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[l,[f,"NuVision"],[d,m]],[/\b(k88) b/i],[l,[f,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[l,[f,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[l,[f,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[l,[f,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[l,[f,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],l,[d,m]],[/\b(ns-?\w{0,9}) b/i],[l,[f,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[f,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],l,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],l,[d,g]],[/\b(ph-1) /i],[l,[f,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[f,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[l,[f,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[l,[f,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[l,[f,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[f,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,O],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[f,N],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[f,N],[d,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,l,[d,v]],[/droid.+; (shield) bui/i],[l,[f,"Nvidia"],[d,v]],[/(playstation [345portablevi]+)/i],[l,[f,L],[d,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[f,O],[d,v]],[/smart-tv.+(samsung)/i],[f,[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,M],[d,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,"LG"],[d,y]],[/(apple) ?tv/i],[f,[l,k+" TV"],[d,y]],[/crkey/i],[[l,x+"cast"],[f,T],[d,y]],[/droid.+aft(\w)( bui|\))/i],[l,[f,S],[d,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[f,D],[d,y]],[/(bravia[\w ]+)( bui|\))/i],[l,[f,L],[d,y]],[/(mitv-\w{5}) bui/i],[l,[f,H],[d,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,Y],[l,Y],[d,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,y]],[/((pebble))app/i],[f,l,[d,b]],[/droid.+; (glass) \d/i],[l,[f,T],[d,b]],[/droid.+; (wt63?0{2,3})\)/i],[l,[f,N],[d,b]],[/(quest( 2)?)/i],[l,[f,U],[d,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[c,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[h,V,J]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[h,V,J]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,h],[/\(bb(10);/i],[h,[c,C]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[c,_+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[c,x+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[c,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,h],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[c,h]]},W=function(e,t){if(typeof e===a&&(t=e,e=void 0),!(this instanceof W))return new W(e,t).getResult();var n=e||(typeof i!==s&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=t?F(K,t):K;return this.getBrowser=function(){var e,t={};return t[c]=void 0,t[h]=void 0,B.call(t,n,r.browser),t.major=typeof(e=t.version)===u?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,t},this.getCPU=function(){var e={};return e[p]=void 0,B.call(e,n,r.cpu),e},this.getDevice=function(){var e={};return e[f]=void 0,e[l]=void 0,e[d]=void 0,B.call(e,n,r.device),e},this.getEngine=function(){var e={};return e[c]=void 0,e[h]=void 0,B.call(e,n,r.engine),e},this.getOS=function(){var e={};return e[c]=void 0,e[h]=void 0,B.call(e,n,r.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===u&&e.length>350?Y(e,350):e,this},this.setUA(n),this};W.VERSION="0.7.33",W.BROWSER=j([c,h,"major"]),W.CPU=j([p]),W.DEVICE=j([l,f,d,v,g,y,m,b,w]),W.ENGINE=W.OS=j([c,h]),typeof t!==s?(e.exp
1orts&&(t=e.exports=W),t.UAParser=W):n.amdO?void 0===(r=(function(){return W}).call(t,n,t,e))||(e.exports=r):typeof i!==s&&(i.UAParser=W);var X=typeof i!==s&&(i.jQuery||i.Zepto);if(X&&!X.ua){var $=new W;X.ua=$.getResult(),X.ua.get=function(){return $.getUA()},X.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var n in t)X.ua[n]=t[n]}}}("object"==typeof window?window:this)},58013:e=>{var t=Object.prototype.hasOwnProperty;function n(e){return"[Throws: "+(e?e.message:"?")+"]"}function r(e){var r=[];return function e(i){if(null===i||"object"!=typeof i)return i;if(-1!==r.indexOf(i))return"[Circular]";if(r.push(i),"function"==typeof i.toJSON)try{var o=e(i.toJSON());return r.pop(),o}catch(e){return n(e)}if(Array.isArray(i)){var s=i.map(e);return r.pop(),s}var a=Object.keys(i).reduce(function(r,o){return r[o]=e(function(e,r){if(t.call(e,r))try{return e[r]}catch(e){return n(e)}return e[r]}(i,o)),r},{});return r.pop(),a}(e)}e.exports=function(e,t,n){return JSON.stringify(r(e),t,n)},e.exports.ensureProperties=r},87909:(e,t,n)=>{"use strict";let r,i,o,s;n.d(t,{P2:()=>p});let a=(e,t)=>t.some(t=>e instanceof t),u=new WeakMap,l=new WeakMap,c=new WeakMap,d={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return f(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function f(e){if(e instanceof IDBRequest){let t;return t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(f(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}),c.set(t,e),t}if(l.has(e))return l.get(e);let t=function(e){if("function"==typeof e)return(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(h(this),t),f(this.request)}:function(...t){return f(e.apply(h(this),t))};return(e instanceof IDBTransaction&&function(e){if(u.has(e))return;let t=new Promise((t,n)=>{let 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)});u.set(e,t)}(e),a(e,r||(r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,d):e}(e);return t!==e&&(l.set(e,t),c.set(t,e)),t}let h=e=>c.get(e);function p(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){let s=indexedDB.open(e,t),a=f(s);return r&&s.addEventListener("upgradeneeded",e=>{r(f(s.result),e.oldVersion,e.newVersion,f(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}let v=["get","getKey","getAll","getAllKeys","count"],g=["put","add","delete","clear"],m=new Map;function y(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(m.get(t))return m.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=g.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||v.includes(n)))return;let o=async function(e,...t){let o=this.transaction(e,i?"readwrite":"readonly"),s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return m.set(t,o),o}d={...o=d,get:(e,t,n)=>y(e,t)||o.get(e,t,n),has:(e,t)=>!!y(e,t)||o.has(e,t)};let b=["continue","continuePrimaryKey","advance"],w={},S=new WeakMap,k=new WeakMap,E={get(e,t){if(!b.includes(t))return e[t];let n=w[t];return n||(n=w[t]=function(...e){S.set(this,k.get(this)[t](...e))}),n}};async function*C(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let n=new Proxy(t,E);for(k.set(n,t),c.set(n,h(t));t;)yield n,t=await (S.get(n)||t.continue()),S.delete(n)}function I(e,t){return t===Symbol.asyncIterator&&a(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&a(e,[IDBIndex,IDBObjectStore])}d={...s=d,get:(e,t,n)=>I(e,t)?C:s.get(e,t,n),has:(e,t)=>I(e,t)||s.has(e,t)}},92487:(e,t,n)=>{"use strict";var r,i;n.d(t,{$:()=>r}),(i=r||(r={}))[i.None=0]="None",i[i.Error=1]="Error",i[i.Warn=2]="Warn",i[i.Verbose
1=3]="Verbose",i[i.Debug=4]="Debug"}}]);
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.