1import{a as e,r as t,t as n}from"./rolldown-runtime-CNC7AqOf.js";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function i(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=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},a.apply(this,arguments)};function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function s(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function c(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function l(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function u(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function d(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var f;(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`})(f||={});var p;(function(e){e.IDENTIFY=`$identify`,e.GROUP_IDENTIFY=`$groupidentify`,e.REVENUE=`revenue_amount`})(p||={});var m=`AMP_unsent`,h=`$default_instance`,g=`https://api2.amplitude.com/2/httpapi`,_=`https://api.eu.amplitude.com/2/httpapi`,v=`https://api2.amplitude.com/batch`,y=`https://api.eu.amplitude.com/batch`,b=`utm_campaign`,x=`utm_content`,S=`utm_id`,C=`utm_medium`,w=`utm_source`,T=`utm_term`,E=`dclid`,D=`fbclid`,ee=`gbraid`,te=`gclid`,O=`ko_click_id`,k=`li_fat_id`,A=`msclkid`,ne=`rdt_cid`,re=`ttclid`,ie=`twclid`,ae=`wbraid`,j={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},M=`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(`.`),oe=[`authorization`,`cookie`,`set-cookie`],se=1e3,ce=function(e){if(Object.keys(e).length>se)return!1;for(var t in e){var n=e[t];if(!le(t,n))return!1}return!0},le=function(e,t){var n,r;if(typeof e!=`string`)return!1;if(Array.isArray(t)){var i=!0;try{for(var a=l(t),o=a.next();!o.done;o=a.next()){var s=o.value;if(Array.isArray(s))return!1;if(typeof s==`object`)i&&=ce(s);else if(![`number`,`string`].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}else if(t==null)return!1;else if(typeof t==`object`)return ce(t);else if(![`number`,`string`,`boolean`].includes(typeof t))return!1;return!0},N=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return a({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(P.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(P.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(P.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(P.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(P.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(P.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(P.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(P.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(P.UNSET,e,`-`),this},e.prototype.clearAll=function(){return this._properties={},this._properties[P.CLEAR_ALL]=`-`,this}
1,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[P.CLEAR_ALL]!==void 0||this._propertySet.has(t)?!1:e===P.ADD?typeof n==`number`:e!==P.UNSET&&e!==P.REMOVE?le(t,n):!0},e}(),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 F=[P.CLEAR_ALL,P.UNSET,P.SET,P.SET_ONCE,P.ADD,P.APPEND,P.PREPEND,P.PREINSERT,P.POSTINSERT,P.REMOVE],ue=`Event tracked successfully`,de=`Unexpected error occurred`,fe=`Event rejected due to exceeded retry count`,pe=`Event skipped due to optOut config`,me=`Event rejected due to missing API key`,he=`Client not initialized`,I;(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`})(I||={});var ge=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=I.Unknown),{event:e,code:t,message:n}},L=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 global<`u`)return global},_e=function(e){return e?(e^Math.random()*16>>e/4).toString(16):`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,R)},ve=d([],u(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,`0`)}),R=function(e){var t=L();if(!t?.crypto?.getRandomValues)return _e(e);var n=t.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,d([],u(n.entries()),!1).map(function(e){var t=u(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?`-${ve[r]}`:ve[r]}).join(``)},ye=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){return s(this,void 0,void 0,function(){var n;return c(this,function(r){switch(r.label){case 0:return e.name===void 0&&(e.name=R(),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.`)),n=e.name,this.pluginStatus.has(n)?(this.loggerProvider.warn(`Plugin with name ${n} already exists, skipping registration`),[2]):(e.type=e.type??`enrichment`,this.pluginStatus.set(n,`locked`),[4,e.setup?.call(e,t,this.client)]);case 1:return r.sent(),this.pluginStatus.get(n)===`locked`?(this.plugins.push(e),this.pluginStatus.set(n,`installed`),[2]):[2]}})})},e.prototype.deregister=function(e,t){return s(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:return this.pluginStatus.delete(e),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.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,s,d,f,p,m,h,g,_,f,p,v,y,b,x,S,C,w;return c(this,function(c){switch(c.label){case 0:if(!e)return[2];t=u(e,1),n=t[0],r=u(e,2),i=r[1],this.loggerProvider.log(`Timeline.apply: Initial event`,n),o=this.plugins.filter(function(e){return e.type===`before`}),c.label=1;case 1:c.trys.push([1,6,7,8]),s=l(o),d=s.next(),c.label=2;case 2:return d.done?[3,5]:(f=d.value,f.execute?[4,f.execute(a({},n))]:[3,4]);case 3:if(p=c.sent(),p===null)return this.loggerProvider.log(`Timeline.apply: Event filtered out by before plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),i({event:n,code:0,message:``}),[2];n=p,this.loggerProvider.log(`Timeline.apply: Event after before plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),c.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return m=c.sent(),x={error:m},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(x)throw x.error}
3return[7];case 8:h=this.plugins.filter(function(e){return e.type===`enrichment`||e.type===void 0}),c.label=9;case 9:c.trys.push([9,14,15,16]),g=l(h),_=g.next(),c.label=10;case 10:return _.done?[3,13]:(f=_.value,f.execute?[4,f.execute(a({},n))]:[3,12]);case 11:if(p=c.sent(),p===null)return this.loggerProvider.log(`Timeline.apply: Event filtered out by enrichment plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),i({event:n,code:0,message:``}),[2];n=p,this.loggerProvider.log(`Timeline.apply: Event after enrichment plugin '${String(f.name)}', event: ${JSON.stringify(n)}`),c.label=12;case 12:return _=g.next(),[3,10];case 13:return[3,16];case 14:return v=c.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=a({},n);return e.execute(t).catch(function(e){return ge(t,0,String(e))})}),Promise.all(b).then(function(e){var t=u(e,1)[0]||ge(n,100,`Event not tracked, no destination plugins on the instance`);i(t)}),[2]}})})},e.prototype.flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r=this;return c(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,i,a,o,s;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,7,8,9]),t=l(this._optOutListeners),n=t.next(),c.label=1;case 1:if(n.done)return[3,6];r=n.value,c.label=2;case 2:return c.trys.push([2,4,,5]),[4,r(e)];case 3:return c.sent(),[3,5];case 4:return i=c.sent(),this.loggerProvider.error(`Error calling optOut listener`,i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return a=c.sent(),o={error:a},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;(t=e.onReset)==null||t.call(e)})},e}(),be=function(e,t,n){return a(a(a({},typeof e==`string`?{event_type:e}:e),n),t&&{event_properties:t})},xe=function(e,t){return a(a({},t),{event_type:p.IDENTIFY,user_properties:e.getUserProperties()})},Se=function(e,t,n,r){var i;return a(a({},r),{event_type:p.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)})},Ce=function(e,t,n){var r,i=new N;return i.set(e,t),a(a({},n),{event_type:p.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[e]=t,r)})},we=function(e,t){return a(a({},t),{event_type:p.REVENUE,event_properties:e.getEventProperties()})},z=function(e){return{promise:e||Promise.resolve()}},Te=function(){function e(e){e===void 0&&(e=`$default`),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new ye(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){return c(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,i,a,o,s,u;return c(this,function(c){switch(c.label){case 0:t=this[e],this[e]=[],c.label=1;case 1:c.trys.push([1,8,9,10]),n=l(t),r=n.next(),c.label=2;case 2:return r.done?[3,7]:(i=r.value,a=i(),a&&`promise`in a?[4,a.promise]:[3,4]);case 3:return c.sent(),[3,6];case 4:return[4,a];case 5:c.sent(),c.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return o=c.sent(),s={error:o},[3,10];case 9:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}
3return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:c.sent(),c.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,n){var r=be(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),z(this.dispatch(r))},e.prototype.identify=function(e,t){var n=xe(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),z(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=Se(e,t,n,r);return z(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=Ce(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),z(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=we(e,t);return z(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),z())},e.prototype._addPlugin=function(e){return z(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)),z())},e.prototype._removePlugin=function(e){return z(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(ge(e,0,he));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return c(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=a({},this.userProperties??{});if(e===void 0)return t;var n={};return Object.keys(e).forEach(function(t){Object.values(f).includes(t)||(n[t]=e[t])}),F.forEach(function(n){if(Object.keys(e).includes(n)){var r=e[n];switch(n){case f.CLEAR_ALL:Object.keys(t).forEach(function(e){delete t[e]});break;case f.UNSET:Object.keys(r).forEach(function(e){delete t[e]});break;case f.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 c(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,ge(e,0,pe)]:(e.event_type===p.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=ge(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 z(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}(),Ee=function(){function e(){this.productId=``,this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));ce(t)&&(this.properties=t)}catch{}return this},e.prototype.getEventProperties=function(){var e=this.properties?a({},this.properties):{};return e[B.REVENUE_PRODUCT_ID]=this.productId,e[B.REVENUE_QUANTITY]=this.quantity,e[B.REVENUE_PRICE]=this.price,e[B.REVENUE_TYPE]=this.revenueType,e[B.REVENUE_CURRENCY]=this.currency,e[B.REVENUE]=this.revenue,e[B.RECEIPT]=this.receipt,e[B.RECEIPT_SIG]=this.receiptSig,e},e}(),B;(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`})(B||={});var De=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},[])},V;(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`})(V||={});var Oe=`Amplitude Logger `,ke=function(){function e(){this.logLevel=V.None}return e.prototype.disable=function(){this.logLevel=V.None},e.prototype.enable=function(e){e===void 0&&(e=V.Warn),this.logLevel=e},e.prototype.log=function(){var e=[...arguments];this.logLevel<V.Verbose||console.log(`${Oe}[Log]: ${e.join(` `)}`)},e.prototype.warn=function(){var e=[...arguments];this.logLevel<V.Warn||console.warn(`${Oe}[Warn]: ${e.join(` `)}`)},e.prototype.error=function(){var e=[...arguments];this.logLevel<V.Error||console.error(`${Oe}[Error]: ${e.join(` `)}`)},e.prototype.debug=function(){var e=[...arguments];this.logLevel<V.Debug||console.log(`${Oe}[Debug]: ${e.join(` `)}`)},e}(),Ae=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:V.Warn,loggerProvider:new ke,offline:!1,optOut:!1,serverUrl:g,serverZone:`US`,useBatch:!1}},je=function(){function e(e){this._optOut=!1;var t=Ae();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=Ne(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}(),Me=function(e,t){return e===`EU`?t?y:_:t?v:g},Ne=function(e,t,n){if(e===void 0&&(e=``),t===void 0&&(t=Ae().serverZone),n===void 0&&(n=Ae().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=[`US`,`EU`].includes(t)?t:Ae().serverZone;return{serverZone:r,serverUrl:Me(r,n)}},Pe=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function Fe(e){return e>=200&&e<300}var Ie=function(e){return e===void 0&&(e=0),(Error().stack||``).split(` 4`).slice(2+e).map(function(e){return e.trim()})},H=function(e){return function(){var t=a({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},Le=function(e,t){var n,r;t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``);try{for(var i=l(t.split(`.`)),a=i.next();!a.done;a=i.next()){var o=a.value;if(o in e)e=e[o];else return}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},U=function(e,t){return function(){var n,r,i={};try{for(var a=l(t),o=a.next();!o.done;o=a.next()){var s=o.value;i[s]=Le(e,s)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}},W=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<V.Debug||!c||!s)return e.apply(i,a);var l={type:`invoke public method`,name:t,args:a,stacktrace:Ie(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}},Re=new Set([g,_,v,y]),ze=function(e,t){return t===void 0&&(t=!1),Re.has(e)?!0:t};function Be(e){return e instanceof Error?e.message:String(e)}function Ve(e){var t=``;try{`body`in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var He=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 c(this,function(r){switch(r.label){case 0:return this.config=e,this.storageKey=`${m}_${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||=R(),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,fe),!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 c(this,function(a){switch(a.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=De(t,this.config.flushQueueSize),[4,r.reduce(function(t,n){return s(i,void 0,void 0,function(){return c(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 a.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,a,s,l,u;return c(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,me)];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,o(t,[`extra`])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new Pe,c.label=1;case 1:return c.trys.push([1,3,,4]),i=Ne(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,a=ze(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,a)];case 2:return s=c.sent(),s===null?(this.fulfillRequest(e,0,de),[2]):t?(this.handleResponse(s,e),[3,4]):(`body`in s?this.fulfillRequest(e,s.statusCode,`${s.status}: ${Ve(s)}`):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return l=c.sent(),u=Be(l),this.config.loggerProvider.error(u),(n=this.diagnosticsClient)==null||n.recordEvent(`anal
4ytics.events.unsuccessful.from.catch.error`,{events:e.map(function(e){return e.event.event_type}),message:u,stack_trace:Ie()}),this.handleResponse({status:I.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){var n;Fe(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:Ve(e),stack_trace:Ie()});var r=e.status;switch(r){case I.Success:this.handleSuccessResponse(e,t);break;case I.Invalid:this.handleInvalidResponse(e,t);break;case I.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case I.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,ue)},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 r=d(d(d(d([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),i=new Set(r),a=t.filter(function(t,r){if(i.has(r)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(Ve(e));var o=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(t.length===1){this.fulfillRequest(t,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Ve(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(Ve(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;Fe(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:Ie()})),this.removeEvents(e),e.forEach(function(e){return e.callback(ge(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}(),Ue=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:We(),platform:`Web`,os:void 0,deviceModel:void 0}},e}(),We=function(){return typeof navigator<`u`&&(navigator.languages&&navigator.languages[0]||navigator.language)||``},Ge=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}(),Ke=function(){return Ke=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},Ke.apply(this,arguments)};function qe(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 Je(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 Ye=function(e,t){var n,r,i=[`string`,`number`,`boolean`,`undefined`],a=typeof e;if(a!==typeof t)return!1;try{for(var o=qe(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(!Ye(e[u],t[u]))return!1}else{if(!Ye(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var d=!0;return Object.keys(e).forEach(function(n){Ye(e[n],t[n])||(d=!1)}),d}return!0},Xe=`$set`,Ze=`$unset`,Qe=`$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 $e=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Ke({},this.identity.userProperties),n=Ke(Ke({},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=qe(Object.entries(e)),u=l.next();!u.done;u=l.next()){var d=Je(u.value,2),f=d[0],p=d[1];switch(f){case Xe:try{for(var m=(i=void 0,qe(Object.entries(p))),h=m.next();!h.done;h=m.next()){var g=Je(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 Ze:try{for(var y=(o=void 0,qe(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 Qe: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 Ke({},this.identity)},e.prototype.setIdentity=function(e){var t=Ke({},this.identity);this.identity=Ke({},e),Ye(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}(),et=typeof globalThis<`u`?globalThis:typeof global<`u`?global:self,tt=function(){function e(){this.identityStore=new $e,this.eventBridge=new Ge,this.applicationContextProvider=new Ue}return e.getInstance=function(t){return et.analyticsConnectorInstances||={},et.analyticsConnectorInstances[t]||(et.analyticsConnectorInstances[t]=new e),et.analyticsConnectorInstances[t]},e}(),nt=function(e){return e===void 0&&(e=h),tt.getInstance(e)},rt=function(e,t){nt(t).identityStore.editIdentity().setUserId(e).commit()},it=function(e,t){nt(t).identityStore.editIdentity().setDeviceId(e).commit()},at=function(){function e(){this.name=`identity`,this.type=`before`,this.identityStore=nt().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return c(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 c(this,function(t){return e.instanceName&&(this.identityStore=nt(e.instanceName).identityStore),[2]})})},e}(),ot=function(e,t){return t===void 0&&(t=Date.now()),Date.now()-t>e},st=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(
4Boolean).join(`_`)},ct=function(e){return`amp_${e.substring(0,6)}`},lt=function(){if(typeof navigator>`u`)return``;var e=navigator.userLanguage;return navigator.languages?.[0]??navigator.language??e??``},ut=function(){var e=L();return e?.location?.search?e.location.search.substring(1).split(`&`).filter(Boolean).reduce(function(e,t){var n=t.split(`=`,2),r=dt(n[0]),i=dt(n[1]);return i&&(e[r]=i),e},{}):{}},dt=function(e){e===void 0&&(e=``);try{return decodeURIComponent(e)}catch{return``}},ft=function(e,t){return!t||!t.length||t.some(function(t){return typeof t==`string`?e===t:e.match(t)})},G=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){t?.error(`Malformed URI sequence: `,e)}return n},pt=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},mt=function(e,t){var n=pt(e.toString());return Math.abs(n)*31%1e5/1e5<t},ht=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},gt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return c(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return c(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 c(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 c(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return c(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return c(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),_t=function(){return L()?.navigator?.locks},vt=function(){function e(e,t){t===void 0&&(t={}),this.options=a({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return c(this,function(s){switch(s.label){case 0:return t=`AMP_TEST`,n=a({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var a=e.get()===i;return!a&&o.config.diagnosticsClient&&((n=o.config.diagnosticsClient)==null||n.recordEvent(`cookies.isEnabled.failure`,{reason:`Test Value mismatch`,testKey:t,testValue:i,sync:!0})),a}catch(e){if(o.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);(r=o.config.diagnosticsClient)==null||r.recordEvent(`cookies.isEnabled.failure`,{reason:`Cookie getter/setter failed`,testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,s.sent()]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return c(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=xt(t);if(n===void 0){console.error(`Amplitude Logger [Error]: Failed to decode cookie value for key: ${e}, value: ${t}`);return}return JSON.parse(n)}catch{console.error(`Amplitude Logger [Error]: Failed to parse cookie value for key: ${e}, value: ${t}`);return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a,o,s,u,d,f,p;return c(this,function(c){switch(c.label){case 0:r=L(),i=r,c.label=1;case 1:return c.trys.push([1,4,,5]),a=i?.cookieStore,a?[4,a.getAll(e)]:[3,3];case 2:if(o=c.sent(),o){o.length>1&&((t=this.config.diagnosticsClient)==null||t.recordEvent(`cookies.duplicate`,{cookies:o.map(function(e){return e.domain})}),(n=this.config.diagnosticsClient)==null||n.increment(`cookies.duplicate.occurrence.cookieStore`));try{for(s=l(o),u=s.next();!u.done;u=s.next())if(d=u.value,St(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}
4finally{try{u&&!u.done&&(p=s.return)&&p.call(s)}finally{if(f)throw f.error}}}c.label=3;case 3:return[3,5];case 4:return c.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t=this,n=((L()?.document)?.cookie.split(`; `)??[]).filter(function(t){return t.indexOf(e+`=`)===0}),r=void 0,i=this.config.duplicateResolverFn;if(typeof i==`function`&&n.length>1&&(r=n.find(function(n){var r;try{var a=i(n.substring(e.length+1));return a||(r=t.config.diagnosticsClient)==null||r.increment(`cookies.duplicate.occurrence.document.cookie`),a}catch{return!1}})),r||=n[0],r)return r.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return c(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){try{var n=L();if(!n||!n.document||typeof n.btoa!=`function`||typeof n.encodeURIComponent!=`function`)return;var r=this.options.expirationDays??0,i=t===null?-1:r,a=void 0;if(i){var o=new Date;o.setTime(o.getTime()+i*24*60*60*1e3),a=o}var s=`${e}=${n.btoa(n.encodeURIComponent(JSON.stringify(t)))}`;a&&(s+=`; expires=${a.toUTCString()}`),s+=`; path=/`,this.options.domain&&(s+=`; domain=${this.options.domain}`),this.options.secure&&(s+=`; Secure`),this.options.sameSite&&(s+=`; SameSite=${this.options.sameSite}`),n.document.cookie=s}catch(t){var c=t instanceof Error?t.message:String(t);console.error(`Amplitude Logger [Error]: Failed to set cookie for key: ${e}. Error: ${c}`)}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return c(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 c(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r,i,a;return c(this,function(o){switch(o.label){case 0:if(e.cachedTlds[t])return[2,!0];n={domain:`.`+t},r=`AMP_TLDTEST`,i=new e(n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.transaction(r,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return a=o.sent(),[2,!!a];case 3:return o.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return c(this,function(a){switch(a.label){case 0:if(n=_t(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.request(`com.amplitude:cookie-lock:${e}`,r)];case 2:return[2,a.sent()];case 3:return a.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),yt=function(e){try{return decodeURIComponent(atob(e))}catch{return}},bt=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}},xt=function(e){return yt(e)??bt(e)},St=function(e,t){if(e===``&&t===``)return!0;if(!e||!t)return!1;var n=e.startsWith(`.`)?e.substring(1):e,r=t.startsWith(`.`)?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},Ct=function(e,t,n){return t===void 0&&(t=``),n===void 0&&(n=10),[`AMP`,t,e.substring(0,n)].filter(Boolean).join(`_`)},wt=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 c(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 c(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 c(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 c(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 c(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 c(this,function(t){try{(e=this.storage)==null||e.clear()}catch{}return[2]})})},e}(),Tt=10,Et=1,K={TAGS:`tags`,COUNTERS:`counters`,HISTOGRAMS:`histograms`,EVENTS:`events`,INTERNAL:`internal`},Dt={LAST_FLUSH_TIMESTAMP:`last_flush_timestamp`},Ot=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName=`AMP_diagnostics_${e.substring(0,10)}`}return e.isSupported=function(){return L()?.indexedDB!==void 0},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return c(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,Et);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(K.TAGS)||e.createObjectStore(K.TAGS,{keyPath:`key`}),e.objectStoreNames.contains(K.COUNTERS)||e.createObjectStore(K.COUNTERS,{keyPath:`key`}),e.objectStoreNames.contains(K.HISTOGRAMS)||e.createObjectStore(K.HISTOGRAMS,{keyPath:`key`}),e.objectStoreNames.contains(K.EVENTS)||e.createObjectStore(K.EVENTS,{keyPath:`id`,autoIncrement:!0}).createIndex(`time_idx`,`time`,{unique:!1}),e.objectStoreNames.contains(K.INTERNAL)||e.createObjectStore(K.INTERNAL,{keyPath:`key`})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return c(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([K.TAGS],`readwrite`),r=n.objectStore(K.TAGS),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){a.logger.debug(`DiagnosticsStorage: Failed to set tags`,e),t()},i.forEach(function(e){var t=u(e,2),n=t[0],i=t[1],o=r.put({key:n,value:i});o.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to set tag`,n,i,e)}})})];case 2:return i=o.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set tags`,i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return c(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([K.COUNTERS],`readwrite`),r=n.objectStore(K.COUNTERS),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){a.logger.debug(`DiagnosticsStorage: Failed to increment counters`,e),t()},i.forEach(function(e){var t=u(e,2),n=t[0],i=t[1],o=r.get(n);o.onsuccess=function(){var e=o.result,t=e?e.value:0,s=r.put({key:n,value:t+i});s.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to update counter`,n,e)}},o.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to read existing counter`,n,e)}})})];case 2:return i=o.sent(),this.logger.debug(`DiagnosticsStorage: Failed to increment counters`,i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return c(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([K.HISTOGRAMS],`readwrite`),r=n.objectStore(K.HISTOGRAMS),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){a.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,e),t()},i.forEach(function(e){var t=u(e,2),n=t[0],i=t[1],o=r.get(n);o.onsuccess=function(){var e=o.result,t=e?{key:n,count:e.count+i.count,min:Math.min(e.min,i.min),max:Math.max(e.max,i.max),sum:e.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},s=r.put(t);s.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,n,e)}},o.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to read existing histogram stats`,n,e)}})})];case 2:return i=o.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set histogram stats`,i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return c(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e.length===0?[2]:[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([K.EVENTS],`readwrite`),r=n.objectStore(K.EVENTS),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){a.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,Tt-t);n<e.length&&a.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){a.logger.debug(`DiagnosticsStorage: Failed to add event record`,e)}})},i.onerror=function(e){a.logger.debug(`DiagnosticsStorage: Failed to count existing events`,e)}})];case 2:return i=o.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,a;return c(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=o.sent(),r=n.transaction([K.INTERNAL],`readwrite`),i=r.objectStore(K.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 a=o.sent(),this.logger.debug(`DiagnosticsStorage: Failed to set internal value`,a),[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 c(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([K.INTERNAL],`readonly`),r=n.objectStore(K.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 c(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(Dt.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 c(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(Dt.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,r,i,a,o,s;return c(this,function(c){switch(c.label){case 0:return c.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=c.sent(),t=e.transaction([K.TAGS,K.COUNTERS,K.HISTOGRAMS,K.EVENTS],`readwrite`),[4,Promise.all([this.getAllFromStore(t,K.TAGS),this.getAllFromStore(t,K.COUNTERS),this.getAllFromStore(t,K.HISTOGRAMS),this.getAllFromStore(t,K.EVENTS)])];case 2:return n=u.apply(void 0,[c.sent(),4]),r=n[0],i=n[1],a=n[2],o=n[3],[4,Promise.all([this.clearTable(t,K.COUNTERS),this.clearTable(t,K.HISTOGRAMS),this.clearTable(t,K.EVENTS)])];case 3:return c.sent(),[2,{tags:r,counters:i,histogramStats:a,events:o}];case 4:return s=c.sent(),this.logger.debug(`DiagnosticsStorage: Failed to get all and clear data`,s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(Error(`Failed to get all from ${t}`))}})},e}(),kt=`__AMPLITUDE_SCRIPT_URL__`,At=`sdk.error.uncaught`,jt=function(){var e=L();if(!e)return[];var t=e[kt];return Array.isArray(t)?t:typeof t==`string`?[t]:[]},Mt=function(e){var t=L();if(!(!t||typeof t.addEventListener!=`function`)){var n=function(e){var t=e.error instanceof Error?e.error:void 0,n=t?.stack,r=Nt({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=Pt(n),a=Nt({filename:r,stack:n});a&&i({type:`unhandledrejection`,message:t?.message??Ft(e.reason),stack:n,filename:r,errorName:t?.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},i=function(t){e.recordEvent(At,a({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)}},Nt=function(e){var t,n,r=jt();if(r.length!==0)try{for(var i=l(r),a=i.next();!a.done;a=i.next()){var o=a.value;if(e.filename&&e.filename.includes(o))return`filename`;if(e.stack&&e.stack.includes(o))return`stack`}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},Pt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},Ft=function(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return`[object Object]`}},It=1e3,Lt=300*1e3,Rt=`https://diagnostics.prod.us-west-2.amplitude.com/v1/capture`,zt=`https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture`,Bt=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`?Rt:zt,this.logger.debug(`DiagnosticsClient: Initializing with options`,JSON.stringify(r,null,2)),this.config=a({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=mt(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,Ot.isSupported()?this.storage=new Ot(e,t):this.logger.debug(`DiagnosticsClient: IndexedDB is not supported`),this.initializeFlushInterval(),this.shouldTrack&&(this.increment(`sdk.diagnostics.sampled.in.and.enabled`),Mt(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})},It),this.flushTimer||=setTimeout(function(){e._flush().catch(function(t){e.logger.debug(`DiagnosticsClient: Failed to flush`,t)}).finally(function(){e.flushTimer=null})},Lt)},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return c(this,function(i){switch(i.label){case 0:return this.storage?(e=a({},this.inMemoryTags),t=a({},this.inMemoryCounters),n=a({},this.inMemoryHistograms),r=d([],u(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,l,u;return c(this,function(c){switch(c.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return c.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=c.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),a={},t.forEach(function(e){a[e.key]=e.value}),o={}
4,n.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[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(o).length===0&&Object.keys(s).length===0&&l.length===0?[2]:(u={tags:a,histogram:s,counters:o,events:l},this.fetch(u),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t,n;return c(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!L())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 c(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(Lt),[2]):(n=e-t,n>=3e5?(this._flush(),[2]):(this._setFlushTimer(Lt-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=mt(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug(`DiagnosticsClient: Should track is`,this.shouldTrack)},e}(),Vt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if(typeof e!=`object`)return null;var t=e.code||0,n=this.buildStatus(t);switch(n){case I.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 I.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 I.PayloadTooLarge:return{status:n,statusCode:t,body:{error:e.error??``}};case I.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 I.Timeout:default:return{status:n,statusCode:t}}},e.prototype.buildStatus=function(e){return Fe(e)?I.Success:e===429?I.RateLimit:e===413?I.PayloadTooLarge:e===408?I.Timeout:e>=400&&e<500?I.Invalid:e>=500?I.Failed:I.Unknown},e}();function Ht(){return typeof CompressionStream<`u`}function Ut(e){return s(this,void 0,void 0,function(){var t,n;return c(this,function(r){switch(r.label){case 0:if(t=CompressionStream,t===void 0)return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t(`gzip`)),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var 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}();function Gt(e,t){return new Promise(function(n,r){var i=function(){var e=Error(`Remote config custom fetch aborted by timeout`);e.name=`AbortError`,r(e)};t.addEventListener(`abort`,i,{once:!0}),e.then(function(e){t.removeEventListener(`abort`,i),n(e)},function(e){t.removeEventListener(`abort`,i),r(e)})})}
4var Kt={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},qt=1e3,Jt=300*1e3,Yt=function(){function e(e,t,n,r,i){n===void 0&&(n=`US`),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=r||(n===`US`?`https://sr-client-cfg.amplitude.com/config`:`https://sr-client-cfg.eu.amplitude.com/config`),this.logger=t,this.storage=new Wt(e,t),this.customFetch=i}return e.prototype.subscribe=function(e,t,n){var r=R(),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 c(this,function(r){switch(r.label){case 0:return this.lastSuccessfulFetch&&(e=Date.now()-this.lastSuccessfulFetch,e<Jt)?(this.logger.debug(`Remote config client skipping updateConfigs: Too recent`),[2]):[4,this.getOrCreateFetchPromise()];case 1:return t=r.sent(),this.storage.setConfig(t),this.callbackInfos.forEach(function(e){n.sendCallback(e,t,`remote`)}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug(`Remote config client skipping fetch: Invalid API key`),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return t.remoteConfig!==null&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return c(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 c(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=qt),s(this,void 0,void 0,function(){var n,r,i,a,o,s,l=this;return c(this,function(u){switch(u.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,o,s,u,d,f,p,m,h,g,_;return c(this,function(c){switch(c.label){case 0:i=!0,o=new AbortController,s=setTimeout(function(){return o.abort()},t),c.label=1;case 1:return c.trys.push([1,10,11,12]),u=a.getUrlParams(),d={Accept:`*/*`},a.customFetch?[4,Gt(a.customFetch({url:u,method:`GET`,headers:d,signal:o.signal}),o.signal)]:[3,3];case 2:return p=c.sent(),[3,5];case 3:return[4,fetch(u,{method:`GET`,headers:d,signal:o.signal})];case 4:p=c.sent(),c.label=5;case 5:return f=p,m=f.ok||f.status>=200&&f.status<300,m?[3,7]:[4,f.text()];case 6:return h=c.sent(),a.logger.debug(`Remote config client fetch with retry time ${e} failed with ${f.status}: ${h}`),f.status===Kt.INVALID_API_KEY||f.status===Kt.FORBIDDEN?(a.logger.error(`Remote config client fetch failed with ${f.status}. Invalid API key; future fetches will be skipped.`),a.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==Kt.RATE_LIMIT&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return g=c.sent(),[2,{value:{remoteConfig:g,lastFetch:new Date}}];case 9:return[3,12];case 10:return _=c.sent(),_ instanceof Error&&_.name===`AbortError`?a.logger.debug(`Remote config client fetch with retry time ${e} timed out after ${t}ms`):a.logger.debug(`Remote config client fetch with retry time ${e} is rejected because: `,_),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(n))})]:[3,14]:[2,`break`];case 13:c.sent(),c.label=14;case 14:return[2]}})},a=this,o=0,u.label=1;case 1:return o<e?[5,i(o)]:[3,4];case 2:if(s=u.sent(),typeof s==`object`)return[2,s.value];if(s===`break`)return[3,4];u.label=3;case 3:return o++,[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}(),Xt=L()?.console,Zt={},Qt={},$t=!1;function en(e){return!Xt||typeof Xt[e]!=`function`?!1:Qt[e]?!0:(Qt[e]=Xt[e],Xt[e]=function(){var t=[...arguments];try{if(Zt[e]&&!$t){$t=!0;var n=Zt[e];n&&n.forEach(function(n){try{n(e,t)}catch{}})}}catch{}return $t=!1,Qt[e].apply(Xt,t)},!0)}function tn(e,t){if(!en(e))return Error(`Console override failed`);Zt[e]?Zt[e].push(t):Zt[e]=[t]}function nn(e){var t,n;try{for(var r=l(Object.values(Zt)),i=r.next();!i.done;i=r.next())for(var a=i.value,o=a.length-1;o>=0;o--)if(a[o]===e){a.splice(o,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}function rn(){var e,t;try{for(var n=l(Object.entries(Qt)),r=n.next();!r.done;r=n.next()){var i=u(r.value,2),a=i[0],o=i[1];o&&(Xt[a]=o)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Qt={},Zt={}}var an={addListener:tn,removeListener:nn,_restoreConsole:rn},on;(function(e){e.US=`US`,e.EU=`EU`,e.STAGING=`STAGING`})(on||={});var sn=[`a`,`button`,`input`,`select`,`textarea`,`label`,`video`,`audio`,`[contenteditable="true" i]`,`[data-amp-default-track]`,`.amp-default-track`],cn=`data-amp-track-`,ln=[`div`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],un=d([`input[type="button"]`,`input[type="submit"]`,`input[type="reset"]`,`input[type="image"]`,`input[type="file"]`],u([`a`,`button`,`[role="button"]`,`[role="link"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="option"]`,`[role="tab"]`,`[role="treeitem"]`,`[contenteditable="true" i]`]),!1),dn=un,fn=un,pn=[`*`],mn=1e3;function hn(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e==null}function gn(e,t,n){e&&_n({json:e,allowlist:t.map(vn),excludelist:n.map(vn),ancestors:[]})}function _n(e){var t,n,r=e.json,i=e.targetObject,a=e.allowlist,o=e.excludelist,s=e.ancestors,c=e.parentObject,f=e.targetKey;i||=r;var p=Object.keys(i);try{for(var m=l(p),h=m.next();!h.done;h=m.next()){var g=h.value,_=d(d([],u(s),!1),[g],!1);hn(i[g])?(!bn(_,a)||bn(_,o))&&delete i[g]:_n({json:r,targetObject:i[g],allowlist:a,excludelist:o,ancestors:_,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}
4Object.keys(i).length===0&&c&&f&&delete c[f]}function vn(e){return e.startsWith(`/`)&&(e=e.slice(1)),e.split(`/`).map(function(e){return e.replace(/~0/g,`~`).replace(/~1/g,`/`)})}function yn(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(yn(e,t,a,r+1))return!0;return!1}else if(i===`*`||i===e[n])return yn(e,t,n+1,r+1);else return!1}function bn(e,t){return t.some(function(t){return yn(e,t)})}var xn=500,Sn=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;e===void 0&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=u(e,2),n=t[0];i[n]=t[1]});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if(typeof r==`object`&&r)try{for(var a=l(Object.entries(r)),o=a.next();!o.done;o=a.next()){var s=u(o.value,2),c=s[0];i[c]=s[1]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return An(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(typeof this._bodySize==`number`)return this._bodySize;if(L()?.TextEncoder){var e=this.request.body;return this._bodySize=wn(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 c(this,function(r){return e.length===0?[2,null]:(n=this.body,[2,Dn(n,e,t)])})})},e}(),Cn=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return e===void 0&&(e=[]),An(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return wn(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 c(this,function(r){return e.length===0?[2,null]:(n=this.body,[2,Dn(n,e,t)])})})},e}();function wn(e,t){var n,r,i,a=L()?.TextEncoder;if(a){var o;if(typeof e==`string`)o=e,i=new a().encode(o).length;else if(e instanceof Blob)o=e,i=o.size;else if(e instanceof URLSearchParams)o=e,i=new a().encode(o.toString()).length;else if(ArrayBuffer.isView(e))o=e,i=o.byteLength;else if(e instanceof ArrayBuffer)o=e,i=o.byteLength;else if(e instanceof FormData){var s=e,c=0,d=0;try{for(var f=l(s.entries()),p=f.next();!p.done;p=f.next()){var m=u(p.value,2),h=m[0],g=m[1];if(c+=h.length,typeof g==`string`)c+=new a().encode(g).length;else if(g instanceof Blob)c+=g.size;else return;if(++d>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}i=c}else if(e instanceof ReadableStream){o=e;return}return i}}var Tn=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}),An(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e;if(this._bodySize!==void 0)return this._bodySize;var t=((e=this.response.headers)?.get)?.call(e,`content-length`),n=t?parseInt(t,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t,n;return c(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)},xn)}),[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 c(this,function(r){switch(r.label){case 0:return e.length===0?[2,null]:[4,this.text()];case 1:return n=r.sent(),[2,Dn(n,e,t)]}})})},e}(),En=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}
4,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 r={},i=this.headersString.split(`\r 5`);try{for(var a=l(i),o=a.next();!o.done;o=a.next()){var s=o.value,c=u(s.split(`: `),2),d=c[0],f=c[1];d&&f&&(r[d]=f)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return An(r,{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 c(this,function(r){return e.length===0?[2,null]:(n=this.getJson(),n?(gn(n,e,t),[2,n]):[2,null])})})},e}();function Dn(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return gn(r,t,n),r}catch{return null}}var On;(function(e){e.REDACT=`redact`,e.REMOVE=`remove`})(On||={});var kn=`[REDACTED]`,An=function(e,t){var n,r,i=t.allow,a=i===void 0?[]:i,o=t.strategy,s=o===void 0?On.REMOVE:o,c=d([],u(oe),!1),f={},p=function(t){var n=t.toLowerCase();c.find(function(e){return e.toLowerCase()===n})?s===On.REDACT&&(f[t]=kn):a.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===On.REDACT&&(f[t]=kn)};try{for(var m=l(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&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return f},jn=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(d([],u(M),!1)),requestBodySize:this.requestWrapper?.bodySize,responseHeaders:this.responseWrapper?.headers(d([],u(M),!1)),responseBodySize:this.responseWrapper?.bodySize};return Object.fromEntries(Object.entries(e).filter(function(e){var t=u(e,2);return t[0],t[1]!==void 0}))},e}();function Mn(e){return typeof e==`object`&&!!e&&`url`in e&&`method`in e}var Nn=function(){function e(e,t){t===void 0&&(t=R()),this.callback=e,this.id=t}return e}();function Pn(e){try{e()}catch{}}var Fn=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=L();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=L();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){Pn(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(Mn(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 jn(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,a,o,s=this;return c(this,function(c){switch(c.label){case 0:try{t=this.getTimestamps()}catch(e){Pn(function(){return s.logger?.debug(`an unexpected error occurred while retrieving timestamps`,e)})}c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=c.sent(),[3,4];case 3:return o=c.sent(),a=o,[3,4];case 4:try{this.handleNetworkRequestEvent(`fetch`,n,r?new Sn(r):void 0,i?new Tn(i):void 0,a,t?.startTime,t?.durationStart)}catch(e){Pn(function(){return s.logger?.debug(`an unexpected error occurred while handling fetch`,e)})}if(i)return[2,i];throw a}})})})},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`&&Pn(function(){return t.logger?.debug(`unexpected error when retrieving responseText. responseType='${e.responseType}'`)}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(!(!this.globalScope||!t||!n)){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){var e=[...arguments],n=this,r=u(e,2),i=r[0],s=r[1];try{n.$$AmplitudeAnalyticsEvent=a({method:i,url:(s?.toString)?.call(s),headers:{}},o.getTimestamps())}catch(e){Pn(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr open`,e)})}return t.apply(n,e)},i.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 En(i.status,e,t?parseInt(t,10):void 0,a),r=i.$$AmplitudeAnalyticsEvent.headers,l=new Cn(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){Pn(function(){return o.logger?.debug(`an unexpected error occurred while handling xhr send`,e)}
5)}}),n.apply(i,t)},i.setRequestHeader=function(e,t){var n=this;try{var i=n.$$AmplitudeAnalyticsEvent;i&&(i.headers[e]=t)}catch(e){Pn(function(){return o.logger?.debug(`an unexpected error occurred while calling xhr setRequestHeader`,e)})}r.apply(n,[e,t])}}},e}()),In=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return c(this,function(e){return[2,a(a(a(a({},j),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=ut();return{utm_campaign:e[b],utm_content:e[x],utm_id:e[S],utm_medium:e[C],utm_source:e[w],utm_term:e[T]}},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=ut();return e={},e[E]=t[E],e[D]=t[D],e[ee]=t[ee],e[te]=t[te],e[O]=t[O],e[k]=t[k],e[A]=t[A],e[ne]=t[ne],e[re]=t[re],e[ie]=t[ie],e[ae]=t[ae],e},e}(),Ln=`data-amp-mask`,Rn=`*****`,zn=/\b(?:\d[ -]*?){13,16}\b/,Bn=/(\d{3}-?\d{2}-?\d{4})/g,Vn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Hn=function(e,t){var n,r;if(t===void 0&&(t=[]),typeof e!=`string`)return``;var i=e;i=i.replace(zn,Rn),i=i.replace(Bn,Rn),i=i.replace(Vn,Rn);try{for(var a=l(t),o=a.next();!o.done;o=a.next()){var s=o.value;try{i=i.replace(s,Rn)}catch{}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},Un=function(e){if(typeof document>`u`||!document.title)return``;var t=document.querySelector(`title`);return t&&t.hasAttribute(`data-amp-mask`)?Rn:e?e(document.title):document.title},Wn=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=void 0;var t=e=>!!Symbol[e],n=e=>t(e)?Symbol[e]:`@@`+e,r=n(`iterator`),i=n(`observable`),a=n(`species`);function o(e,t){let n=e[t];if(n!=null){if(typeof n!=`function`)throw TypeError(n+` is not a function`);return n}}function s(e){let t=e.constructor;return t!==void 0&&(t=t[a],t===null&&(t=void 0)),t===void 0?_:t}function c(e){return e instanceof _}function l(e){l.log?l.log(e):setTimeout(()=>{throw e})}function u(e){Promise.resolve().then(()=>{try{e()}catch(e){l(e)}})}function d(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,t))try{if(typeof t==`function`)t();else{let e=o(t,`unsubscribe`);e&&e.call(t)}}catch(e){l(e)}}function f(e){e._observer=void 0,e._queue=void 0,e._state=`closed`}function p(e){let t=e._queue;if(t){e._queue=void 0,e._state=`ready`;for(let n=0;n<t.length&&(m(e,t[n].type,t[n].value),e._state!==`closed`);++n);}}function m(e,t,n){e._state=`running`;let r=e._observer;try{let i=o(r,t);switch(t){case`next`:i&&i.call(r,n);break;case`error`:if(f(e),i)i.call(r,n);else throw n;break;case`complete`:f(e),i&&i.call(r);break}}catch(e){l(e)}e._state===`closed`?d(e):e._state===`running`&&(e._state=`ready`)}function h(e,t,n){if(e._state!==`closed`){if(e._state===`buffering`){e._queue.push({type:t,value:n});return}if(e._state!==`ready`){e._state=`buffering`,e._queue=[{type:t,value:n}],u(()=>p(e));return}m(e,t,n)}}var g=class{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state=`initializing`;let n=this,r={get closed(){return n._state===`closed`},next(e){h(n,`next`,e)},error(e){h(n,`error`,e)},complete(){h(n,`complete`)}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}this._state===`initializing`&&(this._state=`ready`)}get closed(){return this._state===`closed`}unsubscribe(){this._state!==`closed`&&(f(this),d(this))}},_=class e{constructor(t){if(!(this instanceof e))throw TypeError(`Observable cannot be called as a function`);if(typeof t!=`function`)throw TypeError(`Observable initializer must be a function`);this._subscriber=t}subscribe(e){return(typeof e!=`object`||!e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new g(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if(typeof e!=`function`){n(TypeError(e+` is not a function`));return}function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);return new(s(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);return new(s(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);let t=s(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(a){let o=!r;if(r=!0,!o||n)try{i=e(i,a)}catch(e){return t.error(e)}else i=a},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(TypeError(`Cannot reduce an empty sequence`));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=s(this);return new t(n=>{let r,i=0;function a(o){r=o.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):a(t.from(e[i++]))}})}return a(this),()=>{r&&=(r.unsubscribe(),void 0)}})}flatMap(e){if(typeof e!=`function`)throw TypeError(e+` is not a function`);let t=s(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let o=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(o);e>=0&&r.splice(e,1),a()}});r.push(o)},error(e){n.error(e)},complete(){a()}});function a(){i.closed&&r.length===0&&n.complete()}return()=>
5{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[i](){return this}static from(n){let a=typeof this==`function`?this:e;if(n==null)throw TypeError(n+` is not an object`);let s=o(n,i);if(s){let e=s.call(n);if(Object(e)!==e)throw TypeError(e+` is not an object`);return c(e)&&e.constructor===a?e:new a(t=>e.subscribe(t))}if(t(`iterator`)&&(s=o(n,r),s))return new a(e=>{u(()=>{if(!e.closed){for(let t of s.call(n))if(e.next(t),e.closed)return;e.complete()}})});if(Array.isArray(n))return new a(e=>{u(()=>{if(!e.closed){for(let t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}})});throw TypeError(n+` is not observable`)}static of(...t){return new(typeof this==`function`?this:e)(e=>{u(()=>{if(!e.closed){for(let n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}})})}static get[a](){return this}};e.Observable=_,Object.defineProperty(_,Symbol(`extensions`),{value:{symbol:i,hostReportError:l},configurable:!0})})),q=e(n(((e,t)=>{t.exports=Wn().Observable}))());function Gn(e,t){return new q.default(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function Kn(e,t){return new q.default(function(n){var r=!1,i=new Set,a=function(){var e,t;r=!0;try{for(var n=l(i),a=n.next();!a.done;a=n.next()){var o=a.value;try{o.unsubscribe()}catch{}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},o=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),a())},complete:function(){i.delete(t),!r&&i.size===0&&(n.complete(),a(),r=!0)}});i.add(t)};return o(e),o(t),a})}function J(e){var t=new Set,n=null;function r(){n?.unsubscribe(),n=null,t.clear()}return new q.default(function(i){return t.add(i),n===null&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var a=l(t),o=a.next();!o.done;o=a.next()){var s=o.value;(i=s.next)==null||i.call(s,e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},error:function(e){var n,i,a;try{for(var o=l(t),s=o.next();!s.done;s=o.next()){var c=s.value;(a=c.error)==null||a.call(c,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var a=l(t),o=a.next();!o.done;o=a.next()){var s=o.value;(i=s.complete)==null||i.call(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),t.size===0&&n&&(n.unsubscribe(),n=null)}})}var qn=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}))()),Jn=qn.default||qn,Yn=`https://app.amplitude.com`,Xn={US:Yn,EU:`https://app.eu.amplitude.com`,STAGING:`https://apps.stag2.amplitude.com`},Zn=`https://cdn.amplitude.com/libs/background-capture-1.0.1.js.gz`,Qn=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 $n(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}var er,tr=`__AMPLITUDE_MESSENGER_INSTANCE__`,nr=`__AMPLITUDE_MESSENGER__`,rr=function(){function e(e){var t=(e===void 0?{}:e).origin,n=t===void 0?Yn:t;this[er]=!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=$n(),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,i,a;this.actionHandlers.has(e)&&((a=(i=this.logger)?.warn)==null||a.call(i,`Overwriting existing action handler for: ${e}`)),this.actionHandlers.set(e,t);var o=this.pendingMessages.get(e);if(o){this.pendingMessages.delete(e);
5try{for(var s=l(o),c=s.next();!c.done;c=s.next()){var u=c.value;t(u)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return s(this,void 0,void 0,function(){var t,n,r;return c(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e),t)return[2,t];n=Qn(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),!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=L();e?.[nr]===this&&delete e[nr]},e}();er=tr;function ir(e){return typeof e==`object`&&!!e&&tr in e&&e[tr]===!0}function ar(e){var t=L(),n=t?.[nr];if(ir(n))return n;var r=new rr(e);return t&&(t[nr]=r),r}var or=`__AMPLITUDE_BACKGROUND_CAPTURE__`;function sr(e,t){var n=e;if(n[or]!==!0){n[or]=!0;var r=t?.scriptUrl??Zn,i=null,a=function(t,n){var r,i;t===`background-capture-complete`&&((i=(r=e.logger)?.debug)==null||i.call(r,`Background capture complete`),e.notify({action:`background-capture-complete`,data:n}))};e.registerActionHandler(`initialize-background-capture`,function(){var t,n;(n=(t=e.logger)?.debug)==null||n.call(t,`Initializing background capture (external script)`);var o=new URL(r,e.endpoint).toString();e.loadScriptOnce(o).then(function(){var t,n;(n=(t=e.logger)?.debug)==null||n.call(t,`Background capture script loaded (external)`),i=(window==null?void 0:window.amplitudeBackgroundCapture)?.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:`background-capture-loaded`})}).catch(function(){var t;(t=e.logger)==null||t.warn(`Failed to initialize background capture`)})}),e.registerActionHandler(`close-background-capture`,function(){var e;(e=i?.close)==null||e.call(i),i=null})}}var cr={always:`always`,ifEmptyCampaign:`ifEmptyCampaign`};function lr(e,t){var n=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var r=e/t*100;n=Math.min(100,Math.max(0,r))}return n}function ur(e,t){var n=e.currentTime,r=e.duration;return a({duration:r,start_time:n,last_position:n,percent_completed:lr(n,r)},t===void 0?{}:{stop_reason:t})}function dr(e){return{mux_playback_id:e.getAttribute(`playback-id`),mux_video_id:e.getAttribute(`metadata-video-id`),mux_video_title:e.getAttribute(`metadata-video-title`)}}function fr(e,t,n){var r=function(){var r=a(a({},ur(e)),n===`mux`?dr(e):{});t.onPlay(r)};e.addEventListener(`play`,r);var i=function(){var r=a(a({},ur(e,`paused`)),n===`mux`?dr(e):{});t.onPause(r)};e.addEventListener(`pause`,i);var o=function(){var r=a(a({},ur(e,`ended`)),n===`mux`?dr(e):{});t.onEnded(r)};e.addEventListener(`ended`,o);var s=function(){var r=a(a({},ur(e,`seeking`)),n===`mux`?dr(e):{});t.onSeeking(r)};e.addEventListener(`seeking`,s);var c=function(){var r=a(a({},ur(e)),n===`mux`?dr(e):{});t.onSeeked(r)};e.addEventListener(`seeked`,c);var l=function(){var n=e,r={position:e.currentTime,isSeeking:!!n.seeking};t.onTimeUpdate(r)};return e.addEventListener(`timeupdate`,l),function(){e.removeEventListener(`play`,r),e.removeEventListener(`pause`,i),e.removeEventListener(`ended`,o),e.removeEventListener(`seeking`,s),e.removeEventListener(`seeked`,c),e.removeEventListener(`timeupdate`,l)}}function pr(e){return s(this,void 0,void 0,function(){var t;return c(this,function(n){switch(n.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return t=n.sent(),[2,{currentTime:t}]}})})}function mr(e,t,n,r){return s(this,void 0,void 0,function(){var i,o,s,l,d;return c(this,function(c){switch(c.label){case 0:return[4,Promise.all([new Promise(function(t){return e.getDuration(t)}),new Promise(function(t){return e.getCurrentTime(t)})])];case 1:if(i=u.apply(void 0,[c.sent(),2]),o=i[0],s=i[1],l={},n===`mux`){d=void 0;try{d=new URL(t.getAttribute(`src`)),l.mux_video_title=d.searchParams.get(`metadata-video-title`),l.mux_video_id=d.searchParams.get(`metadata-video-id`),l.mux_playback_id=d.pathname.split(`/`).pop()}catch{}}return[2,a(a({duration:o,start_time:s,last_position:s,percent_completed:lr(s,o)},r===void 0?{}:{stop_reason:r}),l)]}})})}function hr(e,t,n){n===void 0&&(n=null);var r=[],i=function(){var i=e.elem,a=!1,o=function(){mr(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError(`Error getting iframe metadata from 'play' handler: ${e}`)})};e.on(`play`,o),r.push(function(){return e.off(`play`,o)});var s=function(){mr(e,i,n,`paused`).then(function(e){t.onPause(e)}).catch(function(e){t.onError(`Error getting iframe metadata from 'pause' handler: ${e}`)})};e.on(`pause`,s),r.push(function(){return e.off(`pause`,s)});var c=function(){mr(e,i,n,`ended`).then(function(e){t.onEnded(e)}).catch(function(e){t.onError(`Error getting iframe metadata from 'ended' handler: ${e}`)})};e.on(`ended`,c),r.push(function(){return e.off(`ended`,c)});var l=function(){a=!0,mr(e,i,n,`seeking`).then(function(e){t.onSeeking(e)}
5).catch(function(e){t.onError(`Error getting iframe metadata from 'seeking' handler: ${e}`)})};e.on(`seeking`,l),r.push(function(){return e.off(`seeking`,l)});var u=function(){a=!1,mr(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError(`Error getting iframe metadata from 'seeked' handler: ${e}`)})};e.on(`seeked`,u),r.push(function(){return e.off(`seeked`,u)});var d=function(){pr(e).then(function(e){var n={position:e.currentTime,isSeeking:a};t.onTimeUpdate(n)}).catch(function(e){t.onError(`Error getting iframe metadata from 'timeupdate' handler: ${e}`)})};e.on(`timeupdate`,d),r.push(function(){return e.off(`timeupdate`,d)})};return e.on(`ready`,i),function(){e.off(`ready`,i),r.forEach(function(e){return e()})}}var gr=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,o=this;this.state={playbackState:`paused`},this.handler={onPlay:function(e){o.updatePlaybackState(`playing`,e)},onPause:function(e){o.updatePlaybackState(`paused`,e)},onEnded:function(e){o.updatePlaybackState(`ended`,e)},onSeeking:function(){var e=a(a({},o.state),{isSeeking:!0});o.updateState(e)},onSeeked:function(e){var t=a(a({},o.state),{isSeeking:!1,position:e.last_position});o.updateState(t)},onError:function(e){o.updateStateWithError(e)},onTimeUpdate:function(e){o.updateTime(e)}},this.onStateChange=n,i?this.untrack=hr(t,this.handler,r):this.untrack=fr(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch{}},e.prototype.updateStateWithError=function(e){var t=this.state,n=a(a({},t),{playbackState:`error`,errorMessage:e});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t){var n=a(a({},this.state),{playbackState:e,lastEvent:t,position:t.last_position});this.updateState(n)},e.prototype.updateTime=function(e){if(!(!this.state.lastEvent||this.state.playbackState!==`playing`)){var t=e.isSeeking||this.state.isSeeking,n=this.state.position??0,r=e.position;if(t){this.state=a(a({},this.state),{position:r});return}var i=r-n,o=a(a({},this.state),{position:r,watchTime:(this.state.watchTime??0)+i});this.updateState(o)}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.untrack()},e}();function _r(){return typeof L()?.chrome?.runtime?.id==`string`}var vr=function(e,t){return typeof e==`boolean`?e:e?.[t]===!1?!1:!_r()||!!e?.[t]},yr=function(e){return vr(e,`attribution`)},br=function(e){return vr(e,`fileDownloads`)},xr=function(e){return vr(e,`formInteractions`)},Sr=function(e){return vr(e,`pageViews`)},Cr=function(e){return vr(e,`sessions`)},wr=function(e){return vr(e,`pageUrlEnrichment`)},Tr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.networkTracking===!0||typeof e.networkTracking==`object`)},Er=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.elementInteractions===!0||typeof e.elementInteractions==`object`)},Dr=function(e){return typeof e==`boolean`?e:typeof e==`object`&&e.webVitals===!0},Or=function(e){return typeof e==`boolean`?e:typeof e==`object`&&(e.frustrationInteractions===!0||typeof e.frustrationInteractions==`object`)},kr=function(e){return typeof e==`object`&&(e.performanceTracking===!0||typeof e.performanceTracking==`object`)},Ar=function(e){if(typeof e.autocapture==`object`){var t=e.autocapture.performanceTracking;if(t===!0)return{mainThreadBlock:!0};if(typeof t==`object`&&t)return t}},jr=function(e){return typeof e==`boolean`?e:!!(typeof e==`object`&&e&&e.enabled!==!1)},Mr=function(e){if(Er(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.elementInteractions==`object`)return e.autocapture.elementInteractions},Nr=function(e){if(Or(e.autocapture)&&typeof e.autocapture==`object`&&typeof e.autocapture.frustrationInteractions==`object`)return e.autocapture.frustrationInteractions},Pr=function(e){if(Tr(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),a(a({},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.`),a(a({},t),{hosts:void 0})}return t})})}},Fr=function(e){var t=function(){return!1},n=void 0,r,i=e.pageCounter;return Sr(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}},Ir=function(e){return yr(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution==`object`?a({},e.defaultTracking.attribution):{}},Lr=function(e){if(xr(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking==`object`&&typeof e.defaultTracking.formInteractions==`object`)return e.defaultTracking.formInteractions},Rr=function(e,t){zr(e,t)},zr=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},Br=function(e){var t=e;return t&&t._q!==void 0},Vr=`2.44.4`,Hr=`amplitude-ts`,Ur=`Web`,Wr=`$remote`,Gr=function(){function e(){this.name=`@amplitude/plugin-context-browser`,this.type=`before`,this.library=`${Hr}/${Vr}`,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 c(this,function(o){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=a(a(a(a(a(a(a(a({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:Ur}),this.config.trackingOptions.language&&{language:lt()}),this.config.trackingOptions.ipAddress&&{ip:Wr}),{insert_id:R(),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}(),Kr=1e3,qr=function(e){i(t,e);function t(t){var n=this,r,i;try{i=L()?.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 c(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>Kr?(i=n.length-Kr,[4,e.prototype.set.call(this,t,n.slice(0,Kr))]):[3,2];case 1:return a.sent(),(r=this.loggerProvider)==null||r.error(`Failed to save ${i} events because the queue length exceeded ${Kr}.`),[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}(wt),Jr=function(e){i(t,e);function t(){return e.call(this,L()?.sessionStorage)||this}return t}(wt),Yr=function(e){i(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),s(this,void 0,void 0,function(){var r=this;return c(this,function(i){return[2,new Promise(function(i,o){typeof XMLHttpRequest>`u`&&o(Error(`XHRTransport is not supported.`));var d=new XMLHttpRequest;d.open(`POST`,e,!0),d.onreadystatechange=function(){if(d.readyState===r.state.done){var e=d.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch{i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":`application/json`,Accept:`*/*`},p=JSON.stringify(t),m=n&&p.length>=2048&&Ht(),h=function(e){var t,n;f=a(a({},r.customHeaders),f);try{for(var i=l(Object.entries(f)),o=i.next();!o.done;o=i.next()){var s=u(o.value,2),c=s[0],p=s[1];d.setRequestHeader(c,p)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};(function(){return s(r,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:return m?[4,Ut(p)]:[3,2];case 1:return e=t.sent(),e?(f[`Content-Encoding`]=`gzip`,h(e)):h(p),[3,3];case 2:h(p),t.label=3;case 3:return[2]}})})})().catch(o)})]})})},t}(Vt),Xr=function(e){i(t,e);function t(t,n,r){t===void 0&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=n!==!1,i.referrerPolicy=r,i}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),s(this,void 0,void 0,function(){var r,i,o,s,l,u,d,f,p;return c(this,function(c){switch(c.label){case 0:if(typeof fetch>`u`)throw Error(`FetchTransport is not supported`);return r=JSON.stringify(t),i=n&&r.length>=2048&&Ht(),o=r,s={"Content-Type":`application/json`,Accept:`*/*`},i?[4,Ut(r)]:[3,2];case 1:l=c.sent(),l&&(s[`Content-Encoding`]=`gzip`,o=l),c.label=2;case 2:return s=a(a({},this.customHeaders),s),u=typeof o==`string`?o.length:o.byteLength,d={headers:s,body:o,method:`POST`,keepalive:this.enableKeepalive&&u<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return f=c.sent(),[4,f.text()];case 4:p=c.sent();try{return[2,this.buildResponse(JSON.parse(p))]}catch{return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(Vt),Zr=function(e){i(t,e);function t(){return e.call(this)||this}return t.prototype.send=function(e,t,n){return n===void 0&&(n=!1),s(this,void 0,void 0,function(){var n=this;return c(this,function(r){return[2,new Promise(function(r,i){var a=L();if(!a?.navigator.sendBeacon)throw Error(`SendBeaconTransport is not supported`);try{var o=JSON.stringify(t);return a.navigator.sendBeacon(e,o)?r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:o.length,server_upload_time:Date.now()})):r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(Vt),Qr=function(e,t,n){return n===void 0&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,a,o,s,l,d,f,p;return c(this,function(c){switch(c.label){case 0:return r=ct(e),[4,t.getRaw(r)];case 1:return i=c.sent(),i?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:c.sent(),c.label=3;case 3:return a=u(i.split(`.`),6),o=a[0],s=a[1],l=a[2],d=a[3],f=a[4],p=a[5],[2,{deviceId:o,userId:ei(s),sessionId:$r(d),lastEventId:$r(p),lastEventTime:$r(f),optOut:!!l}]}})})},$r=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},ei=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}},Y=`[Amplitude]`;`${Y}`;var ti=`${Y} Form Started`,ni=`${Y} Form Submitted`,ri=`${Y} File Downloaded`,ii=`session_start`,ai=`session_end`,oi=`${Y} File Extension`,si=`${Y} File Name`,ci=`${Y} Link ID`,li=`${Y} Link Text`,ui=`${Y} Link URL`,di=`${Y} Form ID`,fi=`${Y} Form Name`,pi=`${Y} Form Destination`,mi=`cookie`,hi=t({DEFAULT_ACTION_CLICK_ALLOWLIST:()=>ln,DEFAULT_CSS_SELECTOR_ALLOWLIST:()=>sn,DEFAULT_DATA_ATTRIBUTE_PREFIX:()=>cn,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:()=>cr,IdentifyOperation:()=>f,LogLevel:()=>V,OfflineDisabled:()=>null,RevenueProperty:()=>B,ServerZone:()=>on,SpecialEventType:()=>p}),gi=function(e){var t=e.split(`.`);return t.length<=2?e:t.slice(t.length-2,t.length).join(`.`)},_i=function(e){return Object.values(e).every(function(e){return!e})},vi=function(e){var t=a(a({},e),{referring_domain:void 0,referrer:void 0});return Object.values(t).every(function(e){return!e})},yi=function(e,t,n,r,i,a){i===void 0&&(i=!0),e.referrer;var s=e.referring_domain,c=o(e,[`referrer`,`referring_domain`]),l=t||{};l.referrer;var u=l.referring_domain,d=o(l,[`referrer`,`referring_domain`]),f=n.excludeInternalReferrers;if(f){var p=wi(f,r);if(!(p instanceof TypeError)&&e.referring_domain&&Oi(e.referring_domain,a)&&(p===`always`||p===`ifEmptyCampaign`&&vi(e)))return Ti(p,e.referring_domain,r),!1}if(bi(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&&_i(e)&&t)return r.debug(`This is not a new campaign because this is a direct traffic in the same session.`),!1;var m=JSON.stringify(c)!==JSON.stringify(d),h=gi(s||``)!==gi(u||``),g=!t||m||h;return g?r.debug(`This is a new campaign. An $identify event will be sent.`):r.debug(`This is not a new campaign because it's the same as the previous one.`),g},bi=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})},xi=function(e,t){var n=t.startsWith(`.`)?t:`.${t}`;return!!(e.startsWith(`.`)?e:`.${e}`).endsWith(n)},Si=function(e,t){var n=a(a({},j),e);return xe(Object.entries(n).reduce(function(e,n){var r=u(n,2),i=r[0],a=r[1];return e.setOnce(`initial_${i}
5`,a??t.initialEmptyValue??`EMPTY`),a?e.set(i,a):e.unset(i)},new N))},Ci=function(e){var t=e;return t?(t.startsWith(`.`)&&(t=t.substring(1)),[RegExp(`${t.replace(`.`,`\\.`)}\$`)]):[]},wi=function(e,t){if(e===!0)return cr.always;if(typeof e==`object`){var n=e.condition;if(typeof n==`string`&&Object.keys(cr).includes(n))return n;if(n===void 0)return cr.always}var r=`Invalid configuration provided for attribution.excludeInternalReferrers: ${JSON.stringify(e)}`;return t.error(r),TypeError(r)};function Ti(e,t,n){var r=`This is not a new campaign because referring_domain=${t} is on the same domain as the current page and it is configured to exclude internal referrers`;e===`always`?n.debug(r):e===`ifEmptyCampaign`&&n.debug(`${r} with empty campaign parameters`)}var Ei=`ac.in,ac.jp,ac.kr,ac.th,ac.uk,ac.za,appspot.com,asn.au,azurewebsites.net,cloudfront.net,myshopify.com,blogspot.com,co.ca,co.in,co.jp,co.kr,co.nz,co.th,co.uk,co.za,com.ar,com.au,com.br,com.cn,com.hk,com.in,com.jp,com.kr,com.mx,com.pl,com.sg,com.tr,com.tw,ed.jp,edu.au,edu.br,edu.cn,edu.hk,edu.sg,edu.th,edu.tr,edu.tw,firebaseapp.com,fly.dev,gc.ca,geek.nz,github.io,gitlab.io,go.jp,go.kr,go.th,gob.ar,gob.mx,gov.au,gov.br,gov.cn,gov.hk,gov.in,gov.pl,gov.sg,gov.tr,gov.tw,gov.uk,gov.za,govt.nz,gr.jp,herokuapp.com,id.au,idv.hk,iwi.nz,lg.jp,ltd.uk,maori.nz,me.uk,mil.kr,ne.jp,ne.kr,net.au,net.br,net.cn,net.hk,net.in,net.nz,net.pl,net.sg,net.tr,net.tw,net.za,onrender.com,or.jp,or.kr,or.th,org.ar,org.au,org.br,org.cn,org.hk,org.in,org.mx,org.nz,org.pl,org.sg,org.tw,org.uk,org.za,pages.dev,pe.kr,plc.uk,re.kr,res.in,sch.uk,vercel.app,netlify.app,workers.dev`.split(`,`),Di=function(e){var t=e||L()?.location?.hostname;if(!t)return``;var n=t.split(`.`),r=n[n.length-1],i=n[n.length-2];return Ei.find(function(e){return t.endsWith(`.${e}`)})&&(r=n[n.length-2]+`.`+n[n.length-1],i=n[n.length-3]),i?`${i}.${r}`:r},Oi=function(e,t){var n=L();return n?xi(e,(t||``).trim()||Di(n.location.hostname)):!1},ki=function(e){i(t,e);function t(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,te,O,k,A,ne,re,ie,ae,j,M,oe,se,ce,le,N,P){r===void 0&&(r=new gt),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=mi),g===void 0&&(g=new ke),_===void 0&&(_=V.Warn),y===void 0&&(y=!1),b===void 0&&(b=!1),C===void 0&&(C=``),w===void 0&&(w=`US`),D===void 0&&(D=1800*1e3),ee===void 0&&(ee=new qr({loggerProvider:g})),te===void 0&&(te={ipAddress:!0,language:!0,platform:!0}),O===void 0&&(O=`fetch`),k===void 0&&(k=!1),A===void 0&&(A=!0),M===void 0&&(M=!0),oe===void 0&&(oe=0),N===void 0&&(N=!1);var F=this;F=e.call(this,{apiKey:t,storageProvider:ee,transportProvider:Ni(O)})||this,F.apiKey=t,F.appVersion=n,F.cookieOptions=i,F.defaultTracking=a,F.autocapture=o,F.flushIntervalMillis=c,F.flushMaxRetries=l,F.flushQueueSize=u,F.identityStorage=d,F.ingestionMetadata=f,F.instanceName=p,F.loggerProvider=g,F.logLevel=_,F.minIdLength=v,F.offline=y,F.partnerId=x,F.plan=S,F.serverUrl=C,F.serverZone=w,F.sessionTimeout=D,F.storageProvider=ee,F.trackingOptions=te,F.transport=O,F.useBatch=k,F.fetchRemoteConfig=A,F.networkTrackingOptions=ae,F.identify=j,F.enableDiagnostics=M,F.diagnosticsSampleRate=oe,F.diagnosticsClient=se,F.remoteConfig=ce,F.topLevelDomain=le,F.enableRequestBodyCompression=N,F.customEnrichment=P,F.version=Vr,F._optOut=!1,F._cookieStorage=r,F.deviceId=s,F.lastEventId=m,F.lastEventTime=h,F.optOut=b,F.deferredSessionId=E,F.sessionId=T,F.pageCounter=re,F.userId=ne,F.debugLogsEnabled=ie,F.loggerProvider.enable(ie?V.Debug:F.logLevel),F.networkTrackingOptions=ae,F.identify=j,F.enableDiagnostics=M,F.diagnosticsSampleRate=oe,F.diagnosticsClient=se;var ue=ce?.fetchRemoteConfig??A;return F.remoteConfig=F.remoteConfig||{},F.remoteConfig.fetchRemoteConfig=ue,F.fetchRemoteConfig=ue,F.topLevelDomain=le||Di(),F}return Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},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())}
5,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 vt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(st(this.apiKey),e)},t}(je),Ai=function(e,t,n,r,i){return t===void 0&&(t={}),s(void 0,void 0,void 0,function(){var o,s,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;return c(this,function(c){switch(c.label){case 0:return o=t.identityStorage||`cookie`,s=``,o===`cookie`&&!t.cookieOptions?.domain&&t.cookieOptions?.domain!==``?[4,Pi(void 0,r)]:[3,2];case 1:s=c.sent(),c.label=2;case 2:return l=a({domain:t.cookieOptions?.domain??s,expiration:365,sameSite:`Lax`,secure:!1,upgrade:!0},t.cookieOptions),u={duplicateResolverFn:function(e){var t=xt(e);return t?St(JSON.parse(t).cookieDomain,l.domain):!1},diagnosticsClient:r},d=ji(t.identityStorage,l,u),[4,Qr(e,d,t.cookieOptions?.upgrade??!0)];case 3:return f=c.sent(),[4,d.get(st(e))];case 4:return p=c.sent(),m=ut(),h=m.ampTimestamp?Number(m.ampTimestamp):void 0,g=!h||Date.now()<h,_=t.deviceId??(g?m.ampDeviceId??m.deviceId:void 0)??p?.deviceId??f.deviceId??R(),v=p?.lastEventId??f.lastEventId,y=p?.lastEventTime??f.lastEventTime,b=t.optOut??p?.optOut??f.optOut,x=p?.sessionId??f.sessionId,S=p?.deferredSessionId,C=t.userId??p?.userId??f.userId,n.previousSessionDeviceId=p?.deviceId??f.deviceId,n.previousSessionUserId=p?.userId??f.userId,w={ipAddress:t.trackingOptions?.ipAddress??!0,language:t.trackingOptions?.language??!0,platform:t.trackingOptions?.platform??!0},T=p?.pageCounter,E=p?.debugLogsEnabled,t.autocapture!==void 0&&(t.defaultTracking=t.autocapture),D=new ki(e,t.appVersion,d,l,t.defaultTracking,t.autocapture,_,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,v,y,i?.loggerProvider??t.loggerProvider,t.logLevel,t.minIdLength,t.offline,b,t.partnerId,t.plan,t.serverUrl,i?.serverZone??t.serverZone,x,S,t.sessionTimeout,t.storageProvider,w,t.transport,t.useBatch,t.fetchRemoteConfig,C,T,E,t.networkTrackingOptions,t.identify,i?.enableDiagnostics??t.enableDiagnostics,i?.diagnosticsSampleRate??n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment),[4,D.storageProvider.isEnabled()];case 5:return c.sent()||(D.loggerProvider.warn(`Storage provider ${D.storageProvider.constructor.name} is not enabled. Falling back to MemoryStorage.`),D.storageProvider=new gt),[2,D]}})})}
5,ji=function(e,t,n){switch(e===void 0&&(e=mi),t===void 0&&(t={}),e){case`localStorage`:return new qr;case`sessionStorage`:return new Jr;case`none`:return new gt;default:return new vt(a(a({},t),{expirationDays:t.expiration}),n)}},Mi=function(e){return e===void 0&&(e={}),e.remoteConfig?.fetchRemoteConfig===!0||!(e.remoteConfig?.fetchRemoteConfig===!1||e.fetchRemoteConfig===!1)},Ni=function(e){var t=typeof e==`object`?e.type:e,n=typeof e==`object`?e.headers:void 0,r=typeof e==`object`?e.enableKeepalive:void 0,i=typeof e==`object`?e.referrerPolicy:void 0;return t===`xhr`?new Yr(n):t===`beacon`?new Zr:new Xr(n,r,i)},Pi=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,a,o,o,s,l,u;return c(this,function(c){switch(c.label){case 0:return[4,new vt(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!c.sent()||!e&&(typeof location>`u`||!location.hostname)||(n=e??location.hostname,r=n.split(`.`),r.length===1))return[2,``];for(i=[],a=1,Ei.find(function(e){return n.endsWith(`.${e}`)})&&(a=2),o=r.length-a-1;o>=0;--o)i.push(r.slice(o).join(`.`));o=0,c.label=2;case 2:if(!(o<i.length))return[3,7];s=i[o],c.label=3;case 3:return c.trys.push([3,5,,6]),[4,vt.isDomainWritable(s)];case 4:return l=c.sent(),l?[2,`.`+s]:[3,6];case 5:return u=c.sent(),t&&t.recordEvent(`cookies.tld.failure`,{reason:`Unexpected exception checking domain is writable: ${s}`,error:u instanceof Error?u.message:String(u)}),[3,6];case 6:return o++,[3,2];case 7:return t&&t.recordEvent(`cookies.tld.failure`,{reason:`Could not determine TLD for host ${n}`}),[2,``]}})})},Fi=`[Amplitude] Page Viewed`,Ii=`AMP_PAGE_VIEW`,Li=function(e){e===void 0&&(e={});var t,n=L(),r=void 0,i=!1,o,l,d=e.trackOn,f=e.trackHistoryChanges,p=e.eventType,m=p===void 0?Fi:p,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){r?.error(`Malformed URI sequence: `,e)}return t},g=function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return c(this,function(i){switch(i.label){case 0:return t=h(typeof location<`u`&&location.href||``),r={event_type:m},n=[{}],[4,Ri()];case 1:return[2,(r.event_properties=a.apply(void 0,[a.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":typeof location<`u`&&location.hostname||``,"[Amplitude] Page Location":t,"[Amplitude] Page Path":typeof location<`u`&&h(location.pathname)||``,"[Amplitude] Page Title":Un(Hn),"[Amplitude] Page URL":t.split(`?`)[0],"[Amplitude] Page View ID":e}]),r)]}})})},_=function(){return d===void 0||typeof d==`function`&&d()},v=typeof location<`u`?location.href:null,y=function(){return s(void 0,void 0,void 0,function(){var e,n,i,a,o;return c(this,function(s){switch(s.label){case 0:return e=location.href,n=Bi(f,e,v||``)&&_(),v=e,n?(i=void 0,l&&(i=R(),l.set(Ii,{pageViewId:i})),r?.log(`Tracking page view event`),t==null?[3,3]:[3,1]):[3,4];case 1:return o=(a=t).track,[4,g(i)];case 2:o.apply(a,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}})})},b=function(){y()};return{name:`@amplitude/plugin-page-view-tracking-browser`,type:`enrichment`,setup:function(e,a){return s(void 0,void 0,void 0,function(){var s,d,f;return c(this,function(c){switch(c.label){case 0:if(t=a,o=e,r=e.loggerProvider,r.log(`Installing @amplitude/plugin-page-view-tracking-browser`),i=!0,n){try{l=new wt(n.sessionStorage)}catch{r?.debug(`sessionStorage is not available in this environment.`)}n.addEventListener(`popstate`,b),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,n){var r=u(n,3),a=r[0],o=r[1],s=r[2];e.apply(t,[a,o,s]),i&&b()}})}return _()?(r.log(`Tracking page view event`),s=void 0,l&&(s=R(),l.set(Ii,{pageViewId:s})),f=(d=t).track,[4,g(s)]):[3,2];case 1:f.apply(d,[c.sent()]),c.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,i;return c(this,function(s){switch(s.label){case 0:return d===`attribution`&&zi(e)?(r?.log(`Enriching campaign event to page view event with campaign parameters`),t=void 0,l?[4,l.get(Ii)]:[3,2]):[3,4];case 1:n=s.sent(),t=n?.pageViewId,s.label=2;case 2:return[4,g(t)];case 3:i=s.sent(),e.event_type=i.event_type,e.event_properties=a(a({},e.event_properties),i.event_properties),s.label=4;case 4:return o&&e.event_type===m&&(o.pageCounter=o.pageCounter?o.pageCounter+1:1,e.event_properties=a(a({},e.event_properties),{"[Amplitude] Page Counter":o.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(e){return n&&(n.removeEventListener(`popstate`,b),i=!1),[2]})})}}},Ri=function(){return s(void 0,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:return e=ht,[4,new In().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},zi=function(e){if(e.event_type===`$identify`&&e.user_properties){var t=e.user_properties,n=t[f.SET]||{},r=t[f.UNSET]||{},i=d(d([],u(Object.keys(n)),!1),u(Object.keys(r)),!1);return Object.keys(j).every(function(e){return i.includes(e)})}return!1},Bi=function(e,t,n){switch(e){case`pathOnly`:if(n==``)return!0;
5var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname;default:return t!==n}},Vi=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 a,o;return c(this,function(s){return i=Lr(t),a=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=Ui(e);o||r.track(ti,(t={},t[di]=Hi(e.id),t[fi]=Hi(e.name),t[pi]=n,t)),o=!0}),n(e,`submit`,function(n){var a,s,c=Ui(e);if(o||r.track(ti,(a={},a[di]=Hi(e.id),a[fi]=Hi(e.name),a[pi]=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(ni,(s={},s[di]=Hi(e.id),s[fi]=Hi(e.name),s[pi]=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`?a():(o=L(),o?o.addEventListener(`load`,a):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 c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(t){return e?.disconnect(),r(),[2]})})}}},Hi=function(e){if(typeof e==`string`)return e},Ui=function(e){var t=e.getAttribute(`action`);try{t=new URL(encodeURI(t??``),window.location.href).href}catch{}return t},Wi=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,a;return c(this,function(o){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(ri,(n={},n[oi]=i,n[si]=t.pathname,n[ci]=e.id,n[li]=e.text,n[ui]=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)(\?.+)?$/;Array.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():(a=L(),a?a.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 c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(t){return e?.disconnect(),r(),[2]})})}}},Gi=!1,Ki=function(e){Gi||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: 6 7amplitude.init(<YOUR_API_KEY>, { 8 defaultTracking: true, 9}); 10 11Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`),Gi=!0)},qi=function(){var e=`@amplitude/plugin-network-checker-browser`,t=`before`,n=L(),r=[],i=function(e,t){n?.addEventListener&&(n?.addEventListener(e,t),r.push({type:e,handler:t}))},a=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 c(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.offline!==!1&&(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 c(this,function(e){return a(),[2]})})}}};function Ji(e){var t,n,r,i,a,o;if(!(typeof e!=`object`||!e)&&!Array.isArray(e)){var s=Object.keys(e);try{for(var c=l(s),f=c.next();!f.done;f=c.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),Ji(m)}catch{}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}
11try{if(e.autocapture?.networkTracking?.captureRules?.length)try{for(var h=l(e.autocapture.networkTracking.captureRules),g=h.next();!g.done;g=h.next()){var _=g.value;try{for(var v=(a=void 0,l([`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]=d(d([],u(S?M:[]),!1),u(C??[]),!1)}}}catch(e){a={error:e}}finally{try{y&&!y.done&&(o=v.return)&&o.call(v)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.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));try{var T=e.autocapture?.elementInteractions;if(T&&typeof T==`object`&&(T.viewportContentUpdated===!0&&(T.viewportContentUpdated={}),T.viewportContentUpdated===!1&&(T.viewportContentUpdated={enabled:!1}),T.exposureDuration!==void 0)){var E=T.viewportContentUpdated;E===void 0?T.viewportContentUpdated={exposureDuration:T.exposureDuration}:typeof E==`object`&&E.exposureDuration===void 0&&E.enabled!==!1&&(E.exposureDuration=T.exposureDuration),delete T.exposureDuration}}catch{}}}function Yi(e,t,n){var r,i,a=[];try{for(var o=l(t??[]),s=o.next();!s.done;s=o.next()){var c=s.value;try{a.push(new RegExp(c))}catch(e){n.loggerProvider.warn(`Invalid regex pattern: ${c}`,e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return e.concat(a)}function Xi(e,t){var n,r;if(e){Ji(e);try{t.loggerProvider.debug(`Update browser config with remote configuration:`,Jn(e));var i=e;if(i&&`autocapture`in i){if(typeof i.autocapture==`boolean`&&(t.autocapture=i.autocapture),typeof i.autocapture==`object`&&i.autocapture!==null){var o=a({},i.autocapture);if(t.autocapture===void 0&&(t.autocapture=i.autocapture),typeof i.autocapture.elementInteractions==`object`&&i.autocapture.elementInteractions!==null&&i.autocapture.elementInteractions.pageUrlAllowlistRegex?.length){o.elementInteractions=a({},i.autocapture.elementInteractions);var s=o.elementInteractions,c=s.pageUrlAllowlist??[],u=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Yi(c,u,t),delete s.pageUrlAllowlistRegex}if(typeof i.autocapture.networkTracking==`object`&&i.autocapture.networkTracking!==null&&i.autocapture.networkTracking.captureRules?.length){o.networkTracking=a({},i.autocapture.networkTracking);var d=o.networkTracking.captureRules??[];try{for(var f=l(d),p=f.next();!p.done;p=f.next()){var m=p.value;m.urls=Yi(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=a({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=a(a({},t.autocapture),o))}t.defaultTracking=t.autocapture}`customEnrichment`in i&&i.customEnrichment!==null&&t.customEnrichment!==!1&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug(`Browser config after remote config update:`,Jn(t))}catch(e){t.loggerProvider.error(`Failed to apply remote configuration because of error: `,e)}}}var Zi=`1.28.2`,Qi=`@amplitude/plugin-autocapture-browser`,$i=`@amplitude/plugin-frustration-browser`,ea=`@amplitude/plugin-performance-browser`,ta=`[Amplitude] Dead Click`,na=`[Amplitude] Rage Click`,ra=`[Amplitude] Error Click`,ia=`[Amplitude] Thrashed Cursor`,aa=`[Amplitude] Main Thread Block`,oa=`[Amplitude] Element ID`,sa=`[Amplitude] Element Class`,ca=`[Amplitude] Element Tag`,la=`[Amplitude] Element Text`,ua=`[Amplitude] Element Hierarchy`,da=`[Amplitude] Element Href`,fa=`[Amplitude] Element Position Left`,pa=`[Amplitude] Element Position Top`,ma=`[Amplitude] Element Aria Label`,ha=`[Amplitude] Element Attributes`,ga=`[Amplitude] Element Path`,_a=`[Amplitude] Element Parent Label`,va=`[Amplitude] Page URL`,ya=`[Amplitude] Page Title`,ba=`[Amplitude] Viewport Height`,xa=`[Amplitude] Viewport Width`,Sa=`[Amplitude] Max Page X`,Ca=`[Amplitude] Max Page Y`,wa=`[Amplitude] Page View ID`,Ta=`https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz`,Ea=`amp-visual-tagging-selector-highlight`,Da=`data-amp-mask-attributes`,Oa=`AMP_PAGE_VIEW`,ka=[`input`,`select`,`textarea`],Aa=function(e,t){return((window==null?void 0:window.getComputedStyle)?.call(window,e))?.getPropertyValue(`cursor`)===`pointer`&&t===`click`},ja=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&ft(window.location.href,n)||!ft(window.location.href,t))},Ma=function(e,t){return function(n,r){var i,a=e.shouldTrackEventResolver,o=((i=r?.tagName)?.toLowerCase)?.call(i);if(!o)return!1;if(a)return a(n,r);if(!ja(e))return!1;var s=String(r?.getAttribute(`type`))||``;if(typeof s==`string`)switch(s.toLowerCase()){case`hidden`:return!1;case`password`:return!1}if(t&&!t.some(function(e){return!!(r?.matches)?.call(r,e)}))return!1;switch(o){case`input`:case`select`:case`textarea`:return n===`change`||n===`click`;default:return n===`click`}}},Na=function(e){var t,n=((t=e?.tagName)?.toLowerCase)?.call(t),r=e instanceof HTMLElement&&e.getAttribute(`contenteditable`)?.toLowerCase()===`true`;return!ka.includes(n)&&!r},Pa=function(e){return e?e.split(`,`).map(function(e){return e.trim()}).filter(function(e){return e.length>0&&e!==`id`&&e!==`class`}):[]},Fa=function(e,t){return Object.entries(e).reduce(function(e,n){var r=u(n,2),i=r[0],a=r[1];if(i.startsWith(t)){var o=i.replace(t,``);o&&(e[o]=a||``)}return e},{})},Ia=function(e){return e==null||typeof e==`object`&&Object.keys(e).length===0||typeof e==`string`&&e.trim().length===0},La=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return Ia(r)||(t[n]=r),t},{})},Ra=function(){try{var e=(L()?.sessionStorage)?.getItem(Oa);if(!e)return;var t=JSON.parse(e);if(typeof t.pageViewId==`string`)return t.pageViewId}catch{}},za=function(e,t){return e?t.some(function(t){return(e?.matches)?.call(e,t)})?e:za(e?.parentElement,t):null},Ba=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};function Va(e){return e.type===`click`||e.type===`change`}var Ha;(function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]=`LEFT_OR_TOUCH_CONTACT`,e[e.MIDDLE=1]=`MIDDLE`,e[e.RIGHT=2]=`RIGHT`})(Ha||={});var Ua=`__AMPLITUDE_VISUAL_TAGGING__`;function Wa(e,t){var n=e;if(n[Ua]!==!0){n[Ua]=!0;
11var 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(Ta).then(function(){s=(window==null?void 0:window.amplitudeVisualTaggingSelector)?.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i(t?.actionType||`click`,e)},onTrack:l,onSelect:c,visualHighlightClass:Ea,messenger:e,cssSelectorAllowlist:a,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:Zi}}}),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 Ga(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(Ba).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(Ba).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 qa(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=Kn(s.filter(function(e){return!a(`click`,e.closestTrackedAncestor)}).map(function(e){return e.closestTrackedAncestor=za(e.event.target,r.actionClickAllowlist),e.closestTrackedAncestor!==null&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(Ba).filter(function(e){return o(`click`,e.closestTrackedAncestor)}),l?Kn(c,l):c),d=null,f=null;return Gn(u,function(e){if(d&&=(clearTimeout(d),null),e.type===`click`)return f=e,d=setTimeout(function(){d=null,f=null},500),Promise.resolve(null);if(f){var t=f;return f=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&t?.track(`[Amplitude] Element Clicked`,i(`click`,e.closestTrackedAncestor))})}function Ja(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e=L(),t=Math.floor(e?.scrollX??e?.pageXOffset??0),r=Math.floor(e?.scrollY??e?.pageYOffset??0);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,r)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}var Ya=L(),Xa=function(){return new q.default(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},Za=function(e){return e===void 0&&(e=`click`),new q.default(function(t){var n,r=function(e){t.next(e)};return(n=L())==null||n.document.addEventListener(e,r,{capture:!0}),function(){var t;(t=L())==null||t.document.removeEventListener(e,r,{capture:!0})}})},Qa=function(){return new q.default(function(e){var t,n=function(t){e.next(t)};return(t=L())==null||t.addEventListener(`scroll`,n),function(){var e;(e=L())==null||e.removeEventListener(`scroll`,n)}})},$a=function(){return new q.default(function(e){var t=function(t){var n=[...arguments].slice(1),r=void 0;Array.isArray(n[0])&&typeof n[0][0]==`string`&&(r=n[0][0]),e.next({kind:`console`,message:r})};return an.addListener(`error`,t),function(){an.removeListener(t)}})},eo=function(e,t){return new q.default(function(n){var r=L();if(!r?.IntersectionObserver)return function(){};var i=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:`0px`,threshold:1}),a=t.join(`,`);
11(r?.document.querySelectorAll(a)??[]).forEach(function(e){i.observe(e)});var o=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(a)&&i.observe(e),e.querySelectorAll(a).forEach(function(e){i.observe(e)}))})})});return function(){o.unsubscribe(),i.disconnect()}})},to=function(){return new q.default(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:`error`};t.error instanceof Error||t.error instanceof DOMException?n=a(a({},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 Ya.addEventListener(`error`,t),function(){Ya.removeEventListener(`error`,t)}})},no=function(){return new q.default(function(e){var t=function(t){var n={kind:`unhandledrejection`};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):typeof t.reason==`string`&&(n.message=t.reason),e.next(n)};return Ya.addEventListener(`unhandledrejection`,t),function(){Ya.removeEventListener(`unhandledrejection`,t)}})},ro=function(){return Kn(Kn(to(),no()),$a())},io=function(){return new q.default(function(e){var t=function(t){e.next(t)},n={capture:!0};return Ya.document.addEventListener(`mousemove`,t,n),function(){Ya.document.removeEventListener(`mousemove`,t,n)}})},ao=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},oo=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}},so=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}})},co={"[Amplitude] Element Clicked":`click`,"[Amplitude] Element Changed":`change`},lo=function(e){var t,n,r,i,a=Object.values(co).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return a;try{for(var o=l(e),s=o.next();!s.done;s=o.next()){var c=s.value;try{try{for(var u=(r=void 0,l(c.definition)),d=u.next();!d.done;d=u.next()){var f=co[d.value.event_type];f&&a[f].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn(`Skipping Labeled Event due to malformed definition`,c?.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},uo=function(e){var t,n,r,i,a=new Map;try{for(var o=l(e),s=o.next();!s.done;s=o.next()){var c=s.value;try{for(var u=(r=void 0,l(c.conditions)),d=u.next();!d.done;d=u.next()){var f=d.value;if(f.type===`LABELED_EVENT`){var p=f.match.eventId,m=a.get(p);m||(m=[],a.set(p,m)),m.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},fo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return co[t.event_type]===e.type&&t.filters.every(function(t){return ao(e,t)})})})},po=function(e,t){var n,r,i,a,o=new Set;try{for(var s=l(e),c=s.next();!c.done;c=s.next()){var u=c.value,d=t.get(u.id);if(d)try{for(var f=(i=void 0,l(d)),p=f.next();!p.done;p=f.next()){var m=p.value;o.add(m)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(o)},mo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=po(fo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var a=l(i),o=a.next();!o.done;o=a.next()){var s=o.value;so(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}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}(),ho=function(e,t,n,r){return new mo(e,t,n,r)},go=new Set([`id`,`class`,`style`,`value`,`onclick`,`onchange`,`oninput`,`onblur`,`onsubmit`,`onfocus`,`onkeydown`,`onkeyup`,`onkeypress`,`data-reactid`,`data-react-checksum`,`data-reactroot`,Da,Ln]),_o=[`type`],vo=[`svg`,`path`,`g`],yo=[`password`,`hidden`];function bo(e,t){var n,r;if(e===null)return null;var i=String(e.tagName).toLowerCase(),a={tag:i},o=Array.from(e.parentElement?.children??[]);o.length&&(a.index=o.indexOf(e),a.indexOfType=o.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var s=(e.previousElementSibling?.tagName)?.toLowerCase();s&&(a.prevSib=String(s));var c=e.getAttribute(`id`);c&&(a.id=String(c));var u=Array.from(e.classList);u.length&&(a.classes=u);var d={},f=Array.from(e.attributes).filter(function(e){return!go.has(e.name)}),p=!Na(e);if(!yo.includes(String(e.getAttribute(`type`)))&&!vo.includes(i))try{for(var m=l(f),h=m.next();!h.done;h=m.next()){var g=h.value;
11if(!(p&&!_o.includes(g.name))){if(t.has(g.name)){d[g.name]=Rn;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&&(a.attrs=d),a}function xo(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&n.tagName!==`HTML`;)t.push(n),n=n.parentElement;return t}var So=[/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/];function Co(e,t){var n,r,i=[];try{for(var a=l(e),o=a.next();!o.done;o=a.next()){var s=o.value;try{i.push(new RegExp(s))}catch(e){var c=e instanceof Error?e.message:String(e);t?.warn(`@amplitude/element-selector: ignoring invalid autogenerated-id pattern "${s}" (${c})`)}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function wo(e,t){var n,r;if(e==null||e===``)return!1;try{for(var i=l(t),a=i.next();!a.done;a=i.next())if(a.value.test(e))return!1}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}var To=[/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/];function Eo(e,t){var n,r,i=[];try{for(var a=l(e),o=a.next();!o.done;o=a.next()){var s=o.value;try{i.push(new RegExp(s))}catch(e){var c=e instanceof Error?e.message:String(e);t?.warn(`@amplitude/element-selector: ignoring invalid unstable-class pattern "${s}" (${c})`)}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function Do(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(n!==null&&n===``)return null;var r=e.getAttribute(`id`);return r===null||r===``||!wo(r,t.autogeneratedIdPatterns)?null:r}function Oo(e,t){return t.map(ko).join(` > `)}function ko(e){var t=e.tagName.toLowerCase(),n=e.parentElement;return n===null?t:`${t}:nth-of-type(${Ao(e,n)})`}function Ao(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var jo={name:`explicitTrackingAttribute`,try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return r===null||r===``?null:`[${n}=${JSON.stringify(r)}]`}};function Mo(e){var t=globalThis.CSS;if(t&&typeof t.escape==`function`)return t.escape(e);for(var n=String(e),r=n.length,i=``,a=0;a<r;a++){var o=n.charCodeAt(a);if(o===0){i+=`�`;continue}if(o>=1&&o<=31||o===127||a===0&&o>=48&&o<=57||a===1&&o>=48&&o<=57&&n.charCodeAt(0)===45){i+=`\\${o.toString(16)} `;continue}if(a===0&&r===1&&o===45){i+=`\\-`;continue}if(o>=128||o===45||o===95||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122){i+=n.charAt(a);continue}i+=`\\${n.charAt(a)}`}return i}function No(e){return Mo(e)}var Po=[jo,{name:`stableId`,try:function(e,t){var n=Do(e,t.config);return n===null?null:`${e.tagName.toLowerCase()}#${No(n)}`}}];
11function Fo(e,t,n){var r,i;n===void 0&&(n={});var a=n.strategies??Po,o=n.scope??e.ownerDocument??document,s={scope:o,config:t},c=Io(e,t.maxAncestorWalkDepth);try{for(var u=l(a),d=u.next();!d.done;d=u.next())for(var f=d.value,p=0;p<c.length;p++){var m=c[p],h=f.try(m,s);if(h!==null){if(p===0){if(Lo(o,h,e,f.name,n.logger))return h;continue}var g=`${h} > ${Oo(m,c.slice(0,p).reverse())}`;if(Lo(o,g,e,f.name,n.logger))return g}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return null}function Io(e,t){for(var n=[],r=e;r!==null&&(n.push(r),!(t!==void 0&&n.length>t));)r=r.parentElement;return n}function Lo(e,t,n,r,i){var a;try{a=e.querySelectorAll(t)}catch(e){var o=e instanceof Error?e.message:String(e);return i?.debug(`@amplitude/element-selector: strategy "${r}" emitted a malformed selector "${t}" (${o})`),!1}return a.length===1&&a[0]===n}function Ro(e,t,n){n===void 0&&(n={});for(var r=n.scope??e.ownerDocument??document,i=[],a=e,o=0;a!==null&&!(t.maxAncestorWalkDepth!==void 0&&o>t.maxAncestorWalkDepth);){var s=Do(a,t);if(s!==null){var c=d([`${a.tagName.toLowerCase()}#${No(s)}`],u(i),!1).join(` > `);if(Vo(r,c,e))return c}i.unshift(zo(a)),a=a.parentElement,o+=1}return i.join(` > `)}function zo(e){var t=e.tagName.toLowerCase(),n=e.parentElement;return n===null?t:`${t}:nth-of-type(${Bo(e,n)})`}function Bo(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}function Vo(e,t,n){var r;try{r=e.querySelectorAll(t)}catch{return!1}return r.length===1&&r[0]===n}var Ho=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Uo=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return``;for(var n=[],r=e;r;){var i=Wo(r,!!t,r===e);if(!i||(n.push(i),i.optimized))break;r=r.parentElement}return n.reverse(),n.join(` > `)},Wo=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var a=e.getAttribute(`id`);if(t){if(a)return new Ho(Ko(a),!0);var o=e.tagName.toLowerCase();if(o===`body`||o===`head`||o===`html`)return new Ho(o,!0)}var s=e.tagName.toLowerCase();if(a)return new Ho(s+Ko(a),!0);var c=e.parentNode;if(!c||c.nodeType===Node.DOCUMENT_NODE)return new Ho(s,!0);for(var u=Go(e),d=!1,f=!1,p=-1,m=-1,h=c.children,g=0;h&&(p===-1||!f)&&g<h.length;++g){var _=h[g];if(_.nodeType===Node.ELEMENT_NODE){if(m+=1,_===e){p=m;continue}if(!f&&_.tagName.toLowerCase()===s){d=!0;var v=new Set(u);if(!v.size){f=!0;continue}for(var y=Go(_),b=0;b<y.length;++b){var x=y[b];if(v.has(x)&&(v.delete(x),!v.size)){f=!0;break}}}}}var S=s;if(n&&s.toLowerCase()===`input`&&e.getAttribute(`type`)&&!e.getAttribute(`id`)&&!e.getAttribute(`class`)&&(S+=`[type=`+Mo(e.getAttribute(`type`)||``)+`]`),f)S+=`:nth-child(`+String(p+1)+`)`;else if(d)try{for(var C=l(u),w=C.next();!w.done;w=C.next()){var T=w.value;S+=`.`+Mo(T.slice(1))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=C.return)&&i.call(C)}finally{if(r)throw r.error}}return new Ho(S,!1)},Go=function(e){var t=e.getAttribute(`class`);return t?t.split(/\s+/g).filter(Boolean).map(function(e){return`$`+e}):[]},Ko=function(e){return`#`+Mo(e)};function qo(e,t){try{return Uo(e)}catch(e){var n=e instanceof Error?e.message:String(e);return t?.warn(`@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ${n}`),``}}var Jo=Object.freeze({enabled:!1,explicitTrackingAttribute:`data-amp-track-id`,autogeneratedIdPatterns:d([],u(So),!1),unstableClassPatterns:d([],u(To),!1),maxAncestorWalkDepth:void 0});function Yo(e,t){if(!e)return Zo();var n=Zo();return typeof e.enabled==`boolean`&&(n.enabled=e.enabled),typeof e.explicitTrackingAttribute==`string`&&e.explicitTrackingAttribute!==``&&(n.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(n.autogeneratedIdPatterns=Co(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(n.unstableClassPatterns=Eo(e.unstableClassPatterns,t)),n.maxAncestorWalkDepth=Xo(e.maxAncestorWalkDepth),n}function Xo(e){if(typeof e==`number`&&Number.isFinite(e)&&!(e<=0))return Math.floor(e)}function Zo(){return{enabled:Jo.enabled,explicitTrackingAttribute:Jo.explicitTrackingAttribute,autogeneratedIdPatterns:d([],u(Jo.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],u(Jo.unstableClassPatterns),!1),maxAncestorWalkDepth:Jo.maxAncestorWalkDepth}}
11function Qo(e,t){t===void 0&&(t={});var n=e,r=new Set,i=t.logger,a={strategies:t.strategies,scope:t.scope,logger:i};return{generate:function(e){if(!n.enabled)return qo(e,i);try{var r=Fo(e,n,a);return r===null?Ro(e,n,{scope:t.scope??e.ownerDocument??document}):r}catch(t){var o=t instanceof Error?t.message:String(t);return i?.warn(`@amplitude/element-selector: strategy chain threw — falling back to legacy cssPath: ${o}`),qo(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,a;n=e;try{for(var o=l(r),s=o.next();!s.done;s=o.next()){var c=s.value;try{c(e)}catch(e){var u=e instanceof Error?e.message:String(e);i?.warn(`@amplitude/element-selector: onConfigChange subscriber threw — ${u}`)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var $o;function es(){return $o||=Qo(Yo()),$o}var ts=function(){function e(e,t){var n,r,i=this;this.replaceSensitiveString=function(e){return Hn(e,i.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,a=performance.now(),o=[];if(!e)return[];for(var s=xo(e),c=new Map,f=s.length-1;f>=0;f--){var p=s[f];if(p){var m=Pa(p.getAttribute(Da)),h=f===s.length-1?[]:c.get(s[f+1])??new Set,g=new Set(d(d([],u(h),!1),u(m),!1));c.set(p,g)}}o=s.map(function(e){return bo(e,c.get(e)??new Set)});var _=function(e){e?.attrs&&Object.entries(e.attrs).forEach(function(t){var n=u(t,2),r=n[0],a=n[1];e.attrs&&(e.attrs[r]=i.replaceSensitiveString(a))})};try{for(var v=l(o),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(r=i.diagnosticsClient)==null||r.recordHistogram(`autocapturePlugin.getHierarchy`,x-a),o},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?i.getText(n):i.getNearestLabel(t)},this.getElementPath=function(e){var t;if(!e)return``;var n=performance.now(),r=i.selectorEngine.generate(e),a=performance.now();return(t=i.diagnosticsClient)==null||t.recordHistogram(`autocapturePlugin.getElementPath`,a-n),r},this.updateSelectorConfig=function(e,t){i.selectorEngine.updateConfig(Yo(e??void 0,t))},this.getEventProperties=function(e,t,n){var r,a,o=((a=t?.tagName)?.toLowerCase)?.call(a),s=typeof t.getBoundingClientRect==`function`?t.getBoundingClientRect():{left:null,top:null},c=i.getHierarchy(t),l=c[0]?.attrs,u=i.getNearestLabel(t),d=Fa(l??{},n),f=(r={},r[ua]=c,r[ca]=o,r[la]=i.getText(t),r[fa]=s.left==null?null:Math.round(s.left),r[pa]=s.top==null?null:Math.round(s.top),r[ha]=d,r[ga]=i.getElementPath(t),r[_a]=u,r[va]=G(window.location.href.split(`?`)[0]),r[ya]=Un(i.replaceSensitiveString),r[ba]=window.innerHeight,r[xa]=window.innerWidth,r),p=Ra();if(p&&(f[wa]=p),f[oa]=t.getAttribute(`id`)||``,f[sa]=t.getAttribute(`class`),f[ma]=l?.[`aria-label`],o===`a`&&e===`click`&&t instanceof HTMLAnchorElement){var m=t.href.substring(0,128);f[da]=i.replaceSensitiveString(m)}return La(f)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,a){a===void 0&&(a=!1);var o=i.addTypeAndTimestamp(e,t);if(Va(o)&&o.event.target!==null){if(a&&Aa(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=i.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var s=za(o.event.target,n);return s&&(o.closestTrackedAncestor=s,o.targetElementProperties=i.getEventProperties(o.type,s,r)),o}return o},this.extractDataFromDataSource=function(e,t){if(e.sourceType===`DOM_ELEMENT`){var n=oo(e,t);return n?e.elementExtractType===`TEXT`?i.getText(n):e.elementExtractType===`ATTRIBUTE`&&e.attribute?n.getAttribute(e.attribute):void 0:void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r=`[${Ln}], [contenteditable]`;if(!e.querySelector(r))return e.innerText;var a=``,o=Array.from(e.childNodes);try{for(var s=l(o),c=s.next();!c.done;c=s.next()){var u=c.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+=Rn;continue}a+=i.getTextWithMaskedDescendants(u)}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},this.getText=function(e){if(e.closest(`[data-amp-mask]`)!==null)return Rn;var t=``;return t=e.querySelector(`[data-amp-mask], [contenteditable]`)?i.getTextWithMaskedDescendants(e):e.innerText||``,i.replaceSensitiveStr
11ing(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 La((t={},t[ca]=r,t[la]=i.getText(e),t[va]=window.location.href.split(`?`)[0],t))},this.diagnosticsClient=t?.diagnosticsClient,this.selectorEngine=es();var a=e.maskTextRegex??[],o=[];try{for(var s=l(a),c=s.next();!c.done;c=s.next()){var f=c.value;if(o.length>=25)break;if(f instanceof RegExp)o.push(f);else if(`pattern`in f&&typeof f.pattern==`string`)try{o.push(new RegExp(f.pattern,`i`))}catch{}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=o}return e}(),ns=`configs.analyticsSDK.elementSelector`;function rs(e,t){var n=e.remoteConfigClient;if(!(!e.fetchRemoteConfig||!n)){var r=n.subscribe(ns,`all`,function(n){t.updateSelectorConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}function is(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,a=i===void 0?150:i,o=new Map,s=new Map,c=t.exposureObservable.subscribe(function(e){var t=e,i=t.target;if(t.isIntersecting){if(!o.get(i)){var c=setTimeout(function(){o.set(i,!0),n(r.getElementPath(i)),s.set(i,null)},a);s.set(i,c)}}else if(!t.isIntersecting&&t.intersectionRatio<1){var c=s.get(i);c&&(clearTimeout(c),s.set(i,null))}});return{unsubscribe:function(){c.unsubscribe()},reset:function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),o.clear()}}}function as(e){var t,n=e.amplitude,r=e.scrollTracker,i=e.currentElementExposed,a=e.elementExposedForPage,o=e.exposureTracker,s=e.isPageEnd,c=e.lastScroll,l=r.getState(),u=L(),d=u?.innerWidth??0,f=u?.innerHeight??0,p=(t={},t[va]=G((u?.location?.href)?.split(`?`)[0]??``),t[Sa]=l.maxX+d,t[Ca]=l.maxY+f,t[ba]=f,t[xa]=d,t[`[Amplitude] Element Exposed`]=Array.from(i),t),m=Ra();if(m&&(p[wa]=m),i.size===0&&l.maxX===c.maxX&&l.maxY===c.maxY){s&&(r.reset(),a.clear(),o?.reset());return}n?.track(`[Amplitude] Viewport Content Updated`,p),c.maxX=l.maxX,c.maxY=l.maxY,i.clear(),s&&(r.reset(),a.clear(),o?.reset())}function os(e,t,n,r){if(!t.has(e)){t.add(e),n.add(e);var i=Array.from(n);JSON.stringify(i).length>=18e3&&r(!1)}}var X;(function(e){e.ClickObservable=`clickObservable`,e.ChangeObservable=`changeObservable`,e.NavigateObservable=`navigateObservable`,e.MutationObservable=`mutationObservable`,e.ScrollObservable=`scrollObservable`,e.ExposureObservable=`exposureObservable`,e.BrowserErrorObservable=`browserErrorObservable`,e.SelectionObservable=`selectionObservable`,e.MouseMoveObservable=`mouseMoveObservable`})(X||={});var ss=function(e,t){e===void 0&&(e={}),t?.diagnosticsClient.setTag(`plugin.autocapture.version`,`1.28.2`);var n=e.dataAttributePrefix,r=n===void 0?cn:n,i=e.visualTaggingOptions,o=i===void 0?{enabled:!0}:i;e.cssSelectorAllowlist=e.cssSelectorAllowlist??sn,e.actionClickAllowlist=e.actionClickAllowlist??ln,e.debounceTime=e.debounceTime??0;var f=e.viewportContentUpdated?.enabled!==!1,p=e.viewportContentUpdated?.exposureDuration??e.exposureDuration??150;e.viewportContentUpdated=a(a({},e.viewportContentUpdated),{exposureDuration:p}),e.pageUrlExcludelist=e.pageUrlExcludelist?.reduce(function(e,t){if(typeof t==`string`&&e.push(t),t instanceof RegExp&&e.push(t),typeof t==`object`&&t&&`pattern`in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn(`Invalid regex pattern: ${t.pattern}`,n),e}return e},[]);var m=Qi,h=`enrichment`,g=[],_=new ts(e,t),v=new Set,y=new Set,b,x=function(){var t,n=J(Za().map(function(t){return _.addAdditionalEventProperties(t,`click`,e.cssSelectorAllowlist,r)})),i=J(new q.default(function(t){var n,i=function(n){var i=_.addAdditionalEventProperties(n,`change`,e.cssSelectorAllowlist,r);t.next(i)};return(n=L())==null||n.document.addEventListener(`change`,i,{capture:!0}),function(){return L()?.document.removeEventListener(`change`,i)}})),a;window.navigation&&(a=J(new q.default(function(t){var n=function(n){var i=_.addAdditionalEventProperties(n,`navigate`,e.cssSelectorAllowlist,r);t.next(i)};return window.navigation.addEventListener(`navigate`,n),function(){window.navigation.removeEventListener(`navigate`,n)}})));var o=J(Xa().map(function(t){return _.addAdditionalEventProperties(t,`mutation`,e.cssSelectorAllowlist,r)})),s=Qa(),c=eo(o,e.cssSelectorAllowlist);return t={},t[X.ChangeObservable]=i,t[X.ClickObservable]=n,t[X.MutationObservable]=o,t[X.NavigateObservable]=a,t[X.ScrollObservable]=s,t[X.ExposureObservable]=c,t},S=lo(Object.values(e.pageActions?.labeledEvents??{})),C=uo(e.pageActions?.triggers??[]),w=ho(S,C,_,e),T=function(t){t&&(e.pageActions=a(a({},e.pageActions),t),S=lo(Object.values(e.pageActions.labeledEvents??{})),C=uo(e.pageActions.triggers??[]),w.update(S,C,e))};return{name:m,type:h,setup:function(t,n){return s(void 0,void 0,void 0,function(){var i,s,l,h,S,C,E,D,ee,te,O,k,A,ne,re,ie,ae,j,M,oe,se,ce;return c(this,function(c){return typeof document>`u`?[2]:(i=!1,s={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe(`configs.analyticsSDK.pageActions`,`all`,function(e){T(e)}):t.loggerProvider.debug(`Remote config client is not provided, skipping remote config fetch`)),l=rs(t,_),l&&g.push({unsubscribe:l}),h=Ma(e,e.cssSelectorAllowlist),S=Ma(e,e.actionClickAllowlist),C=x(),E=Ga({allObservables:C,amplitude:n,shouldTrackEvent:h,evaluateTriggers:w.evaluate.bind(w)}
11),g.push(E),D=Ka({allObservables:C,getEventProperties:function(){var e=[...arguments];return _.getEventProperties.apply(_,d(d([],u(e),!1),[r],!1))},amplitude:n,shouldTrackEvent:h,evaluateTriggers:w.evaluate.bind(w)}),g.push(D),ee=qa({allObservables:C,options:e,getEventProperties:function(){var e=[...arguments];return _.getEventProperties.apply(_,d(d([],u(e),!1),[r],!1))},amplitude:n,shouldTrackEvent:h,shouldTrackActionClick:S}),ee&&g.push(ee),te=Ja({allObservables:C,amplitude:n}),g.push(te),O={},k=L(),A=function(e){e&&i||(setTimeout(function(){i=!1},100),i=!0,as({amplitude:n,scrollTracker:te,currentElementExposed:y,elementExposedForPage:v,exposureTracker:O.exposure,isPageEnd:e,lastScroll:s}))},ne=function(e){os(e,v,y,A)},f&&(O.exposure=is({allObservables:C,onExposure:ne,dataExtractor:_,exposureDuration:p}),O.exposure&&g.push(O.exposure),re=function(){A(!0)},k?.addEventListener(`beforeunload`,re),b=function(){k?.removeEventListener(`beforeunload`,re)},g.push({unsubscribe:function(){return b()}}),ie=C[X.NavigateObservable],ie?g.push(ie.subscribe(function(){A(!0)})):k&&(ae=function(){A(!0)},k.addEventListener(`popstate`,ae),j=k.history.pushState,k.history&&j&&(k.history.pushState=new Proxy(j,{apply:function(e,t,n){var r=u(n,3),i=r[0],a=r[1],o=r[2];e.apply(t,[i,a,o]),A(!0)}})),g.push({unsubscribe:function(){k.removeEventListener(`popstate`,ae),k.history&&j&&(k.history.pushState=j)}}))),(ce=t?.loggerProvider)==null||ce.log(`${m} has been successfully added.`),window.opener&&o.enabled&&(M=e.cssSelectorAllowlist,oe=e.actionClickAllowlist,se=ar(),Wa(se,{dataExtractor:_,isElementSelectable:Ma(e,d(d([],u(M),!1),u(oe),!1)),cssSelectorAllowlist:M,actionClickAllowlist:oe}),sr(se),se.setup(a({logger:t?.loggerProvider},t?.serverZone&&{endpoint:Xn[t.serverZone]}))),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,i;return c(this,function(a){try{for(e=l(g),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},cs=3e3,ls=[`mutation`,`navigate`];function us(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,o=n.clickObservable,s=n.mutationObservable,c=n.navigateObservable,l=Kn(o.filter(function(e){return Ba(e)&&i(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===Ha.LEFT_OR_TOUCH_CONTACT}),c?Kn(s,c):s),u=null;return Gn(l,function(e){return u&&ls.includes(e.type)?(clearTimeout(u),u=null,Promise.resolve(null)):e.type===`click`?u?Promise.resolve(null):new Promise(function(t){u=setTimeout(function(){t(e),u=null},cs)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track(ta,a(a({},r(`click`,e.closestTrackedAncestor)),n),{time:e.timestamp})}})}var ds=4,fs=mn,ps=50;function ms(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>ps||e.xMax-e.xMin>ps}function hs(e){if(e.length===0)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:a({"[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 gs(e,t){var n=e[Math.max(0,e.length-ds+1)];return t.timestamp-n.timestamp>=fs}function _s(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}function vs(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,a=r.clickObservable,o=r.selectionObservable,l=[],u={},d=null;function f(e){l=[],u={},e&&(ms(u,e),l.push(e))}var p=Gn(a.filter(function(e){return i(`click`,e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return c(this,function(n){return ms(u,e),t=null,l.length===0||_s(l,e)||gs(l,e)||u.isOutOfBounds?(d&&(t=hs(l)),f(e)):l.push(e),d&&=(clearTimeout(d.timerId),d.resolve(t),null),l.length>=ds?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(hs(l))},fs)}})]:[2,null]})})}),m=o?.subscribe(function(){f()}),h=p.subscribe(function(e){e!==null&&n.track(na,e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),m?.unsubscribe()}}}var ys=2e3;function bs(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.clickObservable,o=n.browserErrorObservable,s=i.filter(function(e){return Ba(e)&&r(`click`,e.closestTrackedAncestor)&&e.event.target instanceof Element&&e.event.target.closest(`a[target="_blank"]`)===null&&e.event.button===Ha.LEFT_OR_TOUCH_CONTACT}),c=null,l=null,u=function(){c!==null&&(clearTimeout(c),c=null),l=null};return Kn(s,o).subscribe(function(e){var n;if(e.type===`click`){u(),l=e,c=setTimeout(u,ys);return}e.type===`error`&&l&&(t.track(ra,a((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),l.targetElementProperties)),u())})}var xs;(function(e){e.INCREASING=`increasing`,e.DECREASING=`decreasing`})(xs||={});var Ss;(function(e){e.X=`x`,e.Y=`y`})(Ss||={});var Cs=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new q.default(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var a={x:t.clientX,y:t.clientY};if(n===null){n=a;return}a.x>n.x?(r===xs.DECREASING&&e.next(Ss.X),r=xs.INCREASING):a.x<n.x&&(r===xs.INCREASING&&e.next(Ss.X),r=xs.DECREASING),a.y>n.y?(i===xs.DECREASING&&e.next(Ss.Y),i=xs.INCREASING):a.y<n.y&&(i===xs.INCREASING&&e.next(Ss.Y),i=xs.DECREASING),n=a})})};function ws(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 Ts(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return t.length<n?!1:t[t.length-1]-t[0]<r}function Es(e){e.changes=[],e.startTime=void 0}function Ds(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 Os(e,t){var n=void 0;if(Ts(e)&&(n=e.startTime),Ts(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}var ks=20,As=2e3,js=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=n===void 0?ks:n,i=e.thresholdMs,a=i===void 0?As:i;return new q.default(function(e){var n={changes:[],changesThreshold:r,thresholdMs:a},i={changes:[],changesThreshold:r,thresholdMs:a},o=void 0,s=null;function c(){o!==void 0&&(e.next(o),o=void 0,s!==null&&clearTimeout(s),Es(n),Es(i))}return t.subscribe(function(e){s!==null&&clearTimeout(s),ws(e===Ss.X?n:i);var t=Os(n,i);return t?(o||=t,s=setTimeout(function(){c(),s=null},a)):c(),Ds(n),Ds(i),function(){s!==null&&(clearTimeout(s),s=null)}})})},Ms=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,a=i===void 0?ks:i,o=e.thresholdMs,s=o===void 0?As:o;return js({mouseDirectionChangeObservable:Cs({allWindowObservables:r}),directionChanges:a,thresholdMs:s}).subscribe(function(e){ja(n)&&t.track(ia,void 0,{time:e})})};function Ns(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 Ps=5,Fs=4e3,Is=function(e){e===void 0&&(e={});var t=$i,n=`enrichment`,r=[],i=e.errorClicks!==!1;e.errorClicks||(i=!1);var o=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=Ns(e,`rageClicks`,pn,f),h=Ns(e,`deadClicks`,dn,o),g=Ns(e,`errorClicks`,fn,i),_=e.dataAttributePrefix??
11cn,v=new ts(e),y=d([],u(new Set(d(d(d([],u(m),!1),u(h),!1),u(g),!1))),!1),b=function(){var e,t=J(Za(`pointerdown`).map(function(e){return v.addAdditionalEventProperties(e,`click`,y,_,!0)})),n=J(ro().map(function(e){return v.addTypeAndTimestamp(e,`error`)})),r=J(Xa().map(function(e){return v.addAdditionalEventProperties(e,`mutation`,y,_)})),i;window.navigation&&(i=J(new q.default(function(e){var t=function(t){e.next(a(a({},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 o=J(new q.default(function(e){var t=function(){var t=document.activeElement;if(t&&(t.tagName===`TEXTAREA`||t.tagName===`INPUT`)){var n=void 0,r=void 0;try{if(n=t.selectionStart,r=t.selectionEnd,n===r)return}catch{return}return e.next()}var i=window.getSelection();if(!(!i||i.isCollapsed))return e.next()};return window.document.addEventListener(`selectionchange`,t),function(){window.document.removeEventListener(`selectionchange`,t)}})),s=J(io());return e={},e[X.ClickObservable]=t,e[X.MutationObservable]=r,e[X.NavigateObservable]=i,e[X.BrowserErrorObservable]=n,e[X.SelectionObservable]=o,e[X.MouseMoveObservable]=s,e};return{name:t,type:n,setup:function(n,a){return s(void 0,void 0,void 0,function(){var s,l,u,d,y,x,S,C,w,T,E,D;return c(this,function(c){return typeof document>`u`?[2]:(s=b(),l=rs(n,v),l&&r.push({unsubscribe:l}),f&&(u=Ma(e,m),d=vs({allObservables:s,amplitude:a,shouldTrackRageClick:u}),r.push(d)),o&&(y=Ma(e,h),x=us({amplitude:a,allObservables:s,getEventProperties:function(e,t){return v.getEventProperties(e,t,_)},shouldTrackDeadClick:y}),r.push(x)),i&&(S=Ma(e,g),C=bs({amplitude:a,allObservables:s,shouldTrackErrorClick:S}),r.push(C)),p&&(w=void 0,T=void 0,typeof e.thrashedCursor==`object`&&(w=e.thrashedCursor.directionChanges,T=e.thrashedCursor.threshold,w&&w<Ps&&(n.loggerProvider.warn(`'thrashedCursor.directionChanges' of ${w} is below the minimum of ${Ps}, setting to ${Ps}`),w=Ps),T&&T>Fs&&(n.loggerProvider.warn(`'thrashedCursor.threshold' of ${T} is above the maximum of ${Fs}, setting to ${Fs}`),T=Fs)),E=Ms({amplitude:a,options:e,allObservables:s,directionChanges:w,thresholdMs:T}),r.push(E)),(D=n?.loggerProvider)==null||D.log(`${t} has been successfully added.`),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i,a;return c(this,function(o){try{for(e=l(r),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){i={error:e}}finally{try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(i)throw i.error}}return[2]})})}}},Ls=100,Rs=1e4;function zs(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function Bs(e,t){var n=zs(e,t),r=e.scripts??[],i=r.map(function(e){return e.sourceURL}).filter(Boolean),o=r.map(function(e){return e.sourceFunctionName}).filter(Boolean),s=r.map(function(e){return e.sourceCharPosition}).filter(function(e){return typeof e==`number`&&e>=0}),c=r.map(function(e){return e.invokerType}).filter(Boolean),l=r.map(function(e){return e.invoker}).filter(Boolean);return a(a(a(a(a(a(a({"[Amplitude] Main Thread Block Source":`long-animation-frame`,"[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":r.length}),i.length>0&&{"[Amplitude] Main Thread Block Script URLs":i}),o.length>0&&{"[Amplitude] Main Thread Block Script Functions":o}),s.length>0&&{"[Amplitude] Main Thread Block Script Positions":s}),c.length>0&&{"[Amplitude] Main Thread Block Invoker Types":c}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}function Vs(e,t){var n=zs(e,t),r=e.attribution??[];return a(a({"[Amplitude] Main Thread Block Source":`long-task`,"[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),r.length>0&&{"[Amplitude] Main Thread Block Attribution":r.map(function(e){return e.name})})}function Hs(){if(typeof PerformanceObserver>`u`)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes(`long-animation-frame`))return`long-animation-frame`;if(e.includes(`longtask`))return`longtask`}catch{}return null}function Us(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=r===void 0?Ls:r,a=Hs();if(!a)return{unsubscribe:function(){}};var o=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=l(e.getEntries()),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var c=r-Rs;o.length>0&&o[0].startTime<c;)o.shift()});try{s.observe({entryTypes:[`measure`]})}catch{}var c=new PerformanceObserver(function(e){var r,s;try{for(var c=l(e.getEntries()),u=c.next();!u.done;u=c.next()){var d=u.value;if(!ja(n))return;if(!(d.duration<i)){var f=a===`long-animation-frame`?Bs(d,o):Vs(d,o);t.track(aa,f)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}});try{c.observe({entryTypes:[a]})}catch{return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){c.disconnect(),s.disconnect()}}}var Ws=100,Gs=function(e){e===void 0&&(e={});var t=ea,n=`enrichment`,r=[],i=e.mainThreadBlock===!0||typeof e.mainThreadBlock==`object`&&e.mainThreadBlock!==null;return{name:t,type:n,setup:function(n,a){return s(void 0,void 0,void 0,function(){var o,s,l;return c(this,function(c){return typeof document>`u`?[2]:(i&&(o=Ws,typeof e.mainThreadBlock==`object`&&e.mainThreadBlock.durationThreshold!==void 0&&(o=e.mainThreadBlock.durationThreshold),s=Us({amplitude:a,options:e,durationThreshold:o}),r.push(s)),(l=n?.loggerProvider)==null||l.log(`${t} performance tracking has been successfully added.`),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i,a;return c(this,function(o){try{for(e=l(r),t=e.next();!t.done;t=e.next())n=t.value,n.unsubscribe()}catch(e){i={error:e}}finally{try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(i)throw i.error}}return[2]})})}}},Ks=`@amplitude/plugin-network-capture-browser`,qs=`500-599`;function Js(e,t){var n=`^`+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,`\\$&`).replace(/\*/g,`.*`)+`$`;return new RegExp(n).test(e)}function Ys(e,t){var n,r,i=t.split(`,`);try{for(var a=l(i),o=a.next();!o.done;o=a.next()){var s=o.value,c=u(s.split(`-`).map(Number),2),d=c[0],f=c[1];if(e===d&&f===void 0||e>=d&&e<=f)return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return!1}function Xs(e,t,n,r,i){if(!(e.hosts&&!e.hosts.find(function(e){return Js(t,e)}))&&!(r&&e.urls&&!ft(r,e.urls))&&!(i&&e.methods&&!e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||e===`*`})))return!((n||n===0)&&!Ys(n,e.statusCodeRange||qs))}function Zs(e){if(e)try{var t=L()?.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 Qs(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 $s(e){if(typeof e!=`object`||!e)return e?d([],u(M),!1):void 0;if(e.length!==0)return e}function ec(e){return!e?.allowlist?.length&&!e?.blocklist?.length&&!e?.excludelist?.length}
11function tc(e,t){t===void 0&&(t={});var n=Zs(e.url);if(!n)return!1;var r=n.host;if(t.ignoreAmplitudeRequests!==!1&&(Js(r,`*.amplitude.com`)||Js(r,`amplitude.com`))||t.ignoreHosts?.find(function(e){return Js(r,e)})||!t.captureRules&&e.status!==void 0&&!Ys(e.status,qs))return!1;if(t.captureRules){var i;if(d([],u(t.captureRules),!1).reverse().find(function(t){if(i=Xs(t,r,e.status,e.url,e.method),i){var n=$s(t.responseHeaders);if(e.responseWrapper&&n){var a=e.responseWrapper.headers(n);a&&(e.responseHeaders=a)}var o=$s(t.requestHeaders);if(e.requestWrapper&&o){var s=e.requestWrapper.headers(o);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!ec(t.responseBody)){var c=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,c)}if(e.requestWrapper&&t.requestBody&&!ec(t.requestBody)){var c=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,c)}}return i!==void 0}),!i)return!1}return!(e.requestWrapper&&Qs(r,e.requestWrapper))}function nc(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,o;return c(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=u.apply(void 0,[s.sent(),2]),a=i[0],o=i[1],a)try{e[`[Amplitude] Request Body`]=JSON.stringify(a)}catch(e){r?.debug(`Failed to stringify request body`,e)}if(o)try{e[`[Amplitude] Response Body`]=JSON.stringify(o)}catch{r?.debug(`Failed to stringify response body`)}s.label=2;case 2:return n?.track(`[Amplitude] Network Request`,e),[2]}})})}function rc(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return tc(e.event,n)}).subscribe(function(e){var t,n=e.event,a=Zs(n.url);if(a){var o=n.responseWrapper?.bodySize,s=n.requestWrapper?.bodySize;nc((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)}})}var ic;(function(e){e.NetworkObservable=`networkObservable`})(ic||={});var ac,oc=function(e){e===void 0&&(e={});var t=Ks,n=`enrichment`,r,i=function(e,t){return{event:e,timestamp:Date.now(),type:t}},a=function(){var e,t=new q.default(function(e){var t=new Nn(function(t){var n=i(t,`network`);e.next(n)});return Fn.subscribe(t,r),function(){Fn.unsubscribe(t)}});return e={},e[ic.NetworkObservable]=t,e};return{name:t,type:n,setup:function(n,i){return s(void 0,void 0,void 0,function(){var o;return c(this,function(s){return typeof document>`u`?[2]:(o=a(),r=n?.loggerProvider,ac=rc({allObservables:o,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 c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(e){return ac.unsubscribe(),[2]})})}}},sc=`web-vitals-browser`,cc=`[Amplitude] Web Vitals`,lc=-1,uc=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(lc=t.timeStamp,e(t))}),!0)},Z=(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)))}},dc=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},fc=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},pc=()=>fc()?.activationStart??0,Q=(e,t=-1)=>{let n=fc(),r=`navigate`;return lc>=0?r=`back-forward-cache`:n&&(document.prerendering||pc()>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}},mc=new WeakMap;function hc(e,t){return mc.get(e)||mc.set(e,new t),mc.get(e)}var gc=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)}},_c=(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{}},vc=e=>{let t=!1;return()=>{t||=(e(),!0)}},yc=-1,bc=new Set,xc=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,Sc=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of bc)e();isFinite(yc)||(yc=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,Sc,!0))}},Cc=()=>
11{if(yc<0){let e=pc();yc=(document.prerendering?void 0:globalThis.performance.getEntriesByType(`visibility-state`).filter((t=>t.name===`hidden`&&t.startTime>e))[0]?.startTime)??xc(),addEventListener(`visibilitychange`,Sc,!0),addEventListener(`prerenderingchange`,Sc,!0),uc((()=>{setTimeout((()=>{yc=xc()}))}))}return{get firstHiddenTime(){return yc},onHidden(e){bc.add(e)}}},wc=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},Tc=[1800,3e3],Ec=(e,t={})=>{wc((()=>{let n=Cc(),r,i=Q(`FCP`),a=_c(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-pc(),0),i.entries.push(t),r(!0)))}));a&&(r=Z(e,i,Tc,t.reportAllChanges),uc((n=>{i=Q(`FCP`),r=Z(e,i,Tc,t.reportAllChanges),dc((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},Dc=[.1,.25],Oc=(e,t={})=>{let n=Cc();Ec(vc((()=>{let r,i=Q(`CLS`,0),a=hc(t,gc),o=e=>{for(let t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,r())},s=_c(`layout-shift`,o);s&&(r=Z(e,i,Dc,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),uc((()=>{a.i=0,i=Q(`CLS`,0),r=Z(e,i,Dc,t.reportAllChanges),dc((()=>r()))})),setTimeout(r))})))},kc=0,Ac=1/0,jc=0,Mc=e=>{for(let t of e)t.interactionId&&(Ac=Math.min(Ac,t.interactionId),jc=Math.max(jc,t.interactionId),kc=jc?(jc-Ac)/7+1:0)},Nc,Pc=()=>Nc?kc:performance.interactionCount??0,Fc=()=>{`interactionCount`in performance||Nc||(Nc=_c(`event`,Mc,{type:`event`,buffered:!0,durationThreshold:0}))},Ic=0,Lc=class{u=[];l=new Map;m;p;v(){Ic=Pc(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Pc()-Ic)/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)}}},Rc=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=vc(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},zc=[200,500],Bc=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Cc();wc((()=>{Fc();let r,i=Q(`INP`),a=hc(t,Lc),o=e=>{Rc((()=>{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=_c(`event`,o,{durationThreshold:t.durationThreshold??40});r=Z(e,i,zc,t.reportAllChanges),s&&(s.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),uc((()=>{a.v(),i=Q(`INP`),r=Z(e,i,zc,t.reportAllChanges)})))}))},Vc=class{m;h(e){this.m?.(e)}},Hc=[2500,4e3],Uc=(e,t={})=>{wc((()=>{let n=Cc(),r,i=Q(`LCP`),a=hc(t,Vc),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-pc(),0),i.entries=[t],r())},s=_c(`largest-contentful-paint`,o);if(s){r=Z(e,i,Hc,t.reportAllChanges);let n=vc((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(Rc(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});uc((n=>{i=Q(`LCP`),r=Z(e,i,Hc,t.reportAllChanges),dc((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))},Wc=[800,1800],Gc=e=>{document.prerendering?wc((()=>Gc(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>Gc(e)),!0)},Kc=(e,t={})=>{let n=Q(`TTFB`),r=Z(e,n,Wc,t.reportAllChanges);Gc((()=>{let i=fc();i&&(n.value=Math.max(i.responseStart-pc(),0),n.entries=[i],r(!0),uc((()=>{n=Q(`TTFB`,0),r=Z(e,n,Wc,t.reportAllChanges),r(!0)})))}))};function qc(e){var t=e.entries[0]?.startTime||0;return performance.timeOrigin+t}function Jc(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(qc(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Yc=function(){var e=null,t=L(),n=t?.document,r=t?.location;return{name:sc,type:`enrichment`,setup:function(t,i){return s(void 0,void 0,void 0,function(){var a,o;return c(this,function(s){return n===void 0?[2]:(a=G(r?.href||``,t.loggerProvider),o={"[Amplitude] Page Domain":r?.hostname||``,"[Amplitude] Page Location":a,"[Amplitude] Page Path":G(r?.pathname||``,t.loggerProvider),"[Amplitude] Page Title":typeof document<`u`&&document.title||``,"[Amplitude] Page URL":G(a.split(`?`)[0],t.loggerProvider)},Uc(function(e){o[`[Amplitude] LCP`]=Jc(e)}),Ec(function(e){o[`[Amplitude] FCP`]=Jc(e)}),Bc(function(e){o[`[Amplitude] INP`]=Jc(e)}),Oc(function(e){o[`[Amplitude] CLS`]=Jc(e)}),Kc(function(e){o[`[Amplitude] TTFB`]=Jc(e)}),e=function(){n.visibilityState===`hidden`&&e&&(i.track(cc,o),n.removeEventListener(`visibilitychange`,e),e=null)},n.addEventListener(`visibilitychange`,e),[2])})})},execute:function(e){return s(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(t){return e&&n?.removeEventListener(`visibilitychange`,e),[2]})})}}},Xc=function(){function e(e,t){this.shouldTrackNewCampaign=!1,this.options=a({initialEmptyValue:`EMPTY`,resetSessionOnNewCampaign:!1,excludeReferrers:Ci(t.cookieOptions?.domain||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Ct(t.apiKey,`MKTG`),this.webExpStorageKey=Ct(t.apiKey,`MKTG_ORIGINAL`),this.currentCampaign=j,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log(`Installing web attribution tracking.`)}return e.prototype.init=function(){return s(this,void 0,void 0,function(){var e,t;return c(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=u.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||ot(this.sessionTimeout,this.lastEventTime),yi(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,function(){var e;return c(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 In().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t=Si(this.currentCampaign,this.options);return e&&(t.event_id=e),t},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Zc=`[Amplitude] Attribution`,Qc=new Set([p.IDENTIFY,p.GROUP_IDENTIFY]),$c=function(e){return ht(e)},el=function(e){e===void 0&&(e={});var t=e.fallbackAttributionEvent??!1,n=L(),r,i,o={},l=!1,u=!1,d,f,p,m,h=function(){return s(void 0,void 0,void 0,function(){var e;return c(this,function(n){switch(n.label){case 0:return[4,new In().parse()];case 1:return e=n.sent(),o=$c(e),t&&(i?.log(`Tracking attribution fallback event.`),r?.track(Zc,o)),[2]}})})},g=function(){h()},_=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),l&&g()}})};return{name:`@amplitude/plugin-event-property-attribution-browser`,type:`enrichment`,setup:function(e,t){return s(void 0,void 0,void 0,function(){return c(this,function(a){switch(a.label){case 0:return r=t,i=e.loggerProvider,l=!0,i.log(`Installing event property attribution tracking.`),[4,h()];case 1:if(a.sent(),!n)return[2];if(n.addEventListener(`popstate`,g),!u){if(d=Reflect.get(n.history,`pushState`),f=Reflect.get(n.history,`replaceState`),!d||!f)return[2];p=_(d),n.history.pushState=p,m=_(f),n.history.replaceState=m,u=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return c(this,function(t){return Qc.has(e.event_type)||(e.event_properties=a(a({},o),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return c(this,function(r){return n&&(n.removeEventListener(`popstate`,g),e=Reflect.get(n.history,`pushState`),t=Reflect.get(n.history,`replaceState`),u&&e===p&&d&&(n.history.pushState=d),u&&t===m&&f&&(n.history.replaceState=f)),l=!1,u=!1,d=void 0,f=void 0,p=void 0,m=void 0,o={},[2]})})}}},tl=`AMP_CURRENT_PAGE`,nl=`AMP_PREVIOUS_PAGE`,rl=`AMP_URL_INFO`,il;(function(e){e.Direct=`direct`,e.Internal=`internal`,e.External=`external`})(il||={});var al=new Set([p.IDENTIFY,p.GROUP_IDENTIFY,p.REVENUE]),ol=function(e){var t=(e===void 0?{}:e).internalDomains,n=t===void 0?[]:t,r=L(),i=void 0,o=!1,l=void 0,d=!1,f=!1,p=function(e){var t;try{var n=G(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 il.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?il.Internal:il.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,a;return c(this,function(s){switch(s.label){case 0:return i&&o?[4,i.get(rl)]:[3,3];case 1:return e=s.sent(),t=G(typeof location<`u`&&location.href||``),n=e?.AMP_CURRENT_PAGE||``,r=void 0,r=t===n?e?.AMP_PREVIOUS_PAGE||``:n||document.referrer||``,[4,i.set(rl,(a={},a[tl]=t,a[nl]=r,a))];case 2:s.sent(),s.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(){var t,n,a,s,m,_,v,y;return c(this,function(c){switch(c.label){case 0:if(l=e.loggerProvider,l.log(`Installing @amplitude/plugin-page-url-enrichment-browser`),f=!0,!r)return[3,7];try{i=new wt(r.sessionStorage)}catch{l?.debug(`sessionStorage is not available in this environment.`)}return[4,i?.isEnabled()];case 1:return o=c.sent()??!1,i&&o?(t=typeof document<`u`&&document.referrer||``,n=t?p(t):void 0,a=typeof location<`u`&&location.hostname||``,s=G(typeof location<`u`&&location.href||``),[4,i.get(rl)]):[3,6];case 2:return m=c.sent(),_=m?.AMP_CURRENT_PAGE||``,v=!!n&&n!==a&&_!==s,v?[4,i.set(rl,(y={},y[tl]=s,y[nl]=t,y))]:[3,4];case 3:return c.sent(),[3,6];case 4:return[4,h()];case 5:c.sent(),c.label=6;case 6:r.addEventListener(`popstate`,g),d||=(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=u(n,3),i=r[0],a=r[1],o=r[2];e.apply(t,[i,a,o]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=u(n,3),i=r[0],a=r[1],o=r[2];e.apply(t,[i,a,o]),f&&g()}}),!0),c.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return c(this,function(s){switch(s.label){case 0:return t=G(typeof location<`u`&&location.href||``),i&&o?[4,i.get(rl)]:[3,2];case 1:if(n=s.sent(),r=n?.AMP_PREVIOUS_PAGE||``,al.has(e.event_type))return[2,e];e.event_properties=a(a({},e.event_properties||{}),{"[Amplitude] Page Domain":sl(e,`[Amplitude] Page Domain`,typeof location<`u`&&location.hostname||``),"[Amplitude] Page Location":sl(e,`[Amplitude] Page Location`,t),"[Amplitude] Page Path":sl(e,`[Amplitude] Page Path`,typeof location<`u`&&G(location.pathname)||``),"[Amplitude] Page Title":sl(e,`[Amplitude] Page Title`,Un(Hn)),"[Amplitude] Page URL":sl(e,`[Amplitude] Page URL`,t.split(`?`)[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":m(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener(`popstate`,g),f=!1),i&&o?[4,i.set(rl,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function sl(e,t,n){return e.event_properties||={},e.event_properties[t]===void 0?n:e.event_properties[t]}var cl=function(){var e,t,n;function r(e){return typeof e!=`object`||!e?!1:`body`in e&&typeof e.body==`string`}function i(t){if(t)try{var n=Function(`return `+t)();if(typeof n==`function`)return n;e?.error(`Custom enrichment body did not evaluate to a function`)}catch(t){e?.error(`Could not create custom enrichment function`,t)}return function(e){return e}}return{name:`@amplitude/plugin-custom-enrichment-browser`,type:`enrichment`,setup:function(a,o){return s(void 0,void 0,void 0,function(){var o;return c(this,function(s){return e=a.loggerProvider,e?.log(`Installing @amplitude/plugin-custom-enrichment-browser`),a.remoteConfig?.fetchRemoteConfig&&(a.remoteConfigClient?(o=a.remoteConfigClient.subscribe(`configs.analyticsSDK.browserSDK.customEnrichment`,`all`,function(e){n=e&&r(e)?i(e.body||``):i(``)}),t=function(){return a.remoteConfigClient?.unsubscribe(o)}):e?.debug(`Remote config client is not provided, skipping remote config fetch`)),[2]})})},execute:function(t){return s(void 0,void 0,void 0,function(){return c(this,function(r){if(n)try{return[2,n(t)??null]}catch(n){return e?.error(`Could not execute custom enrichment function`,n),[2,t]}return[2,t]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return c(this,function(e){return t&&t(),[2]})})}}},ll=`userProperty`,ul=`eventProperty`,dl=function(e){return e===`userProperty`||e===`eventProperty`},fl=function(e){var t=d([],u(new Set((Array.isArray(e)?e:[e]).filter(dl))),!1);return t.length>0?t:[ll]},pl=function(e,t){return fl(e.trackingMethod).includes(t)},ml=function(e){return pl(e,ll)},hl=function(e){return pl(e,ul)},gl=-1,_l=function(e){i(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>
112?(r=t,i=n):typeof t==`string`?(r=t,i=void 0):(r=t?.userId,i=t),z(this._init(a(a({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){return s(this,void 0,void 0,function(){var n,r,i,a,l,u,d,f,p,m,h,g,_,v,y,b=this;return c(this,function(x){switch(x.label){case 0:return this.initializing?[2]:(this.initializing=!0,n=Mi(t),r=t.loggerProvider??new ke,t.loggerProvider||r.enable(t.logLevel??V.Warn),i=t.serverZone??`US`,l=this._diagnosticsSampleRate,u=t.enableDiagnostics??!0,n?(a=new Yt(t.apiKey,r,i,t.remoteConfig?.serverUrl),[4,new Promise(function(e){a?.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 Bt(t.apiKey,r,i,{enabled:u,sampleRate:l}),d.setTag(`library`,`${Hr}/${Vr}`),typeof navigator<`u`&&d.setTag(`user_agent`,navigator.userAgent),[4,Ai(t.apiKey,t,this,d,{loggerProvider:r,serverZone:i,enableDiagnostics:u,diagnosticsSampleRate:l})];case 3:return f=x.sent(),n&&a?[4,new Promise(function(e){a?.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&&Xi(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=a,p=Ir(this.config),yr(this.config.defaultTracking)&&ml(p)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(b,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Xc(p,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Xc(p,this.config),[4,this.webAttribution.init()]):[3,8];case 7:x.sent(),x.label=8;case 8:return m=ut(),h=m.ampTimestamp?Number(m.ampTimestamp):void 0,g=!h||Date.now()<h,_=g&&!Number.isNaN(Number(m.ampSessionId))?Number(m.ampSessionId):void 0,v=this.config.deferredSessionId,v===gl&&!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 c(this,function(t){return!e&&this.config.deferredSessionId&&(this.config.deferredSessionId===gl?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),y=nt(t.instanceName),y.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===null?[3,10]:[4,this.add(qi()).promise];case 9:x.sent(),x.label=10;case 10:return[4,this.add(new He({diagnosticsClient:d})).promise];case 11:return x.sent(),[4,this.add(new Gr).promise];case 12:return x.sent(),[4,this.add(new at).promise];case 13:return x.sent(),Ki(this.config),br(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding file download tracking plugin`),[4,this.add(Wi()).promise]):[3,15];case 14:x.sent(),x.label=15;case 15:return xr(this.config.defaultTracking)?(this.config.loggerProvider.debug(`Adding form interaction plugin`),[4,this.add(Vi()).promise]):[3,17];case 16:x.sent(),x.label=17;case 17:return Sr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(Li(Fr(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 c(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug(`Adding page view tracking plugin`),[4,this.add(Li(Fr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),x.label=20;case 20:return yr(this.config.defaultTracking)&&hl(p)?(this.config.loggerProvider.debug(`Adding event property attribution plugin`),[4,this.add(el(p)).promise]):[3,22];case 21:x.sent(),x.label=22;case 22:return Er(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding user interactions plugin (autocapture plugin)`),[4,this.add(ss(Mr(this.config),{diagnosticsClient:d})).promise]):[3,24];case 23:x.sent(),x.label=24;case 24:return Or(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding frustration interactions plugin`),[4,this.add(Is(Nr(this.config))).promise]):[3,26];
11case 25:x.sent(),x.label=26;case 26:return Tr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding network tracking plugin`),[4,this.add(oc(Pr(this.config))).promise]):[3,28];case 27:x.sent(),x.label=28;case 28:return Dr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding web vitals plugin`),[4,this.add(Yc()).promise]):[3,30];case 29:x.sent(),x.label=30;case 30:return kr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding performance tracking plugin`),[4,this.add(Gs(Ar(this.config))).promise]):[3,32];case 31:x.sent(),x.label=32;case 32:return wr(this.config.autocapture)?(this.config.loggerProvider.debug(`Adding referrer page url plugin`),[4,this.add(ol()).promise]):[3,34];case 33:x.sent(),x.label=34;case 34:return jr(this.config.customEnrichment)?(this.config.loggerProvider.debug(`Adding custom enrichment plugin`),[4,this.add(cl()).promise]):[3,36];case 35:x.sent(),x.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions(`dispatchQ`)];case 37:return x.sent(),y.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=o(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}),rt(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}),it(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(R()),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 r=new N,i=e.userProperties??{};try{for(var a=l(Object.entries(i)),o=a.next();!o.done;o=a.next()){var s=u(o.value,2),c=s[0],d=s[1];r.set(c,d)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(r)}},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)),z(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=e??gl,z(Promise.resolve());if(e===void 0&&(e=Date.now()),e===this.config.sessionId)return z(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,Cr(this.config.defaultTracking)&&(n&&r&&t.push(this.track(ai,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(xe(this.config.identify)).promise),Cr(this.config.defaultTracking)&&t.push(this.track(ii,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,z(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=Ni(e)},t.prototype.identify=function(t,n){if(Br(t)){var r=t._q;t._q=[],t=zr(new N,r)}
11return 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(Br(r)){var a=r._q;r._q=[],r=zr(new N,a)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(Br(t)){var r=t._q;t._q=[],t=zr(new Ee,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!ml(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log(`Tracking attribution.`),!0},t.prototype.process=function(t){return s(this,void 0,void 0,function(){var n,r,i;return c(this,function(a){return n=Date.now(),r=ot(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=a(a({},e),{apiKey:e.apiKey.substring(0,10)+`********`});this.config.loggerProvider.debug(`Initialized Amplitude with BrowserConfig:`,Jn(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}(Te),vl=function(){var e=new _l;return{init:W(e.init.bind(e),`init`,H(e),U(e,[`config`])),add:W(e.add.bind(e),`add`,H(e),U(e,[`config.apiKey`,`timeline.plugins`])),remove:W(e.remove.bind(e),`remove`,H(e),U(e,[`config.apiKey`,`timeline.plugins`])),track:W(e.track.bind(e),`track`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),logEvent:W(e.logEvent.bind(e),`logEvent`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),identify:W(e.identify.bind(e),`identify`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),groupIdentify:W(e.groupIdentify.bind(e),`groupIdentify`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),setGroup:W(e.setGroup.bind(e),`setGroup`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),revenue:W(e.revenue.bind(e),`revenue`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),flush:W(e.flush.bind(e),`flush`,H(e),U(e,[`config.apiKey`,`timeline.queue.length`])),getUserId:W(e.getUserId.bind(e),`getUserId`,H(e),U(e,[`config`,`config.userId`])),setUserId:W(e.setUserId.bind(e),`setUserId`,H(e),U(e,[`config`,`config.userId`])),getDeviceId:W(e.getDeviceId.bind(e),`getDeviceId`,H(e),U(e,[`config`,`config.deviceId`])),setDeviceId:W(e.setDeviceId.bind(e),`setDeviceId`,H(e),U(e,[`config`,`config.deviceId`])),reset:W(e.reset.bind(e),`reset`,H(e),U(e,[`config`,`config.userId`,`config.deviceId`])),getSessionId:W(e.getSessionId.bind(e),`getSessionId`,H(e),U(e,[`config`])),setSessionId:W(e.setSessionId.bind(e),`setSessionId`,H(e),U(e,[`config`])),extendSession:W(e.extendSession.bind(e),`extendSession`,H(e),U(e,[`config`])),setOptOut:W(e.setOptOut.bind(e),`setOptOut`,H(e),U(e,[`config`])),setTransport:W(e.setTransport.bind(e),`setTransport`,H(e),U(e,[`config`])),getIdentity:W(e.getIdentity.bind(e),`getIdentity`,H(e),U(e,[`config`])),setIdentity:W(e.setIdentity.bind(e),`setIdentity`,H(e),U(e,[`config`,`config.userId`,`config.deviceId`])),getOptOut:W(e.getOptOut.bind(e),`getOptOut`,H(e),U(e,[`config`])),_setDiagnosticsSampleRate:W(e._setDiagnosticsSampleRate.bind(e),`_setDiagnosticsSampleRate`,H(e),U(e,[`config`]))}},$=vl(),yl=function(){function e(e){this.amplitude=e,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(e){return this.videoEl=e,this},e.prototype.withEmbeddedPlayer=function(e){return this.embeddedVideoPlayer=e,this},e.prototype.withVendor=function(e){return this.vendor=e,this},e.prototype.withExtraEventProperties=function(e){return this.extraEventProperties=e,this},e.prototype.captureVideoStarted=function(){var e=this;return this.listeners.push(function(t,n){t.playbackState!==`playing`&&n.playbackState===`playing`&&e.amplitude.track(`Video Content Started`,a(a({},n.lastEvent),e.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){t.playbackState===`playing`&&n.playbackState!==`playing`&&e.amplitude.track(`Video Content Stopped`,a(a(a({},n.lastEvent),{watch_duration:n.watchTime}),e.extraEventProperties))}),this},e.prototype.start=function(){var e=this,t=this.videoEl??this.embeddedVideoPlayer;if(!t)throw Error(`Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.`);if(this.videoEl&&this.embeddedVideoPlayer)throw Error(`Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.`);var n=new gr({videoEl:t,onStateChange:function(t,n){e.listeners.forEac
11h(function(e){return e(t,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){n.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[]},e}();function bl(e,t,n){n===void 0&&(n={});var r=new yl(e);t instanceof HTMLVideoElement?r.withVideoElement(t):r.withEmbeddedPlayer(t),n.vendor&&r.withVendor(n.vendor);var i=n.extraEventProperties??{};try{r.withExtraEventProperties(a({view_session_id:R()},i)).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return r.stop()}}var xl=$.add,Sl=$.extendSession,Cl=$.flush,wl=$.getDeviceId,Tl=$.getIdentity,El=$.getOptOut,Dl=$.getSessionId,Ol=$.getUserId,kl=$.groupIdentify,Al=$.identify,jl=$.init,Ml=$.logEvent,Nl=$.remove,Pl=$.reset,Fl=$.revenue,Il=$.setDeviceId,Ll=$.setGroup,Rl=$.setIdentity,zl=$.setOptOut,Bl=$.setSessionId,Vl=$.setTransport,Hl=$.setUserId,Ul=$.track,Wl=$._setDiagnosticsSampleRate;export{_l as AmplitudeBrowser,N as Identify,Ee as Revenue,hi as Types,Wl as _setDiagnosticsSampleRate,xl as add,vl as createInstance,Sl as extendSession,Cl as flush,wl as getDeviceId,Tl as getIdentity,El as getOptOut,Dl as getSessionId,Ol as getUserId,kl as groupIdentify,Al as identify,jl as init,Ml as logEvent,Nl as remove,Pl as reset,Fl as revenue,Rr as runQueuedFunctions,Il as setDeviceId,Ll as setGroup,Rl as setIdentity,zl as setOptOut,Bl as setSessionId,Vl as setTransport,Hl as setUserId,Ul as track,bl as trackVideo};
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.