1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ssr-assets/esm-D3HokuX4.js","ssr-assets/tslib.es6-hoQuaKnW.js","ssr-assets/chunk-DzYj8TJc.js","ssr-assets/observers-D3NwiMaz.js","ssr-assets/global-scope-BZ3-s76I.js"])))=>i.map(i=>d[i]); 2try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`64b584cb-330f-40fb-b8a1-b4d7430d9a47`,e._sentryDebugIdIdentifier=`sentry-dbid-64b584cb-330f-40fb-b8a1-b4d7430d9a47`)}catch{}import{o as e,t}from"./chunk-DzYj8TJc.js";import{t as n}from"./preload-helper-oDF6uvx2.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./tslib.es6-hoQuaKnW.js";import{t as f}from"./react-B0-TCddo.js";import{t as p}from"./global-scope-BZ3-s76I.js";o();var m;(function(e){e.SET=`$set`,e.SET_ONCE=`$setOnce`,e.ADD=`$add`,e.APPEND=`$append`,e.PREPEND=`$prepend`,e.REMOVE=`$remove`,e.PREINSERT=`$preInsert`,e.POSTINSERT=`$postInsert`,e.UNSET=`$unset`,e.CLEAR_ALL=`$clearAll`})(m||={});var h;(function(e){e.IDENTIFY=`$identify`,e.GROUP_IDENTIFY=`$groupidentify`,e.REVENUE=`revenue_amount`})(h||={});var g=`AMP_unsent`,_=`$default_instance`,v=`https://api2.amplitude.com/2/httpapi`,y=`https://api.eu.amplitude.com/2/httpapi`,b=`https://api2.amplitude.com/batch`,x=`https://api.eu.amplitude.com/batch`,S=`utm_campaign`,C=`utm_content`,w=`utm_id`,T=`utm_medium`,E=`utm_source`,D=`utm_term`,O=`dclid`,k=`fbclid`,A=`gbraid`,j=`gclid`,M=`ko_click_id`,N=`li_fat_id`,P=`msclkid`,ee=`rdt_cid`,te=`ttclid`,F=`twclid`,ne=`wbraid`,I={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},L=`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`.split(`.`),R=[`authorization`,`cookie`,`set-cookie`],re=1e3,ie=function(e){if(Object.keys(e).length>re)return!1;for(var t in e){var n=e[t];if(!ae(t,n))return!1}return!0},ae=function(e,t){var n,r;if(typeof e!=`string`)return!1;if(Array.isArray(t)){var a=!0;try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var c=s.value;if(Array.isArray(c))return!1;if(typeof c==`object`)a&&=ie(c);else if(![`number`,`string`].includes(typeof c))return!1;if(!a)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(t==null)return!1;else if(typeof t==`object`)return ie(t);else if(![`number`,`string`,`boolean`].includes(typeof t))return!1;return!0};o();var oe=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return d({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(z.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(z.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(z.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(z.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(z.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(z.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(z.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(z.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(z.UNSET,e,`-`),this},e.prototype.clearAll=function(){return this._properties={},this._properties[z.CLEAR_ALL]=`-`,this}
2,e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return r===void 0&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return this._properties[z.CLEAR_ALL]!==void 0||this._propertySet.has(t)?!1:e===z.ADD?typeof n==`number`:e!==z.UNSET&&e!==z.REMOVE?ae(t,n):!0},e}(),z;(function(e){e.SET=`$set`,e.SET_ONCE=`$setOnce`,e.ADD=`$add`,e.APPEND=`$append`,e.PREPEND=`$prepend`,e.REMOVE=`$remove`,e.PREINSERT=`$preInsert`,e.POSTINSERT=`$postInsert`,e.UNSET=`$unset`,e.CLEAR_ALL=`$clearAll`})(z||={});var se=[z.CLEAR_ALL,z.UNSET,z.SET,z.SET_ONCE,z.ADD,z.APPEND,z.PREPEND,z.PREINSERT,z.POSTINSERT,z.REMOVE],ce=`Event tracked successfully`,le=`Unexpected error occurred`,ue=`Event rejected due to exceeded retry count`,de=`Event skipped due to optOut config`,fe=`Event rejected due to missing API key`,pe=`Client not initialized`,B;(function(e){e.Unknown=`unknown`,e.Skipped=`skipped`,e.Success=`success`,e.RateLimit=`rate_limit`,e.PayloadTooLarge=`payload_too_large`,e.Invalid=`invalid`,e.Failed=`failed`,e.Timeout=`Timeout`,e.SystemError=`SystemError`})(B||={});var me=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=B.Unknown),{event:e,code:t,message:n}};o();var he=function(e){return e?(e^Math.random()*16>>e/4).toString(16):`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,_e)},ge=u([],r(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,`0`)}),_e=function(e){var t=p();if(!t?.crypto?.getRandomValues)return he(e);var n=t.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,u([],r(n.entries()),!1).map(function(e){var t=r(e,2),n=t[0],i=t[1];return[4,6,8,10].includes(n)?`-${ge[i]}`:ge[i]}).join(``)};o();var ve=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this._optOutListeners=[]}return e.prototype.register=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return this.plugins.some(function(t){return t.name===e.name})?(this.loggerProvider.warn(`Plugin with name ${e.name} already exists, skipping registration`),[2]):(e.name===void 0&&(e.name=_e(),this.loggerProvider.warn(`Plugin name is undefined. 3 Generating a random UUID for plugin name: ${e.name}. 4 Set a name for the plugin to prevent it from being added multiple times.`)),e.type=e.type??`enrichment`,[4,e.setup?.call(e,t,this.client)]);case 1:return n.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e,t){return s(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:return n=this.plugins.findIndex(function(t){return t.name===e}),n===-1?(t.loggerProvider.warn(`Plugin with name ${e} does not exist, skipping deregistration`),[2]):(r=this.plugins[n],this.plugins.splice(n,1),[4,r.teardown?.call(r)]);case 1:return i.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){return e.teardown?.call(e)}),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,o,s,c,l,u,f,p,m,h,g,_,f,p,v,y,b,x,S,C,w;return a(this,function(a){switch(a.label){case 0:if(!e)return[2];t=r(e,1),n=t[0],o=r(e,2),s=o[1],this.loggerProvider.log(`Timeline.apply: Initial event`,n),c=this.plugins.filter(function(e){return e.type===`before`}),a.label=1;case 1:a.trys.push([1,6,7,8]),l=i(c),u=l.next(),a.label=2;case 2:return u.done?[3,5]:(f=u.value,f.execute?[4,f.execute(d({},n))]:[3,4]);case 3:if(p=a.sent(),p===null)return this.loggerProvider.log(`Timeline.apply: Event filtered out by before plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),s({event:n,code:0,message:``}),[2];n=p,this.loggerProvider.log(`Timeline.apply: Event after before plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),a.label=4;case 4:return u=l.next(),[3,2];case 5:return[3,8];case 6:return m=a.sent(),x={error:m},[3,8];case 7:try{u&&!u.done&&(S=l.return)&&S.call(l)}finally{if(x)throw x.error}
4return[7];case 8:h=this.plugins.filter(function(e){return e.type===`enrichment`||e.type===void 0}),a.label=9;case 9:a.trys.push([9,14,15,16]),g=i(h),_=g.next(),a.label=10;case 10:return _.done?[3,13]:(f=_.value,f.execute?[4,f.execute(d({},n))]:[3,12]);case 11:if(p=a.sent(),p===null)return this.loggerProvider.log(`Timeline.apply: Event filtered out by enrichment plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),s({event:n,code:0,message:``}),[2];n=p,this.loggerProvider.log(`Timeline.apply: Event after enrichment plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),a.label=12;case 12:return _=g.next(),[3,10];case 13:return[3,16];case 14:return v=a.sent(),C={error:v},[3,16];case 15:try{_&&!_.done&&(w=g.return)&&w.call(g)}finally{if(C)throw C.error}return[7];case 16:return y=this.plugins.filter(function(e){return e.type===`destination`}),this.loggerProvider.log(`Timeline.apply: Final event before destinations, event: ${JSON.stringify(n)}`),b=y.map(function(e){var t=d({},n);return e.execute(t).catch(function(e){return me(t,0,String(e))})}),Promise.all(b).then(function(e){var t=r(e,1)[0]||me(n,100,`Event not tracked, no destination plugins on the instance`);s(t)}),[2]}})})},e.prototype.flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r=this;return a(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return e.type===`destination`}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.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;(n=t.onIdentityChanged)==null||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;(n=t.onSessionIdChanged)==null||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;(n=t.onOptOutChanged)==null||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,o,s,c,l;return a(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),t=i(this._optOutListeners),n=t.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 o=a.sent(),this.loggerProvider.error(`Error calling optOut listener`,o),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),c={error:s},[3,9];case 8:try{n&&!n.done&&(l=t.return)&&l.call(t)}finally{if(c)throw c.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;(t=e.onReset)==null||t.call(e)})},e}();o();var ye=function(e,t,n){return d(d(d({},typeof e==`string`?{event_type:e}:e),n),t&&{event_properties:t})},be=function(e,t){return d(d({},t),{event_type:h.IDENTIFY,user_properties:e.getUserProperties()})},xe=function(e,t,n,r){var i;return d(d({},r),{event_type:h.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})},Se=function(e,t,n){var r,i=new oe;return i.set(e,t),d(d({},n),{event_type:h.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})},Ce=function(e,t){return d(d({},t),{event_type:h.REVENUE,event_properties:e.getEventProperties()})},we=function(e){return{promise:e||Promise.resolve()}};o();var Te=function(){function e(e){e===void 0&&(e=`$default`),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new ve(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){return a(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 s(this,void 0,void 0,function(){var t,n,r,o,s,c,l,u;return a(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),n=i(t),r=n.next(),a.label=2;case 2:return r.done?[3,7]:(o=r.value,s=o(),s&&`promise`in s?[4,s.promise]:[3,4]);case 3:return a.sent(),[3,6];case 4:return[4,s];case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return c=a.sent(),l={error:c},[3,10];case 9:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(l)throw l.error}
4return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,n){var r=ye(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),we(this.dispatch(r))},e.prototype.identify=function(e,t){var n=be(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),we(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=xe(e,t,n,r);return we(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=Se(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),we(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=Ce(e,t);return we(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),we())},e.prototype._addPlugin=function(e){return we(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)),we())},e.prototype._removePlugin=function(e){return we(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(me(e,0,pe));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return a(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=d({},this.userProperties??{});if(e===void 0)return t;var n={};return Object.keys(e).forEach(function(t){Object.values(m).includes(t)||(n[t]=e[t])}),se.forEach(function(n){if(Object.keys(e).includes(n)){var r=e[n];switch(n){case m.CLEAR_ALL:Object.keys(t).forEach(function(e){delete t[e]});break;case m.UNSET:Object.keys(r).forEach(function(e){delete t[e]});break;case m.SET:Object.assign(t,r);break}}}),Object.assign(t,n),t},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,t;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,me(e,0,de)]:(e.event_type===h.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return t=i.sent(),t.code===200?this.config.loggerProvider.log(t.message):t.code===100?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return n=i.sent(),r=String(n),this.config.loggerProvider.error(r),t=me(e,0,r),[2,t];case 3:return[2]}})})},e.prototype.setOptOut=function(e){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!e));return}this._setOptOut(e)},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return we(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(t===void 0){this.config.loggerProvider.debug(`Cannot find plugin with name ${e}`);return}return t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}();o();var Ee=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));ie(t)&&(this.properties=t)}catch{}return this},e.prototype.getEventProperties=function(){var e=this.properties?d({},this.properties):{};return e[De.REVENUE_PRODUCT_ID]=this.productId,e[De.REVENUE_QUANTITY]=this.quantity,e[De.REVENUE_PRICE]=this.price,e[De.REVENUE_TYPE]=this.revenueType,e[De.REVENUE_CURRENCY]=this.currency,e[De.REVENUE]=this.revenue,e[De.RECEIPT]=this.receipt,e[De.RECEIPT_SIG]=this.receiptSig,e},e}(),De;(function(e){e.REVENUE_PRODUCT_ID=`$productId`,e.REVENUE_QUANTITY=`$quantity`,e.REVENUE_PRICE=`$price`,e.REVENUE_TYPE=`$revenueType`,e.REVENUE_CURRENCY=`$currency`,e.REVENUE=`$revenue`,e.RECEIPT=`$receipt`,e.RECEIPT_SIG=`$receiptSig`})(De||={});var Oe=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},[])},ke;(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Verbose=3]=`Verbose`,e[e.Debug=4]=`Debug`})(ke||={});var Ae=`Amplitude Logger `,je=function(){function e(){this.logLevel=ke.None}return e.prototype.disable=function(){this.logLevel=ke.None},e.prototype.enable=function(e){e===void 0&&(e=ke.Warn),this.logLevel=e},e.prototype.log=function(){var e=[...arguments];this.logLevel<ke.Verbose||console.log(`${Ae}[Log]: ${e.join(` `)}`)},e.prototype.warn=function(){var e=[...arguments];this.logLevel<ke.Warn||console.warn(`${Ae}[Warn]: ${e.join(` `)}`)},e.prototype.error=function(){var e=[...arguments];this.logLevel<ke.Error||console.error(`${Ae}[Error]: ${e.join(` `)}`)},e.prototype.debug=function(){var e=[...arguments];this.logLevel<ke.Debug||console.log(`${Ae}[Debug]: ${e.join(` `)}`)},e}(),Me=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:_,logLevel:ke.Warn,loggerProvider:new je,offline:!1,optOut:!1,serverUrl:v,serverZone:`US`,useBatch:!1}},Ne=function(){function e(e){this._optOut=!1;var t=Me();this.apiKey=e.apiKey,this.flushIntervalMillis=e.flushIntervalMillis??t.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||t.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||t.flushQueueSize,this.instanceName=e.instanceName||t.instanceName,this.loggerProvider=e.loggerProvider||t.loggerProvider,this.logLevel=e.logLevel??t.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline===void 0?t.offline:e.offline,this.optOut=e.optOut??t.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||t.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=e.useBatch??t.useBatch,this.loggerProvider.enable(this.logLevel);var n=Fe(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=n.serverZone,this.serverUrl=n.serverUrl}return Object.defineProperty(e.prototype,`optOut`,{get:function(){return this._optOut},set:function(e){this._optOut=e}
4,enumerable:!1,configurable:!0}),e}(),Pe=function(e,t){return e===`EU`?t?x:y:t?b:v},Fe=function(e,t,n){if(e===void 0&&(e=``),t===void 0&&(t=Me().serverZone),n===void 0&&(n=Me().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=[`US`,`EU`].includes(t)?t:Me().serverZone;return{serverZone:r,serverUrl:Pe(r,n)}},Ie=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();(function(){function e(){}return e})();function Le(e){return e>=200&&e<300}o();var Re=function(e){return e===void 0&&(e=0),(Error().stack||``).split(` 5`).slice(2+e).map(function(e){return e.trim()})},V=function(e){return function(){var t=d({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ze=function(e,t){var n,r;t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``);try{for(var a=i(t.split(`.`)),o=a.next();!o.done;o=a.next()){var s=o.value;if(s in e)e=e[s];else return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return e},H=function(e,t){return function(){var n,r,a={};try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var c=s.value;a[c]=ze(e,c)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}},U=function(e,t,n,r,i){return i===void 0&&(i=null),function(){var a=[...arguments],o=n(),s=o.logger,c=o.logLevel;if(c&&c<ke.Debug||!c||!s)return e.apply(i,a);var l={type:`invoke public method`,name:t,args:a,stacktrace:Re(1),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var u=e.apply(i,a);return u&&u.promise?u.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))),u}};o();var Be=new Set([v,y,b,x]),Ve=function(e,t){return t===void 0&&(t=!1),Be.has(e)?!0:t};function He(e){return e instanceof Error?e.message:String(e)}function Ue(e){var t=``;try{`body`in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var We=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=e?.diagnosticsClient}return e.prototype.setup=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){switch(r.label){case 0:return this.config=e,this.storageKey=`${g}_${this.config.apiKey.substring(0,10)}`,[4,this.config.storageProvider?.get(this.storageKey)];case 1:return t=r.sent(),t&&t.length>0&&Promise.all(t.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||=_e(),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries?!0:(t.fulfillRequest([e],500,ue),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(e.timeout===0?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(this.scheduleId===null||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 e===void 0&&(e=!1),s(this,void 0,void 0,function(){var t,n,r,i=this;return a(this,function(o){switch(o.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug(`Skipping flush while offline.`),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug(`Skipping flush because previous flush has not resolved.`),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return e.timeout===0?t.push(e):n.push(e)}),r=Oe(t,this.config.flushQueueSize),[4,r.reduce(function(t,n){return s(i,void 0,void 0,function(){return a(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return o.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var n;return t===void 0&&(t=!0),s(this,void 0,void 0,function(){var r,i,o,s,l,u;return a(this,function(a){switch(a.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,fe)];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,c(t,[`extra`])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new Ie,a.label=1;case 1:return a.trys.push([1,3,,4]),i=Fe(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=Ve(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,this.config._enableRequestBodyCompressionExperimental&&o)];case 2:return s=a.sent(),s===null?(this.fulfillRequest(e,0,le),[2]):t?(this.handleResponse(s,e),[3,4]):(`body`in s?this.fulfillRequest(e,s.statusCode,`${s.status}: ${Ue(s)}`):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return l=a.sent(),u=He(l),this.config.loggerProvider.error(u),(n=this.diagnosticsClient)==null||n.recordEvent(`anal
5ytics.events.unsuccessful.from.catch.error`,{events:e.map(function(e){return e.event.event_type}),message:u,stack_trace:Re()}),this.handleResponse({status:B.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){var n;Le(e.statusCode)||(n=this.diagnosticsClient)==null||n.recordEvent(`analytics.events.unsuccessful`,{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:Ue(e),stack_trace:Re()});var r=e.status;switch(r){case B.Success:this.handleSuccessResponse(e,t);break;case B.Invalid:this.handleInvalidResponse(e,t);break;case B.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case B.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn(`{code: 0, error: "Status '${r}' provided for ${t.length} events"}`),this.handleOtherResponse(t);break}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,ce)},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith(`Invalid API key`)){this.fulfillRequest(t,e.statusCode,e.body.error);return}var i=u(u(u(u([],r(Object.values(e.body.eventsWithInvalidFields)),!1),r(Object.values(e.body.eventsWithMissingFields)),!1),r(Object.values(e.body.eventsWithInvalidIdLengths)),!1),r(e.body.silencedEvents),!1).flat(),a=new Set(i),o=t.filter(function(t,r){if(a.has(r)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return!0});o.length>0&&this.config.loggerProvider.warn(Ue(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(t.length===1){this.fulfillRequest(t,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Ue(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),a=e.body.throttledEvents,o=new Set(r),s=new Set(i),c=new Set(a),l=t.filter(function(t,r){if(t.event.user_id&&o.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return c.has(r)&&(t.timeout=n.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(Ue(e));var u=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(u)},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,a;Le(t)?(a=this.diagnosticsClient)==null||a.increment(`analytics.events.sent`,e.length):((r=this.diagnosticsClient)==null||r.increment(`analytics.events.dropped`,e.length),(i=this.diagnosticsClient)==null||i.recordEvent(`analytics.events.dropped`,{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:Re()})),this.removeEvents(e),e.forEach(function(e){return e.callback(me(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}(),Ge=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Ke(),platform:`Web`,os:void 0,deviceModel:void 0}},e}(),Ke=function(){return typeof navigator<`u`&&(navigator.languages&&navigator.languages[0]||navigator.language)||``},qe=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),Je=function(){return Je=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Je.apply(this,arguments)};function Ye(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
5if(e&&typeof e.length==`number`)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 Xe(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var Ze=function(e,t){var n,r,i=[`string`,`number`,`boolean`,`undefined`],a=typeof e;if(a!==typeof t)return!1;try{for(var o=Ye(i),s=o.next();!s.done;s=o.next())if(s.value===a)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(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;var c=Array.isArray(e),l=Array.isArray(t);if(c!==l)return!1;if(c&&l){for(var u=0;u<e.length;u++)if(!Ze(e[u],t[u]))return!1}else{if(!Ze(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var d=!0;return Object.keys(e).forEach(function(n){Ze(e[n],t[n])||(d=!1)}),d}return!0},Qe=`$set`,$e=`$unset`,et=`$clearAll`;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 tt=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Je({},this.identity.userProperties),n=Je(Je({},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,a,o,s,c=n.userProperties||{};try{for(var l=Ye(Object.entries(e)),u=l.next();!u.done;u=l.next()){var d=Xe(u.value,2),f=d[0],p=d[1];switch(f){case Qe:try{for(var m=(i=void 0,Ye(Object.entries(p))),h=m.next();!h.done;h=m.next()){var g=Xe(h.value,2),_=g[0],v=g[1];c[_]=v}}catch(e){i={error:e}}finally{try{h&&!h.done&&(a=m.return)&&a.call(m)}finally{if(i)throw i.error}}break;case $e:try{for(var y=(o=void 0,Ye(Object.keys(p))),b=y.next();!b.done;b=y.next()){var _=b.value;delete c[_]}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(o)throw o.error}}break;case et:c={};break}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return n.userProperties=c,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return Je({},this.identity)},e.prototype.setIdentity=function(e){var t=Je({},this.identity);this.identity=Je({},e),Ze(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}(),nt=typeof globalThis<`u`?globalThis:typeof global<`u`?global:self,rt=function(){function e(){this.identityStore=new tt,this.eventBridge=new qe,this.applicationContextProvider=new Ge}return e.getInstance=function(t){return nt.analyticsConnectorInstances||={},nt.analyticsConnectorInstances[t]||(nt.analyticsConnectorInstances[t]=new e),nt.analyticsConnectorInstances[t]},e}(),it=function(e){return e===void 0&&(e=_),rt.getInstance(e)},at=function(e,t){it(t).identityStore.editIdentity().setUserId(e).commit()},ot=function(e,t){it(t).identityStore.editIdentity().setDeviceId(e).commit()};o();var st=function(){function e(){this.name=`identity`,this.type=`before`,this.identityStore=it().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return a(this,function(n){return t=e.user_properties,t&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return e.instanceName&&(this.identityStore=it(e.instanceName).identityStore),[2]})})},e}(),ct=function(e,t){return t===void 0&&(t=Date.now()),Date.now()-t>e},lt=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(
5Boolean).join(`_`)},ut=function(e){return`amp_${e.substring(0,6)}`},dt=function(){if(typeof navigator>`u`)return``;var e=navigator.userLanguage;return navigator.languages?.[0]??navigator.language??e??``},ft=function(){var e=p();return e?.location?.search?e.location.search.substring(1).split(`&`).filter(Boolean).reduce(function(e,t){var n=t.split(`=`,2),r=pt(n[0]),i=pt(n[1]);return i&&(e[r]=i),e},{}):{}},pt=function(e){e===void 0&&(e=``);try{return decodeURIComponent(e)}catch{return``}},mt=function(e,t){return!t||!t.length?!0:t.some(function(t){return typeof t==`string`?e===t:e.match(t)})},ht=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){t?.error(`Malformed URI sequence: `,e)}return n},gt=function(e){var t=0;if(e.length===0)return t;for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return t},_t=function(e,t){var n=gt(e.toString());return Math.abs(n)*31%1e6/1e6<t},vt=function(e,t){var n=gt(e.toString());return Math.abs(n)*31%1e5/1e5<t};o();var yt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return s(this,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return t=n.sent(),[2,t?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return a(this,function(e){return this.memoryStorage.clear(),[2]})})},e}();o();var bt=function(){return p()?.navigator?.locks},xt=function(){function e(e,t){t===void 0&&(t={}),this.options=d({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return a(this,function(a){switch(a.label){case 0:return t=`AMP_TEST`,n=d({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var a=e.get()===i;return!a&&o.config.diagnosticsClient&&((n=o.config.diagnosticsClient)==null||n.recordEvent(`cookies.isEnabled.failure`,{reason:`Test Value mismatch`,testKey:t,testValue:i,sync:!0})),a}catch(e){if(o.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);(r=o.config.diagnosticsClient)==null||r.recordEvent(`cookies.isEnabled.failure`,{reason:`Cookie getter/setter failed`,testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,a.sent()]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return a(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=wt(t);if(n===void 0){console.error(`Amplitude Logger [Error]: Failed to decode cookie value for key: ${e}, value: ${t}`);return}return JSON.parse(n)}catch{console.error(`Amplitude Logger [Error]: Failed to parse cookie value for key: ${e}, value: ${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 s(this,void 0,void 0,function(){var r,o,s,c,l,u,d,f,m;return a(this,function(a){switch(a.label){case 0:r=p(),o=r,a.label=1;case 1:return a.trys.push([1,4,,5]),s=o?.cookieStore,s?[4,s.getAll(e)]:[3,3];case 2:if(c=a.sent(),c){c.length>1&&((t=this.config.diagnosticsClient)==null||t.recordEvent(`cookies.duplicate`,{cookies:c.map(function(e){return e.domain})}),(n=this.config.diagnosticsClient)==null||n.increment(`cookies.duplicate.occurrence.cookieStore`));try{for(l=i(c),u=l.next();!u.done;u=l.next())if(d=u.value,Tt(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{u&&!u.done&&(m=l.return)&&m.call(l)}finally{if(f)throw f.error}}}a.label=3;case 3:return[3,5];case 4:return a.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t=this,n=((p()?.document)?.cookie.split(`; `)??[]).filter(function(t){return t.indexOf(e+`=`)===0}),r=void 0,i=this.config.duplicateResolverFn;
5if(typeof i==`function`&&n.length>1&&(r=n.find(function(n){var r;try{var a=i(n.substring(e.length+1));return a||(r=t.config.diagnosticsClient)==null||r.increment(`cookies.duplicate.occurrence.document.cookie`),a}catch{return!1}})),r||=n[0],r)return r.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){try{var n=this.options.expirationDays??0,r=t===null?-1:n,i=void 0;if(r){var a=new Date;a.setTime(a.getTime()+r*24*60*60*1e3),i=a}var o=`${e}=${btoa(encodeURIComponent(JSON.stringify(t)))}`;i&&(o+=`; expires=${i.toUTCString()}`),o+=`; path=/`,this.options.domain&&(o+=`; domain=${this.options.domain}`),this.options.secure&&(o+=`; Secure`),this.options.sameSite&&(o+=`; SameSite=${this.options.sameSite}`);var s=p();s?.document&&(s.document.cookie=o)}catch(t){var c=t instanceof Error?t.message:String(t);console.error(`Amplitude Logger [Error]: Failed to set cookie for key: ${e}. Error: ${c}`)}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return a(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 s(this,void 0,void 0,function(){return a(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r,i,o;return a(this,function(a){switch(a.label){case 0:if(e.cachedTlds[t])return[2,!0];n={domain:`.`+t},r=`AMP_TLDTEST`,i=new e(n),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.transaction(r,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 o=a.sent(),[2,!!o];case 3:return a.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return a(this,function(a){switch(a.label){case 0:if(n=bt(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.request(`com.amplitude:cookie-lock:${e}`,r)];case 2:return[2,a.sent()];case 3:return a.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),St=function(e){try{return decodeURIComponent(atob(e))}catch{return}},Ct=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}},wt=function(e){return St(e)??Ct(e)},Tt=function(e,t){if(e===``&&t===``)return!0;if(!e||!t)return!1;var n=e.startsWith(`.`)?e.substring(1):e,r=t.startsWith(`.`)?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},Et=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(Boolean).join(`_`)};o();var Dt=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i;return a(this,function(a){switch(a.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r=`AMP_TEST`,a.label=1;case 1:return a.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return a.sent(),[4,n.get(r)];case 3:return i=a.sent(),[2,i===t];case 4:return a.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return a.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return t=n.sent(),t?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error(`[Amplitude] Error: Could not get value from storage`),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.storage?.getItem(e)||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return a(this,function(r){try{(n=this.storage)==null||n.setItem(e,JSON.stringify(t))}catch{}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return a(this,function(n){try{(t=this.storage)==null||t.removeItem(e)}catch{}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return a(this,function(t){try{(e=this.storage)==null||e.clear()}catch{}return[2]})})},e}();o();var Ot=10,kt=1,W={TAGS:`tags`,COUNTERS:`counters`,HISTOGRAMS:`histograms`,EVENTS:`events`,INTERNAL:`internal`},At={LAST_FLUSH_TIMESTAMP:`last_flush_timestamp`},jt=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName=`AMP_diagnostics_${e.substring(0,10)}`}return e.isSupported=function(){return p()?.indexedDB!==void 0},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return a(this,function(e){return 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,kt);r.onerror=function(){e.dbPromise=null,n(Error(`Failed to open IndexedDB`))},r.onsuccess=function(){var n=r.result;
5n.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(W.TAGS)||e.createObjectStore(W.TAGS,{keyPath:`key`}),e.objectStoreNames.contains(W.COUNTERS)||e.createObjectStore(W.COUNTERS,{keyPath:`key`}),e.objectStoreNames.contains(W.HISTOGRAMS)||e.createObjectStore(W.HISTOGRAMS,{keyPath:`key`}),e.objectStoreNames.contains(W.EVENTS)||e.createObjectStore(W.EVENTS,{keyPath:`id`,autoIncrement:!0}).createIndex(`time_idx`,`time`,{unique:!1}),e.objectStoreNames.contains(W.INTERNAL)||e.createObjectStore(W.INTERNAL,{keyPath:`key`})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,i,o,s=this;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([W.TAGS],`readwrite`),i=n.objectStore(W.TAGS),[2,new Promise(function(t){var a=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug(`DiagnosticsStorage: Failed to set tags`,e),t()},a.forEach(function(e){var t=r(e,2),n=t[0],a=t[1],o=i.put({key:n,value:a});o.onerror=function(e){s.logger.debug(`DiagnosticsStorage: Failed to set tag`,n,a,e)}})})];case 2:return o=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set tags`,o),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return s(this,void 0,void 0,function(){var t,n,i,o,s=this;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([W.COUNTERS],`readwrite`),i=n.objectStore(W.COUNTERS),[2,new Promise(function(t){var a=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug(`DiagnosticsStorage: Failed to increment counters`,e),t()},a.forEach(function(e){var t=r(e,2),n=t[0],a=t[1],o=i.get(n);o.onsuccess=function(){var e=o.result,t=e?e.value:0,r=i.put({key:n,value:t+a});r.onerror=function(e){s.logger.debug(`DiagnosticsStorage: Failed to update counter`,n,e)}},o.onerror=function(e){s.logger.debug(`DiagnosticsStorage: Failed to read existing counter`,n,e)}})})];case 2:return o=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to increment counters`,o),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return s(this,void 0,void 0,function(){var t,n,i,o,s=this;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([W.HISTOGRAMS],`readwrite`),i=n.objectStore(W.HISTOGRAMS),[2,new Promise(function(t){var a=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){s.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,e),t()},a.forEach(function(e){var t=r(e,2),n=t[0],a=t[1],o=i.get(n);o.onsuccess=function(){var e=o.result,t=e?{key:n,count:e.count+a.count,min:Math.min(e.min,a.min),max:Math.max(e.max,a.max),sum:e.sum+a.sum}:{key:n,count:a.count,min:a.min,max:a.max,sum:a.sum},r=i.put(t);r.onerror=function(e){s.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,n,e)}},o.onerror=function(e){s.logger.debug(`DiagnosticsStorage: Failed to read existing histogram stats`,n,e)}})})];case 2:return o=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,o),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),e.length===0?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([W.EVENTS],`readwrite`),r=n.objectStore(W.EVENTS),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug(`DiagnosticsStorage: Failed to add event records`,e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,Ot-t);n<e.length&&o.logger.debug(`DiagnosticsStorage: Only added ${n} of ${e.length}
5 events due to storage limit`),e.slice(0,n).forEach(function(e){var t=r.add(e);t.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to add event record`,e)}})},i.onerror=function(e){o.logger.debug(`DiagnosticsStorage: Failed to count existing events`,e)}})];case 2:return i=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to add event records`,i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([W.INTERNAL],`readwrite`),i=r.objectStore(W.INTERNAL),[2,new Promise(function(n,a){r.onabort=function(){return a(Error(`Failed to set internal value`))};var o=i.put({key:e,value:t});o.onsuccess=function(){return n()},o.onerror=function(){return a(Error(`Failed to set internal value`))}})];case 2:return o=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set internal value`,o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([W.INTERNAL],`readonly`),r=n.objectStore(W.INTERNAL),[2,new Promise(function(t,i){n.onabort=function(){return i(Error(`Failed to get internal value`))};var a=r.get(e);a.onsuccess=function(){return t(a.result)},a.onerror=function(){return i(Error(`Failed to get internal value`))}})];case 2:return i=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to get internal value`,i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return s(this,void 0,void 0,function(){var e,t;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(At.LAST_FLUSH_TIMESTAMP)];case 1:return e=n.sent(),[2,e?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 s(this,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(At.LAST_FLUSH_TIMESTAMP,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 ${t}`))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,i,o,s,c,l;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=a.sent(),t=e.transaction([W.TAGS,W.COUNTERS,W.HISTOGRAMS,W.EVENTS],`readwrite`),[4,Promise.all([this.getAllFromStore(t,W.TAGS),this.getAllFromStore(t,W.COUNTERS),this.getAllFromStore(t,W.HISTOGRAMS),this.getAllFromStore(t,W.EVENTS)])];case 2:return n=r.apply(void 0,[a.sent(),4]),i=n[0],o=n[1],s=n[2],c=n[3],[4,Promise.all([this.clearTable(t,W.COUNTERS),this.clearTable(t,W.HISTOGRAMS),this.clearTable(t,W.EVENTS)])];case 3:return a.sent(),[2,{tags:i,counters:o,histogramStats:s,events:c}];case 4:return l=a.sent(),this.logger.debug(`DiagnosticsStorage: Failed to get all and clear data`,l),[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 ${t}`))}})},e}();o();var Mt=`__AMPLITUDE_SCRIPT_URL__`,Nt=`sdk.error.uncaught`,Pt=function(){var e=p();if(!e)return[];var t=e[Mt];return Array.isArray(t)?t:typeof t==`string`?[t]:[]},Ft=function(e){var t=p();if(!(!t||typeof t.addEventListener!=`function`)){var n=function(e){var t=e.error instanceof Error?e.error:void 0,n=t?.stack,r=It({filename:e.filename,stack:n});r&&i({type:`error`,message:e.message,stack:n,filename:e.filename,errorName:t?.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:r}})},r=function(e){var t=e.reason instanceof Error?e.reason:void 0,n=t?.stack,r=Lt(n),a=It({filename:r,stack:n});a&&i({type:`unhandledrejection`,message:t?.message??Rt(e.reason),stack:n,filename:r,errorName:t?.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},i=function(t){e.recordEvent(Nt,d({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};
5t.addEventListener(`error`,n,!0),t.addEventListener(`unhandledrejection`,r,!0)}},It=function(e){var t,n,r=Pt();if(r.length!==0)try{for(var a=i(r),o=a.next();!o.done;o=a.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=a.return)&&n.call(a)}finally{if(t)throw t.error}}},Lt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},Rt=function(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return`[object Object]`}};o();var zt=1e3,Bt=300*1e3,Vt=`https://diagnostics.prod.us-west-2.amplitude.com/v1/capture`,Ht=`https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture`,Ut=function(){function e(e,t,n,r){n===void 0&&(n=`US`),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl=n===`US`?Vt:Ht,this.logger.debug(`DiagnosticsClient: Initializing with options`,JSON.stringify(r,null,2)),this.config=d({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=vt(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,jt.isSupported()?this.storage=new jt(e,t):this.logger.debug(`DiagnosticsClient: IndexedDB is not supported`),this.initializeFlushInterval(),this.shouldTrack&&(this.increment(`sdk.diagnostics.sampled.in.and.enabled`),Ft(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){this.logger.debug(`DiagnosticsClient: Early return setTags as reaching memory limit`);return}this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(t===void 0&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4){this.logger.debug(`DiagnosticsClient: Early return increment as reaching memory limit`);return}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){this.logger.debug(`DiagnosticsClient: Early return recordHistogram as reaching memory limit`);return}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){this.logger.debug(`DiagnosticsClient: Early return recordEvent as reaching memory limit`);return}this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;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})},zt),this.flushTimer||=setTimeout(function(){e._flush().catch(function(t){e.logger.debug(`DiagnosticsClient: Failed to flush`,t)}).finally(function(){e.flushTimer=null})},Bt)},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,i;return a(this,function(a){switch(a.label){case 0:return this.storage?(e=d({},this.inMemoryTags),t=d({},this.inMemoryCounters),n=d({},this.inMemoryHistograms),i=u([],r(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(i)])]):[2];case 1:return a.sent(),[2]}})})},e.prototype._flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,s,c,l,u;return a(this,function(a){switch(a.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return a.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=a.sent(),t=e.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={}
5,n.forEach(function(e){s[e.key]=e.value}),c={},r.forEach(function(e){c[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),l=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),Object.keys(s).length===0&&Object.keys(c).length===0&&l.length===0?[2]:(u={tags:o,histogram:c,counters:s,events:l},this.fetch(u),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t,n;return a(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!p())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:return t=r.sent(),t.ok?(this.logger.debug(`DiagnosticsClient: Successfully sent diagnostics data`),[3,3]):(this.logger.debug(`DiagnosticsClient: Failed to send diagnostics data.`),[2]);case 2:return n=r.sent(),this.logger.debug(`DiagnosticsClient: Failed to send diagnostics data. `,n),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return a(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return t=r.sent()||-1,t===-1?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(Bt),[2]):(n=e-t,n>=3e5?(this._flush(),[2]):(this._setFlushTimer(Bt-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=vt(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug(`DiagnosticsClient: Should track is`,this.shouldTrack)},e}(),Wt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if(typeof e!=`object`)return null;var t=e.code||0,n=this.buildStatus(t);switch(n){case B.Success:return{status:n,statusCode:t,body:{eventsIngested:e.events_ingested??0,payloadSizeBytes:e.payload_size_bytes??0,serverUploadTime:e.server_upload_time??0}};case B.Invalid:return{status:n,statusCode:t,body:{error:e.error??``,missingField:e.missing_field??``,eventsWithInvalidFields:e.events_with_invalid_fields??{},eventsWithMissingFields:e.events_with_missing_fields??{},eventsWithInvalidIdLengths:e.events_with_invalid_id_lengths??{},epsThreshold:e.eps_threshold??0,exceededDailyQuotaDevices:e.exceeded_daily_quota_devices??{},silencedDevices:e.silenced_devices??[],silencedEvents:e.silenced_events??[],throttledDevices:e.throttled_devices??{},throttledEvents:e.throttled_events??[]}};case B.PayloadTooLarge:return{status:n,statusCode:t,body:{error:e.error??``}};case B.RateLimit:return{status:n,statusCode:t,body:{error:e.error??``,epsThreshold:e.eps_threshold??0,throttledDevices:e.throttled_devices??{},throttledUsers:e.throttled_users??{},exceededDailyQuotaDevices:e.exceeded_daily_quota_devices??{},exceededDailyQuotaUsers:e.exceeded_daily_quota_users??{},throttledEvents:e.throttled_events??[]}};case B.Timeout:default:return{status:n,statusCode:t}}},e.prototype.buildStatus=function(e){return Le(e)?B.Success:e===429?B.RateLimit:e===413?B.PayloadTooLarge:e===408?B.Timeout:e>=400&&e<500?B.Invalid:e>=500?B.Failed:B.Unknown},e}();o();var Gt=function(e){l(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return t.prototype.send=function(e,t){return s(this,void 0,void 0,function(){var n,r,i;return a(this,function(a){switch(a.label){case 0:if(typeof fetch>`u`)throw Error(`FetchTransport is not supported`);return n={headers:d({"Content-Type":`application/json`,Accept:`*/*`},this.customHeaders),body:JSON.stringify(t),method:`POST`},[4,fetch(e,n)];case 1:return r=a.sent(),[4,r.text()];case 2:i=a.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch{return[2,this.buildResponse({code:r.status})]}return[2]}})})},t}(Wt);o();function Kt(){return typeof CompressionStream<`u`}function qt(e){return s(this,void 0,void 0,function(){var t,n;return a(this,function(r){switch(r.label){case 0:if(t=CompressionStream,t===void 0)return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t(`gzip`)),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var Jt=function(){function e(e,t){this.key=`AMP_remote_config_${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(e===null)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: ${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}();o();
5var Yt={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},Xt=1e3,Zt=300*1e3,Qt=function(){function e(e,t,n,r){n===void 0&&(n=`US`),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=r||(n===`US`?`https://sr-client-cfg.amplitude.com/config`:`https://sr-client-cfg.eu.amplitude.com/config`),this.logger=t,this.storage=new Jt(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),t===`all`?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 t===-1?(this.logger.debug(`Remote config client unsubscribe failed because callback with id ${e} doesn't exist.`),!1):(this.callbackInfos.splice(t,1),this.logger.debug(`Remote config client unsubscribe succeeded removing callback with id ${e}.`),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t,n=this;return a(this,function(r){switch(r.label){case 0:return this.lastSuccessfulFetch&&(e=Date.now()-this.lastSuccessfulFetch,e<Zt)?(this.logger.debug(`Remote config client skipping updateConfigs: Too recent`),[2]):[4,this.getOrCreateFetchPromise()];case 1:return t=r.sent(),this.storage.setConfig(t),this.callbackInfos.forEach(function(e){n.sendCallback(e,t,`remote`)}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug(`Remote config client skipping fetch: Invalid API key`),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return t.remoteConfig!==null&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return a(this,function(a){switch(a.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug(`Remote config client subscription all mode fetched from remote: ${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 r=a.sent(),r!==void 0&&(this.logger.debug(`Remote config client subscription all mode fetched from cache: ${JSON.stringify(r)}`),r.remoteConfig===null?this.logger.debug(`Remote config client skips sending c
5allback because cache is empty (first time user).`):this.sendCallback(e,r,`cache`)),[4,t];case 2:return a.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r,r;return a(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 r=i.sent(),r.remoteConfig===null?(this.logger.debug(`Remote config client subscription wait for remote mode failed to fetch cache.`),this.sendCallback(e,r,`remote`)):(this.logger.debug(`Remote config client subscription wait for remote mode returns a cached copy.`),this.sendCallback(e,r,`cache`)),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){e.lastCallback=new Date;var r=e.key?e.key.split(`.`).reduce(function(e,t){return e===null?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig;e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return e===void 0&&(e=3),t===void 0&&(t=Xt),s(this,void 0,void 0,function(){var n,r,i,o,s,c,l=this;return a(this,function(u){switch(u.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,c,u,d,f,p;return a(this,function(a){switch(a.label){case 0:i=!0,s=new AbortController,c=setTimeout(function(){return s.abort()},t),a.label=1;case 1:return a.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:`GET`,headers:{Accept:`*/*`},signal:s.signal})];case 2:return u=a.sent(),u.ok?[3,4]:[4,u.text()];case 3:return d=a.sent(),o.logger.debug(`Remote config client fetch with retry time ${e} failed with ${u.status}: ${d}`),u.status===Yt.INVALID_API_KEY||u.status===Yt.FORBIDDEN?(o.logger.error(`Remote config client fetch failed with ${u.status}. Invalid API key; future fetches will be skipped.`),o.isLastFetchInvalidApiKey=!0,i=!1):u.status>=400&&u.status<500&&u.status!==Yt.RATE_LIMIT&&(i=!1),[3,6];case 4:return[4,u.json()];case 5:return f=a.sent(),[2,{value:{remoteConfig:f,lastFetch:new Date}}];case 6:return[3,9];case 7:return p=a.sent(),p instanceof Error&&p.name===`AbortError`?o.logger.debug(`Remote config client fetch with retry time ${e} timed out after ${t}ms`):o.logger.debug(`Remote config client fetch with retry time ${e} is rejected because: `,p),[3,9];case 8:return clearTimeout(c),[7];case 9:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(n))})]:[3,11]:[2,`break`];case 10:a.sent(),a.label=11;case 11:return[2]}})},o=this,s=0,u.label=1;case 1:return s<e?[5,i(s)]:[3,4];case 2:if(c=u.sent(),typeof c==`object`)return[2,c.value];if(c===`break`)return[3,4];u.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),`${this.serverUrl}/${t}?${n.toString()}`},e.CONFIG_GROUP=`browser`,e}();o();var $t=p()?.console,en={},tn={},nn=!1;function rn(e){return!$t||typeof $t[e]!=`function`?!1:tn[e]?!0:(tn[e]=$t[e],$t[e]=function(){var t=[...arguments];try{if(en[e]&&!nn){nn=!0;var n=en[e];n&&n.forEach(function(n){try{n(e,t)}catch{}})}}catch{}return nn=!1,tn[e].apply($t,t)},!0)}function an(e,t){if(!rn(e))return Error(`Console override failed`);en[e]?en[e].push(t):en[e]=[t]}function on(e){var t,n;try{for(var r=i(Object.values(en)),a=r.next();!a.done;a=r.next())for(var o=a.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}function sn(){var e,t;try{for(var n=i(Object.entries(tn)),a=n.next();!a.done;a=n.next()){var o=r(a.value,2),s=o[0],c=o[1];c&&($t[s]=c)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}tn={},en={}}var cn={addListener:an,removeListener:on,_restoreConsole:sn},ln;(function(e){e.US=`US`,e.EU=`EU`,e.STAGING=`STAGING`})(ln||={});var un=[`a`,`button`,`input`,`select`,`textarea`,`label`,`video`,`audio`,`[contenteditable="true" i]`,`[data-amp-default-track]`,`.amp-default-track`],dn=`data-amp-track-`,fn=[`div`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`];o();var pn=u([`input[type="button"]`,`input[type="submit"]`,`input[type="reset"]`,`input[type="image"]`,`input[type="file"]`],r([`a`,`button`,`[role="button"]`,`[role="link"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="option"]`,`[role="tab"]`,`[role="treeitem"]`,`[contenteditable="true" i]`]),!1),mn=pn,hn=pn,gn=[`*`],_n=1e3;o();function vn(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e==null}function yn(e,t,n){e&&bn({json:e,allowlist:t.map(xn),excludelist:n.map(xn),ancestors:[]})}function bn(e){var t,n,a=e.json,o=e.targetObject,s=e.allowlist,c=e.excludelist,l=e.ancestors,d=e.parentObject,f=e.targetKey;o||=a;var p=Object.keys(o);try{for(var m=i(p),h=m.next();!h.done;h=m.next()){var g=h.value,_=u(u([],r(l),!1),[g],!1);vn(o[g])?(!Cn(_,s)||Cn(_,c))&&delete o[g]:bn({json:a,targetObject:o[g],allowlist:s,excludelist:c,ancestors:_,parentObject:o,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}Object.keys(o).length===0&&d&&f&&delete d[f]}function xn(e){return e.startsWith(`/`)&&(e=e.slice(1)),e.split(`/`).map(function(e){return e.replace(/~0/g,`~`).replace(/~1/g,`/`)})}function Sn(e,t,n,r){if(n===void 0&&(n=0),r===void 0&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&t[r]===`**`;)r++;return r===t.length}var i=t[r];
5if(i===`**`){if(r+1===t.length)return!0;for(var a=n;a<=e.length;a++)if(Sn(e,t,a,r+1))return!0;return!1}else if(i===`*`||i===e[n])return Sn(e,t,n+1,r+1);else return!1}function Cn(e,t){return t.some(function(t){return Sn(e,t)})}o();var wn=500,Tn=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;e===void 0&&(e=[]);var a=this.request.headers,o={};if(Array.isArray(a))a.forEach(function(e){var t=r(e,2),n=t[0];o[n]=t[1]});else if(a instanceof Headers)a.forEach(function(e,t){o[t]=e});else if(typeof a==`object`&&a)try{for(var s=i(Object.entries(a)),c=s.next();!c.done;c=s.next()){var l=r(c.value,2),u=l[0];o[u]=l[1]}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return Nn(o,{allow:e})},Object.defineProperty(e.prototype,`bodySize`,{get:function(){if(typeof this._bodySize==`number`)return this._bodySize;if(p()?.TextEncoder){var e=this.request.body;return this._bodySize=Dn(e,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`method`,{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`body`,{get:function(){return typeof this.request.body==`string`?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),s(this,void 0,void 0,function(){var n;return a(this,function(r){return e.length===0?[2,null]:(n=this.body,[2,An(n,e,t)])})})},e}(),En=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return e===void 0&&(e=[]),Nn(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,`bodySize`,{get:function(){return Dn(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`body`,{get:function(){return typeof this.bodyRaw==`string`?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),s(this,void 0,void 0,function(){var n;return a(this,function(r){return e.length===0?[2,null]:(n=this.body,[2,An(n,e,t)])})})},e}();function Dn(e,t){var n,a,o,s=p()?.TextEncoder;if(s){var c;if(typeof e==`string`)c=e,o=new s().encode(c).length;else if(e instanceof Blob)c=e,o=c.size;else if(e instanceof URLSearchParams)c=e,o=new s().encode(c.toString()).length;else if(ArrayBuffer.isView(e))c=e,o=c.byteLength;else if(e instanceof ArrayBuffer)c=e,o=c.byteLength;else if(e instanceof FormData){var l=e,u=0,d=0;try{for(var f=i(l.entries()),m=f.next();!m.done;m=f.next()){var h=r(m.value,2),g=h[0],_=h[1];if(u+=g.length,typeof _==`string`)u+=new s().encode(_).length;else if(_ instanceof Blob)u+=_.size;else return;if(++d>=t)return}}catch(e){n={error:e}}finally{try{m&&!m.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}o=u}else if(e instanceof ReadableStream){c=e;return}return o}}var On=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(e===void 0&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return(t=n?.forEach)==null||t.call(n,function(e,t){r[t]=e}),Nn(r,{allow:e})}},Object.defineProperty(e.prototype,`bodySize`,{get:function(){var e;if(this._bodySize!==void 0)return this._bodySize;var t=((e=this.response.headers)?.get)?.call(e,`content-length`),n=t?parseInt(t,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`status`,{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t,n;return a(this,function(r){switch(r.label){case 0:this.clonedResponse||=this.response.clone(),r.label=1;case 1:return r.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},wn)}),[4,Promise.race([e,t])];case 2:return n=r.sent(),[2,n];case 3:return r.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),s(this,void 0,void 0,function(){var n;return a(this,function(r){switch(r.label){case 0:return e.length===0?[2,null]:[4,this.text()];case 1:return n=r.sent(),[2,An(n,e,t)]}})})},e}(),kn=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}
5,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`status`,{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(e===void 0&&(e=[]),!this.headersString)return{};var a={},o=this.headersString.split(`\r 6`);try{for(var s=i(o),c=s.next();!c.done;c=s.next()){var l=c.value,u=r(l.split(`: `),2),d=u[0],f=u[1];d&&f&&(a[d]=f)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return Nn(a,{allow:e})},e.prototype.json=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=[]),s(this,void 0,void 0,function(){var n;return a(this,function(r){return e.length===0?[2,null]:(n=this.getJson(),n?(yn(n,e,t),[2,n]):[2,null])})})},e}();function An(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return yn(r,t,n),r}catch{return null}}var jn;(function(e){e.REDACT=`redact`,e.REMOVE=`remove`})(jn||={});var Mn=`[REDACTED]`,Nn=function(e,t){var n,a,o=t.allow,s=o===void 0?[]:o,c=t.strategy,l=c===void 0?jn.REMOVE:c,d=u([],r(R),!1),f={},p=function(t){var n=t.toLowerCase();d.find(function(e){return e.toLowerCase()===n})?l===jn.REDACT&&(f[t]=Mn):s.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:l===jn.REDACT&&(f[t]=Mn)};try{for(var m=i(Object.keys(e)),h=m.next();!h.done;h=m.next()){var g=h.value;p(g)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(a=m.return)&&a.call(m)}finally{if(n)throw n.error}}return f},Pn=function(){function e(e,t,n,r,i,a,o,s,c,l,u){o===void 0&&(o=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=a,this.status=o,this.duration=s,this.responseWrapper=c,this.error=l,this.endTime=u}return e.prototype.toSerializable=function(){var e={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:this.requestWrapper?.headers(u([],r(L),!1)),requestBodySize:this.requestWrapper?.bodySize,responseHeaders:this.responseWrapper?.headers(u([],r(L),!1)),responseBodySize:this.responseWrapper?.bodySize};return Object.fromEntries(Object.entries(e).filter(function(e){var t=r(e,2);return t[0],t[1]!==void 0}))},e}();o();function Fn(e){return typeof e==`object`&&!!e&&`url`in e&&`method`in e}var In=function(){function e(e,t){t===void 0&&(t=_e()),this.callback=e,this.id=t}return e}();function Ln(e){try{e()}catch{}}var Rn=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=p();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=p();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){if(this.logger||=t,this.eventCallbacks.set(e.id,e),!this.isObserving){var n=this.globalScope?.XMLHttpRequest?.prototype?.open,r=this.globalScope?.XMLHttpRequest?.prototype?.send,i=this.globalScope?.XMLHttpRequest?.prototype?.setRequestHeader;n&&r&&i&&this.observeXhr(n,r,i);var a=this.globalScope?.fetch;a&&this.observeFetch(a),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){Ln(function(){var n;(n=t.logger)==null||n.debug(`an unexpected error occurred while triggering event callbacks`,e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,a,o){if(!(a===void 0||o===void 0)){var s,c=`GET`;if(Fn(t)?(s=t.url,c=t.method):s=(t?.toString)?.call(t),s)try{var l=new URL(s);s=`${l.protocol}//${l.host}${l.pathname}${l.search}${l.hash}`}catch{}c=n?.method||c;var u,d;r&&(u=r.status),i&&(d={name:i.name||`UnknownError`,message:i.message||`An unknown error occurred`},u=0);var f=Math.floor(performance.now()-o),p=Math.floor(a+f),m=new Pn(e,c,a,a,s,n,u,f,r,d,p);this.triggerEventCallbacks(m)}},e.prototype.getTimestamps=function(){return{startTime:Date.now?.call(Date),durationStart:(performance==null?void 0:performance.now)?.call(performance)}},e.prototype.observeFetch=function(e){var t=this;!this.globalScope||!e||(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,s,c=this;return a(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){Ln(function(){return c.logger?.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 s=a.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent(`fetch`,n,r?new Tn(r):void 0,i?new On(i):void 0,o,t?.startTime,t?.durationStart)}catch(e){Ln(function(){return c.logger?.debug(`an unexpected error occurred while handling fetch`,e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){try{if(e.responseType===`json`){if(t.globalScope?.structuredClone)return t.globalScope.structuredClone(e.response)}else if([`text`,``].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&n.name===`InvalidStateError`&&Ln(function(){return t.logger?.debug(`unexpected error when retrieving responseText. responseType='${e.responseType}'`)}),null}return null}},e.prototype.observeXhr=function(t,n,i){if(!(!this.globalScope||!t||!n)){var a=this.globalScope.XMLHttpRequest.prototype,o=this;a.open=function(){var e=[...arguments],n=this,i=r(e,2),a=i[0],s=i[1];try{n.$$AmplitudeAnalyticsEvent=d({method:a,url:(s?.toString)?.call(s),headers:{}},o.getTimestamps())}catch(e){Ln(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr open`,e)})}return t.apply(n,e)},a.send=function(){var t=[...arguments],r=this,i=r,a=e.createXhrJsonParser(r,o),s=t[0],c=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener(`loadend`,function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader(`content-length`),n=new kn(i.status,e,t?parseInt(t,10):void 0,a),r=i.$$AmplitudeAnalyticsEvent.headers,l=new En(s,r);c.status=i.status,o.handleNetworkRequestEvent(`xhr`,{url:c.url,method:c.method},l,n,void 0,c.startTime,c.durationStart)}catch(e){Ln(function(){return o.logger?.debug(`an unexpected error occurred while handling xhr send`,e)}
6)}}),n.apply(i,t)},a.setRequestHeader=function(e,t){var n=this;try{var r=n.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){Ln(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr setRequestHeader`,e)})}i.apply(n,[e,t])}}},e}());o();var zn=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,d(d(d(d({},I),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=ft();return{utm_campaign:e[S],utm_content:e[C],utm_id:e[w],utm_medium:e[T],utm_source:e[E],utm_term:e[D]}},e.prototype.getReferrer=function(){var e={referrer:void 0,referring_domain:void 0};try{e.referrer=document.referrer||void 0,e.referring_domain=e.referrer?.split(`/`)[2]??void 0}catch{}return e},e.prototype.getClickIds=function(){var e,t=ft();return e={},e[O]=t[O],e[k]=t[k],e[A]=t[A],e[j]=t[j],e[M]=t[M],e[N]=t[N],e[P]=t[P],e[ee]=t[ee],e[te]=t[te],e[F]=t[F],e[ne]=t[ne],e},e}();o();var Bn=`data-amp-mask`,Vn=`*****`,Hn=/\b(?:\d[ -]*?){13,16}\b/,Un=/(\d{3}-?\d{2}-?\d{4})/g,Wn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Gn=function(e,t){var n,r;if(t===void 0&&(t=[]),typeof e!=`string`)return``;var a=e;a=a.replace(Hn,Vn),a=a.replace(Un,Vn),a=a.replace(Wn,Vn);try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var c=s.value;try{a=a.replace(c,Vn)}catch{}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},Kn=function(e){if(typeof document>`u`||!document.title)return``;var t=document.querySelector(`title`);return t&&t.hasAttribute(`data-amp-mask`)?Vn:e?e(document.title):document.title},qn=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Observable=void 0;var t=e=>!!Symbol[e],n=e=>t(e)?Symbol[e]:`@@`+e,r=n(`iterator`),i=n(`observable`),a=n(`species`);function o(e,t){let n=e[t];if(n!=null){if(typeof n!=`function`)throw TypeError(n+` is not a function`);return n}}function s(e){let t=e.constructor;return t!==void 0&&(t=t[a],t===null&&(t=void 0)),t===void 0?_:t}function c(e){return e instanceof _}function l(e){l.log?l.log(e):setTimeout(()=>{throw e})}function u(e){Promise.resolve().then(()=>{try{e()}catch(e){l(e)}})}function d(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,t))try{if(typeof t==`function`)t();else{let e=o(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 p(e){let t=e._queue;if(t){e._queue=void 0,e._state=`ready`;for(let n=0;n<t.length&&(m(e,t[n].type,t[n].value),e._state!==`closed`);++n);}}function m(e,t,n){e._state=`running`;let r=e._observer;try{let i=o(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);break}}catch(e){l(e)}e._state===`closed`?d(e):e._state===`running`&&(e._state=`ready`)}function h(e,t,n){if(e._state!==`closed`){if(e._state===`buffering`){e._queue.push({type:t,value:n});return}if(e._state!==`ready`){e._state=`buffering`,e._queue=[{type:t,value:n}],u(()=>p(e));return}m(e,t,n)}}var g=class{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state=`initializing`;let n=this,r={get closed(){return n._state===`closed`},next(e){h(n,`next`,e)},error(e){h(n,`error`,e)},complete(){h(n,`complete`)}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}this._state===`initializing`&&(this._state=`ready`)}get closed(){return this._state===`closed`}unsubscribe(){this._state!==`closed`&&(f(this),d(this))}},_=class e{constructor(t){if(!(this instanceof e))throw TypeError(`Observable cannot be called as a function`);if(typeof t!=`function`)throw TypeError(`Observable initializer must be a function`);this._subscriber=t}subscribe(e){return(typeof e!=`object`||!e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new g(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if(typeof e!=`function`){n(TypeError(e+` is not a function`));return}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(typeof e!=`function`)throw TypeError(e+` is not a function`);return new(s(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(typeof e!=`function`)throw TypeError(e+` is not a function`);return new(s(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(typeof e!=`function`)throw TypeError(e+` is not a function`);let t=s(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(a){let o=!r;if(r=!0,!o||n)try{i=e(i,a)}catch(e){return t.error(e)}else i=a},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(TypeError(`Cannot reduce an empty sequence`));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=s(this);return new t(n=>{let r,i=0;function a(o){r=o.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):a(t.from(e[i++]))}})}return a(this),()=>{r&&=(r.unsubscribe(),void 0)}})}flatMap(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);let t=s(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 o=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(o);e>=0&&r.splice(e,1),a()}});r.push(o)},error(e){n.error(e)},complete(){a()}});function a(){i.closed&&r.length===0&&n.complete()}return()=>
6{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[i](){return this}static from(n){let a=typeof this==`function`?this:e;if(n==null)throw TypeError(n+` is not an object`);let s=o(n,i);if(s){let e=s.call(n);if(Object(e)!==e)throw TypeError(e+` is not an object`);return c(e)&&e.constructor===a?e:new a(t=>e.subscribe(t))}if(t(`iterator`)&&(s=o(n,r),s))return new a(e=>{u(()=>{if(!e.closed){for(let t of s.call(n))if(e.next(t),e.closed)return;e.complete()}})});if(Array.isArray(n))return new a(e=>{u(()=>{if(!e.closed){for(let t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}})});throw TypeError(n+` is not observable`)}static of(...t){return new(typeof this==`function`?this:e)(e=>{u(()=>{if(!e.closed){for(let n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}})})}static get[a](){return this}};e.Observable=_,Object.defineProperty(_,Symbol(`extensions`),{value:{symbol:i,hostReportError:l},configurable:!0})})),Jn=t(((e,t)=>{t.exports=qn().Observable}));o();var G=e(Jn());function Yn(e,t){return new G.default(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 Xn(e,t){return new G.default(function(n){var r=!1,a=new Set,o=function(){var e,t;r=!0;try{for(var n=i(a),o=n.next();!o.done;o=n.next()){var s=o.value;try{s.unsubscribe()}catch{}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}a.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(){a.delete(t),!r&&a.size===0&&(n.complete(),o(),r=!0)}});a.add(t)};return s(e),s(t),o})}function Zn(e){var t=new Set,n=null;function r(){n?.unsubscribe(),n=null,t.clear()}return new G.default(function(a){return t.add(a),n===null&&(n=e.subscribe({next:function(e){var n,r,a;try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var c=s.value;(a=c.next)==null||a.call(c,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){var n,a,o;try{for(var s=i(t),c=s.next();!c.done;c=s.next()){var l=c.value;(o=l.error)==null||o.call(l,e)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,a;try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var c=s.value;(a=c.complete)==null||a.call(c)}}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(a),t.size===0&&n&&(n.unsubscribe(),n=null)}})}var Qn=e(t(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e){return`[Throws: `+(e?e.message:`?`)+`]`}function i(e,t){if(n.call(e,t))try{return e[t]}catch(e){return r(e)}return e[t]}function a(e){var t=[];function n(e){if(typeof e!=`object`||!e)return e;if(t.indexOf(e)!==-1)return`[Circular]`;if(t.push(e),typeof e.toJSON==`function`)try{var a=n(e.toJSON());return t.pop(),a}catch(e){return r(e)}if(Array.isArray(e)){var o=e.map(n);return t.pop(),o}var s=Object.keys(e).reduce(function(t,r){return t[r]=n(i(e,r)),t},{});return t.pop(),s}return n(e)}t.exports=function(e,t,n){return JSON.stringify(a(e),t,n)},t.exports.ensureProperties=a}))()),$n=Qn.default||Qn,er=`https://app.amplitude.com`,tr={US:er,EU:`https://app.eu.amplitude.com`,STAGING:`https://apps.stag2.amplitude.com`},nr=`https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz`,rr=function(e){return document.querySelector(`script[src="${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 ${e}`})}),(r=document.head)==null||r.appendChild(i)}catch(e){n(e)}})};function ir(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}o();var ar,or=`__AMPLITUDE_MESSENGER_INSTANCE__`,sr=`__AMPLITUDE_MESSENGER__`,cr=function(){function e(e){var t=(e===void 0?{}:e).origin,n=t===void 0?er:t;this[ar]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;(n=(t=this.logger)?.debug)==null||n.call(t,`Message sent: `,JSON.stringify(e)),(i=(r=window.opener)?.postMessage)==null||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;n===void 0&&(n={timeout:15e3});var i=ir(),a={id:i,action:e,args:t};return new Promise(function(t,o){r.requestCallbacks[i]={resolve:t,reject:o},r.notify(a),n.timeout>0&&setTimeout(function(){o(Error(`${e} timed out (id: ${i})`)),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){(t=this.logger)==null||t.warn(`No callback found for request id: ${e.id}`);return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){var n,r,a,o;this.actionHandlers.has(e)&&((o=(a=this.logger)?.warn)==null||o.call(a,`Overwriting existing action handler for: ${e}`)),this.actionHandlers.set(e,t);var s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var c=i(s),l=c.next();!l.done;l=c.next()){var u=l.value;t(u)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return s(this,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e),t)return[2,t];n=rr(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=this,n,r,i=e===void 0?{}:e,a=i.logger,o=i.endpoint;a&&(this.logger=a),o&&this.endpoint===`https://app.amplitude.com`&&(this.endpoint=o
6),!this.isSetup&&(this.isSetup=!0,(r=(n=this.logger)?.debug)==null||r.call(n,`Setting up messenger`),this.messageHandler=function(e){var n,r,i,a;if((r=(n=t.logger)?.debug)==null||r.call(n,`Message received: `,JSON.stringify(e)),t.endpoint===e.origin){var o=e.data,s=o?.action;if(s)if(`id`in o&&o.id)(a=(i=t.logger)?.debug)==null||a.call(i,`Received Response to previous request: `,JSON.stringify(e)),t.handleResponse(o);else{if(s===`ping`){t.notify({action:`pong`});return}var c=t.actionHandlers.get(s);if(c)c(o.data);else{var l=t.pendingMessages.get(s)??[];l.push(o.data),t.pendingMessages.set(s,l)}}}},window.addEventListener(`message`,this.messageHandler),this.notify({action:`page-loaded`}))},e.prototype.destroy=function(){this.messageHandler&&=(window.removeEventListener(`message`,this.messageHandler),null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=p();e?.[sr]===this&&delete e[sr]},e}();ar=or;function lr(e){return typeof e==`object`&&!!e&&or in e&&e[or]===!0}function ur(e){var t=p(),n=t?.[sr];if(lr(n))return n;var r=new cr(e);return t&&(t[sr]=r),r}var dr=`__AMPLITUDE_BACKGROUND_CAPTURE__`;function fr(e,t){var n=e;if(n[dr]!==!0){n[dr]=!0;var r=t?.scriptUrl??nr,i=null,a=function(t,n){var r,i;t===`background-capture-complete`&&((i=(r=e.logger)?.debug)==null||i.call(r,`Background capture complete`),e.notify({action:`background-capture-complete`,data:n}))};e.registerActionHandler(`initialize-background-capture`,function(){var t,n;(n=(t=e.logger)?.debug)==null||n.call(t,`Initializing background capture (external script)`);var o=new URL(r,e.endpoint).toString();e.loadScriptOnce(o).then(function(){var t,n;(n=(t=e.logger)?.debug)==null||n.call(t,`Background capture script loaded (external)`),i=(window==null?void 0:window.amplitudeBackgroundCapture)?.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:`background-capture-loaded`})}).catch(function(){var t;(t=e.logger)==null||t.warn(`Failed to initialize background capture`)})}),e.registerActionHandler(`close-background-capture`,function(){var e;(e=i?.close)==null||e.call(i),i=null})}}var pr={always:`always`,ifEmptyCampaign:`ifEmptyCampaign`};o();var mr=function(e,t){return typeof e==`boolean`?e:e?.[t]!==!1},hr=function(e){return mr(e,`attribution`)},gr=function(e){return mr(e,`fileDownloads`)},_r=function(e){return mr(e,`formInteractions`)},vr=function(e){return mr(e,`pageViews`)},yr=function(e){return mr(e,`sessions`)},br=function(e){return mr(e,`pageUrlEnrichment`)},xr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.networkTracking===!0||typeof e.networkTracking==`object`)},Sr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.elementInteractions===!0||typeof e.elementInteractions==`object`)},Cr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&e.webVitals===!0},wr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.frustrationInteractions===!0||typeof e.frustrationInteractions==`object`)},Tr=function(e){return typeof e==`boolean`?e:!!(typeof e==`object`&&e&&e.enabled!==!1)},Er=function(e){if(Sr(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.elementInteractions==`object`)return e.autocapture.elementInteractions},Dr=function(e){if(wr(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.frustrationInteractions==`object`)return e.autocapture.frustrationInteractions},Or=function(e){if(xr(e.autocapture)){var t=void 0;return typeof e.autocapture==`object`&&typeof e.autocapture.networkTracking==`object`?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),d(d({},t),{captureRules:(t?.captureRules)?.map(function(t){var n;if(t.urls?.length&&t.hosts?.length){var r=JSON.stringify(t.hosts),i=JSON.stringify(t.urls);return(n=e.loggerProvider)==null||n.warn(`Found network capture rule with both urls='${i}' and hosts='${r}' set. Definition of urls takes precedence over hosts, so ignoring hosts.`),d(d({},t),{hosts:void 0})}return t})})}},kr=function(e){var t=function(){return!1},n=void 0,r,i=e.pageCounter;return vr(e.defaultTracking)&&(t=void 0,r=void 0,e.defaultTracking&&typeof e.defaultTracking==`object`&&e.defaultTracking.pageViews&&typeof e.defaultTracking.pageViews==`object`&&(`trackOn`in e.defaultTracking.pageViews&&(t=e.defaultTracking.pageViews.trackOn),`trackHistoryChanges`in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackHistoryChanges),`eventType`in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(r=e.defaultTracking.pageViews.eventType))),{trackOn:t,trackHistoryChanges:n,eventType:r,pageCounter:i}},Ar=function(e){return hr(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution==`object`?d({},e.defaultTracking.attribution):{}},jr=function(e){if(_r(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&typeof e.defaultTracking.formInteractions==`object`)return e.defaultTracking.formInteractions},Mr=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,a=r.args,o=r.resolve,s=e&&e[i];if(typeof s==`function`){var c=s.apply(e,a);typeof o==`function`&&o(c?.promise)}}return e},Nr=function(e){var t=e;return t&&t._q!==void 0},Pr=`2.37.2`,Fr=`amplitude-ts`;o();var Ir=`Web`,Lr=`$remote`,Rr=function(){function e(){this.name=`@amplitude/plugin-context-browser`,this.type=`before`,this.library=`${Fr}/${Pr}`,typeof navigator<`u`&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return a(this,function(a){return t=new Date().getTime(),n=this.config.lastEventId??-1,r=e.event_id??n+1,this.config.lastEventId=r,e.time||(this.config.lastEventTime=t),i=d(d(d(d(d(d(d(d({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:Ir}),this.config.trackingOptions.language&&{language:dt()}),this.config.trackingOptions.ipAddress&&{ip:Lr}),{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:r,library:this.library,user_agent:this.userAgent}),[2,i]})})},e}();o();var zr=1e3,Br=function(e){l(t,e);function t(t){var n=this,r,i;try{i=p()?.localStorage}catch(e){(r=t?.loggerProvider)==null||r.debug(`Failed to access localStorage. error=${JSON.stringify(e)}`),i=void 0}return n=e.call(this,i)||this,n.loggerProvider=t?.loggerProvider,n}return t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>zr?(i=n.length-zr,[4,e.prototype.set.call(this,t,n.slice(0,zr))]):[3,2];case 1:return a.sent(),(r=this.loggerProvider)==null||r.error(`Failed to save ${i} events because the queue length exceeded ${zr}.`),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},t}(Dt);o();var Vr=function(e){l(t,e);function t(){return e.call(this,p()?.sessionStorage)||this}return t}(Dt);o();var Hr=function(e){l(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),s(this,void 0,void 0,function(){var o=this;return a(this,function(c){return[2,new Promise(function(c,l){typeof XMLHttpRequest>`u`&&l(Error(`XHRTransport is not supported.`));var u=new XMLHttpRequest;u.open(`POST`,e,!0),u.onreadystatechange=function(){if(u.readyState===o.state.done){var e=u.responseText;try{c(o.buildResponse(JSON.parse(e)))}catch{c(o.buildResponse({code:u.status}))}}};var f={"Content-Type":`application/json`,Accept:`*/*`},p=JSON.stringify(t),m=n&&p.length>=2048&&Kt(),h=function(e){var t,n;f=d(d({},o.customHeaders),f);try{for(var a=i(Object.entries(f)),s=a.next();!s.done;s=a.next()){var c=r(s.value,2),l=c[0],p=c[1];u.setRequestHeader(l,p)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}u.send(e)};(function(){return s(o,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return m?[4,qt(p)]:[3,2];case 1:return e=t.sent(),e?(f[`Content-Encoding`]=`gzip`,h(e)):h(p),[3,3];case 2:h(p),t.label=3;case 3:return[2]}})})})().catch(l)})]})})},t}(Wt);o();var Ur=function(e){l(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),s(this,void 0,void 0,function(){var r,i,o,s,c,l,u,f;return a(this,function(a){switch(a.label){case 0:if(typeof fetch>`u`)throw Error(`FetchTransport is not supported`);return r=JSON.stringify(t),i=n&&r.length>=2048&&Kt(),o=r,s={"Content-Type":`application/json`,Accept:`*/*`},i?[4,qt(r)]:[3,2];case 1:c=a.sent(),c&&(s[`Content-Encoding`]=`gzip`,o=c),a.label=2;case 2:return s=d(d({},this.customHeaders),s),l={headers:s,body:o,method:`POST`},[4,fetch(e,l)];case 3:return u=a.sent(),[4,u.text()];case 4:f=a.sent();try{return[2,this.buildResponse(JSON.parse(f))]}catch{return[2,this.buildResponse({code:u.status})]}return[2]}})})},t}(Wt);o();var Wr=function(e){l(t,e);function t(){return e.call(this)||this}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),s(this,void 0,void 0,function(){var n=this;return a(this,function(r){return[2,new Promise(function(r,i){var a=p();if(!a?.navigator.sendBeacon)throw Error(`SendBeaconTransport is not supported`);try{var o=JSON.stringify(t);return a.navigator.sendBeacon(e,o)?r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:o.length,server_upload_time:Date.now()})):r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(Wt);o();var Gr=function(e,t,n){return n===void 0&&(n=!0),s(void 0,void 0,void 0,function(){var i,o,s,c,l,u,d,f,p;return a(this,function(a){switch(a.label){case 0:return i=ut(e),[4,t.getRaw(i)];case 1:return o=a.sent(),o?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:a.sent(),a.label=3;case 3:return s=r(o.split(`.`),6),c=s[0],l=s[1],u=s[2],d=s[3],f=s[4],p=s[5],[2,{deviceId:c,userId:qr(l),sessionId:Kr(d),lastEventId:Kr(p),lastEventTime:Kr(f),optOut:!!u}]}})})},Kr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},qr=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}},Jr=`[Amplitude]`;`${Jr}`;var Yr=`${Jr} Form Started`,Xr=`${Jr} Form Submitted`,Zr=`${Jr} File Downloaded`,Qr=`session_start`,$r=`session_end`,ei=`${Jr} File Extension`,ti=`${Jr} File Name`,ni=`${Jr} Link ID`,ri=`${Jr} Link Text`,ii=`${Jr} Link URL`,ai=`${Jr} Form ID`,oi=`${Jr} Form Name`,si=`${Jr} Form Destination`,ci=`cookie`;o();var li=function(e){var t=e.split(`.`);return t.length<=2?e:t.slice(t.length-2,t.length).join(`.`)},ui=function(e){return Object.values(e).every(function(e){return!e})},di=function(e){var t=d(d({},e),{referring_domain:void 0,referrer:void 0});return Object.values(t).every(function(e){return!e})},fi=function(e,t,n,r,i,a){i===void 0&&(i=!0),e.referrer;var o=e.referring_domain,s=c(e,[`referrer`,`referring_domain`]),l=t||{};l.referrer;var u=l.referring_domain,d=c(l,[`referrer`,`referring_domain`]),f=n.excludeInternalReferrers;if(f){var p=_i(f,r);if(!(p instanceof TypeError)&&e.referring_domain&&xi(e.referring_domain,a)&&(p===`always`||p===`ifEmptyCampaign`&&di(e)))return vi(p,e.referring_domain,r),!1}if(pi(n.excludeReferrers,e.referring_domain))return r.debug(`This is not a new campaign because ${e.referring_domain} is in the exclude referrer list.`),!1;if(!i&&ui(e)&&t)return r.debug(`This is not a new campaign because this is a direct traffic in the same session.`),!1;var m=JSON.stringify(s)!==JSON.stringify(d),h=li(o||``)!==li(u||``),g=!t||m||h;return g?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.`),g},pi=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=``),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},mi=function(e,t){var n=t.startsWith(`.`)?t:`.${t}`;return!!(e.startsWith(`.`)?e:`.${e}`).endsWith(n)},hi=function(e,t){var n=d(d({},I),e);return be(Object.entries(n).reduce(function(e,n){var i=r(n,2),a=i[0],o=i[1];return e.setOnce(`initial_${a}
6`,o??t.initialEmptyValue??`EMPTY`),o?e.set(a,o):e.unset(a)},new oe))},gi=function(e){var t=e;return t?(t.startsWith(`.`)&&(t=t.substring(1)),[RegExp(`${t.replace(`.`,`\\.`)}\$`)]):[]},_i=function(e,t){if(e===!0)return pr.always;if(typeof e==`object`){var n=e.condition;if(typeof n==`string`&&Object.keys(pr).includes(n))return n;if(n===void 0)return pr.always}var r=`Invalid configuration provided for attribution.excludeInternalReferrers: ${JSON.stringify(e)}`;return t.error(r),TypeError(r)};function vi(e,t,n){var r=`This is not a new campaign because referring_domain=${t} is on the same domain as the current page and it is configured to exclude internal referrers`;e===`always`?n.debug(r):e===`ifEmptyCampaign`&&n.debug(`${r} with empty campaign parameters`)}var yi=`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`.split(`,`),bi=function(e){var t=e||p()?.location?.hostname;if(!t)return``;var n=t.split(`.`),r=n[n.length-1],i=n[n.length-2];return yi.find(function(e){return t.endsWith(`.${e}`)})&&(r=n[n.length-2]+`.`+n[n.length-1],i=n[n.length-3]),i?`${i}.${r}`:r},xi=function(e,t){var n=p();return n?mi(e,(t||``).trim()||bi(n.location.hostname)):!1};o();var Si=function(e){l(t,e);function t(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,ee,te,F,ne,I,L,R,re,ie,ae,oe){r===void 0&&(r=new yt),i===void 0&&(i={domain:``,expiration:365,sameSite:`Lax`,secure:!1,upgrade:!0}),c===void 0&&(c=1e3),l===void 0&&(l=5),u===void 0&&(u=30),d===void 0&&(d=ci),g===void 0&&(g=new je),_===void 0&&(_=ke.Warn),y===void 0&&(y=!1),b===void 0&&(b=!1),C===void 0&&(C=``),w===void 0&&(w=`US`),D===void 0&&(D=1800*1e3),O===void 0&&(O=new Br({loggerProvider:g})),k===void 0&&(k={ipAddress:!0,language:!0,platform:!0}),A===void 0&&(A=`fetch`),j===void 0&&(j=!1),M===void 0&&(M=!0),ne===void 0&&(ne=!0),I===void 0&&(I=0),ie===void 0&&(ie=!1),ae===void 0&&(ae=!1);var z=this;z=e.call(this,{apiKey:t,storageProvider:O,transportProvider:Ei(A)})||this,z.apiKey=t,z.appVersion=n,z.cookieOptions=i,z.defaultTracking=a,z.autocapture=o,z.flushIntervalMillis=c,z.flushMaxRetries=l,z.flushQueueSize=u,z.identityStorage=d,z.ingestionMetadata=f,z.instanceName=p,z.loggerProvider=g,z.logLevel=_,z.minIdLength=v,z.offline=y,z.partnerId=x,z.plan=S,z.serverUrl=C,z.serverZone=w,z.sessionTimeout=D,z.storageProvider=O,z.trackingOptions=k,z.transport=A,z.useBatch=j,z.fetchRemoteConfig=M,z.networkTrackingOptions=te,z.identify=F,z.enableDiagnostics=ne,z.diagnosticsSampleRate=I,z.diagnosticsClient=L,z.remoteConfig=R,z.topLevelDomain=re,z.enableRequestBodyCompression=ie,z._enableRequestBodyCompressionExperimental=ae,z.customEnrichment=oe,z.version=Pr,z._optOut=!1,z._cookieStorage=r,z.deviceId=s,z.lastEventId=m,z.lastEventTime=h,z.optOut=b,z.deferredSessionId=E,z.sessionId=T,z.pageCounter=P,z.userId=N,z.debugLogsEnabled=ee,z.loggerProvider.enable(ee?ke.Debug:z.logLevel),z.networkTrackingOptions=te,z.identify=F,z.enableDiagnostics=ne,z.diagnosticsSampleRate=I,z.diagnosticsClient=L;var se=R?.fetchRemoteConfig??M;return z.remoteConfig=z.remoteConfig||{},z.remoteConfig.fetchRemoteConfig=se,z.fetchRemoteConfig=se,z.topLevelDomain=re||bi(),z}return Object.defineProperty(t.prototype,`cookieStorage`,{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
6,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,e!==void 0&&this._deferredSessionId!==void 0&&(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 xt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(lt(this.apiKey),e)},t}(Ne),Ci=function(e,t,n,r,i){return t===void 0&&(t={}),s(void 0,void 0,void 0,function(){var o,s,c,l,u,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;return a(this,function(a){switch(a.label){case 0:return o=t.identityStorage||`cookie`,s=``,o===`cookie`&&!t.cookieOptions?.domain&&t.cookieOptions?.domain!==``?[4,Di(void 0,r)]:[3,2];case 1:s=a.sent(),a.label=2;case 2:return c=d({domain:t.cookieOptions?.domain??s,expiration:365,sameSite:`Lax`,secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(e){var t=wt(e);return t?Tt(JSON.parse(t).cookieDomain,c.domain):!1},diagnosticsClient:r},u=wi(t.identityStorage,c,l),[4,Gr(e,u,t.cookieOptions?.upgrade??!0)];case 3:return f=a.sent(),[4,u.get(lt(e))];case 4:return p=a.sent(),m=ft(),h=m.ampTimestamp?Number(m.ampTimestamp):void 0,g=h?Date.now()<h:!0,_=t.deviceId??(g?m.ampDeviceId??m.deviceId:void 0)??p?.deviceId??f.deviceId??_e(),v=p?.lastEventId??f.lastEventId,y=p?.lastEventTime??f.lastEventTime,b=t.optOut??p?.optOut??f.optOut,x=p?.sessionId??f.sessionId,S=p?.deferredSessionId,C=t.userId??p?.userId??f.userId,n.previousSessionDeviceId=p?.deviceId??f.deviceId,n.previousSessionUserId=p?.userId??f.userId,w={ipAddress:t.trackingOptions?.ipAddress??!0,language:t.trackingOptions?.language??!0,platform:t.trackingOptions?.platform??!0},T=p?.pageCounter,E=p?.debugLogsEnabled,t.autocapture!==void 0&&(t.defaultTracking=t.autocapture),D=new Si(e,t.appVersion,u,c,t.defaultTracking,t.autocapture,_,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,v,y,i?.loggerProvider??t.loggerProvider,t.logLevel,t.minIdLength,t.offline,b,t.partnerId,t.plan,t.serverUrl,i?.serverZone??t.serverZone,x,S,t.sessionTimeout,t.storageProvider,w,t.transport,t.useBatch,t.fetchRemoteConfig,C,T,E,t.networkTrackingOptions,t.identify,i?.enableDiagnostics??t.enableDiagnostics,i?.diagnosticsSampleRate??n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,n._enableRequestBodyCompressionExperimentalValue,t.customEnrichment),[4,D.storageProvider.isEnabled()];case 5:return a.sent()||(D.loggerProvider.warn(`Storage provider ${D.storageProvider.constructor.name} is not enabled. Falling back to MemoryStorage.`),D.storageProvider=new yt),[2,D]}})})},wi=function(e,t,n){switch(e===void 0&&(e=ci),t===void 0&&(t={}),e){case`localStorage`:return new Br;case`sessionStorage`:return new Vr;case`none`:return new yt;default:return new xt(d(d({},t),{expirationDays:t.expiration}),n)}},Ti=function(e){return e===void 0&&(e={}),e.remoteConfig?.fetchRemoteConfig===!0?!0:!(e.remoteConfig?.fetchRemoteConfig===!1||e.fetchRemoteConfig===!1)},Ei=function(e){var t=typeof e==`object`?e.type:e,n=typeof e==`object`?e.headers:void 0;return t===`xhr`?new Hr(n):t===`beacon`?new Wr:new Ur(n)},Di=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,s,s,c,l,u;return a(this,function(a){switch(a.label){case 0:return[4,new xt(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!a.sent()||!e&&(typeof location>`u`||!location.hostname)||(n=e??location.hostname,r=n.split(`.`),r.length===1))return[2,``];for(i=[],o=1,yi.find(function(e){return n.endsWith(`.${e}`)})&&(o=2),s=r.length-o-1;s>=0;--s)i.push(r.slice(s).join(`.`));s=0,a.label=2;case 2:if(!(s<i.length))return[3,7];c=i[s],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,xt.isDomainWritable(c)];case 4:return l=a.sent(),l?[2,`.`+c]:[3,6];case 5:return u=a.sent(),t&&t.recordEvent(`cookies.tld.failure`,{reason:`Unexpected exception checking domain is writable: ${c}`,error:u instanceof Error?u.message:String(u)}),[3,6];case 6:return s++,[3,2];case 7:return t&&t.recordEvent(`cookies.tld.failure`,{reason:`Could not determine TLD for host ${n}`}),[2,``]}})})},Oi=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t};o();var ki=`[Amplitude] Page Viewed`,Ai=`AMP_PAGE_VIEW`,ji=function(e){e===void 0&&(e={});var t,n=p(),i=void 0,o=!1,c,l,u=e.trackOn,f=e.trackHistoryChanges,m=e.eventType,h=m===void 0?ki:m,g=function(e){var t=e;try{t=decodeURI(e)}catch(e){i?.error(`Malformed URI sequence: `,e)}return t},_=function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return t=g(typeof location<`u`&&location.href||``),r={event_type:h},n=[{}],[4,Mi()];case 1:return[2,(r.event_properties=d.apply(void 0,[d.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":typeof location<`u`&&location.hostname||``,"[Amplitude] Page Location":t,"[Amplitude] Page Path":typeof location<`u`&&g(location.pathname)||``,"[Amplitude] Page Title":Kn(Gn),"[Amplitude] Page URL":t.split(`?`)[0],"[Amplitude] Page View ID":e}]),r)]}})})},v=function(){return u===void 0||typeof u==`function`&&u()},y=typeof location<`u`?location.href:null,b=function(){return s(void 0,void 0,void 0,function(){var e,n,r,o,s;return a(this,function(a){switch(a.label){case 0:return e=location.href,n=Pi(f,e,y||``)&&v(),y=e,n?(r=void 0,l&&(r=_e(),l.set(Ai,{pageViewId:r})),i?.log(`Tracking page view event`),t==null?[3,3]:[3,1]):[3,4];case 1:return s=(o=t).track,[4,_(r)];case 2:s.apply(o,[a.sent()]),a.label=3;case 3:a.label=4;case 4:return[2]}})})},x=function(){b()};return{name:`@amplitude/plugin-page-view-tracking-browser`,type:`enrichment`,setup:function(e,u){return s(void 0,void 0,void 0,function(){var s,d,f;return a(this,function(a){switch(a.label){case 0:if(t=u,c=e,i=e.loggerProvider,i.log(`Installing @amplitude/plugin-page-view-tracking-browser`),o=!0,n){try{l=new Dt(n.sessionStorage)}catch{i?.debug(`sessionStorage is not available in this environment.`)}n.addEventListener(`popstate`,x),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,n){var i=r(n,3),a=i[0],s=i[1],c=i[2];e.apply(t,[a,s,c]),o&&x()}})}return v()?(i.log(`Tracking page view event`),s=void 0,l&&(s=_e(),l.set(Ai,{pageViewId:s})),f=(d=t).track,[4,_(s)]):[3,2];case 1:f.apply(d,[a.sent()]),a.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return a(this,function(a){switch(a.label){case 0:return u===`attribution`&&Ni(e)?(i?.log(`Enriching c
6ampaign event to page view event with campaign parameters`),t=void 0,l?[4,l.get(Ai)]:[3,2]):[3,4];case 1:n=a.sent(),t=n?.pageViewId,a.label=2;case 2:return[4,_(t)];case 3:r=a.sent(),e.event_type=r.event_type,e.event_properties=d(d({},e.event_properties),r.event_properties),a.label=4;case 4:return c&&e.event_type===h&&(c.pageCounter=c.pageCounter?c.pageCounter+1:1,e.event_properties=d(d({},e.event_properties),{"[Amplitude] Page Counter":c.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(e){return n&&(n.removeEventListener(`popstate`,x),o=!1),[2]})})}}},Mi=function(){return s(void 0,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return e=Oi,[4,new zn().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Ni=function(e){if(e.event_type===`$identify`&&e.user_properties){var t=e.user_properties,n=t[m.SET]||{},i=t[m.UNSET]||{},a=u(u([],r(Object.keys(n)),!1),r(Object.keys(i)),!1);return Object.keys(I).every(function(e){return a.includes(e)})}return!1},Pi=function(e,t,n){switch(e){case`pathOnly`:if(n==``)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname;default:return t!==n}};o();var Fi=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;t?.removeEventListener(n,r)}),t=[]},i;return{name:`@amplitude/plugin-form-interaction-tracking-browser`,type:`enrichment`,setup:function(t,r){return s(void 0,void 0,void 0,function(){var o,s;return a(this,function(a){return i=jr(t),o=function(){if(!r){t.loggerProvider.warn(`Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.`);return}if(!(typeof document>`u`)){var a=new WeakSet,o=function(e){if(!a.has(e)){a.add(e);var o=!1;n(e,`change`,function(){var t,n=Li(e);o||r.track(Yr,(t={},t[ai]=Ii(e.id),t[oi]=Ii(e.name),t[si]=n,t)),o=!0}),n(e,`submit`,function(n){var a,s,c=Li(e);if(o||r.track(Yr,(a={},a[ai]=Ii(e.id),a[oi]=Ii(e.name),a[si]=c,a)),o=!0,i?.shouldTrackSubmit!==void 0)if(typeof i.shouldTrackSubmit==`function`&&typeof SubmitEvent<`u`&&n instanceof SubmitEvent)try{if(!i.shouldTrackSubmit(n))return}catch{t.loggerProvider.warn(`shouldTrackSubmit callback threw an error, proceeding with tracking.`)}else t.loggerProvider.warn(`shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.`);r.track(Xr,(s={},s[ai]=Ii(e.id),s[oi]=Ii(e.name),s[si]=c,s)),o=!1})}};Array.from(document.getElementsByTagName(`form`)).forEach(o),typeof MutationObserver<`u`&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){e.nodeName===`FORM`&&o(e),`querySelectorAll`in e&&typeof e.querySelectorAll==`function`&&Array.from(e.querySelectorAll(`form`)).map(o)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState===`complete`?o():(s=p(),s?s.addEventListener(`load`,o):t.loggerProvider.debug(`Form interaction tracking is not installed because global is undefined.`)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(t){return e?.disconnect(),r(),[2]})})}}},Ii=function(e){if(typeof e==`string`)return e},Li=function(e){var t=e.getAttribute(`action`);try{t=new URL(encodeURI(t??``),window.location.href).href}catch{}return t};o();var Ri=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;t?.removeEventListener(n,r)}),t=[]};return{name:`@amplitude/plugin-file-download-tracking-browser`,type:`enrichment`,setup:function(t,r){return s(void 0,void 0,void 0,function(){var i,o;return a(this,function(a){return i=function(){if(!r){t.loggerProvider.warn(`File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.`);return}if(!(typeof document>`u`)){var i=function(e){var t;try{t=new URL(e.href,window.location.href)}catch{return}var i=a.exec(t.href)?.[1];i&&n(e,`click`,function(){var n;i&&r.track(Zr,(n={},n[ei]=i,n[ti]=t.pathname,n[ni]=e.id,n[ri]=e.text,n[ii]=e.href,n))})},a=/\.(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)(\?.+)?$/;
6Array.from(document.getElementsByTagName(`a`)).forEach(i),typeof MutationObserver<`u`&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){e.nodeName===`A`&&i(e),`querySelectorAll`in e&&typeof e.querySelectorAll==`function`&&Array.from(e.querySelectorAll(`a`)).map(i)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState===`complete`?i():(o=p(),o?o.addEventListener(`load`,i):t.loggerProvider.debug(`File download tracking is not installed because global is undefined.`)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(t){return e?.disconnect(),r(),[2]})})}}},zi=!1,Bi=function(e){zi||e.defaultTracking!==void 0||(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: 7 8amplitude.init(<YOUR_API_KEY>, { 9 defaultTracking: true, 10}); 11 12Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`),zi=!0)};o();var Vi=function(){var e=`@amplitude/plugin-network-checker-browser`,t=`before`,n=p(),r=[],i=function(e,t){n?.addEventListener&&(n?.addEventListener(e,t),r.push({type:e,handler:t}))},o=function(){r.forEach(function(e){var t=e.type,r=e.handler;n?.removeEventListener(t,r)}),r=[]};return{name:e,type:t,setup:function(e,t){return s(void 0,void 0,void 0,function(){return a(this,function(n){return typeof navigator>`u`?(e.loggerProvider.debug(`Network connectivity checker plugin is disabled because navigator is not available.`),e.offline=!1,[2]):(e.offline=!navigator.onLine,i(`online`,function(){e.loggerProvider.debug(`Network connectivity changed to online.`),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),i(`offline`,function(){e.loggerProvider.debug(`Network connectivity changed to offline.`),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(e){return o(),[2]})})}}};o();function Hi(e){var t,n,a,o,s,c;if(!(typeof e!=`object`||!e)&&!Array.isArray(e)){var l=Object.keys(e);try{for(var d=i(l),f=d.next();!f.done;f=d.next()){var p=f.value;try{var m=e[p];typeof m?.enabled==`boolean`&&(m.enabled?(delete m.enabled,Object.keys(m).length===0&&(e[p]=!0)):e[p]=!1),Hi(m)}catch{}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}try{if(e.autocapture?.networkTracking?.captureRules?.length)try{for(var h=i(e.autocapture.networkTracking.captureRules),g=h.next();!g.done;g=h.next()){var _=g.value;try{for(var v=(s=void 0,i([`responseHeaders`,`requestHeaders`])),y=v.next();!y.done;y=v.next()){var b=y.value,x=_[b]??{},S=x.captureSafeHeaders,C=x.allowlist;if(!(!S&&!C)){if(C!==void 0&&!Array.isArray(C)){delete _[b];continue}_[b]=u(u([],r(S?L:[]),!1),r(C??[]),!1)}}}catch(e){s={error:e}}finally{try{y&&!y.done&&(c=v.return)&&c.call(v)}finally{if(s)throw s.error}}}}catch(e){a={error:e}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}finally{if(a)throw a.error}}}catch{}var w=e.autocapture?.frustrationInteractions;w&&(w.rageClick&&(w.rageClicks=w.rageClick,delete w.rageClick),w.deadClick&&(w.deadClicks=w.deadClick,delete w.deadClick))}}function Ui(e,t,n){var r,a,o=[];try{for(var s=i(t??[]),c=s.next();!c.done;c=s.next()){var l=c.value;try{o.push(new RegExp(l))}catch(e){n.loggerProvider.warn(`Invalid regex pattern: ${l}`,e)}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}return e.concat(o)}function Wi(e,t){var n,r;if(e){Hi(e);try{t.loggerProvider.debug(`Update browser config with remote configuration:`,JSON.stringify(e));var a=e;if(a&&`autocapture`in a){if(typeof a.autocapture==`boolean`&&(t.autocapture=a.autocapture),typeof a.autocapture==`object`&&a.autocapture!==null){var o=d({},a.autocapture);if(t.autocapture===void 0&&(t.autocapture=a.autocapture),typeof a.autocapture.elementInteractions==`object`&&a.autocapture.elementInteractions!==null&&a.autocapture.elementInteractions.pageUrlAllowlistRegex?.length){o.elementInteractions=d({},a.autocapture.elementInteractions);var s=o.elementInteractions,c=s.pageUrlAllowlist??[],l=a.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Ui(c,l,t),delete s.pageUrlAllowlistRegex}
12if(typeof a.autocapture.networkTracking==`object`&&a.autocapture.networkTracking!==null&&a.autocapture.networkTracking.captureRules?.length){o.networkTracking=d({},a.autocapture.networkTracking);var u=o.networkTracking.captureRules??[];try{for(var f=i(u),p=f.next();!p.done;p=f.next()){var m=p.value;m.urls=Ui(m.urls??[],m.urlsRegex,t),delete m.urlsRegex}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}typeof t.autocapture==`boolean`&&(t.autocapture=d({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},o)),typeof t.autocapture==`object`&&(t.autocapture=d(d({},t.autocapture),o))}t.defaultTracking=t.autocapture}`customEnrichment`in a&&a.customEnrichment!==null&&(t.customEnrichment=a.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)}}}var Gi=`1.24.2`,Ki=`@amplitude/plugin-autocapture-browser`,qi=`@amplitude/plugin-frustration-browser`,Ji=`[Amplitude] Dead Click`,Yi=`[Amplitude] Rage Click`,Xi=`[Amplitude] Error Click`,Zi=`[Amplitude] Thrashed Cursor`,Qi=`[Amplitude] Element ID`,$i=`[Amplitude] Element Class`,ea=`[Amplitude] Element Tag`,ta=`[Amplitude] Element Text`,na=`[Amplitude] Element Hierarchy`,ra=`[Amplitude] Element Href`,ia=`[Amplitude] Element Position Left`,aa=`[Amplitude] Element Position Top`,oa=`[Amplitude] Element Aria Label`,sa=`[Amplitude] Element Attributes`,ca=`[Amplitude] Element Path`,la=`[Amplitude] Element Parent Label`,ua=`[Amplitude] Page URL`,da=`[Amplitude] Page Title`,fa=`[Amplitude] Viewport Height`,pa=`[Amplitude] Viewport Width`,ma=`[Amplitude] Max Page X`,ha=`[Amplitude] Max Page Y`,ga=`[Amplitude] Page View ID`,_a=`https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz`,va=`amp-visual-tagging-selector-highlight`,ya=`data-amp-mask-attributes`,ba=`AMP_PAGE_VIEW`;o();var xa=[`input`,`select`,`textarea`],Sa=function(e,t){return((window==null?void 0:window.getComputedStyle)?.call(window,e))?.getPropertyValue(`cursor`)===`pointer`&&t===`click`},Ca=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&mt(window.location.href,n)||!mt(window.location.href,t))},wa=function(e,t,n){return n===void 0&&(n=!1),function(r,i){var a,o=e.shouldTrackEventResolver,s=((a=i?.tagName)?.toLowerCase)?.call(a);if(!s)return!1;if(o)return o(r,i);if(!Ca(e))return!1;var c=String(i?.getAttribute(`type`))||``;if(typeof c==`string`)switch(c.toLowerCase()){case`hidden`:return!1;case`password`:return!1}var l=Sa(i,r);if(n&&l)return!0;if(t&&!t.some(function(e){return!!(i?.matches)?.call(i,e)}))return!1;switch(s){case`input`:case`select`:case`textarea`:return r===`change`||r===`click`;default:return l?!0:r===`click`}}},Ta=function(e){var t,n=((t=e?.tagName)?.toLowerCase)?.call(t),r=e instanceof HTMLElement?e.getAttribute(`contenteditable`)?.toLowerCase()===`true`:!1;return!xa.includes(n)&&!r},Ea=function(e){return e?e.split(`,`).map(function(e){return e.trim()}).filter(function(e){return e.length>0&&e!==`id`&&e!==`class`}):[]},Da=function(e,t){return Object.entries(e).reduce(function(e,n){var i=r(n,2),a=i[0],o=i[1];if(a.startsWith(t)){var s=a.replace(t,``);s&&(e[s]=o||``)}return e},{})},Oa=function(e){return e==null||typeof e==`object`&&Object.keys(e).length===0||typeof e==`string`&&e.trim().length===0},ka=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return Oa(r)||(t[n]=r),t},{})},Aa=function(){try{var e=(p()?.sessionStorage)?.getItem(ba);if(!e)return;var t=JSON.parse(e);if(typeof t.pageViewId==`string`)return t.pageViewId}catch{}},ja=function(e,t){return e?t.some(function(t){return(e?.matches)?.call(e,t)})?e:ja(e?.parentElement,t):null},Ma=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};function Na(e){return e.type===`click`||e.type===`change`}var Pa;(function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]=`LEFT_OR_TOUCH_CONTACT`,e[e.MIDDLE=1]=`MIDDLE`,e[e.RIGHT=2]=`RIGHT`})(Pa||={});var Fa=`__AMPLITUDE_VISUAL_TAGGING__`;function Ia(e,t){var n=e;if(n[Fa]!==!0){n[Fa]=!0;
12var r=t.dataExtractor,i=t.isElementSelectable,a=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,c=function(t){e.notify({action:`element-selected`,data:t})},l=function(t,n){t===`selector-mode-changed`?e.notify({action:`track-selector-mode-changed`,data:n}):t===`selector-moved`&&e.notify({action:`track-selector-moved`,data:n})};e.registerActionHandler(`initialize-visual-tagging-selector`,function(t){e.loadScriptOnce(_a).then(function(){s=(window==null?void 0:window.amplitudeVisualTaggingSelector)?.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return i?i(t?.actionType||`click`,e):!0},onTrack:l,onSelect:c,visualHighlightClass:va,messenger:e,cssSelectorAllowlist:a,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:Gi}}}),e.notify({action:`selector-loaded`})}).catch(function(){var t;(t=e.logger)==null||t.warn(`Failed to initialize visual tagging selector`)})}),e.registerActionHandler(`close-visual-tagging-selector`,function(){var e;(e=s?.close)==null||e.call(s)})}}function La(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(Ma).filter(function(e){return r(`click`,e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){t?.track(`[Amplitude] Element Clicked`,e.targetElementProperties)})}function Ra(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,a=e.evaluateTriggers;return n.changeObservable.filter(Ma).filter(function(e){return i(`change`,e.closestTrackedAncestor)}).map(function(e){return a(e)}).subscribe(function(e){t?.track(`[Amplitude] Element Changed`,r(`change`,e.closestTrackedAncestor))})}function za(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,a=e.shouldTrackEvent,o=e.shouldTrackActionClick,s=n.clickObservable,c=n.mutationObservable,l=n.navigateObservable,u=Xn(s.filter(function(e){return!a(`click`,e.closestTrackedAncestor)}).map(function(e){return e.closestTrackedAncestor=ja(e.event.target,r.actionClickAllowlist),e.closestTrackedAncestor!==null&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(Ma).filter(function(e){return o(`click`,e.closestTrackedAncestor)}),l?Xn(c,l):c),d=null,f=null;return Yn(u,function(e){if(d&&=(clearTimeout(d),null),e.type===`click`)return f=e,d=setTimeout(function(){d=null,f=null},500),Promise.resolve(null);if(f){var t=f;return f=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&t?.track(`[Amplitude] Element Clicked`,i(`click`,e.closestTrackedAncestor))})}function Ba(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e=p(),t=Math.floor(e?.scrollX??e?.pageXOffset??0),r=Math.floor(e?.scrollY??e?.pageYOffset??0);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,r)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}o();var Va=p(),Ha=function(){return new G.default(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()}})},Ua=function(e){return e===void 0&&(e=`click`),new G.default(function(t){var n,r=function(e){t.next(e)};return(n=p())==null||n.document.addEventListener(e,r,{capture:!0}),function(){var t;(t=p())==null||t.document.removeEventListener(e,r,{capture:!0})}})},Wa=function(){return new G.default(function(e){var t,n=function(t){e.next(t)};return(t=p())==null||t.addEventListener(`scroll`,n),function(){var e;(e=p())==null||e.removeEventListener(`scroll`,n)}})},Ga=function(){return new G.default(function(e){var t=function(t){var n=[...arguments].slice(1),r=void 0;Array.isArray(n[0])&&typeof n[0][0]==`string`&&(r=n[0][0]),e.next({kind:`console`,message:r})};return cn.addListener(`error`,t),function(){cn.removeListener(t)}})},Ka=function(e,t){return new G.default(function(n){var r=p();if(!r?.IntersectionObserver)return function(){};var i=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:`0px`,threshold:1}),a=t.join(`,`);
12(r?.document.querySelectorAll(a)??[]).forEach(function(e){i.observe(e)});var o=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(a)&&i.observe(e),e.querySelectorAll(a).forEach(function(e){i.observe(e)}))})})});return function(){o.unsubscribe(),i.disconnect()}})},qa=function(){return new G.default(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:`error`};t.error instanceof Error||t.error instanceof DOMException?n=d(d({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):typeof t.error==`string`&&(n.message=t.error),e.next(n)}};return Va.addEventListener(`error`,t),function(){Va.removeEventListener(`error`,t)}})},Ja=function(){return new G.default(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):typeof t.reason==`string`&&(n.message=t.reason),e.next(n)};return Va.addEventListener(`unhandledrejection`,t),function(){Va.removeEventListener(`unhandledrejection`,t)}})},Ya=function(){return Xn(Xn(qa(),Ja()),Ga())},Xa=function(){return new G.default(function(e){var t=function(t){e.next(t)},n={capture:!0};return Va.document.addEventListener(`mousemove`,t,n),function(){Va.document.removeEventListener(`mousemove`,t,n)}})},Za=function(e,t){try{if(t.subprop_key===`[Amplitude] Element Text`)return t.subprop_op===`is`&&t.subprop_value.includes(e.targetElementProperties[`[Amplitude] Element Text`]);if(t.subprop_key===`[Amplitude] Element Hierarchy`)return t.subprop_op===`autotrack css match`&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error(`Error matching event to filter`,e),!1}return!1},Qa=function(e,t){try{if(e.sourceType===`DOM_ELEMENT`){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch{return}},$a=function(e,t,n){e.forEach(function(e){if(typeof e!=`string`&&e.actionType===`ATTACH_EVENT_PROPERTY`){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})};o();var eo={"[Amplitude] Element Clicked":`click`,"[Amplitude] Element Changed":`change`},to=function(e){var t,n,r,a,o=Object.values(eo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=i(e),c=s.next();!c.done;c=s.next()){var l=c.value;try{try{for(var u=(r=void 0,i(l.definition)),d=u.next();!d.done;d=u.next()){var f=eo[d.value.event_type];f&&o[f].add(l.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn(`Skipping Labeled Event due to malformed definition`,l?.id,e)}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},no=function(e){var t,n,r,a,o=new Map;try{for(var s=i(e),c=s.next();!c.done;c=s.next()){var l=c.value;try{for(var u=(r=void 0,i(l.conditions)),d=u.next();!d.done;d=u.next()){var f=d.value;if(f.type===`LABELED_EVENT`){var p=f.match.eventId,m=o.get(p);m||(m=[],o.set(p,m)),m.push(l)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},ro=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return eo[t.event_type]===e.type&&t.filters.every(function(t){return Za(e,t)})})})},io=function(e,t){var n,r,a,o,s=new Set;try{for(var c=i(e),l=c.next();!l.done;l=c.next()){var u=l.value,d=t.get(u.id);if(d)try{for(var f=(a=void 0,i(d)),p=f.next();!p.done;p=f.next()){var m=p.value;s.add(m)}}catch(e){a={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(a)throw a.error}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Array.from(s)},ao=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 a=io(ro(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=i(a),s=o.next();!s.done;s=o.next()){var c=s.value;$a(c.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}(),oo=function(e,t,n,r){return new ao(e,t,n,r)};o();var so=new Set([`id`,`class`,`style`,`value`,`onclick`,`onchange`,`oninput`,`onblur`,`onsubmit`,`onfocus`,`onkeydown`,`onkeyup`,`onkeypress`,`data-reactid`,`data-react-checksum`,`data-reactroot`,ya,Bn]),co=[`type`],lo=[`svg`,`path`,`g`],uo=[`password`,`hidden`];function fo(e,t){var n,r;if(e===null)return null;var a=String(e.tagName).toLowerCase(),o={tag:a},s=Array.from(e.parentElement?.children??[]);s.length&&(o.index=s.indexOf(e),o.indexOfType=s.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var c=(e.previousElementSibling?.tagName)?.toLowerCase();c&&(o.prevSib=String(c));var l=e.getAttribute(`id`);l&&(o.id=String(l));var u=Array.from(e.classList);u.length&&(o.classes=u);var d={},f=Array.from(e.attributes).filter(function(e){return!so.has(e.name)}),p=!Ta(e);if(!uo.includes(String(e.getAttribute(`type`)))&&!lo.includes(a))try{for(var m=i(f),h=m.next();!h.done;h=m.next()){var g=h.value;
12if(!(p&&!co.includes(g.name))){if(t.has(g.name)){d[g.name]=Vn;continue}d[g.name]=String(g.value).substring(0,128)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(d).length&&(o.attrs=d),o}function po(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&n.tagName!==`HTML`;)t.push(n),n=n.parentElement;return t}o();var mo=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),ho=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return``;for(var n=[],r=e;r;){var i=go(r,!!t,r===e);if(!i||(n.push(i),i.optimized))break;r=r.parentElement}return n.reverse(),n.join(` > `)},go=function(e,t,n){var r,a;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute(`id`);if(t){if(o)return new mo(d(o),!0);var s=e.tagName.toLowerCase();if(s===`body`||s===`head`||s===`html`)return new mo(s,!0)}var c=e.tagName.toLowerCase();if(o)return new mo(c+d(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new mo(c,!0);function u(e){var t=e.getAttribute(`class`);return t?t.split(/\s+/g).filter(Boolean).map(function(e){return`$`+e}):[]}function d(e){return`#`+CSS.escape(e)}for(var f=u(e),p=!1,m=!1,h=-1,g=-1,_=l.children,v=0;_&&(h===-1||!m)&&v<_.length;++v){var y=_[v];if(y.nodeType===Node.ELEMENT_NODE){if(g+=1,y===e){h=g;continue}if(!m&&y.tagName.toLowerCase()===c){p=!0;var b=new Set(f);if(!b.size){m=!0;continue}for(var x=u(y),S=0;S<x.length;++S){var C=x[S];if(b.has(C)&&(b.delete(C),!b.size)){m=!0;break}}}}}var w=c;if(n&&c.toLowerCase()===`input`&&e.getAttribute(`type`)&&!e.getAttribute(`id`)&&!e.getAttribute(`class`)&&(w+=`[type=`+CSS.escape(e.getAttribute(`type`)||``)+`]`),m)w+=`:nth-child(`+String(h+1)+`)`;else if(p)try{for(var T=i(f),E=T.next();!E.done;E=T.next()){var D=E.value;w+=`.`+CSS.escape(D.slice(1))}}catch(e){r={error:e}}finally{try{E&&!E.done&&(a=T.return)&&a.call(T)}finally{if(r)throw r.error}}return new mo(w,!1)};o();var _o=function(){function e(e,t){var n,a,o=this;this.replaceSensitiveString=function(e){return Gn(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,a,s=performance.now(),c=[];if(!e)return[];for(var l=po(e),d=new Map,f=l.length-1;f>=0;f--){var p=l[f];if(p){var m=Ea(p.getAttribute(ya)),h=f===l.length-1?[]:d.get(l[f+1])??new Set,g=new Set(u(u([],r(h),!1),r(m),!1));d.set(p,g)}}c=l.map(function(e){return fo(e,d.get(e)??new Set)});var _=function(e){e?.attrs&&Object.entries(e.attrs).forEach(function(t){var n=r(t,2),i=n[0],a=n[1];e.attrs&&(e.attrs[i]=o.replaceSensitiveString(a))})};try{for(var v=i(c),y=v.next();!y.done;y=v.next()){var b=y.value;_(b)}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}var x=performance.now();return(a=o.diagnosticsClient)==null||a.recordHistogram(`autocapturePlugin.getHierarchy`,x-s),c},this.getNearestLabel=function(e){var t=e.parentElement;if(!t)return``;var n;try{n=t.querySelector(`:scope>span,h1,h2,h3,h4,h5,h6`)}catch{n=null}return n?o.getText(n):o.getNearestLabel(t)},this.getElementPath=function(e){var t;if(!e)return``;var n=performance.now(),r=ho(e),i=performance.now();return(t=o.diagnosticsClient)==null||t.recordHistogram(`autocapturePlugin.getElementPath`,i-n),r},this.getEventProperties=function(e,t,n){var r,i,a=((i=t?.tagName)?.toLowerCase)?.call(i),s=typeof t.getBoundingClientRect==`function`?t.getBoundingClientRect():{left:null,top:null},c=o.getHierarchy(t),l=c[0]?.attrs,u=o.getNearestLabel(t),d=Da(l??{},n),f=(r={},r[na]=c,r[ea]=a,r[ta]=o.getText(t),r[ia]=s.left==null?null:Math.round(s.left),r[aa]=s.top==null?null:Math.round(s.top),r[sa]=d,r[ca]=o.getElementPath(t),r[la]=u,r[ua]=ht(window.location.href.split(`?`)[0]),r[da]=Kn(o.replaceSensitiveString),r[fa]=window.innerHeight,r[pa]=window.innerWidth,r),p=Aa();if(p&&(f[ga]=p),f[Qi]=t.getAttribute(`id`)||``,f[$i]=t.getAttribute(`class`),f[oa]=l?.[`aria-label`],a===`a`&&e===`click`&&t instanceof HTMLAnchorElement){var m=t.href.substring(0,128);f[ra]=o.replaceSensitiveString(m)}return ka(f)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){i===void 0&&(i=!1);var a=o.addTypeAndTimestamp(e,t);if(Na(a)&&a.event.target!==null){if(i&&Sa(a.event.target,a.type))return a.closestTrackedAncestor=a.event.target,a.targetElementProperties=o.getEventProperties(a.type,a.closestTrackedAncestor,r),a;var s=ja(a.event.target,n);return s&&(a.closestTrackedAncestor=s,a.targetElementProperties=o.getEventProperties(a.type,s,r)),a}return a},this.extractDataFromDataSource=function(e,t){if(e.sourceType===`DOM_ELEMENT`){var n=Qa(e,t);return n?e.elementExtractType===`TEXT`?o.getText(n):e.elementExtractType===`ATTRIBUTE`&&e.attribute?n.getAttribute(e.attribute):void 0:void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r=`[${Bn}], [contenteditable]`;if(!e.querySelector(r))return e.innerText;var a=``,s=Array.from(e.childNodes);try{for(var c=i(s),l=c.next();!l.done;l=c.next()){var u=l.value;if(u.nodeType===Node.TEXT_NODE){a+=u.textContent||``;continue}if(u instanceof Element){if(u.hasAttribute(`data-amp-mask`)||u.hasAttribute(`contenteditable`)){a+=Vn;continue}a+=o.getTextWithMaskedDescendants(u)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return a},this.getText=function(e){if(e.closest(`[data-amp-mask]`)!==null)return Vn;var t=``;return t=e.querySelector(`[data-amp-mask], [contenteditable]`)?o.getTextWithMaskedDescendants(e):e.innerText||``,o.replaceSensitiveStr
12ing(t.substring(0,255)).replace(/\s+/g,` `).trim()},this.getEventTagProps=function(e){var t,n;if(!e)return{};var r=((n=e?.tagName)?.toLowerCase)?.call(n);return ka((t={},t[ea]=r,t[ta]=o.getText(e),t[ua]=window.location.href.split(`?`)[0],t))},this.diagnosticsClient=t?.diagnosticsClient;var s=e.maskTextRegex??[],c=[];try{for(var l=i(s),d=l.next();!d.done;d=l.next()){var f=d.value;if(c.length>=25)break;if(f instanceof RegExp)c.push(f);else if(`pattern`in f&&typeof f.pattern==`string`)try{c.push(new RegExp(f.pattern,`i`))}catch{}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=c}return e}();function vo(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,a=i===void 0?150:i,o=new Map,s=new Map,c=t.exposureObservable.subscribe(function(e){var t=e,i=t.target;if(t.isIntersecting){if(!o.get(i)){var c=setTimeout(function(){o.set(i,!0),n(r.getElementPath(i)),s.set(i,null)},a);s.set(i,c)}}else if(!t.isIntersecting&&t.intersectionRatio<1){var c=s.get(i);c&&(clearTimeout(c),s.set(i,null))}});return{unsubscribe:function(){c.unsubscribe()},reset:function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),o.clear()}}}function yo(e){var t,n=e.amplitude,r=e.scrollTracker,i=e.currentElementExposed,a=e.elementExposedForPage,o=e.exposureTracker,s=e.isPageEnd,c=e.lastScroll,l=r.getState(),u=p(),d=u?.innerWidth??0,f=u?.innerHeight??0,m=(t={},t[ua]=u?.location?.href,t[ma]=l.maxX+d,t[ha]=l.maxY+f,t[fa]=f,t[pa]=d,t[`[Amplitude] Element Exposed`]=Array.from(i),t),h=Aa();if(h&&(m[ga]=h),i.size===0&&l.maxX===c.maxX&&l.maxY===c.maxY){s&&(r.reset(),a.clear(),o?.reset());return}n?.track(`[Amplitude] Viewport Content Updated`,m),c.maxX=l.maxX,c.maxY=l.maxY,i.clear(),s&&(r.reset(),a.clear(),o?.reset())}function bo(e,t,n,r){if(!t.has(e)){t.add(e),n.add(e);var i=Array.from(n);JSON.stringify(i).length>=18e3&&r(!1)}}o();var xo;(function(e){e.ClickObservable=`clickObservable`,e.ChangeObservable=`changeObservable`,e.NavigateObservable=`navigateObservable`,e.MutationObservable=`mutationObservable`,e.ScrollObservable=`scrollObservable`,e.ExposureObservable=`exposureObservable`,e.BrowserErrorObservable=`browserErrorObservable`,e.SelectionObservable=`selectionObservable`,e.MouseMoveObservable=`mouseMoveObservable`})(xo||={});var So=function(e,t){e===void 0&&(e={}),t?.diagnosticsClient.setTag(`plugin.autocapture.version`,`1.24.2`);var n=e.dataAttributePrefix,o=n===void 0?dn:n,c=e.visualTaggingOptions,l=c===void 0?{enabled:!0}:c;e.cssSelectorAllowlist=e.cssSelectorAllowlist??un,e.actionClickAllowlist=e.actionClickAllowlist??fn,e.debounceTime=e.debounceTime??0;var f=e.viewportContentUpdated?.exposureDuration??e.exposureDuration??150;e.viewportContentUpdated=d(d({},e.viewportContentUpdated),{exposureDuration:f}),e.pageUrlExcludelist=e.pageUrlExcludelist?.reduce(function(e,t){if(typeof t==`string`&&e.push(t),t instanceof RegExp&&e.push(t),typeof t==`object`&&t&&`pattern`in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn(`Invalid regex pattern: ${t.pattern}`,n),e}return e},[]);var m=Ki,h=`enrichment`,g=[],_=new _o(e,t),v=new Set,y=new Set,b,x=function(){var t,n=Zn(Ua().map(function(t){return _.addAdditionalEventProperties(t,`click`,e.cssSelectorAllowlist,o)})),r=Zn(new G.default(function(t){var n,r=function(n){var r=_.addAdditionalEventProperties(n,`change`,e.cssSelectorAllowlist,o);t.next(r)};return(n=p())==null||n.document.addEventListener(`change`,r,{capture:!0}),function(){return p()?.document.removeEventListener(`change`,r)}})),i;window.navigation&&(i=Zn(new G.default(function(t){var n=function(n){var r=_.addAdditionalEventProperties(n,`navigate`,e.cssSelectorAllowlist,o);t.next(r)};return window.navigation.addEventListener(`navigate`,n),function(){window.navigation.removeEventListener(`navigate`,n)}})));var a=Zn(Ha().map(function(t){return _.addAdditionalEventProperties(t,`mutation`,e.cssSelectorAllowlist,o)})),s=Wa(),c=Ka(a,e.cssSelectorAllowlist);return t={},t[xo.ChangeObservable]=r,t[xo.ClickObservable]=n,t[xo.MutationObservable]=a,t[xo.NavigateObservable]=i,t[xo.ScrollObservable]=s,t[xo.ExposureObservable]=c,t},S=to(Object.values(e.pageActions?.labeledEvents??{})),C=no(e.pageActions?.triggers??[]),w=oo(S,C,_,e),T=function(t){t&&(e.pageActions=d(d({},e.pageActions),t),S=to(Object.values(e.pageActions.labeledEvents??{})),C=no(e.pageActions.triggers??[]),w.update(S,C,e))};return{name:m,type:h,setup:function(t,n){return s(void 0,void 0,void 0,function(){var i,s,c,h,S,C,E,D,O,k,A,j,M,N,P,ee,te,F,ne,I,L;return a(this,function(a){return typeof document>`u`?[2]:(i=!1,s={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe(`configs.analyticsSDK.pageActions`,`all`,function(e){T(e)}):t.loggerProvider.debug(`Remote config client is not provided, skipping remote config fetch`)),c=wa(e,e.cssSelectorAllowlist),h=wa(e,e.actionClickAllowlist),S=x(),C=La({allObservables:S,amplitude:n,shouldTrackEvent:c,evaluateTriggers:w.evaluate.bind(w)}
12),g.push(C),E=Ra({allObservables:S,getEventProperties:function(){var e=[...arguments];return _.getEventProperties.apply(_,u(u([],r(e),!1),[o],!1))},amplitude:n,shouldTrackEvent:c,evaluateTriggers:w.evaluate.bind(w)}),g.push(E),D=za({allObservables:S,options:e,getEventProperties:function(){var e=[...arguments];return _.getEventProperties.apply(_,u(u([],r(e),!1),[o],!1))},amplitude:n,shouldTrackEvent:c,shouldTrackActionClick:h}),D&&g.push(D),O=Ba({allObservables:S,amplitude:n}),g.push(O),k={},A=p(),j=function(e){e&&i||(setTimeout(function(){i=!1},100),i=!0,yo({amplitude:n,scrollTracker:O,currentElementExposed:y,elementExposedForPage:v,exposureTracker:k.exposure,isPageEnd:e,lastScroll:s}))},M=function(e){bo(e,v,y,j)},k.exposure=vo({allObservables:S,onExposure:M,dataExtractor:_,exposureDuration:f}),k.exposure&&g.push(k.exposure),N=function(){j(!0)},A?.addEventListener(`beforeunload`,N),b=function(){A?.removeEventListener(`beforeunload`,N)},g.push({unsubscribe:function(){return b()}}),P=S[xo.NavigateObservable],P?g.push(P.subscribe(function(){j(!0)})):A&&(ee=function(){j(!0)},A.addEventListener(`popstate`,ee),te=A.history.pushState,A.history&&te&&(A.history.pushState=new Proxy(te,{apply:function(e,t,n){var i=r(n,3),a=i[0],o=i[1],s=i[2];e.apply(t,[a,o,s]),j(!0)}})),g.push({unsubscribe:function(){A.removeEventListener(`popstate`,ee),A.history&&te&&(A.history.pushState=te)}})),(L=t?.loggerProvider)==null||L.log(`${m} has been successfully added.`),window.opener&&l.enabled&&(F=e.cssSelectorAllowlist,ne=e.actionClickAllowlist,I=ur(),Ia(I,{dataExtractor:_,isElementSelectable:wa(e,u(u([],r(F),!1),r(ne),!1)),cssSelectorAllowlist:F,actionClickAllowlist:ne}),fr(I),I.setup(d({logger:t?.loggerProvider},t?.serverZone&&{endpoint:tr[t.serverZone]}))),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return a(this,function(a){try{for(e=i(g),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return[2]})})}}};o();var Co=3e3,wo=[`mutation`,`navigate`];function To(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,o=n.mutationObservable,s=n.navigateObservable,c=Xn(a.filter(function(e){return Ma(e)&&i(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===Pa.LEFT_OR_TOUCH_CONTACT}),s?Xn(o,s):o),l=null;return Yn(c,function(e){return l&&wo.includes(e.type)?(clearTimeout(l),l=null,Promise.resolve(null)):e.type===`click`?l?Promise.resolve(null):new Promise(function(t){l=setTimeout(function(){t(e),l=null},Co)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track(Ji,d(d({},r(`click`,e.closestTrackedAncestor)),n),{time:e.timestamp})}})}o();var Eo=4,Do=_n,Oo=50;function ko(e,t){var n=t.event,r=n.pageX,i=n.pageY;e.yMin=Math.min(e.yMin??i,i),e.yMax=Math.max(e.yMax??i,i),e.xMin=Math.min(e.xMin??r,r),e.xMax=Math.max(e.xMax??r,r),e.isOutOfBounds=e.yMax-e.yMin>Oo||e.xMax-e.xMin>Oo}function Ao(e){if(e.length===0)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:d({"[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}}function jo(e,t){var n=e[Math.max(0,e.length-Eo+1)];return t.timestamp-n.timestamp>=Do}function Mo(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}function No(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,c=r.selectionObservable,l=[],u={},d=null;function f(e){l=[],u={},e&&(ko(u,e),l.push(e))}var p=Yn(o.filter(function(e){return i(`click`,e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return a(this,function(n){return ko(u,e),t=null,l.length===0||Mo(l,e)||jo(l,e)||u.isOutOfBounds?(d&&(t=Ao(l)),f(e)):l.push(e),d&&=(clearTimeout(d.timerId),d.resolve(t),null),l.length>=Eo?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Ao(l))},Do)}})]:[2,null]})})}),m=c?.subscribe(function(){f()}),h=p.subscribe(function(e){e!==null&&n.track(Yi,e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),m?.unsubscribe()}}}o();var Po=2e3;function Fo(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.clickObservable,a=n.browserErrorObservable,o=i.filter(function(e){return Ma(e)&&r(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===Pa.LEFT_OR_TOUCH_CONTACT}),s=null,c=null,l=function(){s!==null&&(clearTimeout(s),s=null),c=null};return Xn(o,a).subscribe(function(e){var n;if(e.type===`click`){l(),c=e,s=setTimeout(l,Po);return}e.type===`error`&&c&&(t.track(Xi,d((n={},n[`[Amplitude] Kind`]=e.event.kind,n[`[Amplitude] Message`]=e.event.message,n[`[Amplitude] Stack`]=e.event.stack,n[`[Amplitude] Filename`]=e.event.filename,n[`[Amplitude] Line Number`]=e.event.lineNumber,n[`[Amplitude] Column Number`]=e.event.columnNumber,n),c.targetElementProperties)),l())})}var Io;(function(e){e.INCREASING=`increasing`,e.DECREASING=`decreasing`})(Io||={});var Lo;(function(e){e.X=`x`,e.Y=`y`})(Lo||={});var Ro=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new G.default(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var a={x:t.clientX,y:t.clientY};if(n===null){n=a;return}a.x>n.x?(r===Io.DECREASING&&e.next(Lo.X),r=Io.INCREASING):a.x<n.x&&(r===Io.INCREASING&&e.next(Lo.X),r=Io.DECREASING),a.y>n.y?(i===Io.DECREASING&&e.next(Lo.Y),i=Io.INCREASING):a.y<n.y&&(i===Io.INCREASING&&e.next(Lo.Y),i=Io.DECREASING),n=a})})};function zo(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}function Bo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return t.length<n?!1:t[t.length-1]-t[0]<r}function Vo(e){e.changes=[],e.startTime=void 0}function Ho(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length&&!(i-t[r]<n);r++);r!==0&&(e.startTime=t[r],e.changes.splice(0,r))}function Uo(e,t){var n=void 0;if(Bo(e)&&(n=e.startTime),Bo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}var Wo=20,Go=2e3,Ko=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=n===void 0?Wo:n,i=e.thresholdMs,a=i===void 0?Go:i;return new G.default(function(e){var n={changes:[],changesThreshold:r,thresholdMs:a},i={changes:[],changesThreshold:r,thresholdMs:a},o=void 0,s=null;function c(){o!==void 0&&(e.next(o),o=void 0,s!==null&&clearTimeout(s),V
12o(n),Vo(i))}return t.subscribe(function(e){s!==null&&clearTimeout(s),zo(e===Lo.X?n:i);var t=Uo(n,i);return t?(o||=t,s=setTimeout(function(){c(),s=null},a)):c(),Ho(n),Ho(i),function(){s!==null&&(clearTimeout(s),s=null)}})})},qo=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,a=i===void 0?Wo:i,o=e.thresholdMs,s=o===void 0?Go:o;return Ko({mouseDirectionChangeObservable:Ro({allWindowObservables:r}),directionChanges:a,thresholdMs:s}).subscribe(function(e){Ca(n)&&t.track(Zi,void 0,{time:e})})};o();function Jo(e,t,n,r){if(!r)return[];var i=e[t];return typeof i==`object`&&i&&`cssSelectorAllowlist`in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Yo=5,Xo=4e3,Zo=function(e){e===void 0&&(e={});var t=qi,n=`enrichment`,o=[],c=e.errorClicks!==!1;e.errorClicks||(c=!1);var l=e.deadClicks!==!1&&e.deadClicks!==null,f=e.rageClicks!==!1&&e.rageClicks!==null,p=e.thrashedCursor!==!1&&e.thrashedCursor!==null;e.thrashedCursor||(p=!1);var m=Jo(e,`rageClicks`,gn,f),h=Jo(e,`deadClicks`,mn,l),g=Jo(e,`errorClicks`,hn,c),_=e.dataAttributePrefix??dn,v=new _o(e),y=u([],r(new Set(u(u(u([],r(m),!1),r(h),!1),r(g),!1))),!1),b=function(){var e,t=Zn(Ua(`pointerdown`).map(function(e){return v.addAdditionalEventProperties(e,`click`,y,_,!0)})),n=Zn(Ya().map(function(e){return v.addTypeAndTimestamp(e,`error`)})),r=Zn(Ha().map(function(e){return v.addAdditionalEventProperties(e,`mutation`,y,_)})),i;window.navigation&&(i=Zn(new G.default(function(e){var t=function(t){e.next(d(d({},t),{type:`navigate`}))};return window.navigation.addEventListener(`navigate`,t),function(){window.navigation.removeEventListener(`navigate`,t)}}).map(function(e){return v.addAdditionalEventProperties(e,`navigate`,y,_)})));var a=Zn(new G.default(function(e){var t=function(){var t=document.activeElement;if(t&&(t.tagName===`TEXTAREA`||t.tagName===`INPUT`)){var n=void 0,r=void 0;try{if(n=t.selectionStart,r=t.selectionEnd,n===r)return}catch{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)}})),o=Zn(Xa());return e={},e[xo.ClickObservable]=t,e[xo.MutationObservable]=r,e[xo.NavigateObservable]=i,e[xo.BrowserErrorObservable]=n,e[xo.SelectionObservable]=a,e[xo.MouseMoveObservable]=o,e};return{name:t,type:n,setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,s,u,d,y,x,S,C,w,T,E;return a(this,function(a){return typeof document>`u`?[2]:(i=b(),f&&(s=wa(e,m),u=No({allObservables:i,amplitude:r,shouldTrackRageClick:s}),o.push(u)),l&&(d=wa(e,h),y=To({amplitude:r,allObservables:i,getEventProperties:function(e,t){return v.getEventProperties(e,t,_)},shouldTrackDeadClick:d}),o.push(y)),c&&(x=wa(e,g),S=Fo({amplitude:r,allObservables:i,shouldTrackErrorClick:x}),o.push(S)),p&&(C=void 0,w=void 0,typeof e.thrashedCursor==`object`&&(C=e.thrashedCursor.directionChanges,w=e.thrashedCursor.threshold,C&&C<Yo&&(n.loggerProvider.warn(`'thrashedCursor.directionChanges' of ${C} is below the minimum of ${Yo}, setting to ${Yo}`),C=Yo),w&&w>Xo&&(n.loggerProvider.warn(`'thrashedCursor.threshold' of ${w} is above the maximum of ${Xo}, setting to ${Xo}`),w=Xo)),T=qo({amplitude:r,options:e,allObservables:i,directionChanges:C,thresholdMs:w}),o.push(T)),(E=n?.loggerProvider)==null||E.log(`${t} has been successfully added.`),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,s;return a(this,function(a){try{for(e=i(o),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}}},Qo=`@amplitude/plugin-network-capture-browser`;o();var $o=`500-599`;function es(e,t){var n=`^`+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,`\\$&`).replace(/\*/g,`.*`)+`$`;return new RegExp(n).test(e)}function ts(e,t){var n,a,o=t.split(`,`);try{for(var s=i(o),c=s.next();!c.done;c=s.next()){var l=c.value,u=r(l.split(`-`).map(Number),2),d=u[0],f=u[1];if(e===d&&f===void 0||e>=d&&e<=f)return!0}}catch(e){n={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return!1}function ns(e,t,n,r,i){if(!(e.hosts&&!e.hosts.find(function(e){return es(t,e)}))&&!(r&&e.urls&&!mt(r,e.urls))&&!(i&&e.methods&&!e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||e===`*`})))return!((n||n===0)&&!ts(n,e.statusCodeRange||$o))}function rs(e){if(e)try{var t=p()?.location.href,n=new URL(e,t),r=n.searchParams.toString(),i=n.hash.replace(`#`,``),a=n.href,o=n.host;return n.hash=``,n.search=``,{query:r,fragment:i,href:a,hrefWithoutQueryOrHash:n.href,host:o}}catch{return}}function is(e,t){if(e.includes(`amplitude.com`))try{var n=t.body;if(typeof n!=`string`)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===`[Amplitude] Network Request`}))return!0}catch{}return!1}function as(e){if(typeof e!=`object`||!e)return e?u([],r(L),!1):void 0;if(e.length!==0)return e}function os(e){return!e?.allowlist?.length&&!e?.blocklist?.length}function ss(e,t){t===void 0&&(t={});var n=rs(e.url);if(!n)return!1;var i=n.host;if(t.ignoreAmplitudeRequests!==!1&&(es(i,`*.amplitude.com`)||es(i,`amplitude.com`))||t.ignoreHosts?.find(function(e){return es(i,e)})||!t.captureRules&&e.status!==void 0&&!ts(e.status,$o))return!1;if(t.captureRules){var a;if(u([],r(t.captureRules),!1).reverse().find(function(t){if(a=ns(t,i,e.status,e.url,e.method),a){var n=as(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var o=as(t.requestHeaders);if(e.requestWrapper&&o){var s=e.requestWrapper.headers(o);s&&(e.requestHeaders=s)}e.responseWrapper&&t.responseBody&&!os(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!os(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return a!==void 0}),!a)return!1}return!(e.requestWrapper&&is(i,e.requestWrapper))}function cs(e,t,n,i){return s(this,void 0,void 0,function(){var o,s,c;return a(this,function(a){switch(a.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(o=r.apply(void 0,[a.sent(),2]),s=o[0],c=o[1],s)try{e[`[Amplitude] Request Body`]=JSON.stringify(s)}catch(e){i?.debug(`Failed to stringify request body`,e)}if(c)try{e[`[Amplitude] Response Body`]=JSON.stringify(c)}catch{i?.debug(`Failed to stringify response body`)}a.label=2;case 2:return n?.track(`[Amplitude] Network Request`,e),[2]}})})}function ls(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return ss(e.event,n)}).subscribe(function(e){var t,n=e.event,a=rs(n.url);if(a){var o=n.responseWrapper?.bodySize,s=n.requestWrapper?.bodySize;cs((t={},t[`[Amplitude] URL`]=a.hrefWithoutQueryOrHash,t[`[Amplitude] URL Query`]=a.query,t[`[Amplitude] URL Fragment`]=a.fragment,t[`[Amplitude] Request Method`]=n.method,t[`[Amplitude] Status Code`]=n.status,t[`[Amplitude] Start Time`]=n.startTime,t[`[Amplitude] Completion Time`]=n.endTime,t[`[Amplitude] Duration`]=n.duration,t[`[Amplitude] Request Body Size`]=s,t[`[Amplitude] Response Body Size`]=o,t[`[Amplitude] Request Type`]=n.type,t[`[Amplitude] Request Headers`]=n.requestHeaders,t[`[Amplitude] Response Headers`]=n.responseHeaders,t),n,r,i)}})}o();var us;(function(e){e.NetworkObservable=`networkObservable`})(us||={});var ds,fs=function(e){e===void 0&&(e={});var t=Qo,n=`enrichment`,r,i=function(e,t){return{event:e,timestamp:Date.now(),type:t}},o=function(){var e,t=new G.default(function(e){var t=new In(function(t){var n=i(t,`network`);e.next(n)});return Rn.subscribe(t,r),function(){Rn.unsubscribe(t)}});return e={},e[us.NetworkObservable]=t,e};return{name:t,type:n,setup:function(n,i){return s(void 0,void 0,void 0,function(){var s;return a(this,function(a){return typeof document>`u`?[2]:(s=o(),r=n?.loggerProvider,ds=ls({allObservables:s,networkTrackingOptions:e,amplitude:i,loggerProvider:r}),r?.log(`${t} has been successfully added.`),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(e){return ds.unsubscribe(),[2]})})}}},ps=`web-vitals-browser`,ms=`[Amplitude] Web Vitals`,hs=-1,gs=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(hs=t.timeStamp,e(t))}),!0)},_s=(e,t,n,r)=>{let i,a;return o=>{t.value>=0&&(o||r)&&(a=t.value-(i??0),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},vs=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},ys=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},bs=()=>ys()?.activationStart??0,xs=(e,t=-1)=>{let n=ys(),r=`navigate`;return hs>=0?r=`back-forward-cache`:n&&(document.prerendering||bs()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},Ss=new WeakMap;function Cs(e,t){return Ss.get(e)||Ss.set(e,new t),Ss.get(e)}var ws=class{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)}},Ts=(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{}},Es=e=>{let t=!1;return()=>{t||=(e(),!0)}},Ds=-1,Os=new Set,ks=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,As=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of Os)e();isFinite(Ds)||(Ds=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,As,!0))}},js=()=>
12{if(Ds<0){let e=bs();Ds=(document.prerendering?void 0:globalThis.performance.getEntriesByType(`visibility-state`).filter((t=>t.name===`hidden`&&t.startTime>e))[0]?.startTime)??ks(),addEventListener(`visibilitychange`,As,!0),addEventListener(`prerenderingchange`,As,!0),gs((()=>{setTimeout((()=>{Ds=ks()}))}))}return{get firstHiddenTime(){return Ds},onHidden(e){Os.add(e)}}},Ms=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},Ns=[1800,3e3],Ps=(e,t={})=>{Ms((()=>{let n=js(),r,i=xs(`FCP`),a=Ts(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-bs(),0),i.entries.push(t),r(!0)))}));a&&(r=_s(e,i,Ns,t.reportAllChanges),gs((n=>{i=xs(`FCP`),r=_s(e,i,Ns,t.reportAllChanges),vs((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},Fs=[.1,.25],Is=(e,t={})=>{let n=js();Ps(Es((()=>{let r,i=xs(`CLS`,0),a=Cs(t,ws),o=e=>{for(let t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,r())},s=Ts(`layout-shift`,o);s&&(r=_s(e,i,Fs,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),gs((()=>{a.i=0,i=xs(`CLS`,0),r=_s(e,i,Fs,t.reportAllChanges),vs((()=>r()))})),setTimeout(r))})))},Ls=0,Rs=1/0,zs=0,Bs=e=>{for(let t of e)t.interactionId&&(Rs=Math.min(Rs,t.interactionId),zs=Math.max(zs,t.interactionId),Ls=zs?(zs-Rs)/7+1:0)},Vs,Hs=()=>Vs?Ls:performance.interactionCount??0,Us=()=>{`interactionCount`in performance||Vs||(Vs=Ts(`event`,Bs,{type:`event`,buffered:!0,durationThreshold:0}))},Ws=0,Gs=class{u=[];l=new Map;m;p;v(){Ws=Hs(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Hs()-Ws)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!==`first-input`)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)=>t.P-e.P)),this.u.length>10){let e=this.u.splice(10);for(let t of e)this.l.delete(t.id)}this.p?.(n)}}},Ks=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=Es(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},qs=[200,500],Js=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=js();Ms((()=>{Us();let r,i=xs(`INP`),a=Cs(t,Gs),o=e=>{Ks((()=>{for(let t of e)a.h(t);let t=a.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,r())}))},s=Ts(`event`,o,{durationThreshold:t.durationThreshold??40});r=_s(e,i,qs,t.reportAllChanges),s&&(s.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),gs((()=>{a.v(),i=xs(`INP`),r=_s(e,i,qs,t.reportAllChanges)})))}))},Ys=class{m;h(e){this.m?.(e)}},Xs=[2500,4e3],Zs=(e,t={})=>{Ms((()=>{let n=js(),r,i=xs(`LCP`),a=Cs(t,Ys),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-bs(),0),i.entries=[t],r())},s=Ts(`largest-contentful-paint`,o);if(s){r=_s(e,i,Xs,t.reportAllChanges);let n=Es((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(Ks(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});gs((n=>{i=xs(`LCP`),r=_s(e,i,Xs,t.reportAllChanges),vs((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))},Qs=[800,1800],$s=e=>{document.prerendering?Ms((()=>$s(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>$s(e)),!0)},ec=(e,t={})=>{let n=xs(`TTFB`),r=_s(e,n,Qs,t.reportAllChanges);$s((()=>{let i=ys();i&&(n.value=Math.max(i.responseStart-bs(),0),n.entries=[i],r(!0),gs((()=>{n=xs(`TTFB`,0),r=_s(e,n,Qs,t.reportAllChanges),r(!0)})))}))};o();function tc(e){var t=e.entries[0]?.startTime||0;return performance.timeOrigin+t}function nc(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(tc(e)),navigationStart:Math.floor(performance.timeOrigin)}}var rc=function(){var e=null,t=p(),n=t?.document,r=t?.location;return{name:ps,type:`enrichment`,setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,s;return a(this,function(a){return n===void 0?[2]:(o=ht(r?.href||``,t.loggerProvider),s={"[Amplitude] Page Domain":r?.hostname||``,"[Amplitude] Page Location":o,"[Amplitude] Page Path":ht(r?.pathname||``,t.loggerProvider),"[Amplitude] Page Title":typeof document<`u`&&document.title||``,"[Amplitude] Page URL":ht(o.split(`?`)[0],t.loggerProvider)},Zs(function(e){s[`[Amplitude] LCP`]=nc(e)}),Ps(function(e){s[`[Amplitude] FCP`]=nc(e)}),Js(function(e){s[`[Amplitude] INP`]=nc(e)}),Is(function(e){s[`[Amplitude] CLS`]=nc(e)}),ec(function(e){s[`[Amplitude] TTFB`]=nc(e)}),e=function(){n.visibilityState===`hidden`&&e&&(i.track(ms,s),n.removeEventListener(`visibilitychange`,e),e=null)},n.addEventListener(`visibilitychange`,e),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(t){return e&&n?.removeEventListener(`visibilitychange`,e),[2]})})}}};o();var ic=function(){function e(e,t){this.shouldTrackNewCampaign=!1,this.options=d({initialEmptyValue:`EMPTY`,resetSessionOnNewCampaign:!1,excludeReferrers:gi(t.cookieOptions?.domain||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Et(t.apiKey,`MKTG`),this.webExpStorageKey=Et(t.apiKey,`MKTG_ORIGINAL`),this.currentCampaign=I,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 s(this,void 0,void 0,function(){var e,t;return a(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];
12case 1:return t=r.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=this.lastEventTime?ct(this.sessionTimeout,this.lastEventTime):!0,fi(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return e=t.sent(),e?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new zn().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t=hi(this.currentCampaign,this.options);return e&&(t.event_id=e),t},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}();o();var ac=`AMP_CURRENT_PAGE`,oc=`AMP_PREVIOUS_PAGE`,sc=`AMP_URL_INFO`,cc;(function(e){e.Direct=`direct`,e.Internal=`internal`,e.External=`external`})(cc||={});var lc=new Set([h.IDENTIFY,h.GROUP_IDENTIFY,h.REVENUE]),uc=function(e){var t=(e===void 0?{}:e).internalDomains,n=t===void 0?[]:t,i=p(),o=void 0,c=!1,l=void 0,u=!1,f=!1,m=function(e){var t;try{var n=ht(e,l);t=new URL(n).hostname}catch(e){l?.error(`Could not parse URL: `,e)}return t},h=function(e){var t=typeof location<`u`&&location.hostname||``,r=e?m(e):void 0;if(!r)return cc.Direct;var i=n.some(function(e){return t.indexOf(e)!==-1}),a=n.some(function(e){return r.indexOf(e)!==-1});return t===r||a&&i?cc.Internal:cc.External},g=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,i;return a(this,function(a){switch(a.label){case 0:return o&&c?[4,o.get(sc)]:[3,3];case 1:return e=a.sent(),t=ht(typeof location<`u`&&location.href||``),n=e?.AMP_CURRENT_PAGE||``,r=void 0,r=t===n?e?.AMP_PREVIOUS_PAGE||``:n||document.referrer||``,[4,o.set(sc,(i={},i[ac]=t,i[oc]=r,i))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},_=function(){g()};return{name:`@amplitude/plugin-page-url-enrichment-browser`,type:`enrichment`,setup:function(e,t){return s(void 0,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:if(l=e.loggerProvider,l.log(`Installing @amplitude/plugin-page-url-enrichment-browser`),f=!0,!i)return[3,2];try{o=new Dt(i.sessionStorage)}catch{l?.debug(`sessionStorage is not available in this environment.`)}return[4,o?.isEnabled()];case 1:c=t.sent()??!1,i.addEventListener(`popstate`,_),u||=(i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var i=r(n,3),a=i[0],o=i[1],s=i[2];e.apply(t,[a,o,s]),f&&_()}}),i.history.replaceState=new Proxy(i.history.replaceState,{apply:function(e,t,n){var i=r(n,3),a=i[0],o=i[1],s=i[2];e.apply(t,[a,o,s]),f&&_()}}),!0),t.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r,i,s;return a(this,function(a){switch(a.label){case 0:return t=ht(typeof location<`u`&&location.href||``),o&&c?[4,o.get(sc)]:[3,5];case 1:return n=a.sent(),n?.AMP_CURRENT_PAGE?[3,3]:[4,o.set(sc,(s={},s[ac]=t,s[oc]=document.referrer||``,s))];case 2:a.sent(),a.label=3;case 3:return[4,o.get(sc)];case 4:if(r=a.sent(),i=``,r&&(i=r.AMP_PREVIOUS_PAGE||``),lc.has(e.event_type))return[2,e];e.event_properties=d(d({},e.event_properties||{}),{"[Amplitude] Page Domain":dc(e,`[Amplitude] Page Domain`,typeof location<`u`&&location.hostname||``),"[Amplitude] Page Location":dc(e,`[Amplitude] Page Location`,t),"[Amplitude] Page Path":dc(e,`[Amplitude] Page Path`,typeof location<`u`&&ht(location.pathname)||``),"[Amplitude] Page Title":dc(e,`[Amplitude] Page Title`,Kn(Gn)),"[Amplitude] Page URL":dc(e,`[Amplitude] Page URL`,t.split(`?`)[0]),"[Amplitude] Previous Page Location":i,"[Amplitude] Previous Page Type":h(i)}),a.label=5;case 5:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return i&&(i.removeEventListener(`popstate`,_),f=!1),o&&
12c?[4,o.set(sc,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function dc(e,t,n){return e.event_properties||={},e.event_properties[t]===void 0?n:e.event_properties[t]}o();var fc=function(){var e,t,n;function r(e){return typeof e!=`object`||!e?!1:`body`in e&&typeof e.body==`string`}function i(t){if(t)try{var n=Function(`return `+t)();if(typeof n==`function`)return n;e?.error(`Custom enrichment body did not evaluate to a function`)}catch(t){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(o,c){return s(void 0,void 0,void 0,function(){var s;return a(this,function(a){return e=o.loggerProvider,e?.log(`Installing @amplitude/plugin-custom-enrichment-browser`),o.remoteConfig?.fetchRemoteConfig&&(o.remoteConfigClient?(s=o.remoteConfigClient.subscribe(`configs.analyticsSDK.browserSDK.customEnrichment`,`all`,function(e){n=e&&r(e)?i(e.body||``):i(``)}),t=function(){return o.remoteConfigClient?.unsubscribe(s)}):e?.debug(`Remote config client is not provided, skipping remote config fetch`)),[2]})})},execute:function(t){return s(void 0,void 0,void 0,function(){return a(this,function(r){if(n)try{return[2,n(t)??null]}catch(n){return e?.error(`Could not execute custom enrichment function`,n),[2,t]}return[2,t]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return a(this,function(e){return t&&t(),[2]})})}}};o();var pc=-1,mc=function(e){l(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t._enableRequestBodyCompressionExperimentalValue=!1,t}return t.prototype.init=function(e,t,n){e===void 0&&(e=``);var r,i;return arguments.length>2?(r=t,i=n):typeof t==`string`?(r=t,i=void 0):(r=t?.userId,i=t),we(this._init(d(d({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){return s(this,void 0,void 0,function(){var n,r,i,o,l,u,d,f,p,m,h,g,_,v,y,b=this;return a(this,function(x){switch(x.label){case 0:return this.initializing?[2]:(this.initializing=!0,n=Ti(t),r=t.loggerProvider??new je,t.loggerProvider||r.enable(t.logLevel??ke.Warn),i=t.serverZone??`US`,l=this._diagnosticsSampleRate,u=t.enableDiagnostics??!0,n?(o=new Qt(t.apiKey,r,i,t.remoteConfig?.serverUrl),[4,new Promise(function(e){o?.subscribe(`configs.diagnostics.browserSDK`,`all`,function(t,n,i){if(r.debug(`Diagnostics remote configuration received:`,JSON.stringify({remoteConfig:t,source:n,lastFetch:i},null,2)),t){var a=t.sampleRate;typeof a==`number`&&!isNaN(a)&&(l=a);var o=t.enabled;typeof o==`boolean`&&(u=o)}e()})})]):[3,2]);case 1:x.sent(),x.label=2;case 2:return d=new Ut(t.apiKey,r,i,{enabled:u,sampleRate:l}),d.setTag(`library`,`${Fr}/${Pr}`),typeof navigator<`u`&&d.setTag(`user_agent`,navigator.userAgent),[4,Ci(t.apiKey,t,this,d,{loggerProvider:r,serverZone:i,enableDiagnostics:u,diagnosticsSampleRate:l})];case 3:return f=x.sent(),n&&o?[4,new Promise(function(e){o?.subscribe(`configs.analyticsSDK.browserSDK`,`all`,function(t,n,r){f.loggerProvider.debug(`Remote configuration received:`,JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&Wi(t,f),e()})})]:[3,5];case 4:x.sent(),x.label=5;case 5:return[4,e.prototype._init.call(this,f)];case 6:return x.sent(),this.logBrowserOptions(f),this.config.remoteConfigClient=o,hr(this.config.defaultTracking)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(b,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return e?[3,2]:(t=Ar(this.config),this.webAttribution=new ic(t,this.config),[4,this.webAttribution.init()]);case 1:n.sent(),n.label=2;case 2:return[2]}})})}),p=Ar(this.config),this.webAttribution=new ic(p,this.config),[4,this.webAttribution.init()]):[3,8];case 7:x.sent(),x.label=8;case 8:return m=ft(),h=m.ampTimestamp?Number(m.ampTimestamp):void 0,g=h?Date.now()<h:!0,_=g&&!Number.isNaN(Number(m.ampSessionId))?Number(m.ampSessionId):void 0,v=this.config.deferredSessionId,v===pc&&!this.config.optOut&&(v=Date.now()),this.setSessionId(t.sessionId??_??v??this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(b,void 0,void 0,function(){return a(this,function(t){return!e&&this.config.deferredSessionId&&(this.config.deferredSessionId===pc?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),y=it(t.instanceName),y.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===null?[3,10]:[4,this.add(Vi()).promise];case 9:x.sent(),x.label=10;case 10:return[4,this.add(new We({diagnosticsClient:d})).promise];case 11:return x.sent(),[4,this.add(new Rr).promise];case 12:return x.sent(),[4,this.add(new st).promise];case 13:return x.sent(),Bi(this.config),gr(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding file download tracking plugin`),[4,this.add(Ri()).promise]):[3,15];case 14:x.sent(),x.label=15;case 15:return _r(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding form interaction plugin`),[4,this.add(Fi()).promise]):[3,17];case 16:x.sent(),x.label=17;case 17:return vr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(ji(kr(this.config))).promise]):[3,20];case 18:return x.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return s(b,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(ji(kr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),x.label=20;case 20:return Sr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding user interactions plugin (autocapture plugin)`),[4,this.add(So(Er(this.config),{diagnosticsClient:d})).promise]):[3,22];case 21:x.sent(),x.label=22;case 22:return wr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding frustration interactions plugin`),[4,this.add(Zo(Dr(this.config))).promise]):[3,24];case 23:x.sent(),x.label=24;case 24:return xr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding network tracking plugin`),[4,this.add(fs(Or(this.config))).promise]):[3,26];
12case 25:x.sent(),x.label=26;case 26:return Cr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding web vitals plugin`),[4,this.add(rc()).promise]):[3,28];case 27:x.sent(),x.label=28;case 28:return br(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding referrer page url plugin`),[4,this.add(uc()).promise]):[3,30];case 29:x.sent(),x.label=30;case 30:return Tr(this.config.customEnrichment)?(this.config.loggerProvider.debug(`Adding custom enrichment plugin`),[4,this.add(fc()).promise]):[3,32];case 31:x.sent(),x.label=32;case 32:return this.initializing=!1,[4,this.runQueuedFunctions(`dispatchQ`)];case 33:return x.sent(),y.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=c(t,[`time`]),i=typeof n==`number`?{time:n}:void 0;b.track(e.eventType,r,i)}),[2]}})})},t.prototype.getUserId=function(){return this.config?.userId},t.prototype.setUserId=function(e){if(!this.config){this.q.push(this.setUserId.bind(this,e));return}this.config.loggerProvider.debug(`function setUserId: `,e),(e!==this.config.userId||e===void 0)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),at(e,this.config.instanceName))},t.prototype.getDeviceId=function(){return this.config?.deviceId},t.prototype.setDeviceId=function(e){if(!this.config){this.q.push(this.setDeviceId.bind(this,e));return}this.config.loggerProvider.debug(`function setDeviceId: `,e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),ot(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(_e()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){return{deviceId:this.config?.deviceId,userId:this.config?.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n;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 a=new oe,o=e.userProperties??{};try{for(var s=i(Object.entries(o)),c=s.next();!c.done;c=s.next()){var l=r(c.value,2),u=l[0],d=l[1];a.set(u,d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}this.identify(a)}},t.prototype.getOptOut=function(){return this.config?.optOut},t.prototype.getSessionId=function(){return this.config?.sessionId},t.prototype.setSessionId=function(e){var t=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),we(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=e??pc,we(Promise.resolve());if(e===void 0&&(e=Date.now()),e===this.config.sessionId)return we(Promise.resolve());this.config.loggerProvider.debug(`function setSessionId: `,e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var r=this.config.lastEventTime,i=this.config.lastEventId??-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,yr(this.config.defaultTracking)&&(n&&r&&t.push(this.track($r,void 0,{device_id:this.previousSessionDeviceId,event_id:++i,session_id:n,time:r+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++i,t);return this.config.identify&&t.push(this.track(be(this.config.identify)).promise),yr(this.config.defaultTracking)&&t.push(this.track(Qr,void 0,{event_id:a?++i:i,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,we(Promise.all(t))},t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(e){if(!this.config){this.q.push(this.setTransport.bind(this,e));return}this.config.transportProvider=Ei(e)},t.prototype.identify=function(t,n){if(Nr(t)){var r=t._q;t._q=[],t=Mr(new oe,r)}return n?.user_id&&this.setUserId(n.user_id),n?.device_id&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(Nr(r)){var a=r._q;r._q=[],r=Mr(new oe,a)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(Nr(t)){var r=t._q;t._q=[],t=Mr(new Ee,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);
12return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log(`Tracking attribution.`),!0},t.prototype.process=function(t){return s(this,void 0,void 0,function(){var n,r,i;return a(this,function(a){return n=Date.now(),r=ct(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==`session_start`&&t.event_type!==`session_end`&&(!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=d(d({},e),{apiKey:e.apiKey.substring(0,10)+`********`});this.config.loggerProvider.debug(`Initialized Amplitude with BrowserConfig:`,$n(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.prototype._enableRequestBodyCompressionExperimental=function(e){if(!this.config){this._enableRequestBodyCompressionExperimentalValue=e;return}},t}(Te),hc=`[Amplitude]`,gc=`${hc} Session Replay ID`,_c=ln.US,vc={enabled:!0},yc=1e3,bc=`${hc} Session Replay Debug`,xc=`amp-block`,Sc=`amp-mask`,Cc=`https://api-sr.amplitude.com/sessions/v2/track`,wc=`https://api-sr.eu.amplitude.com/sessions/v2/track`,Tc=`https://api-sr.stag2.amplitude.com/sessions/v2/track`,Ec=1*1e6,Dc=3e4,Oc=6e4,kc=10*1e3,Ac=1024,jc=1e3,Mc;(function(e){e.GET_SR_PROPS=`get-sr-props`,e.DEBUG_INFO=`debug-info`,e.FETCH_REQUEST=`fetch-request`,e.METADATA=`metadata`,e.TARGETING_DECISION=`targeting-decision`})(Mc||={});var Nc=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=this.logger[e];return typeof t==`function`?(t.__rrweb_original__??t).bind(this.logger):(function(){})},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),Pc=`medium`;function Fc(e){return e.toLowerCase()}function Ic(e){var t=e.type;return e.hasAttribute(`data-rr-is-password`)?`password`:t?Fc(t):null}o();var Lc=function(e,t,n){switch(t){case`light`:if(e!==`input`)return!0;var r=n?Ic(n):``;return r?!!([`password`,`hidden`,`email`,`tel`].includes(r)||n.autocomplete.startsWith(`cc-`)):!1;case`medium`:case`conservative`:return!0;default:return Lc(e,Pc,n)}},Rc=function(e,t,n){if(t===void 0&&(t={defaultMaskLevel:Pc}),n){if(n.closest(`.amp-mask`)||(t.maskSelector??[]).some(function(e){return n.closest(e)}))return!0;if(n.closest(`.amp-unmask`)||(t.unmaskSelector??[]).some(function(e){return n.closest(e)}))return!1}return Lc(e,t.defaultMaskLevel??Pc,n)},zc=function(e,t){return function(n,r){return Rc(e,t,r)?n.replace(/[^\s]/g,`*`):n}},Bc=function(e){return function(t,n,r){return t===`style`||!(e?.maskAttributes??[]).includes(t)?n:Rc(`text`,e,r)?n.replace(/[^\s]/g,`*`):n}},Vc=function(){var e=p();return e?.location?e.location.href:``},Hc=function(e,t){return`${t}/${e}`},Uc=function(e,t){return t||(e===ln.STAGING?Tc:e===ln.EU?wc:Cc)},Wc=function(e){return!(typeof e!=`string`||e.trim()===``||!/^\/|^https?:\/\/[^\s]+$/.test(e))},Gc=function(e){var t=e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`);return RegExp(`^${t}\$`)},Kc=function(e){if(!e.every(function(e){return typeof e.selector==`string`&&typeof e.replacement==`string`}))throw Error(`ugcFilterRules must be an array of objects with selector and replacement properties`);if(!e.every(function(e){return Wc(e.selector)}))throw Error(`ugcFilterRules must be an array of objects with valid globs`)},qc=function(e,t){var n,r;try{for(var a=i(t),o=a.next();!o.done;o=a.next()){var s=o.value,c=Gc(s.selector);if(c.test(e))return e.replace(c,s.replacement)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return e},Jc=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),e=p(),e?[4,e.navigator.storage.estimate()]:[3,2];case 1:return t=a.sent(),n=t.usage,r=t.quota,i=t.usageDetails,o=n?Math.round(n/Ac):0,s=n&&r?Math.round((n/r+2**-52)*1e3)/1e3:0,[2,{totalStorageSize:o,percentOfQuota:s,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return a.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:``}]}})})},Yc=function(e){var t=d({},e),n=t.apiKey;return t.apiKey=`****${n.substring(n.length-4)}`,t};o();var Xc=function(){return{flushMaxRetries:2,logLevel:ke.Warn,loggerProvider:new je,transportProvider:new Gt}},Zc=function(e){l(t,e);function t(t,n){var r=this,i=Xc();if(r=e.call(this,d(d({transportProvider:i.transportProvider,loggerProvider:new Nc(n.loggerProvider||i.loggerProvider)},n),{apiKey:t}))||this,r.flushMaxRetries=n.flushMaxRetries!==void 0&&n.flushMaxRetries<=i.flushMaxRetries?n.flushMaxRetries:i.flushMaxRetries,r.apiKey=t,r.sampleRate=n.sampleRate||0,r.serverZone=n.serverZone||_c,r.configServerUrl=n.configServerUrl,r.trackServerUrl=n.trackServerUrl,r.shouldInlineStylesheet=n.shouldInlineStylesheet,r.version=n.version,r.performanceConfig=n.performanceConfig||vc,r.storeType=n.storeType??`idb`,r.applyBackgroun
vendor: 5,210 bytes, line 12
12dColorToBlockedElements=n.applyBackgroundColorToBlockedElements??!1,r.enableUrlChangePolling=n.enableUrlChangePolling??!1,r.urlChangePollingInterval=n.urlChangePollingInterval??yc,r.captureDocumentTitle=n.captureDocumentTitle??!1,n.privacyConfig&&(r.privacyConfig=n.privacyConfig),n.interactionConfig&&(r.interactionConfig=n.interactionConfig,r.interactionConfig.ugcFilterRules&&Kc(r.interactionConfig.ugcFilterRules)),n.debugMode&&(r.debugMode=n.debugMode),n.useWebWorker!==void 0)r.useWebWorker=n.useWebWorker;else{var a=n;a.experimental?.useWebWorker!==void 0&&(r.useWebWorker=a.experimental.useWebWorker)}return n.omitElementTags&&(r.omitElementTags=n.omitElementTags),r}return t}(Ne),Qc=(e=>(e[e.DomContentLoaded=0]=`DomContentLoaded`,e[e.Load=1]=`Load`,e[e.FullSnapshot=2]=`FullSnapshot`,e[e.IncrementalSnapshot=3]=`IncrementalSnapshot`,e[e.Meta=4]=`Meta`,e[e.Custom=5]=`Custom`,e[e.Plugin=6]=`Plugin`,e))(Qc||{}),$c=(e=>(e[e.MouseUp=0]=`MouseUp`,e[e.MouseDown=1]=`MouseDown`,e[e.Click=2]=`Click`,e[e.ContextMenu=3]=`ContextMenu`,e[e.DblClick=4]=`DblClick`,e[e.Focus=5]=`Focus`,e[e.Blur=6]=`Blur`,e[e.TouchStart=7]=`TouchStart`,e[e.TouchMove_Departed=8]=`TouchMove_Departed`,e[e.TouchEnd=9]=`TouchEnd`,e[e.TouchCancel=10]=`TouchCancel`,e))($c||{});o();var el=function(e,t){var n=document.createDocumentFragment(),r=function(e){if(e===void 0&&(e=[]),typeof e==`string`&&(e=[e]),e=e.filter(function(e){try{n.querySelector(e)}catch{return t.warn(`[session-replay-browser] omitting selector "${e}" because it is invalid`),!1}return!0}),e.length!==0)return e};return e.blockSelector=r(e.blockSelector),e.maskSelector=r(e.maskSelector),e.unmaskSelector=r(e.unmaskSelector),e},tl=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){return s(this,void 0,void 0,function(){var e,t,n,o,s,c,l,f,p,m,h,g,_,v,y,b,x,S=this;return a(this,function(a){switch(a.label){case 0:e=d({},this.localConfig),e.optOut=this.localConfig.optOut,e.captureEnabled=!0,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,new Promise(function(n,r){S.remoteConfigClient.subscribe(`configs.sessionReplay`,`all`,function(i,a){if(S.localConfig.loggerProvider.debug(`Session Replay remote configuration received from ${a}:`,JSON.stringify(i,null,2)),!i){r(Error(`No remote config received`));return}var o=i,s=o.sr_sampling_config,c=o.sr_privacy_config,l=o.sr_targeting_config,u=e.interactionConfig?.ugcFilterRules;e.interactionConfig=o.sr_interaction_config,e.interactionConfig&&u&&(e.interactionConfig.ugcFilterRules=u),e.loggingConfig=o.sr_logging_config,(s||c||l)&&(t={},s&&(t.sr_sampling_config=s),c&&(t.sr_privacy_config=c),l&&(t.sr_targeting_config=l)),n()})})];case 2:return a.sent(),[3,4];case 3:return n=a.sent(),this.localConfig.loggerProvider.error(`Failed to generate joined config: `,n),e.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:e,remoteConfig:void 0}];case 4:if(!t)return[2,{localConfig:this.localConfig,joinedConfig:e,remoteConfig:t}];if(o=t.sr_sampling_config,s=t.sr_privacy_config,c=t.sr_targeting_config,o&&Object.keys(o).length>0?(Object.prototype.hasOwnProperty.call(o,`capture_enabled`)?e.captureEnabled=o.capture_enabled:e.captureEnabled=!1,Object.prototype.hasOwnProperty.call(o,`sample_rate`)&&(e.sampleRate=o.sample_rate)):(e.captureEnabled=!0,this.localConfig.loggerProvider.debug(`Remote config successfully fetched, but no values set for project, Session Replay capture enabled.`)),s){l=e.privacyConfig??{},f={defaultMaskLevel:s.defaultMaskLevel??l.defaultMaskLevel??`medium`,blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:u([],r(new Set(u(u([],r(l.maskAttributes??[]),!1),r(s.maskAttributes??[]),!1))),!1)},p=function(e){var t,n,r,a,o,s,c={};typeof e.blockSelector==`string`&&(e.blockSelector=[e.blockSelector]);try{for(var l=i(e.blockSelector??[]),u=l.next();!u.done;u=l.next()){var d=u.value;c[d]=`block`}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}try{for(var f=i(e.maskSelector??[]),p=f.next();!p.done;p=f.next()){var d=p.value;c[d]=`mask`}}catch(e){r={error:e}}finally{try{p&&!p.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}try{for(var m=i(e.unmaskSelector??[]),h=m.next();!h.done;h=m.next()){var d=h.value;c[d]=`unmask`}}catch(e){o={error:e}}finally{try{h&&!h.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}return c},m=d(d({},p(l)),p(s));try{for(h=i(Object.entries(m)),g=h.next();!g.done;g=h.next())_=r(g.value,2),v=_[0],y=_[1],y===`mask`?f.maskSelector.push(v):y===`block`?f.blockSelector.push(v):y===`unmask`&&f.unmaskSelector.push(v)}catch(e){b={error:e}}finally{try{g&&!g.done&&(x=h.return)&&x.call(h)}finally{if(b)throw b.error}}e.privacyConfig=el(f,this.localConfig.loggerProvider)}return c&&Object.keys(c).length>0&&(e.targetingConfig=c),this.localConfig.loggerProvider.debug(JSON.stringify({name:`session replay joined config`,config:Yc(e)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:e,remoteConfig:t}]}})})},e}(),nl=function(e,t){return s(void 0,void 0,void 0,function(){var n,r;return a(this,function(i){return n=new Zc(e,t),r=new Qt(e,n.loggerProvider,n.serverZone,t.configServerUrl),[2,new tl(r,
vendor: 4,862 bytes, line 12
12n)]})})},rl=Uint8Array,il=Uint16Array,al=Uint32Array,ol=new rl([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sl=new rl([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),cl=new rl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ll=function(e,t){for(var n=new il(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new al(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},ul=ll(ol,2),dl=ul[0],fl=ul[1];dl[28]=258,fl[258]=28;var pl=ll(sl,0);pl[0];for(var ml=pl[1],hl=new il(32768),K=0;K<32768;++K){var gl=(K&43690)>>>1|(K&21845)<<1;gl=(gl&52428)>>>2|(gl&13107)<<2,gl=(gl&61680)>>>4|(gl&3855)<<4,hl[K]=((gl&65280)>>>8|(gl&255)<<8)>>>1}for(var _l=(function(e,t,n){for(var r=e.length,i=0,a=new il(t);i<r;++i)++a[e[i]-1];var o=new il(t);for(i=0;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new il(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[hl[d]>>>c]=l}else for(s=new il(r),i=0;i<r;++i)s[i]=hl[o[e[i]-1]++]>>>15-e[i];return s}),vl=new rl(288),K=0;K<144;++K)vl[K]=8;for(var K=144;K<256;++K)vl[K]=9;for(var K=256;K<280;++K)vl[K]=7;for(var K=280;K<288;++K)vl[K]=8;for(var yl=new rl(32),K=0;K<32;++K)yl[K]=5;var bl=_l(vl,9,0),xl=_l(yl,5,0),Sl=function(e){return(e/8>>0)+(e&7&&1)},Cl=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof il?il:e instanceof al?al:rl)(n-t);return r.set(e.subarray(t,n)),r},wl=function(e,t,n){n<<=t&7;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Tl=function(e,t,n){n<<=t&7;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},El=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new rl(0),0];if(i==1){var o=new rl(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new il(f+1),m=Dl(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return[new rl(p),m]},Dl=function(e,t,n){return e.s==-1?Math.max(Dl(e.l,t,n+1),Dl(e.r,t,n+1)):t[e.s]=n},Ol=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new il(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},kl=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Al=function(e,t,n){var r=n.length,i=Sl(t+2);e[i]=r&255,e[i+1]=r>>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},jl=function(e,t,n,r,i,a,o,s,c,l,u){wl(t,u++,n),++i[256];for(var d=El(i,15),f=d[0],p=d[1],m=El(a,15),h=m[0],g=m[1],_=Ol(f),v=_[0],y=_[1],b=Ol(h),x=b[0],S=b[1],C=new il(19),w=0;w<v.length;++w)C[v[w]&31]++;for(var w=0;w<x.length;++w)C[x[w]&31]++;for(var T=El(C,7),E=T[0],D=T[1],O=19;O>4&&!E[cl[O-1]];--O);var k=l+5<<3,A=kl(i,vl)+kl(a,yl)+o,j=kl(i,f)+kl(a,h)+o+14+3*O+kl(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(k<=A&&k<=j)return Al(t,u,e.subarray(c,c+l));var M,N,P,ee;if(wl(t,u,1+(j<A)),u+=2,j<A){M=_l(f,p,0),N=f,P=_l(h,g,0),ee=h;var te=_l(E,D,0);wl(t,u,y-257),wl(t,u+5,S-1),wl(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)wl(t,u+3*w,E[cl[w]]);u+=3*O;for(var F=[v,x],ne=0;ne<2;++ne)for(var I=F[ne],w=0;w<I.length;++w){var L=I[w]&31;wl(t,u,te[L]),u+=E[L],L>15&&(wl(t,u,I[w]>>>5&127),u+=I[w]>>>12)}}else M=bl,N=vl,P=xl,ee=yl;for(var w=0;w<s;++w)if(r[w]>255){var L=r[w]>>>18&31;Tl(t,u,M[L+257]),u+=N[L+257],L>7&&(wl(t,u,r[w]>>>23&31),u+=ol[L]);var R=r[w]&31;Tl(t,u,P[R]),u+=ee[R],R>3&&(Tl(t,u,r[w]>>>5&8191),u+=sl[R])}else Tl(t,u,M[r[w]]),u+=N[r[w]];return Tl(t,u,M[256]),u+N[256]},Ml=new al([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Nl=function(e,t,n,r,i,a){var o=e.length,s=new rl(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=Al(c,l,e.subarray(u,d)):(c[u]=a,l=Al(c,l,e.subarray(u,o)))}else{for(var f=Ml[t-1],p=f>>>13,m=f&8191,h=(1<<n)-1,g=new il(32768),_=new il(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new al(25e3),S=new il(288),C=new il(32),w=0,T=0,u=0,E=0,D=0,O=0;u<o;++u){var k=b(u),A=u&32767,j=_[k];if(g[A]=j,_[k]=A,D<=u){var M=o-u;if((w>7e3||E>24576)&&M>423){l=jl(e,c,0,x,S,C,T,E,O,u-O,l),E=w=T=0,O=u;for(var N=0;N<286;++N)S[N]=0;for(var N=0;N<30;++N)C[N]=0}var P=2,ee=0,te=m,F=A-j&32767;if(M>
vendor: 4,797 bytes, line 12
122&&k==b(u-F))for(var ne=Math.min(p,M)-1,I=Math.min(32767,u),L=Math.min(258,M);F<=I&&--te&&A!=j;){if(e[u+P]==e[u+P-F]){for(var R=0;R<L&&e[u+R]==e[u+R-F];++R);if(R>P){if(P=R,ee=F,R>ne)break;for(var re=Math.min(F,R-2),ie=0,N=0;N<re;++N){var ae=u-F+N+32768&32767,oe=ae-g[ae]+32768&32767;oe>ie&&(ie=oe,j=ae)}}}A=j,j=g[A],F+=A-j+32768&32767}if(ee){x[E++]=268435456|fl[P]<<18|ml[ee];var z=fl[P]&31,se=ml[ee]&31;T+=ol[z]+sl[se],++S[257+z],++C[se],D=u+P,++w}else x[E++]=e[u],++S[e[u]]}}l=jl(e,c,a,x,S,C,T,E,O,u-O,l)}return Cl(s,0,r+Sl(l)+i)},Pl=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length,o=0;o!=a;){for(var s=Math.min(o+5552,a);o<s;++o)r+=n[o],i+=r;r%=65521,i%=65521}e=r,t=i},d:function(){return(e>>>8<<16|(t&255)<<8|t>>>8)+((e&255)<<23)*2}}},Fl=function(e,t,n,r,i){return Nl(e,t.level==null?6:t.level,t.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):12+t.mem,n,r,!0)},Il=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Ll=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)};function Rl(e,t){t===void 0&&(t={});var n=Pl();n.p(e);var r=Fl(e,t,2,4);return Ll(r,t),Il(r,r.length-4,n.d()),r}function zl(e,t){var n=e.length;if(!t&&typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new rl(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new rl(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);c<128||t?a(c):c<2048?(a(192|c>>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++o)&1023,a(240|c>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|c&63)):(a(224|c>>>12),a(128|c>>>6&63),a(128|c&63))}return Cl(r,0,i)}function Bl(e,t){var n=``;if(!t&&typeof TextDecoder<`u`)return new TextDecoder().decode(e);for(var r=0;r<e.length;){var i=e[r++];i<128||t?n+=String.fromCharCode(i):i<224?n+=String.fromCharCode((i&31)<<6|e[r++]&63):i<240?n+=String.fromCharCode((i&15)<<12|(e[r++]&63)<<6|e[r++]&63):(i=((i&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,n+=String.fromCharCode(55296|i>>10,56320|i&1023))}return n}var Vl=e=>{let t={...e,v:`v1`};return Bl(Rl(zl(JSON.stringify(t))),!0)},Hl=2e3,Ul=function(){function e(e,t,n,r){var i=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=Vl(e);return JSON.stringify(t)},this.addCompressedEventToManager=function(e,t){i.eventsManager&&i.deviceId&&i.eventsManager.addEvent({event:{type:`replay`,data:e},sessionId:t,deviceId:i.deviceId})},this.addCompressedEvent=function(e,t){if(i.worker)try{i.worker.postMessage({event:e,sessionId:t})}catch(n){n.name===`DataCloneError`?i.worker.postMessage(JSON.stringify({event:e,sessionId:t})):i.config.loggerProvider.warn(`Unexpected error while posting message to worker:`,n)}else{var n=i.compressEvent(e);i.addCompressedEventToManager(n,t)}},this.terminate=function(){var e;(e=i.worker)==null||e.terminate()};var a=p();if(this.canUseIdleCallback=a&&`requestIdleCallback`in a,this.eventsManager=e,this.config=t,this.deviceId=n,this.timeout=t.performanceConfig?.timeout||Hl,r){t.loggerProvider.log(`Enabling web worker for compression`);try{var o=new Blob([r],{type:`application/javascript`}),s=URL.createObjectURL(o),c=new Worker(s);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error(`Worker failed, falling back to non-worker compression:`,e),c.terminate(),i.worker=void 0},c.onmessage=function(e){var t=e.data,n=t.compressedEvent,r=t.sessionId;i.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){this.canUseIdleCallback&&this.config.performanceConfig?.enabled?(this.config.loggerProvider.debug(`Enqueuing event for processing during idle time.`),this.taskQueue.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){for(var t=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var r=n.event,i=n.sessionId;this.addCompressedEvent(r,i)}}this.taskQueue.length>0?requestIdleCallback(function(e){t.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e}(),Wl=`Unexpected error occurred`,Gl=`Network error occurred, event batch rejected`,Kl=`Session replay event batch rejected due to exceeded retry count`,ql=`Failed to store session replay events in IndexedDB`,Jl=`Session replay event batch not sent due to missing device ID`,Yl=`Session replay event batch not sent due to missing api key`,Xl=`1.34.3`;o();
12var Zl=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher;this.storageKey=``,this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=n,this.payloadBatcher=r||function(e){return e},this.trackServerUrl=t}return e.prototype.sendEventsList=function(e){this.addToQueue(d(d({},e),{attempts:0,timeout:0}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter(function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:Kl}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;this.scheduled||=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e)},e.prototype.flush=function(e){return e===void 0&&(e=!1),s(this,void 0,void 0,function(){var t,n,r,o,s,c,l;return a(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&=(clearTimeout(this.scheduled),null),a.label=1;case 1:a.trys.push([1,6,7,8]),n=i(t),r=n.next(),a.label=2;case 2:return r.done?[3,5]:(o=r.value,[4,this.send(o,e)]);case 3:a.sent(),a.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),c={error:s},[3,8];case 7:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 8:return[2]}})})},e.prototype.send=function(e,t){return t===void 0&&(t=!0),s(this,void 0,void 0,function(){var n,r,i,o,s,c,l,u,d,f,p,m,h;return a(this,function(a){switch(a.label){case 0:if(n=e.apiKey,!n)return[2,this.completeRequest({context:e,err:Yl})];if(r=e.deviceId,!r)return[2,this.completeRequest({context:e,err:Jl})];if(i=Vc(),o=Xl,s=e.sampleRate,c=new URLSearchParams({device_id:r,session_id:`${e.sessionId}`,type:`${e.type}`}),l=`${e.version?.type||`standalone`}/${e.version?.version||o}`,u=this.payloadBatcher({version:1,events:e.events}),u.events.length===0)return this.completeRequest({context:e}),[2];a.label=1;case 1:return a.trys.push([1,6,,7]),d={headers:{"Content-Type":`application/json`,Accept:`*/*`,Authorization:`Bearer ${n}`,"X-Client-Version":o,"X-Client-Library":l,"X-Client-Url":i.substring(0,jc),"X-Client-Sample-Rate":`${s}`},body:JSON.stringify(u),method:`POST`},f=`${Uc(e.serverZone,this.trackServerUrl)}?${c.toString()}`,[4,fetch(f,d)];case 2:if(p=a.sent(),p===null)return this.completeRequest({context:e,err:Wl}),[2];if(t)return[3,3];m=``;try{m=JSON.stringify(p.body,null,2)}catch{}return this.completeRequest({context:e,success:`${p.status}: ${m}`}),[3,5];case 3:return[4,this.handleReponse(p.status,e)];case 4:a.sent(),a.label=5;case 5:return[3,7];case 6:return h=a.sent(),this.completeRequest({context:e,err:h}),[3,7];case 7:return[2]}})})},e.prototype.handleReponse=function(e,t){return s(this,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:switch(n=new Wt().buildStatus(e),r=n,r){case B.Success:return[3,1];case B.Failed:return[3,2]}return[3,4];case 1:return this.handleSuccessResponse(t),[3,5];case 2:return[4,this.handleOtherResponse(t)];case 3:return i.sent(),[3,5];case 4:this.completeRequest({context:t,err:Gl}),i.label=5;case 5:return[2]}})})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/Ac);this.completeRequest({context:e,success:`Session replay event batch tracked successfully for session id ${e.sessionId}, size of events: ${t} KB`})},e.prototype.handleOtherResponse=function(e){return s(this,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return t=e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0)?(this.completeRequest({context:e,err:Kl}),[2]):[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return n.sent(),[4,this.send(e,!0)];case 2:return n.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),Ql=(e,t)=>t.some(t=>e instanceof t),$l,eu;function tu(){return $l||=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]}function nu(){return eu||=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]}var ru=new WeakMap,iu=new WeakMap,au=new WeakMap;function ou(e){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener(`success`,i),e.removeEventListener(`error`,a)},i=()=>{t(fu(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener(`success`,i),e.addEventListener(`error`,a)});return au.set(t,e),t}function su(e){if(ru.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener(`complete`,i),e.removeEventListener(`error`,a),e.removeEventListener(`abort`,a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException(`AbortError`,`AbortError`)),r()};e.addEventListener(`complete`,i),e.addEventListener(`error`,a),e.addEventListener(`abort`,a)});ru.set(e,t)}var cu={get(e,t,n){if(e instanceof IDBTransaction){if(t===`done`)return ru.get(e);if(t===`store`)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return fu(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t===`done`||t===`store`)?!0:t in e}};function lu(e){cu=e(cu)}function uu(e){return nu().includes(e)?function(...t){return e.apply(pu(this),t),fu(this.request)}:function(...t){return fu(e.apply(pu(this),t))}}function du(e){return typeof e==`function`?uu(e):(e instanceof IDBTransaction&&su(e),Ql(e,tu())?new Proxy(e,cu):e)}function fu(e){if(e instanceof IDBRequest)return ou(e);if(iu.has(e))return iu.get(e);let t=du(e);return t!==e&&(iu.set(e,t),au.set(t,e)),t}var pu=e=>au.get(e);function mu(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){let o=indexedDB.open(e,t),s=fu(o);return r&&o.addEventListener(`upgradeneeded`,e=>{r(fu(o.result),e.oldVersion,e.newVersion,fu(o.transaction),e)}),n&&o.addEventListener(`blocked`,e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{a&&e.addEventListener(`close`,()=>a()),i&&e.addEventListener(`versionchange`,e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}var hu=[`get`,`getKey`,`getAll`,`getAllKeys`,`count`],gu=[`put`,`add`,`delete`,`clear`],_u=new Map;function vu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t==`string`))return;if(_u.get(t))return _u.get(t);let n=t.replace(/FromIndex$/,``),r=t!==n,i=gu.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||hu.includes(n)))return;let a=async function(e,...t){let a=this.transaction(e,i?`readwrite`:`readonly`),o=a.store;
vendor: 10,902 bytes, line 12
12return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return _u.set(t,a),a}lu(e=>({...e,get:(t,n,r)=>vu(t,n)||e.get(t,n,r),has:(t,n)=>!!vu(t,n)||e.has(t,n)}));var yu=[`continue`,`continuePrimaryKey`,`advance`],bu={},xu=new WeakMap,Su=new WeakMap,Cu={get(e,t){if(!yu.includes(t))return e[t];let n=bu[t];return n||=bu[t]=function(...e){xu.set(this,Su.get(this)[t](...e))},n}};async function*wu(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;let n=new Proxy(t,Cu);for(Su.set(n,t),au.set(n,pu(t));t;)yield n,t=await(xu.get(n)||t.continue()),xu.delete(n)}function Tu(e,t){return t===Symbol.asyncIterator&&Ql(e,[IDBIndex,IDBObjectStore,IDBCursor])||t===`iterate`&&Ql(e,[IDBIndex,IDBObjectStore])}lu(e=>({...e,get(t,n,r){return Tu(t,n)?wu:e.get(t,n,r)},has(t,n){return Tu(t,n)||e.has(t,n)}})),o();var Eu=function(){function e(e){var t=this;this.minInterval=500,this.maxInterval=kc,this.maxPersistedEventsSize=Ec,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,n){var r=t.getStringSize(n);return t.getEventsArraySize(e)+r>=t.maxPersistedEventsSize?!0:Date.now()-t.timeAtLastSplit>t.interval&&e.length?(t.interval=Math.min(t.maxInterval,t.interval+t.minInterval),t._timeAtLastSplit=Date.now(),!0):!1},this.loggerProvider=e.loggerProvider,this.minInterval=e.minInterval??this.minInterval,this.maxInterval=e.maxInterval??this.maxInterval,this.maxPersistedEventsSize=e.maxPersistedEventsSize??this.maxPersistedEventsSize}return Object.defineProperty(e.prototype,`timeAtLastSplit`,{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){return e.length},e.prototype.getEventsArraySize=function(e){var t,n,r=0;try{for(var a=i(e),o=a.next();!o.done;o=a.next()){var s=o.value;r+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}var c=2+Math.max(0,e.length-1)+e.length*2;return r+c},e}(),Du=function(e){return typeof e==`object`&&!!e&&e.name===`AbortError`},Ou=function(e,t,n){Du(n)?e.debug(t):e.warn(t)};o();var ku=`sessionCurrentSequence`,Au=`sequencesToSend`,ju=function(e){var t,n;return e.objectStoreNames.contains(`sessionCurrentSequence`)||(n=e.createObjectStore(ku,{keyPath:`sessionId`})),e.objectStoreNames.contains(`sequencesToSend`)||(t=e.createObjectStore(Au,{keyPath:`sequenceId`,autoIncrement:!0}),t.createIndex(`sessionId`,`sessionId`)),{sequencesStore:t,currentSequenceStore:n}},Mu=function(e){return s(void 0,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return[4,mu(e,1,{upgrade:ju})];case 1:return[2,t.sent()]}})})},Nu=function(e){l(t,e);function t(t){var n=e.call(this,t)||this;return n.getSequencesToSend=function(){return s(n,void 0,void 0,function(){var e,t,n,r,i,o;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,5,,6]),e=[],[4,this.db.transaction(`sequencesToSend`).store.openCursor()];case 1:t=a.sent(),a.label=2;case 2:return t?(n=t.value,r=n.sessionId,i=n.events,e.push({events:i,sequenceId:t.key,sessionId:r}),[4,t.continue()]):[3,4];case 3:return t=a.sent(),[3,2];case 4:return[2,e];case 5:return o=a.sent(),Ou(this.loggerProvider,`${ql}: ${o}`,o),[3,6];case 6:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.db.get(ku,e)];case 1:return t=i.sent(),t?[4,this.db.put(Au,{sessionId:e,events:t.events})]:[2,void 0];case 2:return n=i.sent(),[4,this.db.put(ku,{sessionId:e,events:[]})];case 3:return i.sent(),[2,d(d({},t),{sessionId:e,sequenceId:n})];case 4:return r=i.sent(),Ou(this.loggerProvider,`${ql}: ${r}`,r),[3,5];case 5:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return s(n,void 0,void 0,function(){var n,r,i,o,s,c;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,10,,11]),n=this.db.transaction(ku,`readwrite`),[4,n.store.get(e)];case 1:return r=a.sent(),r?[3,3]:[4,n.store.put({sessionId:e,events:[t]})];case 2:return a.sent(),[2];case 3:return i=void 0,this.shouldSplitEventsList(r.events,t)?(i=r.events,[4,n.store.put({sessionId:e,events:[t]})]):[3,5];case 4:return a.sent(),[3,7];case 5:return o=r.events.concat(t),[4,n.store.put({sessionId:e,events:o})];case 6:a.sent(),a.label=7;case 7:return[4,n.done];case 8:return a.sent(),i?[4,this.storeSendingEvents(e,i)]:[2,void 0];case 9:return s=a.sent(),s?[2,{events:i,sessionId:e,sequenceId:s}]:[2,void 0];case 10:return c=a.sent(),Ou(this.loggerProvider,`${ql}: ${c}`,c),[3,11];case 11:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return s(n,void 0,void 0,function(){var n,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(Au,{sessionId:e,events:t})];case 1:return n=i.sent(),[2,n];case 2:return r=i.sent(),Ou(this.loggerProvider,`${ql}: ${r}`,r),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return s(n,void 0,void 0,function(){var e;return a(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(Au,t)];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),Ou(this.loggerProvider,`${ql}: ${e}`,e),[3,4];case 4:return[2]}})})},n.db=t.db,n}return t.new=function(e,n){return s(this,void 0,void 0,function(){var r,i,o,s;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=e===`replay`?``:`_${e}`,i=`${n.apiKey.substring(0,10)}_amp_session_replay_events${r}`,[4,Mu(i)];case 1:return o=a.sent(),[2,new t(d(d({},n),{db:o}))];case 2:return s=a.sent(),Ou(n.loggerProvider,`${ql}: ${s}`,s),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return s(this,void 0,void 0,function(){var t,n,r,o,t,s,c,l;return a(this,function(a){switch(a.label){case 0:return e?[4,this.db.get(`sessionCurrentSequence`,e)]:[3,2];case 1:return t=a.sent(),t?[2,[t]]:[2,void 0];case 2:n=[],a.label=3;case 3:return a.trys.push([3,8,9,10]),[4,this.db.getAll(`sessionCurrentSequence`)];case 4:r=i.apply(void 0,[a.sent()]),o=r.next(),a.label=5;case 5:if(o.done)return[3,7];t=o.value,n.push(t),a.label=6;case 6:return o=r.next(),[3,5];case 7:return[3,10];case 8:return s=a.sent(),c={error:s},[3,10];case 9:try{o&&!o.done&&(l=r.return)&&l.call(r)}finally{if(c)throw c.error}return[7];case 10:return[2,n]}})})},t}(Eu);o();var Pu=function(e){l(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=u([],r(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,sessionId:e}},t.prototype.getSequencesToSend=function(){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,Object.entries(this.finalizedSequences).map(function(e){var t=r(e,2),n=t[0],i=t[1],a=i.sessionId,o=i.events;return{sequenceId:Number(n),sessionId:a,events:o}})]})})},t.prototype.storeCurrentSequence=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return s(this,void 0,void 0,function(){var n;return a(this,function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(n=this.addSequence(e)),this.sequences[e].push(t),[2,n]})})},t.prototype.storeSendingEvents=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(e){return t!==void 0&&delete this.finalizedSequences[t],[2]})})},t}(Eu);o();var Fu=function(e){var t=e.config,n=e.minInterval,r=e.maxInterval,i=e.type,o=e.payloadBatcher,c=e.storeType;return s(void 0,void 0,void 0,function(){function e(e){return e===void 0&&(e=!1),s(this,void 0,void 0,function(){return a(this,function(t){return[2,l.flush(e)]})})}var l,u,f,p,m,h,g,_,v;return a(this,function(y){switch(y.label){case 0:return l=new Zl(d(d({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o})),u=function(){return new Pu({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n})},f=function(){return s(void 0,void 0,void 0,function(){var e;return a(this,function(a){switch(a.label){case 0:return[4,Nu.new(i,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,apiKey:t.apiKey})];case 1:return e=a.sent(),e?[2,e]:(t.loggerProvider.log(`Failed to initialize idb store, falling back to memory store.`),[2,u()])}})})},c===`idb`?[4,f()]:[3,2];case 1:return m=y.sent(),[3,3];case 2:m=u(),y.label=3;case 3:return p=m,h=function(e){var n=e.events,r=e.sessionId,o=e.deviceId,c=e.sequenceId;t.debugMode&&Jc().then(function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug(`Total storage size: ${n} KB, percentage of quota: ${r}%, usage details: ${i}`)}).catch(function(){}),l.sendEventsList({events:n,sessionId:r,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:o,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return s(void 0,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,p.cleanUpSessionEventsStore(r,c)];case 1:return e.sent(),[2]}})})}})},g=function(e){var n=e.sessionId,r=e.deviceId;p.storeCurrentSequence(n).then(function(e){e&&h({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)})},_=function(e){var t=e.deviceId;return s(void 0,void 0,void 0,function(){var e;return a(this,function(n){switch(n.label){case 0:return[4,p.getSequencesToSend()];case 1:return e=n.sent(),e&&e.forEach(function(e){h({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},v=function(e){var n=e.event,r=e.sessionId,i=e.deviceId;p.addEventToCurrentSequence(r,n.data).then(function(e){return e&&h({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i})}).catch(function(e){t.loggerProvider.warn(`Failed to add event to session replay capture:`,e)})},[2,{sendCurrentSequenceEvents:g,addEvent:v,sendStoredEvents:_,flush:e}]}})})};o();var Iu=function(){function e(){var e=[...arguments],t=new Map;e.forEach(function(e){t.set(e.name,e.manager)}),this.managers=t}return e.prototype.sendStoredEvents=function(e){return s(this,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEac
vendor: 4,517 bytes, line 12
12h(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;(t=this.managers.get(r.type))==null||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 s(this,void 0,void 0,function(){var t;return a(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}();o();var Lu,Ru,zu;function Bu(e,t){if(zu=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error(`Can't generate CSS selector for non-element node type.`);if(e.tagName.toLowerCase()===`html`)return`html`;var n={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};Lu=d(d({},n),t),Ru=Vu(Lu.root,n);var r=Hu(e,`all`,function(){return Hu(e,`two`,function(){return Hu(e,`one`,function(){return Hu(e,`none`)})})});if(r){var i=id(ad(r,e));return i.length>0&&(r=i[0]),Wu(r)}else throw Error(`Selector was not found.`)}function Vu(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function Hu(e,t,n){for(var a=null,o=[],s=e,c=0,l=function(){var e,l,d=new Date().getTime()-zu.getTime();if(Lu.timeoutMs!==void 0&&d>Lu.timeoutMs)throw Error(`Timeout: Can't find a unique selector after ${d}ms`);var f=td(qu(s))||td.apply(void 0,u([],r(Ju(s)),!1))||td.apply(void 0,u([],r(Yu(s)),!1))||td(Xu(s))||[Zu()],p=Qu(s);if(t==`all`)p&&(f=f.concat(f.filter(ed).map(function(e){return $u(e,p)})));else if(t==`two`)f=f.slice(0,1),p&&(f=f.concat(f.filter(ed).map(function(e){return $u(e,p)})));else if(t==`one`){var m=r(f=f.slice(0,1),1)[0];p&&ed(m)&&(f=[$u(m,p)])}else t==`none`&&(f=[Zu()],p&&(f=[$u(f[0],p)]));try{for(var h=(e=void 0,i(f)),g=h.next();!g.done;g=h.next()){var m=g.value;m.level=c}}catch(t){e={error:t}}finally{try{g&&!g.done&&(l=h.return)&&l.call(h)}finally{if(e)throw e.error}}if(o.push(f),o.length>=Lu.seedMinLength&&(a=Uu(o,n),a))return`break`;s=s.parentElement,c++};s&&l()!==`break`;);return a||=Uu(o,n),!a&&n?n():a}function Uu(e,t){var n,r,a=id(rd(e));if(a.length>Lu.threshold)return t?t():null;try{for(var o=i(a),s=o.next();!s.done;s=o.next()){var c=s.value;if(Ku(c))return c}}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 Wu(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?`${e[r].name} > ${n}`:`${e[r].name} ${n}`,t=e[r]}return n}function Gu(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function Ku(e){var t=Wu(e);switch(Ru.querySelectorAll(t).length){case 0:throw Error(`Can't select any node with this selector: ${t}`);case 1:return!0;default:return!1}}function qu(e){var t=e.getAttribute(`id`);return t&&Lu.idName(t)?{name:`#`+CSS.escape(t),penalty:0}:null}function Ju(e){return Array.from(e.attributes).filter(function(e){return Lu.attr(e.name,e.value)}).map(function(e){return{name:`[${CSS.escape(e.name)}="${CSS.escape(e.value)}"]`,penalty:.5}})}function Yu(e){return Array.from(e.classList).filter(Lu.className).map(function(e){return{name:`.`+CSS.escape(e),penalty:1}})}function Xu(e){var t=e.tagName.toLowerCase();return Lu.tagName(t)?{name:t,penalty:2}:null}function Zu(){return{name:`*`,penalty:3}}function Qu(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}function $u(e,t){return{name:e.name+`:nth-child(${t})`,penalty:e.penalty+1}}function ed(e){return e.name!==`html`&&!e.name.startsWith(`#`)}function td(){var e=[...arguments].filter(nd);return e.length>0?e:null}function nd(e){return e!=null}function rd(e,t){var n,r,o,s,c,l;return t===void 0&&(t=[]),a(this,function(a){switch(a.label){case 0:if(!(e.length>0))return[3,9];a.label=1;case 1:a.trys.push([1,6,7,8]),n=i(e[0]),r=n.next(),a.label=2;case 2:return r.done?[3,5]:(o=r.value,[5,i(rd(e.slice(1,e.length),t.concat(o)))]);case 3:a.sent(),a.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),c={error:s},[3,8];case 7:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}
vendor: 4,115 bytes, line 12
12return[7];case 8:return[3,11];case 9:return[4,t];case 10:a.sent(),a.label=11;case 11:return[2]}})}function id(e){return u([],r(e),!1).sort(function(e,t){return Gu(e)-Gu(t)})}function ad(e,t,n){var o,s,c;return n===void 0&&(n={counter:0,visited:new Map}),a(this,function(a){switch(a.label){case 0:if(!(e.length>2&&e.length>Lu.optimizedMinLength))return[3,5];o=1,a.label=1;case 1:return o<e.length-1?n.counter>Lu.maxNumberOfTries||(n.counter+=1,s=u([],r(e),!1),s.splice(o,1),c=Wu(s),n.visited.has(c))?[2]:Ku(s)&&od(s,t)?[4,s]:[3,4]:[3,5];case 2:return a.sent(),n.visited.set(c,!0),[5,i(ad(s,t,n))];case 3:a.sent(),a.label=4;case 4:return o++,[3,1];case 5:return[2]}})}function od(e,t){return Ru.querySelector(Wu(e))===t}o();var sd=36e5,cd=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);t.count=1,t.type===`click`&&r.push(t)}),{version:t,events:r}},ld=function(e){var t=e.version,n=e.events,r=[];n.forEach(function(e){var t=JSON.parse(e);t.type===`click`&&r.push(t)});var i=r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,a=t.timestamp,o=a-a%sd,s=`${n}:${r}:${i??``}:${o}`;return e[s]?e[s].count+=1:e[s]=d(d({},t),{timestamp:o,count:1}),e},{});return{version:t,events:Object.values(i)}},ud=function(){function e(e,t){var n=this;this.createHook=function(e){var t=e.eventsManager,r=e.sessionId,i=e.deviceIdFn,a=e.mirror,o=e.ugcFilterRules,s=e.performanceOptions;return function(e){if(e.type===$c.Click){var c=p();if(c){var l=c.location,u=c.innerHeight,d=c.innerWidth;if(l){var f=e.x,m=e.y;if(!(f===void 0||m===void 0)){var h=a.getNode(e.id),g;if(h)try{g=Bu(h,s)}catch{n.logger.debug(`error resolving selector from finder`)}var _=qc(l.href,o),v={x:f+n.scrollWatcher.currentScrollX,y:m+n.scrollWatcher.currentScrollY,selector:g,viewportHeight:u,viewportWidth:d,pageUrl:_,timestamp:Date.now(),type:`click`},y=i();y&&t.addEvent({sessionId:r,event:{type:`interaction`,data:JSON.stringify(v)},deviceId:y})}}}}}},this.logger=e,this.scrollWatcher=t}return e}();function dd(){return p()?.innerHeight||document.documentElement&&document.documentElement.clientHeight||0}function fd(){return p()?.innerWidth||document.documentElement&&document.documentElement.clientWidth||0}var pd=function(){function e(e,t){var n=p();n&&n.navigator&&typeof n.navigator.sendBeacon==`function`?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch{}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=Uc(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,a=new URLSearchParams({device_id:e,session_id:String(r),type:String(i),api_key:this.apiKey}),o=`${this.basePageUrl}?${a.toString()}`;this.sendBeacon(o,t)||this.sendXhr(o,t)},e}(),md=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=e(),i=p();i&&r&&n.transport.send(r,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:dd(),viewportWidth:fd(),pageUrl:qc(i.location.href,n.config.interactionConfig?.ugcFilterRules??[]),timestamp:n.timestamp,type:`scroll`}]})}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=fd(),this._maxScrollHeight=dd(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new pd(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}
12,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=fd();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=dd();this._maxScrollY=e.y;var a=e.y+i;a>this._maxScrollHeight&&(this._maxScrollHeight=a),this.timestamp=t}},e}(),hd=function(){function e(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId=Hc(t,n))}return e}();o();var gd=new(function(){function e(){var e=this;this.dbs={},this.createStore=function(t){return s(e,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,mu(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 s(e,void 0,void 0,function(){var e,n;return a(this,function(r){switch(r.label){case 0:return this.dbs&&this.dbs[t]?[2,this.dbs[t]]:(e=`${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 s(e,void 0,void 0,function(){var e,t,o,s;return a(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 o=a.sent(),[2,o?.targetingMatch];case 3:return s=a.sent(),Ou(n,`Failed to get targeting match for session id ${i}: ${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 s(e,void 0,void 0,function(){var e,t,s,c;return a(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 s=a.sent(),[2,s];case 3:return c=a.sent(),Ou(n,`Failed to store targeting match for session id ${i}: ${c}`,c),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.currentSessionId;return s(e,void 0,void 0,function(){var e,t,o,s,c,l,u,d;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,8,,9]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),o=e.transaction(`sessionTargetingMatch`,`readwrite`),[4,o.store.getAll()];case 2:s=a.sent(),c=0,a.label=3;case 3:return c<s.length?(l=s[c],u=Date.now()-l.lastUpdated,l.sessionId!==t&&u>1728e5?[4,o.store.delete(l.sessionId)]:[3,5]):[3,6];case 4:a.sent(),a.label=5;case 5:return c++,[3,3];case 6:return[4,o.done];case 7:return a.sent(),[3,9];case 8:return d=a.sent(),Ou(n,`Failed to clear old targeting matches for sessions: ${d}`,d),[3,9];case 9:return[2]}})})}}return e}());o();var _d=function(e){var t=e.sessionId,r=e.targetingConfig,i=e.loggerProvider,o=e.apiKey,c=e.targetingParams,l=e.urlChange,u=l===void 0?!1:l;return s(void 0,void 0,void 0,function(){var e,s,l,f,p,m,h;return a(this,function(a){switch(a.label){case 0:return[4,gd.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:t})];case 1:return a.sent(),[4,gd.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t})];case 2:if(e=a.sent(),e===!0&&!u)return[2,!0];s=!0,a.label=3;case 3:return a.trys.push([3,6,,7]),[4,n(()=>import(`./esm-D3HokuX4.js`),__vite__mapDeps([0,1,2]))];case 4:return l=a.sent().evaluateTargeting,f=d(d({},c),{flag:r,sessionId:typeof t==`string`?parseInt(t,10):t,apiKey:o,loggerProvider:i}),[4,l(f)];case 5:return p=a.sent(),p&&p.sr_targeting_config&&(s=p.sr_targeting_config.key===`on`),gd.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t,targetingMatch:s}
12),[3,7];case 6:return m=a.sent(),h=m,i.warn(h.message),[3,7];case 7:return[2,s]}})})};o();var vd=`__amplitude_url_tracking_patched__`,yd=new WeakMap;function bd(e,t,n){if(n===void 0&&(n={}),!e?.location)return function(){};var r=n.enablePolling,i=r===void 0?!1:r,a=n.pollingInterval,o=a===void 0?yc:a;if(i){var s=function(){return e.location.href??``},c=s(),l=e.setInterval(function(){var e=s();e!==c&&(c=e,t(e))},o);return function(){l!=null&&e.clearInterval(l)}}var u=yd.get(e);if(!u){var d=void 0,f=new Set,p=function(){return e.location.href??``},m=function(){var e=p();d!==void 0&&e===d||(d=e,f.forEach(function(t){return t(e)}))},h=function(e){var t=function(){var t=[...arguments],n=e.apply(this,t);return m(),n};return t[vd]=!0,t},g=e.history;if(g?.pushState){var _=Reflect.get(g,`pushState`);_[vd]||(g.pushState=h(_))}if(g?.replaceState){var v=Reflect.get(g,`replaceState`);v[vd]||(g.replaceState=h(v))}u={callbacks:f,notify:m,onPopStateOrHashChange:function(){return m()},listenersAttached:!1},yd.set(e,u)}var y=u;return y.listenersAttached||=(e.addEventListener(`popstate`,y.onPopStateOrHashChange),e.addEventListener(`hashchange`,y.onPopStateOrHashChange),!0),y.callbacks.add(t),function(){y.callbacks.delete(t),y.callbacks.size===0&&(y.listenersAttached&&=(e.removeEventListener(`popstate`,y.onPopStateOrHashChange),e.removeEventListener(`hashchange`,y.onPopStateOrHashChange),!1))}}function xd(e){return e===void 0&&(e={}),{name:`amplitude/url-tracking@1`,observer:function(t,n,r){var i=d(d({},e),r),a=i.ugcFilterRules||[],o=i.enablePolling??!1,s=i.pollingInterval??yc,c=i.captureDocumentTitle??!1;if(!n)return function(){};var l=void 0,u=function(){return n.location&&n.location.href||``},f=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=u(),o=``;return c&&(o=r?.title||``),{href:a.length>0?qc(i,a):i,title:o,viewportHeight:e,viewportWidth:t,type:`url-change-event`}},p=function(){var e=u();(l===void 0||e!==l)&&(l=e,t(f()))},m=bd(n,function(){return p()},o?{enablePolling:!0,pollingInterval:s}:{});return p(),function(){return m()}},options:e}}xd(),o();var Sd=function(){function e(){var e=this;this.name=`@amplitude/session-replay-browser`,this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.recordFunction=null,this.urlChangeCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var n=p();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(){e.recordEvents(!1)},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,n,r,i){return n===void 0&&(n=!1),r===void 0&&(r=!1),i===void 0&&(i=!1),s(e,void 0,void 0,function(){var e,o,s,c,l,u,d;return a(this,function(a){switch(a.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)this.loggerProvider.log(`Targeting config has not been set yet, cannot evaluate targeting.`);else return this.loggerProvider.log(`No targeting config set, skipping initialization/recording for event.`),[2];return this.lastTargetingParams=t,e=this.config.targetingConfig,o=e&&!this.sessionTargetingMatch,o?(s=i?this.latestUrlChangeTargetingEvaluationId:void 0,c=t.event,c&&Object.values(h).includes(c.event_type)&&(c=void 0),l=t.page?.url??p()?.location?.href??``,u=t.page??(l===``?void 0:{url:l}),[4,_d({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:c,page:u},urlChange:i})]):[3,2];case 1:if(d=a.sent(),i&&s!==void 0&&s!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug(`Ignoring stale URL-change targeting result #${s}; latest is #${this.latestUrlChangeTargetingEvaluationId}.`),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||d,this.loggerProvider.debug(JSON.stringify({name:`targeted replay capture config`,sessionTargetingMatch:this.sessionTargetingMatch,event:c,targetingParams:t},null,2)),a.label=2;case 2:return n?(this.initialize(!0),[3,5]):[3,3];case 3:return r||!this.recordCancelCallback?(this.loggerProvider.log(`Recording events for session due to forceRestart or no ongoing recording.`),[4,this.recordEvents()]):[3,5];case 4:a.sent(),a.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,n,r){return n===void 0&&(n={}),r===void 0&&(r=!0),s(e,void 0,void 0,function(){var e,i,o,s;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),e=void 0,i=this.config,!(i&&t!==Mc.METADATA)||(e={config:Yc(i),version:Xl},!r)?[3,2]:[4,Jc()];case 1:o=a.sent(),e=d(d({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,d(d({},n),e)):this.loggerProvider.debug(`Not able to add custom replay capture event ${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;try{e.loggerProvider.log(`Session Replay capture stopping.`),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,(t=e.networkObservers)==null||t.stop()}catch(t){var n=t;e.loggerProvider.warn(`Error occurred while stopping replay capture: ${n.toString()}`)}},this.loggerProvider=new Nc(new je)}return e.prototype.init=function(e,t){return we(this._init(e,t))},e.prototype.setupUrlChangeListenerForTargeting=function(){var e=this,t;(t=this.urlChangeCleanup)==null||t.call(this);var n=p();if(n?.location){var r=bd(n,function(t){var n=++e.latestUrlChangeTargetingEvaluationId;e.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:t}}
12,!1,!1,!0),e.loggerProvider.debug(`Queued URL-change targeting re-evaluation #${n} for ${t}.`)});this.urlChangeCleanup=function(){r(),e.urlChangeCleanup=null}}},e.prototype.getCurrentPageForTargeting=function(){var e=p()?.location?.href;return e==null?void 0:{url:e}},e.prototype._init=function(e,t){var i;return s(this,void 0,void 0,function(){var o,s,c,l,f,m,h,g,_,v,y,b,x,S,y,C,w,T,E;return a(this,function(a){switch(a.label){case 0:return(i=this.urlChangeCleanup)==null||i.call(this),this.loggerProvider=new Nc(t.loggerProvider||new je),Object.prototype.hasOwnProperty.call(t,`logLevel`)&&this.loggerProvider.enable(t.logLevel),this.identifiers=new hd({sessionId:t.sessionId,deviceId:t.deviceId}),o=this,[4,nl(e,t)];case 1:return o.joinedConfigGenerator=a.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:s=a.sent(),c=s.joinedConfig,l=s.localConfig,f=s.remoteConfig,this.config=c,this.setMetadata(t.sessionId,c,l,f,t.version?.version,Xl,t.version?.type),t.sessionId&&this.config.interactionConfig?.enabled&&(m=md.default({sessionId:t.sessionId,type:`interaction`},this.config),this.pageLeaveFns=[m.send(this.getDeviceId.bind(this)).bind(m)],this.scrollHook=m.hook.bind(m),this.clickHandler=new ud(this.loggerProvider,m)),h=[],g=this.config.storeType,g===`idb`&&!p()?.indexedDB&&(g=`memory`,this.loggerProvider.warn(`Could not use preferred indexedDB storage, reverting to in memory option.`)),this.loggerProvider.log(`Using ${g} for event storage.`),a.label=3;case 3:return a.trys.push([3,5,,6]),[4,Fu({config:this.config,type:`replay`,storeType:g})];case 4:return _=a.sent(),h.push({name:`replay`,manager:_}),[3,6];case 5:return v=a.sent(),y=v,this.loggerProvider.warn(`Error occurred while creating replay events manager: ${y.toString()}`),[3,6];case 6:if(!this.config.interactionConfig?.enabled)return[3,10];b=this.config.interactionConfig.batch?ld:cd,a.label=7;case 7:return a.trys.push([7,9,,10]),[4,Fu({config:this.config,type:`interaction`,minInterval:this.config.interactionConfig.trackEveryNms??Dc,maxInterval:Oc,payloadBatcher:b,storeType:g})];case 8:return x=a.sent(),h.push({name:`interaction`,manager:x}),[3,10];case 9:return S=a.sent(),y=S,this.loggerProvider.warn(`Error occurred while creating interaction events manager: ${y.toString()}`),[3,10];case 10:return this.eventsManager=new(Iu.bind.apply(Iu,u([void 0],r(h),!1))),this.eventCompressor&&this.eventCompressor.terminate(),C=void 0,w=p(),this.config.useWebWorker&&w&&w.Worker?[4,n(()=>import(`./worker-DQHkyjcq.js`),[])]:[3,12];case 11:T=a.sent().compressionScript,C=T,a.label=12;case 12:return this.eventCompressor=new Ul(this.eventsManager,this.config,this.getDeviceId(),C),[4,this.initializeNetworkObservers()];case 13:return a.sent(),p()?.opener&&(E=ur(),fr(E),E.setup(d({logger:this.loggerProvider},this.config.serverZone&&{endpoint:tr[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 14:return a.sent(),this.config.targetingConfig&&this.setupUrlChangeListenerForTargeting(),[2]}})})},e.prototype.setSessionId=function(e,t){return we(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){return s(this,void 0,void 0,function(){var r,i,o;return a(this,function(a){switch(a.label){case 0:return this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,r=this.identifiers&&this.identifiers.sessionId,r&&this.sendEvents(r),i=t||this.getDeviceId(),this.identifiers=new hd({sessionId:e,deviceId:i}),this.joinedConfigGenerator&&r?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2];case 1:o=a.sent().joinedConfig,this.config=o,a.label=2;case 2:return this.config?.targetingConfig?[4,this.evaluateTargetingAndCapture({userProperties:n?.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)]:[3,4];case 3:return a.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:a.sent(),a.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&&(i=(e={},e[gc]=n.sessionReplayId?n.sessionReplayId:null,e),t.debugMode&&(i[bc]=JSON.stringify({appHash:gt(t.apiKey).toString()}))),this.addCustomRRWebEvent(Mc.GET_SR_PROPS,{shouldRecord:r,eventProperties:i},this.eventCount===10),this.eventCount===10&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t=e||this.identifiers?.sessionId,n=this.getDeviceId();this.eventsManager&&t&&n&&this.eventsManager.sendCurrentSequenceEvents({sessionId:t,deviceId:n})},e.prototype.initialize=function(e){return e===void 0&&(e=!1),s(this,void 0,void 0,function(){var t;return a(this,function(n){return this.identifiers?.sessionId?(t=this.getDeviceId(),t?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:t}),[2,this.recordEvents()]):(this.loggerProvider.log(`Session is not being recorded due to lack of device id.`),[2,Promise.resolve()])):(this.loggerProvider.log(`Session is not being recorded due to lack of session id.`),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){var e;return this.config?.instanceName&&(e=it(this.config.instanceName).identityStore.getIdentity().optOut),e===void 0?this.config?.optOut:e},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 ${this.identifiers.sessionId}
12 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 ${this.identifiers.sessionId} out of recording due to optOut config.`),!1;var e=!1,t=``,n=!1;return this.config.targetingConfig?this.sessionTargetingMatch?(t=`Capturing replays for session ${this.identifiers.sessionId} due to matching targeting conditions.`,this.loggerProvider.log(t),e=!0,n=!0):(t=`Not capturing replays for session ${this.identifiers.sessionId} due to not matching targeting conditions.`,this.loggerProvider.log(t),e=!1,n=!1):_t(this.identifiers.sessionId,this.config.sampleRate)?(e=!0,n=!0):(t=`Opting session ${this.identifiers.sessionId} out of recording due to sample rate.`,this.loggerProvider.log(t),e=!1,n=!1),this.lastShouldRecordDecision!==e&&this.config.targetingConfig&&(this.addCustomRRWebEvent(Mc.TARGETING_DECISION,{message:t,sessionId:this.identifiers.sessionId,matched:n,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=e),e},e.prototype.getBlockSelectors=function(){var e=this.config?.privacyConfig?.blockSelector??[];if(e.length!==0)return e},e.prototype.getMaskTextSelectors=function(){if(this.config?.privacyConfig?.defaultMaskLevel===`conservative`)return`*`;var e=this.config?.privacyConfig?.maskSelector;if(e)return e},e.prototype.getRecordingPlugins=function(e){return s(this,void 0,void 0,function(){var t,r,i,o;return a(this,function(a){switch(a.label){case 0:t=[];try{r=xd({ugcFilterRules:this.config?.interactionConfig?.ugcFilterRules||[],enablePolling:this.config?.enableUrlChangePolling||!1,pollingInterval:this.config?.urlChangePollingInterval,captureDocumentTitle:this.config?.captureDocumentTitle}),t.push(r)}catch(e){this.loggerProvider.warn(`Failed to create URL tracking plugin:`,e)}if(!e?.console?.enabled)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n(()=>import(`./rrweb-plugin-console-record-PyxBIDtu.js`),[])];case 2:return i=a.sent().getRecordConsolePlugin,t.push(i({level:e.console.levels})),[3,4];case 3:return o=a.sent(),this.loggerProvider.warn(`Failed to load console plugin:`,o),[3,4];case 4:return[2,t.length>0?t:void 0]}})})},e.prototype.getRecordFunction=function(){return s(this,void 0,void 0,function(){var e,t;return a(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(()=>import(`./rrweb-record-CCL-E0P_.js`),[])];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){var t;return e===void 0&&(e=!0),s(this,void 0,void 0,function(){var n,r,i,o,s,c,l,u,d,f,p,m,h,g,_,v,y=this;return a(this,function(a){switch(a.label){case 0:return n=this.config,r=this.getShouldRecord(),i=this.identifiers?.sessionId,!r||!i||!n?[2]:(this.stopRecordingEvents(),[4,this.getRecordFunction()]);case 1:return o=a.sent(),o?[4,this.initializeNetworkObservers()]:[2];case 2:a.sent(),s=n.loggingConfig?.network,c=Uc(n.serverZone,n.trackServerUrl),l=[Cc,wc,Tc,c],(t=this.networkObservers)==null||t.start(function(e){l.some(function(t){return e.url.startsWith(t)})||y.addCustomRRWebEvent(Mc.FETCH_REQUEST,e)},s),u=n.privacyConfig,d=n.interactionConfig,f=n.loggingConfig,p=d?.enabled?{mouseInteraction:this.eventsManager&&this.clickHandler?.createHook({eventsManager:this.eventsManager,sessionId:i,deviceIdFn:this.getDeviceId.bind(this),mirror:o.mirror,ugcFilterRules:d.ugcFilterRules??[],performanceOptions:n.performanceConfig?.interaction}),scroll:this.scrollHook}:{},m=d?.enabled&&d.ugcFilterRules?d.ugcFilterRules:[],this.loggerProvider.log(`Session Replay capture beginning for ${i}.`),a.label=3;case 3:return a.trys.push([3,5,,6]),h=this,g=o,v={emit:function(e){if(y.shouldOptOut()){y.loggerProvider.log(`Opting session ${i} out of recording due to optOut config.`),y.stopRecordingEvents(),y.sendEvents();return}e.type===Qc.Meta&&(e.data.href=qc(e.data.href,m)),y.eventCompressor&&y.eventCompressor.enqueueEvent(e,i)},inlineStylesheet:n.shouldInlineStylesheet,hooks:p,maskAllInputs:!0,maskTextClass:Sc,blockClass:xc,blockSelector:this.getBlockSelectors(),applyBackgroun
12dColorToBlockedElements:n.applyBackgroundColorToBlockedElements,maskInputFn:zc(`input`,u),maskTextFn:zc(`text`,u),maskAttributeFn:Bc(u),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:n.omitElementTags?.script,comment:n.omitElementTags?.comment},errorHandler:function(e){var t=e;if(t.message.includes(`insertRule`)&&t.message.includes(`CSSStyleSheet`)||t._external_)throw t;return y.loggerProvider.warn(`Error while capturing replay: `,t.toString()),!0}},[4,this.getRecordingPlugins(f)];case 4:return h.recordCancelCallback=g.apply(void 0,[(v.plugins=a.sent(),v)]),this.addCustomRRWebEvent(Mc.DEBUG_INFO),e&&this.addCustomRRWebEvent(Mc.METADATA,this.metadata),[3,6];case 5:return _=a.sent(),this.loggerProvider.warn(`Failed to initialize session replay:`,_),[3,6];case 6:return[2]}})})},e.prototype.getDeviceId=function(){return this.identifiers?.deviceId},e.prototype.getSessionId=function(){return this.identifiers?.sessionId},e.prototype.flush=function(e){return e===void 0&&(e=!1),s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.eventsManager?.flush(e)]})})},e.prototype.shutdown=function(){var e;(e=this.urlChangeCleanup)==null||e.call(this),this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return e===`plugin`?`@amplitude/plugin-session-replay-browser`:e===`segment`?`@amplitude/segment-session-replay-plugin`:null},e.prototype.setMetadata=function(e,t,n,r,i,a,o){var s=e?.toString()?gt(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,sessionId:e,hashValue:s,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(o),replaySDKVersion:i,standaloneSDKType:`@amplitude/session-replay-browser`,standaloneSDKVersion:a}},e.prototype.initializeNetworkObservers=function(){return s(this,void 0,void 0,function(){var e,t;return a(this,function(r){switch(r.label){case 0:if(!(this.config?.loggingConfig?.network?.enabled&&!this.networkObservers))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n(()=>import(`./observers-D3NwiMaz.js`),__vite__mapDeps([3,4,1,2]))];case 2:return e=r.sent().NetworkObservers,this.networkObservers=new e,[3,4];case 3:return t=r.sent(),this.loggerProvider.warn(`Failed to import or instantiate NetworkObservers:`,t),[3,4];case 4:return[2]}})})},e}(),Cd=function(e){return function(){var t=e.config||Xc();return{logger:t.loggerProvider,logLevel:t.logLevel}}},wd=function(){var e=new Sd;return{init:U(e.init.bind(e),`init`,Cd(e)),evaluateTargetingAndCapture:U(e.evaluateTargetingAndCapture.bind(e),`evaluateTargetingAndRecord`,Cd(e)),setSessionId:U(e.setSessionId.bind(e),`setSessionId`,Cd(e)),getSessionId:U(e.getSessionId.bind(e),`getSessionId`,Cd(e)),getSessionReplayProperties:U(e.getSessionReplayProperties.bind(e),`getSessionReplayProperties`,Cd(e)),flush:U(e.flush.bind(e),`flush`,Cd(e)),shutdown:U(e.shutdown.bind(e),`shutdown`,Cd(e))}}(),Td=wd.init,Ed=wd.setSessionId,Dd=wd.getSessionId,Od=wd.getSessionReplayProperties,kd=wd.flush,Ad=wd.shutdown,jd=wd.evaluateTargetingAndCapture,Md=function(e){return e===void 0&&(e=`$default_instance`),rt.getInstance(e)},Nd;(function(e){e.SET=`$set`,e.SET_ONCE=`$setOnce`,e.ADD=`$add`,e.APPEND=`$append`,e.PREPEND=`$prepend`,e.REMOVE=`$remove`,e.PREINSERT=`$preInsert`,e.POSTINSERT=`$postInsert`,e.UNSET=`$unset`,e.CLEAR_ALL=`$clearAll`})(Nd||={});var Pd;(function(e){e.REVENUE_PRODUCT_ID=`$productId`,e.REVENUE_QUANTITY=`$quantity`,e.REVENUE_PRICE=`$price`,e.REVENUE_TYPE=`$revenueType`,e.REVENUE_CURRENCY=`$currency`,e.REVENUE=`$revenue`})(Pd||={});var Fd;(function(e){e.IDENTIFY=`$identify`,e.GROUP_IDENTIFY=`$groupidentify`,e.REVENUE=`revenue_amount`})(Fd||={});var Id=[Nd.SET,Nd.SET_ONCE,Nd.ADD,Nd.APPEND,Nd.PREPEND,Nd.POSTINSERT];o();var Ld=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(n){if(Id.includes(n)){var r=e.user_properties&&e.user_properties[n];t=d(d({},t),r)}}),t}},Rd=`1.27.4`;o();var zd=`[Amplitude] Session Replay ID`,Bd=function(){function e(t){this.name=e.pluginName,this.type=`enrichment`,this.config=null,this.sessionReplay={flush:kd,getSessionId:Dd,getSessionReplayProperties:Od,init:Td,setSessionId:Ed,shutdown:Ad,evaluateTargetingAndCapture:jd},this.options=d({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){return s(this,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e?.loggerProvider.log(`Installing @amplitude/plugin-session-replay, version 1.27.4.`),this.config=e,this.options.forceSessionTracking&&(typeof e.defaultTracking==`boolean`?e.defaultTracking===!1&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=d(d({},e.defaultTracking),{sessions:!0})),t=Md(this.config.instanceName).identityStore,n=t.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:this.options.deviceId??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||this.config.remoteConfig?.serverUrl,trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:this.options.privacyConfig?.blockSelector,maskSelector:this.options.privacyConfig?.maskSelector,unmaskSelector:this.options.privacyConfig?.unmaskSelector,defaultMaskLevel:this.options.privacyConfig?.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:`plugin`,version:Rd},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:this.options.useWebWorker??this.options.experimental?.useWebWorker,userProperties:n,omitElementTags:this.options.omitElementTags,applyBackgroun
12dColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),e?.loggerProvider.error(`Session Replay: Failed to initialize due to ${r.message}`),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return s(this,void 0,void 0,function(){return a(this,function(n){switch(n.label){case 0:return(t=this.config)==null||t.loggerProvider.debug(`Analytics session id is changed to ${e}, SR session id is ${String(this.sessionReplay.getSessionId())}.`),[4,this.sessionReplay.setSessionId(e).promise];case 1:return n.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return s(this,void 0,void 0,function(){var n;return a(this,function(r){switch(r.label){case 0:return(t=this.config)==null||t.loggerProvider.debug(`optOut is changed to ${String(e)}, calling ${e?`sessionReplay.shutdown()`:`sessionReplay.init()`}.`),e?(this.sessionReplay.shutdown(),[3,4]):[3,1];case 1:return n=this.config!=null,n?[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise]:[3,3];case 2:n=r.sent(),r.label=3;case 3:r.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t;return s(this,void 0,void 0,function(){var n,r,n,i,o,r,s;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,9,,10]),this.options.customSessionId?(n=this.options.customSessionId(e),n?n===this.sessionReplay.getSessionId()?[3,2]:[4,this.sessionReplay.setSessionId(n).promise]:[3,3]):[3,4];case 1:a.sent(),a.label=2;case 2:r=this.sessionReplay.getSessionReplayProperties(),e.event_properties=d(d({},e.event_properties),r),a.label=3;case 3:return[3,8];case 4:return n=this.config?.sessionId,n&&n!==this.sessionReplay.getSessionId()?[4,this.sessionReplay.setSessionId(n).promise]:[3,6];case 5:a.sent(),a.label=6;case 6:return n&&n===e.session_id?(i=void 0,e.event_type===h.IDENTIFY&&(i=Ld(e)),o=p(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:i,page:o?.location?.href==null?void 0:{url:o.location.href}})]):[3,8];case 7:a.sent(),r=this.sessionReplay.getSessionReplayProperties(),e.event_properties=d(d({},e.event_properties),r),a.label=8;case 8:return e.event_type===h.IDENTIFY&&e.event_properties&&delete e.event_properties[zd],[2,Promise.resolve(e)];case 9:return s=a.sent(),(t=this.config)==null||t.loggerProvider.error(`Session Replay: Failed to enrich event due to ${s.message}`),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return s(this,void 0,void 0,function(){return a(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){(e=this.config)==null||e.loggerProvider.error(`Session Replay: teardown failed due to ${t.message}`)}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName=`@amplitude/plugin-session-replay-browser`,e}(),Vd=function(e){return new Bd(e)},Hd=function(e,t){return Hd=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])},Hd(e,t)};function Ud(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Hd(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Wd=function(){return Wd=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wd.apply(this,arguments)};function Gd(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Kd(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(
vendor: 22,714 bytes, line 12
12o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function qd(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)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 Jd(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Yd(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var q={IS:`is`,IS_NOT:`is not`,CONTAINS:`contains`,DOES_NOT_CONTAIN:`does not contain`,LESS_THAN:`less`,LESS_THAN_EQUALS:`less or equal`,GREATER_THAN:`greater`,GREATER_THAN_EQUALS:`greater or equal`,VERSION_LESS_THAN:`version less`,VERSION_LESS_THAN_EQUALS:`version less or equal`,VERSION_GREATER_THAN:`version greater`,VERSION_GREATER_THAN_EQUALS:`version greater or equal`,SET_IS:`set is`,SET_IS_NOT:`set is not`,SET_CONTAINS:`set contains`,SET_DOES_NOT_CONTAIN:`set does not contain`,SET_CONTAINS_ANY:`set contains any`,SET_DOES_NOT_CONTAIN_ANY:`set does not contain any`,REGEX_MATCH:`regex match`,REGEX_DOES_NOT_MATCH:`regex does not match`},Xd=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,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return Uint8Array.from(t)},Zd=-862048943,Qd=461845907,$d=15,ef=13,tf=5,nf=-430675100,rf=function(e,t){t===void 0&&(t=0);for(var n=Xd(e),r=n.length,i=r>>2,a=t,o=0;o<i;o++)a=af(cf(n,o<<2),a);var s=i<<2,c=0;switch(r-s){case 3:c^=n[s+2]<<16,c^=n[s+1]<<8,c^=n[s],c=Math.imul(c,Zd),c=sf(c,$d),c=Math.imul(c,Qd),a^=c;break;case 2:c^=n[s+1]<<8,c^=n[s],c=Math.imul(c,Zd),c=sf(c,$d),c=Math.imul(c,Qd),a^=c;break;case 1:c^=n[s],c=Math.imul(c,Zd),c=sf(c,$d),c=Math.imul(c,Qd),a^=c;break}return a^=r,of(a)>>>0},af=function(e,t){var n=e,r=t;return n=Math.imul(n,Zd),n=sf(n,$d),n=Math.imul(n,Qd),r^=n,r=sf(r,ef),r=Math.imul(r,tf),r+nf|0},of=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16,t},sf=function(e,t,n){n===void 0&&(n=32),t>n&&(t%=n);var r=(e&4294967295<<n-t>>>0)>>>0>>>n-t>>>0;return(e<<t|r)>>>0},cf=function(e,t){return t===void 0&&(t=0),lf(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},lf=function(e){return(e&-16777216)>>>24|(e&16711680)>>>8|(e&65280)<<8|(e&255)<<24},uf=function(e,t){var n,r;if(!(!t||t.length===0)){try{for(var i=qd(t),a=i.next();!a.done;a=i.next()){var o=a.value;if(!o||!e||typeof e!=`object`)return;e=e[o]}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}if(e!=null)return e}},df=`^(\\d+)\\.(\\d+)(\\.(\\d+)(-(([-\\w]+\\.?)*))?)?$`,ff=function(){function e(e,t,n,r){r===void 0&&(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(df).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){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),pf=function(){function e(){}return e.prototype.evaluate=function(e,t){var n,r,i={},a={context:e,result:i};try{for(var o=qd(t),s=o.next();!s.done;s=o.next()){var c=s.value,l=this.evaluateFlag(a,c);l&&(i[c.key]=l)}}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.evaluateFlag=function(e,t){var n,r,i;try{for(var a=qd(t.segments),o=a.next();!o.done;o=a.next()){var s=o.value;if(i=this.evaluateSegment(e,t,s),i){var c=Wd(Wd(Wd({},t.metadata),s.metadata),i.metadata);i=Wd(Wd({},i),{metadata:c});break}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},e.prototype.evaluateSegment=function(e,t,n){if(!n.conditions){var r=this.bucket(e,n);return r===void 0?void 0:t.variants[r]}if(this.evaluateConditions(e,n.conditions)){var r=this.bucket(e,n);return r===void 0?void 0:t.variants[r]}},e.prototype.evaluateConditions=function(e,t){var n,r,i,a;try{for(var o=qd(t),s=o.next();!s.done;s=o.next()){var c=s.value,l=!0;try{for(var u=(i=void 0,qd(c)),d=u.next();!d.done;d=u.next()){var f=d.value;if(l=this.matchCondition(e,f),!l)break}}catch(e){i={error:e}}finally{try{d&&!d.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}if(l)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},e.prototype.matchCondition=function(e,t){var n=uf(e,t.selector);if(n==null)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var r=this.coerceStringArray(n);return r?this.matchSet(r,t.op,t.values):!1}else{var i=this.coerceString(n);return i===void 0?!1:this.matchString(i,t.op,t.values)}},e.prototype.getHash=function(e){return rf(e)},e.prototype.bucket=function(e,t){var n,r,i,a;if(!t.bucket)return t.variant;var o=this.coerceString(uf(e,t.bucket.selector));if(!o||o.length===0)return t.variant;var s=`${t.bucket.salt}/${o}`,c=this.getHash(s),l=c%100,u=Math.floor(c/100);try{for(var d=qd(t.bucket.allocations),f=d.next();!f.done;f=d.next()){var p=f.value,m=p.range[0],h=p.range[1];if(l>=m&&l<h)try{for(var g=(i=void 0,qd(p.distributions)),_=g.next();!_.done;_=g.next()){var v=_.value,y=v.range[0],b=v.range[1];if(u>=y&&u<b)return v.variant}}catch(e){i={error:e}}finally{try{_&&!_.done&&(a=g.return)&&a.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 q.IS:case q.CONTAINS:case q.LESS_THAN:case q.LESS_THAN_EQUALS:case q.GREATER_THAN:case q.GREATER_THAN_EQUALS:case q.VERSION_LESS_THAN:case q.VERSION_LESS_THAN_EQUALS:case q.VERSION_GREATER_THAN:case q.VERSION_GREATER_THAN_EQUALS:case q.SET_IS:case q.SET_CONTAINS:case q.SET_CONTAINS_ANY:return n;case q.IS_NOT:case q.DOES_NOT_CONTAIN:case q.SET_DOES_NOT_CONTAIN:case q.SET_DOES_NOT_CONTAIN_ANY:return!n;default:return!1}},e.prototype.matchSet=function(e,t,n){switch(t){case q.SET_IS:return this.setEquals(e,n);case q.SET_IS_NOT:return!this.setEquals(e,n);case q.SET_CONTAINS:return this.matchesSetContainsAll(e,n);case q.SET_DOES_NOT_CONTAIN:return!this.matchesSetContainsAll(e,n);case q.SET_CONTAINS_ANY:return this.matchesSetContainsAny(e,n);case q.SET_DOES_NOT_CONTAIN_ANY:return!this.matchesSetContainsAny(e,n);default:return!1}},e.prototype.matchString=function(e,t,n){var r=this;switch(t){case q.IS:return this.matchesIs(e,n);case q.IS_NOT:return!this.matchesIs(e,n);case q.CONTAINS:return this.matchesContains(e,n);case q.DOES_NOT_CONTAIN:return!this.matchesContains(e,n);case q.LESS_THAN:case q.LESS_THAN_EQUALS:case q.GREATER_THAN:case q.GREATER_THAN_EQUALS:return this.matchesComparable(e,t,n,function(e){return r.parseNumber(e)},this.comparator);case q.VERSION_LESS_THAN:case q.VERSION_LESS_THAN_EQUALS:case q.VERSION_GREATER_THAN:case q.VERSION_GREATER_THAN_EQUALS:return this.matchesComparable(e,t,n,function(e){return ff.parse(e)},this.versionComparator);case q.REGEX_MATCH:return this.matchesRegex(e,n);case q.REGEX_DOES_NOT_MATCH:return!this.matchesRegex(e,n);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var n=e.toLowerCase();if(n===`true`||n===`false`)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=qd(t),a=i.next();!a.done;a=i.next()){var o=a.value;if(e.toLowerCase().includes(o.toLowerCase()))return!0}}catch(e){n={error:e}}finally{try{a&&!a.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 a=this,o=r(e),s=n.map(function(e){return r(e)}).filter(function(e){return e!==void 0});return o===void 0||s.length===0?n.some(function(n){return a.comparator(e,t,n)}):s.some(function(e){return i(o,t,e)})},e.prototype.comparator=function(e,t,n){switch(t){case q.LESS_THAN:case q.VERSION_LESS_THAN:return e<n;case q.LESS_THAN_EQUALS:case q.VERSION_LESS_THAN_EQUALS:return e<=n;case q.GREATER_THAN:case q.VERSION_GREATER_THAN:return e>n;case q.GREATER_THAN_EQUALS:case q.VERSION_GREATER_THAN_EQUALS:return e>=n;default:return!1}},e.prototype.versionComparator=function(e,t,n){var r=e.compareTo(n);switch(t){case q.LESS_THAN:case q.VERSION_LESS_THAN:return r<0;case q.LESS_THAN_EQUALS:case q.VERSION_LESS_THAN_EQUALS:return r<=0;case q.GREATER_THAN:case q.VERSION_GREATER_THAN:return r>0;case q.GREATER_THAN_EQUALS:case q.VERSION_GREATER_THAN_EQUALS: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 e===`(none)`})},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){return Number(e)??void 0},e.prototype.coerceString=function(e){if(e!=null)return typeof e==`object`?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e)){var n=e;return n.map(function(e){return t.coerceString(e)}).filter(Boolean)}var r=String(e);try{var i=JSON.parse(r);if(Array.isArray(i)){var n=e;return n.map(function(e){return t.coerceString(e)}).filter(Boolean)}else{var a=this.coerceString(r);return a?[a]:void 0}}catch{var a=this.coerceString(r);return a?[a]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case q.SET_IS:case q.SET_IS_NOT:case q.SET_CONTAINS:case q.SET_DOES_NOT_CONTAIN:case q.SET_CONTAINS_ANY:case q.SET_DOES_NOT_CONTAIN_ANY: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&&Yd([],Jd(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=qd(t),a=i.next();!a.done;a=i.next()){var o=a.value;if(!this.matchesIs(o,e))return!1}}catch(e){n={error:e}}finally{try{a&&!a.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=qd(t),a=i.next();!a.done;a=i.next()){var o=a.value;if(this.matchesIs(o,e))return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e}(),mf=function(e,t){var n,r,i=Wd({},e),a=[],o=t||Object.keys(i);try{for(var s=qd(o),c=s.next();!c.done;c=s.next()){var l=c.value,u=hf(l,i);u&&a.push.apply(a,Yd([],Jd(u),!1))}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a},hf=function(e,t,n){var r,i;n===void 0&&(n=[]);var a=t[e];if(a){if(!a.dependencies||a.dependencies.length===0)return delete t[a.key],[a];n.push(a.key);var o=[],s=function(e){if(n.some(function(t){return t===e}))throw Error(`Detected a cycle between flags ${n}`);var r=hf(e,t,n);r&&o.push.apply(o,Yd([],Jd(r),!1))};try{for(var c=qd(a.dependencies),l=c.next();!l.done;l=c.next()){var u=l.value;s(u)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return o.push(a),n.pop(),delete t[a.key],o}},gf=`3.7.7`,_f=gf,vf=typeof Buffer==`function`,yf=typeof TextDecoder==`function`?new TextDecoder:void 0,bf=typeof TextEncoder==`function`?new TextEncoder:void 0,xf=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),Sf=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(xf),Cf=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,wf=String.fromCharCode.bind(String),Tf=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),Ef=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),Df=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),Of=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=xf[t>>18&63]+xf[t>>12&63]+xf[t>>6&63]+xf[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},kf=typeof btoa==`function`?e=>btoa(e):vf?e=>Buffer.from(e,`binary`).toString(`base64`):Of,Af=vf?e=>Buffer.from(e).toString(`base64`):e=>{let t=4096,n=[];for(let r=0,i=e.length;r<i;r+=t)n.push(wf.apply(null,e.subarray(r,r+t)));return kf(n.join(``))},jf=(e,t=!1)=>t?Ef(Af(e)):Af(e),Mf=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?wf(192|t>>>6)+wf(128|t&63):wf(224|t>>>12&15)+wf(128|t>>>6&63)+wf(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return wf(240|t>>>18&7)+wf(128|t>>>12&63)+wf(128|t>>>6&63)+wf(128|t&63)}},Nf=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Pf=e=>e.replace(Nf,Mf),Ff=vf?e=>Buffer.from(e,`utf8`).toString(`base64`):bf?e=>Af(bf.encode(e)):e=>kf(Pf(e)),If=(e,t=!1)=>t?Ef(Ff(e)):Ff(e),Lf=e=>If(e,!0),Rf=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,zf=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 wf((t>>>10)+55296)+wf((t&1023)+56320);case 3:return wf((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return wf((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Bf=e=>e.replace(Rf,zf),Vf=e=>{if(e=e.replace(/\s+/g,``),!Cf.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n=``,r,i;for(let a=0;a<e.length;)t=Sf[e.charAt(a++)]<<18|Sf[e.charAt(a++)]<<12|(r=Sf[e.charAt(a++)])<<6|(i=Sf[e.charAt(a++)]),n+=r===64?wf(t>>16&255):i===64?wf(t>>16&255,t>>8&255):wf(t>>16&255,t>>8&255,t&255);return n},Hf=typeof atob==`function`?e=>atob(Df(e)):vf?e=>Buffer.from(e,`base64`).toString(`binary`):Vf,Uf=vf?e=>Tf(Buffer.from(e,`base64`)):e=>Tf(Hf(e).split(``).map(e=>e.charCodeAt(0))),Wf=e=>Uf(Kf(e)),Gf=vf?e=>Buffer.from(e,`base64`).toString(`utf8`):yf?e=>yf.decode(Uf(e)):e=>Bf(Hf(e)),Kf=e=>Df(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),qf=e=>Gf(Kf(e)),Jf=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},Yf=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),Xf=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,Yf(t));e(`fromBase64`,function(){return qf(this)}),e(`toBase64`,function(e){return If(this,e)}),e(`toBase64URI`,function(){return If(this,!0)}),e(`toBase64URL`,function(){return If(this,!0)}),e(`toUint8Array`,function(){return Wf(this)})},Zf=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Yf(t));e(`toBase64`,function(e){return jf(this,e)}),e(`toBase64URI`,function(){return jf(this,!0)}),e(`toBase64URL`,function(){return jf(this,!0)})},Qf={version:gf,VERSION:_f,atob:Hf,atobPolyfill:Vf,btoa:kf,btoaPolyfill:Of,fromBase64:qf,toBase64:If,encode:If,encodeURI:Lf,encodeURL:Lf,utob:Pf,btou:Bf,decode:qf,isValid:Jf,fromUint8Array:jf,toUint8Array:Wf,extendString:Xf,extendUint8Array:Zf,extendBuiltins:()=>{Xf(),Zf()}},$f=function(e){Ud(t,e);function t(n,r){var i=e.call(this,r)||this;return i.statusCode=n,Object.setPrototypeOf(i,t.prototype),i}return t}(Error),ep=function(e){Ud(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t}(Error),tp=function(){function e(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}return e.prototype.getVariants=function(e,t){return Gd(this,void 0,void 0,function(){var n,r,i,a;return Kd(this,function(o){switch(o.label){case 0:return n=Qf.encodeURL(JSON.stringify(e)),r={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-User":n},t?.flagKeys&&(r[`X-Amp-Exp-Flag-Keys`]=Qf.encodeURL(JSON.stringify(t.flagKeys))),t?.trackingOption&&(r[`X-Amp-Exp-Track`]=t.trackingOption),i=new URL(`${this.serverUrl}/sdk/v2/vardata?v=0`),t?.evaluationMode&&i.searchParams.append(`eval_mode`,t?.evaluationMode),t?.deliveryMethod&&i.searchParams.append(`delivery_method`,t?.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:`GET`,headers:r,timeoutMillis:t?.timeoutMillis})];case 1:if(a=o.sent(),a.status!=200)throw new $f(a.status,`Fetch error response: status=${a.status}`);return[2,JSON.parse(a.body)]}})})},e}(),np=function(){function e(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}return e.prototype.getFlags=function(e){return Gd(this,void 0,void 0,function(){var t,n,r;return Kd(this,function(i){switch(i.label){case 0:return t={Authorization:`Api-Key ${this.deploymentKey}`},e?.libraryName&&e?.libraryVersion&&(t[`X-Amp-Exp-Library`]=`${e.libraryName}/${e.libraryVersion}`),e?.user&&(t[`X-Amp-Exp-User`]=Qf.encodeURL(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:`${this.serverUrl}/sdk/v2/flags`+(e?.deliveryMethod?`?delivery_method=${e.deliveryMethod}`:``),method:`GET`,headers:t,timeoutMillis:e?.timeoutMillis})];case 1:if(n=i.sent(),n.status!=200)throw Error(`Flags error response: status=${n.status}`);return r=JSON.parse(n.body),[2,r.reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),J=typeof globalThis<`u`?globalThis:global||self,rp=function(){if(typeof globalThis<`u`)return globalThis;if(typeof window<`u`)return window;if(typeof self<`u`)return self;if(typeof global<`u`)return global},ip=function(){var e=rp();if(e)try{var t=`EXP_test`;return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch{return!1}return!1},ap=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=J.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&=(J.clearInterval(this.poller),void 0)},e}(),op=t(((e,t)=>{(function(n,r){var i=`0.7.33`,a=``,o=`?`,s=`function`,c=`undefined`,l=`object`,u=`string`,d=`major`,f=`model`,p=`name`,m=`type`,h=`vendor`,g=`version`,_=`architecture`,v=`console`,y=`mobile`,b=`tablet`,x=`smarttv`,S=`wearable`,C=`embedded`,w=350,T=`Amazon`,E=`Apple`,D=`ASUS`,O=`BlackBerry`,k=`Browser`,A=`Chrome`,j=`Edge`,M=`Firefox`,N=`Google`,P=`Huawei`,ee=`LG`,te=`Microsoft`,F=`Motorola`,ne=`Opera`,I=`Samsung`,L=`Sharp`,R=`Sony`,re=`Xiaomi`,ie=`Zebra`,ae=`Facebook`,oe=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},z=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},se=function(e,t){return typeof e===u?ce(t).indexOf(ce(e))!==-1:!1},ce=function(e){return e.toLowerCase()},le=function(e){return typeof e===u?e.replace(/[^\d\.]/g,a).split(`.`)[0]:r},ue=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,a),typeof t===c?e:e.substring(0,w)},de=function(e,t){for(var n=0,i,a,o,c,u,d;n<t.length&&!u;){var f=t[n],p=t[n+1];for(i=a=0;i<f.length&&!u;)if(u=f[i++].exec(e),u)for(o=0;o<p.length;o++)d=u[++a],c=p[o],typeof c===l&&c.length>0?c.length===2?typeof c[1]==s?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:c.length===3?typeof c[1]===s&&!(c[1].exec&&c[1].test)?this[c[0]]=d?c[1].call(this,d,c[2]):r:this[c[0]]=d?d.replace(c[1],c[2]):r:c.length===4&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):r):this[c]=d||r;n+=2}},fe=function(e,t){for(var n in t)if(typeof t[n]===l&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(se(t[n][i],e))return n===o?r:n}else if(se(t[n],e))return n===o?r:n;return e},pe={"1.0":`/8`,1.2:`/1`,1.3:`/3`,"2.0":`/412`,"2.0.2":`/416`,"2.0.3":`/417`,"2.0.4":`/419`,"?":`/`},B={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`},me={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[p,`Chrome`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[p,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,g],[/opios[\/ ]+([\w\.]+)/i],[g,[p,ne+` Mini`]],[/\bopr\/([\w\.]+)/i],[g,[p,ne]],[/(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],[p,g],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[p,`UC`+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[g,[p,`WeChat(Win) Desktop`]],[/micromessenger\/([\w\.]+)/i],[g,[p,`WeChat`]],[/konqueror\/([\w\.]+)/i],[g,[p,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[p,`IE`]],[/yabrowser\/([\w\.]+)/i],[g,[p,`Yandex`]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,`$1 Secure `+k],g],[/\bfocus\/([\w\.]+)/i],[g,[p,M+` Focus`]],[/\bopt\/([\w\.]+)/i],[g,[p,ne+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[g,[p,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[g,[p,`Dolphin`]],[/coast\/([\w\.]+)/i],[g,[p,ne+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[g,[p,`MIUI `+k]],[/fxios\/([-\w\.]+)/i],[g,[p,M]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,`360 `+k
vendor: 4,440 bytes, line 12
12]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[p,/(.+)/,`$1 `+k],g],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g,` `],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,g],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,ae],g],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[p,`GSA`]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[p,A+` Headless`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,A+` WebView`],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[p,`Android `+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[p,`Mobile Safari`]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[g,fe,pe]],[/(webkit|khtml)\/([\w\.]+)/i],[p,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,`Netscape`],g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[p,M+` 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],[p,g],[/(cobalt)\/([\w\.]+)/i],[p,[g,/master.|lts./,``]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[_,`amd64`]],[/(ia32(?=;))/i],[[_,ce]],[/((?:i[346]|x)86)[;\)]/i],[[_,`ia32`]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[_,`arm64`]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[_,`armhf`]],[/windows (ce|mobile); ppc;/i],[[_,`arm`]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[_,/ower/,a,ce]],[/(sun4\w)[;\)]/i],[[_,`sparc`]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[_,ce]]],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],[f,[h,I],[m,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[f,[h,I],[m,y]],[/((ipod|iphone)\d+,\d+)/i],[f,[h,E],[m,y]],[/(ipad\d+,\d+)/i],[f,[h,E],[m,b]],[/\((ip(?:hone|od)[\w ]*);/i],[f,[h,E],[m,y]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[h,E],[m,b]],[/(macintosh);/i],[f,[h,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[f,[h,P],[m,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[h,P],[m,y]],[/\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],[[f,/_/g,` `],[h,re],[m,y]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[f,/_/g,` `],[h,re],[m,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[h,`OPPO`],[m,y]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[h,`Vivo`],[m,y]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[f,[h,`Realme`],[m,y]],[/\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],[f,[h,F],[m,y]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[h,F],[m,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[h,ee],[m,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[h,ee],[m,y]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[f,[h,`Lenovo`],[m,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[f,/_/g,` `],[h,`Nokia`],[m,y]],[/(pixel c)\b/i],[f,[h,N],[m,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[h,N],[m,y]],[/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],[f,[h,R],[m,y]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,`Xperi
12a Tablet`],[h,R],[m,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[h,`OnePlus`],[m,y]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[h,T],[m,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,`Fire Phone $1`],[h,T],[m,y]],[/(playbook);[-\w\),; ]+(rim)/i],[f,h,[m,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[h,O],[m,y]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[h,D],[m,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[h,D],[m,y]],[/(nexus 9)/i],[f,[h,`HTC`],[m,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[f,/_/g,` `],[m,y]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[h,`Acer`],[m,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[h,`Meizu`],[m,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[h,L],[m,y]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,f,[m,y]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,f,[m,b]],[/(surface duo)/i],[f,[h,te],[m,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[h,`Fairphone`],[m,y]],[/(u304aa)/i],[f,[h,`AT&T`],[m,y]],[/\bsie-(\w*)/i],[f,[h,`Siemens`],[m,y]],[/\b(rct\w+) b/i],[f,[h,`RCA`],[m,b]],[/\b(venue[\d ]{2,7}) b/i],[f,[h,`Dell`],[m,b]],[/\b(q(?:mv|ta)\w+) b/i],[f,[h,`Verizon`],[m,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[h,`Barnes & Noble`],[m,b]],[/\b(tm\d{3}\w+) b/i],[f,[h,`NuVision`],[m,b]],[/\b(k88) b/i],[f,[h,`ZTE`],[m,b]],[/\b(nx\d{3}j) b/i],[f,[h,`ZTE`],[m,y]],[/\b(gen\d{3}) b.+49h/i],[f,[h,`Swiss`],[m,y]],[/\b(zur\d{3}) b/i],[f,[h,`Swiss`],[m,b]],[/\b((zeki)?tb.*\b) b/i],[f,[h,`Zeki`],[m,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,`Dragon Touch`],f,[m,b]],[/\b(ns-?\w{0,9}) b/i],[f,[h,`Insignia`],[m,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[h,`NextBook`],[m,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,`Voice`],f,[m,y]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,`LvTel`],f,[m,y]],[/\b(ph-1) /i],[f,[h,`Essential`],[m,y]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[h,`Envizen`],[m,b]],[/\b(trio[-\w\. ]+) b/i],[f,[h,`MachSpeed`],[m,b]],[/\btu_(1491) b/i],[f,[h,`Rotor`],[m,b]],[/(shield[\w ]+) b/i],[f,[h,`Nvidia`],[m,b]],[/(sprint) (\w+)/i],[h,f,[m,y]],[/(kin\.[onetw]{3})/i],[[f,/\./g,` `],[h,te],[m,y]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[h,ie],[m,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[h,ie],[m,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,f,[m,v]],[/droid.+; (shield) bui/i],[f,[h,`Nvidia`],[m,v]],[/(playstation [345portablevi]+)/i],[f,[h,R],[m,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[h,te],[m,v]],[/smart-tv.+(samsung)/i],[h,[m,x]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,`SmartTV`],[h,I],[m,x]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,ee],[m,x]],[/(apple) ?tv/i],[h,[f,E+` TV`],[m,x]],[/crkey/i],[[f,A+`cast`],[h,N],[m,x]],[/droid.+aft(\w)( bui|\))/i],[f,[h,T],[m,x]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[h,L],[m,x]],[/(bravia[\w ]+)( bui|\))/i],[f,[h,R],[m,x]],[/(mitv-\w{5}) bui/i],[f,[h,re],[m,x]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[h,ue],[f,ue],[m,x]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,x]],[/((pebble))app/i],[h,f,[m,S]],[/droid.+; (glass) \d/i],[f,[h,N],[m,S]],[/droid.+; (wt63?0{2,3})\)/i],[f,[h,ie],[m,S]],[/(quest( 2)?)/i],[f,[h,ae],[m,S]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[m,C]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[f,[m,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[m,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,y]],[/(android[-\w\. ]{0,9});.+buil/i],[f,[h,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[p,j+`HTML`]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[p,`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],[p,g],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,g],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[g,fe,B]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,`Windows`],[g,fe,B]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,`.`],[p,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,`Mac OS`],[g,/_/g,`.`]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,g],[/\(bb(10);/i],[g,[p,O]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[g,[p,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[p,M+` OS`]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[p,`webOS`]],[/crkey\/([\d\.]+)/i],[g,[p,A+`cast`]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[p,`Chromium OS`],g],[/(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],[p,g],[/(sunos) ?([\w\.\d]*)/i],[[p,`Solaris`],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[p,g]]},he=function(e,t){if(typeof e===l&&(t=e,e=r),!(this instanceof he))return new he(e,t).getResult();var i=e||(typeof n!==c&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:a),o=t?oe(me,t):me;return this.getBrowser=function(){var e={};return e[p]=r,e[g]=r,de.call(e,i,o.browser),e.major=le(e.version),e},this.getCPU=function(){var e={};return e[_]=r,de.call(e,i,o.cpu),e},this.getDevice=function(){var e={};return e[h]=r,e[f]=r,e[m]=r,de.call(e,i,o.device),e},this.getEngine=function(){var e={};return e[p]=r,e[g]=r,de.call(e,i,o.engine),e},this.getOS=function(){var e={};return e[p]=r,e[g]=r,de.call(e,i,o.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 i},this.setUA=function(e){return i=typeof e===u&&e.length>w?ue(e,w):e,this},this.setUA(i),this};he.VERSION=i,he.BROWSER=z([p,g,d]),he.CPU=z([_]),he.DEVICE=z([f,h,m,v,y,x,b,S,C]),he.ENGINE=he.OS=z([p,g]),typeof e===c?typeof define===s&&define.amd?define(function(){return he}
12):typeof n!==c&&(n.UAParser=he):(typeof t!==c&&t.exports&&(e=t.exports=he),e.UAParser=he);var ge=typeof n!==c&&(n.jQuery||n.Zepto);if(ge&&!ge.ua){var _e=new he;ge.ua=_e.getResult(),ge.ua.get=function(){return _e.getUA()},ge.ua.set=function(e){_e.setUA(e);var t=_e.getResult();for(var n in t)ge.ua[n]=t[n]}}})(typeof window==`object`?window:e)}))();(function(){function e(e){this.amplitudeInstance=e}return e.prototype.getUser=function(){return{device_id:this.amplitudeInstance?.options?.deviceId,user_id:this.amplitudeInstance?.options?.userId,version:this.amplitudeInstance?.options?.versionName,language:this.amplitudeInstance?.options?.language,platform:this.amplitudeInstance?.options?.platform,os:this.getOs(),device_model:this.getDeviceModel()}},e.prototype.getOs=function(){return[this.amplitudeInstance?._ua?.browser?.name,this.amplitudeInstance?._ua?.browser?.major].filter(function(e){return e!=null}).join(` `)},e.prototype.getDeviceModel=function(){return this.amplitudeInstance?._ua?.os?.name},e})(),function(){function e(e){this.amplitudeInstance=e}return e.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},e.prototype.setUserProperty=function(e){var t;this.amplitudeInstance.setUserProperties((t={},t[e.userProperty]=e.variant?.value,t))},e.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent(`$identify`,null,null,{$unset:(t={},t[e.userProperty]=`-`,t)})},e}();var Y=function(){return Y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Y.apply(this,arguments)};function X(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Z(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function sp(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)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 cp(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function lp(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var up=function(e,t){var n,r;t===void 0&&(t=!1);var i=pp(e,t),a=void 0,o=J.document.cookie.split(`; `);try{for(var s=sp(o),c=s.next();!c.done;c=s.next()){var l=c.value,u=cp(l.split(`=`,2),2),d=u[0],f=u[1];d===i&&(a=decodeURIComponent(f))}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}
vendor: 22,130 bytes, line 12
12if(a)try{if(t){var p=atob(a);return JSON.parse(decodeURIComponent(p))}var m=a.split(`.`),h=void 0;return m.length>=2&&m[1]&&(h=atob(m[1])),{deviceId:m[0],userId:h}}catch{return}},dp=function(e){var t=pp(e,!0);try{var n=J.localStorage.getItem(t);if(!n)return;var r=JSON.parse(n);return typeof r==`object`?r:void 0}catch{return}},fp=function(e){var t=pp(e,!0);try{var n=J.sessionStorage.getItem(t);if(!n)return;var r=JSON.parse(n);return typeof r==`object`?r:void 0}catch{return}},pp=function(e,t){if(t)return e?.length<10?void 0:`AMP_${e.substring(0,10)}`;if(!(e?.length<6))return`amp_${e.substring(0,6)}`},mp=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 X(this,void 0,void 0,function(){return Z(this,function(n){return e?.automaticFetchOnAmplitudeIdentityChange&&this.identityStore.addIdentityListener(function(){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):!1},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith(`client-`))return!1;var e=up(this.apiKey,!0);return e||(e=up(this.apiKey,!1),e)||(e=dp(this.apiKey),e)||(e=fp(this.apiKey),e)?(this.commitIdentityToConnector(e),!0):!1},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 X(this,void 0,void 0,function(){var t,n=this;return Z(this,function(r){return t=this.identityStore.getIdentity(),!t.userId&&!t.deviceId?[2,Promise.race([new Promise(function(e){var t=function(){e(),n.identityStore.removeIdentityListener(t)};n.identityStore.addIdentityListener(t)}),new Promise(function(t,n){J.setTimeout(n,e,`Timed out waiting for Amplitude Analytics SDK to initialize.`)})])]:[2]})})},e}();function hp(e,t){return t||={},new Promise(function(n,r){var i=new XMLHttpRequest,a=[],o=[],s={},c=function(){return{ok:(i.status/100|0)==2,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:c,headers:{keys:function(){return a},entries:function(){return o},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};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){a.push(t=t.toLowerCase()),o.push([t,n]),s[t]=s[t]?s[t]+`,`+n:n}),n(c())},i.onerror=r,i.withCredentials=t.credentials==`include`,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)})}var gp=J.fetch||hp,_p=function(e,t){return t==null||t<=0?e:new Promise(function(n,r){J.setTimeout(function(){r(new ep(`Request timeout after `+t+` milliseconds`))},t),e.then(n,r)})},vp=function(e,t,n,r,i){return _p(function(){return X(void 0,void 0,void 0,function(){var i,a,o;return Z(this,function(s){switch(s.label){case 0:return[4,gp(e,{method:t,headers:n,body:r})];case 1:return i=s.sent(),o={status:i.status},[4,i.text()];case 2:return a=(o.body=s.sent(),o),[2,a]}})})}(),i)},yp=function(){function e(e){this.client=e}return e.prototype.request=function(e){return X(this,void 0,void 0,function(){return Z(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}(),bp={request:vp},xp;(function(e){e.LocalStorage=`localStorage`,e.InitialVariants=`initialVariants`})(xp||={});var Q;(function(e){e.LocalStorage=`storage`,e.InitialVariants=`initial`,e.SecondaryLocalStorage=`secondary-storage`,e.SecondaryInitialVariants=`secondary-initial`,e.FallbackInline=`fallback-inline`,e.FallbackConfig=`fallback-config`,e.LocalEvaluation=`local-evaluation`})(Q||={});var Sp=function(e){return!e||e===Q.FallbackInline||e===Q.FallbackConfig||e===Q.SecondaryInitialVariants},Cp={debug:!1,instanceName:`$default_instance`,fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:xp.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:bp},wp=`1.18.0`,Tp=512,Ep=function(){function e(e,t){var n=this;this.isReady=new Promise(function(e){n.resolve=e}),this.config=e,this.client=t;var r=e.instanceName??Cp.instanceName;this.queue=new Op(r),this.cache=new Dp(r)}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){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t={eventType:`$exposure`,eventProperties:e};return e.metadata?.exposureEvent?t={eventType:e.metadata?.exposureEvent,eventProperties:e}:e.metadata?.deliveryMethod===`web`&&(t={eventType:`$impression`,eventProperties:e}),t},e}(),Dp=function(){function e(e){this.isSessionStorageAvailable=kp(),this.inMemoryCache={},this.storageKey=`EXP_sent_v2_${e}`,this.isSessionStorageAvailable&&J.sessionStorage.removeItem(`EXP_sent_${e}`)}return e.prototype.shouldTrack=function(e){if(e.metadata?.deliveryMethod===`web`)return!0;this.loadCache();var t=this.inMemoryCache[e.flag_key],n=!1;return(!t||t.variant!==e.variant)&&(n=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),n},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=J.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&J.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),Op=function(){function e(e,t){t===void 0&&(t=Tp),this.isLocalStorageAvailable=ip(),this.inMemoryQueue=[],this.storageKey=`EXP_unsent_${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=J.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&this.inMemoryQueue.length!==0){try{for(var n=sp(this.inMemoryQueue),r=n.next();!r.done;r=n.next()){var i=r.value;try{if(!this.tracker(i))return}catch{return}}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&=(J.clearInterval(this.poller),void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=J.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)),J.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),kp=function(){var e=rp();if(e)try{var t=`EXP_test`;return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch{return!1}return!1},Ap=function(){function e(){this.globalScope=rp()}return e.prototype.get=function(e){return this.globalScope?.localStorage.getItem(e)},e.prototype.put=function(e,t){var n;(n=this.globalScope)==null||n.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;(t=this.globalScope)==null||t.localStorage.removeItem(e)},e}(),jp=function(e,t,n){return new Np(`amp-exp-${t}-${e.substring(e.length-6)}`,n,Pp)},Mp=function(e,t,n){return n===void 0&&(n=new Ap),new Np(`amp-exp-${t}-${e.substring(e.length-6)}-flags`,n)},Np=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 Y({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,n;try{for(var r=sp(Object.keys(e)),i=r.next();!i.done;i=r.next()){var a=i.value;this.cache[a]=e[a]}}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=this.storage.get(this.namespace),r;try{r=JSON.parse(n)||{}}catch{return}var i={};try{for(var a=sp(Object.keys(r)),o=a.next();!o.done;o=a.next()){var s=o.value;try{var c=void 0;c=this.transformer?this.transformer(r[s]):r[s],c&&(i[s]=c)}catch{}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){e===void 0&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),Pp=function(e){if(typeof e==`string`)return{key:e,value:e};if(typeof e==`object`){var t=e.key,n=e.value,r=e.payload,i=e.metadata,a=e.expKey;i&&i.experimentKey?a=i.experimentKey:a&&(i||={},i.experimentKey=a);var o={};return t?o.key=t:n&&(o.key=n),n&&(o.value=n),i&&(o.metadata=i),r&&(o.payload=r),a&&(o.expKey=a),o}},Fp=function(){function e(){this.globalScope=rp()}return e.prototype.get=function(e){return this.globalScope?.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var n;(n=this.globalScope)==null||n.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;(t=this.globalScope)==null||t.sessionStorage.removeItem(e)},e}(),Ip=function(e,t,n,r){var i,a=`[Experiment] Exposure`,o=n?.value,s=`[Experiment] ${t}`;return{name:a,user:e,key:t,variant:n,userProperty:s,properties:{key:t,variant:o,source:r},userProperties:(i={},i[s]=o,i)}},Lp=function(e){return e==null},Rp=function(e){return Lp(e)?!0:e&&Object.keys(e).length===0},zp=function(e){var t,n;if(!e||typeof e!=`object`)return{};var r={};try{for(var i=sp(Object.entries(e)),a=i.next();!a.done;a=i.next()){var o=cp(a.value,2),s=o[0],c=o[1];Lp(c)||(r[s]=c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r},Bp=function(e){return e?.metadata?.evaluationMode===`local`},Vp=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 X(this,void 0,void 0,function(){return Z(this,function(t){switch(t.label){case 0:if(!this.started)this.started=!0;else throw Error(`Backoff already started`);return[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 X(this,void 0,void 0,function(){var r=this;return Z(this,function(i){return this.done||(this.timeoutHandle=J.setTimeout(function(){return X(r,void 0,void 0,function(){var r,i;return Z(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e()];case 1:return a.sent(),[3,3];case 2:return a.sent(),r=t+1,r<this.attempts&&(i=Math.min(n*this.scalar,this.max),this.backoff(e,r,i)),[3,3];case 3:return[2]}})})},n)),[2]})})},e}(),Hp=function(e){var t,n;if(!e)return{};var r={user:e},i=rp();i&&(r.page={url:i.location.href});var a={};if(!e.groups)return r;try{for(var o=sp(Object.keys(e.groups)),s=o.next();!s.done;s=o.next()){var c=s.value,l=e.groups[c];if(l.length>0&&l[0]){var u=l[0],d={group_name:u},f=e.group_properties?.[c]?.[u];f&&Object.keys(f).length>0&&(d.group_properties=f),a[c]=d}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(r.groups=a),delete r.user.groups,delete r.user.group_properties,r},Up=function(e){return e==null?{}:typeof e==`string`?{key:e,value:e}:e},Wp=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},Gp=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}(),Kp=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var n={userId:t?.user_id,deviceId: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}(),qp=1e4,Jp=8,Yp=500,Xp=1e4,Zp=1.5,Qp=6e4,$p=`https://api.lab.eu.amplitude.com`,em=`https://flag.lab.eu.amplitude.com`,tm=function(){function e(e,t){var n=this;this.engine=new pf,this.isRunning=!1,this.apiKey=e,t=zp(t),this.config=Y(Y(Y({},Cp),t),{serverUrl:t?.serverUrl||((t?.serverZone)?.toLowerCase()===`eu`?$p:Cp.serverUrl),flagsServerUrl:t?.flagsServerUrl||((t?.serverZone)?.toLowerCase()===`eu`?em:Cp.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<Qp?Qp:t.flagConfigPollingIntervalMillis??Cp.flagConfigPollingIntervalMillis});var r=this.config?.internalInstanceNameSuffix;if(this.isWebExperiment=r===`web`,this.poller=new ap(function(){return n.doFlags()},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var i in this.config.initialVariants)this.config.initialVariants[i]=Pp(this.config.initialVariants[i]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new Gp(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new Kp(this.config.exposureTrackingProvider)),this.integrationManager=new Ep(this.config,this);var a=new yp(this.config.httpClient||bp);this.flagApi=new np(this.apiKey,this.config.flagsServerUrl,a),this.evaluationApi=new tp(this.apiKey,this.config.serverUrl,a);var o,s=r?`${this.config.instanceName}-${r}`:this.config.instanceName;o=this.isWebExperiment?new Fp:new Ap,this.variants=jp(this.apiKey,s,o),this.flags=Mp(this.apiKey,s,o);try{this.flags.load(),this.variants.load()}catch{}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return X(this,void 0,void 0,function(){var t,n,r;return Z(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:return i.trys.push([1,6,,7]),t=this.doFlags(),n=this.config.fetchOnStart??!0,n?[4,Promise.all([this.fetch(e),t])]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(r=i.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&=(this.poller.stop(),!1)},e.prototype.fetch=function(){return X(this,arguments,void 0,function(e,t){var n;return e===void 0&&(e=this.user),Z(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 this.config.debug&&(n instanceof ep?console.debug(n):console.error(n)),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){if(!this.apiKey)return{value:void 0};var n=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,n),this.debug(`[Experiment] variant for ${e} is ${n.variant?.key||n.variant?.value}`),n.variant||{}},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)Bp(this.flags.get(t))||delete e[t];return Y(Y(Y({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch{}},e.prototype.getUser=function(){if(!this.user)return this.user;if(this.user?.user_properties){var e=Y({},this.user.user_properties);return Y(Y({},this.user),{user_properties:e})}else return Y({},this.user)},e.prototype.setUser=function(e){if(!e){this.user=null;return}if(this.user?.user_properties){var t=Y({},e.user_properties);this.user=Y(Y({},e),{user_properties:t})}else this.user=Y({},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=mf(this.flags.getAll(),e),a=Hp(r),o=this.engine.evaluate(a,i),s={};try{for(var c=sp(Object.keys(o)),l=c.next();!l.done;l=c.next()){var u=l.value;s[u]=Wp(o[u])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return s},e.prototype.variantAndSource=function(e,t){var n={};this.config.source===xp.LocalStorage?n=this.localStorageVariantAndSource(e,t):this.config.source===xp.InitialVariants&&(n=this.initialVariantsVariantAndSource(e,t));var r=this.flags.get(e);return(Bp(r)||!n.variant&&r)&&(n=this.localEvaluationVariantAndSource(e,r,t)),n},e.prototype.localEvaluationVariantAndSource=function(e,t,n){var r={},i=this.evaluate([t.key])[e],a=Q.LocalEvaluation,o=i?.metadata?.default;if(!Lp(i)&&!o)return{variant:Up(i),source:a,hasDefaultVariant:!1};if(o&&(r={variant:Up(i),source:a,hasDefaultVariant:!0}),!Lp(n))return{variant:Up(n),source:Q.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};var s=this.config.initialVariants[e];if(!Lp(s))return{variant:Up(s),source:Q.SecondaryInitialVariants,hasDefaultVariant:r.hasDefaultVariant};var c=Up(this.config.fallbackVariant),l={variant:c,source:Q.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return Rp(c)?r:l},e.prototype.localStorageVariantAndSource=function(e,t){var n={},r=this.variants.get(e),i=r?.metadata?.default;if(!Lp(r)&&!i)return{variant:Up(r),source:Q.LocalStorage,hasDefaultVariant:!1};if(i&&(n={variant:Up(r),source:Q.LocalStorage,hasDefaultVariant:!0}),!Lp(t))return{variant:Up(t),source:Q.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=this.config.initialVariants[e];if(!Lp(a))return{variant:Up(a),source:Q.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var o=Up(this.config.fallbackVariant),s={variant:o,source:Q.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return Rp(o)?n:s},e.prototype.initialVariantsVariantAndSource=function(e,t){var n={},r=this.config.initialVariants[e];if(!Lp(r))return{variant:Up(r),source:Q.InitialVariants,hasDefaultVariant:!1};var i=this.variants.get(e),a=i?.metadata?.default;if(!Lp(i)&&!a)return{variant:Up(i),source:Q.LocalStorage,hasDefaultVariant:!1};if(a&&(n={variant:Up(i),source:Q.LocalStorage,hasDefaultVariant:!0}),!Lp(t))return{variant:Up(t),source:Q.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var o=Up(this.config.fallbackVariant),s={variant:o,source:Q.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return Rp(o)?n:s},e.prototype.fetchInternal=function(e,t,n,r){return X(this,void 0,void 0,function(){var i,a;return Z(this,function(o){switch(o.label){case 0:if(!this.apiKey)throw Error(`Experiment API key is empty`);this.debug(`[Experiment] Fetch all: retry=${n}`),n&&this.stopRetries(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,this.doFetch(e,t,r)];case 2:return i=o.sent(),[4,this.storeVariants(i,r)];case 3:return o.sent(),[2,i];case 4:throw a=o.sent(),n&&this.shouldRetryFetch(a)&&this.startRetries(e,r),a;case 5:return[2]}})})},e.prototype.cleanUserPropsForFetch=function(e){var t=Y({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,n){return X(this,void 0,void 0,function(){var r,i,a,o,s,c,l;return Z(this,function(u){switch(u.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=u.sent(),e=this.cleanUserPropsForFetch(e),this.debug(`[Experiment] Fetch variants for user: `,e),[4,this.evaluationApi.getVariants(e,Y({timeoutMillis:t},n))];case 2:r=u.sent(),i={};try{for(a=sp(Object.keys(r)),o=a.next();!o.done;o=a.next())s=o.value,i[s]=Wp(r[s])}catch(e){c={error:e}}finally{try{o&&!o.done&&(l=a.return)&&l.call(a)}finally{if(c)throw c.error}}
12return this.debug(`[Experiment] Received variants: `,i),[2,i]}})})},e.prototype.doFlags=function(){return X(this,void 0,void 0,function(){var e,t,n;return Z(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=r.sent(),r.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:`experiment-js-client`,libraryVersion:wp,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?`web`:void 0,user:e?.user_id||e?.device_id?{user_id:e?.user_id,device_id: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(),n instanceof ep){if(this.config.debug&&console.debug(n),this.config.throwOnError)throw n}else throw n;return[3,5];case 5:try{this.flags.store()}catch{}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return X(this,void 0,void 0,function(){var n,r,i,a,a;return Z(this,function(o){for(a in n=t&&t.flagKeys?t.flagKeys:[],n.length===0&&this.variants.clear(),r=function(t){n=n.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)r(a);for(a in n)this.variants.remove(a);try{this.variants.store()}catch{}return this.debug(`[Experiment] Stored variants: `,e),[2]})})},e.prototype.startRetries=function(e,t){return X(this,void 0,void 0,function(){var n=this;return Z(this,function(r){return this.debug(`[Experiment] Retry fetch`),this.retriesBackoff=new Vp(Jp,Yp,Xp,Zp),this.retriesBackoff.start(function(){return X(n,void 0,void 0,function(){return Z(this,function(n){switch(n.label){case 0:return[4,this.fetchInternal(e,qp,!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=this.userProvider?.getUser(),n=this.integrationManager.getUser(),r=Y(Y(Y({},t?.user_properties),n.user_properties),e?.user_properties);return Y(Y(Y(Y({library:`experiment-js-client/${wp}`},t),n),e),{user_properties:r})},e.prototype.addContextOrWait=function(e){return X(this,void 0,void 0,function(){return Z(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(){if(this.config.source==xp.LocalStorage)return this.variants.getAll();if(this.config.source==xp.InitialVariants)return this.config.initialVariants},e.prototype.secondaryVariants=function(){if(this.config.source==xp.LocalStorage)return this.config.initialVariants;if(this.config.source==xp.InitialVariants)return this.variants.getAll()},e.prototype.exposureInternal=function(e,t){var n;if(t.variant?.metadata?.trackExposure??!0){this.legacyExposureInternal(e,t.variant,t.source);var r={flag_key:e},i=Sp(t.source);if(!(i&&!t.hasDefaultVariant)){t.variant?.expKey&&(r.experiment_key=t.variant?.expKey);var a=t.variant?.metadata;if(!i&&!a?.default&&(t.variant?.key?r.variant=t.variant.key:t.variant?.value&&(r.variant=t.variant.value)),a&&(r.metadata=a),this.isWebExperiment){var o=rp();if(o?.location)try{var s=o.location.href;r.metadata.url=s.split(`?`)[0]||``}catch{}}var c=this.addContext(this.getUser());(n=this.userSessionExposureTracker)==null||n.track(r,c),this.integrationManager.track(r)}}},e.prototype.legacyExposureInternal=function(e,t,n){var r,i,a,o,s;if(this.analyticsProvider){var c=Ip(this.addContext(this.getUser()),e,t,n);Sp(n)||!t?.value?(i=(r=this.analyticsProvider)?.unsetUserProperty)==null||i.call(r,c):t?.value&&((o=(a=this.analyticsProvider)?.setUserProperty)==null||o.call(a,c),(s=this.analyticsProvider)==null||s.track(c))}},e.prototype.debug=function(e){var t=[...arguments].slice(1);this.config.debug&&console.debug.apply(console,lp([e],cp(t),!1))},e.prototype.shouldRetryFetch=function(e){return e instanceof $f?e.statusCode<400||e.statusCode>=500||e.statusCode===429:!0},e.prototype.addPlugin=function(e){e.type===`integration`&&this.integrationManager.setIntegration(e)},e}(),nm=function(){function e(e,t){this.globalScope=rp(),this.userAgent=this.globalScope?.navigator===void 0?void 0:this.globalScope?.navigator.userAgent,this.ua=new op.UAParser(this.userAgent).getResult(),this.localStorage=new Ap,this.sessionStorage=new Fp,this.userProvider=e,this.apiKey=t,this.storageKey=`EXP_${this.apiKey?.slice(0,10)}_DEFAULT_USER_PROVIDER`}return e.prototype.getUser=function(){var e=this.userProvider?.getUser()||{};return Y({language:this.getLanguage(),platform:`Web`,os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:this.ua.device?.type??`desktop`,referring_url:(this.globalScope?.document)?.referrer.replace(/\/$/,``),cookie
12:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},e)},e.prototype.getLanguage=function(){return typeof navigator<`u`&&(navigator.languages&&navigator.languages[0]||navigator.language)||``},e.prototype.getOs=function(e){return[e.browser?.name,e.browser?.major].filter(function(e){return e!=null}).join(` `)},e.prototype.getDeviceModel=function(e){return e.os?.name},e.prototype.getBrowser=function(e){var t=e.browser?.name;return t?.includes(`Chrom`)&&(t=`Chrome`),t?.includes(`Firefox`)&&(t=`Firefox`),t?.includes(`Safari`)&&(t=`Safari`),t?.includes(`Edge`)&&(t=`Edge`),t?.includes(`Opera`)&&(t=`Opera`),t},e.prototype.getCookie=function(){if(this.globalScope?.document?.cookie)return Object.fromEntries((this.globalScope?.document?.cookie)?.split(`; `).map(function(e){return e.split(`=`)}))},e.prototype.getLandingUrl=function(){try{var e=JSON.parse(this.sessionStorage.get(this.storageKey)||`{}`);return e.landing_url||(e.landing_url=(this.globalScope?.location)?.href.replace(/\/$/,``),this.sessionStorage.put(this.storageKey,JSON.stringify(e))),e.landing_url}catch{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{return}},e.prototype.getUrlParam=function(){var e,t;if(this.globalScope){var n={};try{var r=new URL(this.globalScope.location.href);try{for(var i=sp(r.searchParams),a=i.next();!a.done;a=i.next()){var o=cp(a.value,2),s=o[0],c=o[1];n[s]=lp(lp([],cp(n[s]??[]),!1),cp(c.split(`,`)),!1)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}}catch{return}return Object.entries(n).reduce(function(e,t){var n=cp(t,2),r=n[0],i=n[1];return e[r]=i.length==1?i[0]:i,e},{})}},e}();J.experimentInstances={};var rm=J.experimentInstances,im=function(e,t){return cm(e,t,function(){return new mp(e,rt.getInstance(am(t)),1e4)})},am=function(e){return e?.instanceName||Cp.instanceName},om=function(e,t){var n=am(t),r=t?.internalInstanceNameSuffix;return r?`${n}.${e}.${r}`:`${n}.${e}`},sm=function(e,t){return new tm(e,Y(Y({},t),{userProvider:new nm(t?.userProvider,e)}))},cm=function(e,t,n){var r=om(e,t),i=rm[r];return i||(i=sm(e,t),n&&i.addPlugin(n()),rm[r]=i,i)};(function(){function e(){}return e.prototype.getUser=function(){return{}},e.prototype.start=function(e){return X(this,void 0,void 0,function(){return Z(this,function(e){return[2]})})},e.prototype.stop=function(){},e.prototype.setUser=function(e){},e.prototype.fetch=function(e,t){return X(this,void 0,void 0,function(){return Z(this,function(e){return[2,this]})})},e.prototype.getUserProvider=function(){return null},e.prototype.setUserProvider=function(e){return this},e.prototype.variant=function(e,t){return Cp.fallbackVariant},e.prototype.all=function(){return{}},e.prototype.clear=function(){},e.prototype.exposure=function(e){},e})(),o();var lm=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(t){return this.experiment=im(this.config?.deploymentKey||e.apiKey,this.config),[2]})})},e.pluginName=`@amplitude/experiment-analytics-plugin`,e}(),um=function(e){return new lm(e)},dm=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:fm(),platform:`Web`,os:void 0,deviceModel:void 0}},e}(),fm=function(){return typeof navigator<`u`&&(navigator.languages&&navigator.languages[0]||navigator.language)||``},pm=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}(),mm=function(){return mm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mm.apply(this,arguments)};function hm(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
12if(e&&typeof e.length==`number`)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 gm(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var _m=function(e,t){var n,r,i=[`string`,`number`,`boolean`,`undefined`],a=typeof e;if(a!==typeof t)return!1;try{for(var o=hm(i),s=o.next();!s.done;s=o.next())if(s.value===a)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(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;var c=Array.isArray(e),l=Array.isArray(t);if(c!==l)return!1;if(c&&l){for(var u=0;u<e.length;u++)if(!_m(e[u],t[u]))return!1}else{if(!_m(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var d=!0;return Object.keys(e).forEach(function(n){_m(e[n],t[n])||(d=!1)}),d}return!0},vm=`$set`,ym=`$unset`,bm=`$clearAll`;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 xm=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=mm({},this.identity.userProperties),n=mm(mm({},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,a,o,s,c=n.userProperties||{};try{for(var l=hm(Object.entries(e)),u=l.next();!u.done;u=l.next()){var d=gm(u.value,2),f=d[0],p=d[1];switch(f){case vm:try{for(var m=(i=void 0,hm(Object.entries(p))),h=m.next();!h.done;h=m.next()){var g=gm(h.value,2),_=g[0],v=g[1];c[_]=v}}catch(e){i={error:e}}finally{try{h&&!h.done&&(a=m.return)&&a.call(m)}finally{if(i)throw i.error}}break;case ym:try{for(var y=(o=void 0,hm(Object.keys(p))),b=y.next();!b.done;b=y.next()){var _=b.value;delete c[_]}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(o)throw o.error}}break;case bm:c={};break}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return n.userProperties=c,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return mm({},this.identity)},e.prototype.setIdentity=function(e){var t=mm({},this.identity);this.identity=mm({},e),_m(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}(),Sm=typeof globalThis<`u`?globalThis:typeof window<`u`?window:self,Cm=function(){function e(){this.identityStore=new xm,this.eventBridge=new pm,this.applicationContextProvider=new dm}return e.getInstance=function(t){return Sm.analyticsConnectorInstances||={},Sm.analyticsConnectorInstances[t]||(Sm.analyticsConnectorInstances[t]=new e),Sm.analyticsConnectorInstances[t]},e}(),wm=[`boot`],Tm=`$default_instance`;function Em(e){let t=typeof window<`u`?window.engagement:void 0,n={_q:t?._q??[],_configuration:{apiKey:t?._configuration?.apiKey??``,serverUrl:t?._configuration?.serverUrl,chatUrl:t?._configuration?.chatUrl,mediaUrl:t?._configuration?.mediaUrl,serverZone:t?._configuration?.serverZone??`US`,options:{...t?._configuration?.options}},_sentry:void 0,init(t,r){var i;if(n._configuration.apiKey){console.log(`Engagement SDK has already been initialized. Ignoring additional init call.`);return}n._configuration={...n._configuration,...r,apiKey:t,options:{splitting:!0,...n._configuration.options,...r?.options}},(i=n._configuration?.options)!=null&&i.logger&&n._configuration.options.logger.enable(n._configuration.options.logLevel??2);let a;if(r!=null&&r.cdnUrl)a=n._configuration.options.splitting?`${r.cdnUrl}/engagement-browser/prod/split/index.js`:r.cdnUrl+`/engagement-browser/prod/index.min.js.gz`;else{let e=n._configuration.serverZone===`EU`?`https://cdn.eu.amplitude.com`:`https://cdn.amplitude.com`;a=n._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let o=null,s=()=>
12{if(o&&=(clearTimeout(o),null),n._q&&n._q.length>0)for(console.warn(`Engagement SDK failed to load within ${c}ms. Resolving pending calls gracefully.`);n._q.length>0;){let e=n._q.shift();if(!e)continue;let t=e[0];if(wm.includes(t)&&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)}}};e(a,n._configuration.options.splitting?`module`:void 0,r?.nonce,s);let c=1e4;o=setTimeout(()=>{s()},c)},plugin(e){let t=n.init;return{name:`@amplitude/engagement-browser`,type:`enrichment`,async setup(n,r){let i=n.instanceName??Tm,a=Cm.getInstance(i).identityStore;t(n.apiKey,{serverZone:n.serverZone,...e,options:{logLevel:n.logLevel,logger:n.loggerProvider,...e?.options}});let o=[{track:e=>{r.track(e)}}];await window.engagement.boot({user:()=>{let e=a.getIdentity();return{user_id:r.getUserId(),device_id:r.getDeviceId(),user_properties:e.userProperties,getSessionId:r.getSessionId}},integrations:o}),a.addIdentityListener(e=>{var t,n;if(!((t=window.engagement)!=null&&t._.user)||!((n=window.engagement)!=null&&n._analytics.hasBooted)){console.warn(`Engagement SDK not booted. Ignoring identity change.`);return}window.engagement?._.user?.user_id===e.userId?window.engagement._setUserProperties(e.userProperties):(window.engagement.shutdown(),window.engagement.boot({user:()=>{let e=a.getIdentity();return{user_id:r.getUserId(),device_id:r.getDeviceId(),user_properties:e.userProperties,getSessionId:r.getSessionId}},integrations:o}))})},async execute(e){return window.engagement.forwardEvent(e),e}}}},r=n;return new Proxy(n,{get:function(e,t){if(t in r)return r[t];if(t!==`then`)return t===`gs`||t===`rc`?new Proxy({},{get:function(e,r){return function(){let e=Array.from(arguments),i=`${t}.${r}`;e.unshift(i),n._q.push(e)}}}):wm.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((r,i)=>{e.unshift(t,r,i),n._q.push(e)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),n._q.push(e)}}})}var Dm=(e=>(e.Local=`https://local.amplitude.com:3010/`,e.Staging=`https://apps.stag2.amplitude.com/`,e.Production=`https://app.amplitude.com/`,e.ProductionEU=`https://app.eu.amplitude.com/`,e))(Dm||{}),Om=e=>{if(typeof window<`u`&&window.opener)for(let t of Object.values(Dm))window.opener.postMessage({message:e},t)};function km(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),document.getElementsByTagName(`head`)[0].appendChild(e)}}var Am=(Om(`ENGAGEMENT_SNIPPET`),Em((e,t,n,r)=>km([e||`https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz`],t,n,r))),jm=e=>(typeof window<`u`&&!window.engagement&&(window.engagement=Am),Am.plugin(e)),Mm=`1.0.13`;o();var Nm=`amplitude-ts-unified`,Pm=function(){return{type:`enrichment`,name:`@amplitude/unified-library-plugin`,execute:function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return e.library=`${Nm}/${Mm}-${e.library??``}`,[2,e]})})}}};o();var Fm=function(e){l(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(this.config!==void 0){var e=this.plugins(lm);if(e.length===0){this.config.loggerProvider.debug(`${lm.pluginName} plugin is not found.`);return}else if(e.length===1)return e[0].experiment;else{this.config.loggerProvider.debug(`Multiple instances of ${lm.pluginName} are found.`);return}}},t.prototype.initAll=function(t,n){return s(this,void 0,void 0,function(){var r=this;return a(this,function(i){return this._initAllPromise||=(function(){return s(r,void 0,void 0,function(){var r,i;return a(this,function(a){switch(a.label){case 0:return r={serverZone:n?.serverZone,instanceName:n?.instanceName},e.prototype.add.call(this,Pm()),[4,e.prototype.init.call(this,t,d(d({},n?.analytics),r)).promise];case 1:return a.sent(),[4,e.prototype.add.call(this,Vd(d(d({},n?.sessionReplay),r))).promise];case 2:return a.sent(),[4,e.prototype.add.call(this,um(d(d({},n?.experiment),r))).promise];case 3:return a.sent(),i=this.plugin(Bd.pluginName),i===void 0?this.config.loggerProvider.debug(`${Bd.pluginName} plugin is not found.`):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,jm(d(d({},n?.engagement),r))).promise];case 4:return a.sent(),[2]}})})})().finally(function(){r._initAllPromise=void 0}),[2,this._initAllPromise]})})},t.prototype.init=function(t,n,r){return t===void 0&&(t=``),e.prototype.init.call(this,t,n,r)},t}(mc),$=function(){var e=new Fm;return{_setDiagnosticsSampleRate:U(e._setDiagnosticsSampleRate.bind(e),`_setDiagnosticsSampleRate`,V(e),H(e,[`config`])),_enableRequestBodyCompressionExperimental:U(e._enableRequestBodyCompressionExperimental.bind(e),`_enableRequestBodyCompressionExperimental`,V(e),H(e,[`config`])),experiment:U(e.experiment.bind(e),`experiment`,V(e),H(e,[`config`])),sessionReplay:U(e.sessionReplay.bind(e),`sessionReplay`,V(e),H(e,[`config`])),initAll:U(e.initAll.bind(e),`initAll`,V(e),H(e,[`config`])),init:U(e.init.bind(e),`init`,V(e),H(e,[`config`])),add:U(e.add.bind(e),`add`,V(e),H(e,[`config.apiKey`,`timeline.plugins`])),remove:U(e.remove.bind(e),`remove`,V(e),H(e,[`config.apiKey`,`timeline.plugins`])),track:U(e.track.bind(e),`track`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),logEvent:U(e.logEvent.bind(e),`logEvent`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),identify:U(e.identify.bind(e),`identify`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),groupIdentify:U(e.groupIdentify.bind(e),`groupIdentify`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),setGroup:U(e.setGroup.bind(e),`setGroup`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),revenue:U(e.revenue.bind(e),`revenue`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),flush:U(e.flush.bind(e),`flush`,V(e),H(e,[`config.apiKey`,`timeline.queue.length`])),getUserId:U(e.getUserId.bind(e),`getUserId`,V(e),H(e,[`config`,`config.userId`])),setUserId:U(e.setUserId.bind(e),`setUserId`,V(e),H(e,[`config`,`config.userId`])),getDeviceId:U(e.getDeviceId.bind(e),`getDeviceId`,V(e),H(e,[`config`,`config.deviceId`])),setDeviceId:U(e.setDeviceId.bind(e),`setDeviceId`,V(e),H(e,[`config`,`config.deviceId`])),reset:U(e.reset.bind(e),`reset`,V(e),H(e,[`config`,`config.userId`,`config.deviceId`])),getSessionId:U(e.getSessionId.bind(e),`getSessionId`,V(e),H(e,[`config`])),setSessionId:U(e.setSessionId.bind(e),`setSessionId`,V(e),H(e,[`config`])),extendSession:U(e.extendSession.bind(e),`extendSession`,V(e),H(e,[`config`])),setOptOut:U(e.setOptOut.bind(e),`setOptOut`,V(e),H(e,[`config`])),getOptOut:U(e.getOptOut.bind(e),`getOptOut`,V(e),H(e,[`config`])),setTransport:U(e.setTransport.bind(e),`setTransport`,V(e),H(e,[`config`])),getIdentity:U(e.getIdentity.bind(e),`getIdentity`,V(e),H(e,[`config`])),setIdentity:U(e.setIdentity.bind(e),`setIdentity`,V(e),H(e,[`config`,`config.userId`,`config.deviceId`]))}}();$._setDiagnosticsSampleRate,$._enableRequestBodyCompressionExperimental;var Im=$.initAll;$.experiment,$.sessionReplay,$.add,$.extendSession,$.flush;var Lm=$.getDeviceId;$.getIdentity,$.getOptOut;var Rm=$.getSessionId,zm=$.getUserId;$.groupIdentify;var Bm=$.identify;$.logEvent,$.remove,$.reset,$.revenue,$.setDeviceId,$.setGroup,$.setIdentity,$.setOptOut,$.setSessionId,$.setTransport;var Vm=$.setUserId,Hm=$.track,Um=f(e=>({isTrackAllowed:!1,setTrackAllowed:t=>e({isTrackAllowed:t})})),Wm=class{eventQueue=[];unsubscribe=null;constructor(){this.unsubscribe=Um.subscribe(e=>{e.isTrackAllowed&&this.flushEventQueue()})}lockTrack(){Um.setState({isTrackAllowed:!1})}identify(e,t,n,r=!1){e&&Vm(e);let i=new oe;return Object.entries(t||{}
12).forEach(([e,t])=>{i.set(e,t)}),{promise:Bm(i,n).promise.then(()=>{r&&Um.setState({isTrackAllowed:!0})})}}track(e,t,n){let{isTrackAllowed:r}=Um.getState();r?Hm(e,t,n):this.eventQueue.push(()=>Hm(e,t,n))}getSessionId(){return Rm()}getDeviceId(){return Lm()}getUserId(){return zm()}flushEventQueue(){this.eventQueue.forEach(e=>e()),this.eventQueue=[]}destroy(){this.unsubscribe&&this.unsubscribe()}},Gm=()=>{let{userAgent:e}=navigator;return!e.includes(`E2E-Playwright`)},Km=new Wm;export{Gm as n,Im as r,Km as t};
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.