@amplitude/analytics-browser 2.49.3 → 2.50.0-video-analytics-plus-page-x-y.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/cjs/browser-client.d.ts.map +1 -1
- package/lib/cjs/browser-client.js +51 -36
- package/lib/cjs/browser-client.js.map +1 -1
- package/lib/cjs/config/joined-config.d.ts +6 -1
- package/lib/cjs/config/joined-config.d.ts.map +1 -1
- package/lib/cjs/config/joined-config.js.map +1 -1
- package/lib/cjs/config.d.ts +9 -2
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +28 -3
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/constants.d.ts +3 -1
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/constants.js +5 -2
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/default-tracking.d.ts +4 -1
- package/lib/cjs/default-tracking.d.ts.map +1 -1
- package/lib/cjs/default-tracking.js +13 -1
- package/lib/cjs/default-tracking.js.map +1 -1
- package/lib/cjs/types.d.ts +1 -1
- package/lib/cjs/types.d.ts.map +1 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/cjs/video-capture/video-capture.d.ts +48 -11
- package/lib/cjs/video-capture/video-capture.d.ts.map +1 -1
- package/lib/cjs/video-capture/video-capture.js +194 -16
- package/lib/cjs/video-capture/video-capture.js.map +1 -1
- package/lib/esm/browser-client.d.ts.map +1 -1
- package/lib/esm/browser-client.js +52 -37
- package/lib/esm/browser-client.js.map +1 -1
- package/lib/esm/config/joined-config.d.ts +6 -1
- package/lib/esm/config/joined-config.d.ts.map +1 -1
- package/lib/esm/config/joined-config.js.map +1 -1
- package/lib/esm/config.d.ts +9 -2
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +26 -2
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/constants.d.ts +3 -1
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/constants.js +4 -1
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/default-tracking.d.ts +4 -1
- package/lib/esm/default-tracking.d.ts.map +1 -1
- package/lib/esm/default-tracking.js +10 -0
- package/lib/esm/default-tracking.js.map +1 -1
- package/lib/esm/types.d.ts +1 -1
- package/lib/esm/types.d.ts.map +1 -1
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/esm/video-capture/video-capture.d.ts +48 -11
- package/lib/esm/video-capture/video-capture.d.ts.map +1 -1
- package/lib/esm/video-capture/video-capture.js +196 -18
- package/lib/esm/video-capture/video-capture.js.map +1 -1
- package/lib/scripts/amplitude-bookmarklet-snippet-min.js +1 -1
- package/lib/scripts/amplitude-bookmarklet.html +1 -1
- package/lib/scripts/amplitude-gtm-min.js +1 -1
- package/lib/scripts/amplitude-gtm-min.js.gz +0 -0
- package/lib/scripts/amplitude-gtm-min.js.map +1 -1
- package/lib/scripts/amplitude-gtm-snippet-min.js +1 -1
- package/lib/scripts/amplitude-lite-min.js +1 -1
- package/lib/scripts/amplitude-lite-min.js.gz +0 -0
- package/lib/scripts/amplitude-lite-min.js.map +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.js.map +1 -1
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/amplitude-snippet-instructions.html +1 -1
- package/lib/scripts/amplitude-snippet-min.js +1 -1
- package/lib/scripts/browser-client.d.ts.map +1 -1
- package/lib/scripts/config/joined-config.d.ts +6 -1
- package/lib/scripts/config/joined-config.d.ts.map +1 -1
- package/lib/scripts/config.d.ts +9 -2
- package/lib/scripts/config.d.ts.map +1 -1
- package/lib/scripts/constants.d.ts +3 -1
- package/lib/scripts/constants.d.ts.map +1 -1
- package/lib/scripts/default-tracking.d.ts +4 -1
- package/lib/scripts/default-tracking.d.ts.map +1 -1
- package/lib/scripts/types.d.ts +1 -1
- package/lib/scripts/types.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/lib/scripts/version.d.ts.map +1 -1
- package/lib/scripts/video-capture/video-capture.d.ts +48 -11
- package/lib/scripts/video-capture/video-capture.d.ts.map +1 -1
- package/package.json +9 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var t=function(e,n){return t=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])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var f,v="AMP",p="".concat(v,"_unsent"),h="$default_instance",g="https://api2.amplitude.com/2/httpapi",m="https://api.eu.amplitude.com/2/httpapi",y="https://api2.amplitude.com/batch",b="https://api.eu.amplitude.com/batch",w="dclid",E="fbclid",S="gbraid",k="gclid",T="ko_click_id",x="li_fat_id",P="msclkid",I="rdt_cid",A="ttclid",C="twclid",_="wbraid",O={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},R=["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"],D=["authorization","cookie","set-cookie"],L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&L(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||N(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(f||(f={}));var j,U=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],q="Event skipped due to empty event type";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(j||(j={}));var F=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=j.Unknown),{event:e,code:t,message:n}},B=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},V=d([],l(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),H=function(e){var t,n=B();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,H)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],l(r.entries()),!1).map(function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(V[r]):V[r]}).join("")},z={},K={get exports(){return z},set exports(e){z=e}},W=Object.prototype.hasOwnProperty;function Y(e){return"[Throws: "+(e?e.message:"?")+"]"}function $(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return Y(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(W.call(e,t))try{return e[t]}catch(e){return Y(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}K.exports=function(e,t,n){return JSON.stringify($(e),t,n)};var G,J=z.ensureProperties=$,X=z||e({__proto__:null,ensureProperties:J,get default(){return z}},[z]),Q=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=H(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),r=this.plugins.findIndex(function(t){return t.name===e}),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a,s,d,f,v,p,h,g,m,y,b,w,E,S,k,T;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),s=c(a),d=s.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(E)throw E.error}return[7];case 8:v=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),p=c(v),h=p.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=12;case 12:return h=p.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),k={error:y},[3,16];case 15:try{h&&!h.done&&(T=p.return)&&T.call(p)}finally{if(k)throw k.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(X(n))),w=b.map(function(e){var t=o({},n);return e.execute(t).catch(function(e){return F(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||F(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 u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),t=c(this._optOutListeners),n=t.next(),u.label=1;case 1:if(n.done)return[3,6];r=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,r(e)];case 3:return u.sent(),[3,5];case 4:return i=u.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=u.sent(),a={error:o},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),Z=function(e,t){return o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},ee=function(e){return{promise:e||Promise.resolve()}},te=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Q(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(a=o())&&"promise"in a?[4,a.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,a];case 5:u.sent(),u.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Z(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ee(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var a=function(e,t,n,r){var a;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(a={},a[e]=t,a)})}(e,t,n,r);return ee(this.dispatch(a))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,a=new M;return a.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:a.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ee(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ee())},e.prototype._addPlugin=function(e){return ee(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)),ee())},e.prototype._removePlugin=function(e){return ee(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(F(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},i=o({},n);if(void 0===e)return i;var a={};return Object.keys(e).forEach(function(t){Object.values(r).includes(t)||(a[t]=e[t])}),U.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case r.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case r.UNSET:Object.keys(n).forEach(function(e){delete i[e]});break;case r.SET:Object.assign(i,n)}}}),Object.assign(i,a),i},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,F(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(q),[2,F(e,0,q)]):(e.event_type===i.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(o=a.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=F(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ee(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ne=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));L(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[G.REVENUE_PRODUCT_ID]=this.productId,e[G.REVENUE_QUANTITY]=this.quantity,e[G.REVENUE_PRICE]=this.price,e[G.REVENUE_TYPE]=this.revenueType,e[G.REVENUE_CURRENCY]=this.currency,e[G.REVENUE]=this.revenue,e[G.RECEIPT]=this.receipt,e[G.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(G||(G={}));var re;!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"}(re||(re={}));var ie="Amplitude Logger ",oe=function(){function e(){this.logLevel=re.None}return e.prototype.disable=function(){this.logLevel=re.None},e.prototype.enable=function(e){void 0===e&&(e=re.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Verbose||console.log("".concat(ie,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Warn||console.warn("".concat(ie,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Error||console.error("".concat(ie,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Debug||console.log("".concat(ie,"[Debug]: ").concat(e.join(" ")))},e}(),ae=function(e){return void 0===e||""===e?h:e},se=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:re.Warn,loggerProvider:new oe,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},ue=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=se();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=ae(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=le(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),ce=function(e,t){return"EU"===e?t?b:m:t?y:g},le=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=se().serverZone),void 0===n&&(n=se().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:se().serverZone;return{serverZone:r,serverUrl:ce(r,n)}},de=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 ve=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},pe=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},he=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ge=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=he(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},me=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),u=s.logger,c=s.logLevel;if(c&&c<re.Debug||!c||!u)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ve(1),time:{start:(new Date).toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))),d}},ye=new Set([g,m,y,b]);function be(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var we=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,function(){var n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(p,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=H()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var t,n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]).reduce(function(t,n){return s(r,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),s(this,void 0,void 0,function(){var r,i,o,s,c,l;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,a(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new de,u.label=1;case 1:return u.trys.push([1,3,,4]),i=le(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=function(e,t){return void 0===t&&(t=!1),!!ye.has(e)||t}(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,o)];case 2:return null===(s=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(be(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return c=u.sent(),l=(d=c)instanceof Error?d.message:String(d),this.config.loggerProvider.error(l),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:ve()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}var d})})},e.prototype.handleResponse=function(e,t){var n;fe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:be(e),stack_trace:ve()});var r=e.status;switch(r){case j.Success:this.handleSuccessResponse(e,t);break;case j.Invalid:this.handleInvalidResponse(e,t);break;case j.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case j.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(be(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(be(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,a=new Set(r),s=new Set(i),u=new Set(o),c=t.filter(function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(be(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:ve()})),this.removeEvents(e),e.forEach(function(e){return e.callback(F(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){var t=new Set(e);this.queue=this.queue.filter(function(e){return!t.has(e)}),this.saveEvents()},e}();class Ee{getApplicationContext(){return{versionName:this.versionName,language:Se(),platform:"Web",os:void 0,deviceModel:void 0}}}const Se=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class ke{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Te=(e,t)=>{const n=["string","number","boolean","undefined"],r=typeof e;if(r!==typeof t)return!1;for(const i of n)if(i===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const i=Array.isArray(e),o=Array.isArray(t);if(i!==o)return!1;if(!i||!o){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(!Te(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Te(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Te(e[n],t[n]))return!1;return!0};Object.entries||(Object.entries=function(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class xe{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},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(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(const[n,r]of Object.entries(e))switch(n){case"$set":for(const[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(const e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){const t=Object.assign({},this.identity);this.identity=Object.assign({},e),Te(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Ie{constructor(){this.identityStore=new xe,this.eventBridge=new ke,this.applicationContextProvider=new Ee}static getInstance(e){return Pe.analyticsConnectorInstances||(Pe.analyticsConnectorInstances={}),Pe.analyticsConnectorInstances[e]||(Pe.analyticsConnectorInstances[e]=new Ie),Pe.analyticsConnectorInstances[e]}}var Ae=function(e){return Ie.getInstance(ae(e))},Ce=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ae().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=Ae(e.instanceName).identityStore),[2]})})},e}(),_e=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Oe=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},Re=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},De=function(){var e,t=B();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=Le(n[0]),i=Le(n[1]);return i?(e[r]=i,e):e},{}):{}},Le=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Ne="AMP_PAGE_VIEW",Me=Symbol.for("@amplitude/page-view-state"),je=function(e){return e||""},Ue=function(){return B()},qe=function(e){var t;void 0===e&&(e=Ue());try{var n=null===(t=null==e?void 0:e.sessionStorage)||void 0===t?void 0:t.getItem(Ne);if(!n)return;var r=JSON.parse(n);if(!r||"object"!=typeof r)return;return r}catch(e){return}},Fe=function(e,t,n){var r;try{var i=e.sessionStorage;if(!i)return;var a=function(e){var t,n,r={};if(!e||"object"!=typeof e)return r;try{for(var i=c(Object.entries(e)),o=i.next();!o.done;o=i.next()){var a=l(o.value,2),s=a[0],u=a[1];"string"==typeof u&&(r[s]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(null===(r=qe(e))||void 0===r?void 0:r.byApiKey),s=je(t);s&&(a[s]=n),i.setItem(Ne,JSON.stringify(o({pageViewId:n},Object.keys(a).length>0?{byApiKey:a}:{})))}catch(e){}},Be=function(e,t){var n,r=Ue();if(r){var i=je(e),o=null!==(n=r[Me])&&void 0!==n?n:{byApiKey:{}},a=o.byApiKey[i];if(a&&a.href===t)return Fe(r,e,a.pageViewId),a.pageViewId;var s=H();return o.byApiKey[i]={pageViewId:s,href:t},r[Me]=o,Fe(r,e,s),s}},Ve=function(e){var t,n,r=null===(n=null===(t=function(){var e;return null===(e=Ue())||void 0===e?void 0:e[Me]}())||void 0===t?void 0:t.byApiKey[je(e)])||void 0===n?void 0:n.pageViewId;return r||function(e){var t=qe();if(t){var n=je(e);if(n&&t.byApiKey&&"object"==typeof t.byApiKey){var r=t.byApiKey[n];return"string"==typeof r?r:void 0}return"string"==typeof t.pageViewId?t.pageViewId:void 0}}(e)},He="[Amplitude] SDK Initialization Offset",ze=Symbol.for("@amplitude/sdk-initialization-offset"),Ke=function(e){var t=B();if(!t)return 0;var n=t[ze];n||(n={byApiKey:{}},t[ze]=n);var r=function(e){return e||""}(e),i=n.byApiKey[r];if("number"==typeof i)return i;var o=We(t);return n.byApiKey[r]=o,o},We=function(e){var t,n;try{var r=null===(n=null===(t=e.performance)||void 0===t?void 0:t.now)||void 0===n?void 0:n.call(t);return"number"==typeof r&&Number.isFinite(r)?Math.max(0,Math.floor(r)):0}catch(e){return 0}},Ye=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},$e=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Ge=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Je=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Xe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return u(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 u(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),Qe=function(){function e(e,t){void 0===t&&(t={}),this.options=o({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return u(this,function(s){switch(s.label){case 0:return t="AMP_TEST",n=o({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&(null===(n=a.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);null===(r=a.config.diagnosticsClient)||void 0===r||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 u(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=Ze(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},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,o,a,s,l,d,f,v;return u(this,function(u){switch(u.label){case 0:r=B(),i=r,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(a=u.sent()){a.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:a.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(s=c(a),l=s.next();!l.done;l=s.next())if(d=l.value,et(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{l&&!l.done&&(v=s.return)&&v.call(s)}finally{if(f)throw f.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=B(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),a=void 0,s=this.config.duplicateResolverFn;if("function"==typeof s&&o.length>1&&(a=o.find(function(t){var n;try{var i=s(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),a||(a=o[0]),a)return a.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=B();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=null!==t?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),a=s}var u="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=u}catch(t){var c=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(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 u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=B();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Ze=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},et=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()},tt=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},nt=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),rt="tags",it="counters",ot="histograms",at="events",st="internal",ut="last_flush_timestamp",ct=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=B())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.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(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(rt)||e.createObjectStore(rt,{keyPath:"key"}),e.objectStoreNames.contains(it)||e.createObjectStore(it,{keyPath:"key"}),e.objectStoreNames.contains(ot)||e.createObjectStore(ot,{keyPath:"key"}),e.objectStoreNames.contains(at))||e.createObjectStore(at,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(st)||e.createObjectStore(st,{keyPath:"key"})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([rt],"readwrite"),r=n.objectStore(rt),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}})})];case 2:return i=a.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,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([it],"readwrite"),r=n.objectStore(it),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return i=a.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,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([ot],"readwrite"),r=n.objectStore(ot),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return i=a.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,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([at],"readwrite"),r=n.objectStore(at),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([st],"readwrite"),i=r.objectStore(st),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([st],"readonly"),r=n.objectStore(st),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.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 u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(ut)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(ut,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),t=e.transaction([rt,it,ot,at],"readwrite"),[4,Promise.all([this.getAllFromStore(t,rt),this.getAllFromStore(t,it),this.getAllFromStore(t,ot),this.getAllFromStore(t,at)])];case 2:return n=l.apply(void 0,[u.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,it),this.clearTable(t,ot),this.clearTable(t,at)])];case 3:return u.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=u.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(new Error("Failed to get all from ".concat(t)))}})},e}(),lt="__AMPLITUDE_SCRIPT_URL__",dt=function(){var e=B();if(!e)return[];var t=e[lt];return Array.isArray(t)?t:"string"==typeof t?[t]:[]},ft=function(e){var t,n,r=dt();if(0!==r.length)try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},vt=function(e){var t,n;try{var r=new URL(e,null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.origin);return r.origin+r.pathname}catch(e){return}},pt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},ht=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},gt=3e5,mt=1e4,yt=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=o({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Ge(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:ct.isSupported()?this.storage=new ct(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=B();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",o({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=ft({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=pt(i),a=ft({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:ht(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=mt?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=mt?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=mt)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},gt))},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=o({},this.inMemoryTags),t=o({},this.inMemoryCounters),n=o({},this.inMemoryHistograms),r=d([],l(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,o,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),a={},n.forEach(function(e){a[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}}),c=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(a).length&&0===Object.keys(s).length&&0===c.length?[2]:(l={tags:o,histogram:s,counters:a,events:c},this.fetch(l),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!B())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(gt),[2]):(n=e-t)>=gt?(this._flush(),[2]):(this._setFlushTimer(gt-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=Ge(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),bt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S;if("object"!=typeof e)return null;var k=e.code||0,T=this.buildStatus(k);switch(T){case j.Success:return{status:T,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case j.Invalid:return{status:T,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case j.PayloadTooLarge:return{status:T,statusCode:k,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case j.RateLimit:return{status:T,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case j.Timeout:default:return{status:T,statusCode:k}}},e.prototype.buildStatus=function(e){return fe(e)?j.Success:429===e?j.RateLimit:413===e?j.PayloadTooLarge:408===e?j.Timeout:e>=400&&e<500?j.Invalid:e>=500?j.Failed:j.Unknown},e}();function wt(){return"undefined"!=typeof CompressionStream}function Et(e){return s(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))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 St=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(X(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){if(!this.isSupported)return Promise.resolve(!1);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}();var kt=401,Tt=403,xt=429,Pt=function(){function e(t,n,r,i,o,a,s){void 0===r&&(r="US"),void 0===a&&(a=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=a,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=s||new St(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=H(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,function(){var n,r,i,o,a,s,c=this;return u(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,l,d,f,v,p,h;return u(this,function(u){switch(u.label){case 0:i=!0,a=new AbortController,s=setTimeout(function(){return a.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),l=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(g=o.customFetch({url:l,method:"GET",headers:d,signal:a.signal}),m=a.signal,new Promise(function(e,t){var n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),g.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return v=u.sent(),[3,5];case 3:return[4,fetch(l,{method:"GET",headers:d,signal:a.signal})];case 4:v=u.sent(),u.label=5;case 5:return(f=v).ok||f.status>=200&&f.status<300?[3,7]:[4,f.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(f.status,": ").concat(p)),f.status===kt||f.status===Tt?(o.logger.error("Remote config client fetch failed with ".concat(f.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==xt&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(h=u.sent())instanceof Error&&"AbortError"===h.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),h),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,c.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var g,m})},o=this,a=0,l.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=l.sent()))return[2,s.value];if("break"===s)return[3,4];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),It=B(),At=null==It?void 0:It.console,Ct={},_t={},Ot=!1;var Rt,Dt={addListener:function(e,t){var n,r=(n=e,!!At&&"function"==typeof At[n]&&(_t[n]||(_t[n]=At[n],At[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(Ct[n]&&!Ot){Ot=!0;var r=Ct[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return Ot=!1,_t[n].apply(At,e)}),!0));if(!r)return new Error("Console override failed");Ct[e]?Ct[e].push(t):Ct[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(Ct)),i=r.next();!i.done;i=r.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(_t)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(At[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}_t={},Ct={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Rt||(Rt={}));var Lt=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Nt="data-amp-track-",Mt=["div","span","h1","h2","h3","h4","h5","h6"],jt=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Ut=jt,qt=jt,Ft=["*"];function Bt(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Vt(e,t,n){e&&Ht({json:e,allowlist:t.map(zt),excludelist:n.map(zt),ancestors:[]})}function Ht(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,u=e.parentObject,f=e.targetKey;i||(i=r);var v=Object.keys(i);try{for(var p=c(v),h=p.next();!h.done;h=p.next()){var g=h.value,m=d(d([],l(s),!1),[g],!1);Bt(i[g])?Wt(m,o)&&!Wt(m,a)||delete i[g]:Ht({json:r,targetObject:i[g],allowlist:o,excludelist:a,ancestors:m,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&u&&f&&delete u[f]}function zt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Kt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Kt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Kt(e,t,n+1,r+1)}function Wt(e,t){return t.some(function(t){return Kt(e,t)})}var Yt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=l(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),u=s[0],d=s[1];i[u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return tn(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=B();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=Gt(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Zt(this.body,e,t)]})})},e}(),$t=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),tn(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Gt(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Zt(this.body,e,t)]})})},e}();function Gt(e,t){var n,r,i,o=B(),a=null==o?void 0:o.TextEncoder;if(a&&null!=e){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(s=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var u=e,d=0,f=0;try{for(var v=c(u.entries()),p=v.next();!p.done;p=v.next()){var h=l(p.value,2),g=h[0],m=h[1];if(d+=g.length,"string"==typeof m)d+=(new a).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}i=d}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(s=e);return i}}var Jt,Xt=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),tn(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Zt(n.sent(),e,t)]}})})},e}(),Qt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split(": "),2),u=s[0],d=s[1];u&&d&&(r[u]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return tn(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){var n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Vt(n,e,t),[2,n]):[2,null]})})},e}();function Zt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Vt(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Jt||(Jt={}));var en="[REDACTED]",tn=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?Jt.REMOVE:a,u=d([],l(D),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===Jt.REDACT&&(f[t]=en):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===Jt.REDACT&&(f[t]=en)};try{for(var p=c(Object.keys(e)),h=p.next();!h.done;h=p.next()){v(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return f},nn=function(){function e(e,t,n,r,i,o,a,s,u,c,l){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=u,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(d([],l(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(d([],l(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=l(e,2);return t[0],void 0!==t[1]}))},e}();var rn=function(e,t){void 0===t&&(t=H()),this.callback=e,this.id=t};function on(e){try{e()}catch(e){}}var an=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=B();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=B();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,u,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,p=null===(l=null===(c=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&v&&p&&this.observeXhr(f,v,p);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),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){on(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var u,c,l,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var v=Math.floor(performance.now()-a),p=Math.floor(o+v),h=new nn(e,d,o,o,u,n,c,v,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,a,s=this;return u(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){on(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Yt(r):void 0,i?new Xt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){on(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&on(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,a=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=l(n,2),s=i[0],u=i[1];try{this.$$AmplitudeAnalyticsEvent=o({method:s,url:null===(e=null==u?void 0:u.toString)||void 0===e?void 0:e.call(u),headers:{}},a.getTimestamps())}catch(e){on(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,a),s=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new Qt(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,c=new $t(s,r);u.status=i.status,a.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(e){on(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){on(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),sn=new an,un=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,o(o(o(o({},O),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=De();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=De();return(e={})[w]=t[w],e[E]=t[E],e[S]=t[S],e[k]=t[k],e[T]=t[T],e[x]=t[x],e[P]=t[P],e[I]=t[I],e[A]=t[A],e[C]=t[C],e[_]=t[_],e},e}(),cn="data-amp-mask",ln="*****",dn=/\b(?:\d[ -]*?){13,16}\b/,fn=/(\d{3}-?\d{2}-?\d{4})/g,vn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,pn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(dn,ln)).replace(fn,ln)).replace(vn,ln);try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,ln)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},hn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(cn)?ln:e?e(document.title):document.title},gn={};Object.defineProperty(gn,"__esModule",{value:!0}),gn.Observable=void 0;const mn=e=>Boolean(Symbol[e]),yn=e=>mn(e)?Symbol[e]:"@@"+e,bn=yn("iterator"),wn=yn("observable"),En=yn("species");function Sn(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function kn(e){let t=e.constructor;return void 0!==t&&(t=t[En],null===t&&(t=void 0)),void 0!==t?t:On}function Tn(e){Tn.log?Tn.log(e):setTimeout(()=>{throw e})}function xn(e){Promise.resolve().then(()=>{try{e()}catch(e){Tn(e)}})}function Pn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=Sn(t,"unsubscribe");e&&e.call(t)}}catch(e){Tn(e)}}function In(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function An(e,t,n){e._state="running";let r=e._observer;try{let i=Sn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(In(e),!i)throw n;i.call(r,n);break;case"complete":In(e),i&&i.call(r)}}catch(e){Tn(e)}"closed"===e._state?Pn(e):"running"===e._state&&(e._state="ready")}function Cn(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void xn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(An(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void An(e,t,n);e._queue.push({type:t,value:n})}}class _n{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){Cn(n,"next",e)},error(e){Cn(n,"error",e)},complete(){Cn(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(In(this),Pn(this))}}class On{constructor(e){if(!(this instanceof On))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new _n(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(kn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(kn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=kn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new 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=kn(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=kn(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 a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[wn](){return this}static from(e){let t="function"==typeof this?this:On;if(null==e)throw new TypeError(e+" is not an object");let n=Sn(e,wn);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof On}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(mn("iterator")&&(n=Sn(e,bn),n))return new t(t=>{xn(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{xn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:On)(t=>{xn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[En](){return this}}gn.Observable=On,Object.defineProperty(On,Symbol("extensions"),{value:{symbol:wn,hostReportError:Tn},configurable:!0});var Rn=gn.Observable;function Dn(e,t){return new Rn(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 Ln(e,t){return new Rn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o})}function Nn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new Rn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=c(t),s=a.next();!s.done;s=a.next()){var u=s.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var Mn,jn="https://app.amplitude.com",Un={US:jn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var qn="__AMPLITUDE_MESSENGER_INSTANCE__",Fn="__AMPLITUDE_MESSENGER__",Bn=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?jn:t;this[Mn]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var s=c(a),u=s.next();!u.done;u=s.next()){t(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.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 u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===jn&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var s=e.data,u=null==s?void 0:s.action;if(u)if("id"in s&&s.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(s);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(s.data);else{var l=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];l.push(s.data),r.pendingMessages.set(u,l)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=B();(null==e?void 0:e[Fn])===this&&delete e[Fn]},e}();function Vn(e){var t,n=B(),r=null==n?void 0:n[Fn];if("object"==typeof(t=r)&&null!==t&&qn in t&&!0===t[qn])return r;var i=new Bn(e);return n&&(n[Fn]=i),i}Mn=qn;var Hn=["desktop","tablet","mobile"],zn="__AMPLITUDE_BACKGROUND_CAPTURE__";function Kn(e,t){var n,r=e;if(!0!==r[zn]){r[zn]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",a=null,s=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){var n,r;null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Initializing background capture (external script)");var u=new URL(i,e.endpoint).toString(),c=t&&"object"==typeof t?function(e){if("string"==typeof e)return Hn.includes(e)?e:void 0}(t.deviceMode):void 0;e.loadScriptOnce(u).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),a=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,o({messenger:e,onBackgroundCapture:s},void 0!==c?{initialDeviceMode:c}:{})),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a),a=null})}}var Wn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Yn(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 $n(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,start_time:n,last_position:n,percent_completed:Yn(n,r)},void 0!==t?{stop_reason:t}:{})}function Gn(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 Jn(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,s,c,d;return u(this,function(u){switch(u.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=l.apply(void 0,[u.sent(),2]),a=i[0],s=i[1],c={},"mux"===n){d=void 0;try{d=new URL(t.getAttribute("src")),c.mux_video_title=d.searchParams.get("metadata-video-title"),c.mux_video_id=d.searchParams.get("metadata-video-id"),c.mux_playback_id=d.pathname.split("/").pop()}catch(e){}}return[2,o(o({duration:a,start_time:s,last_position:s,percent_completed:Yn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function Xn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Jn(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'play' handler: ".concat(e))})};e.on("play",a),r.push(function(){return e.off("play",a)});var c=function(){Jn(e,i,n,"paused").then(function(e){t.onPause(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(e))})};e.on("pause",c),r.push(function(){return e.off("pause",c)});var l=function(){Jn(e,i,n,"ended").then(function(e){t.onEnded(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(e))})};e.on("ended",l),r.push(function(){return e.off("ended",l)});var d=function(){o=!0,Jn(e,i,n,"seeking").then(function(e){t.onSeeking(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(e))})};e.on("seeking",d),r.push(function(){return e.off("seeking",d)});var f=function(){o=!1,Jn(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(e))})};e.on("seeked",f),r.push(function(){return e.off("seeked",f)});var v=function(){(function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return[2,{currentTime:t.sent()}]}})})})(e).then(function(e){var n={position:e.currentTime,isSeeking:o};t.onTimeUpdate(n)}).catch(function(e){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(e))})};e.on("timeupdate",v),r.push(function(){return e.off("timeupdate",v)})};return e.on("ready",i),function(){e.off("ready",i),r.forEach(function(e){return e()})}}var Qn=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(e){a.updatePlaybackState("playing",e)},onPause:function(e){a.updatePlaybackState("paused",e)},onEnded:function(e){a.updatePlaybackState("ended",e)},onSeeking:function(){var e=o(o({},a.state),{isSeeking:!0});a.updateState(e)},onSeeked:function(e){var t=o(o({},a.state),{isSeeking:!1,position:e.last_position});a.updateState(t)},onError:function(e){a.updateStateWithError(e)},onTimeUpdate:function(e){a.updateTime(e)}},this.onStateChange=n,this.untrack=i?Xn(t,this.handler,r):function(e,t,n){var r=function(){var r=o(o({},$n(e)),"mux"===n?Gn(e):{});t.onPlay(r)};e.addEventListener("play",r);var i=function(){var r=o(o({},$n(e,"paused")),"mux"===n?Gn(e):{});t.onPause(r)};e.addEventListener("pause",i);var a=function(){var r=o(o({},$n(e,"ended")),"mux"===n?Gn(e):{});t.onEnded(r)};e.addEventListener("ended",a);var s=function(){var r=o(o({},$n(e,"seeking")),"mux"===n?Gn(e):{});t.onSeeking(r)};e.addEventListener("seeking",s);var u=function(){var r=o(o({},$n(e)),"mux"===n?Gn(e):{});t.onSeeked(r)};e.addEventListener("seeked",u);var c=function(){var n=e,r={position:e.currentTime,isSeeking:!!n.seeking};t.onTimeUpdate(r)};return e.addEventListener("timeupdate",c),function(){e.removeEventListener("play",r),e.removeEventListener("pause",i),e.removeEventListener("ended",a),e.removeEventListener("seeking",s),e.removeEventListener("seeked",u),e.removeEventListener("timeupdate",c)}}(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch(e){}},e.prototype.updateStateWithError=function(e){var t=this.state,n=o(o({},t),{playbackState:"error",errorMessage:e});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t){var n=o(o({},this.state),{playbackState:e,lastEvent:t,position:t.last_position});this.updateState(n)},e.prototype.updateTime=function(e){var t,n;if(this.state.lastEvent&&"playing"===this.state.playbackState){var r=e.isSeeking||this.state.isSeeking,i=null!==(t=this.state.position)&&void 0!==t?t:0,a=e.position;if(r)this.state=o(o({},this.state),{position:a});else{var s=a-i,u=o(o({},this.state),{position:a,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+s});this.updateState(u)}}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.untrack()},e}();function Zn(e,t,n){var r,i,o=[];try{for(var a=c(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(e){n.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function er(e){var t,n,r,i,o,a,s,u,f,v,p,h,g;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var m=Object.keys(e);try{for(var y=c(m),b=y.next();!b.done;b=y.next()){var w=b.value;try{var E=e[w];"boolean"==typeof(null==E?void 0:E.enabled)&&(E.enabled?(delete E.enabled,0===Object.keys(E).length&&(e[w]=!0)):e[w]=!1),er(E)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}try{if(null===(f=null===(u=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===u?void 0:u.captureRules)||void 0===f?void 0:f.length)try{for(var S=c(e.autocapture.networkTracking.captureRules),k=S.next();!k.done;k=S.next()){var T=k.value;try{for(var x=(o=void 0,c(["responseHeaders","requestHeaders"])),P=x.next();!P.done;P=x.next()){var I=P.value,A=null!==(v=T[I])&&void 0!==v?v:{},C=A.captureSafeHeaders,_=A.allowlist;(C||_)&&(void 0===_||Array.isArray(_)?T[I]=d(d([],l(C?R:[]),!1),l(null!=_?_:[]),!1):delete T[I])}}catch(e){o={error:e}}finally{try{P&&!P.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}}catch(e){}void 0!==(null===(p=e.autocapture)||void 0===p?void 0:p.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var O=null===(h=e.autocapture)||void 0===h?void 0:h.frustrationInteractions;O&&(O.rageClick&&(O.rageClicks=O.rageClick,delete O.rageClick),O.deadClick&&(O.deadClicks=O.deadClick,delete O.deadClick),O.errorClick&&(O.errorClicks=O.errorClick,delete O.errorClick));try{var D=null===(g=e.autocapture)||void 0===g?void 0:g.elementInteractions;if(D&&"object"==typeof D&&(!0===D.viewportContentUpdated&&(D.viewportContentUpdated={}),!1===D.viewportContentUpdated&&(D.viewportContentUpdated={enabled:!1}),void 0!==D.exposureDuration)){var L=D.viewportContentUpdated;void 0===L?D.viewportContentUpdated={exposureDuration:D.exposureDuration}:"object"==typeof L&&void 0===L.exposureDuration&&!1!==L.enabled&&(L.exposureDuration=D.exposureDuration),delete D.exposureDuration}}catch(e){}}}function tr(e){var t;if(e)try{var n=null===(t=B())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,u=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:a,fragment:r,href:e,hrefWithoutQueryOrHash:s,host:null!==(t=null==u?void 0:u[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function nr(e){return{event_type:"[Amplitude] Network Request",event_properties:o(o(o({"[Amplitude] URL":e.url.hrefWithoutQueryOrHash,"[Amplitude] URL Query":e.url.query,"[Amplitude] URL Fragment":e.url.fragment,"[Amplitude] Request Method":e.method,"[Amplitude] Status Code":e.statusCode,"[Amplitude] Start Time":e.startTime,"[Amplitude] Completion Time":e.completionTime,"[Amplitude] Duration":e.duration,"[Amplitude] Request Body Size":e.requestBodySize,"[Amplitude] Response Body Size":e.responseBodySize,"[Amplitude] Request Type":e.requestType,"[Amplitude] Request Headers":e.requestHeaders,"[Amplitude] Response Headers":e.responseHeaders},"requestBody"in e&&{"[Amplitude] Request Body":e.requestBody}),"responseBody"in e&&{"[Amplitude] Response Body":e.responseBody}),e.error&&{"[Amplitude] Error Code":e.error.code,"[Amplitude] Error Message":e.error.message})}}var rr=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=B();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},ir=function(e){return rr(e,"attribution")},or=function(e){return rr(e,"formInteractions")},ar=function(e){return rr(e,"pageViews")},sr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},ur=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},cr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},lr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},dr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},fr=function(e){if(ur(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},vr=function(e){if(lr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},pr=function(e){if(sr(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),o(o({},t),{captureRules:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),a=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),o(o({},e),{hosts:void 0})}return e}))})}var n,r},hr=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return ar(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}};var gr="2.49.3",mr="amplitude-ts-sdk-script",yr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(mr,"/").concat(gr),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a;return u(this,function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,a=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Re()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:H(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:a,library:this.library,user_agent:this.userAgent})]})})},e}(),br=function(e){var t;void 0===e&&(e={});var n,r,i=B(),a=void 0,c=!1,l=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,v=void 0===f?"[Amplitude] Page Viewed":f,p=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},h=function(e){return s(void 0,void 0,void 0,function(){var t,r,i,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return t=Er(),r=Sr(),i=Ke(n.apiKey),a=p("undefined"!=typeof location&&location.href||""),c={event_type:v},s=[{}],[4,kr()];case 1:return[2,(c.event_properties=o.apply(void 0,[o.apply(void 0,s.concat([u.sent()])),(l={"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":a,"[Amplitude] Page Path":"undefined"!=typeof location&&p(location.pathname)||"","[Amplitude] Page Title":hn(pn),"[Amplitude] Page URL":a.split("?")[0],"[Amplitude] Min Page Y":t,"[Amplitude] Viewport Width":r},l[He]=i,l["[Amplitude] Page View ID"]=e,l)]),c)]}})})},g=function(){return void 0===l||"function"==typeof l&&l()},m="undefined"!=typeof location?location.href:null,y=function(){s(void 0,void 0,void 0,function(){var e,i,o,s,c;return u(this,function(u){switch(u.label){case 0:return e=location.href,i=xr(d,e,m||"")&&g(),m=e,i?(o=void 0,r&&(o=Be(n.apiKey,wr())),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return c=(s=t).track,[4,h(o)];case 2:c.apply(s,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},b={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,l,d;return u(this,function(u){switch(u.label){case 0:if(t=o,n=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),c=!0,Ke(n.apiKey),i){try{r=new nt(i.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",y),["pushState","replaceState"].forEach(function(e){i.history[e]=new Proxy(i.history[e],{apply:function(t,n,r){var i=location.href,o=t.apply(n,r);return!c||"pushState"!==e&&location.href===i||y(),o}})})}return g()?(a.log("Tracking page view event"),s=void 0,r&&(s=Be(n.apiKey,wr())),d=(l=t).track,[4,h(s)]):[3,2];case 1:d.apply(l,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,i;return u(this,function(s){switch(s.label){case 0:return"attribution"===l&&Tr(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=Ve(n.apiKey)),[4,h(t)]):[3,2];case 1:i=s.sent(),e.event_type=i.event_type,e.event_properties=o(o({},e.event_properties),i.event_properties),s.label=2;case 2:return n&&e.event_type===v&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",y),c=!1),[2]})})}};return b},wr=function(){return"undefined"!=typeof location&&location.href||""},Er=function(){var e,t,n=B();if(!n)return 0;var r=null!==(t=null!==(e=n.scrollY)&&void 0!==e?e:n.pageYOffset)&&void 0!==t?t:0;return Math.floor(r)},Sr=function(){var e,t=B();return t&&null!==(e=t.innerWidth)&&void 0!==e?e:0},kr=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Je,[4,(new un).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Tr=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[r.SET]||{},i=t[r.UNSET]||{},o=d(d([],l(Object.keys(n)),!1),l(Object.keys(i)),!1);return Object.keys(O).every(function(e){return o.includes(e)})}return!1},xr=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},Pr="[Amplitude]",Ir="".concat(Pr," Form Started"),Ar="".concat(Pr," Form Submitted"),Cr="".concat(Pr," File Downloaded"),_r="session_start",Or="session_end",Rr="".concat(Pr," File Extension"),Dr="".concat(Pr," File Name"),Lr="".concat(Pr," Link ID"),Nr="".concat(Pr," Link Text"),Mr="".concat(Pr," Link URL"),jr="".concat(Pr," Form ID"),Ur="".concat(Pr," Form Name"),qr="".concat(Pr," Form Destination"),Fr="cookie",Br=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return t=function(e){if(or(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,a=function(e){if(!o.has(e)){o.add(e);var a=!1;r(e,"change",function(){var t,n=Hr(e);a||i.track(Ir,((t={})[jr]=Vr(e.id),t[Ur]=Vr(e.name),t[qr]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=Hr(e);if(a||i.track(Ir,((o={})[jr]=Vr(e.id),o[Ur]=Vr(e.name),o[qr]=u,o)),a=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(Ar,((s={})[jr]=Vr(e.id),s[Ur]=Vr(e.name),s[qr]=u,s)),a=!1})}};Array.from(document.getElementsByTagName("form")).forEach(a),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&a(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(a)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(a=B())?a.addEventListener("load",o):n.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 u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},Vr=function(e){if("string"==typeof e)return e},Hr=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},zr=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,o;return u(this,function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;a&&r.track(Cr,((t={})[Rr]=a,t[Dr]=n.pathname,t[Lr]=e.id,t[Nr]=e.text,t[Mr]=e.href,t))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=B())?o.addEventListener("load",i):n.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 u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}};function Kr(e,t){var n,r;if(e){er(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",X(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var a=o({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){a.elementInteractions=o({},i.autocapture.elementInteractions);var s=a.elementInteractions,u=null!==(r=s.pageUrlAllowlist)&&void 0!==r?r:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Zn(u,l,t.loggerProvider),delete s.pageUrlAllowlistRegex}var d=function(e,t){var n,r,i,a,s;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var u=o({},e),l=null!==(a=u.captureRules)&&void 0!==a?a:[];try{for(var d=c(l),f=d.next();!f.done;f=d.next()){var v=f.value;v.urls=Zn(null!==(s=v.urls)&&void 0!==s?s:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u}}(i.autocapture.networkTracking,t.loggerProvider);d&&(a.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",X(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var Wr="1.31.3",Yr="[Amplitude] Element Clicked",$r="[Amplitude] Element Tag",Gr="[Amplitude] Element Text",Jr="[Amplitude] Page URL",Xr="[Amplitude] Viewport Height",Qr="[Amplitude] Viewport Width",Zr="[Amplitude] Page View ID",ei="data-amp-mask-attributes",ti="data-amp-internal-shadow";function ni(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function ri(e,t){return t.map(ii).join(" > ")}function ii(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(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}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var oi=":scope > ";function ai(e){var t;return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||null!=e&&11===e.nodeType&&1===(null===(t=e.host)||void 0===t?void 0:t.nodeType)}function si(e){var t,n=e.getRootNode();return ai(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function ui(e,t){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:n=e,r=0,i=0,a.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return a.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return ai(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function ci(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=l(r.pop(),2),a=o[0],s=o[1],u=a.shadowRoot;if(u&&s+1<=t){n.push({root:u,depth:s+1});for(var c=u.children,d=0;d<c.length;d++)r.push([c[d],s+1])}var f=a.children;for(d=0;d<f.length;d++)r.push([f[d],s])}return n}function li(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=si(r);n.push({root:o,target:r});var a=r.getRootNode();if(!ai(a))break;r=a.host}var s=n.length-1,u=!1,c=n;return s>t&&(c=n.slice(s-t),u=!0),{segments:c.reverse(),truncated:u}}function di(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&ai(i)?"".concat(n,":nth-of-type(").concat(fi(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(fi(e,r.children),")")}function fi(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var vi={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function pi(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var a=n.charCodeAt(o);0!==a?a>=1&&a<=31||127===a||0===o&&a>=48&&a<=57||1===o&&a>=48&&a<=57&&45===n.charCodeAt(0)?i+="\\".concat(a.toString(16)," "):i+=0!==o||1!==r||45!==a?a>=128||45===a||95===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function hi(e){return pi(e)}var gi={name:"stableId",try:function(e,t){var n=ni(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(hi(n))}},mi=!1,yi=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:d([],l([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:d([],l([/^(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-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:mi,maxShadowDomDepth:1});function bi(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:mi,maxShadowDomDepth:Ei(e.maxShadowDomDepth)})}function wi(e,t){if(!e)return Si();var n,r=Si();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Ei(e.maxShadowDomDepth),bi(r)}function Ei(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Si(){return{enabled:yi.enabled,explicitTrackingAttribute:yi.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(yi.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(yi.unstableClassPatterns),!1),maxAncestorWalkDepth:yi.maxAncestorWalkDepth,shadowDomEnabled:yi.shadowDomEnabled,maxShadowDomDepth:yi.maxShadowDomDepth}}var ki=[vi,gi];function Ti(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=bi(t),l=null!==(o=n.strategies)&&void 0!==o?o:ki,d=null!==(s=null!==(a=n.scope)&&void 0!==a?a:e.ownerDocument)&&void 0!==s?s:document,f={scope:d,config:u},v=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,u.maxAncestorWalkDepth);try{for(var p=c(l),h=p.next();!h.done;h=p.next())for(var g=h.value,m=0;m<v.length;m++){var y=v[m],b=g.try(y,f);if(null!==b)if(0!==m){var w=ri(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(xi(d,E,e,g.name,n.logger))return E}else if(xi(d,b,e,g.name,n.logger))return b}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function xi(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var a=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return 1===o.length&&o[0]===n}function Pi(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var Ii=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Ai=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new Ii(_i(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new Ii(a,!0)}var s=e.tagName.toLowerCase();if(o)return new Ii(s+_i(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new Ii(s,!0);for(var l=Ci(e),d=!1,f=!1,v=-1,p=-1,h=u.children,g=0;h&&(-1===v||!f)&&g<h.length;++g){var m=h[g];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!f&&m.tagName.toLowerCase()===s){d=!0;var y=new Set(l);if(y.size)for(var b=Ci(m),w=0;w<b.length;++w){var E=b[w];if(y.has(E)&&(y.delete(E),!y.size)){f=!0;break}}else f=!0}}else v=p}var S=s;if(n&&"input"===s.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+pi(e.getAttribute("type")||"")+"]"),f)S+=":nth-child("+String(v+1)+")";else if(d)try{for(var k=c(l),T=k.next();!T.done;T=k.next()){S+="."+pi(T.value.slice(1))}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}return new Ii(S,!1)},Ci=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},_i=function(e){return"#"+pi(e)};function Oi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Ai(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Ri(e,t){void 0===t&&(t={});var n=bi(e),r=new Set,i=t.logger,o=function(e){return Oi(e,i)},a=function(e,r){var o;return null!==(o=Ti(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=bi(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=ai(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=ni(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(hi(p))],l(u),!1).join(" > ");if(Pi(a,h,e))return h}u.unshift(di(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(oi).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&ai(t)?"".concat(oi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var r,u;try{return n.shadowDomEnabled?function(e,t){var r=li(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?a:s):(n.enabled?a:o)(e,null!==(u=null!==(r=t.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==u?u:document)}catch(t){var c=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(c)),Oi(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=bi(e);try{for(var a=c(r),s=a.next();!s.done;s=a.next()){var u=s.value;try{u(n)}catch(e){var l=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(l))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var Di,Li,Ni=Object.freeze({enabled:!1,maxDepth:0}),Mi=function(){var e=Ni,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;try{for(var i=c(d([],l(t),!1)),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},ji=["input","select","textarea"],Ui=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ye(window.location.href,n))&&!!Ye(window.location.href,t)},qi=function(e,t){return function(n,r){var i,o,a=e.shouldTrackEventResolver,s=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!s)return!1;if(a)return a(n,r);if(!Ui(e))return!1;var u=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}if(t){var c=t.some(function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))});if(!c)return!1}switch(s){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},Fi=function(e){if(!(e instanceof HTMLElement))return!1;var t=e.getAttribute("contenteditable");return null!==t&&"false"!==t.toLowerCase()},Bi=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},Vi=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},Hi=function(e,t,n){return void 0===n&&(n=Ni),n.enabled?Ki(e,t,n.maxDepth):zi(e,t)},zi=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:zi(null==e?void 0:e.parentElement,t):null},Ki=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var a=c(ui(e,n)),s=a.next();!s.done;s=a.next()){var u=o(s.value);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return null},Wi=function(e,t,n){return void 0===n&&(n=Ni),n.enabled?$i(e,t,n.maxDepth):Yi(e,t)},Yi=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},$i=function(e,t,n){var r=Yi(e,t),i=e instanceof Document?e.documentElement:e;return i?(ci(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},Gi=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function Ji(e){if(!e)return"";try{var t=new URL(e);return t.search="",$e(t.href)}catch(t){return $e(e)}}function Xi(e){var t,n;return void 0===e&&(e=B()),Ji(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(Li||(Li={}));var Qi="__AMPLITUDE_VISUAL_TAGGING__";var Zi=function(){var e,t,n,r,i=B();return{x:Math.floor(null!==(t=null!==(e=null==i?void 0:i.scrollX)&&void 0!==e?e:null==i?void 0:i.pageXOffset)&&void 0!==t?t:0),y:Math.floor(null!==(r=null!==(n=null==i?void 0:i.scrollY)&&void 0!==n?n:null==i?void 0:i.pageYOffset)&&void 0!==r?r:0)}};var eo=B(),to=function(e){return e.get()},no={childList:!0,attributes:!0,characterData:!0,subtree:!0},ro=function(e){return new Rn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),ai(e)&&i.set(e,t),s.observe(e,no))},a=function(e,t,n){var r=n-t;r<=0||ci(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},s=new MutationObserver(function(n){var r,o;t.next(n);try{var s=to(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!ai(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&a(e,t,s.maxDepth)})};try{for(var l=c(n),d=l.next();!d.done;d=l.next()){u(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){a(u,0,e.maxDepth)})}return function(){null==n||n(),s.disconnect()}}: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()}})},io=function(e){return void 0===e&&(e="click"),new Rn(function(t){var n,r=function(e){t.next(e)};return null===(n=B())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=B())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},oo=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new Rn(function(n){var r=B();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var a=new WeakSet,s=function(e){a.add(e),c.observe(e)},u=function(e){a.has(e)&&!e.isConnected&&(a.delete(e),c.unobserve(e),n.next({target:e,isIntersecting:!1}))},c=new IntersectionObserver(function(e){e.forEach(function(e){e.target.isConnected?n.next(e):u(e.target)})},{root:null,rootMargin:"0px",threshold:0}),l=t.join(","),d=function(e){e instanceof Element&&e.matches(l)&&s(e),e.querySelectorAll(l).forEach(function(e){s(e)})},f=function(e){if(o)try{Wi(e,l,to(o)).forEach(function(e){s(e)})}catch(e){}},v=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&to(o).enabled?Wi(e,l,to(o)):e.querySelectorAll(l)}catch(e){return}Array.from(t).forEach(function(e){c.unobserve(e),s(e)})}};null==i||i(v),v();var p=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&f(r.document)}),h=e.subscribe(function(e){var t=e.event;t.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)d(e);else if(e instanceof Element)if(o&&to(o).enabled){try{e.matches(l)&&s(e)}catch(e){}f(e)}else d(e)})}),t.forEach(function(e){var t=e.removedNodes;null==t||t.forEach(function(e){e instanceof Element&&!e.isConnected&&function(e){for(var t=[e];t.length;){var n=t.pop();u(n);for(var r=0;r<n.children.length;r++)t.push(n.children[r]);var i=n.shadowRoot;if(i)for(r=0;r<i.children.length;r++)t.push(i.children[r])}}(e)})})});return function(){null==i||i(void 0),null==p||p(),h.unsubscribe(),c.disconnect()}})},ao=function(){var e=Ln(new Rn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=o(o({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return eo.addEventListener("error",t),function(){eo.removeEventListener("error",t)}}),new Rn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return eo.addEventListener("unhandledrejection",t),function(){eo.removeEventListener("unhandledrejection",t)}}));return Ln(e,new Rn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Dt.addListener("error",t),function(){Dt.removeListener(t)}}))},so=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},uo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},co=function(e){var t,n,r,i,o=Object.values(uo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var l=(r=void 0,c(u.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,v=uo[f.event_type];v&&o[v].add(u.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},lo=function(e){var t,n,r,i,o=new Map;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var l=(r=void 0,c(u.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(u)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},fo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return uo[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},vo=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=function(e,t){var n,r,i,o,a=new Set;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var l=u.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),v=f.next();!v.done;v=f.next()){var p=v.value;a.add(p)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(fo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=a.value;so(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),po=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ei,cn,ti]),ho=["type"],go=["svg","path","g"],mo=["password","hidden"];function yo(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=Ni),null===e)return null;var l=String(e.tagName).toLowerCase(),d={tag:l},f=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&ai(n)?n.children:[]}(e,n.enabled));f.length&&(d.index=f.indexOf(e),d.indexOfType=f.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();v&&(d.prevSib=String(v));var p=e.getAttribute("id");p&&(d.id=String(p));var h=Array.from(e.classList);h.length&&(d.classes=h);var g={},m=Array.from(e.attributes).filter(function(e){return!po.has(e.name)}),y=!function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t);return!ji.includes(r)&&!Fi(e)}(e);if(!mo.includes(String(e.getAttribute("type")))&&!go.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!ho.includes(E.name)||(t.has(E.name)?g[E.name]=ln:g[E.name]=String(E.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(g).length&&(d.attrs=g),e.shadowRoot&&(d.attrs=o(o({},d.attrs||{}),((a={})[ti]="true",a)),d.shadow=!0),d}function bo(e,t){return void 0===t&&(t=Ni),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(ui(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if("HTML"===s.tagName)break;i.push(s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var wo;var Eo=function(e,t){var n,r,i,a=this;this.setPageViewApiKey=function(e){a.pageViewApiKey=e},this.replaceSensitiveString=function(e){return pn(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o,s=performance.now();if(!e)return[];for(var u=a.getShadowMode(),f=bo(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=Bi(h.getAttribute(ei)),m=p===f.length-1?[]:null!==(r=v.get(f[p+1]))&&void 0!==r?r:new Set,y=new Set(d(d([],l(m),!1),l(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return yo(e,null!==(t=v.get(e))&&void 0!==t?t:new Set,u)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(i))})};try{for(var w=c(o),E=w.next();!E.done;E=w.next())b(E.value)}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var S=performance.now();return null===(i=a.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?a.getText(t):a.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return null===(t=a.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateRemoteConfig=function(e,t){var n;if(null!=e){var r=e.elementSelector,i=null!==(n=e.elementInteractions)&&void 0!==n?n:{};return"boolean"==typeof i.shadowDomEnabled&&(r=o(o({},null!=r?r:{}),{shadowDomEnabled:i.shadowDomEnabled})),"number"==typeof i.maxShadowDomDepth&&(r=o(o({},null!=r?r:{}),{maxShadowDomDepth:i.maxShadowDomDepth})),a.updateSelectorConfig(r,t)}},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var s=wi(e,t),u=a.selectorEngine.getConfig().enabled,c=a.shadowGate.get().enabled,l=a.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?Ni:Object.freeze({enabled:!0,maxDepth:n})}(s));a.selectorEngine.updateConfig(o(o(o({},r?s:a.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),r&&u!==s.enabled&&(null==t||t.debug(s.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!c&&l.enabled&&(null===(n=a.diagnosticsClient)||void 0===n||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return a.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,u,c,d=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=a.getHierarchy(t),p=null===(s=v[0])||void 0===s?void 0:s.attrs,h=a.getNearestLabel(t),g=(u=null!=p?p:{},c=n,Object.entries(u).reduce(function(e,t){var n=l(t,2),r=n[0],i=n[1];if(r.startsWith(c)){var o=r.replace(c,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[$r]=d,r[Gr]=a.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=a.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[Jr]=$e(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=hn(a.replaceSensitiveString),r[Xr]=window.innerHeight,r[Qr]=window.innerWidth,r),y=Ve(a.pageViewApiKey);if(y&&(m[Zr]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=a.replaceSensitiveString(b)}return Vi(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=a.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){var s=a.getShadowMode(),u=function(e,t){var n,r;if(void 0===t&&(t=Ni),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var a=i[0];if(!(a instanceof Element))return null!=a?a:o;var s=li(a,t.maxDepth),u=s.segments;return s.truncated&&u.length>0?u[u.length-1].target:a}(o.event,s);if(i){var c=function(e,t){var n;if("click"!==t||!(e instanceof Element))return!1;var r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=Hi(u,n,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=a.getEventProperties(o.type,l,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?a.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(cn,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=c(o),u=s.next();!u.done;u=s.next()){var l=u.value;l.nodeType!==Node.TEXT_NODE?l instanceof Element&&(l.hasAttribute(cn)||Fi(l)?i+=ln:i+=a.getTextWithMaskedDescendants(l)):i+=l.textContent||""}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=a.getShadowMode();return t.enabled?function(e,t){var n,r;return!!bo(e,t).some(function(e){return e.hasAttribute(cn)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(cn))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(cn,"]"))}(e)},this.getText=function(e){var t=a.hasMaskedAncestor(e),n=function(e){if(Fi(e))return!0;var t=e.closest("[contenteditable]");return!!t&&Fi(t)}(e);if(t||n)return ln;var r="";return r=e.querySelector("[".concat(cn,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(r.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[$r]=i,t[Gr]=a.getText(e),t[Jr]=window.location.href.split("?")[0],t);return Vi(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(wo||(wo=Ri(wi())),wo),this.shadowGate=(Di||(Di=Mi()),Di);var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],u=[];try{for(var f=c(s),v=f.next();!v.done;v=f.next()){var p=v.value;if(u.length>=25)break;if(p instanceof RegExp)u.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{u.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u};function So(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateRemoteConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var ko,To=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function xo(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new WeakMap,s=new Map,u=new Set,c=function(e){var t=s.get(e);void 0!==t&&(clearTimeout(t),s.delete(e))},l=function(e){if(function(e){var t=B(),n=t.document.documentElement.clientHeight||t.innerHeight,r=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,a=Math.max(i.left,0),s=Math.min(i.right,r);if(o<-1||o>n+1||a>=s||i.width<=0)return!1;for(var u=To(e,t.getComputedStyle(e).position);u;){var c=t.getComputedStyle(u),l=c.overflowY&&"visible"!==c.overflowY,d=c.overflowX&&"visible"!==c.overflowX;if(l||d){var f=u.getBoundingClientRect();if(l&&(o<f.top-1||o>f.bottom+1))return!1;if(d&&(a=Math.max(a,f.left))>=(s=Math.min(s,f.right)))return!1}u=To(u,c.position)}return!0}(e)){if(!a.get(e)&&!s.has(e)){var t=setTimeout(function(){s.delete(e),a.set(e,!0);var t=r.getElementPath(e);n(t)},o);s.set(e,t)}}else c(e)},d=t.exposureObservable,f=t.scrollObservable,v=d.subscribe(function(e){var t=e,n=t.target;t.isIntersecting?(u.add(n),l(n)):(u.delete(n),c(n))}),p=f.subscribe(function(){u.forEach(l)}),h=function(){s.forEach(function(e){return clearTimeout(e)}),s.clear(),a=new WeakMap};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(l)}}}function Po(e){var t,n,r,i,o,a=e.mutationObservable,s=e.onRescan,u=e.onFlush,c=e.exposureDuration,l=e.quietMs,d=void 0===l?150:l,f=e.maxWaitMs,v=void 0===f?4e3:f,p=!1,h=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},g=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,h(),g(),s(),r=setTimeout(function(){r=void 0,u()},c+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){h(),g(),p=!1,y(),n=setTimeout(m,v)};return{start:function(){i||(i=a.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,h(),g()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(ko||(ko={}));var Io=function(e,t){var n,r,i,a,f,v,p,h,g,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",Wr);var w=e.dataAttributePrefix,E=void 0===w?Nt:w,S=e.visualTaggingOptions,k=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:Lt,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Mt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var T=!1!==(null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.enabled),x=null!==(p=null!==(v=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==v?v:e.exposureDuration)&&void 0!==p?p:150;e.viewportContentUpdated=o(o({},e.viewportContentUpdated),{exposureDuration:x}),e.pageUrlExcludelist=null===(h=e.pageUrlExcludelist)||void 0===h?void 0:h.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var P,I,A="@amplitude/plugin-autocapture-browser",C=[],_=new Eo(e,t),O=new Set,R=new Set,D=new Set,L=function(){var t,n,r=Nn(io().map(function(t){return _.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=Nn(new Rn(function(t){var n,r=function(n){var r=_.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=B())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=B())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=Nn(new Rn(function(t){var n=function(n){var r=_.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=_.shadowGate,a=Nn(ro(o).map(function(t){return _.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new Rn(function(e){var t,n,r=function(t){e.next(t)};return null===(t=B())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=B())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=B())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=B())||void 0===t||t.removeEventListener("resize",r)}}),u=oo(a,e.cssSelectorAllowlist,function(e){I=e},o);return(t={})[ko.ChangeObservable]=i,t[ko.ClickObservable]=r,t[ko.MutationObservable]=a,t[ko.NavigateObservable]=n,t[ko.ScrollObservable]=s,t[ko.ExposureObservable]=u,t},N=co(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=lo(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),j=function(e,t,n,r){return new vo(e,t,n,r)}(N,M,_,e);return{name:A,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,function(){var r,i,a,s,c,f,v,p,h,g,m,y,b,w,S,U,q,F,V,H,z,K,W,Y,$,G,J,X,Q,Z,ee,te,ne,re,ie,oe,ae,se,ue,ce,le,de,fe;return u(this,function(u){return"undefined"==typeof document||(_.setPageViewApiKey(t.apiKey),Ke(t.apiKey),r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=o(o({},e.pageActions),t),N=co(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=lo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(N,M,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),!0===e.shadowDomEnabled&&("number"!=typeof(i=e.maxShadowDomDepth)&&(i=1),_.updateSelectorConfig({shadowDomEnabled:!0,maxShadowDomDepth:i})),(a=So(t,_))&&C.push({unsubscribe:a}),s=qi(e,e.cssSelectorAllowlist),c=qi(e,e.actionClickAllowlist),f=L(),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(Gi).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(Yr,e.targetElementProperties)})}({allObservables:f,amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),C.push(v),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(Gi).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:f,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _.getEventProperties.apply(_,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),C.push(p),h=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,l=s.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=Hi(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(Gi).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?Ln(u,c):u,f=Ln(l,d),v=null,p=null;return Dn(f,function(e){if(v&&(clearTimeout(v),v=null),"click"===e.type)return p=e,v=setTimeout(function(){v=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(Yr,i("click",e.closestTrackedAncestor)))})}({allObservables:f,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _.getEventProperties.apply(_,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,shouldTrackActionClick:c}),h&&C.push(h),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0,minY:0},r=!0,i=function(){var e=Zi(),t=e.x,i=e.y;n.maxX=t,n.maxY=i,n.minY=i,r=!1};i();var o=t.subscribe(function(){var e=Zi(),t=e.x,i=e.y;if(r)return n.maxX=t,n.maxY=i,n.minY=i,void(r=!1);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,i),n.minY=Math.min(n.minY,i)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0,n.minY=0,r=!0},isAwaitingSeed:function(){return r},seed:function(){return!!r&&(i(),!0)}}}({allObservables:f,amplitude:n}),C.push(g),m=o({},g.getState()),y=function(){g.seed();var e=g.getState();m.maxX=e.maxX,m.maxY=e.maxY,m.minY=e.minY},b=!1,w=!1,S=!1,q={},F=B(),H=function(){var e;g.reset();var t=g.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,D.clear(),O.clear(),R.clear(),null===(e=q.exposure)||void 0===e||e.reset(),null==V||V.reset()},z=function(){b=!0},K=function(e){if(b)return e?void H():void(w=!0);e&&(null==V||V.reset()),e&&r?H():(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,u=e.elementExposedInSentEvents,c=e.exposureTracker,l=e.isPageEnd,d=e.lastScroll,f=e.apiKey,v=o.getState(),p=B(),h=null!==(n=null==p?void 0:p.innerWidth)&&void 0!==n?n:0,g=null!==(r=null==p?void 0:p.innerHeight)&&void 0!==r?r:0,m=Array.from(a).filter(function(e){return!u.has(e)}),y=((t={})[Jr]=Xi(p),t["[Amplitude] Max Page X"]=v.maxX+h,t["[Amplitude] Max Page Y"]=v.maxY+g,t["[Amplitude] Min Page Y"]=v.minY,t[Xr]=g,t[Qr]=h,t[He]=Ke(f),t["[Amplitude] Element Exposed"]=m,t),b=Ve(f);b&&(y[Zr]=b);var w=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,d.minY=e.minY,s.clear(),u.clear(),null==c||c.reset()};0!==m.length||v.maxX!==d.maxX||v.maxY!==d.maxY||v.minY!==d.minY?(null==i||i.track("[Amplitude] Viewport Content Updated",y),d.maxX=v.maxX,d.maxY=v.maxY,d.minY=v.minY,m.forEach(function(e){u.add(e)}),a.clear(),l&&w()):l&&w()}({amplitude:n,scrollTracker:g,currentElementExposed:D,elementExposedForPage:O,elementExposedInSentEvents:R,exposureTracker:q.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},Y=function(){W&&(clearTimeout(W),W=void 0)},$=function(){Y(),W=setTimeout(function(){W=void 0,G()},0)},G=function(){if(Y(),null==U||U.removeEventListener("abort",$),U=void 0,b){b=!1,g.reset(),y();var e=w,t=S;w=!1,S=!1,e&&K(t)}},J=function(){Y(),null==U||U.removeEventListener("abort",$),U=void 0,w=!1,S=!1},X=function(){U&&!U.aborted||G()},Q=function(e){Y(),null==U||U.removeEventListener("abort",$),U=void 0,e&&(e.aborted?G():(U=e,e.addEventListener("abort",$,{once:!0})))},Z=Xi(F),ee=function(e){var t=Xi(F);return t!==Z&&(b&&e&&e.deferScrollBaseline?(J(),H(),Z=t,!0):(Z=t,K(!0),(null==e?void 0:e.deferScrollBaseline)?(z(),!0):(y(),!1)))},te=function(e,t){var n=Xi(F),r=function(e,t){var n;if(void 0===t&&(t=B()),null==e||""===e)return Xi(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return Ji(new URL(e,r).href)}catch(e){return Xi(t)}}(t,F);n!==r?(Z=r,K(!0),e(),y()):e()},ne=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,O,R,D,K)},T&&(q.exposure=xo({allObservables:f,onExposure:ne,dataExtractor:_,exposureDuration:x}),q.exposure&&C.push(q.exposure),V=Po({mutationObservable:f[ko.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==I||I()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),K(!1)},exposureDuration:x}),V.start(),C.push({unsubscribe:function(){null==V||V.stop()}}),re=function(){if(b)return S=!0,w=!0,void G();K(!0)},null==F||F.addEventListener("beforeunload",re),P=function(){null==F||F.removeEventListener("beforeunload",re)},C.push({unsubscribe:function(){return P()}}),(ie=f[ko.NavigateObservable])?(C.push(ie.subscribe(function(e){var t,n,r,i=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(i){var o=Ji(i);if(o===Z)return;return b?(w=!1,S=!1,Z=o,K(!0),void Q(e.event.signal)):(Z=o,K(!0),z(),void Q(e.event.signal))}ee({deferScrollBaseline:!0})&&Q(null===(r=e.event)||void 0===r?void 0:r.signal)})),(oe=window.navigation)&&(oe.addEventListener("navigatesuccess",G),oe.addEventListener("navigateerror",X),C.push({unsubscribe:function(){J(),b=!1,oe.removeEventListener("navigatesuccess",G),oe.removeEventListener("navigateerror",X)}}))):F&&(ae=function(){ee()},F.addEventListener("popstate",ae),se=F.history.pushState,ue=F.history.replaceState,F.history&&se&&(F.history.pushState=new Proxy(se,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),F.history&&ue&&(F.history.replaceState=new Proxy(ue,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),C.push({unsubscribe:function(){F.removeEventListener("popstate",ae),F.history&&se&&(F.history.pushState=se),F.history&&ue&&(F.history.replaceState=ue)}}))),null===(fe=null==t?void 0:t.loggerProvider)||void 0===fe||fe.log("".concat(A," has been successfully added.")),window.opener&&k.enabled&&(ce=e.cssSelectorAllowlist,le=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[Qi]){n[Qi]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;s=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:Wr}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(de=Vn(),{dataExtractor:_,isElementSelectable:qi(e,d(d([],l(ce),!1),l(le),!1)),cssSelectorAllowlist:ce,actionClickAllowlist:le}),Kn(de),de.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Un[t.serverZone]})))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){try{for(e=c(C),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Ao=["mutation","navigate"];function Co(e,t){var n,r,i,o,a=t.event,s=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function _o(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:o({"[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 Oo(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,a=r.selectionObservable,c=[],l={},d=null;function f(e){c=[],l={},e&&(Co(l,e),c.push(e))}var v=Dn(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return u(this,function(n){return Co(l,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||l.isOutOfBounds?(d&&(t=_o(c)),f(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(_o(c))},1e3)}})]:[2,null]})})}),p=null==a?void 0:a.subscribe(function(){f()}),h=v.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var Ro,Do;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Ro||(Ro={})),function(e){e.X="x",e.Y="y"}(Do||(Do={}));function Lo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function No(e){e.changes=[],e.startTime=void 0}function Mo(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var jo=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new Rn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,s=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==s&&clearTimeout(s),No(n),No(i))}return t.subscribe(function(e){null!==s&&clearTimeout(s),function(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()}(e===Do.X?n:i);var t=function(e,t){var n=void 0;if(Lo(e)&&(n=e.startTime),Lo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,s=setTimeout(function(){u(),s=null},o)):u(),Mo(n),Mo(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},Uo=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,s=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new Rn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Ro.DECREASING&&e.next(Do.X),r=Ro.INCREASING):o.x<n.x&&(r===Ro.INCREASING&&e.next(Do.X),r=Ro.DECREASING),o.y>n.y?(i===Ro.DECREASING&&e.next(Do.Y),i=Ro.INCREASING):o.y<n.y&&(i===Ro.INCREASING&&e.next(Do.Y),i=Ro.DECREASING),n=o):n=o})})}({allWindowObservables:r});return jo({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){Ui(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function qo(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Fo=4e3,Bo=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var a=!1!==e.deadClicks&&null!==e.deadClicks,f=!1!==e.rageClicks&&null!==e.rageClicks,v=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(v=!1);var p=qo(e,"rageClicks",Ft,f),h=qo(e,"deadClicks",Ut,a),g=qo(e,"errorClicks",qt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Nt,y=new Eo(e),b=d([],l(new Set(d(d(d([],l(p),!1),l(h),!1),l(g),!1))),!1),w=function(){var e,t,n=function(e){return Nn(io(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=Nn(ao().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=Nn(ro(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Nn(new Rn(function(e){var t=function(t){e.next(o(o({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var u=Nn(new Rn(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),c=Nn(new Rn(function(e){var t=function(t){e.next(t)},n={capture:!0};return eo.document.addEventListener("mousemove",t,n),function(){eo.document.removeEventListener("mousemove",t,n)}}));return(e={})[ko.ClickObservable]=r,e[ko.PointerDownObservable]=i,e[ko.MutationObservable]=s,e[ko.NavigateObservable]=t,e[ko.BrowserErrorObservable]=a,e[ko.SelectionObservable]=u,e[ko.MouseMoveObservable]=c,e};return{name:n,type:"enrichment",setup:function(t,c){return s(void 0,void 0,void 0,function(){var s,l,d,b,E,S,k,T,x,P,I,A;return u(this,function(u){return"undefined"==typeof document||(y.setPageViewApiKey(t.apiKey),s=w(),(l=So(t,y))&&r.push({unsubscribe:l}),f&&(d=qi(e,p),b=Oo({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=qi(e,h),S=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,s=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return Gi(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Li.LEFT_OR_TOUCH_CONTACT}),l=u?Ln(s,u):s,d=Ln(c,l),f=null;return Dn(d,function(e){return f&&Ao.includes(e.type)?(clearTimeout(f),f=null,Promise.resolve(null)):"click"===e.type?f?Promise.resolve(null):new Promise(function(t){f=setTimeout(function(){t(e),f=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:E}),r.push(S)),i&&(k=qi(e,g),T=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,a=n.browserErrorObservable,s=i.filter(function(e){return Gi(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Li.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,l=function(){null!==u&&(clearTimeout(u),u=null),c=null};return Ln(s,a).subscribe(function(e){var n;if("click"===e.type)return l(),c=e,void(u=setTimeout(l,2e3));"error"===e.type&&c&&(t.track("[Amplitude] Error Click",o(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),c.targetElementProperties)),l())})}({amplitude:c,allObservables:s,shouldTrackErrorClick:k}),r.push(T)),v&&(x=void 0,P=void 0,"object"==typeof e.thrashedCursor&&(x=e.thrashedCursor.directionChanges,P=e.thrashedCursor.threshold,x&&x<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(x," is below the minimum of ").concat(5,", setting to ").concat(5)),x=5),P&&P>Fo&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(P," is above the maximum of ").concat(Fo,", setting to ").concat(Fo)),P=Fo)),I=Uo({amplitude:c,options:e,allObservables:s,directionChanges:x,thresholdMs:P}),r.push(I)),null===(A=null==t?void 0:t.loggerProvider)||void 0===A||A.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function Vo(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 Ho(e,t){var n,r=Vo(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],a=i.map(function(e){return e.sourceURL}).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),c=i.map(function(e){return e.invokerType}).filter(Boolean),l=i.map(function(e){return e.invoker}).filter(Boolean);return o(o(o(o(o(o(o({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),u.length>0&&{"[Amplitude] Main Thread Block Script Positions":u}),c.length>0&&{"[Amplitude] Main Thread Block Invoker Types":c}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}function zo(e,t){var n,r=Vo(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];return o(o({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function Ko(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var s=o.value;a.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;a.length>0&&a[0].startTime<u;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,s;try{for(var u=c(e.getEntries()),l=u.next();!l.done;l=u.next()){var d=l.value;if(!Ui(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?Ho(d,a):zo(d,a);t.track("[Amplitude] Main Thread Block",f)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),s.disconnect()}}}var Wo,Yo,$o=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a,s,c;return u(this,function(u){return"undefined"==typeof document||(r&&(a=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(a=e.mainThreadBlock.durationThreshold),s=Ko({amplitude:o,options:e,durationThreshold:a}),n.push(s)),null===(c=null==i?void 0:i.loggerProvider)||void 0===c||c.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},Go="[Amplitude] Network Request",Jo="500-599";function Xo(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function Qo(e,t){var n,r,i=t.split(",");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split("-").map(Number),2),u=s[0],d=s[1];if(e===u&&void 0===d)return!0;if(e>=u&&e<=d)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function Zo(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],l(R),!1);if(void 0===e){return}}}function ea(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function ta(e,t){var n;void 0===t&&(t={});var r=tr(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(Xo(o,"*.amplitude.com")||Xo(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return Xo(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!Qo(e.status,Jo))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return Xo(t,e)}))&&(!r||!e.urls||Ye(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!Qo(n,e.statusCodeRange||Jo))}(t,o,e.status,e.url,e.method),i){var n=Zo(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=Zo(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!ea(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!ea(t.requestBody)){u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===Go}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function na(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return ta(e.event,n)}).subscribe(function(e){var t,n,o=e.event,a=tr(o.url);if(a){var c=null===(t=o.responseWrapper)||void 0===t?void 0:t.bodySize,d=null===(n=o.requestWrapper)||void 0===n?void 0:n.bodySize;!function(e,t,n,r){s(this,void 0,void 0,function(){var i,o,a;return u(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=l.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(Go,e),[2]}})})}(nr({url:a,method:o.method,statusCode:o.status,startTime:o.startTime,completionTime:o.endTime,duration:o.duration,requestBodySize:d,responseBodySize:c,requestType:o.type,requestHeaders:o.requestHeaders,responseHeaders:o.responseHeaders}).event_properties,o,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(Wo||(Wo={}));var ra=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new Rn(function(e){var n=new rn(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return sn.subscribe(n,t),function(){sn.unsubscribe(n)}});return(e={})[Wo.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a;return u(this,function(s){return"undefined"!=typeof document||function(){var e,t=B();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(a=r(),t=null==i?void 0:i.loggerProvider,Yo=na({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added.")),[2]):[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return Yo.unsubscribe(),[2]})})}}},ia="web-vitals-browser",oa="[Amplitude] Web Vitals",aa={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let sa=-1;const ua=()=>sa,ca=e=>{addEventListener("pageshow",t=>{t.persisted&&(sa=t.timeStamp,e(t))},!0)},la=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},da=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},fa=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},va=()=>fa()?.activationStart??0;let pa=-1;const ha=new Set,ga=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,ma=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of ha)e();isFinite(pa)||(pa="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",ma,!0))}},ya=(e=!1)=>{if(e&&(pa=1/0),pa<0){const e=va(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;pa=t??ga(),addEventListener("visibilitychange",ma,!0),addEventListener("prerenderingchange",ma,!0),ca(()=>{setTimeout(()=>{pa=ga()})})}return{get firstHiddenTime(){return pa},onHidden(e){ha.add(e)}}},ba=(e,t=-1,n,r=0,i,o,a)=>{const s=fa(),u=s?.navigationId||0;let c="navigate";return n?c=n:ua()>=0?c="back-forward-cache":s&&(document.prerendering||va()>0?c="prerender":document.wasDiscarded?c="restore":s.type&&(c=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:r||u,navigationInteractionId:i,navigationURL:o||s?.name,navigationStartTime:a||0}},wa=new WeakMap;function Ea(e,t){let n=wa.get(t);return n||(n=new WeakMap,wa.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class Sa{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const ka=(e,t,n={})=>{try{const r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},Ta=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,xa=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Pa=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Ia{l}const Aa=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ca=[1800,3e3],_a=(e,t={})=>{const n=Ta(t);Aa(()=>{const r=Ea(t,Ia),i=ya();let o,a=ba("FCP");const s=ka(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(a.value=Math.max(t.startTime-va(),0),a.entries.push(t),a.navigationId=t.navigationId||a.navigationId,o(!0)))});s&&(o=la(e,a,Ca,t.reportAllChanges),ca(n=>{a=ba("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,ua()),o=la(e,a,Ca,t.reportAllChanges),da(()=>{a.value=performance.now()-n.timeStamp,o(!0)})})),n&&ka(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&xa(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);a=ba("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=la(e,a,Ca,t.reportAllChanges),o(!0)})},t)})},Oa=[.1,.25],Ra=(e,t={})=>{const n=ya();_a(Pa(()=>{let r,i=ba("CLS",0);const o=Ea(t,Sa),a=(n,a,s,u,c)=>{i=ba("CLS",0,n,a,s,u,c),o.i=0,r=la(e,i,Oa,t.reportAllChanges)},s=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},u=e=>{s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s()},l=["layout-shift"];Ta(t)&&l.push("soft-navigation");const d=ka(l,c);d&&(r=la(e,i,Oa,t.reportAllChanges),n.onHidden(()=>{c(d.takeRecords()),r(!0)}),ca(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,ua()),da(r)}),setTimeout(r))}))};let Da=0,La=1/0,Na=0;const Ma=e=>{for(const t of e)t.interactionId&&(La=Math.min(La,t.interactionId),Na=Math.max(Na,t.interactionId),Da=Na?(Na-La)/7+1:0)};let ja;const Ua=()=>ja?Da:performance.interactionCount??0;class qa{u=0;v=[];m=new Map;p;T;_(){return Ua()-this.u}M(){this.u=Ua(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.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.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}}const Fa=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=Pa(e);let o=-1;const a=()=>{r(o),i()};addEventListener("visibilitychange",a,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",a,{capture:!0}),i()},{timeout:t})}},Ba=[200,500],Va=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=ya();Aa(()=>{"interactionCount"in performance||ja||(ja=ka(["event"],Ma,{durationThreshold:0}));let r,i=ba("INP");const o=Ea(t,qa),a=(n,a,s,u,c)=>{o.M(),i=ba("INP",-1,n,a,s,u,c),r=la(e,i,Ba,t.reportAllChanges)},s=()=>{const e=o.L(i.navigationType);e&&e.P!==i.value&&(i.value=e.P,i.entries=e.entries,r())},u=e=>{s(),r(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=(e,t=!1)=>{Fa(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s(),t&&r(!0)})},l=["event","first-input"];Ta(t)&&l.push("soft-navigation");const d=ka(l,c,{...t,durationThreshold:t.durationThreshold??40});r=la(e,i,Ba,t.reportAllChanges),d&&(n.onHidden(()=>{c(d.takeRecords(),!0)}),ca(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,ua())}))})};class Ha{p;l;h(e){this.p?.(e)}}const za=[2500,4e3],Ka=(e,t={})=>{let n=!1;const r=Ta(t);Aa(()=>{let i,o=ya(),a=ba("LCP");const s=Ea(t,Ha),u=(r,s,u,c,l)=>{a=ba("LCP",-1,r,s,u,c,l),i=la(e,a,za,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=ya(!0))},c=e=>{s.l&&e.navigationId&&xa(s.l,e),n||i(!0),u("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&l([t])},l=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],r=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-va(),0),s.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const i=t;if(!a.navigationId)continue;if("interactionId"in i&&i.interactionId!=a.navigationInteractionId)continue;r=i.largestContentfulPaint?.renderTime||0,e=Math.max(r-t.startTime,0),i.largestContentfulPaint&&(s.h(i.largestContentfulPaint),n=[i.largestContentfulPaint])}r<o.firstHiddenTime&&(a.value=e,a.entries=n,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");const f=ka(d,l);if(f){i=la(e,a,za,t.reportAllChanges);const o=["keydown","click","visibilitychange"],s=e=>{if(e.isTrusted&&!n){const e=a.id;Fa(()=>{if(!n){if(!r){f.disconnect();for(const e of o)removeEventListener(e,s,{capture:!0})}e===a.id&&(n=!0,i(!0))}})}};for(const e of o)addEventListener(e,s,{capture:!0});ca(r=>{u("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,ua()),i=la(e,a,za,t.reportAllChanges),da(()=>{a.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},Wa=[800,1800],Ya=e=>{document.prerendering?Aa(()=>Ya(e)):"complete"!==document.readyState?addEventListener("load",()=>Ya(e),!0):setTimeout(e)},$a=(e,t={})=>{const n=Ta(t);let r=ba("TTFB"),i=la(e,r,Wa,t.reportAllChanges);Ya(()=>{const o=fa();if(o){const a=o.responseStart;r.value=Math.max(a-va(),0),r.entries=[o],i(!0),ca(()=>{r=ba("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,ua()),i=la(e,r,Wa,t.reportAllChanges),i(!0)}),n&&ka(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=ba("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=la(e,r,Wa,t.reportAllChanges),i(!0))})},t)}})};function Ga(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Ja(e,t){void 0===t&&(t=!1);var n={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Ga(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var Xa=Object.values(aa);var Qa=function(){var e,t=null,n=B(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,a=new Set;return{name:ia,type:"enrichment",setup:function(n,l){return s(void 0,void 0,void 0,function(){var s,d,f,v,p,h,g,m;return u(this,function(u){return void 0===r||(o=!0,s=new Map,d=-1,f=function(e){var t=e.navigationId,o=s.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var a=$e(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":a,"[Amplitude] Page Path":$e(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":$e(a.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),s.set(t,o)),o},v=function(e){a.add(e);var t=s.get(e);t&&(s.delete(e),function(e){return Xa.some(function(t){return t in e})}(t)&&l.track(oa,t))},p=function(){var e,t;try{for(var n=c(Array.from(s.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;v(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},h=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=c(Array.from(s.keys())),o=i.next();!o.done;o=i.next()){var a=o.value;a<t&&v(a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},m={reportSoftNavs:!0},Ka((g=function(e){return function(t){o&&!a.has(t.navigationId)&&(f(t)[e]=Ja(t,!0),t.navigationId>d&&(-1!==d&&h(t.navigationId),d=t.navigationId))}})(aa.LCP),m),_a(g(aa.FCP),m),Va(g(aa.INP),m),Ra(g(aa.CLS),m),$a(g(aa.TTFB),m),t=function(){"hidden"===r.visibilityState&&t&&p()},r.addEventListener("visibilitychange",t)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},Za=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=B();return e&&"PerformanceSoftNavigation"in e}()?Qa():function(){var e=null,t=B(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:ia,type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return void 0===n||(o=$e((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":$e((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":$e(o.split("?")[0],t.loggerProvider)},Ka(function(e){a["[Amplitude] LCP"]=Ja(e)}),_a(function(e){a["[Amplitude] FCP"]=Ja(e)}),Va(function(e){a["[Amplitude] INP"]=Ja(e)}),Ra(function(e){a["[Amplitude] CLS"]=Ja(e)}),$a(function(e){a["[Amplitude] TTFB"]=Ja(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(oa,a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}}()},es=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return G},get LogLevel(){return re},get ServerZone(){return Rt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Lt,DEFAULT_DATA_ATTRIBUTE_PREFIX:Nt,DEFAULT_ACTION_CLICK_ALLOWLIST:Mt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Wn}),ts=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ns=function(e,t,n,r,i,s){void 0===i&&(i=!0),e.referrer;var u=e.referring_domain,c=a(e,["referrer","referring_domain"]),l=t||{};l.referrer;var d,f=l.referring_domain,v=a(l,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var h=is(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&cs(e.referring_domain,s)){if("always"===h)return os(h,e.referring_domain,r),!1;if("ifEmptyCampaign"===h&&(d=o(o({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return os(h,e.referring_domain,r),!1}}if(rs(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(c)!==JSON.stringify(v),m=ts(u||"")!==ts(f||""),y=!t||g||m;return y?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."),y},rs=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},is=function(e,t){if(!0===e)return Wn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Wn).includes(n))return n;if(void 0===n)return Wn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function os(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var as,ss=["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"],us=function(e){var t,n,r=e||(null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],a=i[i.length-2];return ss.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},cs=function(e,t){var n=B();if(!n)return!1;var r,i,o,a=(t||"").trim()||us(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},ls=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=tt(t.apiKey,"MKTG"),this.webExpStorageKey=tt(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=O,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 u(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||_e(this.sessionTimeout,this.lastEventTime),ns(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 u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new un).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,a=(t=this.currentCampaign,n=this.options,r=o(o({},O),t),i=Object.entries(r).reduce(function(e,t){var r,i=l(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)},new M),Z(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ds=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),fs=function(e){var t;void 0===e&&(e={});var n,r,i,a,c,l,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,f=B(),v={},p=!1,h=!1,g=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new un).parse()];case 1:return e=t.sent(),v=Je(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",v)),[2]}})})},m=function(){g()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(o){switch(o.label){case 0:return n=t,r=e.loggerProvider,p=!0,r.log("Installing event property attribution tracking."),[4,g()];case 1:if(o.sent(),!f)return[2];if(f.addEventListener("popstate",m),!h){if(i=Reflect.get(f.history,"pushState"),a=Reflect.get(f.history,"replaceState"),!i||!a)return[2];c=y(i),f.history.pushState=c,l=y(a),f.history.replaceState=l,h=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return ds.has(e.event_type)||(e.event_properties=o(o({},v),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){return f&&(f.removeEventListener("popstate",m),e=Reflect.get(f.history,"pushState"),t=Reflect.get(f.history,"replaceState"),h&&e===c&&i&&(f.history.pushState=i),h&&t===l&&a&&(f.history.replaceState=a)),p=!1,h=!1,i=void 0,a=void 0,c=void 0,l=void 0,v={},[2]})})}}},vs="AMP_CURRENT_PAGE",ps="AMP_PREVIOUS_PAGE",hs="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(as||(as={}));var gs=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),ms=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=B(),i=void 0,a=!1,c=void 0,d=!1,f=!1,v=function(e){var t;try{t=new URL(e).hostname}catch(e){null==c||c.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?v(e):void 0;if(!r)return as.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?as.Internal:as.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return u(this,function(s){switch(s.label){case 0:return i&&a?[4,i.get(hs)]:[3,3];case 1:return e=s.sent(),t=$e("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[vs])||"",r=void 0,r=t===n?(null==e?void 0:e[ps])||"":n||(document.referrer||""),[4,i.set(hs,(o={},o[vs]=t,o[ps]=r,o))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},g=function(){h()},m={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,o,s,p,m,y,b;return u(this,function(u){switch(u.label){case 0:if((c=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),f=!0,!r)return[3,7];try{i=new nt(r.sessionStorage)}catch(e){null==c||c.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return a=null!==(b=u.sent())&&void 0!==b&&b,i&&a?(t="undefined"!=typeof document&&document.referrer||"",n=t?v(t):void 0,o="undefined"!=typeof location&&location.hostname||"",s=$e("undefined"!=typeof location&&location.href||""),[4,i.get(hs)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[vs])||"",!!n&&n!==o&&m!==s?[4,i.set(hs,(y={},y[vs]=s,y[ps]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,h()];case 5:u.sent(),u.label=6;case 6:r.addEventListener("popstate",g),d||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),d=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(s){switch(s.label){case 0:return t=$e("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(hs)]:[3,2];case 1:if(n=s.sent(),r=(null==n?void 0:n[ps])||"",gs.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":ys(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":ys(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":ys(e,"[Amplitude] Page Path","undefined"!=typeof location&&$e(location.pathname)||""),"[Amplitude] Page Title":ys(e,"[Amplitude] Page Title",hn(pn)),"[Amplitude] Page URL":ys(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",g),f=!1),i&&a?[4,i.set(hs,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function ys(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var bs=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(a=i.remoteConfig)||void 0===a?void 0:a.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||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(){var r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||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 u(this,function(e){return t&&t(),[2]})})}};return i},ws="userProperty",Es="eventProperty",Ss=function(e){return e===ws||e===Es},ks=[ws,Es],Ts=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(Ss))),!1);return t.length>0?t:d([],l(ks),!1)}(e.trackingMethod).includes(t)},xs=function(e){return Ts(e,ws)},Ps=function(e,t){Is(e,t)},Is=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var u=s.apply(e,o);"function"==typeof a&&a(null==u?void 0:u.promise)}}return e},As=function(e){return e&&void 0!==e._q},Cs=1e3,_s=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=B())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>Cs?(i=n.length-Cs,[4,e.prototype.set.call(this,t,n.slice(0,Cs))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(Cs,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(nt),Os=function(e){function t(){var t;return e.call(this,null===(t=B())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(nt),Rs=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r=this;return u(this,function(i){return[2,new Promise(function(i,a){"undefined"==typeof XMLHttpRequest&&a(new 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(e){i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":"application/json",Accept:"*/*"},v=JSON.stringify(t),p=n&&v.length>=2048&&wt(),h=function(e){var t,n;f=o(o({},r.customHeaders),f);try{for(var i=c(Object.entries(f)),a=i.next();!a.done;a=i.next()){var s=l(a.value,2),u=s[0],v=s[1];d.setRequestHeader(u,v)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};s(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,Et(v)]:[3,2];case 1:return(e=t.sent())?(f["Content-Encoding"]="gzip",h(e)):h(v),[3,3];case 2:h(v),t.label=3;case 3:return[2]}})}).catch(a)})]})})},t}(bt),Ds=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r,i,a,s,c,l,d,f,v;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&wt(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,Et(r)]:[3,2];case 1:(c=u.sent())&&(s["Content-Encoding"]="gzip",a=c),u.label=2;case 2:return s=o(o({},this.customHeaders),s),l="string"==typeof a?a.length:a.byteLength,d={headers:s,body:a,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(f=u.sent()).text()];case 4:v=u.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch(e){return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(bt),Ls=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,n){return s(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,i){var o=B();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,a)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(bt),Ns=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,o,a,s,c,d,f,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(v.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=l(i.split("."),6),a=o[0],s=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:a,userId:js(s),sessionId:Ms(d),lastEventId:Ms(p),lastEventTime:Ms(f),optOut:Boolean(c)}]}})})},Ms=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},js=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Us=function(e){function t(t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,C,_,O,R,D,L,N,M,j,U,q,F,B,V,H,z){void 0===r&&(r=new Xe),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Fr),void 0===g&&(g=new oe),void 0===m&&(m=re.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===T&&(T="US"),void 0===I&&(I=18e5),void 0===A&&(A=new _s({loggerProvider:g})),void 0===C&&(C={ipAddress:!0,language:!0,platform:!0}),void 0===_&&(_="fetch"),void 0===O&&(O=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===q&&(q=0),void 0===H&&(H=!1);var K,W=this;(W=e.call(this,{apiKey:t,instanceName:v,storageProvider:A,transportProvider:Bs(_)})||this).apiKey=t,W.appVersion=n,W.cookieOptions=i,W.defaultTracking=o,W.autocapture=a,W.flushIntervalMillis=u,W.flushMaxRetries=c,W.flushQueueSize=l,W.identityStorage=d,W.ingestionMetadata=f,W.loggerProvider=g,W.logLevel=m,W.minIdLength=y,W.offline=b,W.partnerId=E,W.plan=S,W.serverUrl=k,W.serverZone=T,W.sessionTimeout=I,W.storageProvider=A,W.trackingOptions=C,W.transport=_,W.useBatch=O,W.fetchRemoteConfig=R,W.networkTrackingOptions=M,W.identify=j,W.enableDiagnostics=U,W.diagnosticsSampleRate=q,W.diagnosticsClient=F,W.remoteConfig=B,W.topLevelDomain=V,W.enableRequestBodyCompression=H,W.customEnrichment=z,W.version=gr,W._optOut=!1,W._cookieStorage=r,W.deviceId=s,W.lastEventId=p,W.lastEventTime=h,W.optOut=w,W.deferredSessionId=P,W.sessionId=x,W.pageCounter=L,W.userId=D,W.debugLogsEnabled=N,W.loggerProvider.enable(N?re.Debug:W.logLevel),W.networkTrackingOptions=M,W.identify=j,W.enableDiagnostics=U,W.diagnosticsSampleRate=q,W.diagnosticsClient=F;var Y=null!==(K=null==B?void 0:B.fetchRemoteConfig)&&void 0!==K?K:R;return W.remoteConfig=W.remoteConfig||{},W.remoteConfig.fetchRemoteConfig=Y,W.fetchRemoteConfig=Y,W.topLevelDomain=V||us(),W}return n(t,e),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())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof Qe&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Oe(this.apiKey),e)},t}(ue),qs=function(e,t,n,r,i){return void 0===t&&(t={}),s(void 0,void 0,void 0,function(){var a,s,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,C,_,O,R,D,L,N,M,j,U,q,F,B,V,z,K,W,Y,$,G,J,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return a=t.identityStorage||Fr,s="",a!==Fr||(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)||""===(null===(C=t.cookieOptions)||void 0===C?void 0:C.domain)?[3,2]:[4,Vs(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=o({domain:null!==(O=null===(_=t.cookieOptions)||void 0===_?void 0:_.domain)&&void 0!==O?O:s,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(e){var t=Ze(e);if(!t)return!1;var n=JSON.parse(t);return et(n.cookieDomain,c.domain)},diagnosticsClient:r},d=Fs(t.identityStorage,c,l),[4,Ns(e,d,null===(D=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===D||D)];case 3:return f=u.sent(),[4,d.get(Oe(e))];case 4:return v=u.sent(),p=De(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(M=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(N=p.ampDeviceId)&&void 0!==N?N:p.deviceId:void 0)&&void 0!==M?M:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:H(),y=null!==(q=null==v?void 0:v.lastEventId)&&void 0!==q?q:f.lastEventId,b=null!==(F=null==v?void 0:v.lastEventTime)&&void 0!==F?F:f.lastEventTime,w=null!==(V=null!==(B=t.optOut)&&void 0!==B?B:null==v?void 0:v.optOut)&&void 0!==V?V:f.optOut,E=null!==(z=null==v?void 0:v.sessionId)&&void 0!==z?z:f.sessionId,S=null==v?void 0:v.deferredSessionId,k=null!==(W=null!==(K=t.userId)&&void 0!==K?K:null==v?void 0:v.userId)&&void 0!==W?W:f.userId,n.previousSessionDeviceId=null!==(Y=null==v?void 0:v.deviceId)&&void 0!==Y?Y:f.deviceId,n.previousSessionUserId=null!==($=null==v?void 0:v.userId)&&void 0!==$?$:f.userId,T={ipAddress:null===(J=null===(G=t.trackingOptions)||void 0===G?void 0:G.ipAddress)||void 0===J||J,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},x=null==v?void 0:v.pageCounter,P=null==v?void 0:v.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(I=new Us(e,t.appVersion,d,c,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,E,S,t.sessionTimeout,t.storageProvider,T,t.transport,t.useBatch,t.fetchRemoteConfig,k,x,P,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment)).storageProvider.isEnabled()];case 5:return u.sent()||(I.loggerProvider.warn("Storage provider ".concat(I.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),I.storageProvider=new Xe),[2,I]}})})},Fs=function(e,t,n){switch(void 0===e&&(e=Fr),void 0===t&&(t={}),e){case"localStorage":return new _s;case"sessionStorage":return new Os;case"none":return new Xe;default:return new Qe(o(o({},t),{expirationDays:t.expiration}),n)}},Bs=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new Rs(n):"beacon"===t?new Ls:new Ds(n,r,i)},Vs=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,a,s,c;return u(this,function(u){switch(u.label){case 0:return[4,new Qe(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,ss.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),a=r.length-o-1;a>=0;--a)i.push(r.slice(a).join("."));a=0,u.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,Qe.isDomainWritable(s)];case 4:return u.sent()?[2,"."+s]:[3,6];case 5:return c=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:c instanceof Error?c.message:String(c)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(n)}),[2,""]}})})},Hs=!1,zs=function(){var e=B(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}},Ks=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.diagnosticsSampleRate=0,t.enableDiagnostics=!0,t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ee(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,c,l,d,f,v;return s(this,void 0,void 0,function(){var p,h,g,m,y,b,w,E,S,k,T,x,P,I,A,C,_=this;return u(this,function(O){switch(O.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),h=null!==(n=t.loggerProvider)&&void 0!==n?n:new oe,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:re.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(c=t.enableDiagnostics)||void 0===c||c,this.diagnosticsSampleRate=y,this.enableDiagnostics=b,w=this.autocaptureAdapter(),p&&w?[4,w.getRemoteConfigClient(t,h,g)]:[3,2]);case 1:m=O.sent(),y=this.diagnosticsSampleRate,b=this.enableDiagnostics,O.label=2;case 2:return[4,null==w?void 0:w.getDiagnosticsClient(t,h,g,b,y)];case 3:return E=null!==(l=O.sent())&&void 0!==l?l:void 0,[4,qs(t.apiKey,t,this,E,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 4:return S=O.sent(),p&&m&&w?[4,w.fetchRemoteConfig(m,S)]:[3,6];case 5:O.sent(),O.label=6;case 6:return[4,e.prototype._init.call(this,S)];case 7:return O.sent(),this.logBrowserOptions(S),this.config.remoteConfigClient=m,R=this.config,k=ir(R.defaultTracking)&&R.defaultTracking&&"object"==typeof R.defaultTracking&&R.defaultTracking.attribution&&"object"==typeof R.defaultTracking.attribution?o({},R.defaultTracking.attribution):{},this.attributionTrackingOptions=k,[4,null==w?void 0:w.addAttributionTrackingPlugin()];case 8:return O.sent(),T=De(),x=T.ampTimestamp?Number(T.ampTimestamp):void 0,P=!x||Date.now()<x,I=P&&!Number.isNaN(Number(T.ampSessionId))?Number(T.ampSessionId):void 0,-1!==(A=this.config.deferredSessionId)||this.config.optOut||(A=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:I)&&void 0!==f?f:A)&&void 0!==v?v:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(C=Ae(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(zs()).promise];case 9:O.sent(),O.label=10;case 10:return[4,this.add(new we({diagnosticsClient:E})).promise];case 11:return O.sent(),[4,this.add(new yr).promise];case 12:return O.sent(),[4,this.add(new Ce).promise];case 13:return O.sent(),w&&function(e){Hs||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Hs=!0)}(this.config),[4,null==w?void 0:w.addPlugins()];case 14:return O.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 15:return O.sent(),C.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i=o(o({},"number"==typeof n&&{time:n}),e.groups&&{groups:e.groups});_.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var R})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){Ae(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){Ae(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(H()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n,r;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 i=new M,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var a=c(Object.entries(o)),s=a.next();!s.done;s=a.next()){var u=l(s.value,2),d=u[0],f=u[1];i.set(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ee(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ee(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ee(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var i=this.getSessionId();i!==e&&this.timeline.onSessionIdChanged(e);var o=this.config.lastEventTime,a=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0;var s,u=this.autocaptureAdapter(),c=!u,l=!c&&(s=this.config.defaultTracking,rr(s,"sessions"));l&&i&&o&&r.push(this.track(Or,void 0,{device_id:this.previousSessionDeviceId,event_id:++a,session_id:i,time:o+1,user_id:this.previousSessionUserId}).promise),(c||l)&&(this.config.lastEventTime=this.config.sessionId);var d=null!==(n=null==u?void 0:u.trackCampaignEventIfNeeded(++a,r))&&void 0!==n&&n;return this.config.identify&&r.push(this.track(Z(this.config.identify)).promise),l&&r.push(this.track(_r,void 0,{event_id:d?++a:a,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ee(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Bs(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(As(t)){var r=t._q;t._q=[],t=Is(new M,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(As(r)){var o=r._q;r._q=[],r=Is(new M,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(As(t)){var r=t._q;t._q=[],t=Is(new ne,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.process=function(t){var n;return s(this,void 0,void 0,function(){var r,i,o;return u(this,function(a){return r=Date.now(),i=_e(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===_r||t.event_type===Or||t.session_id&&t.session_id!==this.getSessionId()||(i||o?(this.setSessionId(r),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||null===(n=this.autocaptureAdapter())||void 0===n||n.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=o(o({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",X(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t.prototype.autocaptureAdapter=function(){return null},t}(te),Ws=function(e){function t(){var t=e.call(this)||this;return t.diagnosticsSampleRate=0,t.enableDiagnostics=!0,t._autocaptureAdapter=null,t}return n(t,e),t.prototype.autocaptureAdapter=function(){var e=this;return this._autocaptureAdapter||(this._autocaptureAdapter={addPlugins:function(){return s(e,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return o=this.config.defaultTracking,rr(o,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(zr()).promise]):[3,2];case 1:n.sent(),n.label=2;case 2:return or(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Br()).promise]):[3,4];case 3:n.sent(),n.label=4;case 4:return ar(this.config.defaultTracking)?this.config.optOut?[3,6]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(br(hr(this.config))).promise]):[3,7];case 5:return n.sent(),[3,7];case 6:this.timeline.addOptOutListener(function(e){return s(t,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(br(hr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),n.label=7;case 7:return this.attributionTrackingOptions&&ir(this.config.defaultTracking)&&(i=this.attributionTrackingOptions,Ts(i,Es))?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(fs(this.attributionTrackingOptions)).promise]):[3,9];case 8:n.sent(),n.label=9;case 9:return ur(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),e=this.diagnosticsClient?{diagnosticsClient:this.diagnosticsClient}:void 0,[4,this.add(Io(fr(this.config),e)).promise]):[3,11];case 10:n.sent(),n.label=11;case 11:return lr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Bo(vr(this.config))).promise]):[3,13];case 12:n.sent(),n.label=13;case 13:return sr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ra(pr(this.config))).promise]):[3,15];case 14:n.sent(),n.label=15;case 15:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.webVitals||"object"==typeof e.webVitals&&null!==e.webVitals)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Za(cr(this.config))).promise]):[3,17];case 16:n.sent(),n.label=17;case 17:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add($o(dr(this.config))).promise]):[3,19];case 18:n.sent(),n.label=19;case 19:return function(e){return rr(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(ms()).promise]):[3,21];case 20:n.sent(),n.label=21;case 21:return("boolean"==typeof(r=this.config.customEnrichment)?r:"object"==typeof r&&null!==r&&!1!==r.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(bs()).promise]):[3,23];case 22:n.sent(),n.label=23;case 23:return[2]}var r,i,o})})},trackCampaignEventIfNeeded:function(t,n){if(!e.webAttribution||!e.webAttribution.shouldTrackNewCampaign||!xs(e.webAttribution.options))return!1;var r=e.webAttribution.generateCampaignEvent(t);return n?n.push(e.track(r).promise):e.track(r),e.config.loggerProvider.log("Tracking attribution."),!0},addAttributionTrackingPlugin:function(){return s(e,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return void 0!==this.attributionTrackingOptions&&ir(this.config.defaultTracking)&&xs(this.attributionTrackingOptions)?(e=this.attributionTrackingOptions,this.config.optOut&&this.timeline.addOptOutListener(function(n){return s(t,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return n?[3,2]:(this.webAttribution=new ls(e,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new ls(e,this.config),[4,this.webAttribution.init()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},getDiagnosticsClient:function(t,n,r,i,o){return s(e,void 0,void 0,function(){var e;return u(this,function(a){return e=new yt(t.apiKey,n,r,{enabled:i,sampleRate:o}),this.diagnosticsClient=e,e.setTag("library","".concat(mr,"/").concat(gr)),e.setTag("platform","Web"),e.setTag("web_environment",function(){var e=B();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&e.setTag("user_agent",navigator.userAgent),[2,e]})})},getRemoteConfigClient:function(t,n,r){return s(e,void 0,void 0,function(){var e,i,o=this;return u(this,function(a){switch(a.label){case 0:return e=new Pt(t.apiKey,n,r,null===(i=t.remoteConfig)||void 0===i?void 0:i.serverUrl),[4,new Promise(function(t){null==e||e.subscribe("configs.diagnostics.browserSDK","all",function(e,r,i){if(n.debug("Diagnostics remote configuration received:",X({remoteConfig:e,source:r,lastFetch:i},null,2)),e){var a=e.sampleRate;"number"!=typeof a||isNaN(a)||(o.diagnosticsSampleRate=a);var s=e.enabled;"boolean"==typeof s&&(o.enableDiagnostics=s)}t()})})];case 1:return a.sent(),[2,e]}})})},fetchRemoteConfig:function(t,n){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e){null==t||t.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,i){var o;null===(o=n.loggerProvider)||void 0===o||o.debug("Remote configuration received:",X({remoteConfig:t,source:r,lastFetch:i},null,2)),t&&Kr(t,n),e()})})];case 1:return e.sent(),[2]}})})}}),this._autocaptureAdapter},t}(Ks),Ys=function(){var e=new Ws;return{init:me(e.init.bind(e),"init",pe(e),ge(e,["config"])),add:me(e.add.bind(e),"add",pe(e),ge(e,["config.apiKey","timeline.plugins"])),remove:me(e.remove.bind(e),"remove",pe(e),ge(e,["config.apiKey","timeline.plugins"])),track:me(e.track.bind(e),"track",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),logEvent:me(e.logEvent.bind(e),"logEvent",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),identify:me(e.identify.bind(e),"identify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),groupIdentify:me(e.groupIdentify.bind(e),"groupIdentify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),setGroup:me(e.setGroup.bind(e),"setGroup",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),revenue:me(e.revenue.bind(e),"revenue",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),flush:me(e.flush.bind(e),"flush",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),getUserId:me(e.getUserId.bind(e),"getUserId",pe(e),ge(e,["config","config.userId"])),setUserId:me(e.setUserId.bind(e),"setUserId",pe(e),ge(e,["config","config.userId"])),getDeviceId:me(e.getDeviceId.bind(e),"getDeviceId",pe(e),ge(e,["config","config.deviceId"])),setDeviceId:me(e.setDeviceId.bind(e),"setDeviceId",pe(e),ge(e,["config","config.deviceId"])),reset:me(e.reset.bind(e),"reset",pe(e),ge(e,["config","config.userId","config.deviceId"])),getSessionId:me(e.getSessionId.bind(e),"getSessionId",pe(e),ge(e,["config"])),setSessionId:me(e.setSessionId.bind(e),"setSessionId",pe(e),ge(e,["config"])),extendSession:me(e.extendSession.bind(e),"extendSession",pe(e),ge(e,["config"])),setOptOut:me(e.setOptOut.bind(e),"setOptOut",pe(e),ge(e,["config"])),setTransport:me(e.setTransport.bind(e),"setTransport",pe(e),ge(e,["config"])),getIdentity:me(e.getIdentity.bind(e),"getIdentity",pe(e),ge(e,["config"])),setIdentity:me(e.setIdentity.bind(e),"setIdentity",pe(e),ge(e,["config","config.userId","config.deviceId"])),getOptOut:me(e.getOptOut.bind(e),"getOptOut",pe(e),ge(e,["config"])),_setDiagnosticsSampleRate:me(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",pe(e),ge(e,["config"]))}},$s=Ys(),Gs=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){"playing"!==t.playbackState&&"playing"===n.playbackState&&e.amplitude.track("Video Content Started",o(o({},n.lastEvent),e.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){"playing"===t.playbackState&&"playing"!==n.playbackState&&e.amplitude.track("Video Content Stopped",o(o(o({},n.lastEvent),{watch_duration:n.watchTime}),e.extraEventProperties))}),this},e.prototype.start=function(){var e,t=this,n=null!==(e=this.videoEl)&&void 0!==e?e:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var r=new Qn({videoEl:n,onStateChange:function(e,n){t.listeners.forEach(function(t){return t(e,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){r.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[]},e}();var Js=$s.add,Xs=$s.extendSession,Qs=$s.flush,Zs=$s.getDeviceId,eu=$s.getIdentity,tu=$s.getOptOut,nu=$s.getSessionId,ru=$s.getUserId,iu=$s.groupIdentify,ou=$s.identify,au=$s.init,su=$s.logEvent,uu=$s.remove,cu=$s.reset,lu=$s.revenue,du=$s.setDeviceId,fu=$s.setGroup,vu=$s.setIdentity,pu=$s.setOptOut,hu=$s.setSessionId,gu=$s.setTransport,mu=$s.setUserId,yu=$s.track,bu=$s._setDiagnosticsSampleRate,wu=Object.freeze({__proto__:null,add:Js,extendSession:Xs,flush:Qs,getDeviceId:Zs,getIdentity:eu,getOptOut:tu,getSessionId:nu,getUserId:ru,groupIdentify:iu,identify:ou,init:au,logEvent:su,remove:uu,reset:cu,revenue:lu,setDeviceId:du,setGroup:fu,setIdentity:vu,setOptOut:pu,setSessionId:hu,setTransport:gu,setUserId:mu,track:yu,_setDiagnosticsSampleRate:bu,createInstance:Ys,AmplitudeBrowser:Ws,runQueuedFunctions:Ps,Revenue:ne,Identify:M,createNetworkRequestEvent:function(e){var t,n;if("string"==typeof(null==e?void 0:e.url)&&e.url.trim()&&"string"==typeof e.method&&e.method.trim()){var r=e.startTime+e.duration;if(!(!Number.isFinite(e.startTime)||e.startTime<0||!Number.isFinite(e.duration)||e.duration<0)&&Number.isFinite(r)){var i=nr(o(o({},e),{url:tr(e.url),statusCode:null!==(t=e.statusCode)&&void 0!==t?t:0,requestType:null!==(n=e.requestType)&&void 0!==n?n:"custom",completionTime:r}));return o(o({},i),{event_properties:Object.fromEntries(Object.entries(i.event_properties).filter(function(e){return void 0!==l(e,2)[1]}))})}console.error("Amplitude Logger [Error]: Network request timing must be finite, non-negative milliseconds")}else console.error("Amplitude Logger [Error]: Network request URL and method must not be empty")},trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new Gs(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),n.vendor&&i.withVendor(n.vendor);var a=null!==(r=n.extraEventProperties)&&void 0!==r?r:{};try{i.withExtraEventProperties(o({view_session_id:H()},a)).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:es});!function(e){if(e.scriptUrl){var t=vt(e.scriptUrl);t&&function(e){var t=B();if(t){var n=dt();n.includes(e)||(n.push(e),t[lt]=n)}}(t)}}({scriptUrl:function(){if("undefined"==typeof document)return;var e=document.currentScript;if(null==e?void 0:e.src)return e.src;return}()}),function(){var e=B();if(e){var t=function(e){var t=Ys(),n=B();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},wu,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],Ps(wu,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitude._iq[o],t(o)),s=a._q;a._q=[],Ps(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
|
|
1
|
+
!function(){"use strict";function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var t=function(e,n){return t=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])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function l(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var f,v="AMP",p="".concat(v,"_unsent"),h="$default_instance",g="https://api2.amplitude.com/2/httpapi",m="https://api.eu.amplitude.com/2/httpapi",y="https://api2.amplitude.com/batch",b="https://api.eu.amplitude.com/batch",w="[Amplitude] Page Viewed",E="dclid",S="fbclid",T="gbraid",k="gclid",P="ko_click_id",x="li_fat_id",I="msclkid",_="rdt_cid",A="ttclid",O="twclid",C="wbraid",R={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},D=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],L=["authorization","cookie","set-cookie"],N=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!M(t,n))return!1}return!0},M=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=l(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&N(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return N(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},j=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||M(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(f||(f={}));var U,F=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],q="Event skipped due to empty event type",B="Stale event overwritten";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(U||(U={}));var H=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=U.Unknown),{event:e,code:t,message:n}},V=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},z=d([],c(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),W=function(e){var t,n=V();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,W)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],c(r.entries()),!1).map(function(e){var t=c(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(z[r]):z[r]}).join("")},K={},Y={get exports(){return K},set exports(e){K=e}},$=Object.prototype.hasOwnProperty;function G(e){return"[Throws: "+(e?e.message:"?")+"]"}function J(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return G(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if($.call(e,t))try{return e[t]}catch(e){return G(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}Y.exports=function(e,t,n){return JSON.stringify(J(e),t,n)};var X,Q=K.ensureProperties=J,Z=K||e({__proto__:null,ensureProperties:Q,get default(){return K}},[K]),ee=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=W(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),r=this.plugins.findIndex(function(t){return t.name===e}),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a,s,d,f,v,p,h,g,m,y,b,w,E,S,T,k;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=c(e,1),n=t[0],r=c(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),s=l(a),d=s.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(Z(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(Z(n))),u.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(E)throw E.error}return[7];case 8:v=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),p=l(v),h=p.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(Z(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(Z(n))),u.label=12;case 12:return h=p.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),T={error:y},[3,16];case 15:try{h&&!h.done&&(k=p.return)&&k.call(p)}finally{if(T)throw T.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(Z(n))),w=b.map(function(e){var t=o({},n);return e.execute(t).catch(function(e){return H(t,0,String(e))})}),Promise.all(w).then(function(e){var t=c(e,1)[0]||H(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 u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),t=l(this._optOutListeners),n=t.next(),u.label=1;case 1:if(n.done)return[3,6];r=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,r(e)];case 3:return u.sent(),[3,5];case 4:return i=u.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=u.sent(),a={error:o},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),te=function(e,t){return o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},ne=function(e){return{promise:e||Promise.resolve()}},re=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new ee(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,c,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=l(n),i=r.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(a=o())&&"promise"in a?[4,a.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,a];case 5:u.sent(),u.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),c={error:s},[3,10];case 9:try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(c)throw c.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ne(this.dispatch(r))},e.prototype.identify=function(e,t){var n=te(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ne(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var a=function(e,t,n,r){var a;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(a={},a[e]=t,a)})}(e,t,n,r);return ne(this.dispatch(a))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,a=new j;return a.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:a.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ne(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ne(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ne())},e.prototype._addPlugin=function(e){return ne(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)),ne())},e.prototype._removePlugin=function(e){return ne(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(H(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},i=o({},n);if(void 0===e)return i;var a={};return Object.keys(e).forEach(function(t){Object.values(r).includes(t)||(a[t]=e[t])}),F.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case r.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case r.UNSET:Object.keys(n).forEach(function(e){delete i[e]});break;case r.SET:Object.assign(i,n)}}}),Object.assign(i,a),i},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,H(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(q),[2,H(e,0,q)]):(e.event_type===i.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 0===(o=a.sent()).code&&o.message===B||(200===o.code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message)),[2,o];case 2:return n=a.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=H(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ne(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ie=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));N(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[X.REVENUE_PRODUCT_ID]=this.productId,e[X.REVENUE_QUANTITY]=this.quantity,e[X.REVENUE_PRICE]=this.price,e[X.REVENUE_TYPE]=this.revenueType,e[X.REVENUE_CURRENCY]=this.currency,e[X.REVENUE]=this.revenue,e[X.RECEIPT]=this.receipt,e[X.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(X||(X={}));var oe;!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"}(oe||(oe={}));var ae="Amplitude Logger ",se=function(){function e(){this.logLevel=oe.None}return e.prototype.disable=function(){this.logLevel=oe.None},e.prototype.enable=function(e){void 0===e&&(e=oe.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Verbose||console.log("".concat(ae,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Warn||console.warn("".concat(ae,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Error||console.error("".concat(ae,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<oe.Debug||console.log("".concat(ae,"[Debug]: ").concat(e.join(" ")))},e}(),ue=function(e){return void 0===e||""===e?h:e},le=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:oe.Warn,loggerProvider:new se,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},ce=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=le();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=ue(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.delayedEventsServerUrl=e.delayedEventsServerUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=fe(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),de=function(e,t){return"EU"===e?t?b:m:t?y:g},fe=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=le().serverZone),void 0===n&&(n=le().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:le().serverZone;return{serverZone:r,serverUrl:de(r,n)}},ve=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function pe(e){return e>=200&&e<300}var he=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},ge=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},me=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=l(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ye=function(e,t){return function(){var n,r,i={};try{for(var o=l(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=me(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},be=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),u=s.logger,l=s.logLevel;if(l&&l<oe.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:he(1),time:{start:(new Date).toISOString()},states:{}};r&&c.states&&(c.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=(new Date).toISOString()),u.debug(JSON.stringify(c,null,2))}):(r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=(new Date).toISOString()),u.debug(JSON.stringify(c,null,2))),d}},we=new Set([g,m,y,b]);function Ee(e){return void 0!==e.delay&&null!==e.delay}function Se(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var Te=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.inFlightDelayedEvents={},this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,function(){var n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(p,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.delay&&delete e.user_properties,e.insert_id||(e.insert_id=W()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};Ee(e)&&t.removeStaleDelayedEvents(e),t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeStaleDelayedEvents=function(e){var t=this;try{this.queue=this.queue.filter(function(n){var r,i=n.event;if(!Ee(i))return!0;if(!(i.delay.id===e.delay.id&&i.insert_id===e.insert_id))return!0;var a=t.inFlightDelayedEvents[e.delay.id];return a&&(e.delay=o(o({},e.delay),{skipRemoval:!0})),!(!a||(null===(r=i.delay)||void 0===r?void 0:r.skipRemoval))||(n.callback(H(i,0,B)),!1)})}catch(e){}},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var t,n,r,i,o,a,l=this;return u(this,function(c){switch(c.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={},r=[],this.queue.forEach(function(e){var i;if(0!==e.timeout)r.push(e);else if(null===(i=e.event.delay)||void 0===i?void 0:i.id){var o=e.event.delay;n[o.id]=n[o.id]||[],n[o.id].push(e)}else t.push(e)}),d=t,f=this.config.flushQueueSize,v=Math.max(f,1),i=d.reduce(function(e,t,n){var r=Math.floor(n/v);return e[r]||(e[r]=[]),e[r].push(t),e},[]),o=i.reduce(function(t,n){return s(l,void 0,void 0,function(){return u(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()),a=[o],Object.keys(n).length>0&&a.push(this.sendDelayedEvents(n,e)),[4,Promise.all(a)]);case 1:return c.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var d,f,v})})},e.prototype.sendDelayedEvents=function(e,t){var n,r,i=this,o=[];try{var a=function(e,n){d.inFlightDelayedEvents[e]=!0;var r=d.send(n,t,!0);o.push(r),r.finally(function(){delete i.inFlightDelayedEvents[e]})},d=this;try{for(var f=l(Object.entries(e)),v=f.next();!v.done;v=f.next()){var p=c(v.value,2);a(p[0],p[1])}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}catch(e){}return o.reduce(function(e,t){return s(i,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return[4,e];case 1:return n.sent(),[4,t];case 2:return[2,n.sent()]}})})},Promise.resolve())},e.prototype.translatePayloadToDelayedPayload=function(e,t){var n,r,i=[],o=[],a=[],s=[];t.forEach(function(t,n){t.event.delay.timeout?(i.push(e.events[n]),a.push(t)):(o.push(e.events[n]),s.push(t))}),t.splice.apply(t,d(d([0,t.length],c(a),!1),c(s),!1)),e.timeout=null!==(r=null===(n=a[0])||void 0===n?void 0:n.event.delay.timeout)&&void 0!==r?r:0,e.id=t[0].event.delay.id,e.events=i,e.instant_events=o},e.prototype.send=function(e,t,n){var r;return void 0===t&&(t=!0),s(this,void 0,void 0,function(){var i,o,s,l,c,d;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];i={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,t.delay,a(t,["extra","delay"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:n?void 0:this.config.requestMetadata},n||(this.config.requestMetadata=new ve),u.label=1;case 1:return u.trys.push([1,3,,4]),o=fe(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,s=function(e,t){return void 0===t&&(t=!1),!!we.has(e)||t}(o,this.config.enableRequestBodyCompression),n&&(o=this.config.delayedEventsServerUrl||"".concat(o,"/delayed"),this.translatePayloadToDelayedPayload(i,e),s=!1),[4,this.config.transportProvider.send(o,i,s)];case 2:return null===(l=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(l,e),[3,4]):("body"in l?this.fulfillRequest(e,l.statusCode,"".concat(l.status,": ").concat(Se(l))):this.fulfillRequest(e,l.statusCode,l.status),[2]);case 3:return c=u.sent(),d=(f=c)instanceof Error?f.message:String(f),this.config.loggerProvider.error(d),null===(r=this.diagnosticsClient)||void 0===r||r.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:d,stack_trace:he()}),this.handleResponse({status:U.Failed,statusCode:0},e),[3,4];case 4:return[2]}var f})})},e.prototype.handleResponse=function(e,t){var n;pe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:Se(e),stack_trace:he()});var r=e.status;switch(r){case U.Success:this.handleSuccessResponse(e,t);break;case U.Invalid:this.handleInvalidResponse(e,t);break;case U.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case U.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=d(d(d(d([],c(Object.values(e.body.eventsWithInvalidFields)),!1),c(Object.values(e.body.eventsWithMissingFields)),!1),c(Object.values(e.body.eventsWithInvalidIdLengths)),!1),c(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(Se(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(Se(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,a=new Set(r),s=new Set(i),u=new Set(o),l=t.filter(function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});l.length>0&&this.config.loggerProvider.warn(Se(e));var c=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;pe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:he()})),this.removeEvents(e),e.forEach(function(e){return e.callback(H(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){var t=new Set(e.map(function(e){return e.event.insert_id})),n=new Set(e);this.queue=this.queue.filter(function(e){var t;return!n.has(e)||(null===(t=e.event.delay)||void 0===t?void 0:t.skipRemoval)}),this.queue.forEach(function(e){var n;(null===(n=e.event.delay)||void 0===n?void 0:n.skipRemoval)&&t.has(e.event.insert_id)&&delete e.event.delay.skipRemoval}),this.saveEvents()},e}(),ke=function(){function e(e,t,n,r,i){void 0===i&&(i={}),this.client=e,this.pulse=t,this.delayTimeout=n,this.logger=r,this.options=i,this.interval=null,this.resetPromise=null,this.unsubscribeFunctions=[],this.pageHidePreparers=[],this.events=new Map,this.delayId=W()}return e.prototype.heartbeat=function(e){var t,n;return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var r,i,o,s,c,d,f,v,p,h=this;return u(this,function(u){switch(u.label){case 0:if(null===(n=(t=this.options).beforeHeartbeat)||void 0===n||n.call(t),0===this.events.size)return this.stop(),[2,[]];r=[],i=function(e){var t=e.event_type,n=e.event_properties,i=a(e,["event_type","event_properties"]),s=o.client.track(t,n,i).promise;if(o.isInstantEvent(e)){var u=e.insert_id;s.finally(function(){return h.events.delete(u)})}r.push(s)},o=this;try{for(s=l(this.events.values()),c=s.next();!c.done;c=s.next())d=c.value,i(d)}catch(e){v={error:e}}finally{try{c&&!c.done&&(p=s.return)&&p.call(s)}finally{if(v)throw v.error}}return[4,Promise.all(r)];case 1:return f=u.sent(),e&&this.client.flush(),[2,f]}})})},e.prototype.resetHeartbeat=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.resetPromise?[4,this.resetPromise]:[3,2];case 1:case 3:return[2,n.sent()];case 2:return!1!==this.options.sendOnPageLifecycle&&this.setupPageLifecycleListeners(),this.interval&&clearInterval(this.interval),this.interval=setInterval(function(){t.heartbeat()},this.pulse),e=new Promise(function(e){setTimeout(function(){t.resetPromise=null,e(t.heartbeat())},0)}),this.resetPromise=e,[4,e]}})})},e.prototype.setupPageLifecycleListeners=function(){var e=this;if(!(this.unsubscribeFunctions.length>0)){var t=V();if(t&&"function"==typeof t.addEventListener&&t.document){var n=t.document,r=function(t){var n,r;if(!t.persisted){try{for(var i=l(d([],c(e.pageHidePreparers),!1)),o=i.next();!o.done;o=i.next()){(0,o.value)()}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.heartbeat(!0)}},i=function(){"hidden"===n.visibilityState&&e.resetHeartbeat()};t.addEventListener("pagehide",r),n.addEventListener("visibilitychange",i),this.unsubscribeFunctions.push(function(){t.removeEventListener("pagehide",r),n.removeEventListener("visibilitychange",i)})}}},e.prototype.isInstantEvent=function(e){return Boolean(e.insert_id&&!e.delay.timeout)},e.prototype.checkEventSizeLimit=function(e){var t;return!(JSON.stringify(d([],c(this.events.values()),!1)).length>4e4)||(null===(t=this.logger)||void 0===t||t.warn("Heartbeat: events size limit reached, rejecting event with id=".concat(e.insert_id)),e.insert_id&&this.events.delete(e.insert_id),!1)},e.prototype.enqueue=function(e){return!!e.insert_id&&(this.events.set(e.insert_id,o(o({},e),{delay:e.delay||{id:this.delayId,timeout:this.delayTimeout}})),this.checkEventSizeLimit(e))},e.prototype.track=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e.insert_id?this.enqueue(e)?[4,this.resetHeartbeat()]:[2]:[2,new Error("insert_id is required on events tracked with heartbeat")];case 1:return[2,t.sent().find(function(t){return t.event.insert_id===e.insert_id})]}})})},e.prototype.trackNoDelay=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.delay={id:this.delayId},[2,this.track(e)]})})},e.prototype.update=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return e.insert_id&&this.events.has(e.insert_id)&&(t=this.events.get(e.insert_id),this.events.set(e.insert_id,o(o({},e),{delay:e.delay||{id:this.delayId,timeout:this.delayTimeout}})),!this.checkEventSizeLimit(e)&&t)?(this.events.set(e.insert_id,t),[2]):[2]})})},e.prototype.beforePageHide=function(e){var t=this;return this.pageHidePreparers.push(e),function(){var n=t.pageHidePreparers.indexOf(e);-1!==n&&t.pageHidePreparers.splice(n,1)}},e.prototype.pause=function(){this.interval&&clearInterval(this.interval),this.interval=null},e.prototype.stop=function(e){void 0===e&&(e=!1),this.pause(),this.events.clear(),this.unsubscribeFunctions.forEach(function(e){return e()}),this.unsubscribeFunctions=[],e&&this.client.flush()},e}(),Pe=new Map;class xe{getApplicationContext(){return{versionName:this.versionName,language:Ie(),platform:"Web",os:void 0,deviceModel:void 0}}}const Ie=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class _e{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}const Ae=(e,t)=>{const n=["string","number","boolean","undefined"],r=typeof e;if(r!==typeof t)return!1;for(const i of n)if(i===r)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;const i=Array.isArray(e),o=Array.isArray(t);if(i!==o)return!1;if(!i||!o){const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(!Ae(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Ae(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Ae(e[n],t[n]))return!1;return!0};Object.entries||(Object.entries=function(e){const t=Object.keys(e);let n=t.length;const r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class Oe{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},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(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(const[n,r]of Object.entries(e))switch(n){case"$set":for(const[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(const e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){const t=Object.assign({},this.identity);this.identity=Object.assign({},e),Ae(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Ce="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Re{constructor(){this.identityStore=new Oe,this.eventBridge=new _e,this.applicationContextProvider=new xe}static getInstance(e){return Ce.analyticsConnectorInstances||(Ce.analyticsConnectorInstances={}),Ce.analyticsConnectorInstances[e]||(Ce.analyticsConnectorInstances[e]=new Re),Ce.analyticsConnectorInstances[e]}}var De=function(e){return Re.getInstance(ue(e))},Le=function(){function e(){this.name="identity",this.type="before",this.identityStore=De().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=De(e.instanceName).identityStore),[2]})})},e}(),Ne=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Me=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},je=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},Ue=function(){var e,t=V();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=Fe(n[0]),i=Fe(n[1]);return i?(e[r]=i,e):e},{}):{}},Fe=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},qe="AMP_PAGE_VIEW",Be=Symbol.for("@amplitude/page-view-state"),He=function(e){return e||""},Ve=function(){return V()},ze=function(e){var t;void 0===e&&(e=Ve());try{var n=null===(t=null==e?void 0:e.sessionStorage)||void 0===t?void 0:t.getItem(qe);if(!n)return;var r=JSON.parse(n);if(!r||"object"!=typeof r)return;return r}catch(e){return}},We=function(e,t,n){var r;try{var i=e.sessionStorage;if(!i)return;var a=function(e){var t,n,r={};if(!e||"object"!=typeof e)return r;try{for(var i=l(Object.entries(e)),o=i.next();!o.done;o=i.next()){var a=c(o.value,2),s=a[0],u=a[1];"string"==typeof u&&(r[s]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(null===(r=ze(e))||void 0===r?void 0:r.byApiKey),s=He(t);s&&(a[s]=n),i.setItem(qe,JSON.stringify(o({pageViewId:n},Object.keys(a).length>0?{byApiKey:a}:{})))}catch(e){}},Ke=function(e,t,n){var r,i=Ve();if(i){var o=He(e),a=null!==(r=i[Be])&&void 0!==r?r:{byApiKey:{}},s=a.byApiKey[o];if(s&&s.href===t&&s.pageViewId!==n)return We(i,e,s.pageViewId),s.pageViewId;var u=W();return a.byApiKey[o]={pageViewId:u,href:t},i[Be]=a,We(i,e,u),u}},Ye=function(e){var t,n,r=null===(n=null===(t=function(){var e;return null===(e=Ve())||void 0===e?void 0:e[Be]}())||void 0===t?void 0:t.byApiKey[He(e)])||void 0===n?void 0:n.pageViewId;return r||function(e){var t=ze();if(t){var n=He(e);if(n&&t.byApiKey&&"object"==typeof t.byApiKey){var r=t.byApiKey[n];return"string"==typeof r?r:void 0}return"string"==typeof t.pageViewId?t.pageViewId:void 0}}(e)},$e="[Amplitude] SDK Initialization Offset",Ge=Symbol.for("@amplitude/sdk-initialization-offset"),Je=function(e){var t=V();if(!t)return 0;var n=t[Ge];n||(n={byApiKey:{}},t[Ge]=n);var r=function(e){return e||""}(e),i=n.byApiKey[r];if("number"==typeof i)return i;var o=Xe(t);return n.byApiKey[r]=o,o},Xe=function(e){var t,n;try{var r=null===(n=null===(t=e.performance)||void 0===t?void 0:t.now)||void 0===n?void 0:n.call(t);return"number"==typeof r&&Number.isFinite(r)?Math.max(0,Math.floor(r)):0}catch(e){return 0}},Qe=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Ze=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},et=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},tt=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},nt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return u(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 u(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),rt=function(){function e(e,t){void 0===t&&(t={}),this.options=o({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return u(this,function(s){switch(s.label){case 0:return t="AMP_TEST",n=o({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&(null===(n=a.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);null===(r=a.config.diagnosticsClient)||void 0===r||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 u(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=it(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},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,o,a,s,c,d,f,v;return u(this,function(u){switch(u.label){case 0:r=V(),i=r,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(a=u.sent()){a.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:a.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(s=l(a),c=s.next();!c.done;c=s.next())if(d=c.value,ot(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{c&&!c.done&&(v=s.return)&&v.call(s)}finally{if(f)throw f.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=V(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),a=void 0,s=this.config.duplicateResolverFn;if("function"==typeof s&&o.length>1&&(a=o.find(function(t){var n;try{var i=s(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),a||(a=o[0]),a)return a.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=V();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=null!==t?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),a=s}var u="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=u}catch(t){var l=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(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 u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=V();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),it=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},ot=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()},at=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},st=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),ut="tags",lt="counters",ct="histograms",dt="events",ft="internal",vt="last_flush_timestamp",pt=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=V())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.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(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(ut)||e.createObjectStore(ut,{keyPath:"key"}),e.objectStoreNames.contains(lt)||e.createObjectStore(lt,{keyPath:"key"}),e.objectStoreNames.contains(ct)||e.createObjectStore(ct,{keyPath:"key"}),e.objectStoreNames.contains(dt))||e.createObjectStore(dt,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(ft)||e.createObjectStore(ft,{keyPath:"key"})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([ut],"readwrite"),r=n.objectStore(ut),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=c(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}})})];case 2:return i=a.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,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([lt],"readwrite"),r=n.objectStore(lt),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=c(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return i=a.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,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([ct],"readwrite"),r=n.objectStore(ct),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=c(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return i=a.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,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([dt],"readwrite"),r=n.objectStore(dt),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([ft],"readwrite"),i=r.objectStore(ft),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([ft],"readonly"),r=n.objectStore(ft),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.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 u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(vt)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(vt,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),t=e.transaction([ut,lt,ct,dt],"readwrite"),[4,Promise.all([this.getAllFromStore(t,ut),this.getAllFromStore(t,lt),this.getAllFromStore(t,ct),this.getAllFromStore(t,dt)])];case 2:return n=c.apply(void 0,[u.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,lt),this.clearTable(t,ct),this.clearTable(t,dt)])];case 3:return u.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=u.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(new Error("Failed to get all from ".concat(t)))}})},e}(),ht="__AMPLITUDE_SCRIPT_URL__",gt=function(){var e=V();if(!e)return[];var t=e[ht];return Array.isArray(t)?t:"string"==typeof t?[t]:[]},mt=function(e){var t,n,r=gt();if(0!==r.length)try{for(var i=l(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},yt=function(e){var t,n;try{var r=new URL(e,null===(n=null===(t=V())||void 0===t?void 0:t.location)||void 0===n?void 0:n.origin);return r.origin+r.pathname}catch(e){return}},bt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},wt=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},Et=3e5,St=1e4,Tt=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=o({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=et(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:pt.isSupported()?this.storage=new pt(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=V();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",o({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=mt({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=bt(i),a=mt({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:wt(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=St?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=St?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=St)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},Et))},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=o({},this.inMemoryTags),t=o({},this.inMemoryCounters),n=o({},this.inMemoryHistograms),r=d([],c(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,o,a,s,l,c;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),a={},n.forEach(function(e){a[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}}),0===Object.keys(a).length&&0===Object.keys(s).length&&0===l.length?[2]:(c={tags:o,histogram:s,counters:a,events:l},this.fetch(c),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!V())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(Et),[2]):(n=e-t)>=Et?(this._flush(),[2]):(this._setFlushTimer(Et-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=et(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),kt=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,u,l,c,d,f,v,p,h,g,m,y,b,w,E,S;if("object"!=typeof e)return null;var T=e.code||0,k=this.buildStatus(T);switch(k){case U.Success:return{status:k,statusCode:T,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case U.Invalid:return{status:k,statusCode:T,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(c=e.exceeded_daily_quota_devices)&&void 0!==c?c:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case U.PayloadTooLarge:return{status:k,statusCode:T,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case U.RateLimit:return{status:k,statusCode:T,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case U.Timeout:default:return{status:k,statusCode:T}}},e.prototype.buildStatus=function(e){return pe(e)?U.Success:429===e?U.RateLimit:413===e?U.PayloadTooLarge:408===e?U.Timeout:e>=400&&e<500?U.Invalid:e>=500?U.Failed:U.Unknown},e}();function Pt(){return"undefined"!=typeof CompressionStream}function xt(e){return s(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))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 It=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(Z(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){if(!this.isSupported)return Promise.resolve(!1);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}();var _t=401,At=403,Ot=429,Ct=function(){function e(t,n,r,i,o,a,s){void 0===r&&(r="US"),void 0===a&&(a=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=a,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=s||new It(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=W(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,function(){var n,r,i,o,a,s,l=this;return u(this,function(c){switch(c.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,c,d,f,v,p,h;return u(this,function(u){switch(u.label){case 0:i=!0,a=new AbortController,s=setTimeout(function(){return a.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),c=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(g=o.customFetch({url:c,method:"GET",headers:d,signal:a.signal}),m=a.signal,new Promise(function(e,t){var n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),g.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return v=u.sent(),[3,5];case 3:return[4,fetch(c,{method:"GET",headers:d,signal:a.signal})];case 4:v=u.sent(),u.label=5;case 5:return(f=v).ok||f.status>=200&&f.status<300?[3,7]:[4,f.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(f.status,": ").concat(p)),f.status===_t||f.status===At?(o.logger.error("Remote config client fetch failed with ".concat(f.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==Ot&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(h=u.sent())instanceof Error&&"AbortError"===h.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),h),[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:u.sent(),u.label=14;case 14:return[2]}var g,m})},o=this,a=0,c.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=c.sent()))return[2,s.value];if("break"===s)return[3,4];c.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),Rt=V(),Dt=null==Rt?void 0:Rt.console,Lt={},Nt={},Mt=!1;var jt,Ut={addListener:function(e,t){var n,r=(n=e,!!Dt&&"function"==typeof Dt[n]&&(Nt[n]||(Nt[n]=Dt[n],Dt[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(Lt[n]&&!Mt){Mt=!0;var r=Lt[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return Mt=!1,Nt[n].apply(Dt,e)}),!0));if(!r)return new Error("Console override failed");Lt[e]?Lt[e].push(t):Lt[e]=[t]},removeListener:function(e){var t,n;try{for(var r=l(Object.values(Lt)),i=r.next();!i.done;i=r.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=l(Object.entries(Nt)),r=n.next();!r.done;r=n.next()){var i=c(r.value,2),o=i[0],a=i[1];a&&(Dt[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Nt={},Lt={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(jt||(jt={}));var Ft=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],qt="data-amp-track-",Bt=["div","span","h1","h2","h3","h4","h5","h6"],Ht=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],c(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Vt=Ht,zt=Ht,Wt=["*"];function Kt(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Yt(e,t,n){e&&$t({json:e,allowlist:t.map(Gt),excludelist:n.map(Gt),ancestors:[]})}function $t(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,u=e.parentObject,f=e.targetKey;i||(i=r);var v=Object.keys(i);try{for(var p=l(v),h=p.next();!h.done;h=p.next()){var g=h.value,m=d(d([],c(s),!1),[g],!1);Kt(i[g])?Xt(m,o)&&!Xt(m,a)||delete i[g]:$t({json:r,targetObject:i[g],allowlist:o,excludelist:a,ancestors:m,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&u&&f&&delete u[f]}function Gt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Jt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Jt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Jt(e,t,n+1,r+1)}function Xt(e,t){return t.some(function(t){return Jt(e,t)})}var Qt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=c(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=l(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=c(a.value,2),u=s[0],d=s[1];i[u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return sn(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=V();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=en(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,on(this.body,e,t)]})})},e}(),Zt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),sn(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return en(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,on(this.body,e,t)]})})},e}();function en(e,t){var n,r,i,o=V(),a=null==o?void 0:o.TextEncoder;if(a&&null!=e){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(s=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var u=e,d=0,f=0;try{for(var v=l(u.entries()),p=v.next();!p.done;p=v.next()){var h=c(p.value,2),g=h[0],m=h[1];if(d+=g.length,"string"==typeof m)d+=(new a).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}i=d}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(s=e);return i}}var tn,nn=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),sn(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,on(n.sent(),e,t)]}})})},e}(),rn=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=l(i),a=o.next();!a.done;a=o.next()){var s=c(a.value.split(": "),2),u=s[0],d=s[1];u&&d&&(r[u]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return sn(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){var n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Yt(n,e,t),[2,n]):[2,null]})})},e}();function on(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Yt(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(tn||(tn={}));var an="[REDACTED]",sn=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?tn.REMOVE:a,u=d([],c(L),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===tn.REDACT&&(f[t]=an):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===tn.REDACT&&(f[t]=an)};try{for(var p=l(Object.keys(e)),h=p.next();!h.done;h=p.next()){v(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return f},un=function(){function e(e,t,n,r,i,o,a,s,u,l,c){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=u,this.error=l,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(d([],c(D),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(d([],c(D),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=c(e,2);return t[0],void 0!==t[1]}))},e}();var ln=function(e,t){void 0===t&&(t=W()),this.callback=e,this.id=t};function cn(e){try{e()}catch(e){}}var dn=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=V();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=V();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,u,l,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,p=null===(c=null===(l=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===l?void 0:l.prototype)||void 0===c?void 0:c.setRequestHeader;f&&v&&p&&this.observeXhr(f,v,p);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),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){cn(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var u,l,c,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(l=r.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var v=Math.floor(performance.now()-a),p=Math.floor(o+v),h=new un(e,d,o,o,u,n,l,v,r,c,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,a,s=this;return u(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){cn(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Qt(r):void 0,i?new nn(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){cn(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&cn(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,a=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=c(n,2),s=i[0],u=i[1];try{this.$$AmplitudeAnalyticsEvent=o({method:s,url:null===(e=null==u?void 0:u.toString)||void 0===e?void 0:e.call(u),headers:{}},a.getTimestamps())}catch(e){cn(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,a),s=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new rn(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,l=new Zt(s,r);u.status=i.status,a.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},l,n,void 0,u.startTime,u.durationStart)}catch(e){cn(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){cn(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),fn=new dn,vn=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,o(o(o(o({},R),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Ue();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=Ue();return(e={})[E]=t[E],e[S]=t[S],e[T]=t[T],e[k]=t[k],e[P]=t[P],e[x]=t[x],e[I]=t[I],e[_]=t[_],e[A]=t[A],e[O]=t[O],e[C]=t[C],e},e}(),pn="data-amp-mask",hn="*****",gn=/\b(?:\d[ -]*?){13,16}\b/,mn=/(\d{3}-?\d{2}-?\d{4})/g,yn=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,bn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(gn,hn)).replace(mn,hn)).replace(yn,hn);try{for(var o=l(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,hn)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},wn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(pn)?hn:e?e(document.title):document.title},En={};Object.defineProperty(En,"__esModule",{value:!0}),En.Observable=void 0;const Sn=e=>Boolean(Symbol[e]),Tn=e=>Sn(e)?Symbol[e]:"@@"+e,kn=Tn("iterator"),Pn=Tn("observable"),xn=Tn("species");function In(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function _n(e){let t=e.constructor;return void 0!==t&&(t=t[xn],null===t&&(t=void 0)),void 0!==t?t:Mn}function An(e){An.log?An.log(e):setTimeout(()=>{throw e})}function On(e){Promise.resolve().then(()=>{try{e()}catch(e){An(e)}})}function Cn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=In(t,"unsubscribe");e&&e.call(t)}}catch(e){An(e)}}function Rn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function Dn(e,t,n){e._state="running";let r=e._observer;try{let i=In(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(Rn(e),!i)throw n;i.call(r,n);break;case"complete":Rn(e),i&&i.call(r)}}catch(e){An(e)}"closed"===e._state?Cn(e):"running"===e._state&&(e._state="ready")}function Ln(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void On(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(Dn(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void Dn(e,t,n);e._queue.push({type:t,value:n})}}class Nn{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){Ln(n,"next",e)},error(e){Ln(n,"error",e)},complete(){Ln(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(Rn(this),Cn(this))}}class Mn{constructor(e){if(!(this instanceof Mn))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new Nn(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(_n(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(_n(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=_n(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new 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=_n(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=_n(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 a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[Pn](){return this}static from(e){let t="function"==typeof this?this:Mn;if(null==e)throw new TypeError(e+" is not an object");let n=In(e,Pn);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof Mn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(Sn("iterator")&&(n=In(e,kn),n))return new t(t=>{On(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{On(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:Mn)(t=>{On(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[xn](){return this}}En.Observable=Mn,Object.defineProperty(Mn,Symbol("extensions"),{value:{symbol:Pn,hostReportError:An},configurable:!0});var jn=En.Observable;function Un(e,t){return new jn(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 Fn(e,t){return new jn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=l(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o})}function qn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new jn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=l(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=l(t),s=a.next();!s.done;s=a.next()){var u=s.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=l(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var Bn,Hn="https://app.amplitude.com",Vn={US:Hn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var zn="__AMPLITUDE_MESSENGER_INSTANCE__",Wn="__AMPLITUDE_MESSENGER__",Kn=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Hn:t;this[Bn]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var s=l(a),u=s.next();!u.done;u=s.next()){t(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.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 u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===Hn&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var s=e.data,u=null==s?void 0:s.action;if(u)if("id"in s&&s.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(s);else{if("ping"===u)return void r.notify({action:"pong"});var l=r.actionHandlers.get(u);if(l)l(s.data);else{var c=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];c.push(s.data),r.pendingMessages.set(u,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=V();(null==e?void 0:e[Wn])===this&&delete e[Wn]},e}();function Yn(e){var t,n=V(),r=null==n?void 0:n[Wn];if("object"==typeof(t=r)&&null!==t&&zn in t&&!0===t[zn])return r;var i=new Kn(e);return n&&(n[Wn]=i),i}Bn=zn;var $n=["desktop","tablet","mobile"],Gn="__AMPLITUDE_BACKGROUND_CAPTURE__";function Jn(e,t){var n,r=e;if(!0!==r[Gn]){r[Gn]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",a=null,s=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){var n,r;null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Initializing background capture (external script)");var u=new URL(i,e.endpoint).toString(),l=t&&"object"==typeof t?function(e){if("string"==typeof e)return $n.includes(e)?e:void 0}(t.deviceMode):void 0;e.loadScriptOnce(u).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),a=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,o({messenger:e,onBackgroundCapture:s},void 0!==l?{initialDeviceMode:l}:{})),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a),a=null})}}var Xn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Qn(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 Zn(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,position:n,percent_completed:Qn(n,r)},void 0!==t?{stop_reason:t}:{})}function er(e){var t=e;return t.srcObject||t.currentSrc||t.src||e.getAttribute("src")}function tr(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 nr(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,s,l,d;return u(this,function(u){switch(u.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=c.apply(void 0,[u.sent(),2]),a=i[0],s=i[1],l={},"mux"===n){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(e){}}return[2,o(o({duration:a,position:s,percent_completed:Qn(s,a)},void 0!==r?{stop_reason:r}:{}),l)]}})})}function rr(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){nr(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'play' handler: ".concat(e))})};e.on("play",a),r.push(function(){return e.off("play",a)});var l=function(){nr(e,i,n,"ended").then(function(e){t.onEnded(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(e))})};e.on("ended",l),r.push(function(){return e.off("ended",l)});var c=function(){nr(e,i,n,"paused").then(function(e){t.onPause(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(e))})};e.on("pause",c),r.push(function(){return e.off("pause",c)});var d=function(){o=!0,nr(e,i,n,"seeking").then(function(e){t.onSeeking(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(e))})};e.on("seeking",d),r.push(function(){return e.off("seeking",d)});var f=function(){o=!1,nr(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(e))})};e.on("seeked",f),r.push(function(){return e.off("seeked",f)});var v=function(){(function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return[2,{currentTime:t.sent()}]}})})})(e).then(function(e){var n={position:e.currentTime,isSeeking:o};t.onTimeUpdate(n)}).catch(function(e){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(e))})};if(e.on("timeupdate",v),r.push(function(){return e.off("timeupdate",v)}),e.getPaused)try{e.getPaused(function(e){!1===e&&a()})}catch(e){t.onError("Error getting paused state from 'ready' handler: ".concat(e))}};return e.on("ready",i),function(){e.off("ready",i),r.forEach(function(e){return e()})}}var ir=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,a=this;this.state={playbackState:"paused"},this.waitingInterval=null,this.handler={onPlay:function(e){a.updatePlaybackState("playing",e)},onPause:function(e){a.updatePlaybackState("paused",e)},onEnded:function(e,t){a.updatePlaybackState("ended",e,t)},onSeeking:function(){var e=o(o({},a.state),{isSeeking:!0});a.updateState(e)},onSeeked:function(e){var t=o(o({},a.state),{isSeeking:!1,position:e.position});a.updateState(t)},onError:function(e){a.updateStateWithError(e)},onTimeUpdate:function(e){a.updateTime(e)}},this.onStateChange=n,this.untrack=i?rr(t,this.handler,r):function(e,t,n){var r=!1,i=function(){r=!1;var i=o(o({},Zn(e)),"mux"===n?tr(e):{});t.onPlay(i)};e.addEventListener("play",i);var a=function(){if(!r){r=!0;var i=o(o({},Zn(e,"ended")),"mux"===n?tr(e):{});t.onEnded(i)}};e.addEventListener("ended",a);var s=function(){if(!0!==e.ended){var r=o(o({},Zn(e,"paused")),"mux"===n?tr(e):{});t.onPause(r)}else a()};e.addEventListener("pause",s);var u=function(){var r=o(o({},Zn(e,"seeking")),"mux"===n?tr(e):{});t.onSeeking(r)};e.addEventListener("seeking",u);var l=function(){var r=o(o({},Zn(e)),"mux"===n?tr(e):{});t.onSeeked(r)};e.addEventListener("seeked",l);var c=function(){var n;t.onError((n=e.error)?"Media element error (code ".concat(n.code,")").concat(n.message?": ".concat(n.message):""):"Media element error")};e.addEventListener("error",c);var d=null,f=function(){var a=e,s=e.duration,u="number"!=typeof s||Number.isNaN(s),l=!u&&!0!==a.ended&&!1===a.paused;r&&null===d&&l&&i();var c={position:e.currentTime,isSeeking:!!a.seeking};t.onTimeUpdate(c),r&&u||(r&&null===d&&!0!==a.ended&&(r=!1),d=Zn(e),"mux"===n&&(d=o(o({},d),tr(e))))};e.addEventListener("timeupdate",f);var v=function(e){d&&!r&&(r=!0,t.onEnded(d,e)),d=null},p=er(e),h=function(){var t=er(e);t!==p&&(p=t,v("content_changed"))};e.addEventListener("loadstart",h);var g=function(){return v("content_changed")};e.addEventListener("emptied",g);var m=e;return!1===m.paused&&!0!==m.ended&&i(),function(){e.removeEventListener("play",i),e.removeEventListener("ended",a),e.removeEventListener("pause",s),e.removeEventListener("seeking",u),e.removeEventListener("seeked",l),e.removeEventListener("error",c),e.removeEventListener("timeupdate",f),e.removeEventListener("loadstart",h),e.removeEventListener("emptied",g)}}(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch(e){}},e.prototype.updateStateWithError=function(e){this.clearWaitingInterval();var t=this.state,n=o(o({},t),{playbackState:"error",errorMessage:e,cause:void 0});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t,n){var r=this,i=this.state.playbackState,a=!!this.state.isSeeking&&("ended"===e||"playing"===e&&"ended"===i),s=o(o(o({},this.state),{playbackState:e,errorMessage:void 0,lastEvent:t,position:t.position,cause:n}),a?{isSeeking:!1}:{});if(this.updateState(s),this.clearWaitingInterval(),"playing"===e){var u=this.state.position;this.waitingInterval=setInterval(function(){var e=r.state.position;"playing"===r.state.playbackState&&"number"==typeof u&&u===e&&r.updateState(o(o({},r.state),{playbackState:"waiting"})),u=e},1e3)}},e.prototype.clearWaitingInterval=function(){this.waitingInterval&&(clearInterval(this.waitingInterval),this.waitingInterval=null)},e.prototype.updateTime=function(e){var t,n,r=this.state.lastEvent,i="waiting"===this.state.playbackState,a="playing"===this.state.playbackState;if(r&&(a||i)){var s=e.isSeeking||this.state.isSeeking,u=null!==(t=this.state.position)&&void 0!==t?t:0,l=e.position;if(s)this.state=o(o({},this.state),{position:l});else{var c=l-u,d=o(o({},this.state),{playbackState:"playing",position:l,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+c});this.updateState(d)}}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.clearWaitingInterval(),this.untrack()},e}();function or(e,t,n){var r,i,o=[];try{for(var a=l(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(e){n.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function ar(e){var t,n,r,i,o,a,s,u,f,v,p,h,g;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var m=Object.keys(e);try{for(var y=l(m),b=y.next();!b.done;b=y.next()){var w=b.value;try{var E=e[w];"boolean"==typeof(null==E?void 0:E.enabled)&&(E.enabled?(delete E.enabled,0===Object.keys(E).length&&(e[w]=!0)):e[w]=!1),ar(E)}catch(e){}}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}try{if(null===(f=null===(u=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===u?void 0:u.captureRules)||void 0===f?void 0:f.length)try{for(var S=l(e.autocapture.networkTracking.captureRules),T=S.next();!T.done;T=S.next()){var k=T.value;try{for(var P=(o=void 0,l(["responseHeaders","requestHeaders"])),x=P.next();!x.done;x=P.next()){var I=x.value,_=null!==(v=k[I])&&void 0!==v?v:{},A=_.captureSafeHeaders,O=_.allowlist;(A||O)&&(void 0===O||Array.isArray(O)?k[I]=d(d([],c(A?D:[]),!1),c(null!=O?O:[]),!1):delete k[I])}}catch(e){o={error:e}}finally{try{x&&!x.done&&(a=P.return)&&a.call(P)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}}catch(e){}void 0!==(null===(p=e.autocapture)||void 0===p?void 0:p.pageViews)&&(e.autocapture.screenViews=e.autocapture.pageViews);var C=null===(h=e.autocapture)||void 0===h?void 0:h.frustrationInteractions;C&&(C.rageClick&&(C.rageClicks=C.rageClick,delete C.rageClick),C.deadClick&&(C.deadClicks=C.deadClick,delete C.deadClick),C.errorClick&&(C.errorClicks=C.errorClick,delete C.errorClick));try{var R=null===(g=e.autocapture)||void 0===g?void 0:g.elementInteractions;if(R&&"object"==typeof R&&(!0===R.viewportContentUpdated&&(R.viewportContentUpdated={}),!1===R.viewportContentUpdated&&(R.viewportContentUpdated={enabled:!1}),void 0!==R.exposureDuration)){var L=R.viewportContentUpdated;void 0===L?R.viewportContentUpdated={exposureDuration:R.exposureDuration}:"object"==typeof L&&void 0===L.exposureDuration&&!1!==L.enabled&&(L.exposureDuration=R.exposureDuration),delete R.exposureDuration}}catch(e){}}}function sr(e){var t;if(e)try{var n=null===(t=V())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,u=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:a,fragment:r,href:e,hrefWithoutQueryOrHash:s,host:null!==(t=null==u?void 0:u[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function ur(e){return{event_type:"[Amplitude] Network Request",event_properties:o(o(o({"[Amplitude] URL":e.url.hrefWithoutQueryOrHash,"[Amplitude] URL Query":e.url.query,"[Amplitude] URL Fragment":e.url.fragment,"[Amplitude] Request Method":e.method,"[Amplitude] Status Code":e.statusCode,"[Amplitude] Start Time":e.startTime,"[Amplitude] Completion Time":e.completionTime,"[Amplitude] Duration":e.duration,"[Amplitude] Request Body Size":e.requestBodySize,"[Amplitude] Response Body Size":e.responseBodySize,"[Amplitude] Request Type":e.requestType,"[Amplitude] Request Headers":e.requestHeaders,"[Amplitude] Response Headers":e.responseHeaders},"requestBody"in e&&{"[Amplitude] Request Body":e.requestBody}),"responseBody"in e&&{"[Amplitude] Response Body":e.responseBody}),e.error&&{"[Amplitude] Error Code":e.error.code,"[Amplitude] Error Message":e.error.message})}}var lr=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=V();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},cr=function(e){return lr(e,"attribution")},dr=function(e){return lr(e,"formInteractions")},fr=function(e){return lr(e,"pageViews")},vr=function(e){return lr(e,"pageUrlEnrichment")},pr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},hr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},gr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},mr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},yr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},br=function(e){if(hr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},wr=function(e){if(mr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},Er=function(e){if(pr(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),o(o({},t),{captureRules:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),a=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),o(o({},e),{hosts:void 0})}return e}))})}var n,r},Sr=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return fr(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}};var Tr="2.50.0-video-analytics-plus-page-x-y.0",kr="amplitude-ts-sdk-script",Pr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(kr,"/").concat(Tr),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a;return u(this,function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,a=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:je()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:W(),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:a,library:this.library,user_agent:this.userAgent})]})})},e}(),xr=function(e){var t;void 0===e&&(e={});var n,r,i=V(),a=void 0,l=!1,c=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,v=void 0===f?w:f,p=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},h=function(e){return s(void 0,void 0,void 0,function(){var t,r,i,a,s,l,c;return u(this,function(u){switch(u.label){case 0:return t=_r(),r=Ar(),i=Je(n.apiKey),a=p("undefined"!=typeof location&&location.href||""),l={event_type:v},s=[{}],[4,Or()];case 1:return[2,(l.event_properties=o.apply(void 0,[o.apply(void 0,s.concat([u.sent()])),(c={"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":a,"[Amplitude] Page Path":"undefined"!=typeof location&&p(location.pathname)||"","[Amplitude] Page Title":wn(bn),"[Amplitude] Page URL":a.split("?")[0],"[Amplitude] Min Page Y":t,"[Amplitude] Viewport Width":r},c[$e]=i,c["[Amplitude] Page View ID"]=e,c)]),l)]}})})},g=function(){return void 0===c||"function"==typeof c&&c()},m="undefined"!=typeof location?location.href:null,y=function(){s(void 0,void 0,void 0,function(){var e,i,o,s,l;return u(this,function(u){switch(u.label){case 0:return e=location.href,i=Rr(d,e,m||"")&&g(),m=e,i?(o=void 0,r&&(o=Ke(n.apiKey,Ir())),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return l=(s=t).track,[4,h(o)];case 2:l.apply(s,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},b={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,c,d;return u(this,function(u){switch(u.label){case 0:if(t=o,n=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),l=!0,Je(n.apiKey),i){try{r=new st(i.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",y),["pushState","replaceState"].forEach(function(e){i.history[e]=new Proxy(i.history[e],{apply:function(t,n,r){var i=location.href,o=t.apply(n,r);return!l||"pushState"!==e&&location.href===i||y(),o}})})}return g()?(a.log("Tracking page view event"),s=void 0,r&&(s=Ke(n.apiKey,Ir())),d=(c=t).track,[4,h(s)]):[3,2];case 1:d.apply(c,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,i,s;return u(this,function(u){switch(u.label){case 0:return!0===(null===(s=e.extra)||void 0===s?void 0:s.engagedTimeReplay)?[2,e]:"attribution"===c&&Cr(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=Ye(n.apiKey)),[4,h(t)]):[3,2];case 1:i=u.sent(),e.event_type=i.event_type,e.event_properties=o(o({},e.event_properties),i.event_properties),u.label=2;case 2:return n&&e.event_type===v&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",y),l=!1),[2]})})}};return b},Ir=function(){return"undefined"!=typeof location&&location.href||""},_r=function(){var e,t,n=V();if(!n)return 0;var r=null!==(t=null!==(e=n.scrollY)&&void 0!==e?e:n.pageYOffset)&&void 0!==t?t:0;return Math.floor(r)},Ar=function(){var e,t=V();return t&&null!==(e=t.innerWidth)&&void 0!==e?e:0},Or=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=tt,[4,(new vn).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Cr=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[r.SET]||{},i=t[r.UNSET]||{},o=d(d([],c(Object.keys(n)),!1),c(Object.keys(i)),!1);return Object.keys(R).every(function(e){return o.includes(e)})}return!1},Rr=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n};function Dr(e,t,n,r){return void 0===r&&(r=2147483647),void 0===e?t:!Number.isFinite(e)||e<=0||e>r?(n.warn("Page engagement: invalid duration ".concat(e," ms; using default ").concat(t," ms. Expected 0 < finite duration <= ").concat(r," ms.")),t):e}var Lr=function(e,t,n,r,i){var a,s,u=h(),l=!0,c=!1,d=[],f=Dr(n.inactivityTimeoutMillis,18e4,r.loggerProvider,864e5),v=Dr(n.activityWindowMillis,5e3,r.loggerProvider),p=Math.min(Dr(n.heartbeatIntervalMillis,15e3,r.loggerProvider),f/2);function h(){return"visible"===t.document.visibilityState&&t.document.hasFocus()}function g(e){var t=Math.max(e.updated,Math.min(Date.now(),e.lastActivity+f));u&&(e.engaged+=Math.max(0,Math.min(t,e.lastActivity+v)-e.updated)),e.updated=t}function m(e,t){g(e);var n=++e.version;return o(o(o({},e.event),"initial"===t?{}:{extra:o(o({},e.event.extra),{engagedTimeReplay:!0})}),{event_properties:o(o({},e.event.event_properties),{"[Amplitude] Engaged Time":e.engaged,"[Amplitude] Total Time":e.updated-e.started,"[Amplitude] Snapshot Version":n,"[Amplitude] Engagement Snapshot Reason":t})})}function y(){clearTimeout(s),s=setTimeout(function(){return k("inactivity")},f)}var b=function(){l&&!c&&u&&!t.document.prerendering&&(a&&Date.now()>=a.lastActivity+f&&k("inactivity"),a?(g(a),a.lastActivity=Date.now(),y()):i())},w=function(){"visible"===t.document.visibilityState&&(a&&g(a),u=!0,b())},E=function(){a&&g(a),u=!1,a&&S(a)};function S(t){var n=void 0===t.lastBackgroundSent?0:t.lastBackgroundSent+1e3-Date.now();n>0?void 0===t.backgroundTimer&&(t.backgroundTimer=setTimeout(function(){t.backgroundTimer=void 0,S(t)},n)):(clearTimeout(t.backgroundTimer),t.backgroundTimer=void 0,t.lastBackgroundSent=Date.now(),t.nextSnapshotReason="background",t.heartbeat.heartbeat(),e.flush())}function T(e,t){clearInterval(e.pulseTimer),clearTimeout(e.backgroundTimer),clearTimeout(s);var n=m(e,t);n.delay=o(o({},n.delay),{timeout:void 0}),e.heartbeat.update(n),e.heartbeat.pause(),a=void 0}function k(t){c=!1;var n=a;n&&(T(n,t),Promise.resolve().then(function(){n.heartbeat.heartbeat(),e.flush(),n.heartbeat.stop()}))}var P=function(e,t,n){e.addEventListener(t,n,{passive:!0}),d.push(function(){return e.removeEventListener(t,n)})};return["pointerdown","pointermove","keydown","scroll","touchstart","wheel"].forEach(function(e){P(t.document,e,b)}),P(t,"focus",w),P(t,"blur",E),P(t.document,"visibilitychange",function(){return h()?w():E()}),P(t,"pagehide",function(){return k("pagehide")}),P(t,"pageshow",function(){h()&&w()}),{start:function(t){var n;if(k("navigation"),l){var i=Date.now();u=h();var s={event:o(o({},t),{event_properties:o({},t.event_properties),insert_id:t.insert_id||W(),time:null!==(n=t.time)&&void 0!==n?n:i,delay:{id:W(),timeout:f}}),heartbeat:new ke(e,p,f,r.loggerProvider,{sendOnPageLifecycle:!1,beforeHeartbeat:function(){a===s&&(Date.now()>=s.lastActivity+f?T(s,"inactivity"):(s.heartbeat.update(m(s,s.nextSnapshotReason)),s.nextSnapshotReason="heartbeat"))}}),started:i,updated:i,lastActivity:i,engaged:0,version:0,nextSnapshotReason:"heartbeat"};delete s.event.user_properties;var d=m(s,"initial"),v=!1;try{v=s.heartbeat.enqueue(d)}catch(e){s.heartbeat.stop()}return v?(a=s,y(),s.pulseTimer=setInterval(function(){s.heartbeat.heartbeat()},p),d):(c=!0,void r.loggerProvider.warn("Page engagement: snapshot cannot be queued (invalid data or size limit); sending without engaged-time tracking."))}},finish:k,setOptOut:function(e){l=!e,e&&(c=!1,clearTimeout(s),clearTimeout(null==a?void 0:a.backgroundTimer),clearInterval(null==a?void 0:a.pulseTimer),null==a||a.heartbeat.stop(),a=void 0)},teardown:function(){k("teardown"),l=!1,d.forEach(function(e){return e()})}}},Nr=function(e){var t,n;void 0===e&&(e={});var r,i,a,s,u,l=null!==(t=e.pageViewEventType)&&void 0!==t?t:w,c=null!==(n=e.secondaryPageViewEventType)&&void 0!==n?n:l,d=!1,f=!1,v=0,p=0,h=[],g=Promise.resolve(),m=function(e){v+=1,null==r||r.finish(e)};return{name:"@amplitude/plugin-engaged-time-tracking-browser",type:"enrichment",setup:function(t,n){i=t;var l=V();if(!(null==l?void 0:l.document))return g;f=!0;var m=l.document,y=function(e,t,n){e.addEventListener(t,n),h.push(function(){return e.removeEventListener(t,n)})};y(l,"pagehide",function(){d=!0,v+=1}),y(l,"pageshow",function(){d=!1});(r=Lr(n,l,e,t,function(){!function(){if(!f||d||t.optOut||m.prerendering||l.location.href!==a||(null==s?void 0:s.revision)===p&&s.cancellation===v)return g;var e={revision:p,cancellation:v,href:l.location.href};s=e;var r={event_type:c,extra:{engagedTimeContext:e}};n.track(r).promise.finally(function(){s===e&&(s=void 0)})}()})).setOptOut(t.optOut);var b="@amplitude/plugin-engaged-time-tracking-browser/context";return n.add({name:b,type:"before",execute:function(e){var t,n,r,i,a=null===(t=e.extra)||void 0===t?void 0:t.engagedTimeContext;return!0===(null===(n=e.extra)||void 0===n?void 0:n.engagedTimeReplay)||void 0===(null==a?void 0:a.revision)||a.revision===p&&a.cancellation===v&&a.href===l.location.href?(!0===(null===(r=e.extra)||void 0===r?void 0:r.engagedTimeReplay)||(null===(i=e.extra)||void 0===i?void 0:i.engagedTimeContext)||(e.extra=o(o({},e.extra),{engagedTimeContext:{cancellation:v,href:l.location.href}})),Promise.resolve(e)):Promise.resolve(null)}}).promise.then(function(){u=function(){return n.remove(b).promise}})},execute:function(e){var t,n,o,s=null===(t=e.extra)||void 0===t?void 0:t.engagedTimeContext;return r&&!0!==(null===(n=e.extra)||void 0===n?void 0:n.engagedTimeReplay)&&(e.event_type===l||e.event_type===c&&void 0!==(null==s?void 0:s.revision))?d||i.optOut||s&&s.cancellation!==v||void 0!==(null==s?void 0:s.revision)&&s.revision!==p?Promise.resolve(null):void 0!==(null==s?void 0:s.href)&&s.href!==V().location.href?Promise.resolve(void 0!==s.revision?null:e):(a=V().location.href,p+=1,Promise.resolve(null!==(o=r.start(e))&&void 0!==o?o:e)):Promise.resolve(e)},teardown:function(){var e;return f=!1,v+=1,null==r||r.teardown(),r=void 0,h.forEach(function(e){return e()}),null!==(e=null==u?void 0:u())&&void 0!==e?e:g},onOptOutChanged:function(e){return e&&(v+=1),null==r||r.setOptOut(e),g},onReset:function(){return m("reset"),g},onIdentityChanged:function(e){return("userId"in e||"deviceId"in e)&&m("identity_change"),g},onSessionIdChanged:function(){return m("session_change"),g}}},Mr="[Amplitude]",jr="".concat(Mr," Form Started"),Ur="".concat(Mr," Form Submitted"),Fr="".concat(Mr," File Downloaded"),qr="session_start",Br="session_end",Hr="".concat(Mr," File Extension"),Vr="".concat(Mr," File Name"),zr="".concat(Mr," Link ID"),Wr="".concat(Mr," Link Text"),Kr="".concat(Mr," Link URL"),Yr="".concat(Mr," Form ID"),$r="".concat(Mr," Form Name"),Gr="".concat(Mr," Form Destination"),Jr="cookie",Xr="US",Qr=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return t=function(e){if(dr(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,a=function(e){if(!o.has(e)){o.add(e);var a=!1;r(e,"change",function(){var t,n=ei(e);a||i.track(jr,((t={})[Yr]=Zr(e.id),t[$r]=Zr(e.name),t[Gr]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=ei(e);if(a||i.track(jr,((o={})[Yr]=Zr(e.id),o[$r]=Zr(e.name),o[Gr]=u,o)),a=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(Ur,((s={})[Yr]=Zr(e.id),s[$r]=Zr(e.name),s[Gr]=u,s)),a=!1})}};Array.from(document.getElementsByTagName("form")).forEach(a),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&a(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(a)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(a=V())?a.addEventListener("load",o):n.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 u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},Zr=function(e){if("string"==typeof e)return e},ei=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},ti=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,o;return u(this,function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;a&&r.track(Fr,((t={})[Hr]=a,t[Vr]=n.pathname,t[zr]=e.id,t[Wr]=e.text,t[Kr]=e.href,t))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=V())?o.addEventListener("load",i):n.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 u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}};function ni(e,t){var n,r;if(e){ar(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",Z(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var a=o({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){a.elementInteractions=o({},i.autocapture.elementInteractions);var s=a.elementInteractions,u=null!==(r=s.pageUrlAllowlist)&&void 0!==r?r:[],c=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=or(u,c,t.loggerProvider),delete s.pageUrlAllowlistRegex}var d=function(e,t){var n,r,i,a,s;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var u=o({},e),c=null!==(a=u.captureRules)&&void 0!==a?a:[];try{for(var d=l(c),f=d.next();!f.done;f=d.next()){var v=f.value;v.urls=or(null!==(s=v.urls)&&void 0!==s?s:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u}}(i.autocapture.networkTracking,t.loggerProvider);d&&(a.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",Z(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var ri="1.32.0-video-analytics-plus-page-x-y.0",ii="[Amplitude] Element Clicked",oi="[Amplitude] Element Tag",ai="[Amplitude] Element Text",si="[Amplitude] Page URL",ui="[Amplitude] Viewport Height",li="[Amplitude] Viewport Width",ci="[Amplitude] Page View ID",di="data-amp-mask-attributes",fi="data-amp-internal-shadow";function vi(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=l(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function pi(e,t){return t.map(hi).join(" > ")}function hi(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(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}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var gi=":scope > ";function mi(e){var t;return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||null!=e&&11===e.nodeType&&1===(null===(t=e.host)||void 0===t?void 0:t.nodeType)}function yi(e){var t,n=e.getRootNode();return mi(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function bi(e,t){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:n=e,r=0,i=0,a.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return a.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return mi(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function wi(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=c(r.pop(),2),a=o[0],s=o[1],u=a.shadowRoot;if(u&&s+1<=t){n.push({root:u,depth:s+1});for(var l=u.children,d=0;d<l.length;d++)r.push([l[d],s+1])}var f=a.children;for(d=0;d<f.length;d++)r.push([f[d],s])}return n}function Ei(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=yi(r);n.push({root:o,target:r});var a=r.getRootNode();if(!mi(a))break;r=a.host}var s=n.length-1,u=!1,l=n;return s>t&&(l=n.slice(s-t),u=!0),{segments:l.reverse(),truncated:u}}function Si(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&mi(i)?"".concat(n,":nth-of-type(").concat(Ti(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(Ti(e,r.children),")")}function Ti(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var ki={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function Pi(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var a=n.charCodeAt(o);0!==a?a>=1&&a<=31||127===a||0===o&&a>=48&&a<=57||1===o&&a>=48&&a<=57&&45===n.charCodeAt(0)?i+="\\".concat(a.toString(16)," "):i+=0!==o||1!==r||45!==a?a>=128||45===a||95===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function xi(e){return Pi(e)}var Ii={name:"stableId",try:function(e,t){var n=vi(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(xi(n))}},_i=!1,Ai=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:d([],c([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:d([],c([/^(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-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:_i,maxShadowDomDepth:1});function Oi(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:_i,maxShadowDomDepth:Ri(e.maxShadowDomDepth)})}function Ci(e,t){if(!e)return Di();var n,r=Di();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=l(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=l(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Ri(e.maxShadowDomDepth),Oi(r)}function Ri(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Di(){return{enabled:Ai.enabled,explicitTrackingAttribute:Ai.explicitTrackingAttribute,autogeneratedIdPatterns:d([],c(Ai.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],c(Ai.unstableClassPatterns),!1),maxAncestorWalkDepth:Ai.maxAncestorWalkDepth,shadowDomEnabled:Ai.shadowDomEnabled,maxShadowDomDepth:Ai.maxShadowDomDepth}}var Li=[ki,Ii];function Ni(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Oi(t),c=null!==(o=n.strategies)&&void 0!==o?o:Li,d=null!==(s=null!==(a=n.scope)&&void 0!==a?a:e.ownerDocument)&&void 0!==s?s:document,f={scope:d,config:u},v=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,u.maxAncestorWalkDepth);try{for(var p=l(c),h=p.next();!h.done;h=p.next())for(var g=h.value,m=0;m<v.length;m++){var y=v[m],b=g.try(y,f);if(null!==b)if(0!==m){var w=pi(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(Mi(d,E,e,g.name,n.logger))return E}else if(Mi(d,b,e,g.name,n.logger))return b}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function Mi(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var a=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return 1===o.length&&o[0]===n}function ji(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var Ui=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Fi=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new Ui(Bi(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new Ui(a,!0)}var s=e.tagName.toLowerCase();if(o)return new Ui(s+Bi(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new Ui(s,!0);for(var c=qi(e),d=!1,f=!1,v=-1,p=-1,h=u.children,g=0;h&&(-1===v||!f)&&g<h.length;++g){var m=h[g];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!f&&m.tagName.toLowerCase()===s){d=!0;var y=new Set(c);if(y.size)for(var b=qi(m),w=0;w<b.length;++w){var E=b[w];if(y.has(E)&&(y.delete(E),!y.size)){f=!0;break}}else f=!0}}else v=p}var S=s;if(n&&"input"===s.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+Pi(e.getAttribute("type")||"")+"]"),f)S+=":nth-child("+String(v+1)+")";else if(d)try{for(var T=l(c),k=T.next();!k.done;k=T.next()){S+="."+Pi(k.value.slice(1))}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=T.return)&&i.call(T)}finally{if(r)throw r.error}}return new Ui(S,!1)},qi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},Bi=function(e){return"#"+Pi(e)};function Hi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Fi(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Vi(e,t){void 0===t&&(t={});var n=Oi(e),r=new Set,i=t.logger,o=function(e){return Hi(e,i)},a=function(e,r){var o;return null!==(o=Ni(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Oi(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=mi(a),u=[],l=e,f=0,v=!(o.shadowDomEnabled&&s);null!==l&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=vi(l,o);if(null!==p){var h=d(["".concat(l.tagName.toLowerCase(),"#").concat(xi(p))],c(u),!1).join(" > ");if(ji(a,h,e))return h}u.unshift(Si(l,o.shadowDomEnabled)),l=l.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===l?"".concat(gi).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&mi(t)?"".concat(gi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var r,u;try{return n.shadowDomEnabled?function(e,t){var r=Ei(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?a:s):(n.enabled?a:o)(e,null!==(u=null!==(r=t.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==u?u:document)}catch(t){var l=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(l)),Hi(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Oi(e);try{for(var a=l(r),s=a.next();!s.done;s=a.next()){var u=s.value;try{u(n)}catch(e){var c=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(c))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var zi,Wi,Ki=Object.freeze({enabled:!1,maxDepth:0}),Yi=function(){var e=Ki,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;try{for(var i=l(d([],c(t),!1)),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},$i=["input","select","textarea"],Gi=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Qe(window.location.href,n))&&!!Qe(window.location.href,t)},Ji=function(e,t){return function(n,r){var i,o,a=e.shouldTrackEventResolver,s=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!s)return!1;if(a)return a(n,r);if(!Gi(e))return!1;var u=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}if(t){var l=t.some(function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))});if(!l)return!1}switch(s){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},Xi=function(e){if(!(e instanceof HTMLElement))return!1;var t=e.getAttribute("contenteditable");return null!==t&&"false"!==t.toLowerCase()},Qi=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},Zi=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},eo=function(e,t,n){return void 0===n&&(n=Ki),n.enabled?no(e,t,n.maxDepth):to(e,t)},to=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:to(null==e?void 0:e.parentElement,t):null},no=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var a=l(bi(e,n)),s=a.next();!s.done;s=a.next()){var u=o(s.value);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return null},ro=function(e,t,n){return void 0===n&&(n=Ki),n.enabled?oo(e,t,n.maxDepth):io(e,t)},io=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},oo=function(e,t,n){var r=io(e,t),i=e instanceof Document?e.documentElement:e;return i?(wi(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},ao=function(e){var t;if(!e||"number"!=typeof e.detail||0===e.detail)return{};var n=e,r=n.pageX,i=n.pageY;return"number"==typeof r&&"number"==typeof i&&isFinite(r)&&isFinite(i)?((t={})["[Amplitude] Page X"]=Math.round(r),t["[Amplitude] Page Y"]=Math.round(i),t):{}},so=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function uo(e){if(!e)return"";try{var t=new URL(e);return t.search="",Ze(t.href)}catch(t){return Ze(e)}}function lo(e){var t,n;return void 0===e&&(e=V()),uo(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(Wi||(Wi={}));var co="__AMPLITUDE_VISUAL_TAGGING__";var fo=function(){var e,t,n,r,i=V();return{x:Math.floor(null!==(t=null!==(e=null==i?void 0:i.scrollX)&&void 0!==e?e:null==i?void 0:i.pageXOffset)&&void 0!==t?t:0),y:Math.floor(null!==(r=null!==(n=null==i?void 0:i.scrollY)&&void 0!==n?n:null==i?void 0:i.pageYOffset)&&void 0!==r?r:0)}};var vo=V(),po=function(e){return e.get()},ho={childList:!0,attributes:!0,characterData:!0,subtree:!0},go=function(e){return new jn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),mi(e)&&i.set(e,t),s.observe(e,ho))},a=function(e,t,n){var r=n-t;r<=0||wi(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},s=new MutationObserver(function(n){var r,o;t.next(n);try{var s=po(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!mi(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&a(e,t,s.maxDepth)})};try{for(var c=l(n),d=c.next();!d.done;d=c.next()){u(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){a(u,0,e.maxDepth)})}return function(){null==n||n(),s.disconnect()}}: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()}})},mo=function(e){return void 0===e&&(e="click"),new jn(function(t){var n,r=function(e){t.next(e)};return null===(n=V())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=V())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},yo=function(){var e=Fn(new jn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=o(o({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return vo.addEventListener("error",t),function(){vo.removeEventListener("error",t)}}),new jn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return vo.addEventListener("unhandledrejection",t),function(){vo.removeEventListener("unhandledrejection",t)}}));return Fn(e,new jn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Ut.addListener("error",t),function(){Ut.removeListener(t)}}))},bo=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},wo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Eo=function(e){var t,n,r,i,o=Object.values(wo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var a=l(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var c=(r=void 0,l(u.definition)),d=c.next();!d.done;d=c.next()){var f=d.value,v=wo[f.event_type];v&&o[v].add(u.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},So=function(e){var t,n,r,i,o=new Map;try{for(var a=l(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var c=(r=void 0,l(u.conditions)),d=c.next();!d.done;d=c.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(u)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},To=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return wo[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},ko=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=function(e,t){var n,r,i,o,a=new Set;try{for(var s=l(e),u=s.next();!u.done;u=s.next()){var c=u.value,d=t.get(c.id);if(d)try{for(var f=(i=void 0,l(d)),v=f.next();!v.done;v=f.next()){var p=v.value;a.add(p)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(To(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=l(i),a=o.next();!a.done;a=o.next()){var s=a.value;bo(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Po=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",di,pn,fi]),xo=["type"],Io=["svg","path","g"],_o=["password","hidden"];function Ao(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=Ki),null===e)return null;var c=String(e.tagName).toLowerCase(),d={tag:c},f=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&mi(n)?n.children:[]}(e,n.enabled));f.length&&(d.index=f.indexOf(e),d.indexOfType=f.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();v&&(d.prevSib=String(v));var p=e.getAttribute("id");p&&(d.id=String(p));var h=Array.from(e.classList);h.length&&(d.classes=h);var g={},m=Array.from(e.attributes).filter(function(e){return!Po.has(e.name)}),y=!function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t);return!$i.includes(r)&&!Xi(e)}(e);if(!_o.includes(String(e.getAttribute("type")))&&!Io.includes(c))try{for(var b=l(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!xo.includes(E.name)||(t.has(E.name)?g[E.name]=hn:g[E.name]=String(E.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(g).length&&(d.attrs=g),e.shadowRoot&&(d.attrs=o(o({},d.attrs||{}),((a={})[fi]="true",a)),d.shadow=!0),d}function Oo(e,t){return void 0===t&&(t=Ki),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=l(bi(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if("HTML"===s.tagName)break;i.push(s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var Co;var Ro=function(e,t){var n,r,i,a=this;this.setPageViewApiKey=function(e){a.pageViewApiKey=e},this.replaceSensitiveString=function(e){return bn(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o,s=performance.now();if(!e)return[];for(var u=a.getShadowMode(),f=Oo(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=Qi(h.getAttribute(di)),m=p===f.length-1?[]:null!==(r=v.get(f[p+1]))&&void 0!==r?r:new Set,y=new Set(d(d([],c(m),!1),c(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return Ao(e,null!==(t=v.get(e))&&void 0!==t?t:new Set,u)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=c(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(i))})};try{for(var w=l(o),E=w.next();!E.done;E=w.next())b(E.value)}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var S=performance.now();return null===(i=a.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?a.getText(t):a.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return null===(t=a.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateRemoteConfig=function(e,t){var n;if(null!=e){var r=e.elementSelector,i=null!==(n=e.elementInteractions)&&void 0!==n?n:{};return"boolean"==typeof i.shadowDomEnabled&&(r=o(o({},null!=r?r:{}),{shadowDomEnabled:i.shadowDomEnabled})),"number"==typeof i.maxShadowDomDepth&&(r=o(o({},null!=r?r:{}),{maxShadowDomDepth:i.maxShadowDomDepth})),a.updateSelectorConfig(r,t)}},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var s=Ci(e,t),u=a.selectorEngine.getConfig().enabled,l=a.shadowGate.get().enabled,c=a.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?Ki:Object.freeze({enabled:!0,maxDepth:n})}(s));a.selectorEngine.updateConfig(o(o(o({},r?s:a.selectorEngine.getConfig()),{shadowDomEnabled:c.enabled}),c.enabled&&{maxShadowDomDepth:c.maxDepth})),r&&u!==s.enabled&&(null==t||t.debug(s.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!l&&c.enabled&&(null===(n=a.diagnosticsClient)||void 0===n||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(c.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return a.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,u,l,d=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=a.getHierarchy(t),p=null===(s=v[0])||void 0===s?void 0:s.attrs,h=a.getNearestLabel(t),g=(u=null!=p?p:{},l=n,Object.entries(u).reduce(function(e,t){var n=c(t,2),r=n[0],i=n[1];if(r.startsWith(l)){var o=r.replace(l,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[oi]=d,r[ai]=a.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=a.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[si]=Ze(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=wn(a.replaceSensitiveString),r[ui]=window.innerHeight,r[li]=window.innerWidth,r),y=Ye(a.pageViewApiKey);if(y&&(m[ci]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=a.replaceSensitiveString(b)}return Zi(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=a.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){var s=a.getShadowMode(),u=function(e,t){var n,r;if(void 0===t&&(t=Ki),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var a=i[0];if(!(a instanceof Element))return null!=a?a:o;var s=Ei(a,t.maxDepth),u=s.segments;return s.truncated&&u.length>0?u[u.length-1].target:a}(o.event,s);if(i){var l=function(e,t){var n;if("click"!==t||!(e instanceof Element))return!1;var r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))}(u,o.type);if(l)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var c=eo(u,n,s);c&&(o.closestTrackedAncestor=c,o.targetElementProperties=a.getEventProperties(o.type,c,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?a.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(pn,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=l(o),u=s.next();!u.done;u=s.next()){var c=u.value;c.nodeType!==Node.TEXT_NODE?c instanceof Element&&(c.hasAttribute(pn)||Xi(c)?i+=hn:i+=a.getTextWithMaskedDescendants(c)):i+=c.textContent||""}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=a.getShadowMode();return t.enabled?function(e,t){var n,r;return!!Oo(e,t).some(function(e){return e.hasAttribute(pn)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(pn))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(pn,"]"))}(e)},this.getText=function(e){var t=a.hasMaskedAncestor(e),n=function(e){if(Xi(e))return!0;var t=e.closest("[contenteditable]");return!!t&&Xi(t)}(e);if(t||n)return hn;var r="";return r=e.querySelector("[".concat(pn,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(r.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[oi]=i,t[ai]=a.getText(e),t[si]=window.location.href.split("?")[0],t);return Zi(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Co||(Co=Vi(Ci())),Co),this.shadowGate=(zi||(zi=Yi()),zi);var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],u=[];try{for(var f=l(s),v=f.next();!v.done;v=f.next()){var p=v.value;if(u.length>=25)break;if(p instanceof RegExp)u.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{u.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u};function Do(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateRemoteConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var Lo,No=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function Mo(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new Map,s=new Map,u=new Set,l=function(e){var t=s.get(e);t&&(clearTimeout(t),s.set(e,null))},c=function(e){if(function(e){var t=V(),n=t.document.documentElement.clientHeight||t.innerHeight,r=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,a=Math.max(i.left,0),s=Math.min(i.right,r);if(o<-1||o>n+1||a>=s||i.width<=0)return!1;for(var u=No(e,t.getComputedStyle(e).position);u;){var l=t.getComputedStyle(u),c=l.overflowY&&"visible"!==l.overflowY,d=l.overflowX&&"visible"!==l.overflowX;if(c||d){var f=u.getBoundingClientRect();if(c&&(o<f.top-1||o>f.bottom+1))return!1;if(d&&(a=Math.max(a,f.left))>=(s=Math.min(s,f.right)))return!1}u=No(u,l.position)}return!0}(e)){if(!a.get(e)&&!s.get(e)){var t=setTimeout(function(){a.set(e,!0);var t=r.getElementPath(e);n(t),s.set(e,null)},o);s.set(e,t)}}else l(e)},d=t.exposureObservable,f=t.scrollObservable,v=d.subscribe(function(e){var t=e,n=t.target;t.isIntersecting?(u.add(n),c(n)):(u.delete(n),l(n))}),p=f.subscribe(function(){u.forEach(c)}),h=function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(c)}}}function jo(e){var t,n,r,i,o,a=e.mutationObservable,s=e.onRescan,u=e.onFlush,l=e.exposureDuration,c=e.quietMs,d=void 0===c?150:c,f=e.maxWaitMs,v=void 0===f?4e3:f,p=!1,h=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},g=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,h(),g(),s(),r=setTimeout(function(){r=void 0,u()},l+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){h(),g(),p=!1,y(),n=setTimeout(m,v)};return{start:function(){i||(i=a.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,h(),g()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Lo||(Lo={}));var Uo=function(e,t){var n,r,i,a,f,v,p,h,g,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ri);var w=e.dataAttributePrefix,E=void 0===w?qt:w,S=e.visualTaggingOptions,T=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:Ft,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Bt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var k=!1!==(null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.enabled),P=null!==(p=null!==(v=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==v?v:e.exposureDuration)&&void 0!==p?p:150;e.viewportContentUpdated=o(o({},e.viewportContentUpdated),{exposureDuration:P}),e.pageUrlExcludelist=null===(h=e.pageUrlExcludelist)||void 0===h?void 0:h.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var x,I,_="@amplitude/plugin-autocapture-browser",A=[],O=new Ro(e,t),C=new Set,R=new Set,D=new Set,L=function(){var t,n,r=qn(mo().map(function(t){return O.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=qn(new jn(function(t){var n,r=function(n){var r=O.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=V())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=V())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=qn(new jn(function(t){var n=function(n){var r=O.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=O.shadowGate,a=qn(go(o).map(function(t){return O.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new jn(function(e){var t,n,r=function(t){e.next(t)};return null===(t=V())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=V())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=V())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=V())||void 0===t||t.removeEventListener("resize",r)}}),u=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new jn(function(n){var r=V();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var a=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:0}),s=t.join(","),u=function(e){e instanceof Element&&e.matches(s)&&a.observe(e),e.querySelectorAll(s).forEach(function(e){a.observe(e)})},l=function(e){if(o)try{ro(e,s,po(o)).forEach(function(e){a.observe(e)})}catch(e){}},c=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&po(o).enabled?ro(e,s,po(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(c),c();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&l(r.document)}),f=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)u(e);else if(e instanceof Element)if(o&&po(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}l(e)}else u(e)})})});return function(){null==i||i(void 0),null==d||d(),f.unsubscribe(),a.disconnect()}})}(a,e.cssSelectorAllowlist,function(e){I=e},o);return(t={})[Lo.ChangeObservable]=i,t[Lo.ClickObservable]=r,t[Lo.MutationObservable]=a,t[Lo.NavigateObservable]=n,t[Lo.ScrollObservable]=s,t[Lo.ExposureObservable]=u,t},N=Eo(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=So(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),j=function(e,t,n,r){return new ko(e,t,n,r)}(N,M,O,e);return{name:_,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,function(){var r,i,a,s,l,f,v,p,h,g,m,y,b,w,S,U,F,q,B,H,z,W,K,Y,$,G,J,X,Q,Z,ee,te,ne,re,ie,oe,ae,se,ue,le,ce,de,fe;return u(this,function(u){return"undefined"==typeof document||(O.setPageViewApiKey(t.apiKey),Je(t.apiKey),r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=o(o({},e.pageActions),t),N=Eo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=So(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(N,M,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),!0===e.shadowDomEnabled&&("number"!=typeof(i=e.maxShadowDomDepth)&&(i=1),O.updateSelectorConfig({shadowDomEnabled:!0,maxShadowDomDepth:i})),(a=Do(t,O))&&A.push({unsubscribe:a}),s=Ji(e,e.cssSelectorAllowlist),l=Ji(e,e.actionClickAllowlist),f=L(),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(so).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(ii,o(o({},e.targetElementProperties),ao(e.event)))})}({allObservables:f,amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),A.push(v),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(so).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:f,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O.getEventProperties.apply(O,d(d([],c(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),A.push(p),h=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,a=e.shouldTrackEvent,s=e.shouldTrackActionClick,u=n.clickObservable,l=n.mutationObservable,c=n.navigateObservable,d=u.filter(function(e){return!a("click",e.closestTrackedAncestor)}).map(function(e){var t=eo(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(so).filter(function(e){return s("click",e.closestTrackedAncestor)}),f=c?Fn(l,c):l,v=Fn(d,f),p=null,h=null;return Un(v,function(e){if(p&&(clearTimeout(p),p=null),"click"===e.type)return h=e,p=setTimeout(function(){p=null,h=null},500),Promise.resolve(null);if(h){var t=h;return h=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){if(e){var n=e;null==t||t.track(ii,o(o({},i("click",n.closestTrackedAncestor)),ao(n.event)))}})}({allObservables:f,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O.getEventProperties.apply(O,d(d([],c(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,shouldTrackActionClick:l}),h&&A.push(h),g=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0,minY:0},r=!0,i=function(){var e=fo(),t=e.x,i=e.y;n.maxX=t,n.maxY=i,n.minY=i,r=!1};i();var o=t.subscribe(function(){var e=fo(),t=e.x,i=e.y;if(r)return n.maxX=t,n.maxY=i,n.minY=i,void(r=!1);n.maxX=Math.max(n.maxX,t),n.maxY=Math.max(n.maxY,i),n.minY=Math.min(n.minY,i)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0,n.minY=0,r=!0},isAwaitingSeed:function(){return r},seed:function(){return!!r&&(i(),!0)}}}({allObservables:f,amplitude:n}),A.push(g),m=o({},g.getState()),y=function(){g.seed();var e=g.getState();m.maxX=e.maxX,m.maxY=e.maxY,m.minY=e.minY},b=!1,w=!1,S=!1,F={},q=V(),H=function(){var e;g.reset();var t=g.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,D.clear(),C.clear(),R.clear(),null===(e=F.exposure)||void 0===e||e.reset(),null==B||B.reset()},z=function(){b=!0},W=function(e){if(b)return e?void H():void(w=!0);e&&(null==B||B.reset()),e&&r?H():(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,u=e.elementExposedInSentEvents,l=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,f=e.apiKey,v=o.getState(),p=V(),h=null!==(n=null==p?void 0:p.innerWidth)&&void 0!==n?n:0,g=null!==(r=null==p?void 0:p.innerHeight)&&void 0!==r?r:0,m=Array.from(a).filter(function(e){return!u.has(e)}),y=((t={})[si]=lo(p),t["[Amplitude] Max Page X"]=v.maxX+h,t["[Amplitude] Max Page Y"]=v.maxY+g,t["[Amplitude] Min Page Y"]=v.minY,t[ui]=g,t[li]=h,t[$e]=Je(f),t["[Amplitude] Element Exposed"]=m,t),b=Ye(f);b&&(y[ci]=b);var w=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,d.minY=e.minY,s.clear(),u.clear(),null==l||l.reset()};0!==m.length||v.maxX!==d.maxX||v.maxY!==d.maxY||v.minY!==d.minY?(null==i||i.track("[Amplitude] Viewport Content Updated",y),d.maxX=v.maxX,d.maxY=v.maxY,d.minY=v.minY,m.forEach(function(e){u.add(e)}),a.clear(),c&&w()):c&&w()}({amplitude:n,scrollTracker:g,currentElementExposed:D,elementExposedForPage:C,elementExposedInSentEvents:R,exposureTracker:F.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},Y=function(){K&&(clearTimeout(K),K=void 0)},$=function(){Y(),K=setTimeout(function(){K=void 0,G()},0)},G=function(){if(Y(),null==U||U.removeEventListener("abort",$),U=void 0,b){b=!1,g.reset(),y();var e=w,t=S;w=!1,S=!1,e&&W(t)}},J=function(){Y(),null==U||U.removeEventListener("abort",$),U=void 0,w=!1,S=!1},X=function(){U&&!U.aborted||G()},Q=function(e){Y(),null==U||U.removeEventListener("abort",$),U=void 0,e&&(e.aborted?G():(U=e,e.addEventListener("abort",$,{once:!0})))},Z=lo(q),ee=function(e){var t=lo(q);return t!==Z&&(b&&e&&e.deferScrollBaseline?(J(),H(),Z=t,!0):(Z=t,W(!0),(null==e?void 0:e.deferScrollBaseline)?(z(),!0):(y(),!1)))},te=function(e,t){var n=lo(q),r=function(e,t){var n;if(void 0===t&&(t=V()),null==e||""===e)return lo(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return uo(new URL(e,r).href)}catch(e){return lo(t)}}(t,q);n!==r?(Z=r,W(!0),e(),y()):e()},ne=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,C,R,D,W)},k&&(F.exposure=Mo({allObservables:f,onExposure:ne,dataExtractor:O,exposureDuration:P}),F.exposure&&A.push(F.exposure),B=jo({mutationObservable:f[Lo.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==I||I()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),W(!1)},exposureDuration:P}),B.start(),A.push({unsubscribe:function(){null==B||B.stop()}}),re=function(){if(b)return S=!0,w=!0,void G();W(!0)},null==q||q.addEventListener("beforeunload",re),x=function(){null==q||q.removeEventListener("beforeunload",re)},A.push({unsubscribe:function(){return x()}}),(ie=f[Lo.NavigateObservable])?(A.push(ie.subscribe(function(e){var t,n,r,i=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(i){var o=uo(i);if(o===Z)return;return b?(w=!1,S=!1,Z=o,W(!0),void Q(e.event.signal)):(Z=o,W(!0),z(),void Q(e.event.signal))}ee({deferScrollBaseline:!0})&&Q(null===(r=e.event)||void 0===r?void 0:r.signal)})),(oe=window.navigation)&&(oe.addEventListener("navigatesuccess",G),oe.addEventListener("navigateerror",X),A.push({unsubscribe:function(){J(),b=!1,oe.removeEventListener("navigatesuccess",G),oe.removeEventListener("navigateerror",X)}}))):q&&(ae=function(){ee()},q.addEventListener("popstate",ae),se=q.history.pushState,ue=q.history.replaceState,q.history&&se&&(q.history.pushState=new Proxy(se,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),q.history&&ue&&(q.history.replaceState=new Proxy(ue,{apply:function(e,t,n){te(function(){e.apply(t,n)},n[2])}})),A.push({unsubscribe:function(){q.removeEventListener("popstate",ae),q.history&&se&&(q.history.pushState=se),q.history&&ue&&(q.history.replaceState=ue)}}))),null===(fe=null==t?void 0:t.loggerProvider)||void 0===fe||fe.log("".concat(_," has been successfully added.")),window.opener&&T.enabled&&(le=e.cssSelectorAllowlist,ce=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[co]){n[co]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,u=function(t){e.notify({action:"element-selected",data:t})},l=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;s=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:l,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ri}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(de=Yn(),{dataExtractor:O,isElementSelectable:Ji(e,d(d([],c(le),!1),c(ce),!1)),cssSelectorAllowlist:le,actionClickAllowlist:ce}),Jn(de),de.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Vn[t.serverZone]})))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){try{for(e=l(A),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Fo=["mutation","navigate"];function qo(e,t){var n,r,i,o,a=t.event,s=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Bo(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:o({"[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 Ho(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,a=r.selectionObservable,l=[],c={},d=null;function f(e){l=[],c={},e&&(qo(c,e),l.push(e))}var v=Un(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return u(this,function(n){return qo(c,e),t=null,0===l.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(l,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(l,e)||c.isOutOfBounds?(d&&(t=Bo(l)),f(e)):l.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),l.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Bo(l))},1e3)}})]:[2,null]})})}),p=null==a?void 0:a.subscribe(function(){f()}),h=v.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var Vo,zo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Vo||(Vo={})),function(e){e.X="x",e.Y="y"}(zo||(zo={}));function Wo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function Ko(e){e.changes=[],e.startTime=void 0}function Yo(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var $o=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new jn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,s=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==s&&clearTimeout(s),Ko(n),Ko(i))}return t.subscribe(function(e){null!==s&&clearTimeout(s),function(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()}(e===zo.X?n:i);var t=function(e,t){var n=void 0;if(Wo(e)&&(n=e.startTime),Wo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,s=setTimeout(function(){u(),s=null},o)):u(),Yo(n),Yo(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},Go=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,s=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new jn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Vo.DECREASING&&e.next(zo.X),r=Vo.INCREASING):o.x<n.x&&(r===Vo.INCREASING&&e.next(zo.X),r=Vo.DECREASING),o.y>n.y?(i===Vo.DECREASING&&e.next(zo.Y),i=Vo.INCREASING):o.y<n.y&&(i===Vo.INCREASING&&e.next(zo.Y),i=Vo.DECREASING),n=o):n=o})})}({allWindowObservables:r});return $o({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){Gi(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Jo(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Xo=4e3,Qo=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var a=!1!==e.deadClicks&&null!==e.deadClicks,f=!1!==e.rageClicks&&null!==e.rageClicks,v=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(v=!1);var p=Jo(e,"rageClicks",Wt,f),h=Jo(e,"deadClicks",Vt,a),g=Jo(e,"errorClicks",zt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:qt,y=new Ro(e),b=d([],c(new Set(d(d(d([],c(p),!1),c(h),!1),c(g),!1))),!1),w=function(){var e,t,n=function(e){return qn(mo(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=qn(yo().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=qn(go(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=qn(new jn(function(e){var t=function(t){e.next(o(o({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var u=qn(new jn(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),l=qn(new jn(function(e){var t=function(t){e.next(t)},n={capture:!0};return vo.document.addEventListener("mousemove",t,n),function(){vo.document.removeEventListener("mousemove",t,n)}}));return(e={})[Lo.ClickObservable]=r,e[Lo.PointerDownObservable]=i,e[Lo.MutationObservable]=s,e[Lo.NavigateObservable]=t,e[Lo.BrowserErrorObservable]=a,e[Lo.SelectionObservable]=u,e[Lo.MouseMoveObservable]=l,e};return{name:n,type:"enrichment",setup:function(t,l){return s(void 0,void 0,void 0,function(){var s,c,d,b,E,S,T,k,P,x,I,_;return u(this,function(u){return"undefined"==typeof document||(y.setPageViewApiKey(t.apiKey),s=w(),(c=Do(t,y))&&r.push({unsubscribe:c}),f&&(d=Ji(e,p),b=Ho({allObservables:s,amplitude:l,shouldTrackRageClick:d}),r.push(b)),a&&(E=Ji(e,h),S=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,s=n.mutationObservable,u=n.navigateObservable,l=a.filter(function(e){return so(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Wi.LEFT_OR_TOUCH_CONTACT}),c=u?Fn(s,u):s,d=Fn(l,c),f=null;return Un(d,function(e){return f&&Fo.includes(e.type)?(clearTimeout(f),f=null,Promise.resolve(null)):"click"===e.type?f?Promise.resolve(null):new Promise(function(t){f=setTimeout(function(){t(e),f=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:l,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:E}),r.push(S)),i&&(T=Ji(e,g),k=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,a=n.browserErrorObservable,s=i.filter(function(e){return so(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Wi.LEFT_OR_TOUCH_CONTACT}),u=null,l=null,c=function(){null!==u&&(clearTimeout(u),u=null),l=null};return Fn(s,a).subscribe(function(e){var n;if("click"===e.type)return c(),l=e,void(u=setTimeout(c,2e3));"error"===e.type&&l&&(t.track("[Amplitude] Error Click",o(((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)),c())})}({amplitude:l,allObservables:s,shouldTrackErrorClick:T}),r.push(k)),v&&(P=void 0,x=void 0,"object"==typeof e.thrashedCursor&&(P=e.thrashedCursor.directionChanges,x=e.thrashedCursor.threshold,P&&P<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(P," is below the minimum of ").concat(5,", setting to ").concat(5)),P=5),x&&x>Xo&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(x," is above the maximum of ").concat(Xo,", setting to ").concat(Xo)),x=Xo)),I=Go({amplitude:l,options:e,allObservables:s,directionChanges:P,thresholdMs:x}),r.push(I)),null===(_=null==t?void 0:t.loggerProvider)||void 0===_||_.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=l(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function Zo(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 ea(e,t){var n,r=Zo(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],a=i.map(function(e){return e.sourceURL}).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),l=i.map(function(e){return e.invokerType}).filter(Boolean),c=i.map(function(e){return e.invoker}).filter(Boolean);return o(o(o(o(o(o(o({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),u.length>0&&{"[Amplitude] Main Thread Block Script Positions":u}),l.length>0&&{"[Amplitude] Main Thread Block Invoker Types":l}),c.length>0&&{"[Amplitude] Main Thread Block Invokers":c})}function ta(e,t){var n,r=Zo(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];return o(o({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function na(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=l(e.getEntries()),o=i.next();!o.done;o=i.next()){var s=o.value;a.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;a.length>0&&a[0].startTime<u;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,s;try{for(var u=l(e.getEntries()),c=u.next();!c.done;c=u.next()){var d=c.value;if(!Gi(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?ea(d,a):ta(d,a);t.track("[Amplitude] Main Thread Block",f)}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),s.disconnect()}}}var ra,ia,oa=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a,s,l;return u(this,function(u){return"undefined"==typeof document||(r&&(a=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(a=e.mainThreadBlock.durationThreshold),s=na({amplitude:o,options:e,durationThreshold:a}),n.push(s)),null===(l=null==i?void 0:i.loggerProvider)||void 0===l||l.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=l(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},aa="[Amplitude] Network Request",sa="500-599";function ua(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function la(e,t){var n,r,i=t.split(",");try{for(var o=l(i),a=o.next();!a.done;a=o.next()){var s=c(a.value.split("-").map(Number),2),u=s[0],d=s[1];if(e===u&&void 0===d)return!0;if(e>=u&&e<=d)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function ca(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],c(D),!1);if(void 0===e){return}}}function da(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function fa(e,t){var n;void 0===t&&(t={});var r=sr(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(ua(o,"*.amplitude.com")||ua(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return ua(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!la(e.status,sa))return!1;if(t.captureRules&&(d([],c(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return ua(t,e)}))&&(!r||!e.urls||Qe(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!la(n,e.statusCodeRange||sa))}(t,o,e.status,e.url,e.method),i){var n=ca(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=ca(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!da(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!da(t.requestBody)){u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===aa}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function va(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return fa(e.event,n)}).subscribe(function(e){var t,n,o=e.event,a=sr(o.url);if(a){var l=null===(t=o.responseWrapper)||void 0===t?void 0:t.bodySize,d=null===(n=o.requestWrapper)||void 0===n?void 0:n.bodySize;!function(e,t,n,r){s(this,void 0,void 0,function(){var i,o,a;return u(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=c.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(aa,e),[2]}})})}(ur({url:a,method:o.method,statusCode:o.status,startTime:o.startTime,completionTime:o.endTime,duration:o.duration,requestBodySize:d,responseBodySize:l,requestType:o.type,requestHeaders:o.requestHeaders,responseHeaders:o.responseHeaders}).event_properties,o,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(ra||(ra={}));var pa=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new jn(function(e){var n=new ln(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return fn.subscribe(n,t),function(){fn.unsubscribe(n)}});return(e={})[ra.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a;return u(this,function(s){return"undefined"!=typeof document||function(){var e,t=V();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(a=r(),t=null==i?void 0:i.loggerProvider,ia=va({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added.")),[2]):[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return ia.unsubscribe(),[2]})})}}},ha="web-vitals-browser",ga="[Amplitude] Web Vitals",ma={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let ya=-1;const ba=()=>ya,wa=e=>{addEventListener("pageshow",t=>{t.persisted&&(ya=t.timeStamp,e(t))},!0)},Ea=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},Sa=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Ta=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ka=()=>Ta()?.activationStart??0;let Pa=-1;const xa=new Set,Ia=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,_a=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of xa)e();isFinite(Pa)||(Pa="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",_a,!0))}},Aa=(e=!1)=>{if(e&&(Pa=1/0),Pa<0){const e=ka(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;Pa=t??Ia(),addEventListener("visibilitychange",_a,!0),addEventListener("prerenderingchange",_a,!0),wa(()=>{setTimeout(()=>{Pa=Ia()})})}return{get firstHiddenTime(){return Pa},onHidden(e){xa.add(e)}}},Oa=(e,t=-1,n,r=0,i,o,a)=>{const s=Ta(),u=s?.navigationId||0;let l="navigate";return n?l=n:ba()>=0?l="back-forward-cache":s&&(document.prerendering||ka()>0?l="prerender":document.wasDiscarded?l="restore":s.type&&(l=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:l,navigationId:r||u,navigationInteractionId:i,navigationURL:o||s?.name,navigationStartTime:a||0}},Ca=new WeakMap;function Ra(e,t){let n=Ca.get(t);return n||(n=new WeakMap,Ca.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class Da{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const La=(e,t,n={})=>{try{const r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},Na=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,Ma=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},ja=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Ua{l}const Fa=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},qa=[1800,3e3],Ba=(e,t={})=>{const n=Na(t);Fa(()=>{const r=Ra(t,Ua),i=Aa();let o,a=Oa("FCP");const s=La(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(a.value=Math.max(t.startTime-ka(),0),a.entries.push(t),a.navigationId=t.navigationId||a.navigationId,o(!0)))});s&&(o=Ea(e,a,qa,t.reportAllChanges),wa(n=>{a=Oa("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,ba()),o=Ea(e,a,qa,t.reportAllChanges),Sa(()=>{a.value=performance.now()-n.timeStamp,o(!0)})})),n&&La(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&Ma(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);a=Oa("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=Ea(e,a,qa,t.reportAllChanges),o(!0)})},t)})},Ha=[.1,.25],Va=(e,t={})=>{const n=Aa();Ba(ja(()=>{let r,i=Oa("CLS",0);const o=Ra(t,Da),a=(n,a,s,u,l)=>{i=Oa("CLS",0,n,a,s,u,l),o.i=0,r=Ea(e,i,Ha,t.reportAllChanges)},s=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},u=e=>{s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},l=e=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s()},c=["layout-shift"];Na(t)&&c.push("soft-navigation");const d=La(c,l);d&&(r=Ea(e,i,Ha,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),wa(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,ba()),Sa(r)}),setTimeout(r))}))};let za=0,Wa=1/0,Ka=0;const Ya=e=>{for(const t of e)t.interactionId&&(Wa=Math.min(Wa,t.interactionId),Ka=Math.max(Ka,t.interactionId),za=Ka?(Ka-Wa)/7+1:0)};let $a;const Ga=()=>$a?za:performance.interactionCount??0;class Ja{u=0;v=[];m=new Map;p;T;_(){return Ga()-this.u}M(){this.u=Ga(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.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.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}}const Xa=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=ja(e);let o=-1;const a=()=>{r(o),i()};addEventListener("visibilitychange",a,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",a,{capture:!0}),i()},{timeout:t})}},Qa=[200,500],Za=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Aa();Fa(()=>{"interactionCount"in performance||$a||($a=La(["event"],Ya,{durationThreshold:0}));let r,i=Oa("INP");const o=Ra(t,Ja),a=(n,a,s,u,l)=>{o.M(),i=Oa("INP",-1,n,a,s,u,l),r=Ea(e,i,Qa,t.reportAllChanges)},s=()=>{const e=o.L(i.navigationType);e&&e.P!==i.value&&(i.value=e.P,i.entries=e.entries,r())},u=e=>{s(),r(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},l=(e,t=!1)=>{Xa(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s(),t&&r(!0)})},c=["event","first-input"];Na(t)&&c.push("soft-navigation");const d=La(c,l,{...t,durationThreshold:t.durationThreshold??40});r=Ea(e,i,Qa,t.reportAllChanges),d&&(n.onHidden(()=>{l(d.takeRecords(),!0)}),wa(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,ba())}))})};class es{p;l;h(e){this.p?.(e)}}const ts=[2500,4e3],ns=(e,t={})=>{let n=!1;const r=Na(t);Fa(()=>{let i,o=Aa(),a=Oa("LCP");const s=Ra(t,es),u=(r,s,u,l,c)=>{a=Oa("LCP",-1,r,s,u,l,c),i=Ea(e,a,ts,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=Aa(!0))},l=e=>{s.l&&e.navigationId&&Ma(s.l,e),n||i(!0),u("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&c([t])},c=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){l(t);continue}let e=0,n=[],r=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-ka(),0),s.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const i=t;if(!a.navigationId)continue;if("interactionId"in i&&i.interactionId!=a.navigationInteractionId)continue;r=i.largestContentfulPaint?.renderTime||0,e=Math.max(r-t.startTime,0),i.largestContentfulPaint&&(s.h(i.largestContentfulPaint),n=[i.largestContentfulPaint])}r<o.firstHiddenTime&&(a.value=e,a.entries=n,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");const f=La(d,c);if(f){i=Ea(e,a,ts,t.reportAllChanges);const o=["keydown","click","visibilitychange"],s=e=>{if(e.isTrusted&&!n){const e=a.id;Xa(()=>{if(!n){if(!r){f.disconnect();for(const e of o)removeEventListener(e,s,{capture:!0})}e===a.id&&(n=!0,i(!0))}})}};for(const e of o)addEventListener(e,s,{capture:!0});wa(r=>{u("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,ba()),i=Ea(e,a,ts,t.reportAllChanges),Sa(()=>{a.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},rs=[800,1800],is=e=>{document.prerendering?Fa(()=>is(e)):"complete"!==document.readyState?addEventListener("load",()=>is(e),!0):setTimeout(e)},os=(e,t={})=>{const n=Na(t);let r=Oa("TTFB"),i=Ea(e,r,rs,t.reportAllChanges);is(()=>{const o=Ta();if(o){const a=o.responseStart;r.value=Math.max(a-ka(),0),r.entries=[o],i(!0),wa(()=>{r=Oa("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,ba()),i=Ea(e,r,rs,t.reportAllChanges),i(!0)}),n&&La(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=Oa("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Ea(e,r,rs,t.reportAllChanges),i(!0))})},t)}})};function as(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function ss(e,t){void 0===t&&(t=!1);var n={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(as(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var us=Object.values(ma);var ls=function(){var e,t=null,n=V(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,a=new Set;return{name:ha,type:"enrichment",setup:function(n,c){return s(void 0,void 0,void 0,function(){var s,d,f,v,p,h,g,m;return u(this,function(u){return void 0===r||(o=!0,s=new Map,d=-1,f=function(e){var t=e.navigationId,o=s.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var a=Ze(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":a,"[Amplitude] Page Path":Ze(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":Ze(a.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),s.set(t,o)),o},v=function(e){a.add(e);var t=s.get(e);t&&(s.delete(e),function(e){return us.some(function(t){return t in e})}(t)&&c.track(ga,t))},p=function(){var e,t;try{for(var n=l(Array.from(s.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;v(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},h=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=l(Array.from(s.keys())),o=i.next();!o.done;o=i.next()){var a=o.value;a<t&&v(a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},m={reportSoftNavs:!0},ns((g=function(e){return function(t){o&&!a.has(t.navigationId)&&(f(t)[e]=ss(t,!0),t.navigationId>d&&(-1!==d&&h(t.navigationId),d=t.navigationId))}})(ma.LCP),m),Ba(g(ma.FCP),m),Za(g(ma.INP),m),Va(g(ma.CLS),m),os(g(ma.TTFB),m),t=function(){"hidden"===r.visibilityState&&t&&p()},r.addEventListener("visibilitychange",t)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},cs=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=V();return e&&"PerformanceSoftNavigation"in e}()?ls():function(){var e=null,t=V(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:ha,type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return void 0===n||(o=Ze((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Ze((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Ze(o.split("?")[0],t.loggerProvider)},ns(function(e){a["[Amplitude] LCP"]=ss(e)}),Ba(function(e){a["[Amplitude] FCP"]=ss(e)}),Za(function(e){a["[Amplitude] INP"]=ss(e)}),Va(function(e){a["[Amplitude] CLS"]=ss(e)}),os(function(e){a["[Amplitude] TTFB"]=ss(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(ga,a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}}()},ds=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return X},get LogLevel(){return oe},get ServerZone(){return jt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Ft,DEFAULT_DATA_ATTRIBUTE_PREFIX:qt,DEFAULT_ACTION_CLICK_ALLOWLIST:Bt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Xn}),fs=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},vs=function(e,t,n,r,i,s){void 0===i&&(i=!0),e.referrer;var u=e.referring_domain,l=a(e,["referrer","referring_domain"]),c=t||{};c.referrer;var d,f=c.referring_domain,v=a(c,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var h=hs(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&ws(e.referring_domain,s)){if("always"===h)return gs(h,e.referring_domain,r),!1;if("ifEmptyCampaign"===h&&(d=o(o({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return gs(h,e.referring_domain,r),!1}}if(ps(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(l)!==JSON.stringify(v),m=fs(u||"")!==fs(f||""),y=!t||g||m;return y?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."),y},ps=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},hs=function(e,t){if(!0===e)return Xn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Xn).includes(n))return n;if(void 0===n)return Xn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function gs(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var ms,ys=["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"],bs=function(e){var t,n,r=e||(null===(n=null===(t=V())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],a=i[i.length-2];return ys.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},ws=function(e,t){var n=V();if(!n)return!1;var r,i,o,a=(t||"").trim()||bs(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Es=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=at(t.apiKey,"MKTG"),this.webExpStorageKey=at(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=R,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 u(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=c.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||Ne(this.sessionTimeout,this.lastEventTime),vs(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 u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new vn).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,a=(t=this.currentCampaign,n=this.options,r=o(o({},R),t),i=Object.entries(r).reduce(function(e,t){var r,i=c(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)},new j),te(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Ss=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),Ts=function(e){var t;void 0===e&&(e={});var n,r,i,a,l,c,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,f=V(),v={},p=!1,h=!1,g=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new vn).parse()];case 1:return e=t.sent(),v=tt(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",v)),[2]}})})},m=function(){g()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(o){switch(o.label){case 0:return n=t,r=e.loggerProvider,p=!0,r.log("Installing event property attribution tracking."),[4,g()];case 1:if(o.sent(),!f)return[2];if(f.addEventListener("popstate",m),!h){if(i=Reflect.get(f.history,"pushState"),a=Reflect.get(f.history,"replaceState"),!i||!a)return[2];l=y(i),f.history.pushState=l,c=y(a),f.history.replaceState=c,h=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return Ss.has(e.event_type)||(e.event_properties=o(o({},v),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){return f&&(f.removeEventListener("popstate",m),e=Reflect.get(f.history,"pushState"),t=Reflect.get(f.history,"replaceState"),h&&e===l&&i&&(f.history.pushState=i),h&&t===c&&a&&(f.history.replaceState=a)),p=!1,h=!1,i=void 0,a=void 0,l=void 0,c=void 0,v={},[2]})})}}},ks="AMP_CURRENT_PAGE",Ps="AMP_PREVIOUS_PAGE",xs="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(ms||(ms={}));var Is=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),_s=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=V(),i=void 0,a=!1,l=void 0,d=!1,f=!1,v=function(e){var t;try{t=new URL(e).hostname}catch(e){null==l||l.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?v(e):void 0;if(!r)return ms.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?ms.Internal:ms.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return u(this,function(s){switch(s.label){case 0:return i&&a?[4,i.get(xs)]:[3,3];case 1:return e=s.sent(),t=Ze("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[ks])||"",r=void 0,r=t===n?(null==e?void 0:e[Ps])||"":n||(document.referrer||""),[4,i.set(xs,(o={},o[ks]=t,o[Ps]=r,o))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},g=function(){h()},m={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,o,s,p,m,y,b;return u(this,function(u){switch(u.label){case 0:if((l=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),f=!0,!r)return[3,7];try{i=new st(r.sessionStorage)}catch(e){null==l||l.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return a=null!==(b=u.sent())&&void 0!==b&&b,i&&a?(t="undefined"!=typeof document&&document.referrer||"",n=t?v(t):void 0,o="undefined"!=typeof location&&location.hostname||"",s=Ze("undefined"!=typeof location&&location.href||""),[4,i.get(xs)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[ks])||"",!!n&&n!==o&&m!==s?[4,i.set(xs,(y={},y[ks]=s,y[Ps]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,h()];case 5:u.sent(),u.label=6;case 6:r.addEventListener("popstate",g),d||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=c(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=c(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),d=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r,s;return u(this,function(u){switch(u.label){case 0:return!0===(null===(s=e.extra)||void 0===s?void 0:s.engagedTimeReplay)?[2,e]:(t=Ze("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(xs)]:[3,2]);case 1:if(n=u.sent(),r=(null==n?void 0:n[Ps])||"",Is.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":As(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":As(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":As(e,"[Amplitude] Page Path","undefined"!=typeof location&&Ze(location.pathname)||""),"[Amplitude] Page Title":As(e,"[Amplitude] Page Title",wn(bn)),"[Amplitude] Page URL":As(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),u.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",g),f=!1),i&&a?[4,i.set(xs,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function As(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var Os=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(a=i.remoteConfig)||void 0===a?void 0:a.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||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(){var r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||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 u(this,function(e){return t&&t(),[2]})})}};return i},Cs="userProperty",Rs="eventProperty",Ds=function(e){return e===Cs||e===Rs},Ls=[Cs,Rs],Ns=function(e,t){return function(e){var t=d([],c(new Set((Array.isArray(e)?e:[e]).filter(Ds))),!1);return t.length>0?t:d([],c(Ls),!1)}(e.trackingMethod).includes(t)},Ms=function(e){return Ns(e,Cs)},js=function(e,t){Us(e,t)},Us=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var u=s.apply(e,o);"function"==typeof a&&a(null==u?void 0:u.promise)}}return e},Fs=function(e){return e&&void 0!==e._q},qs=1e3,Bs=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=V())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>qs?(i=n.length-qs,[4,e.prototype.set.call(this,t,n.slice(0,qs))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(qs,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(st),Hs=function(e){function t(){var t;return e.call(this,null===(t=V())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(st),Vs=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r=this;return u(this,function(i){return[2,new Promise(function(i,a){"undefined"==typeof XMLHttpRequest&&a(new 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(e){i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":"application/json",Accept:"*/*"},v=JSON.stringify(t),p=n&&v.length>=2048&&Pt(),h=function(e){var t,n;f=o(o({},r.customHeaders),f);try{for(var i=l(Object.entries(f)),a=i.next();!a.done;a=i.next()){var s=c(a.value,2),u=s[0],v=s[1];d.setRequestHeader(u,v)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};s(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,xt(v)]:[3,2];case 1:return(e=t.sent())?(f["Content-Encoding"]="gzip",h(e)):h(v),[3,3];case 2:h(v),t.label=3;case 3:return[2]}})}).catch(a)})]})})},t}(kt),zs=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r,i,a,s,l,c,d,f,v;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&Pt(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,xt(r)]:[3,2];case 1:(l=u.sent())&&(s["Content-Encoding"]="gzip",a=l),u.label=2;case 2:return s=o(o({},this.customHeaders),s),c="string"==typeof a?a.length:a.byteLength,d={headers:s,body:a,method:"POST",keepalive:this.enableKeepalive&&c<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(f=u.sent()).text()];case 4:v=u.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch(e){return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(kt),Ws=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,n){return s(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,i){var o=V();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,a)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(kt),Ks=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,o,a,s,l,d,f,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(v.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=c(i.split("."),6),a=o[0],s=o[1],l=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:a,userId:$s(s),sessionId:Ys(d),lastEventId:Ys(p),lastEventTime:Ys(f),optOut:Boolean(l)}]}})})},Ys=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},$s=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Gs=function(e){function t(t,n,r,i,o,a,s,u,l,c,d,f,v,p,h,g,m,y,b,w,E,S,T,k,P,x,I,_,A,O,C,R,D,L,N,M,j,U,F,q,B,H,V,z,W){void 0===r&&(r=new nt),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===l&&(l=5),void 0===c&&(c=30),void 0===d&&(d=Jr),void 0===g&&(g=new se),void 0===m&&(m=oe.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===T&&(T=""),void 0===k&&(k=Xr),void 0===I&&(I=18e5),void 0===_&&(_=new Bs({loggerProvider:g})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===C&&(C=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===V&&(V=!1);var K,Y=this;(Y=e.call(this,{apiKey:t,instanceName:v,storageProvider:_,transportProvider:Qs(O)})||this).apiKey=t,Y.appVersion=n,Y.cookieOptions=i,Y.defaultTracking=o,Y.autocapture=a,Y.flushIntervalMillis=u,Y.flushMaxRetries=l,Y.flushQueueSize=c,Y.identityStorage=d,Y.ingestionMetadata=f,Y.loggerProvider=g,Y.logLevel=m,Y.minIdLength=y,Y.offline=b,Y.partnerId=E,Y.plan=S,Y.serverUrl=T,Y.serverZone=k,Y.sessionTimeout=I,Y.storageProvider=_,Y.trackingOptions=A,Y.transport=O,Y.useBatch=C,Y.fetchRemoteConfig=R,Y.networkTrackingOptions=M,Y.identify=j,Y.enableDiagnostics=U,Y.diagnosticsSampleRate=F,Y.diagnosticsClient=q,Y.remoteConfig=B,Y.topLevelDomain=H,Y.enableRequestBodyCompression=V,Y.customEnrichment=z,Y.delayedEventsServerUrl=W,Y.version=Tr,Y._optOut=!1,Y._cookieStorage=r,Y.deviceId=s,Y.lastEventId=p,Y.lastEventTime=h,Y.optOut=w,Y.deferredSessionId=x,Y.sessionId=P,Y.pageCounter=L,Y.userId=D,Y.debugLogsEnabled=N,Y.loggerProvider.enable(N?oe.Debug:Y.logLevel),Y.networkTrackingOptions=M,Y.identify=j,Y.enableDiagnostics=U,Y.diagnosticsSampleRate=F,Y.diagnosticsClient=q;var $=null!==(K=null==B?void 0:B.fetchRemoteConfig)&&void 0!==K?K:R;return Y.remoteConfig=Y.remoteConfig||{},Y.remoteConfig.fetchRemoteConfig=$,Y.fetchRemoteConfig=$,Y.topLevelDomain=H||bs(),Y.delayedEventsServerUrl=function(e,t,n){return void 0===n&&(n=Xr),t||(e?"".concat(e,"/delayed"):"EU"===n?"https://delayed-events.prod.eu-central-1.amplitude.com/2/httpapi/delayed":"https://delayed-events.prod.us-west-2.amplitude.com/2/httpapi/delayed")}(T,W,k),Y}return n(t,e),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())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof rt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Me(this.apiKey),e)},t}(ce),Js=function(e,t,n,r,i){return void 0===t&&(t={}),s(void 0,void 0,void 0,function(){var a,s,l,c,d,f,v,p,h,g,m,y,b,w,E,S,T,k,P,x,I,_,A,O,C,R,D,L,N,M,j,U,F,q,B,H,V,z,K,Y,$,G,J,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return a=t.identityStorage||Jr,s="",a!==Jr||(null===(_=t.cookieOptions)||void 0===_?void 0:_.domain)||""===(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)?[3,2]:[4,Zs(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return l=o({domain:null!==(C=null===(O=t.cookieOptions)||void 0===O?void 0:O.domain)&&void 0!==C?C:s,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),c={duplicateResolverFn:function(e){var t=it(e);if(!t)return!1;var n=JSON.parse(t);return ot(n.cookieDomain,l.domain)},diagnosticsClient:r},d=Xs(t.identityStorage,l,c),[4,Ks(e,d,null===(D=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===D||D)];case 3:return f=u.sent(),[4,d.get(Me(e))];case 4:return v=u.sent(),p=Ue(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(M=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(N=p.ampDeviceId)&&void 0!==N?N:p.deviceId:void 0)&&void 0!==M?M:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:W(),y=null!==(F=null==v?void 0:v.lastEventId)&&void 0!==F?F:f.lastEventId,b=null!==(q=null==v?void 0:v.lastEventTime)&&void 0!==q?q:f.lastEventTime,w=null!==(H=null!==(B=t.optOut)&&void 0!==B?B:null==v?void 0:v.optOut)&&void 0!==H?H:f.optOut,E=null!==(V=null==v?void 0:v.sessionId)&&void 0!==V?V:f.sessionId,S=null==v?void 0:v.deferredSessionId,T=null!==(K=null!==(z=t.userId)&&void 0!==z?z:null==v?void 0:v.userId)&&void 0!==K?K:f.userId,n.previousSessionDeviceId=null!==(Y=null==v?void 0:v.deviceId)&&void 0!==Y?Y:f.deviceId,n.previousSessionUserId=null!==($=null==v?void 0:v.userId)&&void 0!==$?$:f.userId,k={ipAddress:null===(J=null===(G=t.trackingOptions)||void 0===G?void 0:G.ipAddress)||void 0===J||J,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},P=null==v?void 0:v.pageCounter,x=null==v?void 0:v.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(I=new Gs(e,t.appVersion,d,l,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,E,S,t.sessionTimeout,t.storageProvider,k,t.transport,t.useBatch,t.fetchRemoteConfig,T,P,x,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment,t.delayedEventsServerUrl)).storageProvider.isEnabled()];case 5:return u.sent()||(I.loggerProvider.warn("Storage provider ".concat(I.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),I.storageProvider=new nt),[2,I]}})})},Xs=function(e,t,n){switch(void 0===e&&(e=Jr),void 0===t&&(t={}),e){case"localStorage":return new Bs;case"sessionStorage":return new Hs;case"none":return new nt;default:return new rt(o(o({},t),{expirationDays:t.expiration}),n)}},Qs=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new Vs(n):"beacon"===t?new Ws:new zs(n,r,i)},Zs=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,a,s,l;return u(this,function(u){switch(u.label){case 0:return[4,new rt(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,ys.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),a=r.length-o-1;a>=0;--a)i.push(r.slice(a).join("."));a=0,u.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,rt.isDomainWritable(s)];case 4:return u.sent()?[2,"."+s]:[3,6];case 5:return l=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:l instanceof Error?l.message:String(l)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(n)}),[2,""]}})})},eu=!1,tu=function(){var e=V(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}},nu=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.diagnosticsSampleRate=0,t.enableDiagnostics=!0,t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ne(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,l,c,d,f,v;return s(this,void 0,void 0,function(){var p,h,g,m,y,b,w,E,S,T,k,P,x,I,_,A,O=this;return u(this,function(C){switch(C.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),h=null!==(n=t.loggerProvider)&&void 0!==n?n:new se,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:oe.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:Xr,y=this._diagnosticsSampleRate,b=null===(l=t.enableDiagnostics)||void 0===l||l,this.diagnosticsSampleRate=y,this.enableDiagnostics=b,w=this.autocaptureAdapter(),p&&w?[4,w.getRemoteConfigClient(t,h,g)]:[3,2]);case 1:m=C.sent(),y=this.diagnosticsSampleRate,b=this.enableDiagnostics,C.label=2;case 2:return[4,null==w?void 0:w.getDiagnosticsClient(t,h,g,b,y)];case 3:return E=null!==(c=C.sent())&&void 0!==c?c:void 0,[4,Js(t.apiKey,t,this,E,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 4:return S=C.sent(),p&&m&&w?[4,w.fetchRemoteConfig(m,S)]:[3,6];case 5:C.sent(),C.label=6;case 6:return[4,e.prototype._init.call(this,S)];case 7:return C.sent(),this.logBrowserOptions(S),this.config.remoteConfigClient=m,R=this.config,T=cr(R.defaultTracking)&&R.defaultTracking&&"object"==typeof R.defaultTracking&&R.defaultTracking.attribution&&"object"==typeof R.defaultTracking.attribution?o({},R.defaultTracking.attribution):{},this.attributionTrackingOptions=T,[4,null==w?void 0:w.addAttributionTrackingPlugin()];case 8:return C.sent(),k=Ue(),P=k.ampTimestamp?Number(k.ampTimestamp):void 0,x=!P||Date.now()<P,I=x&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(_=this.config.deferredSessionId)||this.config.optOut||(_=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:I)&&void 0!==f?f:_)&&void 0!==v?v:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(O,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(A=De(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(tu()).promise];case 9:C.sent(),C.label=10;case 10:return[4,this.add(new Te({diagnosticsClient:E})).promise];case 11:return C.sent(),[4,this.add(new Pr).promise];case 12:return C.sent(),[4,this.add(new Le).promise];case 13:return C.sent(),w&&function(e){eu||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),eu=!0)}(this.config),[4,null==w?void 0:w.addPlugins()];case 14:return C.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 15:return C.sent(),A.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i=o(o({},"number"==typeof n&&{time:n}),e.groups&&{groups:e.groups});O.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var R})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){De(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){De(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(W()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n,r;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 i=new j,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var a=l(Object.entries(o)),s=a.next();!s.done;s=a.next()){var u=c(s.value,2),d=u[0],f=u[1];i.set(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ne(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ne(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ne(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var i=this.getSessionId();i!==e&&this.timeline.onSessionIdChanged(e);var o=this.config.lastEventTime,a=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0;var s,u=this.autocaptureAdapter(),l=!u,c=!l&&(s=this.config.defaultTracking,lr(s,"sessions"));c&&i&&o&&r.push(this.track(Br,void 0,{device_id:this.previousSessionDeviceId,event_id:++a,session_id:i,time:o+1,user_id:this.previousSessionUserId}).promise),(l||c)&&(this.config.lastEventTime=this.config.sessionId);var d=null!==(n=null==u?void 0:u.trackCampaignEventIfNeeded(++a,r))&&void 0!==n&&n;return this.config.identify&&r.push(this.track(te(this.config.identify)).promise),c&&r.push(this.track(qr,void 0,{event_id:d?++a:a,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ne(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Qs(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(Fs(t)){var r=t._q;t._q=[],t=Us(new j,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(Fs(r)){var o=r._q;r._q=[],r=Us(new j,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(Fs(t)){var r=t._q;t._q=[],t=Us(new ie,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.process=function(t){var n;return s(this,void 0,void 0,function(){var r,i,o;return u(this,function(a){return r=Date.now(),i=Ne(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===qr||t.event_type===Br||t.session_id&&t.session_id!==this.getSessionId()||(i||o?(this.setSessionId(r),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||null===(n=this.autocaptureAdapter())||void 0===n||n.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=o(o({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",Z(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t.prototype.autocaptureAdapter=function(){return null},t}(re),ru=function(e){function t(){var t=e.call(this)||this;return t.diagnosticsSampleRate=0,t.enableDiagnostics=!0,t._autocaptureAdapter=null,t}return n(t,e),t.prototype.autocaptureAdapter=function(){var e=this;return this._autocaptureAdapter||(this._autocaptureAdapter={addPlugins:function(){return s(e,void 0,void 0,function(){var e,t,n=this;return u(this,function(r){switch(r.label){case 0:return c=this.config.defaultTracking,lr(c,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ti()).promise]):[3,2];case 1:r.sent(),r.label=2;case 2:return dr(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Qr()).promise]):[3,4];case 3:r.sent(),r.label=4;case 4:return(e=void 0===Sr(this.config).trackOn)&&vr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(_s()).promise]):[3,6];case 5:r.sent(),r.label=6;case 6:return fr(this.config.defaultTracking)?this.config.optOut?[3,8]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(xr(Sr(this.config))).promise]):[3,9];case 7:return r.sent(),[3,9];case 8:this.timeline.addOptOutListener(function(e){return s(n,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(xr(Sr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),r.label=9;case 9:return this.attributionTrackingOptions&&cr(this.config.defaultTracking)&&(l=this.attributionTrackingOptions,Ns(l,Rs))?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(Ts(this.attributionTrackingOptions)).promise]):[3,11];case 10:r.sent(),r.label=11;case 11:return hr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),t=this.diagnosticsClient?{diagnosticsClient:this.diagnosticsClient}:void 0,[4,this.add(Uo(br(this.config),t)).promise]):[3,13];case 12:r.sent(),r.label=13;case 13:return mr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Qo(wr(this.config))).promise]):[3,15];case 14:r.sent(),r.label=15;case 15:return pr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(pa(Er(this.config))).promise]):[3,17];case 16:r.sent(),r.label=17;case 17:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.webVitals||"object"==typeof e.webVitals&&null!==e.webVitals)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(cs(gr(this.config))).promise]):[3,19];case 18:r.sent(),r.label=19;case 19:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(oa(yr(this.config))).promise]):[3,21];case 20:r.sent(),r.label=21;case 21:return e||!vr(this.config.autocapture)?[3,23]:(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(_s()).promise]);case 22:r.sent(),r.label=23;case 23:return("boolean"==typeof(a=this.config.customEnrichment)?a:"object"==typeof a&&null!==a&&!1!==a.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(Os()).promise]):[3,25];case 24:r.sent(),r.label=25;case 25:return function(e){return"object"==typeof e&&(!0===e.engagedTimeTracking||"object"==typeof e.engagedTimeTracking&&null!==e.engagedTimeTracking)}(this.config.autocapture)?[4,this.add(Nr((i=this.config,o="object"==typeof i.autocapture?i.autocapture.engagedTimeTracking:void 0,o&&"object"==typeof o?o:void 0))).promise]:[3,27];case 26:r.sent(),r.label=27;case 27:return[2]}var i,o,a,l,c})})},trackCampaignEventIfNeeded:function(t,n){if(!e.webAttribution||!e.webAttribution.shouldTrackNewCampaign||!Ms(e.webAttribution.options))return!1;var r=e.webAttribution.generateCampaignEvent(t);return n?n.push(e.track(r).promise):e.track(r),e.config.loggerProvider.log("Tracking attribution."),!0},addAttributionTrackingPlugin:function(){return s(e,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return void 0!==this.attributionTrackingOptions&&cr(this.config.defaultTracking)&&Ms(this.attributionTrackingOptions)?(e=this.attributionTrackingOptions,this.config.optOut&&this.timeline.addOptOutListener(function(n){return s(t,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return n?[3,2]:(this.webAttribution=new Es(e,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Es(e,this.config),[4,this.webAttribution.init()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},getDiagnosticsClient:function(t,n,r,i,o){return s(e,void 0,void 0,function(){var e;return u(this,function(a){return e=new Tt(t.apiKey,n,r,{enabled:i,sampleRate:o}),this.diagnosticsClient=e,e.setTag("library","".concat(kr,"/").concat(Tr)),e.setTag("platform","Web"),e.setTag("web_environment",function(){var e=V();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&e.setTag("user_agent",navigator.userAgent),[2,e]})})},getRemoteConfigClient:function(t,n,r){return s(e,void 0,void 0,function(){var e,i,o=this;return u(this,function(a){switch(a.label){case 0:return e=new Ct(t.apiKey,n,r,null===(i=t.remoteConfig)||void 0===i?void 0:i.serverUrl),[4,new Promise(function(t){null==e||e.subscribe("configs.diagnostics.browserSDK","all",function(e,r,i){if(n.debug("Diagnostics remote configuration received:",Z({remoteConfig:e,source:r,lastFetch:i},null,2)),e){var a=e.sampleRate;"number"!=typeof a||isNaN(a)||(o.diagnosticsSampleRate=a);var s=e.enabled;"boolean"==typeof s&&(o.enableDiagnostics=s)}t()})})];case 1:return a.sent(),[2,e]}})})},fetchRemoteConfig:function(t,n){return s(e,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e){null==t||t.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,i){var o;null===(o=n.loggerProvider)||void 0===o||o.debug("Remote configuration received:",Z({remoteConfig:t,source:r,lastFetch:i},null,2)),t&&ni(t,n),e()})})];case 1:return e.sent(),[2]}})})}}),this._autocaptureAdapter},t}(nu),iu=function(){var e=new ru;return{init:be(e.init.bind(e),"init",ge(e),ye(e,["config"])),add:be(e.add.bind(e),"add",ge(e),ye(e,["config.apiKey","timeline.plugins"])),remove:be(e.remove.bind(e),"remove",ge(e),ye(e,["config.apiKey","timeline.plugins"])),track:be(e.track.bind(e),"track",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),logEvent:be(e.logEvent.bind(e),"logEvent",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),identify:be(e.identify.bind(e),"identify",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),groupIdentify:be(e.groupIdentify.bind(e),"groupIdentify",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),setGroup:be(e.setGroup.bind(e),"setGroup",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),revenue:be(e.revenue.bind(e),"revenue",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),flush:be(e.flush.bind(e),"flush",ge(e),ye(e,["config.apiKey","timeline.queue.length"])),getUserId:be(e.getUserId.bind(e),"getUserId",ge(e),ye(e,["config","config.userId"])),setUserId:be(e.setUserId.bind(e),"setUserId",ge(e),ye(e,["config","config.userId"])),getDeviceId:be(e.getDeviceId.bind(e),"getDeviceId",ge(e),ye(e,["config","config.deviceId"])),setDeviceId:be(e.setDeviceId.bind(e),"setDeviceId",ge(e),ye(e,["config","config.deviceId"])),reset:be(e.reset.bind(e),"reset",ge(e),ye(e,["config","config.userId","config.deviceId"])),getSessionId:be(e.getSessionId.bind(e),"getSessionId",ge(e),ye(e,["config"])),setSessionId:be(e.setSessionId.bind(e),"setSessionId",ge(e),ye(e,["config"])),extendSession:be(e.extendSession.bind(e),"extendSession",ge(e),ye(e,["config"])),setOptOut:be(e.setOptOut.bind(e),"setOptOut",ge(e),ye(e,["config"])),setTransport:be(e.setTransport.bind(e),"setTransport",ge(e),ye(e,["config"])),getIdentity:be(e.getIdentity.bind(e),"getIdentity",ge(e),ye(e,["config"])),setIdentity:be(e.setIdentity.bind(e),"setIdentity",ge(e),ye(e,["config","config.userId","config.deviceId"])),getOptOut:be(e.getOptOut.bind(e),"getOptOut",ge(e),ye(e,["config"])),_setDiagnosticsSampleRate:be(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",ge(e),ye(e,["config"]))}},ou=iu(),au=new Set(["playing","waiting"]),su={content_id:"[Streaming] Content ID",title:"[Streaming] Title",media_type:"[Streaming] Media Type",delivery_mode:"[Streaming] Delivery Mode",stream_session_id:"[Streaming] Stream Session ID",play_id:"[Streaming] Play ID",start_position:"[Streaming] Start Position Sec",position:"[Streaming] Position Sec",duration:"[Streaming] Duration Sec",play_time:"[Streaming] Play Time Sec",play_time_total:"[Streaming] Play Time Total Sec",percent_completed:"[Streaming] Percent Completed",stop_reason:"[Streaming] Stop Reason",error_message:"[Streaming] Error Message"},uu=new Set(["position","percent_completed","stop_reason"]);var lu=function(){function e(e){this.amplitude=e,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.stopEvent=null,this.listeners=[],this.onRemoveListeners=[],this.playId=null,this.playStartPosition=null,this.playTimeBaseline=0,this.sessionTimeBaseline=0,this.heartbeat=function(e,t){var n=Pe.get(e);if(n)return n;var r=new ke(e,6e4,36e5,t);return Pe.set(e,r),r}(this.amplitude)}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.toAnalyticsEventProperties=function(e){var t,n,r;if(!e)return{};var i={};try{for(var o=l(Object.entries(e)),a=o.next();!a.done;a=o.next()){var s=c(a.value,2),u=s[0],d=s[1];i[null!==(r=su[u])&&void 0!==r?r:u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i},e.prototype.captureVideoStarted=function(){var e=this;return this.listeners.push(function(t,n){var r,i,a,s,u,l=t.playbackState,c=n.playbackState;if("ended"===l&&(e.extraEventProperties.stream_session_id=W(),e.sessionTimeBaseline=null!==(r=t.watchTime)&&void 0!==r?r:0),!au.has(l)&&"playing"===c){e.playId=W(),e.playStartPosition=null!==(s=null!==(i=n.position)&&void 0!==i?i:null===(a=n.lastEvent)||void 0===a?void 0:a.position)&&void 0!==s?s:0,e.playTimeBaseline=null!==(u=t.watchTime)&&void 0!==u?u:0;var d=(new Date).getTime(),f={insert_id:W(),event_type:"[Streaming] Stream Started",time:d,event_properties:o(o(o({},e.parseStartEventProperties(n)),e.extraEventProperties),{play_id:e.playId})};e.stopEvent=o(o({},f),{insert_id:W(),event_type:"[Streaming] Stream Stopped",time:d+1,event_properties:e.toAnalyticsEventProperties(o(o({stop_reason:"timeout",play_id:e.playId},e.parseStopEventProperties(n)),e.extraEventProperties))}),e.heartbeat.trackNoDelay(o(o({},f),{event_properties:e.toAnalyticsEventProperties(f.event_properties)})).catch(function(){return e.stop()}),e.heartbeat.track(e.stopEvent).catch(function(){return e.stop()})}}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){var r;e.stopEvent&&(e.stopEvent.event_properties=e.toAnalyticsEventProperties(o(o(o({},e.stopEvent.event_properties),e.parseStopEventProperties(n)),e.extraEventProperties)),e.stopEvent.time=(new Date).getTime(),e.heartbeat.update(e.stopEvent)),au.has(t.playbackState)&&!au.has(n.playbackState)&&e.flushStopEvent(null!==(r=n.cause)&&void 0!==r?r:n.playbackState)}),this},e.prototype.flushStopEvent=function(e){var t=this,n=this.stopEvent;n&&(this.stopEvent=null,this.playStartPosition=null,n.event_properties=o(o({},n.event_properties),{stop_reason:e}),this.heartbeat.trackNoDelay(o(o({},n),{event_properties:this.toAnalyticsEventProperties(n.event_properties)})).catch(function(){return t.stop()}))},e.prototype.start=function(){var e,t=this,n=null!==(e=this.videoEl)&&void 0!==e?e:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var r=new ir({videoEl:n,onStateChange:function(e,n){t.listeners.forEach(function(t){return t(e,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){r.destroy()}),V()&&this.onRemoveListeners.push(this.heartbeat.beforePageHide(function(){t.stop("ended")})),this},e.prototype.stop=function(e){void 0===e&&(e="untracked"),this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[],this.flushStopEvent(e)},e.prototype.parseStartEventProperties=function(e){var t,n,r,i,a;return o(o({},function(e){var t,n,r={};try{for(var i=l(Object.entries(null!=e?e:{})),o=i.next();!o.done;o=i.next()){var a=c(o.value,2),s=a[0],u=a[1];uu.has(s)||null==u||(r[s]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(e.lastEvent)),{duration:null!==(n=null===(t=e.lastEvent)||void 0===t?void 0:t.duration)&&void 0!==n?n:void 0,start_position:null!==(i=null!==(r=this.playStartPosition)&&void 0!==r?r:e.position)&&void 0!==i?i:0,position:null!==(a=e.position)&&void 0!==a?a:0,media_type:this.getMediaType()})},e.prototype.getMediaType=function(){return this.videoEl instanceof HTMLAudioElement?"audio":"video"},e.prototype.parseStopEventProperties=function(e){var t,n,r;return o(o(o({},this.parseStartEventProperties(e)),{play_time:this.watchedSince(e.watchTime,this.playTimeBaseline),play_time_total:this.watchedSince(e.watchTime,this.sessionTimeBaseline),percent_completed:cu(null!==(t=e.position)&&void 0!==t?t:0,null!==(r=null===(n=e.lastEvent)||void 0===n?void 0:n.duration)&&void 0!==r?r:0)}),e.errorMessage?{error_message:e.errorMessage}:{})},e.prototype.watchedSince=function(e,t){var n=(null!=e?e:0)-t;return n>0?n:0},e}();function cu(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?0:Math.min(100,Math.max(0,e/t*100))}var du=ou.add,fu=ou.extendSession,vu=ou.flush,pu=ou.getDeviceId,hu=ou.getIdentity,gu=ou.getOptOut,mu=ou.getSessionId,yu=ou.getUserId,bu=ou.groupIdentify,wu=ou.identify,Eu=ou.init,Su=ou.logEvent,Tu=ou.remove,ku=ou.reset,Pu=ou.revenue,xu=ou.setDeviceId,Iu=ou.setGroup,_u=ou.setIdentity,Au=ou.setOptOut,Ou=ou.setSessionId,Cu=ou.setTransport,Ru=ou.setUserId,Du=ou.track,Lu=ou._setDiagnosticsSampleRate,Nu=Object.freeze({__proto__:null,add:du,extendSession:fu,flush:vu,getDeviceId:pu,getIdentity:hu,getOptOut:gu,getSessionId:mu,getUserId:yu,groupIdentify:bu,identify:wu,init:Eu,logEvent:Su,remove:Tu,reset:ku,revenue:Pu,setDeviceId:xu,setGroup:Iu,setIdentity:_u,setOptOut:Au,setSessionId:Ou,setTransport:Cu,setUserId:Ru,track:Du,_setDiagnosticsSampleRate:Lu,createInstance:iu,AmplitudeBrowser:ru,runQueuedFunctions:js,Revenue:ie,Identify:j,createNetworkRequestEvent:function(e){var t,n;if("string"==typeof(null==e?void 0:e.url)&&e.url.trim()&&"string"==typeof e.method&&e.method.trim()){var r=e.startTime+e.duration;if(!(!Number.isFinite(e.startTime)||e.startTime<0||!Number.isFinite(e.duration)||e.duration<0)&&Number.isFinite(r)){var i=ur(o(o({},e),{url:sr(e.url),statusCode:null!==(t=e.statusCode)&&void 0!==t?t:0,requestType:null!==(n=e.requestType)&&void 0!==n?n:"custom",completionTime:r}));return o(o({},i),{event_properties:Object.fromEntries(Object.entries(i.event_properties).filter(function(e){return void 0!==c(e,2)[1]}))})}console.error("Amplitude Logger [Error]: Network request timing must be finite, non-negative milliseconds")}else console.error("Amplitude Logger [Error]: Network request URL and method must not be empty")},trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new lu(e);t instanceof HTMLMediaElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),n.vendor&&i.withVendor(n.vendor);var a=null!==(r=n.extraEventProperties)&&void 0!==r?r:{};try{i.withExtraEventProperties(o(o({},a),{stream_session_id:W()})).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:ds});!function(e){if(e.scriptUrl){var t=yt(e.scriptUrl);t&&function(e){var t=V();if(t){var n=gt();n.includes(e)||(n.push(e),t[ht]=n)}}(t)}}({scriptUrl:function(){if("undefined"==typeof document)return;var e=document.currentScript;if(null==e?void 0:e.src)return e.src;return}()}),function(){var e=V();if(e){var t=function(e){var t=iu(),n=V();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Nu,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],js(Nu,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitude._iq[o],t(o)),s=a._q;a._q=[],js(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
|
|
2
2
|
//# sourceMappingURL=amplitude-min.js.map
|