PageSourceSearch

https://across.to/assets/amplitude-DFoZc5LR.js

js across.to collected 2026-09-25 14:34:14 UTC 193,776 bytes, 12 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`7f8a8dd78854a663b2f552e93512b9a278c2c6c6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`878b4e4d-eba8-40b9-b536-cf99293507dc`,e._sentryDebugIdIdentifier=`sentry-dbid-878b4e4d-eba8-40b9-b536-cf99293507dc`)}catch{}})();import{o as e,r as t,t as n}from"./chunk-W5WNQTQK.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-BavOWinV.js";import{t as f}from"./config-Cx4Vg8us.js";var p;(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`})(p||={});var m;(function(e){e.IDENTIFY=`$identify`,e.GROUP_IDENTIFY=`$groupidentify`,e.REVENUE=`revenue_amount`})(m||={});var h=`AMP_unsent`,g=`$default_instance`,_=`https://api2.amplitude.com/2/httpapi`,v=`https://api.eu.amplitude.com/2/httpapi`,y=`https://api2.amplitude.com/batch`,b=`https://api.eu.amplitude.com/batch`,x=`utm_campaign`,S=`utm_content`,C=`utm_id`,w=`utm_medium`,ee=`utm_source`,te=`utm_term`,ne=`dclid`,T=`fbclid`,E=`gbraid`,re=`gclid`,ie=`ko_click_id`,ae=`li_fat_id`,oe=`msclkid`,se=`rdt_cid`,ce=`ttclid`,le=`twclid`,ue=`wbraid`,de={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},D=`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(`.`),fe=[`authorization`,`cookie`,`set-cookie`];o();var pe=1e3,O=function(e){if(Object.keys(e).length>pe)return!1;for(var t in e){var n=e[t];if(!me(t,n))return!1}return!0},me=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&&=O(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 O(t);else if(![`number`,`string`,`boolean`].includes(typeof t))return!1;return!0};o();var k=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(A.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(A.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(A.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(A.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(A.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(A.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(A.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(A.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(A.UNSET,e,`-`),this},e.prototype.clearAll=function(){return this._properties={},this._properties[A.CLEAR_ALL]=`-`,this},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[A.CLEAR_ALL]!==void 0||this._propertySet.has(t)?!1:e===A.ADD?typeof n==`
1number`:e!==A.UNSET&&e!==A.REMOVE?me(t,n):!0},e}(),A;(function(e){e.SET=`$set`,e.SET_ONCE=`$setOnce`,e.ADD=`$add`,e.APPEND=`$append`,e.PREPEND=`$prepend`,e.REMOVE=`$remove`,e.PREINSERT=`$preInsert`,e.POSTINSERT=`$postInsert`,e.UNSET=`$unset`,e.CLEAR_ALL=`$clearAll`})(A||={});var he=[A.CLEAR_ALL,A.UNSET,A.SET,A.SET_ONCE,A.ADD,A.APPEND,A.PREPEND,A.PREINSERT,A.POSTINSERT,A.REMOVE],ge=`Event tracked successfully`,_e=`Unexpected error occurred`,ve=`Event rejected due to exceeded retry count`,ye=`Event skipped due to optOut config`,be=`Event rejected due to missing API key`,xe=`Client not initialized`,j;(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`})(j||={});var Se=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=j.Unknown),{event:e,code:t,message:n}},M=function(){var e=`ampIntegrationContext`;if(typeof globalThis<`u`&&globalThis[e]!==void 0)return globalThis[e];if(typeof globalThis<`u`)return globalThis;if(typeof window<`u`)return window;if(typeof self<`u`)return self;if(typeof globalThis<`u`)return globalThis};o();var Ce=function(e){return e?(e^Math.random()*16>>e/4).toString(16):`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,N
1)},we=u([],r(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,`0`)}),N=function(e){var t=M();if(!t?.crypto?.getRandomValues)return Ce(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)?`-${we[i]}`:we[i]}).join(``)};o();var Te=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=N(),this.loggerProvider.warn(`Plugin name is undefined. 
2      Generating a random UUID for plugin name: ${e.name}. 
3      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}return[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 Se(t,0,String(e))})}),Promise.all(b).then(function(e){var t=r(e,1)[0]||Se(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}
3return[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 Ee=function(e,t,n){return d(d(d({},typeof e==`string`?{event_type:e}:e),n),t&&{event_properties:t})},De=function(e,t){return d(d({},t),{event_type:m.IDENTIFY,user_properties:e.getUserProperties()})},Oe=function(e,t,n,r){var i;return d(d({},r),{event_type:m.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})},ke=function(e,t,n){var r,i=new k;return i.set(e,t),d(d({},n),{event_type:m.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})},Ae=function(e,t){return d(d({},t),{event_type:m.REVENUE,event_properties:e.getEventProperties()})},P=function(e){return{promise:e||Promise.resolve()}};o();var je=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 Te(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}return[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=Ee(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),P(this.dispatch(r))},e.prototype.identify=function(e,t){var n=De(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),P(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=Oe(e,t,n,r);return P(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=ke(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),P(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=Ae(e,t);return P(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),P())},e.prototype._addPlugin=function(e){return P(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)),P())},e.prototype._removePlugin=function(e){return P(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(Se(e,0,xe));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(p).includes(t)||(n[t]=e[t])}),he.forEach(function(n){if(Object.keys(e).includes(n)){var r=e[n];switch(n){case p.CLEAR_ALL:Object.keys(t).forEach(function(e){delete t[e]});break;case p.UNSET:Object.keys(r).forEach(function(e){delete t[e]});break;case p.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,Se(e,0,ye)]:(e.event_type===m.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=Se(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 P(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 Me=function(){function e(){this.productId=``,this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){return O(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?d({},this.properties):{};return e[F.REVENUE_PRODUCT_ID]=this.productId,e[F.REVENUE_QUANTITY]=this.quantity,e[F.REVENUE_PRICE]=this.price,e[F.REVENUE_TYPE]=this.revenueType,e[F.REVENUE_CURRENCY]=this.currency,e[F.REVENUE]=this.revenue,e[F.RECEIPT]=this.receipt,e[F.RECEIPT_SIG]=this.receiptSig,e},e}(),F;(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`})(F||={});var Ne=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},[])},I;(function(e){e[e.None=0]=`None`,e[e.Error=1]=`Error`,e[e.Warn=2]=`Warn`,e[e.Verbose=3]=`Verbose`,e[e.Debug=4]=`Debug`})(I||={});var Pe=`Amplitude Logger `,Fe=function(){function e(){this.logLevel=I.None}return e.prototype.disable=function(){this.logLevel=I.None},e.prototype.enable=function(e){e===void 0&&(e=I.Warn),this.logLevel=e},e.prototype.log=function(){var e=[...arguments];this.logLevel<I.Verbose||console.log(`${Pe}[Log]: ${e.join(` `)}`)},e.prototype.warn=function(){var e=[...arguments];this.logLevel<I.Warn||console.warn(`${Pe}[Warn]: ${e.join(` `)}`)},e.prototype.error=function(){var e=[...arguments];this.logLevel<I.Error||console.error(`${Pe}[Error]: ${e.join(` `)}`)},e.prototype.debug=function(){var e=[...arguments];this.logLevel<I.Debug||console.log(`${Pe}[Debug]: ${e.join(` `)}`)},e}(),Ie=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:g,logLevel:I.Warn,loggerProvider:new Fe,offline:!1,optOut:!1,serverUrl:_,serverZone:`US`,useBatch:!1}},Le=function(){function e(e){this._optOut=!1;var t=Ie();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=ze(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}
3,enumerable:!1,configurable:!0}),e}(),Re=function(e,t){return e===`EU`?t?b:v:t?y:_},ze=function(e,t,n){if(e===void 0&&(e=``),t===void 0&&(t=Ie().serverZone),n===void 0&&(n=Ie().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=[`US`,`EU`].includes(t)?t:Ie().serverZone;return{serverZone:r,serverUrl:Re(r,n)}},Be=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 Ve(e){return e>=200&&e<300}o();var He=function(e){return e===void 0&&(e=0),(Error().stack||``).split(`
4`).slice(2+e).map(function(e){return e.trim()})},L=function(e){return function(){var t=d({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},Ue=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},R=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]=Ue(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}},z=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<I.Debug||!c||!s)return e.apply(i,a);var l={type:`invoke public method`,name:t,args:a,stacktrace:He(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();function We(e){return e instanceof Error?e.message:String(e)}function Ge(e){var t=``;try{`body`in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var Ke=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=`${h}_${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||=N(),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,ve),!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=Ne(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;return a(this,function(a){switch(a.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,be)];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 Be,a.label=1;case 1:return a.trys.push([1,3,,4]),i=ze(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return o=a.sent(),o===null?(this.fulfillRequest(e,0,_e),[2]):t?(this.handleResponse(o,e),[3,4]):(`body`in o?this.fulfillRequest(e,o.statusCode,`${o.status}: ${Ge(o)}`):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=a.sent(),l=We(s),this.config.loggerProvider.error(l),(n=this.diagnosticsClient)==null||n.recordEvent(`anal
4ytics.events.unsuccessful.from.catch.error`,{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:He()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){var n;Ve(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:Ge(e),stack_trace:He()});var r=e.status;switch(r){case j.Success:this.handleSuccessResponse(e,t);break;case j.Invalid:this.handleInvalidResponse(e,t);break;case j.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case j.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,ge)},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(Ge(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(Ge(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(Ge(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;Ve(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:He()})),this.removeEvents(e),e.forEach(function(e){return e.callback(Se(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}(),qe=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Je(),platform:`Web`,os:void 0,deviceModel:void 0}},e}(),Je=function(){return typeof navigator<`u`&&(navigator.languages&&navigator.languages[0]||navigator.language)||``},Ye=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}(),B=function(){return B=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},B.apply(this,arguments)};function Xe(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
4if(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 Ze(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 Qe=function(e,t){var n,r,i=[`string`,`number`,`boolean`,`undefined`],a=typeof e;if(a!==typeof t)return!1;try{for(var o=Xe(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(!Qe(e[u],t[u]))return!1}else{if(!Qe(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var d=!0;return Object.keys(e).forEach(function(n){Qe(e[n],t[n])||(d=!1)}),d}return!0},$e=`$set`,et=`$unset`,tt=`$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 nt=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=B({},this.identity.userProperties),n=B(B({},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=Xe(Object.entries(e)),u=l.next();!u.done;u=l.next()){var d=Ze(u.value,2),f=d[0],p=d[1];switch(f){case $e:try{for(var m=(i=void 0,Xe(Object.entries(p))),h=m.next();!h.done;h=m.next()){var g=Ze(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 et:try{for(var y=(o=void 0,Xe(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 tt: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 B({},this.identity)},e.prototype.setIdentity=function(e){var t=B({},this.identity);this.identity=B({},e),Qe(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}(),rt=typeof globalThis<`u`||typeof globalThis<`u`?globalThis:self,it=function(){function e(){this.identityStore=new nt,this.eventBridge=new Ye,this.applicationContextProvider=new qe}return e.getInstance=function(t){return rt.analyticsConnectorInstances||={},rt.analyticsConnectorInstances[t]||(rt.analyticsConnectorInstances[t]=new e),rt.analyticsConnectorInstances[t]},e}(),at=function(e){return e===void 0&&(e=g),it.getInstance(e)},ot=function(e,t){at(t).identityStore.editIdentity().setUserId(e).commit()},st=function(e,t){at(t).identityStore.editIdentity().setDeviceId(e).commit()};o();var ct=function(){function e(){this.name=`identity`,this.type=`before`,this.identityStore=at().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=at(e.instanceName).identityStore),[2]})})},e}(),lt=function(e,t){return t===void 0&&(t=Date.now()),Date.now()-t>e},ut=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(
4Boolean).join(`_`)},dt=function(e){return`amp_${e.substring(0,6)}`},ft=function(){if(typeof navigator>`u`)return``;var e=navigator.userLanguage;return navigator.languages?.[0]??navigator.language??e??``},pt=function(){var e=M();return e?.location?.search?e.location.search.substring(1).split(`&`).filter(Boolean).reduce(function(e,t){var n=t.split(`=`,2),r=mt(n[0]),i=mt(n[1]);return i&&(e[r]=i),e},{}):{}},mt=function(e){e===void 0&&(e=``);try{return decodeURIComponent(e)}catch{return``}},ht=function(e,t){return!t||!t.length?!0:t.some(function(t){return typeof t==`string`?e===t:e.match(t)})},V=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%1e5/1e5<t};o();var vt=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 yt=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,s;return a(this,function(a){switch(a.label){case 0:if(t=M(),!t||!t.document)return[2,!1];n=String(Date.now()),r=d(d({},this.options),{expirationDays:.003}),i=new e(r),o=`AMP_TEST_${N().substring(0,8)}`,a.label=1;case 1:return a.trys.push([1,4,5,7]),[4,i.set(o,n)];case 2:return a.sent(),[4,i.get(o)];case 3:return s=a.sent(),[2,s===n];case 4:return a.sent(),[2,!1];case 5:return[4,i.remove(o)];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,n;return a(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:if(t=r.sent(),!t)return[2,void 0];try{return n=St(t),n===void 0?(console.error(`Amplitude Logger [Error]: Failed to decode cookie value for key: ${e}, value: ${t}`),[2,void 0]):[2,JSON.parse(n)]}catch{return console.error(`Amplitude Logger [Error]: Failed to parse cookie value for key: ${e}, value: ${t}`),[2,void 0]}return[2]}})})},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,p,m,h,g,_=this;return a(this,function(a){switch(a.label){case 0:r=M(),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,Ct(d.domain,this.options.domain))return[2,d.value]}catch(e){h={error:e}}finally{try{u&&!u.done&&(g=l.return)&&g.call(l)}finally{if(h)throw h.error}}}a.label=3;case 3:return[3,5];case 4:return a.sent(),[3,5];case 5:return f=((r?.document)?.cookie.split(`; `)??[]).filter(function(t){return t.indexOf(e+`=`)===0}),p=void 0,m=this.config.duplicateResolverFn,typeof m==`function`&&f.length>1&&(p=f.find(function(t){var n;try{var r=m(t.substring(e.length+1));return r||(n=_.config.diagnosticsClient)==null||n.increment(`cookies.duplicate.occurrence.document.cookie`),r}catch{return!1}}
4)),p||=f[0],p?[2,p.substring(e.length+1)]:[2,void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,s,c,l;return a(this,function(a){try{n=this.options.expirationDays??0,r=t===null?-1:n,i=void 0,r&&(o=new Date,o.setTime(o.getTime()+r*24*60*60*1e3),i=o),s=`${e}=${btoa(encodeURIComponent(JSON.stringify(t)))}`,i&&(s+=`; expires=${i.toUTCString()}`),s+=`; path=/`,this.options.domain&&(s+=`; domain=${this.options.domain}`),this.options.secure&&(s+=`; Secure`),this.options.sameSite&&(s+=`; SameSite=${this.options.sameSite}`),c=M(),c&&(c.document.cookie=s)}catch(t){l=t instanceof Error?t.message:String(t),console.error(`Amplitude Logger [Error]: Failed to set cookie for key: ${e}. Error: ${l}`)}return[2]})})},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}(),bt=function(e){try{return decodeURIComponent(atob(e))}catch{return}},xt=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}},St=function(e){return bt(e)??xt(e)},Ct=function(e,t){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()},wt=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 Tt=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 Et=10,Dt=1,H={TAGS:`tags`,COUNTERS:`counters`,HISTOGRAMS:`histograms`,EVENTS:`events`,INTERNAL:`internal`},Ot={LAST_FLUSH_TIMESTAMP:`last_flush_timestamp`},kt=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName=`AMP_diagnostics_${e.substring(0,10)}`}return e.isSupported=function(){return M()?.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,Dt);r.onerror=function(){e.dbPromise=null,n(Error(`Failed to open IndexedDB`))},r.onsuccess=function(){var n=r.result;
4n.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(H.TAGS)||e.createObjectStore(H.TAGS,{keyPath:`key`}),e.objectStoreNames.contains(H.COUNTERS)||e.createObjectStore(H.COUNTERS,{keyPath:`key`}),e.objectStoreNames.contains(H.HISTOGRAMS)||e.createObjectStore(H.HISTOGRAMS,{keyPath:`key`}),e.objectStoreNames.contains(H.EVENTS)||e.createObjectStore(H.EVENTS,{keyPath:`id`,autoIncrement:!0}).createIndex(`time_idx`,`time`,{unique:!1}),e.objectStoreNames.contains(H.INTERNAL)||e.createObjectStore(H.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([H.TAGS],`readwrite`),i=n.objectStore(H.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([H.COUNTERS],`readwrite`),i=n.objectStore(H.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([H.HISTOGRAMS],`readwrite`),i=n.objectStore(H.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([H.EVENTS],`readwrite`),r=n.objectStore(H.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,Et-t);n<e.length&&o.logger.debug(`DiagnosticsStorage: Only added ${n} of ${e.length}
4 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([H.INTERNAL],`readwrite`),i=r.objectStore(H.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([H.INTERNAL],`readonly`),r=n.objectStore(H.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(Ot.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(Ot.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([H.TAGS,H.COUNTERS,H.HISTOGRAMS,H.EVENTS],`readwrite`),[4,Promise.all([this.getAllFromStore(t,H.TAGS),this.getAllFromStore(t,H.COUNTERS),this.getAllFromStore(t,H.HISTOGRAMS),this.getAllFromStore(t,H.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,H.COUNTERS),this.clearTable(t,H.HISTOGRAMS),this.clearTable(t,H.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 At=`__AMPLITUDE_SCRIPT_URL__`,jt=`sdk.error.uncaught`,Mt=function(){var e=M();if(!e)return[];var t=e[At];return Array.isArray(t)?t:typeof t==`string`?[t]:[]},Nt=function(e){var t=M();if(!(!t||typeof t.addEventListener!=`function`)){var n=function(e){var t=e.error instanceof Error?e.error:void 0,n=t?.stack,r=Pt({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=Ft(n),a=Pt({filename:r,stack:n});a&&i({type:`unhandledrejection`,message:t?.message??It(e.reason),stack:n,filename:r,errorName:t?.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},i=function(t){e.recordEvent(jt,d({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};
4t.addEventListener(`error`,n,!0),t.addEventListener(`unhandledrejection`,r,!0)}},Pt=function(e){var t,n,r=Mt();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}}},Ft=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},It=function(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return`[object Object]`}};o();var Lt=1e3,Rt=300*1e3,zt=`https://diagnostics.prod.us-west-2.amplitude.com/v1/capture`,Bt=`https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture`,Vt=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`?zt:Bt,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=_t(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,kt.isSupported()?this.storage=new kt(e,t):this.logger.debug(`DiagnosticsClient: IndexedDB is not supported`),this.initializeFlushInterval(),this.shouldTrack&&(this.increment(`sdk.diagnostics.sampled.in.and.enabled`),Nt(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})},Lt),this.flushTimer||=setTimeout(function(){e._flush().catch(function(t){e.logger.debug(`DiagnosticsClient: Failed to flush`,t)}).finally(function(){e.flushTimer=null})},Rt)},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={}
4,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]),!M())throw Error(`DiagnosticsClient: Fetch is not supported`);return[4,fetch(this.serverUrl,{method:`POST`,headers:{"X-ApiKey":this.apiKey,"Content-Type":`application/json`},body:JSON.stringify(e)})];case 1: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(Rt),[2]):(n=e-t,n>=3e5?(this._flush(),[2]):(this._setFlushTimer(Rt-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=_t(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug(`DiagnosticsClient: Should track is`,this.shouldTrack)},e}(),Ht=function(){function e(){}return e.prototype.send=function(e,t){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 j.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 j.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 j.PayloadTooLarge:return{status:n,statusCode:t,body:{error:e.error??``}};case j.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 j.Timeout:default:return{status:n,statusCode:t}}},e.prototype.buildStatus=function(e){return Ve(e)?j.Success:e===429?j.RateLimit:e===413?j.PayloadTooLarge:e===408?j.Timeout:e>=400&&e<500?j.Invalid:e>=500?j.Failed:j.Unknown},e}();o();var Ut=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}(Ht),Wt=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();var Gt=1e3,Kt=300*1e3,qt=function(){function e(e,t,n,r){n===void 0&&(n=`US`),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,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 Wt(e,t)}return e.prototype.subscribe=function(e,t,n){var r=N(),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<Kt)?(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.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
4allback 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=Gt),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;return a(this,function(a){switch(a.label){case 0:i=new AbortController,s=setTimeout(function(){return i.abort()},t),a.label=1;case 1:return a.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:`GET`,headers:{Accept:`*/*`},signal:i.signal})];case 2:return c=a.sent(),c.ok?[3,4]:[4,c.text()];case 3:return u=a.sent(),o.logger.debug(`Remote config client fetch with retry time ${e} failed with ${c.status}: ${u}`),[3,6];case 4:return[4,c.json()];case 5:return d=a.sent(),[2,{value:{remoteConfig:d,lastFetch:new Date}}];case 6:return[3,9];case 7:return f=a.sent(),f instanceof Error&&f.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: `,f),[3,9];case 8:return clearTimeout(s),[7];case 9:return r<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(n))})]:[3,11];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];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 Jt=M()?.console,Yt={},Xt={},Zt=!1;function Qt(e){return!Jt||typeof Jt[e]!=`function`?!1:Xt[e]?!0:(Xt[e]=Jt[e],Jt[e]=function(){var t=[...arguments];try{if(Yt[e]&&!Zt){Zt=!0;var n=Yt[e];n&&n.forEach(function(n){try{n(e,t)}catch{}})}}catch{}return Zt=!1,Xt[e].apply(Jt,t)},!0)}function $t(e,t){if(!Qt(e))return Error(`Console override failed`);Yt[e]?Yt[e].push(t):Yt[e]=[t]}function en(e){var t,n;try{for(var r=i(Object.values(Yt)),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 tn(){var e,t;try{for(var n=i(Object.entries(Xt)),a=n.next();!a.done;a=n.next()){var o=r(a.value,2),s=o[0],c=o[1];c&&(Jt[s]=c)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Xt={},Yt={}}var nn={addListener:$t,removeListener:en,_restoreConsole:tn},rn;(function(e){e.US=`US`,e.EU=`EU`,e.STAGING=`STAGING`})(rn||={});var an=[`a`,`button`,`input`,`select`,`textarea`,`label`,`video`,`audio`,`[contenteditable="true" i]`,`[data-amp-default-track]`,`.amp-default-track`],on=`data-amp-track-`,sn=[`div`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`];o();var cn=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),ln=cn,un=cn,dn=[`*`],fn=1e3;o();function pn(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e==null}
4function mn(e,t,n){e&&hn({json:e,allowlist:t.map(gn),excludelist:n.map(gn),ancestors:[]})}function hn(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);pn(o[g])?(!vn(_,s)||vn(_,c))&&delete o[g]:hn({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 gn(e){return e.startsWith(`/`)&&(e=e.slice(1)),e.split(`/`).map(function(e){return e.replace(/~0/g,`~`).replace(/~1/g,`/`)})}function _n(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];if(i===`**`){if(r+1===t.length)return!0;for(var a=n;a<=e.length;a++)if(_n(e,t,a,r+1))return!0;return!1}else if(i===`*`||i===e[n])return _n(e,t,n+1,r+1);else return!1}function vn(e,t){return t.some(function(t){return _n(e,t)})}o();var yn=500,bn=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 On(o,{allow:e})},Object.defineProperty(e.prototype,`bodySize`,{get:function(){if(typeof this._bodySize==`number`)return this._bodySize;if(M()?.TextEncoder){var e=this.request.body;return this._bodySize=Sn(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,Tn(n,e,t)])})})},e}(),xn=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return e===void 0&&(e=[]),On(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,`bodySize`,{get:function(){return Sn(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,Tn(n,e,t)])})})},e}();function Sn(e,t){var n,a,o,s=M()?.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()),p=f.next();!p.done;p=f.next()){var m=r(p.value,2),h=m[0],g=m[1];if(u+=h.length,typeof g==`string`)u+=new s().encode(g).length;else if(g instanceof Blob)u+=g.size;else return;if(++d>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.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 Cn=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}),On(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}
4,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)},yn)}),[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,Tn(n,e,t)]}})})},e}(),wn=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,`bodySize`,{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`status`,{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(e===void 0&&(e=[]),!this.headersString)return{};var a={},o=this.headersString.split(`\r
5`);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 On(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?(mn(n,e,t),[2,n]):[2,null])})})},e}();function Tn(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return mn(r,t,n),r}catch{return null}}var En;(function(e){e.REDACT=`redact`,e.REMOVE=`remove`})(En||={});var Dn=`[REDACTED]`,On=function(e,t){var n,a,o=t.allow,s=o===void 0?[]:o,c=t.strategy,l=c===void 0?En.REMOVE:c,d=u([],r(fe),!1),f={},p=function(t){var n=t.toLowerCase();d.find(function(e){return e.toLowerCase()===n})?l===En.REDACT&&(f[t]=Dn):s.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:l===En.REDACT&&(f[t]=Dn)};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},kn=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(D),!1)),requestBodySize:this.requestWrapper?.bodySize,responseHeaders:this.responseWrapper?.headers(u([],r(D),!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 An(e){return typeof e==`object`&&!!e&&`url`in e&&`method`in e}var jn=function(){function e(e,t){t===void 0&&(t=N()),this.callback=e,this.id=t}return e}();function Mn(e){try{e()}catch{}}var Nn=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=M();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=M();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){Mn(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(An(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 kn(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){Mn(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 bn(r):void 0,i?new Cn(i):void 0,o,t?.startTime,t?.durationStart)}catch(e){Mn(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`&&Mn(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){Mn(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 wn(i.status,e,t?parseInt(t,10):void 0,a),r=i.$$AmplitudeAnalyticsEvent.headers,l=new xn(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){Mn(function(){return o.logger?.debug(`an unexpected error occurred while handling xhr send`,e)}
5)}}),n.apply(i,t)},a.setRequestHeader=function(e,t){var n=this;try{var r=n.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){Mn(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr setRequestHeader`,e)})}i.apply(n,[e,t])}}},e}());o();var Pn=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({},de),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=pt();return{utm_campaign:e[x],utm_content:e[S],utm_id:e[C],utm_medium:e[w],utm_source:e[ee],utm_term:e[te]}},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=pt();return e={},e[ne]=t[ne],e[T]=t[T],e[E]=t[E],e[re]=t[re],e[ie]=t[ie],e[ae]=t[ae],e[oe]=t[oe],e[se]=t[se],e[ce]=t[ce],e[le]=t[le],e[ue]=t[ue],e},e}();o();var Fn=`data-amp-mask`,U=`*****`,In=/\b(?:\d[ -]*?){13,16}\b/,Ln=/(\d{3}-?\d{2}-?\d{4})/g,Rn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,zn=function(e,t){var n,r;if(t===void 0&&(t=[]),typeof e!=`string`)return``;var a=e;a=a.replace(In,U),a=a.replace(Ln,U),a=a.replace(Rn,U);try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var c=s.value;try{a=a.replace(c,U)}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},Bn=function(e){if(typeof document>`u`||!document.title)return``;var t=document.querySelector(`title`);return t&&t.hasAttribute(`data-amp-mask`)?U:e?e(document.title):document.title};function Vn(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Hn(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
6In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hn(e,t){if(e){if(typeof e==`string`)return Un(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Un(e,t)}}function Un(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Wn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gn(e,t,n){return t&&Wn(e.prototype,t),n&&Wn(e,n),e}var Kn=function(){return typeof Symbol==`function`},qn=function(e){return Kn()&&!!Symbol[e]},Jn=function(e){return qn(e)?Symbol[e]:`@@`+e};Kn()&&!qn(`observable`)&&(Symbol.observable=Symbol(`observable`));var Yn=Jn(`iterator`),Xn=Jn(`observable`),Zn=Jn(`species`);function Qn(e,t){var n=e[t];if(n!=null){if(typeof n!=`function`)throw TypeError(n+` is not a function`);return n}}function $n(e){var t=e.constructor;return t!==void 0&&(t=t[Zn],t===null&&(t=void 0)),t===void 0?W:t}function er(e){return e instanceof W}function tr(e){tr.log?tr.log(e):setTimeout(function(){throw e})}function nr(e){Promise.resolve().then(function(){try{e()}catch(e){tr(e)}})}function rr(e){var t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,t))try{if(typeof t==`function`)t();else{var n=Qn(t,`unsubscribe`);n&&n.call(t)}}catch(e){tr(e)}}function ir(e){e._observer=void 0,e._queue=void 0,e._state=`closed`}function ar(e){var t=e._queue;if(t){e._queue=void 0,e._state=`ready`;for(var n=0;n<t.length&&(or(e,t[n].type,t[n].value),e._state!==`closed`);++n);}}function or(e,t,n){e._state=`running`;var r=e._observer;try{var i=Qn(r,t);switch(t){case`next`:i&&i.call(r,n);break;case`error`:if(ir(e),i)i.call(r,n);else throw n;break;case`complete`:ir(e),i&&i.call(r);break}}catch(e){tr(e)}e._state===`closed`?rr(e):e._state===`running`&&(e._state=`ready`)}function sr(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}],nr(function(){return ar(e)});return}or(e,t,n)}}var cr=function(){function e(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state=`initializing`;var n=new lr(this);try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}this._state===`initializing`&&(this._state=`ready`)}var t=e.prototype;return t.unsubscribe=function(){this._state!==`closed`&&(ir(this),rr(this))},Gn(e,[{key:`closed`,get:function(){return this._state===`closed`}}]),e}(),lr=function(){function e(e){this._subscription=e}var t=e.prototype;return t.next=function(e){sr(this._subscription,`next`,e)},t.error=function(e){sr(this._subscription,`error`,e)},t.complete=function(){sr(this._subscription,`complete`)},Gn(e,[{key:`closed`,get:function(){return this._subscription._state===`closed`}}]),e}(),W=function(){function e(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}var t=e.prototype;return t.subscribe=function(e){return(typeof e!=`object`||!e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new cr(e,this._subscriber)},t.forEach=function(e){var t=this;return new Promise(function(n,r){if(typeof e!=`function`){r(TypeError(e+` is not a function`));return}function i(){a.unsubscribe(),n()}var a=t.subscribe({next:function(t){try{e(t,i)}catch(e){r(e),a.unsubscribe()}},error:r,complete:n})})},t.map=function(e){var t=this;if(typeof e!=`function`)throw TypeError(e+` is not a function`);return new($n(this))(function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})})},t.filter=function(e){var t=this;if(typeof e!=`function`)throw TypeError(e+` is not a function`);return new($n(this))(function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})})},t.reduce=function(e){var t=this;if(typeof e!=`function`)throw TypeError(e+` is not a function`);var n=$n(this),r=arguments.length>1,i=!1,a=arguments[1];return new n(function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(TypeError(`Cannot reduce an empty sequence`));n.next(a),n.complete()}})})},t.concat=function(){var e=this,t=[...arguments],n=$n(this);return new n(function(r){var i,a=0;function o(e){i=e.subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){a===t.length?(i=void 0,r.complete()):o(n.from(t[a++]))}})}return o(e),function(){i&&=(i.unsubscribe(),void 0)}})},t.flatMap=function(e){var t=this;if(typeof e!=`function`)throw TypeError(e+` is not a function`);var n=$n(this);return new n(function(r){var i=[],a=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var a=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(a);e>=0&&i.splice(e,1),o()}});i.push(a)},error:function(e){r.error(e)},complete:function(){o()}});function o(){a.closed&&i.length===0&&r.complete()}
6return function(){i.forEach(function(e){return e.unsubscribe()}),a.unsubscribe()}})},t[Xn]=function(){return this},e.from=function(t){var n=typeof this==`function`?this:e;if(t==null)throw TypeError(t+` is not an object`);var r=Qn(t,Xn);if(r){var i=r.call(t);if(Object(i)!==i)throw TypeError(i+` is not an object`);return er(i)&&i.constructor===n?i:new n(function(e){return i.subscribe(e)})}if(qn(`iterator`)&&(r=Qn(t,Yn),r))return new n(function(e){nr(function(){if(!e.closed){for(var n=Vn(r.call(t)),i;!(i=n()).done;){var a=i.value;if(e.next(a),e.closed)return}e.complete()}})});if(Array.isArray(t))return new n(function(e){nr(function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}})});throw TypeError(t+` is not observable`)},e.of=function(){var t=[...arguments];return new(typeof this==`function`?this:e)(function(e){nr(function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}})})},Gn(e,null,[{key:Zn,get:function(){return this}}]),e}();Kn()&&Object.defineProperty(W,Symbol(`extensions`),{value:{symbol:Xn,hostReportError:tr},configurable:!0}),o();function ur(e,t){return new W(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 dr(e,t){return new W(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 G(e){var t=new Set,n=null;function r(){n?.unsubscribe(),n=null,t.clear()}return new W(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 fr=e(n(((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}))()),pr=fr.default||fr,mr=`https://app.amplitude.com`,hr={US:mr,EU:`https://app.eu.amplitude.com`,STAGING:`https://apps.stag2.amplitude.com`},gr=`https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.1.js.gz`,_r=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 vr(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}o();var yr,br=`__AMPLITUDE_MESSENGER_INSTANCE__`,xr=`__AMPLITUDE_MESSENGER__`,Sr=function(){function e(e){var t=(e===void 0?{}:e).origin,n=t===void 0?mr:t;this[yr]=!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=vr(),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=_r(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=M();e?.[xr]===this&&delete e[xr]},e}();yr=br;function Cr(e){return typeof e==`object`&&!!e&&br in e&&e[br]===!0}function wr(e){var t=M(),n=t?.[xr];if(Cr(n))return n;var r=new Sr(e);return t&&(t[xr]=r),r}var Tr=`__AMPLITUDE_BACKGROUND_CAPTURE__`;function Er(e,t){var n=e;if(n[Tr]!==!0){n[Tr]=!0;var r=t?.scriptUrl??gr,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})}}o();var Dr=function(e,t){return typeof e==`boolean`?e:e?.[t]!==!1},Or=function(e){return Dr(e,`attribution`)},kr=function(e){return Dr(e,`fileDownloads`)},Ar=function(e){return Dr(e,`formInteractions`)},jr=function(e){return Dr(e,`pageViews`)},Mr=function(e){return Dr(e,`sessions`)},Nr=function(e){return Dr(e,`pageUrlEnrichment`)},Pr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.networkTracking===!0||typeof e.networkTracking==`object`)},Fr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.elementInteractions===!0||typeof e.elementInteractions==`object`)},Ir=function(e){return typeof e==`boolean`?e:typeof e==`object`&&e.webVitals===!0},Lr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.frustrationInteractions===!0||typeof e.frustrationInteractions==`object`)},Rr=function(e){if(Fr(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.elementInteractions==`object`)return e.autocapture.elementInteractions},zr=function(e){if(Lr(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.frustrationInteractions==`object`)return e.autocapture.frustrationInteractions},Br=function(e){if(Pr(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})})}},Vr=function(e){var t=function(){return!1},n=void 0,r,i=e.pageCounter;return jr(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}},Hr=function(e){return Or(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution==`object`?d({},e.defaultTracking.attribution):{}},Ur=function(e){if(Ar(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&typeof e.defaultTracking.formInteractions==`object`)return e.defaultTracking.formInteractions},Wr=function(e,t){Gr(e,t)},Gr=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},Kr=function(e){var t=e;return t&&t._q!==void 0},qr=`2.35.4`,Jr=`amplitude-ts`;o();var Yr=`Web`,Xr=`$remote`,Zr=function(){function e(){this.name=`@amplitude/plugin-context-browser`,this.type=`before`,this.library=`${Jr}/${qr}`,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:Yr}),this.config.trackingOptions.language&&{language:ft()}),this.config.trackingOptions.ipAddress&&{ip:Xr}),{insert_id:N(),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 Qr=1e3,$r=function(e){l(t,e);function t(t){var n=this,r,i;try{i=M()?.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>Qr?(i=n.length-Qr,[4,e.prototype.set.call(this,t,n.slice(0,Qr))]):[3,2];case 1:return a.sent(),(r=this.loggerProvider)==null||r.error(`Failed to save ${i} events because the queue length exceeded ${Qr}.`),[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}(Tt);o();var ei=function(e){l(t,e);function t(){return e.call(this,M()?.sessionStorage)||this}return t}(Tt);o();var ti=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){return s(this,void 0,void 0,function(){var n=this;return a(this,function(a){return[2,new Promise(function(a,o){var s,c;typeof XMLHttpRequest>`u`&&o(Error(`XHRTransport is not supported.`));var l=new XMLHttpRequest;l.open(`POST`,e,!0),l.onreadystatechange=function(){if(l.readyState===n.state.done){var e=l.responseText;try{a(n.buildResponse(JSON.parse(e)))}catch{a(n.buildResponse({code:l.status}))}}};var u=d({"Content-Type":`application/json`,Accept:`*/*`},n.customHeaders);try{for(var f=i(Object.entries(u)),p=f.next();!p.done;p=f.next()){var m=r(p.value,2),h=m[0],g=m[1];l.setRequestHeader(h,g)}}catch(e){s={error:e}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}l.send(JSON.stringify(t))})]})})},t}(Ht);o();var ni=function(e){l(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.send=function(e,t){return s(this,void 0,void 0,function(){var n=this;return a(this,function(r){return[2,new Promise(function(r,i){var a=M();if(!a?.navigator.sendBeacon)throw Error(`SendBeaconTransport is not supported`);try{var o=JSON.stringify(t);return a.navigator.sendBeacon(e,JSON.stringify(t))?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}(Ht);o();var ri=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=dt(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:ai(l),sessionId:ii(d),lastEventId:ii(p),lastEventTime:ii(f),optOut:!!u}]}})})},ii=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},ai=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}},K=`[Amplitude]`;`${K}`;var oi=`${K} Form Started`,si=`${K} Form Submitted`,ci=`${K} File Downloaded`,li=`session_start`,ui=`session_end`,di=`${K} File Extension`,fi=`${K} File Name`,pi=`${K} Link ID`,mi=`${K} Link Text`,hi=`${K} Link URL`,gi=`${K} Form ID`,_i=`${K} Form Name`,vi=`${K} Form Destination`,yi=`cookie`;o();var bi=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,ee,te,ne,T,E,re,ie,ae,oe,se,ce,le,ue,de,D,fe,pe){r===void 0&&(r=new vt),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=yi),g===void 0&&(g=new Fe),_===void 0&&(_=I.Warn),y===void 0&&(y=!1),b===void 0&&(b=!1),C===void 0&&(C=``),w===void 0&&(w=`US`),ne===void 0&&(ne=1800*1e3),T===void 0&&(T=new $r({loggerProvider:g})),E===void 0&&(E={ipAddress:!0,language:!0,platform:!0}),re===void 0&&(re=`fetch`),ie===void 0&&(ie=!1),ae===void 0&&(ae=!0),de===void 0&&(de=!0),D===void 0&&(D=0);var O=this;O=e.call(this,{apiKey:t,storageProvider:T,transportProvider:wi(re)})||this,O.apiKey=t,O.appVersion=n,O.cookieOptions=i,O.defaultTracking=a,O.autocapture=o,O.flushIntervalMillis=c,O.flushMaxRetries=l,O.flushQueueSize=u,O.identityStorage=d,O.ingestionMetadata=f,O.instanceName=p,O.loggerProvider=g,O.logLevel=_,O.minIdLength=v,O.offline=y,O.partnerId=x,O.plan=S,O.serverUrl=C,O.serverZone=w,O.sessionTimeout=ne,O.storageProvider=T,O.trackingOptions=E,O.transport=re,O.useBatch=ie,O.fetchRemoteConfig=ae,O.networkTrackingOptions=le,O.identify=ue,O.enableDiagnostics=de,O.diagnosticsSampleRate=D,O.diagnosticsClient=fe,O.remoteConfig=pe,O.version=qr,O._optOut=!1,O._cookieStorage=r,O.deviceId=s,O.lastEventId=m,O.lastEventTime=h,O.optOut=b,O.deferredSessionId=te,O.sessionId=ee,O.pageCounter=se,O.userId=oe,O.debugLogsEnabled=ce,O.loggerProvider.enable(ce?I.Debug:O.logLevel),O.networkTrackingOptions=le,O.identify=ue,O.enableDiagnostics=de,O.diagnosticsSampleRate=D,O.diagnosticsClient=fe;var me=pe?.fetchRemoteConfig??ae;return O.remoteConfig=O.remoteConfig||{},O.remoteConfig.fetchRemoteConfig=me,O.fetchRemoteConfig=me,O}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 yt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(ut(this.apiKey),e)},t}(Le),xi=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,ee,te,ne,T,E,re;return a(this,function(a){switch(a.label){case 0:return o=t.identityStorage||`cookie`,E={},o===`cookie`?[3,1]:(c=``,[3,5]);case 1:return(re=t.cookieOptions?.domain)==null?[3,2]:(l=re,[3,4]);case 2:return[4,Ti()];case 3:l=a.sent(),a.label=4;case 4:c=l,a.label=5;case 5:return s=d.apply(void 0,[(E.domain=c,E.expiration=365,E.sameSite=`Lax`,E.secure=!1,E.upgrade=!0,E),t.cookieOptions]),u={duplicateResolverFn:function(e){var t=St(e);return t?Ct(JSON.parse(t).cookieDomain,s.domain):!1},diagnosticsClient:r},f=Si(t.identityStorage,s,u),[4,ri(e,f,t.cookieOptions?.upgrade??!0)];case 6:return p=a.sent(),[4,f.get(ut(e))];case 7:return m=a.sent(),h=pt(),g=h.ampTimestamp?Number(h.ampTimestamp):void 0,_=g?Date.now()<g:!0,v=t.deviceId??(_?h.ampDeviceId??h.deviceId:void 0)??m?.deviceId??p.deviceId??N(),y=m?.lastEventId??p.lastEventId,b=m?.lastEventTime??p.lastEventTime,x=t.optOut??m?.optOut??p.optOut,S=m?.sessionId??p.sessionId,C=m?.deferredSessionId,w=t.userId??m?.userId??p.userId,n.previousSessionDeviceId=m?.deviceId??p.deviceId,n.previousSessionUserId=m?.userId??p.userId,ee={ipAddress:t.trackingOptions?.ipAddress??!0,language:t.trackingOptions?.language??!0,platform:t.trackingOptions?.platform??!0},te=m?.pageCounter,ne=m?.debugLogsEnabled,t.autocapture!==void 0&&(t.defaultTracking=t.autocapture),T=new bi(e,t.appVersion,f,s,t.defaultTracking,t.autocapture,v,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,y,b,i?.loggerProvider??t.loggerProvider,t.logLevel,t.minIdLength,t.offline,x,t.partnerId,t.plan,t.serverUrl,i?.serverZone??t.serverZone,S,C,t.sessionTimeout,t.storageProvider,ee,t.transport,t.useBatch,t.fetchRemoteConfig,w,te,ne,t.networkTrackingOptions,t.identify,i?.enableDiagnostics??t.enableDiagnostics,i?.diagnosticsSampleRate??n._diagnosticsSampleRate,r,t.remoteConfig),[4,T.storageProvider.isEnabled()];case 8:return a.sent()||(T.loggerProvider.warn(`Storage provider ${T.storageProvider.constructor.name} is not enabled. Falling back to MemoryStorage.`),T.storageProvider=new vt),[2,T]}})})},Si=function(e,t,n){switch(e===void 0&&(e=yi),t===void 0&&(t={}),e){case`localStorage`:return new $r;case`sessionStorage`:return new ei;case`none`:return new vt;default:return new yt(d(d({},t),{expirationDays:t.expiration}),n)}},Ci=function(e){return e===void 0&&(e={}),e.remoteConfig?.fetchRemoteConfig===!0?!0:!(e.remoteConfig?.fetchRemoteConfig===!1||e.fetchRemoteConfig===!1)},wi=function(e){var t=typeof e==`object`?e.type:e,n=typeof e==`object`?e.headers:void 0;return t===`xhr`?new ti(n):t===`beacon`?new ni:new Ut(n)},Ti=function(e){return s(void 0,void 0,void 0,function(){var t,n,r,i,o,s,s,c,l,u,d;return a(this,function(a){switch(a.label){case 0:return[4,new yt().isEnabled()];case 1:if(!a.sent()||!e&&(typeof location>`u`||!location.hostname))return[2,``];for(t=e??location.hostname,n=t.split(`.`),r=[],i=N(),o=`AMP_TLDTEST_${i.substring(0,8)}`,s=n.length-2;s>=0;--s)r.push(n.slice(s).join(`.`));s=0,a.label=2;case 2:return s<r.length?(c=r[s],l={domain:`.`+c,expirationDays:.003},u=new yt(l),[4,u.set(o,1)]):[3,7];case 3:return a.sent(),[4,u.get(o)];case 4:return d=a.sent(),d?[4,u.remove(o)]:[3,6];case 5:return a.sent(),[2,`.`+c];case 6:return s++,[3,2];case 7:return[2,``]}})})},Ei=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t};o();var Di=`[Amplitude] Page Viewed`,Oi=function(e){e===void 0&&(e={});var t,n=M(),i=void 0,o=!1,c,l=e.trackOn,u=e.trackHistoryChanges,f=e.eventType,p=f===void 0?Di:f,m=function(e){var t=e;try{t=decodeURI(e)}catch(e){i?.error(`Malformed URI sequence: `,e)}return t},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n;return a(this,function(r){switch(r.label){case 0:return e=m(typeof location<`u`&&location.href||``),n={event_type:p},t=[{}],[4,ki()];case 1:return[2,(n.event_properties=d.apply(void 0,[d.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":typeof location<`u`&&location.hostname||``,"[Amplitude] Page Location":e,"[Amplitude] Page Path":typeof location<`u`&&m(location.pathname)||``,"[Amplitude] Page Title":Bn(zn),"[Amplitude] Page URL":e.split(`?`)[0]}]),n)]}})})},g=function(){return l===void 0||typeof l==`function`&&l()},_=typeof location<`u`?location.href:null,v=function(){return s(void 0,void 0,void 0,function(){var e,n,r,o;return a(this,function(a){switch(a.label){case 0:return e=location.href,n=ji(u,e,_||``)&&g(),_=e,n?(i?.log(`Tracking page view event`),t==null?[3,3]:[3,1]):[3,4];case 1:return o=(r=t).track,[4,h()];case 2:o.apply(r,[a.sent()]),a.label=3;case 3:a.label=4;case 4:return[2]}})})},y=function(){v()};return{name:`@amplitude/plugin-page-view-tracking-browser`,type:`enrichment`,setup:function(e,l){return s(void 0,void 0,void 0,function(){var s,u;return a(this,function(a){switch(a.label){case 0:return t=l,c=e,i=e.loggerProvider,i.log(`Installing @amplitude/plugin-page-view-tracking-browser`),o=!0,n&&(n.addEventListener(`popstate`,y),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&&v()}})),g()?(i.log(`Tracking page view event`),u=(s=t).track,[4,h()]):[3,2];case 1:u.apply(s,[a.sent()]),a.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t;return a(this,function(n){switch(n.label){case 0:return l===`attribution`&&Ai(e)?(i?.log(`Enriching c
6ampaign event to page view event with campaign parameters`),[4,h()]):[3,2];case 1:t=n.sent(),e.event_type=t.event_type,e.event_properties=d(d({},e.event_properties),t.event_properties),n.label=2;case 2:return c&&e.event_type===p&&(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`,y),o=!1),[2]})})}}},ki=function(){return s(void 0,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return e=Ei,[4,new Pn().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Ai=function(e){if(e.event_type===`$identify`&&e.user_properties){var t=e.user_properties,n=t[p.SET]||{},i=t[p.UNSET]||{},a=u(u([],r(Object.keys(n)),!1),r(Object.keys(i)),!1);return Object.keys(de).every(function(e){return a.includes(e)})}return!1},ji=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 Mi=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=Ur(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=Pi(e);o||r.track(oi,(t={},t[gi]=Ni(e.id),t[_i]=Ni(e.name),t[vi]=n,t)),o=!0}),n(e,`submit`,function(n){var a,s,c=Pi(e);if(o||r.track(oi,(a={},a[gi]=Ni(e.id),a[_i]=Ni(e.name),a[vi]=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(si,(s={},s[gi]=Ni(e.id),s[_i]=Ni(e.name),s[vi]=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=M(),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]})})}}},Ni=function(e){if(typeof e==`string`)return e},Pi=function(e){var t=e.getAttribute(`action`);try{t=new URL(encodeURI(t??``),window.location.href).href}catch{}return t};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=[]};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(ci,(n={},n[di]=i,n[fi]=t.pathname,n[pi]=e.id,n[mi]=e.text,n[hi]=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=M(),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]})})}}},Ii=!1,Li=function(e){Ii||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.`),Ii=!0)};o();var Ri=function(){var e=`@amplitude/plugin-network-checker-browser`,t=`before`,n=M(),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 zi(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),zi(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?D:[]),!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 Bi(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 Vi(e,t){var n,r;if(e){zi(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=Bi(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=Bi(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}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 Hi=`1.22.3`,Ui=`@amplitude/plugin-autocapture-browser`,Wi=`@amplitude/plugin-frustration-browser`,Gi=`[Amplitude] Dead Click`,Ki=`[Amplitude] Rage Click`,qi=`[Amplitude] Error Click`,Ji=`[Amplitude] Thrashed Cursor`,Yi=`[Amplitude] Element ID`,Xi=`[Amplitude] Element Class`,Zi=`[Amplitude] Element Tag`,Qi=`[Amplitude] Element Text`,$i=`[Amplitude] Element Hierarchy`,ea=`[Amplitude] Element Href`,ta=`[Amplitude] Element Position Left`,na=`[Amplitude] Element Position Top`,ra=`[Amplitude] Element Aria Label`,ia=`[Amplitude] Element Attributes`,aa=`[Amplitude] Element Parent Label`,oa=`[Amplitude] Page URL`,sa=`[Amplitude] Page Title`,ca=`[Amplitude] Viewport Height`,la=`[Amplitude] Viewport Width`,ua=`https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz`,da=`amp-visual-tagging-selector-highlight`,fa=`data-amp-mask-attributes`;o();var pa=[`input`,`select`,`textarea`],ma=function(e,t){return((window==null?void 0:window.getComputedStyle)?.call(window,e))?.getPropertyValue(`cursor`)===`pointer`&&t===`click`},ha=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&ht(window.location.href,n)||!ht(window.location.href,t))},ga=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(!ha(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=ma(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`}}},_a=function(e){var t,n=((t=e?.tagName)?.toLowerCase)?.call(t),r=e instanceof HTMLElement?e.getAttribute(`contenteditable`)?.toLowerCase()===`true`:!1;return!pa.includes(n)&&!r},va=function(e){return e?e.split(`,`).map(function(e){return e.trim()}).filter(function(e){return e.length>0&&e!==`id`&&e!==`class`}):[]},ya=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},{})},ba=function(e){return e==null||typeof e==`object`&&Object.keys(e).length===0||typeof e==`string`&&e.trim().length===0},xa=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return ba(r)||(t[n]=r),t},{})},Sa=function(e,t){return e?t.some(function(t){return(e?.matches)?.call(e,t)})?e:Sa(e?.parentElement,t):null},Ca=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};function wa(e){return e.type===`click`||e.type===`change`}var Ta;(function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]=`LEFT_OR_TOUCH_CONTACT`,e[e.MIDDLE=1]=`MIDDLE`,e[e.RIGHT=2]=`RIGHT`})(Ta||={});var Ea=`__AMPLITUDE_VISUAL_TAGGING__`;function Da(e,t){var n=e;if(n[Ea]!==!0){n[Ea]=!0;var 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(ua).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:da,messenger:e,cssSelectorAllowlist:a,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:Hi}}}),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 Oa(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(Ca).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 ka(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,a=e.evaluateTriggers;return n.changeObservable.filter(Ca).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 Aa(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=dr(s.filter(function(e){return!a(`click`,e.closestTrackedAncestor)}).map(function(e){return e.closestTrackedAncestor=Sa(e.event.target,r.actionClickAllowlist),e.closestTrackedAncestor!==null&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(Ca).filter(function(e){return o(`click`,e.closestTrackedAncestor)}),l?dr(c,l):c),d=null,f=null;return ur(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))})}o();var q=M(),ja=function(){return new W(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()}})},Ma=function(e){return e===void 0&&(e=`click`),new W(function(t){var n=function(e){t.next(e)};return q.document.addEventListener(e,n,{capture:!0}),function(){q.document.removeEventListener(e,n,{capture:!0})}})},Na=function(){return new W(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 nn.addListener(`error`,t),function(){nn.removeListener(t)}})},Pa=function(){return new W(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 q.addEventListener(`error`,t),function(){q.removeEventListener(`error`,t)}})},Fa=function(){return new W(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 q.addEventListener(`unhandledrejection`,t),function(){q.removeEventListener(`unhandledrejection`,t)}})},Ia=function(){return dr(dr(Pa(),Fa()),Na())},La=function(){return new W(function(e){var t=function(t){e.next(t)},n={capture:!0};return q.document.addEventListener(`mousemove`,t,n),function(){q.document.removeEventListener(`mousemove`,t,n)}})},Ra=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},za=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}},Ba=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 Va={"[Amplitude] Element Clicked":`click`,"[Amplitude] Element Changed":`change`},Ha=function(e){var t,n,r,a,o=Object.values(Va).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=Va[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},Ua=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},Wa=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Va[t.event_type]===e.type&&t.filters.every(function(t){return Ra(e,t)})})})},Ga=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}}
12finally{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)},Ka=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=Ga(Wa(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;Ba(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}(),qa=function(e,t,n,r){return new Ka(e,t,n,r)};o();var Ja=new Set([`id`,`class`,`style`,`value`,`onclick`,`onchange`,`oninput`,`onblur`,`onsubmit`,`onfocus`,`onkeydown`,`onkeyup`,`onkeypress`,`data-reactid`,`data-react-checksum`,`data-reactroot`,fa,Fn]),Ya=[`type`],Xa=[`svg`,`path`,`g`],Za=[`password`,`hidden`];function Qa(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!Ja.has(e.name)}),p=!_a(e);if(!Za.includes(String(e.getAttribute(`type`)))&&!Xa.includes(a))try{for(var m=i(f),h=m.next();!h.done;h=m.next()){var g=h.value;if(!(p&&!Ya.includes(g.name))){if(t.has(g.name)){d[g.name]=U;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 $a(e){var t=[];if(!e)return t;
12t.push(e);for(var n=e.parentElement;n&&n.tagName!==`HTML`;)t.push(n),n=n.parentElement;return t}o();var eo=function(){function e(e,t){var n,a,o=this;this.replaceSensitiveString=function(e){return zn(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,a,s=performance.now(),c=[];if(!e)return[];for(var l=$a(e),d=new Map,f=l.length-1;f>=0;f--){var p=l[f];if(p){var m=va(p.getAttribute(fa)),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 Qa(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.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=ya(l??{},n),f=(r={},r[$i]=c,r[Zi]=a,r[Qi]=o.getText(t),r[ta]=s.left==null?null:Math.round(s.left),r[na]=s.top==null?null:Math.round(s.top),r[ia]=d,r[aa]=u,r[oa]=V(window.location.href.split(`?`)[0]),r[sa]=Bn(o.replaceSensitiveString),r[ca]=window.innerHeight,r[la]=window.innerWidth,r);if(f[Yi]=t.getAttribute(`id`)||``,f[Xi]=t.getAttribute(`class`),f[ra]=l?.[`aria-label`],a===`a`&&e===`click`&&t instanceof HTMLAnchorElement){var p=t.href.substring(0,128);f[ea]=o.replaceSensitiveString(p)}return xa(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(wa(a)&&a.event.target!==null){if(i&&ma(a.event.target,a.type))return a.closestTrackedAncestor=a.event.target,a.targetElementProperties=o.getEventProperties(a.type,a.closestTrackedAncestor,r),a;var s=Sa(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=za(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=`[${Fn}], [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+=U;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 U;var t=``;return t=e.querySelector(`[data-amp-mask], [contenteditable]`)?o.getTextWithMaskedDescendants(e):e.innerText||``,o.replaceSensitiveString(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 xa((t={},t[Zi]=r,t[Qi]=o.getText(e),t[oa]=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}();o();var J;(function(e){e.ClickObservable=`clickObservable`,e.ChangeObservable=`changeObservable`,e.NavigateObservable=`navigateObservable`,e.MutationObservable=`mutationObservable`,e.BrowserErrorObservable=`browserErrorObservable`,e.SelectionObservable=`selectionObservable`,e.MouseMoveObservable=`mouseMoveObservable`})(J||={});var to=function(e,t){e===void 0&&(e={}),t?.diagnosticsClient.setTag(`plugin.autocapture.version`,`1.22.3`);var n=e.dataAttributePrefix,o=n===void 0?on:n,c=e.visualTaggingOptions,l=c===void 0?{enabled:!0}:c;e.cssSelectorAllowlist=e.cssSelectorAllowlist??an,e.actionClickAllowlist=e.actionClickAllowlist??sn,e.debounceTime=e.debounceTime??0,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 f=Ui,p=`enrichment`,m=[],h=new eo(e,t),g=function(){var t,n=G(Ma().map(function(t){return h.addAdditionalEventProperties(t,`click`,e.cssSelectorAllowlist,o)})),r=G(new W(function(t){var n,r=function(n){var r=h.addAdditionalEventProperties(n,`change`,e.cssSelectorAllowlist,o);t.next(r)};return(n=M())==null||n.document.addEventListener(`change`,r,{capture:!0}),function(){return M()?.document.removeEventListener(`change`,r)}})),i;window.navigation&&(i=G(new W(function(t){var n=function(n){var r=h.addAdditionalEventProperties(n,`navigate`,e.cssSelectorAllowlist,o);t.next(r)};return window.navigation.addEventListener(`navigate`,n),function(){window.navigation.removeEventListener(`navigate`,n)}})));var a=G(ja().map(function(t){return h.addAdditionalEventProperties(t,`mutation`,e.cssSelectorAllowlist,o)}));return t={},t[J.ChangeObservable]=r,t[J.ClickObservable]=n,t[J.MutationObservable]=a,t[J.NavigateObservable]=i,t},_=Ha(Object.values(e.pageActions?.labeledEvents??{})),v=Ua(e.pageActions?.triggers??[]),y=qa(_,v,h,e),b=function(t){t&&(e.pageActions=d(d({},e.pageActions),t),_=Ha(Object.values(e.pageActions.labeledEvents??{})),v=Ua(e.pageActions.triggers??[]),y.update(_,v,e))};return{name:f,type:p,setup:function(t,n){return s(void 0,void 0,void 0,function(){var i,s,c,p,_,v,x,S,C,w;return a(this,function(a){return typeof document>`u`?[2]:(t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe(`configs.analyticsSDK.pageActions`,`all`,function(e){b(e)}):t.loggerProvider.debug(`Remote config client is not provided, skipping remote config fetch`)),i=ga(e,e.cssSelectorAllowlist),s=ga(e,e.actionClickAllowlist),c=g(),p=Oa({allObservables:c,amplitude:n,shouldTrackEvent:i,evaluateTriggers:y.evaluate.bind(y)}),m.push(p),_=ka({allObservables:c,getEventProperties:function(){var e=[...arguments];return h.getEventProperties.apply(h,u(u([],r(e),!1),[o],!1))},amplitude:n,shouldTrackEvent:i,evaluateTriggers:y.evaluate.bind(y)}),m.push(_),v=Aa({allObservables:c,options:e,getEventProperties:function(){var e=[...arguments];return h.getEventProperties.apply(h,u(u([],r(e),!1),[o],!1))},amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:s}),v&&m.push(v),(w=t?.loggerProvider)==null||w.log(`${f} has been successfully added.`),window.opener&&l.enabled&&(x=e.cssSelectorAllowlist,S=e.actionClickAllowlist,C=wr(),Da(C,{dataExtractor:h,isElementSelectable:ga(e,u(u([],r(x),!1),r(S),!1)),cssSelectorAllowlist:x,actionClickAllowlist:S}),Er(C),C.setup(d({logger:t?.loggerProvider},t?.serverZone&&{endpoint:hr[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(m),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 no=3e3,ro=[`mutation`,`navigate`];function io(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,o=n.mutationObservable,s=n.navigateObservable,c=dr(a.filter(function(e){return Ca(e)&&i(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===Ta.LEFT_OR_TOUCH_CONTACT}),s?dr(o,s):o),l=null;return ur(c,function(e){return l&&ro.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},no)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track(Gi,d(d({},r(`click`,e.closestTrackedAncestor)),n),{time:e.timestamp})}})}o();var ao=4,oo=fn,so=50;function co(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>so||e.xMax-e.xMin>so}function lo(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 uo(e,t){var n=e[Math.max(0,e.length-ao+1)];return t.timestamp-n.timestamp>=oo}function fo(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}function po(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&&(co(u,e),l.push(e))}var p=ur(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 co(u,e),t=null,l.length===0||fo(l,e)||uo(l,e)||u.isOutOfBounds?(d&&(t=lo(l)),f(e)):l.push(e),d&&=(clearTimeout(d.timerId),d.resolve(t),null),l.length>=ao?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(lo(l))},oo)}})]:[2,null]})})}),m=c?.subscribe(function(){f()}),h=p.subscribe(function(e){e!==null&&n.track(Ki,e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),m?.unsubscribe()}}}o();var mo=2e3;function ho(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.clickObservable,a=n.browserErrorObservable,o=i.filter(function(e){return Ca(e)&&r(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===Ta.LEFT_OR_TOUCH_CONTACT}),s=null,c=null,l=function(){s!==null&&(clearTimeout(s),s=null),c=null};return dr(o,a).subscribe(function(e){var n;if(e.type===`click`){l(),c=e,s=setTimeout(l,mo);return}e.type===`error`&&c&&(t.track(qi,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 Y;(function(e){e.INCREASING=`increasing`,e.DECREASING=`decreasing`})(Y||={});var go;(function(e){e.X=`x`,e.Y=`y`})(go||={});var _o=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new W(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===Y.DECREASING&&e.next(go.X),r=Y.INCREASING):a.x<n.x&&(r===Y.INCREASING&&e.next(go.X),r=Y.DECREASING),a.y>n.y?(i===Y.DECREASING&&e.next(go.Y),i=Y.INCREASING):a.y<n.y&&(i===Y.INCREASING&&e.next(go.Y),i=Y.DECREASING),n=a})})};function vo(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 yo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return t.length<n?!1:t[t.length-1]-t[0]<r}function bo(e){e.changes=[],e.startTime=void 0}function xo(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 So(e,t){var n=void 0;if(yo(e)&&(n=e.startTime),yo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}var Co=10,wo=2e3,To=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=n===void 0?Co:n,i=e.thresholdMs,a=i===void 0?wo:i;return new W(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),bo(n),bo(i))}return t.subscribe(function(e){s!==null&&clearTimeout(s),vo(e===go.X?n:i);var t=So(n,i);return t?(o||=t,s=setTimeout(function(){c(),s=null},a)):c(),xo(n),xo(i),function(){s!==null&&(clearTimeout(s),s=null)}})})},Eo=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,a=i===void 0?Co:i,o=e.thresholdMs,s=o===void 0?wo:o;return To({mouseDirectionChangeObservable:_o({allWindowObservables:r}),directionChanges:a,thresholdMs:s}).subscribe(function(e){ha(n)&&t.track(Ji,void 0,{time:e})})};o();function Do(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 Oo=5,ko=4e3,Ao=function(e){e===void 0&&(e={});var t=Wi,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=Do(e,`rageClicks`,dn,f),h=Do(e,`deadClicks`,ln,l),g=Do(e,`errorClicks`,un,c),_=e.dataAttributePrefix??on,v=new eo(e),y=u([],r(new Set(u(u(u([],r(m),!1),r(h),!1),r(g),!1))),!1),b=function(){var e,t=G(Ma(`pointerdown`).map(function(e){return v.addAdditionalEventProperties(e,`click`,y,_,!0)})),n=G(Ia().map(function(e){return v.addTypeAndTimestamp(e,`error`)})),r=G(ja().map(function(e){return v.addAdditionalEventProperties(e,`mutation`,y,_)})),i;window.navigation&&(i=G(new W(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=G(new W(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=G(La());return e={},e[J.ClickObservable]=t,e[J.MutationObservable]=r,e[J.NavigateObservable]=i,e[J.BrowserErrorObservable]=n,e[J.SelectionObservable]=a,e[J.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,ee,te;return a(this,function(a){return typeof document>`u`?[2]:(i=b(),f&&(s=ga(e,m),u=po({allObservables:i,amplitude:r,shouldTrackRageClick:s}),o.push(u)),l&&(d=ga(e,h),y=io({amplitude:r,allObservables:i,getEventProperties:function(e,t){return v.getEventProperties(e,t,_)},shouldTrackDeadClick:d}),o.push(y)),c&&(x=ga(e,g),S=ho({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<Oo&&(n.loggerProvider.warn(`'thrashedCursor.directionChanges' of ${C} is below the minimum of ${Oo}, setting to ${Oo}`),C=Oo),w&&w>ko&&(n.loggerProvider.warn(`'thrashedCursor.threshold' of ${w} is above the maximum of ${ko}, setting to ${ko}`),w=ko)),ee=Eo({amplitude:r,options:e,allObservables:i,directionChanges:C,thresholdMs:w}),o.push(ee)),(te=n?.loggerProvider)==null||te.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(){ret
12urn 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]})})}}},jo=`@amplitude/plugin-network-capture-browser`;o();var Mo=`500-599`;function No(e,t){var n=`^`+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,`\\$&`).replace(/\*/g,`.*`)+`$`;return new RegExp(n).test(e)}function Po(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 Fo(e,t,n,r,i){if(!(e.hosts&&!e.hosts.find(function(e){return No(t,e)}))&&!(r&&e.urls&&!ht(r,e.urls))&&!(i&&e.methods&&!e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||e===`*`})))return!((n||n===0)&&!Po(n,e.statusCodeRange||Mo))}function Io(e){if(e)try{var t=M()?.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 Lo(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 Ro(e){if(typeof e!=`object`||!e)return e?u([],r(D),!1):void 0;if(e.length!==0)return e}function zo(e){return!e?.allowlist?.length&&!e?.blocklist?.length}function Bo(e,t){t===void 0&&(t={});var n=Io(e.url);if(!n)return!1;var i=n.host;if(t.ignoreAmplitudeRequests!==!1&&(No(i,`*.amplitude.com`)||No(i,`amplitude.com`))||t.ignoreHosts?.find(function(e){return No(i,e)})||!t.captureRules&&e.status!==void 0&&!Po(e.status,Mo))return!1;if(t.captureRules){var a;if(u([],r(t.captureRules),!1).reverse().find(function(t){if(a=Fo(t,i,e.status,e.url,e.method),a){var n=Ro(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var o=Ro(t.requestHeaders);if(e.requestWrapper&&o){var s=e.requestWrapper.headers(o);s&&(e.requestHeaders=s)}e.responseWrapper&&t.responseBody&&!zo(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!zo(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return a!==void 0}),!a)return!1}return!(e.requestWrapper&&Lo(i,e.requestWrapper))}function Vo(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 Ho(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return Bo(e.event,n)}).subscribe(function(e){var t,n=e.event,a=Io(n.url);if(a){var o=n.responseWrapper?.bodySize,s=n.requestWrapper?.bodySize;Vo((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 Uo;(function(e){e.NetworkObservable=`networkObservable`})(Uo||={});var Wo,Go=function(e){e===void 0&&(e={});var t=jo,n=`enrichment`,r,i=function(e,t){return{event:e,timestamp:Date.now(),type:t}},o=function(){var e,t=new W(function(e){var t=new jn(function(t){var n=i(t,`network`);e.next(n)});return Nn.subscribe(t,r),function(){Nn.unsubscribe(t)}});return e={},e[Uo.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,Wo=Ho({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 Wo.unsubscribe(),[2]})})}}},Ko=`web-vitals-browser`,qo=`[Amplitude] Web Vitals`,Jo=-1,Yo=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(Jo=t.timeStamp,e(t))}),!0)},X=(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)))}},Xo=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Zo=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Qo=()=>Zo()?.activationStart??0,Z=(e,t=-1)=>{let n=Zo(),r=`navigate`;return Jo>=0?r=`back-forward-cache`:n&&(document.prerendering||Qo()>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}},$o=new WeakMap;function es(e,t){return $o.get(e)||$o.set(e,new t),$o.get(e)}var ts=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)}},ns=(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{}},rs=e=>{let t=!1;return()=>{t||=(e(),!0)}},is=-1,as=new Set,os=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,ss=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of as)e();isFinite(is)||(is=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,ss,!0))}},cs=()=>
12{if(is<0){let e=Qo();is=(document.prerendering?void 0:globalThis.performance.getEntriesByType(`visibility-state`).filter((t=>t.name===`hidden`&&t.startTime>e))[0]?.startTime)??os(),addEventListener(`visibilitychange`,ss,!0),addEventListener(`prerenderingchange`,ss,!0),Yo((()=>{setTimeout((()=>{is=os()}))}))}return{get firstHiddenTime(){return is},onHidden(e){as.add(e)}}},ls=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},us=[1800,3e3],ds=(e,t={})=>{ls((()=>{let n=cs(),r,i=Z(`FCP`),a=ns(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Qo(),0),i.entries.push(t),r(!0)))}));a&&(r=X(e,i,us,t.reportAllChanges),Yo((n=>{i=Z(`FCP`),r=X(e,i,us,t.reportAllChanges),Xo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},fs=[.1,.25],ps=(e,t={})=>{let n=cs();ds(rs((()=>{let r,i=Z(`CLS`,0),a=es(t,ts),o=e=>{for(let t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,r())},s=ns(`layout-shift`,o);s&&(r=X(e,i,fs,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),Yo((()=>{a.i=0,i=Z(`CLS`,0),r=X(e,i,fs,t.reportAllChanges),Xo((()=>r()))})),setTimeout(r))})))},ms=0,hs=1/0,gs=0,_s=e=>{for(let t of e)t.interactionId&&(hs=Math.min(hs,t.interactionId),gs=Math.max(gs,t.interactionId),ms=gs?(gs-hs)/7+1:0)},vs,ys=()=>vs?ms:performance.interactionCount??0,bs=()=>{`interactionCount`in performance||vs||(vs=ns(`event`,_s,{type:`event`,buffered:!0,durationThreshold:0}))},xs=0,Ss=class{u=[];l=new Map;m;p;v(){xs=ys(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((ys()-xs)/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)}}},Cs=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=rs(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},ws=[200,500],Ts=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=cs();ls((()=>{bs();let r,i=Z(`INP`),a=es(t,Ss),o=e=>{Cs((()=>{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=ns(`event`,o,{durationThreshold:t.durationThreshold??40});r=X(e,i,ws,t.reportAllChanges),s&&(s.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),Yo((()=>{a.v(),i=Z(`INP`),r=X(e,i,ws,t.reportAllChanges)})))}))},Es=class{m;h(e){this.m?.(e)}},Ds=[2500,4e3],Os=(e,t={})=>{ls((()=>{let n=cs(),r,i=Z(`LCP`),a=es(t,Es),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-Qo(),0),i.entries=[t],r())},s=ns(`largest-contentful-paint`,o);if(s){r=X(e,i,Ds,t.reportAllChanges);let n=rs((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(Cs(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Yo((n=>{i=Z(`LCP`),r=X(e,i,Ds,t.reportAllChanges),Xo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))},ks=[800,1800],As=e=>{document.prerendering?ls((()=>As(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>As(e)),!0)},js=(e,t={})=>{let n=Z(`TTFB`),r=X(e,n,ks,t.reportAllChanges);As((()=>{let i=Zo();i&&(n.value=Math.max(i.responseStart-Qo(),0),n.entries=[i],r(!0),Yo((()=>{n=Z(`TTFB`,0),r=X(e,n,ks,t.reportAllChanges),r(!0)})))}))};o();function Ms(e){var t=e.entries[0]?.startTime||0;return performance.timeOrigin+t}function Ns(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Ms(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Ps=function(){var e=null,t=M(),n=t?.document,r=t?.location;return{name:Ko,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=V(r?.href||``,t.loggerProvider),s={"[Amplitude] Page Domain":r?.hostname||``,"[Amplitude] Page Location":o,"[Amplitude] Page Path":V(r?.pathname||``,t.loggerProvider),"[Amplitude] Page Title":typeof document<`u`&&document.title||``,"[Amplitude] Page URL":V(o.split(`?`)[0],t.loggerProvider)},Os(function(e){s[`[Amplitude] LCP`]=Ns(e)}),ds(function(e){s[`[Amplitude] FCP`]=Ns(e)}),Ts(function(e){s[`[Amplitude] INP`]=Ns(e)}),ps(function(e){s[`[Amplitude] CLS`]=Ns(e)}),js(function(e){s[`[Amplitude] TTFB`]=Ns(e)}),e=function(){n.visibilityState===`hidden`&&e&&(i.track(qo,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 Fs=function(e){var t=e.split(`.`);return t.length<=2?e:t.slice(t.length-2,t.length).join(`.`)},Is=function(e){return Object.values(e).every(function(e){return!e})},Ls=function(e,t,n,r,i){i===void 0&&(i=!0),e.referrer;var a=e.referring_domain,o=c(e,[`referrer`,`referring_domain`]),s=t||{};s.referrer;var l=s.referring_domain,u=c(s,[`referrer`,`referring_domain`]);if(Rs(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&&Is(e)&&t)return r.debug(`This is not a new campaign because this is a direct traffic in the same session.`),!1;var d=JSON.stringify(o)!==JSON.stringify(u),f=Fs(a||``)!==Fs(l||``),p=!t||d||f;return p?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.`),p},Rs=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})},zs=function(e,t){var n=d(d({},de),e);return De(Object.entries(n).reduce(function(e,n){var i=r(n,2),a=i[0],o=i[1];return e.setOnce(`initial_${a}
12`,o??t.initialEmptyValue??`EMPTY`),o?e.set(a,o):e.unset(a)},new k))},Bs=function(e){var t=e;return t?(t.startsWith(`.`)&&(t=t.substring(1)),[RegExp(`${t.replace(`.`,`\\.`)}\$`)]):[]};o();var Vs=function(){function e(e,t){this.shouldTrackNewCampaign=!1,this.options=d({initialEmptyValue:`EMPTY`,resetSessionOnNewCampaign:!1,excludeReferrers:Bs(t.cookieOptions?.domain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=wt(t.apiKey,`MKTG`),this.webExpStorageKey=wt(t.apiKey,`MKTG_ORIGINAL`),this.currentCampaign=de,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log(`Installing web attribution tracking.`)}return e.prototype.init=function(){return 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()];case 1:return t=r.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=this.lastEventTime?lt(this.sessionTimeout,this.lastEventTime):!0,Ls(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},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 Pn().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t=zs(this.currentCampaign,this.options);return e&&(t.event_id=e),t},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}();o();var Hs=`AMP_CURRENT_PAGE`,Us=`AMP_PREVIOUS_PAGE`,Ws=`AMP_URL_INFO`,Gs;(function(e){e.Direct=`direct`,e.Internal=`internal`,e.External=`external`})(Gs||={});var Ks=new Set([m.IDENTIFY,m.GROUP_IDENTIFY,m.REVENUE]),qs=function(e){var t=(e===void 0?{}:e).internalDomains,n=t===void 0?[]:t,i=M(),o=void 0,c=!1,l=void 0,u=!1,f=!1,p=function(e){var t;try{var n=V(e,l);t=new URL(n).hostname}catch(e){l?.error(`Could not parse URL: `,e)}return t},m=function(e){var t=typeof location<`u`&&location.hostname||``,r=e?p(e):void 0;if(!r)return Gs.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?Gs.Internal:Gs.External},h=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(Ws)]:[3,3];case 1:return e=a.sent(),t=V(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(Ws,(i={},i[Hs]=t,i[Us]=r,i))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},g=function(){h()};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:return l=e.loggerProvider,l.log(`Installing @amplitude/plugin-page-url-enrichment-browser`),f=!0,i?(o=new Tt(i.sessionStorage),[4,o.isEnabled()]):[3,2];case 1:c=t.sent(),i.addEventListener(`popstate`,g),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&&g()}}),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&&g()}}),!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=V(typeof location<`u`&&location.href||``),o&&c?[4,o.get(Ws)]:[3,5];case 1:return n=a.sent(),n?.AMP_CURRENT_PAGE?[3,3]:[4,o.set(Ws,(s={},s[Hs]=t,s[Us]=document.referrer||``,s))];case 2:a.sent(),a.label=3;case 3:return[4,o.get(Ws)];case 4:if(r=a.sent(),i=``,r&&(i=r.AMP_PREVIOUS_PAGE||``),Ks.has(e.event_type))return[2,e];e.event_properties=d(d({},e.event_properties||{}),{"[Amplitude] Page Domain":Js(e,`[Amplitude] Page Domain`,typeof location<`u`&&location.hostname||``),"[Amplitude] Page Location":Js(e,`[Amplitude] Page Location`,t),"[Amplitude] Page Path":Js(e,`[Amplitude] Page Path`,typeof location<`u`&&V(location.pathname)||``),"[Amplitude] Page Title":Js(e,`[Amplitude] Page Title`,Bn(zn)),"[Amplitude] Page URL":Js(e,`[Amplitude] Page URL`,t.split(`?`)[0]),"[Amplitude] Previous Page Location":i,"[Amplitude] Previous Page Type":m(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`,g),f=!1),o&&
12c?[4,o.set(Ws,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function Js(e,t,n){return e.event_properties||={},e.event_properties[t]===void 0?n:e.event_properties[t]}o();var Ys=-1,Xs=function(e){l(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,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),P(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=Ci(t),r=t.loggerProvider??new Fe,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 Vt(t.apiKey,r,i,{enabled:u,sampleRate:l}),d.setTag(`library`,`${Jr}/${qr}`),typeof navigator<`u`&&d.setTag(`user_agent`,navigator.userAgent),[4,xi(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&&Vi(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,Or(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=Hr(this.config),this.webAttribution=new Vs(t,this.config),[4,this.webAttribution.init()]);case 1:n.sent(),n.label=2;case 2:return[2]}})})}),p=Hr(this.config),this.webAttribution=new Vs(p,this.config),[4,this.webAttribution.init()]):[3,8];case 7:x.sent(),x.label=8;case 8:return m=pt(),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===Ys&&!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===Ys?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),y=at(t.instanceName),y.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===null?[3,10]:[4,this.add(Ri()).promise];case 9:x.sent(),x.label=10;case 10:return[4,this.add(new Ke({diagnosticsClient:d})).promise];case 11:return x.sent(),[4,this.add(new Zr).promise];case 12:return x.sent(),[4,this.add(new ct).promise];case 13:return x.sent(),Li(this.config),kr(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding file download tracking plugin`),[4,this.add(Fi()).promise]):[3,15];case 14:x.sent(),x.label=15;case 15:return Ar(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding form interaction plugin`),[4,this.add(Mi()).promise]):[3,17];case 16:x.sent(),x.label=17;case 17:return jr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(Oi(Vr(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(Oi(Vr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),x.label=20;case 20:return Fr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding user interactions plugin (autocapture plugin)`),[4,this.add(to(Rr(this.config),{diagnosticsClient:d})).promise]):[3,22];case 21:x.sent(),x.label=22;case 22:return Lr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding frustration interactions plugin`),[4,this.add(Ao(zr(this.config))).promise]):[3,24];case 23:x.sent(),x.label=24;case 24:return Pr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding network tracking plugin`),[4,this.add(Go(Br(this.config))).promise]):[3,26];
12case 25:x.sent(),x.label=26;case 26:return Ir(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding web vitals plugin`),[4,this.add(Ps()).promise]):[3,28];case 27:x.sent(),x.label=28;case 28:return Nr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding referrer page url plugin`),[4,this.add(qs()).promise]):[3,30];case 29:x.sent(),x.label=30;case 30:return this.initializing=!1,[4,this.runQueuedFunctions(`dispatchQ`)];case 31: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}),ot(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}),st(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(N()),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 k,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)),P(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=e??Ys,P(Promise.resolve());if(e===void 0&&(e=Date.now()),e===this.config.sessionId)return P(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,Mr(this.config.defaultTracking)&&(n&&r&&t.push(this.track(ui,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(De(this.config.identify)).promise),Mr(this.config.defaultTracking)&&t.push(this.track(li,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,P(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=wi(e)},t.prototype.identify=function(t,n){if(Kr(t)){var r=t._q;t._q=[],t=Gr(new k,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(Kr(r)){var a=r._q;r._q=[],r=Gr(new k,a)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(Kr(t)){var r=t._q;t._q=[],t=Gr(new Me,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=lt(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:`,pr(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}(je),Zs=function(){var e=new Xs;return{init:z(e.init.bind(e),`init`,L(e),R(e,[`config`])),add:z(e.add.bind(e),`add`,L(e),R(e,[`config.apiKey`,`timeline.plugins`])),remove:z(e.remove.bind(e),`remove`,L(e),R(e,[`config.apiKey`,`timeline.plugins`])),track:z(e.track.bind(e),`track`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),logEvent:z(e.logEvent.bind(e),`logEvent`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),identify:z(e.identify.bind(e),`identify`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),groupIdentify:z(e.groupIdentify.bind(e),`groupIdentify`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),setGroup:z(e.setGroup.bind(e),`setGroup`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),revenue:z(e.revenue.bind(e),`revenue`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),flush:z(e.flush.bind(e),`flush`,L(e),R(e,[`config.apiKey`,`timeline.queue.length`])),getUserId:z(e.getUserId.bind(e),`getUserId`,L(e),R(e,[`config`,`config.userId`])),setUserId:z(e.setUserId.bind(e),`setUserId`,L(e),R(e,[`config`,`config.userId`])),getDeviceId:z(e.getDeviceId.bind(e),`getDeviceId`,L(e),R(e,[`config`,`config.deviceId`])),setDeviceId:z(e.setDeviceId.bind(e),`setDeviceId`,L(e),R(e,[`config`,`config.deviceId`])),reset:z(e.reset.bind(e),`reset`,L(e),R(e,[`config`,`config.userId`,`config.deviceId`])),getSessionId:z(e.getSessionId.bind(e),`getSessionId`,L(e),R(e,[`config`])),setSessionId:z(e.setSessionId.bind(e),`setSessionId`,L(e),R(e,[`config`])),extendSession:z(e.extendSession.bind(e),`extendSession`,L(e),R(e,[`config`])),setOptOut:z(e.setOptOut.bind(e),`setOptOut`,L(e),R(e,[`config`])),setTransport:z(e.setTransport.bind(e),`setTransport`,L(e),R(e,[`config`])),getIdentity:z(e.getIdentity.bind(e),`getIdentity`,L(e),R(e,[`config`])),setIdentity:z(e.setIdentity.bind(e),`setIdentity`,L(e),R(e,[`config`,`config.userId`,`config.deviceId`])),getOptOut:z(e.getOptOut.bind(e),`getOptOut`,L(e),R(e,[`config`])),_setDiagnosticsSampleRate:z(e._setDiagnosticsSampleRate.bind(e),`_setDiagnosticsSampleRate`,L(e),R(e,[`config`]))}},Q=Zs(),Qs=t({DEFAULT_ACTION_CLICK_ALLOWLIST:()=>sn,DEFAULT_CSS_SELECTOR_ALLOWLIST:()=>an,DEFAULT_DATA_ATTRIBUTE_PREFIX:()=>on,IdentifyOperation:()=>p,LogLevel:()=>I,OfflineDisabled:()=>null,RevenueProperty:()=>F,ServerZone:()=>rn,SpecialEventType:()=>m}),$s=t({AmplitudeBrowser:()=>Xs,Identify:()=>k,Revenue:()=>Me,Types:()=>Qs,_setDiagnosticsSampleRate:()=>Cc,add:()=>ec,createInstance:()=>Zs,extendSession:()=>tc,flush:()=>nc,getDeviceId:()=>rc,getIdentity:()=>ic,getOptOut:()=>ac,getSessionId:()=>oc,getUserId:()=>sc,groupIdentify:()=>cc,identify:()=>lc,init:()=>uc,logEvent:()=>dc,remove:()=>fc,reset:()=>pc,revenue:()=>mc,runQueuedFunctions:()=>Wr,setDeviceId:()=>hc,setGroup:()=>gc,setIdentity:()=>_c,setOptOut:()=>vc,setSessionId:()=>yc,setTransport:()=>bc,setUserId:()=>xc,track:()=>Sc}
12),ec=Q.add,tc=Q.extendSession,nc=Q.flush,rc=Q.getDeviceId,ic=Q.getIdentity,ac=Q.getOptOut,oc=Q.getSessionId,sc=Q.getUserId,cc=Q.groupIdentify,lc=Q.identify,uc=Q.init,dc=Q.logEvent,fc=Q.remove,pc=Q.reset,mc=Q.revenue,hc=Q.setDeviceId,gc=Q.setGroup,_c=Q.setIdentity,vc=Q.setOptOut,yc=Q.setSessionId,bc=Q.setTransport,xc=Q.setUserId,Sc=Q.track,Cc=Q._setDiagnosticsSampleRate,wc={production:``,development:``,testing:``},Tc={plan:{version:`52`,branch:`main`,source:`web`,versionId:`50263a38-9a64-4557-9ff2-53ded1ea6a6e`},ingestionMetadata:{sourceName:`browser-typescript-ampli`,sourceVersion:`2.0.0`}},Ec=class{event_type=`ApplicationLoaded`},Dc=class{event_type=`ChangeUnitsButtonClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Oc=class{event_type=`ClickedFollowOnXButton`;constructor(e){this.event_properties=e,this.event_properties=e}},kc=class{event_type=`ClickedShareOnXButton`;constructor(e){this.event_properties=e,this.event_properties=e}},Ac=class{event_type=`ClickedShareOnXCopyOrDownloadButton`;constructor(e){this.event_properties=e,this.event_properties=e}},jc=class{event_type=`ClickedShareOnXCTA`;constructor(e){this.event_properties=e,this.event_properties=e}},Mc=class{event_type=`ComponentViewed`;constructor(e){this.event_properties=e,this.event_properties=e}},Nc=class{event_type=`ConnectWalletButtonClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Pc=class{event_type=`CTAButtonClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Fc=class{event_type=`DepositNetworkMismatch`;constructor(e){this.event_properties=e,this.event_properties=e}},Ic=class{event_type=`DestinationChainSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},Lc=class{event_type=`DestinationTokenSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},Rc=class{event_type=`DisconnectWalletButtonClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},zc=class{event_type=`EarnByAddingLiquidityClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Bc=class{event_type=`ErrorDisplayed`;constructor(e){this.event_properties=e,this.event_properties=e}},Vc=class{event_type=`FeesInfoExpanded`},Hc=class{event_type=`FromChainSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},Uc=class{event_type=`InputAmountPercentClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Wc=class{event_type=`LinkClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Gc=class{event_type=`MaxTokenAmountClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Kc=class{event_type=`MonitorDepositProgressClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},qc=class{event_type=`OriginChainSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},Jc=class{event_type=`OriginTokenSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},Yc=class{event_type=`PageViewed`;constructor(e){this.event_properties=e,this.event_properties=e}},Xc=class{event_type=`PMFButtonClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Zc=class{event_type=`QuickSwapButtonClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},Qc=class{event_type=`ToAccountChanged`;constructor(e){this.event_properties=e,this.event_properties=e}},$c=class{event_type=`ToChainSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},el=class{event_type=`TokenSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},tl=class{event_type=`TrackInExplorerClicked`;constructor(e){this.event_properties=e,this.event_properties=e}},nl=class{event_type=`TransferDepositCompleted`;constructor(e){this.event_properties=e,this.event_properties=e}},rl=class{event_type=`TransferFillCompleted`;constructor(e){this.event_properties=e,this.event_properties=e}},il=class{event_type=`TransferQuoteReceived`;constructor(e){this.event_properties=e,this.event_properties=e}},al=class{event_type=`TransferSigned`;constructor(e){this.event_properties=e,this.event_properties=e}},ol=class{event_type=`TransferSubmitted`;constructor(e){this.event_properties=e,this.event_properties=e}},sl=class{event_type=`WalletConnectTransactionCompleted`;constructor(e){this.event_properties=e,this.event_properties=e}},cl=class{event_type=`WalletNetworkSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},ll=class{event_type=`WalletSelected`;constructor(e){this.event_properties=e,this.event_properties=e}},ul=class{event_type=`WebVitals`;constructor(e){this.event_properties=e,this.event_properties=e}},dl=()=>({promise:Promise.resolve()}),$=new class{disabled=!1;amplitude;get client(){return this.isInitializedAndEnabled(),this.amplitude}get isLoaded(){return this.amplitude!=null}isInitializedAndEnabled(){return this.amplitude?!this.disabled:(console.error(`ERROR: Ampli is not yet initialized. Have you called ampli.load() on app start?`),!1)}load(e){if(this.disabled=e.disabled??!1,this.amplitude)return console.warn(`WARNING: Ampli is already intialized. Ampli.load() should be called once at application startup.`),dl();let t=null;if(e.client&&`apiKey`in e.client?t=e.client.apiKey:`environment`in e&&(t=wc[e.environment]),e.client&&`instance`in e.client)this.amplitude=e.client.instance;else if(t){this.amplitude=Zs();let n=e.client&&`configuration`in e.client?e.client.configuration:{};return this.amplitude.init(t,void 0,{...Tc,...n})}else console.error(`ERROR: ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'`);return dl()}
12identify(e,t,n){if(!this.isInitializedAndEnabled())return dl();e&&(n={...n,user_id:e});let r=new k,i=t;if(i!=null)for(let[e,t]of Object.entries(i))r.set(e,t);return this.amplitude.identify(r,n)}flush(){return this.isInitializedAndEnabled()?this.amplitude.flush():dl()}track(e,t){return this.isInitializedAndEnabled()?this.amplitude.track(e,void 0,t):dl()}applicationLoaded(e){return this.track(new Ec,e)}changeUnitsButtonClicked(e,t){return this.track(new Dc(e),t)}clickedFollowOnXButton(e,t){return this.track(new Oc(e),t)}clickedShareOnXButton(e,t){return this.track(new kc(e),t)}clickedShareOnXCopyOrDownloadButton(e,t){return this.track(new Ac(e),t)}clickedShareOnXcta(e,t){return this.track(new jc(e),t)}componentViewed(e,t){return this.track(new Mc(e),t)}connectWalletButtonClicked(e,t){return this.track(new Nc(e),t)}ctaButtonClicked(e,t){return this.track(new Pc(e),t)}depositNetworkMismatch(e,t){return this.track(new Fc(e),t)}destinationChainSelected(e,t){return this.track(new Ic(e),t)}destinationTokenSelected(e,t){return this.track(new Lc(e),t)}disconnectWalletButtonClicked(e,t){return this.track(new Rc(e),t)}earnByAddingLiquidityClicked(e,t){return this.track(new zc(e),t)}errorDisplayed(e,t){return this.track(new Bc(e),t)}feesInfoExpanded(e){return this.track(new Vc,e)}fromChainSelected(e,t){return this.track(new Hc(e),t)}inputAmountPercentClicked(e,t){return this.track(new Uc(e),t)}linkClicked(e,t){return this.track(new Wc(e),t)}maxTokenAmountClicked(e,t){return this.track(new Gc(e),t)}monitorDepositProgressClicked(e,t){return this.track(new Kc(e),t)}originChainSelected(e,t){return this.track(new qc(e),t)}originTokenSelected(e,t){return this.track(new Jc(e),t)}pageViewed(e,t){return this.track(new Yc(e),t)}pmfButtonClicked(e,t){return this.track(new Xc(e),t)}quickSwapButtonClicked(e,t){return this.track(new Zc(e),t)}toAccountChanged(e,t){return this.track(new Qc(e),t)}toChainSelected(e,t){return this.track(new $c(e),t)}tokenSelected(e,t){return this.track(new el(e),t)}trackInExplorerClicked(e,t){return this.track(new tl(e),t)}transferDepositCompleted(e,t){return this.track(new nl(e),t)}transferFillCompleted(e,t){return this.track(new rl(e),t)}transferQuoteReceived(e,t){return this.track(new il(e),t)}transferSigned(e,t){return this.track(new al(e),t)}transferSubmitted(e,t){return this.track(new ol(e),t)}walletConnectTransactionCompleted(e,t){return this.track(new sl(e),t)}walletNetworkSelected(e,t){return this.track(new cl(e),t)}walletSelected(e,t){return this.track(new ll(e),t)}webVitals(e,t){return this.track(new ul(e),t)}},fl=`arbitrum.arbitrumsepolia.arc.avalanche.base.basesepolia.blast.blastsepolia.bnbsmartchain.bsc.hypercore.hyperevm.ink.lens.lenssepolia.lighter.linea.lisk.lisksepolia.ethereum.megaeth.mode.modesepolia.monad.optimism.optimismsepolia.plasma.polygon.polygonamoy.robinhood.scroll.sepolia.solana.solanadevnet.soneium.tempo.unichain.unichainsepolia.worldchain.zksync.zora.hyperliquid`.split(`.`),pl=`-bridge`,ml=new Set(fl),hl=new Set(fl.map(e=>`${e}${pl}`));function gl(e){let t=e.toLowerCase();return hl.has(t)||ml.has(t)}function _l(e){return ml.has(e.toLowerCase())}function vl(e){let t=e.toLowerCase();return t.endsWith(pl)?t:`${t}${pl}`}function yl(e){let t=e.toLowerCase();return t.endsWith(pl)?t.slice(0,-7):t}var bl={"/":`marketingHomePage`,"/bridge":`bridgePage`,"/bridge-and-swap":`bridgePage`,"/pool":`poolPage`,"/rewards":`rewardsPage`,"/rewards/referrals":`referralPage`,"/rewards/optimism-grant-program":`referralPage`,"/airdrop":`airdropPage`,"/transfers":`transactionsPage`,"/blog":`marketingBlogHomePage`,"/privacy-policy":`marketingPrivacyPage`,"/terms-of-service":`marketingTermsPage`,...f().getPoolSymbols().reduce((e,t)=>({...e,[`/rewards/staking/${t.toLowerCase()}`]:`stakingPage`}),{})};function xl(){let e=Sl();if(/^\/bridge-and-swap\/0x[0-9a-fA-F]+$/.test(e))return`depositStatusPage`;if(/^\/blog\/[^/]+$/.test(e))return`marketingBlogSpecificPage`;let t=e.slice(1);return t&&gl(t)?`marketingHomePage`:bl[e]??`404Page`}function Sl(){let e=window.location.pathname.replace(/\/$/,``).toLowerCase();return e===``?`/`:e}function Cl(e){return $.connectWalletButtonClicked({action:`onClick`,element:`connectWalletButton`,page:xl(),section:e})}function wl(e){if(e)return $.walletSelected({page:xl(),action:`onClick`,element:`web3OnboardModal`,walletType:e})}function Tl(e,t,n){return $.walletConnectTransactionCompleted({isReconnect:n,succeeded:!0,walletAddress:e,walletType:t})}function El(e){return $.disconnectWalletButtonClicked({action:`onClick`,element:`disconnectWalletButton`,page:xl(),section:e})}function Dl(e){e&&$.client?.setUserId(e)}function Ol(e,t){if(!e||!t)return;$.client?.setUserId(e);let n=new k;return n.postInsert(`AllWalletAddressesConnected`,e),n.set(`WalletAddress`,e),n.set(`WalletType`,t),$.client?.identify(n)}function kl(e){let t=new k;return t.postInsert(`AllWalletChainIds`,e),$.client?.identify(t)}function Al(e,t){let n=new k;return n.set(`ThemePreference`,e),n.set(`Theme`,t),$.client?.identify(n)}function jl(){let e,t;try{e=document.referrer||void 0,t=e?.split(`/`)[2]??void 0}catch{return}if(!e||!t||t===`across.to`||t.endsWith(`.across.to`))return;let n=new k;return n.setOnce(`referrer`,e),n.setOnce(`referring_domain`,t),$.client?.identify(n)}function Ml(e){return $.maxTokenAmountClicked({action:`onClick`,element:`maxButton`,page:xl(),section:e})}var Nl=[`across.to`,`risklabs.foundation`];function Pl(e){try{let t=new URL(e);if(t.origin===window.location.origin)return!1;let n=t.hostname.toLowerCase();return!Nl.some(e=>n===e||n.endsWith(`.${e}`))}catch{return!1}}
12function Fl(e){return $.linkClicked({target_url:e,...Pl(e)&&{is_external:!0}})}function Il(e){return $.componentViewed({...e,page:xl()})}var Ll={viewed:`PromoBannerViewed`,clicked:`PromoBannerClicked`,dismissed:`PromoBannerDismissed`};function Rl(e,t,n){return $.client?.track(Ll[e],{campaignId:t,surface:n})}export{I as C,it as S,gl as _,kl as a,$s as b,Cl as c,Fl as d,Ml as f,_l as g,yl as h,Ol as i,El as l,Tl as m,jl as n,Dl as o,Rl as p,Al as r,Il as s,xl as t,wl as u,vl as v,uc as x,$ as y};

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.