@amplitude/analytics-browser 2.48.2-codexsemantic-review-integration.0 → 2.49.0-video-analytics-8.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 +1 -1
- package/lib/cjs/browser-client.d.ts.map +1 -1
- package/lib/cjs/browser-client.js +43 -35
- package/lib/cjs/browser-client.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 +2 -0
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/constants.js +3 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/default-tracking.d.ts.map +1 -1
- package/lib/cjs/default-tracking.js +6 -6
- 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 +43 -35
- package/lib/esm/browser-client.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 +2 -0
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/constants.js +2 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/default-tracking.d.ts.map +1 -1
- package/lib/esm/default-tracking.js +6 -6
- 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-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.d.ts +9 -2
- package/lib/scripts/config.d.ts.map +1 -1
- package/lib/scripts/constants.d.ts +2 -0
- package/lib/scripts/constants.d.ts.map +1 -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 -9
|
@@ -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",_="twclid",O="wbraid",C={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],F="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 q=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 G(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(G(e),t,n)};var $,J=z.ensureProperties=G,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 q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||q(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(q(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,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(F),[2,q(e,0,F)]):(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=q(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[$.REVENUE_PRODUCT_ID]=this.productId,e[$.REVENUE_QUANTITY]=this.quantity,e[$.REVENUE_PRICE]=this.price,e[$.REVENUE_TYPE]=this.revenueType,e[$.REVENUE_CURRENCY]=this.currency,e[$.REVENUE]=this.revenue,e[$.RECEIPT]=this.receipt,e[$.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"}($||($={}));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(q(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))},_e=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}(),Oe=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Ce=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()},Fe=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}},qe=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=Fe(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 qe(r,e,a.pageViewId),a.pageViewId;var s=H();return o.byApiKey[i]={pageViewId:s,href:t},r[Me]=o,qe(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=Fe();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)})},Ge=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},$e=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=function(e){var t,n,r=function(){var e=B();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();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}}},dt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},ft=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},vt=3e5,pt=1e4,ht=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=$e(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=lt({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=dt(i),a=lt({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:ft(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>=pt?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>=pt?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>=pt)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})},vt))},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(vt),[2]):(n=e-t)>=vt?(this._flush(),[2]):(this._setFlushTimer(vt-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=$e(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),gt=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 mt(){return"undefined"!=typeof CompressionStream}function yt(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 bt=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 wt=401,Et=403,St=429,kt=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 bt(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===wt||f.status===Et?(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!==St&&(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}(),Tt=B(),xt=null==Tt?void 0:Tt.console,Pt={},It={},At=!1;var _t,Ot={addListener:function(e,t){var n,r=(n=e,!!xt&&"function"==typeof xt[n]&&(It[n]||(It[n]=xt[n],xt[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(Pt[n]&&!At){At=!0;var r=Pt[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return At=!1,It[n].apply(xt,e)}),!0));if(!r)return new Error("Console override failed");Pt[e]?Pt[e].push(t):Pt[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(Pt)),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(It)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(xt[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}It={},Pt={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(_t||(_t={}));var Ct=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Rt="data-amp-track-",Dt=["div","span","h1","h2","h3","h4","h5","h6"],Lt=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),Nt=Lt,Mt=Lt,jt=["*"];function Ut(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Ft(e,t,n){e&&qt({json:e,allowlist:t.map(Bt),excludelist:n.map(Bt),ancestors:[]})}function qt(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);Ut(i[g])?Ht(m,o)&&!Ht(m,a)||delete i[g]:qt({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 Bt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Vt(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(Vt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Vt(e,t,n+1,r+1)}function Ht(e,t){return t.some(function(t){return Vt(e,t)})}var zt=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 Qt(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=Wt(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,Jt(this.body,e,t)]})})},e}(),Kt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),Qt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Wt(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,Jt(this.body,e,t)]})})},e}();function Wt(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 Yt,Gt=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}),Qt(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,Jt(n.sent(),e,t)]}})})},e}(),$t=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 Qt(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())?(Ft(n,e,t),[2,n]):[2,null]})})},e}();function Jt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Ft(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Yt||(Yt={}));var Xt="[REDACTED]",Qt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?Yt.REMOVE:a,u=d([],l(D),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===Yt.REDACT&&(f[t]=Xt):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===Yt.REDACT&&(f[t]=Xt)};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},Zt=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 en=function(e,t){void 0===t&&(t=H()),this.callback=e,this.id=t};function tn(e){try{e()}catch(e){}}var nn=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){tn(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 Zt(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){tn(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 zt(r):void 0,i?new Gt(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){tn(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&&tn(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){tn(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 $t(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,c=new Kt(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){tn(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){tn(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}(),rn=new nn,on=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({},C),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[_]=t[_],e[O]=t[O],e},e}(),an="data-amp-mask",sn="*****",un=/\b(?:\d[ -]*?){13,16}\b/,cn=/(\d{3}-?\d{2}-?\d{4})/g,ln=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,dn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(un,sn)).replace(cn,sn)).replace(ln,sn);try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,sn)}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},fn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(an)?sn:e?e(document.title):document.title},vn={};Object.defineProperty(vn,"__esModule",{value:!0}),vn.Observable=void 0;const pn=e=>Boolean(Symbol[e]),hn=e=>pn(e)?Symbol[e]:"@@"+e,gn=hn("iterator"),mn=hn("observable"),yn=hn("species");function bn(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function wn(e){let t=e.constructor;return void 0!==t&&(t=t[yn],null===t&&(t=void 0)),void 0!==t?t:An}function En(e){En.log?En.log(e):setTimeout(()=>{throw e})}function Sn(e){Promise.resolve().then(()=>{try{e()}catch(e){En(e)}})}function kn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=bn(t,"unsubscribe");e&&e.call(t)}}catch(e){En(e)}}function Tn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function xn(e,t,n){e._state="running";let r=e._observer;try{let i=bn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(Tn(e),!i)throw n;i.call(r,n);break;case"complete":Tn(e),i&&i.call(r)}}catch(e){En(e)}"closed"===e._state?kn(e):"running"===e._state&&(e._state="ready")}function Pn(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 Sn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(xn(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void xn(e,t,n);e._queue.push({type:t,value:n})}}class In{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){Pn(n,"next",e)},error(e){Pn(n,"error",e)},complete(){Pn(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&&(Tn(this),kn(this))}}class An{constructor(e){if(!(this instanceof An))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 In(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(wn(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(wn(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=wn(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=wn(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=wn(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()}})}[mn](){return this}static from(e){let t="function"==typeof this?this:An;if(null==e)throw new TypeError(e+" is not an object");let n=bn(e,mn);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 An}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(pn("iterator")&&(n=bn(e,gn),n))return new t(t=>{Sn(()=>{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=>{Sn(()=>{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:An)(t=>{Sn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[yn](){return this}}vn.Observable=An,Object.defineProperty(An,Symbol("extensions"),{value:{symbol:mn,hostReportError:En},configurable:!0});var _n=vn.Observable;function On(e,t){return new _n(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 Cn(e,t){return new _n(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 Rn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new _n(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 Dn,Ln="https://app.amplitude.com",Nn={US:Ln,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Mn="__AMPLITUDE_MESSENGER_INSTANCE__",jn="__AMPLITUDE_MESSENGER__",Un=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Ln:t;this[Dn]=!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===Ln&&(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[jn])===this&&delete e[jn]},e}();function Fn(e){var t,n=B(),r=null==n?void 0:n[jn];if("object"==typeof(t=r)&&null!==t&&Mn in t&&!0===t[Mn])return r;var i=new Un(e);return n&&(n[jn]=i),i}Dn=Mn;var qn=["desktop","tablet","mobile"],Bn="__AMPLITUDE_BACKGROUND_CAPTURE__";function Vn(e,t){var n,r=e;if(!0!==r[Bn]){r[Bn]=!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 qn.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 Hn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function zn(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 Kn(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,start_time:n,last_position:n,percent_completed:zn(n,r)},void 0!==t?{stop_reason:t}:{})}function Wn(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 Yn(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:zn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function Gn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Yn(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(){Yn(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(){Yn(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,Yn(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,Yn(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 $n=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?Gn(t,this.handler,r):function(e,t,n){var r=function(){var r=o(o({},Kn(e)),"mux"===n?Wn(e):{});t.onPlay(r)};e.addEventListener("play",r);var i=function(){var r=o(o({},Kn(e,"paused")),"mux"===n?Wn(e):{});t.onPause(r)};e.addEventListener("pause",i);var a=function(){var r=o(o({},Kn(e,"ended")),"mux"===n?Wn(e):{});t.onEnded(r)};e.addEventListener("ended",a);var s=function(){var r=o(o({},Kn(e,"seeking")),"mux"===n?Wn(e):{});t.onSeeking(r)};e.addEventListener("seeking",s);var u=function(){var r=o(o({},Kn(e)),"mux"===n?Wn(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 Jn(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 Xn(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),Xn(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:{},_=A.captureSafeHeaders,O=A.allowlist;(_||O)&&(void 0===O||Array.isArray(O)?T[I]=d(d([],l(_?R:[]),!1),l(null!=O?O:[]),!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 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 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){}}}var Qn=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]))},Zn=function(e){return Qn(e,"attribution")},er=function(e){return Qn(e,"formInteractions")},tr=function(e){return Qn(e,"pageViews")},nr=function(e){return Qn(e,"sessions")},rr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},ir=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},or=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},ar=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},sr=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}},ur=function(e){if(ir(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},cr=function(e){if(ar(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},lr=function(e){if(rr(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},dr=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return tr(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}},fr=function(e,t){vr(e,t)},vr=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},pr=function(e){return e&&void 0!==e._q};var hr="2.48.2-codexsemantic-review-integration.0",gr="amplitude-ts",mr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(gr,"/").concat(hr),"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}(),yr=1e3,br=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>yr?(i=n.length-yr,[4,e.prototype.set.call(this,t,n.slice(0,yr))]):[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(yr,".")),[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),wr=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),Er=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&&mt(),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,yt(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}(gt),Sr=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&&mt(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,yt(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}(gt),kr=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}(gt),Tr=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:Pr(s),sessionId:xr(d),lastEventId:xr(p),lastEventTime:xr(f),optOut:Boolean(c)}]}})})},xr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Pr=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ir="[Amplitude]",Ar="".concat(Ir," Form Started"),_r="".concat(Ir," Form Submitted"),Or="".concat(Ir," File Downloaded"),Cr="session_start",Rr="session_end",Dr="".concat(Ir," File Extension"),Lr="".concat(Ir," File Name"),Nr="".concat(Ir," Link ID"),Mr="".concat(Ir," Link Text"),jr="".concat(Ir," Link URL"),Ur="".concat(Ir," Form ID"),Fr="".concat(Ir," Form Name"),qr="".concat(Ir," Form Destination"),Br="cookie",Vr=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return $},get LogLevel(){return re},get ServerZone(){return _t},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Ct,DEFAULT_DATA_ATTRIBUTE_PREFIX:Rt,DEFAULT_ACTION_CLICK_ALLOWLIST:Dt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Hn}),Hr=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},zr=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=Wr(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&Jr(e.referring_domain,s)){if("always"===h)return Yr(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 Yr(h,e.referring_domain,r),!1}}if(Kr(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=Hr(u||"")!==Hr(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},Kr=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})},Wr=function(e,t){if(!0===e)return Hn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Hn).includes(n))return n;if(void 0===n)return Hn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Yr(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 Gr=["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"],$r=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 Gr.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},Jr=function(e,t){var n=B();if(!n)return!1;var r,i,o,a=(t||"").trim()||$r(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Xr=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,_,O,C,R,D,L,N,M,j,U,F,q,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=Br),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 br({loggerProvider:g})),void 0===_&&(_={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===H&&(H=!1);var K,W=this;(W=e.call(this,{apiKey:t,instanceName:v,storageProvider:A,transportProvider:ei(O)})||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=_,W.transport=O,W.useBatch=C,W.fetchRemoteConfig=R,W.networkTrackingOptions=M,W.identify=j,W.enableDiagnostics=U,W.diagnosticsSampleRate=F,W.diagnosticsClient=q,W.remoteConfig=B,W.topLevelDomain=V,W.enableRequestBodyCompression=H,W.customEnrichment=z,W.version=hr,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=F,W.diagnosticsClient=q;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||$r(),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(Ce(this.apiKey),e)},t}(ue),Qr=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,_,O,C,R,D,L,N,M,j,U,F,q,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||Br,s="",a!==Br||(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)||""===(null===(_=t.cookieOptions)||void 0===_?void 0:_.domain)?[3,2]:[4,ti(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=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),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=Zr(t.identityStorage,c,l),[4,Tr(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(Ce(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!==(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!==(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!==(G=null==v?void 0:v.userId)&&void 0!==G?G:f.userId,T={ipAddress:null===(J=null===($=t.trackingOptions)||void 0===$?void 0:$.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 Xr(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]}})})},Zr=function(e,t,n){switch(void 0===e&&(e=Br),void 0===t&&(t={}),e){case"localStorage":return new br;case"sessionStorage":return new wr;case"none":return new Xe;default:return new Qe(o(o({},t),{expirationDays:t.expiration}),n)}},ei=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 Er(n):"beacon"===t?new kr:new Sr(n,r,i)},ti=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,Gr.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,""]}})})},ni=function(e){var t;void 0===e&&(e={});var n,r,i=B(),a=void 0,c=!1,d=e.trackOn,f=e.trackHistoryChanges,v=e.eventType,p=void 0===v?"[Amplitude] Page Viewed":v,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},g=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=ii(),r=oi(),i=Ke(n.apiKey),a=h("undefined"!=typeof location&&location.href||""),c={event_type:p},s=[{}],[4,ai()];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&&h(location.pathname)||"","[Amplitude] Page Title":fn(dn),"[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)]}})})},m=function(){return void 0===d||"function"==typeof d&&d()},y="undefined"!=typeof location?location.href:null,b=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=ui(f,e,y||"")&&m(),y=e,i?(o=void 0,r&&(o=Be(n.apiKey,ri())),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return c=(s=t).track,[4,g(o)];case 2:c.apply(s,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,d,f;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",b),i.history.pushState=new Proxy(i.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]),c&&b()}})}return m()?(a.log("Tracking page view event"),s=void 0,r&&(s=Be(n.apiKey,ri())),f=(d=t).track,[4,g(s)]):[3,2];case 1:f.apply(d,[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"===d&&si(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=Ve(n.apiKey)),[4,g(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===p&&(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",b),c=!1),[2]})})}};return w},ri=function(){return"undefined"!=typeof location&&location.href||""},ii=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)},oi=function(){var e,t=B();return t&&null!==(e=t.innerWidth)&&void 0!==e?e:0},ai=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 on).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},si=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(C).every(function(e){return o.includes(e)})}return!1},ui=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},ci=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(er(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=di(e);a||i.track(Ar,((t={})[Ur]=li(e.id),t[Fr]=li(e.name),t[qr]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=di(e);if(a||i.track(Ar,((o={})[Ur]=li(e.id),o[Fr]=li(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(_r,((s={})[Ur]=li(e.id),s[Fr]=li(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]})})}}},li=function(e){if("string"==typeof e)return e},di=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},fi=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(Or,((t={})[Dr]=a,t[Lr]=n.pathname,t[Nr]=e.id,t[Mr]=e.text,t[jr]=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]})})}}},vi=!1,pi=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]})})}}};function hi(e,t){var n,r;if(e){Xn(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=Jn(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=Jn(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 gi="1.31.0-codexsemantic-review-integration.0",mi="[Amplitude] Element Clicked",yi="[Amplitude] Element Tag",bi="[Amplitude] Element Text",wi="[Amplitude] Page URL",Ei="[Amplitude] Viewport Height",Si="[Amplitude] Viewport Width",ki="[Amplitude] Page View ID",Ti="data-amp-mask-attributes",xi="data-amp-internal-shadow";function Pi(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 Ii(e,t){return t.map(Ai).join(" > ")}function Ai(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 _i=":scope > ";function Oi(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 Ci(e){var t,n=e.getRootNode();return Oi(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function Ri(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 Oi(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function Di(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=Ci(r);n.push({root:o,target:r});var a=r.getRootNode();if(!Oi(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 Ni(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&Oi(i)?"".concat(n,":nth-of-type(").concat(Mi(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(Mi(e,r.children),")")}function Mi(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 ji={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 Ui(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 Fi(e){return Ui(e)}var qi={name:"stableId",try:function(e,t){var n=Pi(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Fi(n))}},Bi=!1,Vi=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:Bi,maxShadowDomDepth:1});function Hi(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Bi,maxShadowDomDepth:Ki(e.maxShadowDomDepth)})}function zi(e,t){if(!e)return Wi();var n,r=Wi();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=Ki(e.maxShadowDomDepth),Hi(r)}function Ki(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Wi(){return{enabled:Vi.enabled,explicitTrackingAttribute:Vi.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(Vi.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(Vi.unstableClassPatterns),!1),maxAncestorWalkDepth:Vi.maxAncestorWalkDepth,shadowDomEnabled:Vi.shadowDomEnabled,maxShadowDomDepth:Vi.maxShadowDomDepth}}var Yi=[ji,qi];function Gi(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Hi(t),l=null!==(o=n.strategies)&&void 0!==o?o:Yi,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=Ii(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if($i(d,E,e,g.name,n.logger))return E}else if($i(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 $i(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 Xi=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Qi=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 Xi(eo(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new Xi(a,!0)}var s=e.tagName.toLowerCase();if(o)return new Xi(s+eo(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new Xi(s,!0);for(var l=Zi(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=Zi(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="+Ui(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+="."+Ui(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 Xi(S,!1)},Zi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},eo=function(e){return"#"+Ui(e)};function to(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Qi(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 no(e,t){void 0===t&&(t={});var n=Hi(e),r=new Set,i=t.logger,o=function(e){return to(e,i)},a=function(e,r){var o;return null!==(o=Gi(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=Hi(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=Oi(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=Pi(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(Fi(p))],l(u),!1).join(" > ");if(Ji(a,h,e))return h}u.unshift(Ni(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(_i).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&Oi(t)?"".concat(_i).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)),to(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Hi(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 ro,io,oo=Object.freeze({enabled:!1,maxDepth:0}),ao=function(){var e=oo,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)}}}},so=["input","select","textarea"],uo=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ye(window.location.href,n))&&!!Ye(window.location.href,t)},co=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(!uo(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}}},lo=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},fo=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},{})},vo=function(e,t,n){return void 0===n&&(n=oo),n.enabled?ho(e,t,n.maxDepth):po(e,t)},po=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:po(null==e?void 0:e.parentElement,t):null},ho=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(Ri(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},go=function(e,t,n){return void 0===n&&(n=oo),n.enabled?yo(e,t,n.maxDepth):mo(e,t)},mo=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},yo=function(e,t,n){var r=mo(e,t),i=e instanceof Document?e.documentElement:e;return i?(Di(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},bo=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function wo(e){if(!e)return"";try{var t=new URL(e);return t.search="",Ge(t.href)}catch(t){return Ge(e)}}function Eo(e){var t,n;return void 0===e&&(e=B()),wo(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"}(io||(io={}));var So="__AMPLITUDE_VISUAL_TAGGING__";var ko=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 To=B(),xo=function(e){return e.get()},Po={childList:!0,attributes:!0,characterData:!0,subtree:!0},Io=function(e){return new _n(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),Oi(e)&&i.set(e,t),s.observe(e,Po))},a=function(e,t,n){var r=n-t;r<=0||Di(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=xo(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!Oi(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,Po),function(){return t.disconnect()}})},Ao=function(e){return void 0===e&&(e="click"),new _n(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})}})},_o=function(){var e=Cn(new _n(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 To.addEventListener("error",t),function(){To.removeEventListener("error",t)}}),new _n(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 To.addEventListener("unhandledrejection",t),function(){To.removeEventListener("unhandledrejection",t)}}));return Cn(e,new _n(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 Ot.addListener("error",t),function(){Ot.removeListener(t)}}))},Oo=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}})},Co={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Ro=function(e){var t,n,r,i,o=Object.values(Co).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=Co[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},Do=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},Lo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Co[t.event_type]===e.type&&t.filters.every(function(t){return 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)})})})},No=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)}(Lo(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;Oo(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}(),Mo=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Ti,an,xi]),jo=["type"],Uo=["svg","path","g"],Fo=["password","hidden"];function qo(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=oo),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&&Oi(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!Mo.has(e.name)}),y=!function(e){var t,n,r,i=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),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!so.includes(i)&&!o}(e);if(!Fo.includes(String(e.getAttribute("type")))&&!Uo.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!jo.includes(E.name)||(t.has(E.name)?g[E.name]=sn: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={})[xi]="true",a)),d.shadow=!0),d}function Bo(e,t){return void 0===t&&(t=oo),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(Ri(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 Vo;var Ho=function(e,t){var n,r,i,a=this;this.setPageViewApiKey=function(e){a.pageViewApiKey=e},this.replaceSensitiveString=function(e){return dn(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=lo(h.getAttribute(Ti)),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 qo(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=zi(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?oo: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[yi]=d,r[bi]=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[wi]=Ge(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=fn(a.replaceSensitiveString),r[Ei]=window.innerHeight,r[Si]=window.innerWidth,r),y=Ve(a.pageViewApiKey);if(y&&(m[ki]=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 fo(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=oo),!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,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"))&&"click"===t}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=vo(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(an,"], [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(an)||l.hasAttribute("contenteditable")?i+=sn: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(an)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(an))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(an,"]"))}(e)},this.getText=function(e){if(a.hasMaskedAncestor(e))return sn;var t="";return t=e.querySelector("[".concat(an,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(t.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={})[yi]=i,t[bi]=a.getText(e),t[wi]=window.location.href.split("?")[0],t);return fo(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Vo||(Vo=no(zi())),Vo),this.shadowGate=(ro||(ro=ao()),ro);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 zo(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,Wo=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 Yo(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,c=function(e){var t=s.get(e);t&&(clearTimeout(t),s.set(e,null))},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=Wo(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=Wo(u,c.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 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){e&&clearTimeout(e)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(l)}}}function Go(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 $o=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",gi);var w=e.dataAttributePrefix,E=void 0===w?Rt:w,S=e.visualTaggingOptions,k=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:Ct,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Dt,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",_=[],O=new Ho(e,t),C=new Set,R=new Set,D=new Set,L=function(){var t,n,r=Rn(Ao().map(function(t){return O.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=Rn(new _n(function(t){var n,r=function(n){var r=O.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,{capture:!0})}}));window.navigation&&(n=Rn(new _n(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=Rn(Io(o).map(function(t){return O.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new _n(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=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new _n(function(n){var r=B();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)})},c=function(e){if(o)try{go(e,s,xo(o)).forEach(function(e){a.observe(e)})}catch(e){}},l=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&xo(o).enabled?go(e,s,xo(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(l),l();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&c(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&&xo(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}c(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={})[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=Ro(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=Do(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 No(e,t,n,r)}(N,M,O,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,F,q,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||(O.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=Ro(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=Do(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=zo(t,O))&&_.push({unsubscribe:a}),s=co(e,e.cssSelectorAllowlist),c=co(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(bo).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(mi,e.targetElementProperties)})}({allObservables:f,amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),_.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(bo).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([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,evaluateTriggers:j.evaluate.bind(j)}),_.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=vo(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(bo).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?Cn(u,c):u,f=Cn(l,d),v=null,p=null;return On(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(mi,i("click",e.closestTrackedAncestor)))})}({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([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,shouldTrackActionClick:c}),h&&_.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=ko(),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=ko(),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}),_.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=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(),C.clear(),R.clear(),null===(e=F.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={})[wi]=Eo(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[Ei]=g,t[Si]=h,t[He]=Ke(f),t["[Amplitude] Element Exposed"]=m,t),b=Ve(f);b&&(y[ki]=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:C,elementExposedInSentEvents:R,exposureTracker:F.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},Y=function(){W&&(clearTimeout(W),W=void 0)},G=function(){Y(),W=setTimeout(function(){W=void 0,$()},0)},$=function(){if(Y(),null==U||U.removeEventListener("abort",G),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",G),U=void 0,w=!1,S=!1},X=function(){U&&!U.aborted||$()},Q=function(e){Y(),null==U||U.removeEventListener("abort",G),U=void 0,e&&(e.aborted?$():(U=e,e.addEventListener("abort",G,{once:!0})))},Z=Eo(q),ee=function(e){var t=Eo(q);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=Eo(q),r=function(e,t){var n;if(void 0===t&&(t=B()),null==e||""===e)return Eo(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return wo(new URL(e,r).href)}catch(e){return Eo(t)}}(t,q);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,C,R,D,K)},T&&(F.exposure=Yo({allObservables:f,onExposure:ne,dataExtractor:O,exposureDuration:x}),F.exposure&&_.push(F.exposure),V=Go({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(),_.push({unsubscribe:function(){null==V||V.stop()}}),re=function(){if(b)return S=!0,w=!0,void $();K(!0)},null==q||q.addEventListener("beforeunload",re),P=function(){null==q||q.removeEventListener("beforeunload",re)},_.push({unsubscribe:function(){return P()}}),(ie=f[Ko.NavigateObservable])?(_.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=wo(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",$),oe.addEventListener("navigateerror",X),_.push({unsubscribe:function(){J(),b=!1,oe.removeEventListener("navigatesuccess",$),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])}})),_.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(A," has been successfully added.")),window.opener&&k.enabled&&(ce=e.cssSelectorAllowlist,le=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[So]){n[So]=!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:gi}}}),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=Fn(),{dataExtractor:O,isElementSelectable:co(e,d(d([],l(ce),!1),l(le),!1)),cssSelectorAllowlist:ce,actionClickAllowlist:le}),Vn(de),de.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Nn[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(_),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]})})}}},Jo=["mutation","navigate"];function Xo(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 Qo(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 Zo(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&&(Xo(l,e),c.push(e))}var v=On(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 Xo(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=Qo(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(Qo(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 ea,ta;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(ea||(ea={})),function(e){e.X="x",e.Y="y"}(ta||(ta={}));function na(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function ra(e){e.changes=[],e.startTime=void 0}function ia(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 oa=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 _n(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),ra(n),ra(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===ta.X?n:i);var t=function(e,t){var n=void 0;if(na(e)&&(n=e.startTime),na(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(),ia(n),ia(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},aa=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 _n(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===ea.DECREASING&&e.next(ta.X),r=ea.INCREASING):o.x<n.x&&(r===ea.INCREASING&&e.next(ta.X),r=ea.DECREASING),o.y>n.y?(i===ea.DECREASING&&e.next(ta.Y),i=ea.INCREASING):o.y<n.y&&(i===ea.INCREASING&&e.next(ta.Y),i=ea.DECREASING),n=o):n=o})})}({allWindowObservables:r});return oa({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){uo(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function sa(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 ua=4e3,ca=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=sa(e,"rageClicks",jt,f),h=sa(e,"deadClicks",Nt,a),g=sa(e,"errorClicks",Mt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Rt,y=new Ho(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 Rn(Ao(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=Rn(_o().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=Rn(Io(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Rn(new _n(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=Rn(new _n(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=Rn(new _n(function(e){var t=function(t){e.next(t)},n={capture:!0};return To.document.addEventListener("mousemove",t,n),function(){To.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=zo(t,y))&&r.push({unsubscribe:l}),f&&(d=co(e,p),b=Zo({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=co(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 bo(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===io.LEFT_OR_TOUCH_CONTACT}),l=u?Cn(s,u):s,d=Cn(c,l),f=null;return On(d,function(e){return f&&Jo.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=co(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 bo(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===io.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,l=function(){null!==u&&(clearTimeout(u),u=null),c=null};return Cn(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>ua&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(P," is above the maximum of ").concat(ua,", setting to ").concat(ua)),P=ua)),I=aa({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 la(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 da(e,t){var n,r=la(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 fa(e,t){var n,r=la(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 va(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(!uo(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?da(d,a):fa(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 pa,ha,ga=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=va({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]})})}}},ma="[Amplitude] Network Request",ya="500-599";function ba(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function wa(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 Ea(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 Sa(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 ka(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=Ea(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(ba(o,"*.amplitude.com")||ba(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return ba(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!wa(e.status,ya))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 ba(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)&&!wa(n,e.statusCodeRange||ya))}(t,o,e.status,e.url,e.method),i){var n=Sa(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=Sa(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!ka(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!ka(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===ma}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function xa(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,a=e.event,c=Ea(a.url);if(c){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.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(ma,e),[2]}})})}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(pa||(pa={}));var Pa=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new _n(function(e){var n=new en(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return rn.subscribe(n,t),function(){rn.unsubscribe(n)}});return(e={})[pa.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,ha=xa({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 ha.unsubscribe(),[2]})})}}},Ia="web-vitals-browser",Aa="[Amplitude] Web Vitals",_a={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let Oa=-1;const Ca=()=>Oa,Ra=e=>{addEventListener("pageshow",t=>{t.persisted&&(Oa=t.timeStamp,e(t))},!0)},Da=(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)))}},La=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Na=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ma=()=>Na()?.activationStart??0;let ja=-1;const Ua=new Set,Fa=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,qa=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Ua)e();isFinite(ja)||(ja="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",qa,!0))}},Ba=(e=!1)=>{if(e&&(ja=1/0),ja<0){const e=Ma(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;ja=t??Fa(),addEventListener("visibilitychange",qa,!0),addEventListener("prerenderingchange",qa,!0),Ra(()=>{setTimeout(()=>{ja=Fa()})})}return{get firstHiddenTime(){return ja},onHidden(e){Ua.add(e)}}},Va=(e,t=-1,n,r=0,i,o,a)=>{const s=Na(),u=s?.navigationId||0;let c="navigate";return n?c=n:Ca()>=0?c="back-forward-cache":s&&(document.prerendering||Ma()>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}},Ha=new WeakMap;function za(e,t){let n=Ha.get(t);return n||(n=new WeakMap,Ha.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class Ka{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 Wa=(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{}},Ya=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,Ga=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},$a=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class Ja{l}const Xa=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Qa=[1800,3e3],Za=(e,t={})=>{const n=Ya(t);Xa(()=>{const r=za(t,Ja),i=Ba();let o,a=Va("FCP");const s=Wa(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(a.value=Math.max(t.startTime-Ma(),0),a.entries.push(t),a.navigationId=t.navigationId||a.navigationId,o(!0)))});s&&(o=Da(e,a,Qa,t.reportAllChanges),Ra(n=>{a=Va("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Ca()),o=Da(e,a,Qa,t.reportAllChanges),La(()=>{a.value=performance.now()-n.timeStamp,o(!0)})})),n&&Wa(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&Ga(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);a=Va("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=Da(e,a,Qa,t.reportAllChanges),o(!0)})},t)})},es=[.1,.25],ts=(e,t={})=>{const n=Ba();Za($a(()=>{let r,i=Va("CLS",0);const o=za(t,Ka),a=(n,a,s,u,c)=>{i=Va("CLS",0,n,a,s,u,c),o.i=0,r=Da(e,i,es,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"];Ya(t)&&l.push("soft-navigation");const d=Wa(l,c);d&&(r=Da(e,i,es,t.reportAllChanges),n.onHidden(()=>{c(d.takeRecords()),r(!0)}),Ra(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Ca()),La(r)}),setTimeout(r))}))};let ns=0,rs=1/0,is=0;const os=e=>{for(const t of e)t.interactionId&&(rs=Math.min(rs,t.interactionId),is=Math.max(is,t.interactionId),ns=is?(is-rs)/7+1:0)};let as;const ss=()=>as?ns:performance.interactionCount??0;class us{u=0;v=[];m=new Map;p;T;_(){return ss()-this.u}M(){this.u=ss(),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 cs=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=$a(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})}},ls=[200,500],ds=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Ba();Xa(()=>{"interactionCount"in performance||as||(as=Wa(["event"],os,{durationThreshold:0}));let r,i=Va("INP");const o=za(t,us),a=(n,a,s,u,c)=>{o.M(),i=Va("INP",-1,n,a,s,u,c),r=Da(e,i,ls,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)=>{cs(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s(),t&&r(!0)})},l=["event","first-input"];Ya(t)&&l.push("soft-navigation");const d=Wa(l,c,{...t,durationThreshold:t.durationThreshold??40});r=Da(e,i,ls,t.reportAllChanges),d&&(n.onHidden(()=>{c(d.takeRecords(),!0)}),Ra(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Ca())}))})};class fs{p;l;h(e){this.p?.(e)}}const vs=[2500,4e3],ps=(e,t={})=>{let n=!1;const r=Ya(t);Xa(()=>{let i,o=Ba(),a=Va("LCP");const s=za(t,fs),u=(r,s,u,c,l)=>{a=Va("LCP",-1,r,s,u,c,l),i=Da(e,a,vs,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=Ba(!0))},c=e=>{s.l&&e.navigationId&&Ga(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-Ma(),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=Wa(d,l);if(f){i=Da(e,a,vs,t.reportAllChanges);const o=["keydown","click","visibilitychange"],s=e=>{if(e.isTrusted&&!n){const e=a.id;cs(()=>{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});Ra(r=>{u("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Ca()),i=Da(e,a,vs,t.reportAllChanges),La(()=>{a.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},hs=[800,1800],gs=e=>{document.prerendering?Xa(()=>gs(e)):"complete"!==document.readyState?addEventListener("load",()=>gs(e),!0):setTimeout(e)},ms=(e,t={})=>{const n=Ya(t);let r=Va("TTFB"),i=Da(e,r,hs,t.reportAllChanges);gs(()=>{const o=Na();if(o){const a=o.responseStart;r.value=Math.max(a-Ma(),0),r.entries=[o],i(!0),Ra(()=>{r=Va("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ca()),i=Da(e,r,hs,t.reportAllChanges),i(!0)}),n&&Wa(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=Va("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Da(e,r,hs,t.reportAllChanges),i(!0))})},t)}})};function ys(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function bs(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(ys(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var ws=Object.values(_a);var Es,Ss=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=Ge(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":a,"[Amplitude] Page Path":Ge(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":Ge(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 ws.some(function(t){return t in e})}(t)&&l.track(Aa,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},ps((g=function(e){return function(t){o&&!a.has(t.navigationId)&&(f(t)[e]=bs(t,!0),t.navigationId>d&&(-1!==d&&h(t.navigationId),d=t.navigationId))}})(_a.LCP),m),Za(g(_a.FCP),m),ds(g(_a.INP),m),ts(g(_a.CLS),m),ms(g(_a.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]})})}}},ks=function(e){return void 0===e&&(e={}),!0===e.reportSoftNav&&function(){var e=B();return e&&"PerformanceSoftNavigation"in e}()?Ss():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=Ge((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":Ge((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Ge(o.split("?")[0],t.loggerProvider)},ps(function(e){a["[Amplitude] LCP"]=bs(e)}),Za(function(e){a["[Amplitude] FCP"]=bs(e)}),ds(function(e){a["[Amplitude] INP"]=bs(e)}),ts(function(e){a["[Amplitude] CLS"]=bs(e)}),ms(function(e){a["[Amplitude] TTFB"]=bs(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(Aa,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]})})}}}()},Ts=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=C,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||Oe(this.sessionTimeout,this.lastEventTime),zr(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 on).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({},C),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}(),xs=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),Ps=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 on).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 xs.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]})})}}},Is="AMP_CURRENT_PAGE",As="AMP_PREVIOUS_PAGE",_s="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Es||(Es={}));var Os=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),Cs=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 Es.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?Es.Internal:Es.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(_s)]:[3,3];case 1:return e=s.sent(),t=Ge("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[Is])||"",r=void 0,r=t===n?(null==e?void 0:e[As])||"":n||(document.referrer||""),[4,i.set(_s,(o={},o[Is]=t,o[As]=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=Ge("undefined"!=typeof location&&location.href||""),[4,i.get(_s)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[Is])||"",!!n&&n!==o&&m!==s?[4,i.set(_s,(y={},y[Is]=s,y[As]=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=Ge("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(_s)]:[3,2];case 1:if(n=s.sent(),r=(null==n?void 0:n[As])||"",Os.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":Rs(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":Rs(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":Rs(e,"[Amplitude] Page Path","undefined"!=typeof location&&Ge(location.pathname)||""),"[Amplitude] Page Title":Rs(e,"[Amplitude] Page Title",fn(dn)),"[Amplitude] Page URL":Rs(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(_s,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function Rs(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var Ds=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},Ls="userProperty",Ns="eventProperty",Ms=function(e){return e===Ls||e===Ns},js=[Ls,Ns],Us=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(Ms))),!1);return t.length>0?t:d([],l(js),!1)}(e.trackingMethod).includes(t)},Fs=function(e){return Us(e,Ls)},qs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return 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,_=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,p?(m=new kt(t.apiKey,h,g,null===(l=t.remoteConfig)||void 0===l?void 0:l.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:O.sent(),O.label=2;case 2:return(w=new ht(t.apiKey,h,g,{enabled:b,sampleRate:y})).setTag("library","".concat(gr,"/").concat(hr)),w.setTag("platform","Web"),w.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&&w.setTag("user_agent",navigator.userAgent),[4,Qr(t.apiKey,t,this,w,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return E=O.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&hi(t,E),e()})})]:[3,5];case 4:O.sent(),O.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return O.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=m,D=this.config,S=Zn(D.defaultTracking)&&D.defaultTracking&&"object"==typeof D.defaultTracking&&D.defaultTracking.attribution&&"object"==typeof D.defaultTracking.attribution?o({},D.defaultTracking.attribution):{},Zn(this.config.defaultTracking)&&Fs(S)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(_,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Ts(S,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Ts(S,this.config),[4,this.webAttribution.init()]):[3,8];case 7:O.sent(),O.label=8;case 8:return k=De(),T=k.ampTimestamp?Number(k.ampTimestamp):void 0,x=!T||Date.now()<T,P=x&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(I=this.config.deferredSessionId)||this.config.optOut||(I=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:P)&&void 0!==f?f:I)&&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]})})}),(A=Ae(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(pi()).promise];case 9:O.sent(),O.label=10;case 10:return[4,this.add(new we({diagnosticsClient:w})).promise];case 11:return O.sent(),[4,this.add(new mr).promise];case 12:return O.sent(),[4,this.add(new _e).promise];case 13:return O.sent(),function(e){vi||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."),vi=!0)}(this.config),R=this.config.defaultTracking,Qn(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(fi()).promise]):[3,15];case 14:O.sent(),O.label=15;case 15:return er(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(ci()).promise]):[3,17];case 16:O.sent(),O.label=17;case 17:return tr(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(ni(dr(this.config))).promise]):[3,20];case 18:return O.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return s(_,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(ni(dr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),O.label=20;case 20:return Zn(this.config.defaultTracking)&&function(e){return Us(e,Ns)}(S)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(Ps(S)).promise]):[3,22];case 21:O.sent(),O.label=22;case 22:return ir(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add($o(ur(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:O.sent(),O.label=24;case 24:return ar(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(ca(cr(this.config))).promise]):[3,26];case 25:O.sent(),O.label=26;case 26:return rr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Pa(lr(this.config))).promise]):[3,28];case 27:O.sent(),O.label=28;case 28: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(ks(or(this.config))).promise]):[3,30];case 29:O.sent(),O.label=30;case 30: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(ga(sr(this.config))).promise]):[3,32];case 31:O.sent(),O.label=32;case 32:return function(e){return Qn(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Cs()).promise]):[3,34];case 33:O.sent(),O.label=34;case 34:return("boolean"==typeof(C=this.config.customEnrichment)?C:"object"==typeof C&&null!==C&&!1!==C.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(Ds()).promise]):[3,36];case 35:O.sent(),O.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return O.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});_.track(e.eventType,r,Object.keys(i).length?i:void 0)}),[2]}var C,R,D})})},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=[];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 r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,nr(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Rr,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(Z(this.config.identify)).promise),nr(this.config.defaultTracking)&&n.push(this.track(Cr,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ee(Promise.all(n))},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=ei(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(pr(t)){var r=t._q;t._q=[],t=vr(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(pr(r)){var o=r._q;r._q=[],r=vr(new M,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(pr(t)){var r=t._q;t._q=[],t=vr(new ne,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!Fs(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return s(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=Oe(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Cr||t.event_type===Rr||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=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}(te),Bs=function(){var e=new qs;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"]))}},Vs=Bs(),Hs=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 $n({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 zs=Vs.add,Ks=Vs.extendSession,Ws=Vs.flush,Ys=Vs.getDeviceId,Gs=Vs.getIdentity,$s=Vs.getOptOut,Js=Vs.getSessionId,Xs=Vs.getUserId,Qs=Vs.groupIdentify,Zs=Vs.identify,eu=Vs.init,tu=Vs.logEvent,nu=Vs.remove,ru=Vs.reset,iu=Vs.revenue,ou=Vs.setDeviceId,au=Vs.setGroup,su=Vs.setIdentity,uu=Vs.setOptOut,cu=Vs.setSessionId,lu=Vs.setTransport,du=Vs.setUserId,fu=Vs.track,vu=Vs._setDiagnosticsSampleRate,pu=Object.freeze({__proto__:null,add:zs,extendSession:Ks,flush:Ws,getDeviceId:Ys,getIdentity:Gs,getOptOut:$s,getSessionId:Js,getUserId:Xs,groupIdentify:Qs,identify:Zs,init:eu,logEvent:tu,remove:nu,reset:ru,revenue:iu,setDeviceId:ou,setGroup:au,setIdentity:su,setOptOut:uu,setSessionId:cu,setTransport:lu,setUserId:du,track:fu,_setDiagnosticsSampleRate:vu,createInstance:Bs,AmplitudeBrowser:qs,runQueuedFunctions:fr,Revenue:ne,Identify:M,trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new Hs(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:Vr});!function(){var e=B();if(e){var t=function(e){var t=Bs(),n=B();return n&&n.amplitudeGTM&&n.amplitudeGTM._iq&&e&&(n.amplitudeGTM._iq[e]=t),t};if(e.amplitudeGTM=Object.assign(e.amplitudeGTM||{},pu,{createInstance:t}),e.amplitudeGTM.invoked){var n=e.amplitudeGTM._q;e.amplitudeGTM._q=[],fr(pu,n);for(var r=Object.keys(e.amplitudeGTM._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitudeGTM._iq[o],t(o)),s=a._q;a._q=[],fr(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 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",P="li_fat_id",x="msclkid",I="rdt_cid",_="ttclid",A="twclid",O="wbraid",C={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"],R=["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(!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=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},N=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 j,U=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],F="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 q=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},H=d([],l(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),V=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,V)}(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(H[r]):H[r]}).join("")},z={},W={get exports(){return z},set exports(e){z=e}},K=Object.prototype.hasOwnProperty;function Y(e){return"[Throws: "+(e?e.message:"?")+"]"}function G(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(K.call(e,t))try{return e[t]}catch(e){return Y(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}W.exports=function(e,t,n){return JSON.stringify(G(e),t,n)};var $,J=z.ensureProperties=G,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=V(),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 q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||q(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 N;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(q(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,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(F),[2,q(e,0,F)]):(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=q(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[$.REVENUE_PRODUCT_ID]=this.productId,e[$.REVENUE_QUANTITY]=this.quantity,e[$.REVENUE_PRICE]=this.price,e[$.REVENUE_TYPE]=this.revenueType,e[$.REVENUE_CURRENCY]=this.currency,e[$.REVENUE]=this.revenue,e[$.RECEIPT]=this.receipt,e[$.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"}($||($={}));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.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=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){return void 0!==e.delay&&null!==e.delay}function we(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var Ee=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=V()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};be(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(!be(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(q(i,0,"Stale event overwritten")),!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,c=this;return u(this,function(l){switch(l.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(c,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 l.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=c(Object.entries(e)),v=f.next();!v.done;v=f.next()){var p=l(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],l(a),!1),l(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,c,l,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 de),u.label=1;case 1:return u.trys.push([1,3,,4]),o=le(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,s=function(e,t){return void 0===t&&(t=!1),!!ye.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===(c=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(c,e),[3,4]):("body"in c?this.fulfillRequest(e,c.statusCode,"".concat(c.status,": ").concat(we(c))):this.fulfillRequest(e,c.statusCode,c.status),[2]);case 3:return l=u.sent(),d=(f=l)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:ve()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}var f})})},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:we(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(we(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(we(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(we(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(q(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}(),Se=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=V()}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,l,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=c(this.events.values()),l=s.next();!l.done;l=s.next())d=l.value,i(d)}catch(e){v={error:e}}finally{try{l&&!l.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=B();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=c(d([],l(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([],l(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}(),ke=new Map;class Te{getApplicationContext(){return{versionName:this.versionName,language:Pe(),platform:"Web",os:void 0,deviceModel:void 0}}}const Pe=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class xe{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 Ie=(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(!Ie(n,r))return!1;let i=!0;return Object.keys(e).forEach(n=>{Ie(e[n],t[n])||(i=!1)}),i}for(let n=0;n<e.length;n++)if(!Ie(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 _e{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),Ie(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}const Ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self;class Oe{constructor(){this.identityStore=new _e,this.eventBridge=new xe,this.applicationContextProvider=new Te}static getInstance(e){return Ae.analyticsConnectorInstances||(Ae.analyticsConnectorInstances={}),Ae.analyticsConnectorInstances[e]||(Ae.analyticsConnectorInstances[e]=new Oe),Ae.analyticsConnectorInstances[e]}}var Ce=function(e){return Oe.getInstance(ae(e))},De=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ce().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=Ce(e.instanceName).identityStore),[2]})})},e}(),Re=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Le=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},Me=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:""},Ne=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=je(n[0]),i=je(n[1]);return i?(e[r]=i,e):e},{}):{}},je=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Ue="AMP_PAGE_VIEW",Fe=Symbol.for("@amplitude/page-view-state"),qe=function(e){return e||""},Be=function(){return B()},He=function(e){var t;void 0===e&&(e=Be());try{var n=null===(t=null==e?void 0:e.sessionStorage)||void 0===t?void 0:t.getItem(Ue);if(!n)return;var r=JSON.parse(n);if(!r||"object"!=typeof r)return;return r}catch(e){return}},Ve=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=He(e))||void 0===r?void 0:r.byApiKey),s=qe(t);s&&(a[s]=n),i.setItem(Ue,JSON.stringify(o({pageViewId:n},Object.keys(a).length>0?{byApiKey:a}:{})))}catch(e){}},ze=function(e,t,n){var r,i=Be();if(i){var o=qe(e),a=null!==(r=i[Fe])&&void 0!==r?r:{byApiKey:{}},s=a.byApiKey[o];if(s&&s.href===t&&s.pageViewId!==n)return Ve(i,e,s.pageViewId),s.pageViewId;var u=V();return a.byApiKey[o]={pageViewId:u,href:t},i[Fe]=a,Ve(i,e,u),u}},We=function(e){var t,n,r=null===(n=null===(t=function(){var e;return null===(e=Be())||void 0===e?void 0:e[Fe]}())||void 0===t?void 0:t.byApiKey[qe(e)])||void 0===n?void 0:n.pageViewId;return r||function(e){var t=He();if(t){var n=qe(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)},Ke="[Amplitude] SDK Initialization Offset",Ye=Symbol.for("@amplitude/sdk-initialization-offset"),Ge=function(e){var t=B();if(!t)return 0;var n=t[Ye];n||(n={byApiKey:{}},t[Ye]=n);var r=function(e){return e||""}(e),i=n.byApiKey[r];if("number"==typeof i)return i;var o=$e(t);return n.byApiKey[r]=o,o},$e=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}},Je=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Xe=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Qe=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},Ze=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},et=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}(),tt=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=nt(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,rt(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}(),nt=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)},rt=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()},it=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},ot=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}(),at="tags",st="counters",ut="histograms",ct="events",lt="internal",dt="last_flush_timestamp",ft=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(at)||e.createObjectStore(at,{keyPath:"key"}),e.objectStoreNames.contains(st)||e.createObjectStore(st,{keyPath:"key"}),e.objectStoreNames.contains(ut)||e.createObjectStore(ut,{keyPath:"key"}),e.objectStoreNames.contains(ct))||e.createObjectStore(ct,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(lt)||e.createObjectStore(lt,{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([at],"readwrite"),r=n.objectStore(at),[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([st],"readwrite"),r=n.objectStore(st),[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([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 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([ct],"readwrite"),r=n.objectStore(ct),[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([lt],"readwrite"),i=r.objectStore(lt),[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([lt],"readonly"),r=n.objectStore(lt),[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(dt)];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(dt,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([at,st,ut,ct],"readwrite"),[4,Promise.all([this.getAllFromStore(t,at),this.getAllFromStore(t,st),this.getAllFromStore(t,ut),this.getAllFromStore(t,ct)])];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,st),this.clearTable(t,ut),this.clearTable(t,ct)])];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}(),vt=function(e){var t,n,r=function(){var e=B();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();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}}},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=Qe(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:ft.isSupported()?this.storage=new ft(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=vt({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=vt({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=Qe(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,Pt=429,xt=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=V(),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!==Pt&&(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(),_t=null==It?void 0:It.console,At={},Ot={},Ct=!1;var Dt,Rt={addListener:function(e,t){var n,r=(n=e,!!_t&&"function"==typeof _t[n]&&(Ot[n]||(Ot[n]=_t[n],_t[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(At[n]&&!Ct){Ct=!0;var r=At[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return Ct=!1,Ot[n].apply(_t,e)}),!0));if(!r)return new Error("Console override failed");At[e]?At[e].push(t):At[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(At)),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(Ot)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(_t[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}Ot={},At={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Dt||(Dt={}));var Lt=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Mt="data-amp-track-",Nt=["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,Ft=jt,qt=["*"];function Bt(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Ht(e,t,n){e&&Vt({json:e,allowlist:t.map(zt),excludelist:n.map(zt),ancestors:[]})}function Vt(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])?Kt(m,o)&&!Kt(m,a)||delete i[g]:Vt({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 Wt(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(Wt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Wt(e,t,n+1,r+1)}function Kt(e,t){return t.some(function(t){return Wt(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=$t(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}(),Gt=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 $t(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 $t(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())?(Ht(n,e,t),[2,n]):[2,null]})})},e}();function Zt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Ht(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(R),!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(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([],l(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=l(e,2);return t[0],void 0!==t[1]}))},e}();var rn=function(e,t){void 0===t&&(t=V()),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 Gt(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({},C),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Ne();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=Ne();return(e={})[w]=t[w],e[E]=t[E],e[S]=t[S],e[k]=t[k],e[T]=t[T],e[P]=t[P],e[x]=t[x],e[I]=t[I],e[_]=t[_],e[A]=t[A],e[O]=t[O],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:Cn}function Tn(e){Tn.log?Tn.log(e):setTimeout(()=>{throw e})}function Pn(e){Promise.resolve().then(()=>{try{e()}catch(e){Tn(e)}})}function xn(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 _n(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?xn(e):"running"===e._state&&(e._state="ready")}function An(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 Pn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(_n(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void _n(e,t,n);e._queue.push({type:t,value:n})}}class On{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){An(n,"next",e)},error(e){An(n,"error",e)},complete(){An(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),xn(this))}}class Cn{constructor(e){if(!(this instanceof Cn))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 On(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:Cn;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 Cn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(mn("iterator")&&(n=Sn(e,bn),n))return new t(t=>{Pn(()=>{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=>{Pn(()=>{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:Cn)(t=>{Pn(()=>{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=Cn,Object.defineProperty(Cn,Symbol("extensions"),{value:{symbol:wn,hostReportError:Tn},configurable:!0});var Dn=gn.Observable;function Rn(e,t){return new Dn(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 Dn(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 Mn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new Dn(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 Nn,jn="https://app.amplitude.com",Un={US:jn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Fn="__AMPLITUDE_MESSENGER_INSTANCE__",qn="__AMPLITUDE_MESSENGER__",Bn=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?jn:t;this[Nn]=!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[qn])===this&&delete e[qn]},e}();function Hn(e){var t,n=B(),r=null==n?void 0:n[qn];if("object"==typeof(t=r)&&null!==t&&Fn in t&&!0===t[Fn])return r;var i=new Bn(e);return n&&(n[qn]=i),i}Nn=Fn;var Vn=["desktop","tablet","mobile"],zn="__AMPLITUDE_BACKGROUND_CAPTURE__";function Wn(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 Vn.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 Kn={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 Gn(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,position:n,percent_completed:Yn(n,r)},void 0!==t?{stop_reason:t}:{})}function $n(e){var t=e;return t.srcObject||t.currentSrc||t.src||e.getAttribute("src")}function Jn(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 Xn(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,position:s,percent_completed:Yn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function Qn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Xn(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(){Xn(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",c),r.push(function(){return e.off("ended",c)});var l=function(){Xn(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",l),r.push(function(){return e.off("pause",l)});var d=function(){o=!0,Xn(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,Xn(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 Zn=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?Qn(t,this.handler,r):function(e,t,n){var r=!1,i=function(){r=!1;var i=o(o({},Gn(e)),"mux"===n?Jn(e):{});t.onPlay(i)};e.addEventListener("play",i);var a=function(){if(!r){r=!0;var i=o(o({},Gn(e,"ended")),"mux"===n?Jn(e):{});t.onEnded(i)}};e.addEventListener("ended",a);var s=function(){if(!0!==e.ended){var r=o(o({},Gn(e,"paused")),"mux"===n?Jn(e):{});t.onPause(r)}else a()};e.addEventListener("pause",s);var u=function(){var r=o(o({},Gn(e,"seeking")),"mux"===n?Jn(e):{});t.onSeeking(r)};e.addEventListener("seeking",u);var c=function(){var r=o(o({},Gn(e)),"mux"===n?Jn(e):{});t.onSeeked(r)};e.addEventListener("seeked",c);var l=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",l);var d=null,f=function(){var a=e,s=e.duration,u="number"!=typeof s||Number.isNaN(s),c=!u&&!0!==a.ended&&!1===a.paused;r&&null===d&&c&&i();var l={position:e.currentTime,isSeeking:!!a.seeking};t.onTimeUpdate(l),r&&u||(r&&null===d&&!0!==a.ended&&(r=!1),d=Gn(e),"mux"===n&&(d=o(o({},d),Jn(e))))};e.addEventListener("timeupdate",f);var v=function(e){d&&!r&&(r=!0,t.onEnded(d,e)),d=null},p=$n(e),h=function(){var t=$n(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",c),e.removeEventListener("error",l),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,c=e.position;if(s)this.state=o(o({},this.state),{position:c});else{var l=c-u,d=o(o({},this.state),{playbackState:"playing",position:c,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+l});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 er(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 tr(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),tr(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 P=(o=void 0,c(["responseHeaders","requestHeaders"])),x=P.next();!x.done;x=P.next()){var I=x.value,_=null!==(v=T[I])&&void 0!==v?v:{},A=_.captureSafeHeaders,O=_.allowlist;(A||O)&&(void 0===O||Array.isArray(O)?T[I]=d(d([],l(A?D:[]),!1),l(null!=O?O:[]),!1):delete T[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{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 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){}}}var nr=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]))},rr=function(e){return nr(e,"attribution")},ir=function(e){return nr(e,"formInteractions")},or=function(e){return nr(e,"pageViews")},ar=function(e){return nr(e,"sessions")},sr=function(e){return nr(e,"pageUrlEnrichment")},ur=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},cr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},lr=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;return"object"==typeof t&&null!==t?t:void 0}},dr=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},fr=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}},vr=function(e){if(cr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},pr=function(e){if(dr(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},hr=function(e){if(ur(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},gr=function(e){var t,n=function(){return!1},r=void 0,i={},a=e.pageCounter;if(or(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);var s=e.defaultTracking.pageViews;"trackEngagedTime"in s&&(i={trackEngagedTime:s.trackEngagedTime})}return o({trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:a},i)},mr=function(e,t){yr(e,t)},yr=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},br=function(e){return e&&void 0!==e._q};var wr="2.49.0-video-analytics-8.0",Er="amplitude-ts",Sr=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(Er,"/").concat(wr),"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:Me()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:V(),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}(),kr=1e3,Tr=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>kr?(i=n.length-kr,[4,e.prototype.set.call(this,t,n.slice(0,kr))]):[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(kr,".")),[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}(ot),Pr=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}(ot),xr=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),Ir=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),_r=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),Ar=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:Cr(s),sessionId:Or(d),lastEventId:Or(p),lastEventTime:Or(f),optOut:Boolean(c)}]}})})},Or=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Cr=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Dr="[Amplitude]",Rr="".concat(Dr," Form Started"),Lr="".concat(Dr," Form Submitted"),Mr="".concat(Dr," File Downloaded"),Nr="session_start",jr="session_end",Ur="".concat(Dr," File Extension"),Fr="".concat(Dr," File Name"),qr="".concat(Dr," Link ID"),Br="".concat(Dr," Link Text"),Hr="".concat(Dr," Link URL"),Vr="".concat(Dr," Form ID"),zr="".concat(Dr," Form Name"),Wr="".concat(Dr," Form Destination"),Kr="cookie",Yr="US",Gr=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return $},get LogLevel(){return re},get ServerZone(){return Dt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Lt,DEFAULT_DATA_ATTRIBUTE_PREFIX:Mt,DEFAULT_ACTION_CLICK_ALLOWLIST:Nt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Kn}),$r=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Jr=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=Qr(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&ni(e.referring_domain,s)){if("always"===h)return Zr(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 Zr(h,e.referring_domain,r),!1}}if(Xr(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=$r(u||"")!==$r(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},Xr=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})},Qr=function(e,t){if(!0===e)return Kn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Kn).includes(n))return n;if(void 0===n)return Kn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Zr(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 ei=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],ti=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 ei.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},ni=function(e,t){var n=B();if(!n)return!1;var r,i,o,a=(t||"").trim()||ti(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},ri=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,P,x,I,_,A,O,C,D,R,L,M,N,j,U,F,q,B,H,V,z,W){void 0===r&&(r=new et),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=Kr),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=Yr),void 0===I&&(I=18e5),void 0===_&&(_=new Tr({loggerProvider:g})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===C&&(C=!1),void 0===D&&(D=!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:ai(O)})||this).apiKey=t,Y.appVersion=n,Y.cookieOptions=i,Y.defaultTracking=o,Y.autocapture=a,Y.flushIntervalMillis=u,Y.flushMaxRetries=c,Y.flushQueueSize=l,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=k,Y.serverZone=T,Y.sessionTimeout=I,Y.storageProvider=_,Y.trackingOptions=A,Y.transport=O,Y.useBatch=C,Y.fetchRemoteConfig=D,Y.networkTrackingOptions=N,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=wr,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=R,Y.debugLogsEnabled=M,Y.loggerProvider.enable(M?re.Debug:Y.logLevel),Y.networkTrackingOptions=N,Y.identify=j,Y.enableDiagnostics=U,Y.diagnosticsSampleRate=F,Y.diagnosticsClient=q;var G=null!==(K=null==B?void 0:B.fetchRemoteConfig)&&void 0!==K?K:D;return Y.remoteConfig=Y.remoteConfig||{},Y.remoteConfig.fetchRemoteConfig=G,Y.fetchRemoteConfig=G,Y.topLevelDomain=H||ti(),Y.delayedEventsServerUrl=function(e,t,n){return void 0===n&&(n=Yr),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")}(k,W,T),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 tt&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Le(this.apiKey),e)},t}(ue),ii=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,P,x,I,_,A,O,C,D,R,L,M,N,j,U,F,q,B,H,z,W,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||Kr,s="",a!==Kr||(null===(_=t.cookieOptions)||void 0===_?void 0:_.domain)||""===(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)?[3,2]:[4,si(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=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),l={duplicateResolverFn:function(e){var t=nt(e);if(!t)return!1;var n=JSON.parse(t);return rt(n.cookieDomain,c.domain)},diagnosticsClient:r},d=oi(t.identityStorage,c,l),[4,Ar(e,d,null===(R=null===(D=t.cookieOptions)||void 0===D?void 0:D.upgrade)||void 0===R||R)];case 3:return f=u.sent(),[4,d.get(Le(e))];case 4:return v=u.sent(),p=Ne(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(N=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(M=p.ampDeviceId)&&void 0!==M?M:p.deviceId:void 0)&&void 0!==N?N:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:V(),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!==(z=null==v?void 0:v.sessionId)&&void 0!==z?z:f.sessionId,S=null==v?void 0:v.deferredSessionId,k=null!==(K=null!==(W=t.userId)&&void 0!==W?W: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!==(G=null==v?void 0:v.userId)&&void 0!==G?G:f.userId,T={ipAddress:null===(J=null===($=t.trackingOptions)||void 0===$?void 0:$.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 ri(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,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 et),[2,I]}})})},oi=function(e,t,n){switch(void 0===e&&(e=Kr),void 0===t&&(t={}),e){case"localStorage":return new Tr;case"sessionStorage":return new Pr;case"none":return new et;default:return new tt(o(o({},t),{expirationDays:t.expiration}),n)}},ai=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 xr(n):"beacon"===t?new _r:new Ir(n,r,i)},si=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 tt(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,ei.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,tt.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,""]}})})};function ui(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: duration ".concat(e," ms is invalid; using default ").concat(t," ms. Expected a finite value greater than 0 and at most ").concat(r," ms.")),t):e}var ci=function(){function e(e,t,n,r,i){var o,a,s=this;this.client=e,this.scope=t,this.config=r,this.newPageView=i,this.enabled=!0,this.skippedPage=!1,this.removeListeners=[],this.activity=function(){s.enabled&&!s.skippedPage&&s.foreground&&!s.scope.document.prerendering&&(s.pageState&&Date.now()>=s.pageState.lastActivity+s.timeout&&s.finish("inactivity"),s.pageState?(s.settle(s.pageState),s.pageState.lastActivity=Date.now(),s.scheduleInactivity()):s.newPageView())},this.resume=function(){"visible"===s.scope.document.visibilityState&&(s.pageState&&s.settle(s.pageState),s.foreground=!0,s.activity())},this.pause=function(){s.pageState&&s.settle(s.pageState),s.foreground=!1,s.pageState&&s.sendBackground(s.pageState)},this.timeout=ui(n.inactivityTimeoutMillis,18e4,r.loggerProvider,864e5),this.activityWindow=ui(n.activityWindowMillis,5e3,r.loggerProvider),this.pulse=Math.min(ui(n.heartbeatIntervalMillis,15e3,r.loggerProvider),this.timeout/2),this.foreground=this.isForeground();var u=function(e,t,n){e.addEventListener(t,n,{passive:!0}),s.removeListeners.push(function(){return e.removeEventListener(t,n)})};try{for(var l=c(["pointerdown","pointermove","keydown","scroll","touchstart","wheel"]),d=l.next();!d.done;d=l.next()){var f=d.value;u(t.document,f,this.activity)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}u(t,"focus",this.resume),u(t,"blur",this.pause),u(t.document,"visibilitychange",function(){return s.isForeground()?s.resume():s.pause()}),u(t,"pagehide",function(){return s.finish("pagehide")}),u(t,"pageshow",function(){s.isForeground()&&s.resume()})}return e.prototype.isForeground=function(){return"visible"===this.scope.document.visibilityState&&this.scope.document.hasFocus()},e.prototype.start=function(e){var t,n=this;if(this.finish("navigation"),!this.enabled)return!1;var r=Date.now();this.foreground=this.isForeground();var i={event:o(o({},e),{insert_id:e.insert_id||V(),time:null!==(t=e.time)&&void 0!==t?t:r,delay:{id:V(),timeout:this.timeout}}),heartbeat:new Se(this.client,this.pulse,this.timeout,this.config.loggerProvider,{sendOnPageLifecycle:!1,beforeHeartbeat:function(){n.pageState===i&&(Date.now()>=i.lastActivity+n.timeout?n.retire(i,"inactivity"):(i.heartbeat.update(n.snapshot(i,i.nextSnapshotReason)),i.nextSnapshotReason="heartbeat"))}}),started:r,updated:r,lastActivity:r,engaged:0,version:0,nextSnapshotReason:"initial"};return delete i.event.user_properties,i.heartbeat.enqueue(this.snapshot(i,"initial"))?(this.pageState=i,this.scheduleInactivity(),i.heartbeat.resetHeartbeat(),!0):(this.skippedPage=!0,this.config.loggerProvider.warn("Page engagement: snapshot exceeds the Heartbeat size limit. Sending the original page view without engaged-time tracking."),!1)},e.prototype.settle=function(e){var t=Math.max(e.updated,Math.min(Date.now(),e.lastActivity+this.timeout));this.foreground&&(e.engaged+=Math.max(0,Math.min(t,e.lastActivity+this.activityWindow)-e.updated)),e.updated=t},e.prototype.snapshot=function(e,t){this.settle(e);var n=++e.version;return o(o({},e.event),{extra:o(o({},e.event.extra),{pageEngagementSnapshot:!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})})},e.prototype.scheduleInactivity=function(){var e=this;clearTimeout(this.inactivityTimer),this.inactivityTimer=setTimeout(function(){return e.finish("inactivity")},this.timeout)},e.prototype.sendBackground=function(e){var t=this,n=void 0===e.lastBackgroundSent?0:e.lastBackgroundSent+1e3-Date.now();n>0?void 0===e.backgroundTimer&&(e.backgroundTimer=setTimeout(function(){e.backgroundTimer=void 0,t.sendBackground(e)},n)):(clearTimeout(e.backgroundTimer),e.backgroundTimer=void 0,e.lastBackgroundSent=Date.now(),e.nextSnapshotReason="background",e.heartbeat.heartbeat(),this.client.flush())},e.prototype.retire=function(e,t){clearTimeout(e.backgroundTimer),clearTimeout(this.inactivityTimer);var n=this.snapshot(e,t);n.delay=o(o({},n.delay),{timeout:void 0}),e.heartbeat.update(n),e.heartbeat.pause(),this.pageState=void 0},e.prototype.finish=function(e){this.skippedPage=!1;var t=this.pageState;t&&(this.retire(t,e),t.heartbeat.heartbeat(),this.client.flush(),t.heartbeat.stop())},e.prototype.setOptOut=function(e){var t,n;this.enabled=!e,e&&(this.skippedPage=!1,clearTimeout(this.inactivityTimer),clearTimeout(null===(t=this.pageState)||void 0===t?void 0:t.backgroundTimer),null===(n=this.pageState)||void 0===n||n.heartbeat.stop(),this.pageState=void 0)},e.prototype.teardown=function(){this.finish("teardown"),this.enabled=!1,this.removeListeners.forEach(function(e){return e()})},e}(),li=function(e){var t;void 0===e&&(e={});var n,r,i,a,c,d,f,v=B(),p=void 0,h=!1,g=0,m=0,y=!1,b=e.trackOn,w=e.trackHistoryChanges,E=e.eventType,S=void 0===E?"[Amplitude] Page Viewed":E,k=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==p||p.error("Malformed URI sequence: ",e)}return t},T=function(e){return s(void 0,void 0,void 0,function(){var t,r,i,a,s,c,l,d;return u(this,function(u){switch(u.label){case 0:return t=fi(),r=vi(),i=Ge(n.apiKey),a=k("undefined"!=typeof location&&location.href||""),(l={"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":a,"[Amplitude] Page Path":"undefined"!=typeof location&&k(location.pathname)||"","[Amplitude] Page Title":hn(pn),"[Amplitude] Page URL":a.split("?")[0],"[Amplitude] Min Page Y":t,"[Amplitude] Viewport Width":r})[Ke]=i,l["[Amplitude] Page View ID"]=e,s=l,d={event_type:S},c=[{}],[4,pi()];case 1:return[2,(d.event_properties=o.apply(void 0,[o.apply(void 0,c.concat([u.sent()])),s]),d)]}})})},P=function(){return void 0===b||"function"==typeof b&&b()},x=function(e){return s(void 0,void 0,void 0,function(){var t,r,i,s;return u(this,function(u){switch(u.label){case 0:if(t=m,r=g,y||c===t)return[2];c=t,i=ze(n.apiKey,di(),a),a=i,u.label=1;case 1:return u.trys.push([1,,5,6]),[4,T(i)];case 2:return s=u.sent(),!h||n.optOut||r!==g?[3,4]:(s.extra=o(o({},s.extra),{pageViewContext:{revision:t,cancellation:r}}),[4,e.track(s).promise]);case 3:u.sent(),u.label=4;case 4:return[3,6];case 5:return c===t&&(c=void 0),[7];case 6:return[2]}})})},I=function(e){m+=1,"navigation"!==e&&(g+=1),null==i||i.finish(e)},_="undefined"!=typeof location?location.href:null,A=function(){s(void 0,void 0,void 0,function(){var e,o,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return e=location.href,o=gi(w,e,_||""),a=o&&P(),_=e,i&&o&&I("navigation"),a?i?(x(t),[2]):(s=void 0,r&&(s=ze(n.apiKey,di())),null==p||p.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return l=(c=t).track,[4,T(s)];case 2:l.apply(c,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},O={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(o,a){return s(void 0,void 0,void 0,function(){var s,c,w,E,S,k,I,_;return u(this,function(u){switch(u.label){case 0:if(t=a,n=o,(p=o.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),h=!0,e.trackEngagedTime&&void 0===b&&(null==v?void 0:v.document)&&(s=function(){y=!0,m+=1,g+=1},c=function(){y=!1},v.addEventListener("pagehide",s),v.addEventListener("pageshow",c),f=function(){v.removeEventListener("pagehide",s),v.removeEventListener("pageshow",c)},w="object"==typeof e.trackEngagedTime?e.trackEngagedTime:{},i=new ci(a,v,w,o,function(){x(a)})),Ge(n.apiKey),v){try{r=new ot(v.sessionStorage)}catch(e){null==p||p.debug("sessionStorage is not available in this environment.")}v.addEventListener("popstate",A),v.history.pushState=new Proxy(v.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]),h&&A()}})}return P()?(E=null==v?void 0:v.document)&&i&&E.prerendering?(S=function(){E.removeEventListener("prerenderingchange",S),x(a)},E.addEventListener("prerenderingchange",S),d=function(){return E.removeEventListener("prerenderingchange",S)},[2]):i?(x(a),[2]):(p.log("Tracking page view event"),k=void 0,r&&(k=ze(n.apiKey,di())),_=(I=t).track,[4,T(k)]):[3,2];case 1:_.apply(I,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,a,s,c;return u(this,function(u){switch(u.label){case 0:return i&&e.delay?[2,e]:"attribution"===b&&hi(e)?(null==p||p.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r&&(t=We(n.apiKey)),[4,T(t)]):[3,2];case 1:a=u.sent(),e.event_type=a.event_type,e.event_properties=o(o({},e.event_properties),a.event_properties),u.label=2;case 2:if(n&&e.event_type===S){if(s=null===(c=e.extra)||void 0===c?void 0:c.pageViewContext,i&&(y||s&&s.cancellation!==g))return[2,null];if(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter}),i)return n.optOut?[2,null]:s&&s.revision!==m?[2,e]:(delete e.user_properties,[2,i.start(e)?null:e])}return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return m+=1,g+=1,null==i||i.teardown(),null==d||d(),null==f||f(),v&&(v.removeEventListener("popstate",A),h=!1),[2]})})},onOptOutChanged:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(m+=1,g+=1),null==i||i.setOptOut(e),[2]})})},onReset:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return[2,I("reset")]})})},onIdentityChanged:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return("userId"in e||"deviceId"in e)&&I("identity_change"),[2]})})},onSessionIdChanged:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return[2,I("session_change")]})})}};return O},di=function(){return"undefined"!=typeof location&&location.href||""},fi=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)},vi=function(){var e,t=B();return t&&null!==(e=t.innerWidth)&&void 0!==e?e:0},pi=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Ze,[4,(new un).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},hi=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(C).every(function(e){return o.includes(e)})}return!1},gi=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},mi=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(ir(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=bi(e);a||i.track(Rr,((t={})[Vr]=yi(e.id),t[zr]=yi(e.name),t[Wr]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=bi(e);if(a||i.track(Rr,((o={})[Vr]=yi(e.id),o[zr]=yi(e.name),o[Wr]=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(Lr,((s={})[Vr]=yi(e.id),s[zr]=yi(e.name),s[Wr]=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]})})}}},yi=function(e){if("string"==typeof e)return e},bi=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},wi=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(Mr,((t={})[Ur]=a,t[Fr]=n.pathname,t[qr]=e.id,t[Br]=e.text,t[Hr]=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]})})}}},Ei=!1,Si=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]})})}}};function ki(e,t){var n,r;if(e){tr(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=er(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=er(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 Ti="1.31.0-video-analytics-8.0",Pi="[Amplitude] Element Clicked",xi="[Amplitude] Element Tag",Ii="[Amplitude] Element Text",_i="[Amplitude] Page URL",Ai="[Amplitude] Viewport Height",Oi="[Amplitude] Viewport Width",Ci="[Amplitude] Page View ID",Di="data-amp-mask-attributes",Ri="data-amp-internal-shadow";function Li(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 Mi(e,t){return t.map(Ni).join(" > ")}function Ni(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 ji=":scope > ";function Ui(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 Fi(e){var t,n=e.getRootNode();return Ui(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function qi(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 Ui(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function Bi(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 Hi(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=Fi(r);n.push({root:o,target:r});var a=r.getRootNode();if(!Ui(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 Vi(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&Ui(i)?"".concat(n,":nth-of-type(").concat(zi(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(zi(e,r.children),")")}function zi(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 Wi={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 Ki(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 Yi(e){return Ki(e)}var Gi={name:"stableId",try:function(e,t){var n=Li(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Yi(n))}},$i=!1,Ji=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:$i,maxShadowDomDepth:1});function Xi(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:$i,maxShadowDomDepth:Zi(e.maxShadowDomDepth)})}function Qi(e,t){if(!e)return eo();var n,r=eo();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=Zi(e.maxShadowDomDepth),Xi(r)}function Zi(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function eo(){return{enabled:Ji.enabled,explicitTrackingAttribute:Ji.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(Ji.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(Ji.unstableClassPatterns),!1),maxAncestorWalkDepth:Ji.maxAncestorWalkDepth,shadowDomEnabled:Ji.shadowDomEnabled,maxShadowDomDepth:Ji.maxShadowDomDepth}}var to=[Wi,Gi];function no(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Xi(t),l=null!==(o=n.strategies)&&void 0!==o?o:to,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=Mi(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(ro(d,E,e,g.name,n.logger))return E}else if(ro(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 ro(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 io(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var oo=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),ao=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 oo(uo(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new oo(a,!0)}var s=e.tagName.toLowerCase();if(o)return new oo(s+uo(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new oo(s,!0);for(var l=so(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=so(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="+Ki(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+="."+Ki(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 oo(S,!1)},so=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},uo=function(e){return"#"+Ki(e)};function co(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=ao(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 lo(e,t){void 0===t&&(t={});var n=Xi(e),r=new Set,i=t.logger,o=function(e){return co(e,i)},a=function(e,r){var o;return null!==(o=no(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=Xi(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=Ui(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=Li(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(Yi(p))],l(u),!1).join(" > ");if(io(a,h,e))return h}u.unshift(Vi(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(ji).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&Ui(t)?"".concat(ji).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=Hi(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)),co(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Xi(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 fo,vo,po=Object.freeze({enabled:!1,maxDepth:0}),ho=function(){var e=po,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)}}}},go=["input","select","textarea"],mo=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Je(window.location.href,n))&&!!Je(window.location.href,t)},yo=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(!mo(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}}},bo=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},wo=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=po),n.enabled?ko(e,t,n.maxDepth):So(e,t)},So=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:So(null==e?void 0:e.parentElement,t):null},ko=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(qi(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},To=function(e,t,n){return void 0===n&&(n=po),n.enabled?xo(e,t,n.maxDepth):Po(e,t)},Po=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},xo=function(e,t,n){var r=Po(e,t),i=e instanceof Document?e.documentElement:e;return i?(Bi(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},Io=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function _o(e){if(!e)return"";try{var t=new URL(e);return t.search="",Xe(t.href)}catch(t){return Xe(e)}}function Ao(e){var t,n;return void 0===e&&(e=B()),_o(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"}(vo||(vo={}));var Oo="__AMPLITUDE_VISUAL_TAGGING__";var Co=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 Do=B(),Ro=function(e){return e.get()},Lo={childList:!0,attributes:!0,characterData:!0,subtree:!0},Mo=function(e){return new Dn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),Ui(e)&&i.set(e,t),s.observe(e,Lo))},a=function(e,t,n){var r=n-t;r<=0||Bi(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=Ro(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!Ui(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()}})},No=function(e){return void 0===e&&(e="click"),new Dn(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})}})},jo=function(){var e=Ln(new Dn(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 Do.addEventListener("error",t),function(){Do.removeEventListener("error",t)}}),new Dn(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 Do.addEventListener("unhandledrejection",t),function(){Do.removeEventListener("unhandledrejection",t)}}));return Ln(e,new Dn(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 Rt.addListener("error",t),function(){Rt.removeListener(t)}}))},Uo=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}})},Fo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},qo=function(e){var t,n,r,i,o=Object.values(Fo).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=Fo[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},Bo=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},Ho=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return Fo[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)}(Ho(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;Uo(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}(),zo=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Di,cn,Ri]),Wo=["type"],Ko=["svg","path","g"],Yo=["password","hidden"];function Go(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=po),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&&Ui(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!zo.has(e.name)}),y=!function(e){var t,n,r,i=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),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!go.includes(i)&&!o}(e);if(!Yo.includes(String(e.getAttribute("type")))&&!Ko.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!Wo.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={})[Ri]="true",a)),d.shadow=!0),d}function $o(e,t){return void 0===t&&(t=po),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(qi(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 Jo;var Xo=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=$o(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=bo(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([],l(m),!1),l(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return Go(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=Qi(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?po: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[xi]=d,r[Ii]=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[_i]=Xe(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=hn(a.replaceSensitiveString),r[Ai]=window.innerHeight,r[Oi]=window.innerWidth,r),y=We(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 wo(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=po),!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=Hi(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,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"))&&"click"===t}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=Eo(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)||l.hasAttribute("contenteditable")?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!!$o(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){if(a.hasMaskedAncestor(e))return ln;var t="";return t=e.querySelector("[".concat(cn,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(t.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={})[xi]=i,t[Ii]=a.getText(e),t[_i]=window.location.href.split("?")[0],t);return wo(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Jo||(Jo=lo(Qi())),Jo),this.shadowGate=(fo||(fo=ho()),fo);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 Qo(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 Zo,ea=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 ta(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,c=function(e){var t=s.get(e);t&&(clearTimeout(t),s.set(e,null))},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=ea(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=ea(u,c.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 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){e&&clearTimeout(e)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(l)}}}function na(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"}(Zo||(Zo={}));var ra=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",Ti);var w=e.dataAttributePrefix,E=void 0===w?Mt: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:Nt,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),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 Xo(e,t),C=new Set,D=new Set,R=new Set,L=function(){var t,n,r=Mn(No().map(function(t){return O.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=Mn(new Dn(function(t){var n,r=function(n){var r=O.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=Mn(new Dn(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=Mn(Mo(o).map(function(t){return O.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new Dn(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=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new Dn(function(n){var r=B();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)})},c=function(e){if(o)try{To(e,s,Ro(o)).forEach(function(e){a.observe(e)})}catch(e){}},l=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&Ro(o).enabled?To(e,s,Ro(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(l),l();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&c(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&&Ro(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}c(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={})[Zo.ChangeObservable]=i,t[Zo.ClickObservable]=r,t[Zo.MutationObservable]=a,t[Zo.NavigateObservable]=n,t[Zo.ScrollObservable]=s,t[Zo.ExposureObservable]=u,t},M=qo(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),N=Bo(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)}(M,N,O,e);return{name:_,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,F,q,H,V,z,W,K,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||(O.setPageViewApiKey(t.apiKey),Ge(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),M=qo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),N=Bo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(M,N,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=Qo(t,O))&&A.push({unsubscribe:a}),s=yo(e,e.cssSelectorAllowlist),c=yo(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(Io).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(Pi,e.targetElementProperties)})}({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(Io).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([],l(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,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=Eo(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(Io).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?Ln(u,c):u,f=Ln(l,d),v=null,p=null;return Rn(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(Pi,i("click",e.closestTrackedAncestor)))})}({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([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:s,shouldTrackActionClick:c}),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=Co(),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=Co(),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=B(),V=function(){var e;g.reset();var t=g.getState();m.maxX=t.maxX,m.maxY=t.maxY,m.minY=t.minY,R.clear(),C.clear(),D.clear(),null===(e=F.exposure)||void 0===e||e.reset(),null==H||H.reset()},z=function(){b=!0},W=function(e){if(b)return e?void V():void(w=!0);e&&(null==H||H.reset()),e&&r?V():(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={})[_i]=Ao(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[Ai]=g,t[Oi]=h,t[Ke]=Ge(f),t["[Amplitude] Element Exposed"]=m,t),b=We(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==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:R,elementExposedForPage:C,elementExposedInSentEvents:D,exposureTracker:F.exposure,isPageEnd:e,lastScroll:m,apiKey:t.apiKey}))},Y=function(){K&&(clearTimeout(K),K=void 0)},G=function(){Y(),K=setTimeout(function(){K=void 0,$()},0)},$=function(){if(Y(),null==U||U.removeEventListener("abort",G),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",G),U=void 0,w=!1,S=!1},X=function(){U&&!U.aborted||$()},Q=function(e){Y(),null==U||U.removeEventListener("abort",G),U=void 0,e&&(e.aborted?$():(U=e,e.addEventListener("abort",G,{once:!0})))},Z=Ao(q),ee=function(e){var t=Ao(q);return t!==Z&&(b&&e&&e.deferScrollBaseline?(J(),V(),Z=t,!0):(Z=t,W(!0),(null==e?void 0:e.deferScrollBaseline)?(z(),!0):(y(),!1)))},te=function(e,t){var n=Ao(q),r=function(e,t){var n;if(void 0===t&&(t=B()),null==e||""===e)return Ao(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return _o(new URL(e,r).href)}catch(e){return Ao(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,D,R,W)},T&&(F.exposure=ta({allObservables:f,onExposure:ne,dataExtractor:O,exposureDuration:P}),F.exposure&&A.push(F.exposure),H=na({mutationObservable:f[Zo.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}),H.start(),A.push({unsubscribe:function(){null==H||H.stop()}}),re=function(){if(b)return S=!0,w=!0,void $();W(!0)},null==q||q.addEventListener("beforeunload",re),x=function(){null==q||q.removeEventListener("beforeunload",re)},A.push({unsubscribe:function(){return x()}}),(ie=f[Zo.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=_o(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",$),oe.addEventListener("navigateerror",X),A.push({unsubscribe:function(){J(),b=!1,oe.removeEventListener("navigatesuccess",$),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&&k.enabled&&(ce=e.cssSelectorAllowlist,le=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[Oo]){n[Oo]=!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:Ti}}}),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=Hn(),{dataExtractor:O,isElementSelectable:yo(e,d(d([],l(ce),!1),l(le),!1)),cssSelectorAllowlist:ce,actionClickAllowlist:le}),Wn(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(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]})})}}},ia=["mutation","navigate"];function oa(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 aa(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 sa(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&&(oa(l,e),c.push(e))}var v=Rn(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 oa(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=aa(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(aa(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 ua,ca;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(ua||(ua={})),function(e){e.X="x",e.Y="y"}(ca||(ca={}));function la(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function da(e){e.changes=[],e.startTime=void 0}function fa(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 va=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 Dn(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),da(n),da(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===ca.X?n:i);var t=function(e,t){var n=void 0;if(la(e)&&(n=e.startTime),la(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(),fa(n),fa(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},pa=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 Dn(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===ua.DECREASING&&e.next(ca.X),r=ua.INCREASING):o.x<n.x&&(r===ua.INCREASING&&e.next(ca.X),r=ua.DECREASING),o.y>n.y?(i===ua.DECREASING&&e.next(ca.Y),i=ua.INCREASING):o.y<n.y&&(i===ua.INCREASING&&e.next(ca.Y),i=ua.DECREASING),n=o):n=o})})}({allWindowObservables:r});return va({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){mo(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function ha(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 ga=4e3,ma=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=ha(e,"rageClicks",qt,f),h=ha(e,"deadClicks",Ut,a),g=ha(e,"errorClicks",Ft,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:Mt,y=new Xo(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 Mn(No(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=Mn(jo().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=Mn(Mo(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=Mn(new Dn(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=Mn(new Dn(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=Mn(new Dn(function(e){var t=function(t){e.next(t)},n={capture:!0};return Do.document.addEventListener("mousemove",t,n),function(){Do.document.removeEventListener("mousemove",t,n)}}));return(e={})[Zo.ClickObservable]=r,e[Zo.PointerDownObservable]=i,e[Zo.MutationObservable]=s,e[Zo.NavigateObservable]=t,e[Zo.BrowserErrorObservable]=a,e[Zo.SelectionObservable]=u,e[Zo.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,P,x,I,_;return u(this,function(u){return"undefined"==typeof document||(y.setPageViewApiKey(t.apiKey),s=w(),(l=Qo(t,y))&&r.push({unsubscribe:l}),f&&(d=yo(e,p),b=sa({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=yo(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 Io(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===vo.LEFT_OR_TOUCH_CONTACT}),l=u?Ln(s,u):s,d=Ln(c,l),f=null;return Rn(d,function(e){return f&&ia.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=yo(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 Io(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===vo.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&&(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>ga&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(x," is above the maximum of ").concat(ga,", setting to ").concat(ga)),x=ga)),I=pa({amplitude:c,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=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 ya(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 ba(e,t){var n,r=ya(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 wa(e,t){var n,r=ya(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 Ea(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(!mo(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?ba(d,a):wa(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 Sa,ka,Ta=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=Ea({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]})})}}},Pa="[Amplitude] Network Request",xa="500-599";function Ia(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function _a(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 Aa(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 Oa(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],l(D),!1);if(void 0===e){return}}}function Ca(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 Da(e,t){var n;void 0===t&&(t={});var r=Aa(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(Ia(o,"*.amplitude.com")||Ia(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return Ia(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!_a(e.status,xa))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 Ia(t,e)}))&&(!r||!e.urls||Je(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!_a(n,e.statusCodeRange||xa))}(t,o,e.status,e.url,e.method),i){var n=Oa(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=Oa(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!Ca(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!Ca(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===Pa}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function Ra(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return Da(e.event,n)}).subscribe(function(e){var t,n,o,a=e.event,c=Aa(a.url);if(c){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.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(Pa,e),[2]}})})}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(Sa||(Sa={}));var La=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new Dn(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={})[Sa.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,ka=Ra({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 ka.unsubscribe(),[2]})})}}},Ma="web-vitals-browser",Na="[Amplitude] Web Vitals",ja={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let Ua=-1;const Fa=()=>Ua,qa=e=>{addEventListener("pageshow",t=>{t.persisted&&(Ua=t.timeStamp,e(t))},!0)},Ba=(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)))}},Ha=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Va=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},za=()=>Va()?.activationStart??0;let Wa=-1;const Ka=new Set,Ya=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ga=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Ka)e();isFinite(Wa)||(Wa="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Ga,!0))}},$a=(e=!1)=>{if(e&&(Wa=1/0),Wa<0){const e=za(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;Wa=t??Ya(),addEventListener("visibilitychange",Ga,!0),addEventListener("prerenderingchange",Ga,!0),qa(()=>{setTimeout(()=>{Wa=Ya()})})}return{get firstHiddenTime(){return Wa},onHidden(e){Ka.add(e)}}},Ja=(e,t=-1,n,r=0,i,o,a)=>{const s=Va(),u=s?.navigationId||0;let c="navigate";return n?c=n:Fa()>=0?c="back-forward-cache":s&&(document.prerendering||za()>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}},Xa=new WeakMap;function Qa(e,t){let n=Xa.get(t);return n||(n=new WeakMap,Xa.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class Za{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 es=(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{}},ts=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,ns=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},rs=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class is{l}const os=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},as=[1800,3e3],ss=(e,t={})=>{const n=ts(t);os(()=>{const r=Qa(t,is),i=$a();let o,a=Ja("FCP");const s=es(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(a.value=Math.max(t.startTime-za(),0),a.entries.push(t),a.navigationId=t.navigationId||a.navigationId,o(!0)))});s&&(o=Ba(e,a,as,t.reportAllChanges),qa(n=>{a=Ja("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Fa()),o=Ba(e,a,as,t.reportAllChanges),Ha(()=>{a.value=performance.now()-n.timeStamp,o(!0)})})),n&&es(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&ns(r.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);a=Ja("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o=Ba(e,a,as,t.reportAllChanges),o(!0)})},t)})},us=[.1,.25],cs=(e,t={})=>{const n=$a();ss(rs(()=>{let r,i=Ja("CLS",0);const o=Qa(t,Za),a=(n,a,s,u,c)=>{i=Ja("CLS",0,n,a,s,u,c),o.i=0,r=Ba(e,i,us,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"];ts(t)&&l.push("soft-navigation");const d=es(l,c);d&&(r=Ba(e,i,us,t.reportAllChanges),n.onHidden(()=>{c(d.takeRecords()),r(!0)}),qa(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Fa()),Ha(r)}),setTimeout(r))}))};let ls=0,ds=1/0,fs=0;const vs=e=>{for(const t of e)t.interactionId&&(ds=Math.min(ds,t.interactionId),fs=Math.max(fs,t.interactionId),ls=fs?(fs-ds)/7+1:0)};let ps;const hs=()=>ps?ls:performance.interactionCount??0;class gs{u=0;v=[];m=new Map;p;T;_(){return hs()-this.u}M(){this.u=hs(),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 ms=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=rs(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})}},ys=[200,500],bs=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=$a();os(()=>{"interactionCount"in performance||ps||(ps=es(["event"],vs,{durationThreshold:0}));let r,i=Ja("INP");const o=Qa(t,gs),a=(n,a,s,u,c)=>{o.M(),i=Ja("INP",-1,n,a,s,u,c),r=Ba(e,i,ys,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)=>{ms(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):u(t);s(),t&&r(!0)})},l=["event","first-input"];ts(t)&&l.push("soft-navigation");const d=es(l,c,{...t,durationThreshold:t.durationThreshold??40});r=Ba(e,i,ys,t.reportAllChanges),d&&(n.onHidden(()=>{c(d.takeRecords(),!0)}),qa(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Fa())}))})};class ws{p;l;h(e){this.p?.(e)}}const Es=[2500,4e3],Ss=(e,t={})=>{let n=!1;const r=ts(t);os(()=>{let i,o=$a(),a=Ja("LCP");const s=Qa(t,ws),u=(r,s,u,c,l)=>{a=Ja("LCP",-1,r,s,u,c,l),i=Ba(e,a,Es,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=$a(!0))},c=e=>{s.l&&e.navigationId&&ns(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-za(),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=es(d,l);if(f){i=Ba(e,a,Es,t.reportAllChanges);const o=["keydown","click","visibilitychange"],s=e=>{if(e.isTrusted&&!n){const e=a.id;ms(()=>{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});qa(r=>{u("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Fa()),i=Ba(e,a,Es,t.reportAllChanges),Ha(()=>{a.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},ks=[800,1800],Ts=e=>{document.prerendering?os(()=>Ts(e)):"complete"!==document.readyState?addEventListener("load",()=>Ts(e),!0):setTimeout(e)},Ps=(e,t={})=>{const n=ts(t);let r=Ja("TTFB"),i=Ba(e,r,ks,t.reportAllChanges);Ts(()=>{const o=Va();if(o){const a=o.responseStart;r.value=Math.max(a-za(),0),r.entries=[o],i(!0),qa(()=>{r=Ja("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Fa()),i=Ba(e,r,ks,t.reportAllChanges),i(!0)}),n&&es(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(r=Ja("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Ba(e,r,ks,t.reportAllChanges),i(!0))})},t)}})};function xs(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Is(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(xs(e)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(n.navigationId=e.navigationId),n}var _s=Object.values(ja);var As,Os=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:Ma,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=Xe(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":a,"[Amplitude] Page Path":Xe(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":Xe(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 _s.some(function(t){return t in e})}(t)&&l.track(Na,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},Ss((g=function(e){return function(t){o&&!a.has(t.navigationId)&&(f(t)[e]=Is(t,!0),t.navigationId>d&&(-1!==d&&h(t.navigationId),d=t.navigationId))}})(ja.LCP),m),ss(g(ja.FCP),m),bs(g(ja.INP),m),cs(g(ja.CLS),m),Ps(g(ja.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=B();return e&&"PerformanceSoftNavigation"in e}()?Os():function(){var e=null,t=B(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:Ma,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=Xe((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":Xe((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Xe(o.split("?")[0],t.loggerProvider)},Ss(function(e){a["[Amplitude] LCP"]=Is(e)}),ss(function(e){a["[Amplitude] FCP"]=Is(e)}),bs(function(e){a["[Amplitude] INP"]=Is(e)}),cs(function(e){a["[Amplitude] CLS"]=Is(e)}),Ps(function(e){a["[Amplitude] TTFB"]=Is(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(Na,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=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=it(t.apiKey,"MKTG"),this.webExpStorageKey=it(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=C,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||Re(this.sessionTimeout,this.lastEventTime),Jr(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({},C),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 N),Z(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Rs=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),Ls=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=Ze(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 Rs.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]})})}}},Ms="AMP_CURRENT_PAGE",Ns="AMP_PREVIOUS_PAGE",js="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(As||(As={}));var Us=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),Fs=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(js)]:[3,3];case 1:return e=s.sent(),t=Xe("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[Ms])||"",r=void 0,r=t===n?(null==e?void 0:e[Ns])||"":n||(document.referrer||""),[4,i.set(js,(o={},o[Ms]=t,o[Ns]=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 ot(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=Xe("undefined"!=typeof location&&location.href||""),[4,i.get(js)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[Ms])||"",!!n&&n!==o&&m!==s?[4,i.set(js,(y={},y[Ms]=s,y[Ns]=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,s;return u(this,function(u){switch(u.label){case 0:return(null===(s=e.extra)||void 0===s?void 0:s.pageEngagementSnapshot)?[2,e]:(t=Xe("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(js)]:[3,2]);case 1:if(n=u.sent(),r=(null==n?void 0:n[Ns])||"",Us.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":qs(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":qs(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":qs(e,"[Amplitude] Page Path","undefined"!=typeof location&&Xe(location.pathname)||""),"[Amplitude] Page Title":qs(e,"[Amplitude] Page Title",hn(pn)),"[Amplitude] Page URL":qs(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(js,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function qs(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},Hs="userProperty",Vs="eventProperty",zs=function(e){return e===Hs||e===Vs},Ws=[Hs,Vs],Ks=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(zs))),!1);return t.length>0?t:d([],l(Ws),!1)}(e.trackingMethod).includes(t)},Ys=function(e){return Ks(e,Hs)},Gs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return 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,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 oe,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:re.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:Yr,y=this._diagnosticsSampleRate,b=null===(c=t.enableDiagnostics)||void 0===c||c,p?(m=new xt(t.apiKey,h,g,null===(l=t.remoteConfig)||void 0===l?void 0:l.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:C.sent(),C.label=2;case 2:return(w=new yt(t.apiKey,h,g,{enabled:b,sampleRate:y})).setTag("library","".concat(Er,"/").concat(wr)),w.setTag("platform","Web"),w.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&&w.setTag("user_agent",navigator.userAgent),[4,ii(t.apiKey,t,this,w,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return E=C.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&ki(t,E),e()})})]:[3,5];case 4:C.sent(),C.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return C.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=m,L=this.config,S=rr(L.defaultTracking)&&L.defaultTracking&&"object"==typeof L.defaultTracking&&L.defaultTracking.attribution&&"object"==typeof L.defaultTracking.attribution?o({},L.defaultTracking.attribution):{},rr(this.config.defaultTracking)&&Ys(S)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(O,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Ds(S,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Ds(S,this.config),[4,this.webAttribution.init()]):[3,8];case 7:C.sent(),C.label=8;case 8:return k=Ne(),T=k.ampTimestamp?Number(k.ampTimestamp):void 0,P=!T||Date.now()<T,x=P&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(I=this.config.deferredSessionId)||this.config.optOut||(I=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:x)&&void 0!==f?f:I)&&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]})})}),(_=Ce(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(Si()).promise];case 9:C.sent(),C.label=10;case 10:return[4,this.add(new Ee({diagnosticsClient:w})).promise];case 11:return C.sent(),[4,this.add(new Sr).promise];case 12:return C.sent(),[4,this.add(new De).promise];case 13:return C.sent(),function(e){Ei||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."),Ei=!0)}(this.config),R=this.config.defaultTracking,nr(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(wi()).promise]):[3,15];case 14:C.sent(),C.label=15;case 15:return ir(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(mi()).promise]):[3,17];case 16:C.sent(),C.label=17;case 17:return(A=void 0===gr(this.config).trackOn)&&sr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Fs()).promise]):[3,19];case 18:C.sent(),C.label=19;case 19:return or(this.config.defaultTracking)?this.config.optOut?[3,21]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(li(gr(this.config))).promise]):[3,22];case 20:return C.sent(),[3,22];case 21:this.timeline.addOptOutListener(function(e){return s(O,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(li(gr(this.config))).promise]);case 1:return t.sent(),[2]}})})}),C.label=22;case 22:return rr(this.config.defaultTracking)&&function(e){return Ks(e,Vs)}(S)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(Ls(S)).promise]):[3,24];case 23:C.sent(),C.label=24;case 24:return cr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(ra(vr(this.config),{diagnosticsClient:w})).promise]):[3,26];case 25:C.sent(),C.label=26;case 26:return dr(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(ma(pr(this.config))).promise]):[3,28];case 27:C.sent(),C.label=28;case 28:return ur(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(La(hr(this.config))).promise]):[3,30];case 29:C.sent(),C.label=30;case 30: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(lr(this.config))).promise]):[3,32];case 31:C.sent(),C.label=32;case 32: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(Ta(fr(this.config))).promise]):[3,34];case 33:C.sent(),C.label=34;case 34:return A||!sr(this.config.autocapture)?[3,36]:(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(Fs()).promise]);case 35:C.sent(),C.label=36;case 36:return("boolean"==typeof(D=this.config.customEnrichment)?D:"object"==typeof D&&null!==D&&!1!==D.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(Bs()).promise]):[3,38];case 37:C.sent(),C.label=38;case 38:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 39:return C.sent(),_.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 D,R,L})})},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){Ce(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){Ce(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(V()),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 N,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=[];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 r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,ar(this.config.defaultTracking)&&(r&&i&&n.push(this.track(jr,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(Z(this.config.identify)).promise),ar(this.config.defaultTracking)&&n.push(this.track(Nr,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ee(Promise.all(n))},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=ai(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(br(t)){var r=t._q;t._q=[],t=yr(new N,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(br(r)){var o=r._q;r._q=[],r=yr(new N,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(br(t)){var r=t._q;t._q=[],t=yr(new ne,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!Ys(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return s(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=Re(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Nr||t.event_type===jr||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=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}(te),$s=function(){var e=new Gs;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"]))}},Js=$s(),Xs=new Set(["playing","waiting"]),Qs={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"},Zs=new Set(["position","percent_completed","stop_reason"]);var eu=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=ke.get(e);if(n)return n;var r=new Se(e,6e4,36e5,t);return ke.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=c(Object.entries(e)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),u=s[0],d=s[1];i[null!==(r=Qs[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,c=t.playbackState,l=n.playbackState;if("ended"===c&&(e.extraEventProperties.stream_session_id=V(),e.sessionTimeBaseline=null!==(r=t.watchTime)&&void 0!==r?r:0),!Xs.has(c)&&"playing"===l){e.playId=V(),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:V(),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:V(),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)),Xs.has(t.playbackState)&&!Xs.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 Zn({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()}),B()&&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=c(Object.entries(null!=e?e:{})),o=i.next();!o.done;o=i.next()){var a=l(o.value,2),s=a[0],u=a[1];Zs.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:tu(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 tu(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?0:Math.min(100,Math.max(0,e/t*100))}var nu=Js.add,ru=Js.extendSession,iu=Js.flush,ou=Js.getDeviceId,au=Js.getIdentity,su=Js.getOptOut,uu=Js.getSessionId,cu=Js.getUserId,lu=Js.groupIdentify,du=Js.identify,fu=Js.init,vu=Js.logEvent,pu=Js.remove,hu=Js.reset,gu=Js.revenue,mu=Js.setDeviceId,yu=Js.setGroup,bu=Js.setIdentity,wu=Js.setOptOut,Eu=Js.setSessionId,Su=Js.setTransport,ku=Js.setUserId,Tu=Js.track,Pu=Js._setDiagnosticsSampleRate,xu=Object.freeze({__proto__:null,add:nu,extendSession:ru,flush:iu,getDeviceId:ou,getIdentity:au,getOptOut:su,getSessionId:uu,getUserId:cu,groupIdentify:lu,identify:du,init:fu,logEvent:vu,remove:pu,reset:hu,revenue:gu,setDeviceId:mu,setGroup:yu,setIdentity:bu,setOptOut:wu,setSessionId:Eu,setTransport:Su,setUserId:ku,track:Tu,_setDiagnosticsSampleRate:Pu,createInstance:$s,AmplitudeBrowser:Gs,runQueuedFunctions:mr,Revenue:ne,Identify:N,trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new eu(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:V()})).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:Gr});!function(){var e=B();if(e){var t=function(e){var t=$s(),n=B();return n&&n.amplitudeGTM&&n.amplitudeGTM._iq&&e&&(n.amplitudeGTM._iq[e]=t),t};if(e.amplitudeGTM=Object.assign(e.amplitudeGTM||{},xu,{createInstance:t}),e.amplitudeGTM.invoked){var n=e.amplitudeGTM._q;e.amplitudeGTM._q=[],mr(xu,n);for(var r=Object.keys(e.amplitudeGTM._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitudeGTM._iq[o],t(o)),s=a._q;a._q=[],mr(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
|
|
2
2
|
//# sourceMappingURL=amplitude-gtm-min.js.map
|