@amplitude/analytics-browser 2.2.3 → 2.3.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 CHANGED
@@ -51,7 +51,7 @@ This SDK is also available through CDN. Copy the script loader below and paste b
51
51
  <!-- README_SNIPPET_BLOCK -->
52
52
  ```html
53
53
  <script type="text/javascript">
54
- !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<g.length;t++)o(e,g[t],!1);for(var r=0;r<h.length;r++)o(e,h[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-QhN12IHEJCDzzlNZ/ugu3iCq5jVI1saLR0QXlVfubYxdHb8NhKqgMhr9KeruyviR",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-2.2.3-min.js.gz",u.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(c,l[p]);r.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)n(d,f[v]);r.Revenue=d;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],h=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
54
+ !function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var n=0;n<y.length;n++)o(e,y[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-3X3tXIucakqeV9+8J7rNyz7UnAJ4t3FGtY8QrzGYyVpetkZpCpBnbXxk84pmQBaT",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.3.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)r(u,p[l]);n.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}();
55
55
 
56
56
  amplitude.init("<YOUR_API_KEY>");
57
57
  </script>
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.2.3";
1
+ export declare const VERSION = "2.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.VERSION = void 0;
3
- exports.VERSION = '2.2.3';
3
+ exports.VERSION = '2.3.0';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.2.3';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.3.0';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.2.3";
1
+ export declare const VERSION = "2.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '2.2.3';
1
+ export var VERSION = '2.3.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.2.3';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '2.3.0';\n"]}
@@ -0,0 +1 @@
1
+ !function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},i=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(i(e,t,Array.prototype.slice.call(arguments)))}}},s=function(e){for(var t=0;t<v.length;t++)o(e,v[t],!1);for(var n=0;n<y.length;n++)o(e,y[n],!0)};n.invoked=!0;var a=t.getElementsByTagName("script")[0],u=t.createElement("script");u.src="https://cdn.amplitude.com/libs/plugin-auto-tracking-browser-0.1.1-min.js.gz",u.async=!1,a.parentNode.insertBefore(u,a);var c=t.createElement("script");c.type="text/javascript",c.integrity="sha384-3X3tXIucakqeV9+8J7rNyz7UnAJ4t3FGtY8QrzGYyVpetkZpCpBnbXxk84pmQBaT",c.crossOrigin="anonymous",c.async=!1,c.src="https://cdn.amplitude.com/libs/analytics-browser-2.3.0-min.js.gz",c.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK"),e.amplitude.init("YOUR_API_KEY","YOUR_USER_ID",{instanceName:"amplitude-bookmarklet",serverZone:"YOUR_SERVER_ZONE",ingestionMetadata:{sourceName:"browser-typescript-bookmarklet",sourceVersion:"1.0.0"},optOut:!1}),amplitudeAutoTrackingPlugin&&amplitudeAutoTrackingPlugin.autoTrackingPlugin&&"function"==typeof amplitudeAutoTrackingPlugin.autoTrackingPlugin&&e.amplitude.add(amplitudeAutoTrackingPlugin.autoTrackingPlugin()),alert("Amplitude is now tracking events!")},a.parentNode.insertBefore(c,a);for(var l=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<p.length;d++)r(l,p[d]);n.Identify=l;for(var g=function(){return this._q=[],this},m=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<m.length;f++)r(g,m[f]);n.Revenue=g;var v=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];s(n),n.createInstance=function(e){return n._iq[e]={_q:[]},s(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}();
@@ -0,0 +1 @@
1
+ javascript:!function()%7B%22use%20strict%22%3B!function(e%2Ct)%7Bvar%20n%3De.amplitude%7C%7C%7B_q%3A%5B%5D%2C_iq%3A%7B%7D%7D%3Bif(n.invoked)e.console%26%26console.error%26%26console.error(%22Amplitude%20snippet%20has%20been%20loaded.%22)%3Belse%7Bvar%20r%3Dfunction(e%2Ct)%7Be.prototype%5Bt%5D%3Dfunction()%7Breturn%20this._q.push(%7Bname%3At%2Cargs%3AArray.prototype.slice.call(arguments%2C0)%7D)%2Cthis%7D%7D%2Ci%3Dfunction(e%2Ct%2Cn)%7Breturn%20function(r)%7Be._q.push(%7Bname%3At%2Cargs%3AArray.prototype.slice.call(n%2C0)%2Cresolve%3Ar%7D)%7D%7D%2Co%3Dfunction(e%2Ct%2Cn)%7Be%5Bt%5D%3Dfunction()%7Bif(n)return%7Bpromise%3Anew%20Promise(i(e%2Ct%2CArray.prototype.slice.call(arguments)))%7D%7D%7D%2Cs%3Dfunction(e)%7Bfor(var%20t%3D0%3Bt%3Cv.length%3Bt%2B%2B)o(e%2Cv%5Bt%5D%2C!1)%3Bfor(var%20n%3D0%3Bn%3Cy.length%3Bn%2B%2B)o(e%2Cy%5Bn%5D%2C!0)%7D%3Bn.invoked%3D!0%3Bvar%20a%3Dt.getElementsByTagName(%22script%22)%5B0%5D%2Cu%3Dt.createElement(%22script%22)%3Bu.src%3D%22https%3A%2F%2Fcdn.amplitude.com%2Flibs%2Fplugin-auto-tracking-browser-0.1.1-min.js.gz%22%2Cu.async%3D!1%2Ca.parentNode.insertBefore(u%2Ca)%3Bvar%20c%3Dt.createElement(%22script%22)%3Bc.type%3D%22text%2Fjavascript%22%2Cc.integrity%3D%22sha384-3X3tXIucakqeV9%2B8J7rNyz7UnAJ4t3FGtY8QrzGYyVpetkZpCpBnbXxk84pmQBaT%22%2Cc.crossOrigin%3D%22anonymous%22%2Cc.async%3D!1%2Cc.src%3D%22https%3A%2F%2Fcdn.amplitude.com%2Flibs%2Fanalytics-browser-2.3.0-min.js.gz%22%2Cc.onload%3Dfunction()%7Be.amplitude.runQueuedFunctions%7C%7Cconsole.log(%22%5BAmplitude%5D%20Error%3A%20could%20not%20load%20SDK%22)%2Ce.amplitude.init(%22YOUR_API_KEY%22%2C%22YOUR_USER_ID%22%2C%7BinstanceName%3A%22amplitude-bookmarklet%22%2CserverZone%3A%22YOUR_SERVER_ZONE%22%2CingestionMetadata%3A%7BsourceName%3A%22browser-typescript-bookmarklet%22%2CsourceVersion%3A%221.0.0%22%7D%2CoptOut%3A!1%7D)%2CamplitudeAutoTrackingPlugin%26%26amplitudeAutoTrackingPlugin.autoTrackingPlugin%26%26%22function%22%3D%3Dtypeof%20amplitudeAutoTrackingPlugin.autoTrackingPlugin%26%26e.amplitude.add(amplitudeAutoTrackingPlugin.autoTrackingPlugin())%2Calert(%22Amplitude%20is%20now%20tracking%20events!%22)%7D%2Ca.parentNode.insertBefore(c%2Ca)%3Bfor(var%20l%3Dfunction()%7Breturn%20this._q%3D%5B%5D%2Cthis%7D%2Cp%3D%5B%22add%22%2C%22append%22%2C%22clearAll%22%2C%22prepend%22%2C%22set%22%2C%22setOnce%22%2C%22unset%22%2C%22preInsert%22%2C%22postInsert%22%2C%22remove%22%2C%22getUserProperties%22%5D%2Cd%3D0%3Bd%3Cp.length%3Bd%2B%2B)r(l%2Cp%5Bd%5D)%3Bn.Identify%3Dl%3Bfor(var%20g%3Dfunction()%7Breturn%20this._q%3D%5B%5D%2Cthis%7D%2Cm%3D%5B%22getEventProperties%22%2C%22setProductId%22%2C%22setQuantity%22%2C%22setPrice%22%2C%22setRevenue%22%2C%22setRevenueType%22%2C%22setEventProperties%22%5D%2Cf%3D0%3Bf%3Cm.length%3Bf%2B%2B)r(g%2Cm%5Bf%5D)%3Bn.Revenue%3Dg%3Bvar%20v%3D%5B%22getDeviceId%22%2C%22setDeviceId%22%2C%22getSessionId%22%2C%22setSessionId%22%2C%22getUserId%22%2C%22setUserId%22%2C%22setOptOut%22%2C%22setTransport%22%2C%22reset%22%2C%22extendSession%22%5D%2Cy%3D%5B%22init%22%2C%22add%22%2C%22remove%22%2C%22track%22%2C%22logEvent%22%2C%22identify%22%2C%22groupIdentify%22%2C%22setGroup%22%2C%22revenue%22%2C%22flush%22%5D%3Bs(n)%2Cn.createInstance%3Dfunction(e)%7Breturn%20n._iq%5Be%5D%3D%7B_q%3A%5B%5D%7D%2Cs(n._iq%5Be%5D)%2Cn._iq%5Be%5D%7D%2Ce.amplitude%3Dn%7D%7D(window%2Cdocument)%7D()%3B%0A
@@ -1 +1 @@
1
- !function(){"use strict";var e=function(t,n){return e=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])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function r(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function o(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var c,l,d,f,p,v,h=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},g=function(){var e,t=h();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),i=y(n[0]),r=y(n[1]);return r?(e[i]=r,e):e}),{}):{}},y=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},m="dclid",b="fbclid",_="gbraid",I="gclid",w="ko_click_id",S="li_fat_id",E="msclkid",T="rtd_cid",O="ttclid",k="twclid",P="wbraid",R={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},x=function(){function e(){}return e.prototype.parse=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,n(n(n(n({},R),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=g();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=g();return(e={})[m]=t[m],e[b]=t[b],e[_]=t[_],e[I]=t[I],e[w]=t[w],e[S]=t[S],e[E]=t[E],e[T]=t[T],e[O]=t[O],e[k]=t[k],e[P]=t[P],e},e}(),U="Event rejected due to exceeded retry count";!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"}(c||(c={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(l||(l={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(d||(d={})),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"}(f||(f={})),function(e){e.US="US",e.EU="EU"}(p||(p={})),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"}(v||(v={}));var q=Object.freeze({__proto__:null,get SpecialEventType(){return d},get IdentifyOperation(){return c},get RevenueProperty(){return l},get LogLevel(){return f},get ServerZone(){return p},get Status(){return v}}),D=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=v.Unknown),{event:e,code:t,message:n}},N=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,N)},L=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,s;return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:N(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(s=e.setup)||void 0===s?void 0:s.call(e,t,this.client)];case 1:return r.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.reset=function(e){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.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 r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,f,p,v,h,g,y,m,b,_,I,w,S,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(n({},i))]:[3,4];case 3:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=o.sent(),I={error:f},[3,8];case 7:try{d&&!d.done&&(w=l.return)&&w.call(l)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),o.label=9;case 9:o.trys.push([9,14,15,16]),v=s(p),h=v.next(),o.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(n({},i))]:[3,12];case 11:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=o.sent(),S={error:m},[3,16];case 15:try{h&&!h.done&&(E=v.return)&&E.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),_=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return D(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0]||D(i,100,"Event not tracked, no destination plugins on the instance");a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,n,i=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),A="AMP",j="".concat(A,"_unsent"),M="https://api2.amplitude.com/2/httpapi",C=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!V(t,n))return!1}return!0},V=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&C(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return C(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},F=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(c.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(c.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(c.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(c.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(c.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(c.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(c.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(c.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(c.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[c.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[c.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===c.ADD?"number"==typeof n:e===c.UNSET||e===c.REMOVE||V(t,n)))},e}(),Q=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},$=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new L(this),this.name=e}return e.prototype._init=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return r(this,void 0,void 0,(function(){var t,n,i,r,u,a;return o(this,(function(o){switch(o.label){case 0:t=this[e],this[e]=[],o.label=1;case 1:o.trys.push([1,6,7,8]),n=s(t),i=n.next(),o.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:o.sent(),o.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=o.sent(),u={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return $(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Q(e,t);return $(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:d.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return $(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new F;return o.set(e,t),n(n({},i),{event_type:d.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,i);return $(this.dispatch(r))},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:d.REVENUE,event_properties:e.getEventProperties()})}(e,t);return $(this.dispatch(i))},e.prototype.add=function(e){return this.config?$(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),$())},e.prototype.remove=function(e){return this.config?$(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),$())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(D(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,D(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=D(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return $(this.timeline.flush())},e}(),B=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return C(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[l.REVENUE_PRODUCT_ID]=this.productId,e[l.REVENUE_QUANTITY]=this.quantity,e[l.REVENUE_PRICE]=this.price,e[l.REVENUE_TYPE]=this.revenueType,e[l.REVENUE]=this.revenue,e},e}(),z="Amplitude Logger ",G=function(){function e(){this.logLevel=f.None}return e.prototype.disable=function(){this.logLevel=f.None},e.prototype.enable=function(e){void 0===e&&(e=f.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Verbose||console.log("".concat(z,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Warn||console.warn("".concat(z,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Error||console.error("".concat(z,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Debug||console.log("".concat(z,"[Debug]: ").concat(e.join(" ")))},e}(),W=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:f.Warn,loggerProvider:new G,optOut:!1,serverUrl:M,serverZone:"US",useBatch:!1}},J=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=W();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=e.instanceName||o.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.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=Y(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),Z=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":M},Y=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=W().serverZone),void 0===n&&(n=W().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:W().serverZone;return{serverZone:i,serverUrl:Z(i,n)}};function H(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var X=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return r(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(j,"_").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=r.sent(),this.saveEvents(),n&&n.length>0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,U),!1)}));i.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,n,i,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),r=Y(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(s=o.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(H(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return u=o.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case v.Success:this.handleSuccessResponse(e,t);break;case v.Invalid:this.handleInvalidResponse(e,t);break;case v.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case v.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 i=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(H(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),c=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(D(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),ee=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},te=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ne=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=s(t.split(".")),o=r.next();!o.done;o=r.next()){var u=o.value;if(!(u in e))return;e=e[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},ie=function(e,t){return function(){var n,i,r={};try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;r[a]=ne(e,a)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},re=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<f.Debug||!c||!a)return e.apply(r,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ee(1),time:{start:(new Date).toISOString()},states:{}};i&&l.states&&(l.states.before=i());var d=e.apply(r,o);return d&&d.promise?d.promise.then((function(){i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},oe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),se=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,p,h,g,y,m,b,_,I,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case v.Success:return{status:T,statusCode:E,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!==(i=e.server_upload_time)&&void 0!==i?i:0}};case v.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},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!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case v.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case v.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case v.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),ue=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[A,t,e.substring(0,n)].filter(Boolean).join("_")},ae=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ce=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:if(!h())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return r(this,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){return i=h(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(s=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,s.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return r(this,void 0,void 0,(function(){var i,r,s,u,a,c;return o(this,(function(o){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,s=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=h())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),le=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},n}(se),de=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:fe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),fe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},pe=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),ve=function(){return ve=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ve.apply(this,arguments)},he=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++){if(r[i]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!he(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){he(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!he(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var ge=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ve({},this.identity.userProperties),n=ve(ve({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++){delete t[d=v[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ve({},this.identity)},e.prototype.setIdentity=function(e){var t=ve({},this.identity);this.identity=ve({},e),he(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,me=function(){function e(){this.identityStore=new ge,this.eventBridge=new pe,this.applicationContextProvider=new de}return e.getInstance=function(t){return ye.analyticsConnectorInstances||(ye.analyticsConnectorInstances={}),ye.analyticsConnectorInstances[t]||(ye.analyticsConnectorInstances[t]=new e),ye.analyticsConnectorInstances[t]},e}(),be=function(e){return void 0===e&&(e="$default_instance"),me.getInstance(e)},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=be().identityStore}return e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return e.instanceName&&(this.identityStore=be(e.instanceName).identityStore),[2]}))}))},e}(),Ie=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},we=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Se=function(e){return we(e,"attribution")},Ee=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,we(n,"pageViews"))&&(i=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(i=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:i,trackHistoryChanges:r,eventType:t}},Te=function(e,t){Oe(e,t)},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},ke=function(e){return e&&void 0!==e._q},Pe=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.2.3"),"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,i;return r(this,void 0,void 0,(function(){var r,s,u;return o(this,(function(o){return r=(new Date).getTime(),s=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(i=e.event_id)&&void 0!==i?i:s+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=r),[2,n(n(n(n(n(n(n(n({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:Ie()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:N(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Re=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(i){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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),xe=1e3,Ue=function(e){function n(t){var n,i=this;return(i=e.call(this,null===(n=h())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return t(n,e),n.prototype.set=function(t,n){var i;return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xe?(r=n.length-xe,[4,e.prototype.set.call(this,t,n.slice(0,xe))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(xe,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},n}(Re),qe=function(e){function n(){var t;return e.call(this,null===(t=h())||void 0===t?void 0:t.sessionStorage)||this}return t(n,e),n}(Re),De=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},n}(se),Ne=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){var o=h();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},n}(se),Le=function(e,t,n){return void 0===n&&(n=!0),r(void 0,void 0,void 0,(function(){var i,r,s,a,c,l,d,f,p;return o(this,(function(o){switch(o.label){case 0:return i=function(e){return"".concat(A.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=o.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:o.sent(),o.label=3;case 3:return s=u(r.split("."),6),a=s[0],c=s[1],l=s[2],d=s[3],f=s[4],p=s[5],[2,{deviceId:a,userId:je(c),sessionId:Ae(d),lastEventId:Ae(p),lastEventTime:Ae(f),optOut:Boolean(l)}]}}))}))},Ae=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},je=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Me="[Amplitude]",Ce="".concat(Me," Form Started"),Ve="".concat(Me," Form Submitted"),Fe="".concat(Me," File Downloaded"),Qe="session_start",$e="session_end",Ke="".concat(Me," File Extension"),Be="".concat(Me," File Name"),ze="".concat(Me," Link ID"),Ge="".concat(Me," Link Text"),We="".concat(Me," Link URL"),Je="".concat(Me," Form ID"),Ze="".concat(Me," Form Name"),Ye="".concat(Me," Form Destination"),He="cookie",Xe=function(e){function n(t,n,i,r,o,s,u,a,c,l,d,p,v,h,g,y,m,b,_,I,w,S,E,T,O,k,P,R,x){void 0===i&&(i=new oe),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=He),void 0===g&&(g=new G),void 0===y&&(y=f.Warn),void 0===b&&(b=!1),void 0===w&&(w=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===O&&(O=new Ue({loggerProvider:g})),void 0===k&&(k={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===R&&(R=!1);var U=e.call(this,{apiKey:t,storageProvider:O,transportProvider:nt(P)})||this;return U.apiKey=t,U.appVersion=n,U.cookieOptions=r,U.defaultTracking=o,U.flushIntervalMillis=u,U.flushMaxRetries=a,U.flushQueueSize=c,U.identityStorage=l,U.ingestionMetadata=d,U.instanceName=p,U.loggerProvider=g,U.logLevel=y,U.minIdLength=m,U.partnerId=_,U.plan=I,U.serverUrl=w,U.serverZone=S,U.sessionTimeout=T,U.storageProvider=O,U.trackingOptions=k,U.transport=P,U.useBatch=R,U._optOut=!1,U._cookieStorage=i,U.deviceId=s,U.lastEventId=v,U.lastEventTime=h,U.optOut=b,U.sessionId=E,U.userId=x,U.loggerProvider.enable(U.logLevel),U}return t(n,e),Object.defineProperty(n.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),n.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId};this.cookieStorage.set(ue(this.apiKey),e)},n}(J),et=function(e,t,i){return void 0===t&&(t={}),r(void 0,void 0,void 0,(function(){var r,s,u,a,c,l,d,f,p,v,h,y,m,b,_,I,w,S,E,T,O,k,P,R,x,U,q,D,L,A,j,M,C,V,F,Q,$,K,B;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||He,I={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(a=S,[3,4]);case 2:return[4,it()];case 3:a=o.sent(),o.label=4;case 4:u=a,o.label=5;case 5:return s=n.apply(void 0,[(I.domain=u,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=tt(t.identityStorage,s),[4,Le(e,c,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=o.sent(),[4,c.get(ue(e))];case 7:return d=o.sent(),f=g(),p=null!==(R=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==R?R:N(),v=null!==(x=null==d?void 0:d.lastEventId)&&void 0!==x?x:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,y=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,m=null!==(L=null==d?void 0:d.sessionId)&&void 0!==L?L:l.sessionId,b=null!==(j=null!==(A=t.userId)&&void 0!==A?A:null==d?void 0:d.userId)&&void 0!==j?j:l.userId,i.previousSessionDeviceId=null!==(M=null==d?void 0:d.deviceId)&&void 0!==M?M:l.deviceId,i.previousSessionUserId=null!==(C=null==d?void 0:d.userId)&&void 0!==C?C:l.userId,_={ipAddress:null===(F=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===F||F,language:null===($=null===(Q=t.trackingOptions)||void 0===Q?void 0:Q.language)||void 0===$||$,platform:null===(B=null===(K=t.trackingOptions)||void 0===K?void 0:K.platform)||void 0===B||B},[2,new Xe(e,t.appVersion,c,s,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,b)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new qe;case"none":return new oe;default:return new ce(n(n({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new De:"beacon"===e?new Ne:new le},it=function(e){return r(void 0,void 0,void 0,(function(){var t,n,i,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return[4,(new ce).isEnabled()];case 1:if(!o.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",s=n.length-2;s>=0;--s)i.push(n.slice(s).join("."));s=0,o.label=2;case 2:return s<i.length?(u=i[s],[4,(a=new ce({domain:"."+u})).set(r,1)]):[3,7];case 3:return o.sent(),[4,a.get(r)];case 4:return o.sent()?[4,a.remove(r)]:[3,6];case 5:return o.sent(),[2,"."+u];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ot=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}))},st=function(e){var t=this;void 0===e&&(e={});var s={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,s){var a;return r(this,void 0,void 0,(function(){var r,c,l,d,f,p,v,h;return o(this,(function(o){switch(o.label){case 0:return r=n({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(b=null===(a=t.cookieOptions)||void 0===a?void 0:a.domain,_=b,_?(_.startsWith(".")&&(_=_.substring(1)),[new RegExp("".concat(_.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),c=t.cookieStorage,g=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),l=[A,y,g.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new x).parse(),c.get(l)])];case 1:return d=u.apply(void 0,[o.sent(),2]),f=d[0],p=d[1],v=ae(t.sessionTimeout,t.lastEventTime),function(e,t,n,r){void 0===r&&(r=!0);var o=e.referrer,s=e.referring_domain,u=i(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=i(a,["referrer","referring_domain"]);if(ot(n.excludeReferrers,e.referring_domain))return!1;if(!r&&!o&&t)return!1;var d=JSON.stringify(u)!==JSON.stringify(l),f=rt(s||"")!==rt(c||"");return!t||d||f}(f,p,r,v)&&(r.resetSessionOnNewCampaign&&(s.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),h=function(e,t){var i=n(n({},R),e),r=Object.entries(i).reduce((function(e,n){var i,r=u(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new F);return Q(r)}(f,r),s.track(h),c.set(l,f)),[2]}var g,y,m,b,_}))}))},execute:function(e){return r(t,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))}};return s},ut=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},at=function(e){var t;void 0===e&&(e={});var i,s=h(),a=void 0,c=function(){return r(void 0,void 0,void 0,(function(){var t,i,r;return o(this,(function(o){switch(o.label){case 0:return i={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,ct()];case 1:return[2,(i.event_properties=n.apply(void 0,[n.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),i)]}}))}))},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},d="undefined"!=typeof location?location.href:null,f=function(){return r(void 0,void 0,void 0,(function(){var n,i,r,s;return o(this,(function(o){switch(o.label){case 0:return n=location.href,i=dt(e.trackHistoryChanges,n,d||"")&&l(),d=n,i?(null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(r=t).track,[4,c()];case 2:s.apply(r,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return[2]}}))}))},p=function(){f()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,n){return r(void 0,void 0,void 0,(function(){var r,d;return o(this,(function(o){switch(o.label){case 0:return t=n,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s&&(s.addEventListener("popstate",p),i=s.history.pushState,s.history.pushState=new Proxy(s.history.pushState,{apply:function(e,t,n){var i=u(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),f()}})),l()?(a.log("Tracking page view event"),d=(r=t).track,[4,c()]):[3,2];case 1:d.apply(r,[o.sent()]),o.label=2;case 2:return[2]}}))}))},execute:function(t){return r(void 0,void 0,void 0,(function(){var i;return o(this,(function(r){switch(r.label){case 0:return"attribution"===e.trackOn&&lt(t)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),[4,c()]):[3,2];case 1:i=r.sent(),t.event_type=i.event_type,t.event_properties=n(n({},t.event_properties),i.event_properties),r.label=2;case 2:return[2,t]}}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return s&&(s.removeEventListener("popstate",p),i&&(s.history.pushState=i)),[2]}))}))}};return v},ct=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=ut,[4,(new x).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},lt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[c.SET]||{},i=t[c.UNSET]||{},r=a(a([],u(Object.keys(n)),!1),u(Object.keys(i)),!1);return Object.keys(R).every((function(e){return r.includes(e)}))}return!1},dt=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},ft=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return r(void 0,void 0,void 0,(function(){var r;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Ce,((n={})[Je]=e.id,n[Ze]=pt(e.name),n[Ye]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Ce,((n={})[Je]=e.id,n[Ze]=pt(e.name),n[Ye]=e.action,n)),i.track(Ve,((r={})[Je]=e.id,r[Ze]=pt(e.name),r[Ye]=e.action,r)),t=!1}))},Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},pt=function(e){if("string"==typeof e)return e},vt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return r(void 0,void 0,void 0,(function(){var r,s;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=s.exec(n.href),o=null==r?void 0:r[1];o&&function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})}(e,"click",(function(){var t;o&&i.track(Fe,((t={})[Ke]=o,t[Be]=n.pathname,t[ze]=e.id,t[Ge]=e.text,t[We]=e.href,t))}))},s=/\.(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(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},ht=!1,gt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.init=function(e,t,i){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=i):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),$(this._init(n(n({},o),{userId:r,apiKey:e})))},i.prototype._init=function(t){var i,s;return r(this,void 0,void 0,(function(){var r,u,a,c,l=this;return o(this,(function(o){switch(o.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,et(t.apiKey,t,this)]);case 1:return r=o.sent(),[4,e.prototype._init.call(this,r)];case 2:return o.sent(),this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),(u=be(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new X).promise];case 3:return o.sent(),[4,this.add(new Pe).promise];case 4:return o.sent(),[4,this.add(new _e).promise];case 5:return o.sent(),f=this.config,ht||void 0!==f.defaultTracking||(f.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."),ht=!0),d=this.config.defaultTracking,we(d,"fileDownloads")?[4,this.add(vt()).promise]:[3,7];case 6:o.sent(),o.label=7;case 7:return function(e){return we(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(ft()).promise]:[3,9];case 8:o.sent(),o.label=9;case 9:return Se(this.config.defaultTracking)?(a=function(e){return Se(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?n({},e.defaultTracking.attribution):{}}(this.config),c=st(a),[4,this.add(c).promise]):[3,11];case 10:o.sent(),o.label=11;case 11:return[4,this.add(at(Ee(this.config))).promise];case 12:return o.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return o.sent(),u.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var d,f}))}))},i.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},i.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){be(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},i.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},i.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){be(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(N()),this.setUserId(void 0)},i.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},i.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,we(n,"sessions")&&(i&&r&&this.track($e,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Qe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=nt(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new F,i)}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)},i.prototype.groupIdentify=function(t,n,i,r){if(ke(i)){var o=i._q;i._q=[],i=Oe(new F,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new B,i)}return e.prototype.revenue.call(this,t,n)},i.prototype.process=function(t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){return n=Date.now(),i=ae(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Qe||t.event_type===$e||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),yt=function(){var e=new gt;return{init:re(e.init.bind(e),"init",te(e),ie(e,["config"])),add:re(e.add.bind(e),"add",te(e),ie(e,["config.apiKey","timeline.plugins"])),remove:re(e.remove.bind(e),"remove",te(e),ie(e,["config.apiKey","timeline.plugins"])),track:re(e.track.bind(e),"track",te(e),ie(e,["config.apiKey","timeline.queue.length"])),logEvent:re(e.logEvent.bind(e),"logEvent",te(e),ie(e,["config.apiKey","timeline.queue.length"])),identify:re(e.identify.bind(e),"identify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:re(e.groupIdentify.bind(e),"groupIdentify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),setGroup:re(e.setGroup.bind(e),"setGroup",te(e),ie(e,["config.apiKey","timeline.queue.length"])),revenue:re(e.revenue.bind(e),"revenue",te(e),ie(e,["config.apiKey","timeline.queue.length"])),flush:re(e.flush.bind(e),"flush",te(e),ie(e,["config.apiKey","timeline.queue.length"])),getUserId:re(e.getUserId.bind(e),"getUserId",te(e),ie(e,["config","config.userId"])),setUserId:re(e.setUserId.bind(e),"setUserId",te(e),ie(e,["config","config.userId"])),getDeviceId:re(e.getDeviceId.bind(e),"getDeviceId",te(e),ie(e,["config","config.deviceId"])),setDeviceId:re(e.setDeviceId.bind(e),"setDeviceId",te(e),ie(e,["config","config.deviceId"])),reset:re(e.reset.bind(e),"reset",te(e),ie(e,["config","config.userId","config.deviceId"])),getSessionId:re(e.getSessionId.bind(e),"getSessionId",te(e),ie(e,["config"])),setSessionId:re(e.setSessionId.bind(e),"setSessionId",te(e),ie(e,["config"])),extendSession:re(e.extendSession.bind(e),"extendSession",te(e),ie(e,["config"])),setOptOut:re(e.setOptOut.bind(e),"setOptOut",te(e),ie(e,["config"])),setTransport:re(e.setTransport.bind(e),"setTransport",te(e),ie(e,["config"]))}},mt=yt(),bt=mt.add,_t=mt.extendSession,It=mt.flush,wt=mt.getDeviceId,St=mt.getSessionId,Et=mt.getUserId,Tt=mt.groupIdentify,Ot=mt.identify,kt=mt.init,Pt=mt.logEvent,Rt=mt.remove,xt=mt.reset,Ut=mt.revenue,qt=mt.setDeviceId,Dt=mt.setGroup,Nt=mt.setOptOut,Lt=mt.setSessionId,At=mt.setTransport,jt=mt.setUserId,Mt=mt.track,Ct=Object.freeze({__proto__:null,add:bt,extendSession:_t,flush:It,getDeviceId:wt,getSessionId:St,getUserId:Et,groupIdentify:Tt,identify:Ot,init:kt,logEvent:Pt,remove:Rt,reset:xt,revenue:Ut,setDeviceId:qt,setGroup:Dt,setOptOut:Nt,setSessionId:Lt,setTransport:At,setUserId:jt,track:Mt,Types:q,createInstance:yt,runQueuedFunctions:Te,Revenue:B,Identify:F});!function(){var e=h();if(e){var t=function(e){var t=yt(),n=h();return n&&n.amplitudeGTM&&n.amplitudeGTM._iq&&e&&(n.amplitudeGTM._iq[e]=t),t};if(e.amplitudeGTM=Object.assign(e.amplitudeGTM||{},Ct,{createInstance:t}),e.amplitudeGTM.invoked){var n=e.amplitudeGTM._q;e.amplitudeGTM._q=[],Te(Ct,n);for(var i=Object.keys(e.amplitudeGTM._iq)||[],r=0;r<i.length;r++){var o=i[r],s=Object.assign(e.amplitudeGTM._iq[o],t(o)),u=s._q;s._q=[],Te(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
1
+ !function(){"use strict";var e=function(t,n){return e=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])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function r(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function o(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var c,l,d,f,p,v,h=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},g=function(){var e,t=h();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),i=y(n[0]),r=y(n[1]);return r?(e[i]=r,e):e}),{}):{}},y=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},m="dclid",b="fbclid",_="gbraid",I="gclid",w="ko_click_id",S="li_fat_id",E="msclkid",T="rtd_cid",O="ttclid",k="twclid",P="wbraid",R={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},x=function(){function e(){}return e.prototype.parse=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,n(n(n(n({},R),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=g();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=g();return(e={})[m]=t[m],e[b]=t[b],e[_]=t[_],e[I]=t[I],e[w]=t[w],e[S]=t[S],e[E]=t[E],e[T]=t[T],e[O]=t[O],e[k]=t[k],e[P]=t[P],e},e}(),U="Event rejected due to exceeded retry count";!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"}(c||(c={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(l||(l={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(d||(d={})),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"}(f||(f={})),function(e){e.US="US",e.EU="EU"}(p||(p={})),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"}(v||(v={}));var q=Object.freeze({__proto__:null,get SpecialEventType(){return d},get IdentifyOperation(){return c},get RevenueProperty(){return l},get LogLevel(){return f},get ServerZone(){return p},get Status(){return v}}),D=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=v.Unknown),{event:e,code:t,message:n}},N=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,N)},L=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,s;return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:N(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(s=e.setup)||void 0===s?void 0:s.call(e,t,this.client)];case 1:return r.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.reset=function(e){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.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 r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,f,p,v,h,g,y,m,b,_,I,w,S,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(n({},i))]:[3,4];case 3:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=o.sent(),I={error:f},[3,8];case 7:try{d&&!d.done&&(w=l.return)&&w.call(l)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),o.label=9;case 9:o.trys.push([9,14,15,16]),v=s(p),h=v.next(),o.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(n({},i))]:[3,12];case 11:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=o.sent(),S={error:m},[3,16];case 15:try{h&&!h.done&&(E=v.return)&&E.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),_=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return D(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0]||D(i,100,"Event not tracked, no destination plugins on the instance");a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,n,i=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),A="AMP",j="".concat(A,"_unsent"),M="https://api2.amplitude.com/2/httpapi",C=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!V(t,n))return!1}return!0},V=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&C(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return C(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},F=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(c.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(c.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(c.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(c.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(c.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(c.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(c.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(c.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(c.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[c.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[c.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===c.ADD?"number"==typeof n:e===c.UNSET||e===c.REMOVE||V(t,n)))},e}(),Q=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},$=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new L(this),this.name=e}return e.prototype._init=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return r(this,void 0,void 0,(function(){var t,n,i,r,u,a;return o(this,(function(o){switch(o.label){case 0:t=this[e],this[e]=[],o.label=1;case 1:o.trys.push([1,6,7,8]),n=s(t),i=n.next(),o.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:o.sent(),o.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=o.sent(),u={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return $(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Q(e,t);return $(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:d.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return $(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new F;return o.set(e,t),n(n({},i),{event_type:d.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,i);return $(this.dispatch(r))},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:d.REVENUE,event_properties:e.getEventProperties()})}(e,t);return $(this.dispatch(i))},e.prototype.add=function(e){return this.config?$(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),$())},e.prototype.remove=function(e){return this.config?$(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),$())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(D(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,D(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=D(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return $(this.timeline.flush())},e}(),B=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return C(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[l.REVENUE_PRODUCT_ID]=this.productId,e[l.REVENUE_QUANTITY]=this.quantity,e[l.REVENUE_PRICE]=this.price,e[l.REVENUE_TYPE]=this.revenueType,e[l.REVENUE]=this.revenue,e},e}(),z="Amplitude Logger ",G=function(){function e(){this.logLevel=f.None}return e.prototype.disable=function(){this.logLevel=f.None},e.prototype.enable=function(e){void 0===e&&(e=f.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Verbose||console.log("".concat(z,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Warn||console.warn("".concat(z,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Error||console.error("".concat(z,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Debug||console.log("".concat(z,"[Debug]: ").concat(e.join(" ")))},e}(),W=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:f.Warn,loggerProvider:new G,optOut:!1,serverUrl:M,serverZone:"US",useBatch:!1}},J=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=W();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=e.instanceName||o.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.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=Y(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),Z=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":M},Y=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=W().serverZone),void 0===n&&(n=W().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:W().serverZone;return{serverZone:i,serverUrl:Z(i,n)}};function H(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var X=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return r(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(j,"_").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=r.sent(),this.saveEvents(),n&&n.length>0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,U),!1)}));i.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,n,i,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),r=Y(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(s=o.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(H(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return u=o.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case v.Success:this.handleSuccessResponse(e,t);break;case v.Invalid:this.handleInvalidResponse(e,t);break;case v.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case v.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 i=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(H(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),c=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(D(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),ee=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},te=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ne=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=s(t.split(".")),o=r.next();!o.done;o=r.next()){var u=o.value;if(!(u in e))return;e=e[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},ie=function(e,t){return function(){var n,i,r={};try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;r[a]=ne(e,a)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},re=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<f.Debug||!c||!a)return e.apply(r,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ee(1),time:{start:(new Date).toISOString()},states:{}};i&&l.states&&(l.states.before=i());var d=e.apply(r,o);return d&&d.promise?d.promise.then((function(){i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},oe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),se=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,p,h,g,y,m,b,_,I,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case v.Success:return{status:T,statusCode:E,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!==(i=e.server_upload_time)&&void 0!==i?i:0}};case v.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},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!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case v.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case v.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case v.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),ue=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[A,t,e.substring(0,n)].filter(Boolean).join("_")},ae=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ce=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:if(!h())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return r(this,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){return i=h(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(s=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,s.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return r(this,void 0,void 0,(function(){var i,r,s,u,a,c;return o(this,(function(o){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,s=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=h())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),le=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},n}(se),de=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:fe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),fe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},pe=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),ve=function(){return ve=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ve.apply(this,arguments)},he=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++){if(r[i]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!he(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){he(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!he(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var ge=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ve({},this.identity.userProperties),n=ve(ve({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++){delete t[d=v[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ve({},this.identity)},e.prototype.setIdentity=function(e){var t=ve({},this.identity);this.identity=ve({},e),he(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,me=function(){function e(){this.identityStore=new ge,this.eventBridge=new pe,this.applicationContextProvider=new de}return e.getInstance=function(t){return ye.analyticsConnectorInstances||(ye.analyticsConnectorInstances={}),ye.analyticsConnectorInstances[t]||(ye.analyticsConnectorInstances[t]=new e),ye.analyticsConnectorInstances[t]},e}(),be=function(e){return void 0===e&&(e="$default_instance"),me.getInstance(e)},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=be().identityStore}return e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return e.instanceName&&(this.identityStore=be(e.instanceName).identityStore),[2]}))}))},e}(),Ie=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},we=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Se=function(e){return we(e,"attribution")},Ee=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,we(n,"pageViews"))&&(i=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(i=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:i,trackHistoryChanges:r,eventType:t}},Te=function(e,t){Oe(e,t)},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},ke=function(e){return e&&void 0!==e._q},Pe=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.3.0"),"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,i;return r(this,void 0,void 0,(function(){var r,s,u;return o(this,(function(o){return r=(new Date).getTime(),s=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(i=e.event_id)&&void 0!==i?i:s+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=r),[2,n(n(n(n(n(n(n(n({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:Ie()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:N(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Re=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(i){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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),xe=1e3,Ue=function(e){function n(t){var n,i=this;return(i=e.call(this,null===(n=h())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return t(n,e),n.prototype.set=function(t,n){var i;return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xe?(r=n.length-xe,[4,e.prototype.set.call(this,t,n.slice(0,xe))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(xe,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},n}(Re),qe=function(e){function n(){var t;return e.call(this,null===(t=h())||void 0===t?void 0:t.sessionStorage)||this}return t(n,e),n}(Re),De=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},n}(se),Ne=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){var o=h();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},n}(se),Le=function(e,t,n){return void 0===n&&(n=!0),r(void 0,void 0,void 0,(function(){var i,r,s,a,c,l,d,f,p;return o(this,(function(o){switch(o.label){case 0:return i=function(e){return"".concat(A.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=o.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:o.sent(),o.label=3;case 3:return s=u(r.split("."),6),a=s[0],c=s[1],l=s[2],d=s[3],f=s[4],p=s[5],[2,{deviceId:a,userId:je(c),sessionId:Ae(d),lastEventId:Ae(p),lastEventTime:Ae(f),optOut:Boolean(l)}]}}))}))},Ae=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},je=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Me="[Amplitude]",Ce="".concat(Me," Form Started"),Ve="".concat(Me," Form Submitted"),Fe="".concat(Me," File Downloaded"),Qe="session_start",$e="session_end",Ke="".concat(Me," File Extension"),Be="".concat(Me," File Name"),ze="".concat(Me," Link ID"),Ge="".concat(Me," Link Text"),We="".concat(Me," Link URL"),Je="".concat(Me," Form ID"),Ze="".concat(Me," Form Name"),Ye="".concat(Me," Form Destination"),He="cookie",Xe=function(e){function n(t,n,i,r,o,s,u,a,c,l,d,p,v,h,g,y,m,b,_,I,w,S,E,T,O,k,P,R,x){void 0===i&&(i=new oe),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=He),void 0===g&&(g=new G),void 0===y&&(y=f.Warn),void 0===b&&(b=!1),void 0===w&&(w=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===O&&(O=new Ue({loggerProvider:g})),void 0===k&&(k={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===R&&(R=!1);var U=e.call(this,{apiKey:t,storageProvider:O,transportProvider:nt(P)})||this;return U.apiKey=t,U.appVersion=n,U.cookieOptions=r,U.defaultTracking=o,U.flushIntervalMillis=u,U.flushMaxRetries=a,U.flushQueueSize=c,U.identityStorage=l,U.ingestionMetadata=d,U.instanceName=p,U.loggerProvider=g,U.logLevel=y,U.minIdLength=m,U.partnerId=_,U.plan=I,U.serverUrl=w,U.serverZone=S,U.sessionTimeout=T,U.storageProvider=O,U.trackingOptions=k,U.transport=P,U.useBatch=R,U._optOut=!1,U._cookieStorage=i,U.deviceId=s,U.lastEventId=v,U.lastEventTime=h,U.optOut=b,U.sessionId=E,U.userId=x,U.loggerProvider.enable(U.logLevel),U}return t(n,e),Object.defineProperty(n.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),n.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId};this.cookieStorage.set(ue(this.apiKey),e)},n}(J),et=function(e,t,i){return void 0===t&&(t={}),r(void 0,void 0,void 0,(function(){var r,s,u,a,c,l,d,f,p,v,h,y,m,b,_,I,w,S,E,T,O,k,P,R,x,U,q,D,L,A,j,M,C,V,F,Q,$,K,B;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||He,I={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(a=S,[3,4]);case 2:return[4,it()];case 3:a=o.sent(),o.label=4;case 4:u=a,o.label=5;case 5:return s=n.apply(void 0,[(I.domain=u,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=tt(t.identityStorage,s),[4,Le(e,c,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=o.sent(),[4,c.get(ue(e))];case 7:return d=o.sent(),f=g(),p=null!==(R=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==R?R:N(),v=null!==(x=null==d?void 0:d.lastEventId)&&void 0!==x?x:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,y=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,m=null!==(L=null==d?void 0:d.sessionId)&&void 0!==L?L:l.sessionId,b=null!==(j=null!==(A=t.userId)&&void 0!==A?A:null==d?void 0:d.userId)&&void 0!==j?j:l.userId,i.previousSessionDeviceId=null!==(M=null==d?void 0:d.deviceId)&&void 0!==M?M:l.deviceId,i.previousSessionUserId=null!==(C=null==d?void 0:d.userId)&&void 0!==C?C:l.userId,_={ipAddress:null===(F=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===F||F,language:null===($=null===(Q=t.trackingOptions)||void 0===Q?void 0:Q.language)||void 0===$||$,platform:null===(B=null===(K=t.trackingOptions)||void 0===K?void 0:K.platform)||void 0===B||B},[2,new Xe(e,t.appVersion,c,s,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,b)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new qe;case"none":return new oe;default:return new ce(n(n({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new De:"beacon"===e?new Ne:new le},it=function(e){return r(void 0,void 0,void 0,(function(){var t,n,i,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return[4,(new ce).isEnabled()];case 1:if(!o.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",s=n.length-2;s>=0;--s)i.push(n.slice(s).join("."));s=0,o.label=2;case 2:return s<i.length?(u=i[s],[4,(a=new ce({domain:"."+u})).set(r,1)]):[3,7];case 3:return o.sent(),[4,a.get(r)];case 4:return o.sent()?[4,a.remove(r)]:[3,6];case 5:return o.sent(),[2,"."+u];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ot=function(e,t,n,r){void 0===r&&(r=!0),e.referrer;var o=e.referring_domain,s=i(e,["referrer","referring_domain"]),u=t||{};u.referrer;var a=u.referring_domain,c=i(u,["referrer","referring_domain"]);if(st(n.excludeReferrers,e.referring_domain))return!1;if(!r&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return!1;var l=JSON.stringify(s)!==JSON.stringify(c),d=rt(o||"")!==rt(a||"");return!t||l||d},st=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}))},ut=function(e){var t=this;void 0===e&&(e={});var i={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,i){var s;return r(this,void 0,void 0,(function(){var r,a,c,l,d,f,p,v;return o(this,(function(o){switch(o.label){case 0:return r=n({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(m=null===(s=t.cookieOptions)||void 0===s?void 0:s.domain,b=m,b?(b.startsWith(".")&&(b=b.substring(1)),[new RegExp("".concat(b.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),a=t.cookieStorage,h=t.apiKey,void 0===(g="MKTG")&&(g=""),void 0===y&&(y=10),c=[A,g,h.substring(0,y)].filter(Boolean).join("_"),[4,Promise.all([(new x).parse(),a.get(c)])];case 1:return l=u.apply(void 0,[o.sent(),2]),d=l[0],f=l[1],p=ae(t.sessionTimeout,t.lastEventTime),ot(d,f,r,p)&&(r.resetSessionOnNewCampaign&&(i.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),v=function(e,t){var i=n(n({},R),e),r=Object.entries(i).reduce((function(e,n){var i,r=u(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new F);return Q(r)}(d,r),i.track(v),a.set(c,d)),[2]}var h,g,y,m,b}))}))},execute:function(e){return r(t,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))}};return i},at=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},ct=function(e){var t;void 0===e&&(e={});var i,s=h(),a=void 0,c=function(){return r(void 0,void 0,void 0,(function(){var t,i,r;return o(this,(function(o){switch(o.label){case 0:return i={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,lt()];case 1:return[2,(i.event_properties=n.apply(void 0,[n.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),i)]}}))}))},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},d="undefined"!=typeof location?location.href:null,f=function(){return r(void 0,void 0,void 0,(function(){var n,i,r,s;return o(this,(function(o){switch(o.label){case 0:return n=location.href,i=ft(e.trackHistoryChanges,n,d||"")&&l(),d=n,i?(null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(r=t).track,[4,c()];case 2:s.apply(r,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return[2]}}))}))},p=function(){f()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,n){return r(void 0,void 0,void 0,(function(){var r,d;return o(this,(function(o){switch(o.label){case 0:return t=n,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s&&(s.addEventListener("popstate",p),i=s.history.pushState,s.history.pushState=new Proxy(s.history.pushState,{apply:function(e,t,n){var i=u(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),f()}})),l()?(a.log("Tracking page view event"),d=(r=t).track,[4,c()]):[3,2];case 1:d.apply(r,[o.sent()]),o.label=2;case 2:return[2]}}))}))},execute:function(t){return r(void 0,void 0,void 0,(function(){var i;return o(this,(function(r){switch(r.label){case 0:return"attribution"===e.trackOn&&dt(t)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),[4,c()]):[3,2];case 1:i=r.sent(),t.event_type=i.event_type,t.event_properties=n(n({},t.event_properties),i.event_properties),r.label=2;case 2:return[2,t]}}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return s&&(s.removeEventListener("popstate",p),i&&(s.history.pushState=i)),[2]}))}))}};return v},lt=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=at,[4,(new x).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},dt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[c.SET]||{},i=t[c.UNSET]||{},r=a(a([],u(Object.keys(n)),!1),u(Object.keys(i)),!1);return Object.keys(R).every((function(e){return r.includes(e)}))}return!1},ft=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},pt=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return r(void 0,void 0,void 0,(function(){var r;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Ce,((n={})[Je]=e.id,n[Ze]=vt(e.name),n[Ye]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Ce,((n={})[Je]=e.id,n[Ze]=vt(e.name),n[Ye]=e.action,n)),i.track(Ve,((r={})[Je]=e.id,r[Ze]=vt(e.name),r[Ye]=e.action,r)),t=!1}))},Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},vt=function(e){if("string"==typeof e)return e},ht=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return r(void 0,void 0,void 0,(function(){var r,s;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=s.exec(n.href),o=null==r?void 0:r[1];o&&function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})}(e,"click",(function(){var t;o&&i.track(Fe,((t={})[Ke]=o,t[Be]=n.pathname,t[ze]=e.id,t[Ge]=e.text,t[We]=e.href,t))}))},s=/\.(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(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},gt=!1,yt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.init=function(e,t,i){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=i):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),$(this._init(n(n({},o),{userId:r,apiKey:e})))},i.prototype._init=function(t){var i,s;return r(this,void 0,void 0,(function(){var r,u,a,c,l=this;return o(this,(function(o){switch(o.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,et(t.apiKey,t,this)]);case 1:return r=o.sent(),[4,e.prototype._init.call(this,r)];case 2:return o.sent(),this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),(u=be(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new X).promise];case 3:return o.sent(),[4,this.add(new Pe).promise];case 4:return o.sent(),[4,this.add(new _e).promise];case 5:return o.sent(),f=this.config,gt||void 0!==f.defaultTracking||(f.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."),gt=!0),d=this.config.defaultTracking,we(d,"fileDownloads")?[4,this.add(ht()).promise]:[3,7];case 6:o.sent(),o.label=7;case 7:return function(e){return we(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(pt()).promise]:[3,9];case 8:o.sent(),o.label=9;case 9:return Se(this.config.defaultTracking)?(a=function(e){return Se(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?n({},e.defaultTracking.attribution):{}}(this.config),c=ut(a),[4,this.add(c).promise]):[3,11];case 10:o.sent(),o.label=11;case 11:return[4,this.add(ct(Ee(this.config))).promise];case 12:return o.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return o.sent(),u.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var d,f}))}))},i.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},i.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){be(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},i.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},i.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){be(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(N()),this.setUserId(void 0)},i.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},i.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,we(n,"sessions")&&(i&&r&&this.track($e,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Qe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=nt(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new F,i)}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)},i.prototype.groupIdentify=function(t,n,i,r){if(ke(i)){var o=i._q;i._q=[],i=Oe(new F,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new B,i)}return e.prototype.revenue.call(this,t,n)},i.prototype.process=function(t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){return n=Date.now(),i=ae(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Qe||t.event_type===$e||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),mt=function(){var e=new yt;return{init:re(e.init.bind(e),"init",te(e),ie(e,["config"])),add:re(e.add.bind(e),"add",te(e),ie(e,["config.apiKey","timeline.plugins"])),remove:re(e.remove.bind(e),"remove",te(e),ie(e,["config.apiKey","timeline.plugins"])),track:re(e.track.bind(e),"track",te(e),ie(e,["config.apiKey","timeline.queue.length"])),logEvent:re(e.logEvent.bind(e),"logEvent",te(e),ie(e,["config.apiKey","timeline.queue.length"])),identify:re(e.identify.bind(e),"identify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:re(e.groupIdentify.bind(e),"groupIdentify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),setGroup:re(e.setGroup.bind(e),"setGroup",te(e),ie(e,["config.apiKey","timeline.queue.length"])),revenue:re(e.revenue.bind(e),"revenue",te(e),ie(e,["config.apiKey","timeline.queue.length"])),flush:re(e.flush.bind(e),"flush",te(e),ie(e,["config.apiKey","timeline.queue.length"])),getUserId:re(e.getUserId.bind(e),"getUserId",te(e),ie(e,["config","config.userId"])),setUserId:re(e.setUserId.bind(e),"setUserId",te(e),ie(e,["config","config.userId"])),getDeviceId:re(e.getDeviceId.bind(e),"getDeviceId",te(e),ie(e,["config","config.deviceId"])),setDeviceId:re(e.setDeviceId.bind(e),"setDeviceId",te(e),ie(e,["config","config.deviceId"])),reset:re(e.reset.bind(e),"reset",te(e),ie(e,["config","config.userId","config.deviceId"])),getSessionId:re(e.getSessionId.bind(e),"getSessionId",te(e),ie(e,["config"])),setSessionId:re(e.setSessionId.bind(e),"setSessionId",te(e),ie(e,["config"])),extendSession:re(e.extendSession.bind(e),"extendSession",te(e),ie(e,["config"])),setOptOut:re(e.setOptOut.bind(e),"setOptOut",te(e),ie(e,["config"])),setTransport:re(e.setTransport.bind(e),"setTransport",te(e),ie(e,["config"]))}},bt=mt(),_t=bt.add,It=bt.extendSession,wt=bt.flush,St=bt.getDeviceId,Et=bt.getSessionId,Tt=bt.getUserId,Ot=bt.groupIdentify,kt=bt.identify,Pt=bt.init,Rt=bt.logEvent,xt=bt.remove,Ut=bt.reset,qt=bt.revenue,Dt=bt.setDeviceId,Nt=bt.setGroup,Lt=bt.setOptOut,At=bt.setSessionId,jt=bt.setTransport,Mt=bt.setUserId,Ct=bt.track,Vt=Object.freeze({__proto__:null,add:_t,extendSession:It,flush:wt,getDeviceId:St,getSessionId:Et,getUserId:Tt,groupIdentify:Ot,identify:kt,init:Pt,logEvent:Rt,remove:xt,reset:Ut,revenue:qt,setDeviceId:Dt,setGroup:Nt,setOptOut:Lt,setSessionId:At,setTransport:jt,setUserId:Mt,track:Ct,Types:q,createInstance:mt,runQueuedFunctions:Te,Revenue:B,Identify:F});!function(){var e=h();if(e){var t=function(e){var t=mt(),n=h();return n&&n.amplitudeGTM&&n.amplitudeGTM._iq&&e&&(n.amplitudeGTM._iq[e]=t),t};if(e.amplitudeGTM=Object.assign(e.amplitudeGTM||{},Vt,{createInstance:t}),e.amplitudeGTM.invoked){var n=e.amplitudeGTM._q;e.amplitudeGTM._q=[],Te(Vt,n);for(var i=Object.keys(e.amplitudeGTM._iq)||[],r=0;r<i.length;r++){var o=i[r],s=Object.assign(e.amplitudeGTM._iq[o],t(o)),u=s._q;s._q=[],Te(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
Binary file
@@ -1 +1 @@
1
- !function(){"use strict";!function(e,t){var n=e.amplitudeGTM||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},i=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},o=function(e){for(var t=0;t<m.length;t++)i(e,m[t],!1);for(var n=0;n<g.length;n++)i(e,g[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-XOOk53JwcW0Qr7lXs78jPii3fpEfCkafCLm9q0M/Fwo6F+CWMhZAJU3NdvV7dcDe",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-gtm-2.2.3-min.js.gz",a.onload=function(){e.amplitudeGTM.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(a,u);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(c,l[p]);n.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];o(n),n.createInstance=function(e){return n._iq[e]={_q:[]},o(n._iq[e]),n._iq[e]},e.amplitudeGTM=n,e.amplitude||(e.amplitude=e.amplitudeGTM)}}(window,document)}();
1
+ !function(){"use strict";!function(e,t){var n=e.amplitudeGTM||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},i=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},o=function(e){for(var t=0;t<m.length;t++)i(e,m[t],!1);for(var n=0;n<g.length;n++)i(e,g[n],!0)};n.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-2QUHi5tkQrwqCbde1jFiTBS4QwwN28fEVuHDr/Y//zH/ev1M93MH0Ynj0TuGhWLf",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-gtm-2.3.0-min.js.gz",u.onload=function(){e.amplitudeGTM.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(c,l[p]);n.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];o(n),n.createInstance=function(e){return n._iq[e]={_q:[]},o(n._iq[e]),n._iq[e]},e.amplitudeGTM=n,e.amplitude||(e.amplitude=e.amplitudeGTM)}}(window,document)}();
@@ -1 +1 @@
1
- !function(){"use strict";var e=function(t,n){return e=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])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function r(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function o(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var c,l,d,f,p,v,h=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},g=function(){var e,t=h();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),i=y(n[0]),r=y(n[1]);return r?(e[i]=r,e):e}),{}):{}},y=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},m="dclid",b="fbclid",_="gbraid",I="gclid",w="ko_click_id",S="li_fat_id",E="msclkid",T="rtd_cid",O="ttclid",k="twclid",P="wbraid",R={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},x=function(){function e(){}return e.prototype.parse=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,n(n(n(n({},R),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=g();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=g();return(e={})[m]=t[m],e[b]=t[b],e[_]=t[_],e[I]=t[I],e[w]=t[w],e[S]=t[S],e[E]=t[E],e[T]=t[T],e[O]=t[O],e[k]=t[k],e[P]=t[P],e},e}(),U="Event rejected due to exceeded retry count";!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"}(c||(c={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(l||(l={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(d||(d={})),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"}(f||(f={})),function(e){e.US="US",e.EU="EU"}(p||(p={})),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"}(v||(v={}));var q=Object.freeze({__proto__:null,get SpecialEventType(){return d},get IdentifyOperation(){return c},get RevenueProperty(){return l},get LogLevel(){return f},get ServerZone(){return p},get Status(){return v}}),D=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=v.Unknown),{event:e,code:t,message:n}},N=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,N)},L=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,s;return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:N(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(s=e.setup)||void 0===s?void 0:s.call(e,t,this.client)];case 1:return r.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.reset=function(e){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.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 r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,f,p,v,h,g,y,m,b,_,I,w,S,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(n({},i))]:[3,4];case 3:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=o.sent(),I={error:f},[3,8];case 7:try{d&&!d.done&&(w=l.return)&&w.call(l)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),o.label=9;case 9:o.trys.push([9,14,15,16]),v=s(p),h=v.next(),o.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(n({},i))]:[3,12];case 11:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=o.sent(),S={error:m},[3,16];case 15:try{h&&!h.done&&(E=v.return)&&E.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),_=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return D(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0]||D(i,100,"Event not tracked, no destination plugins on the instance");a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,n,i=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),A="AMP",j="".concat(A,"_unsent"),C="https://api2.amplitude.com/2/httpapi",M=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!V(t,n))return!1}return!0},V=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&M(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return M(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},F=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(c.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(c.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(c.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(c.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(c.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(c.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(c.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(c.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(c.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[c.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[c.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===c.ADD?"number"==typeof n:e===c.UNSET||e===c.REMOVE||V(t,n)))},e}(),Q=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},$=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new L(this),this.name=e}return e.prototype._init=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return r(this,void 0,void 0,(function(){var t,n,i,r,u,a;return o(this,(function(o){switch(o.label){case 0:t=this[e],this[e]=[],o.label=1;case 1:o.trys.push([1,6,7,8]),n=s(t),i=n.next(),o.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:o.sent(),o.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=o.sent(),u={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return $(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Q(e,t);return $(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:d.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return $(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new F;return o.set(e,t),n(n({},i),{event_type:d.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,i);return $(this.dispatch(r))},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:d.REVENUE,event_properties:e.getEventProperties()})}(e,t);return $(this.dispatch(i))},e.prototype.add=function(e){return this.config?$(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),$())},e.prototype.remove=function(e){return this.config?$(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),$())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(D(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,D(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=D(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return $(this.timeline.flush())},e}(),B=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return M(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[l.REVENUE_PRODUCT_ID]=this.productId,e[l.REVENUE_QUANTITY]=this.quantity,e[l.REVENUE_PRICE]=this.price,e[l.REVENUE_TYPE]=this.revenueType,e[l.REVENUE]=this.revenue,e},e}(),z="Amplitude Logger ",W=function(){function e(){this.logLevel=f.None}return e.prototype.disable=function(){this.logLevel=f.None},e.prototype.enable=function(e){void 0===e&&(e=f.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Verbose||console.log("".concat(z,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Warn||console.warn("".concat(z,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Error||console.error("".concat(z,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Debug||console.log("".concat(z,"[Debug]: ").concat(e.join(" ")))},e}(),J=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:f.Warn,loggerProvider:new W,optOut:!1,serverUrl:C,serverZone:"US",useBatch:!1}},Z=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=J();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=e.instanceName||o.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.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=G(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),Y=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":C},G=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=J().serverZone),void 0===n&&(n=J().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:J().serverZone;return{serverZone:i,serverUrl:Y(i,n)}};function H(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var X=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return r(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(j,"_").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=r.sent(),this.saveEvents(),n&&n.length>0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,U),!1)}));i.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,n,i,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),r=G(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(s=o.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(H(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return u=o.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case v.Success:this.handleSuccessResponse(e,t);break;case v.Invalid:this.handleInvalidResponse(e,t);break;case v.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case v.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 i=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(H(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),c=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(D(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),ee=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},te=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ne=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=s(t.split(".")),o=r.next();!o.done;o=r.next()){var u=o.value;if(!(u in e))return;e=e[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},ie=function(e,t){return function(){var n,i,r={};try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;r[a]=ne(e,a)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},re=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<f.Debug||!c||!a)return e.apply(r,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ee(1),time:{start:(new Date).toISOString()},states:{}};i&&l.states&&(l.states.before=i());var d=e.apply(r,o);return d&&d.promise?d.promise.then((function(){i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},oe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),se=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,p,h,g,y,m,b,_,I,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case v.Success:return{status:T,statusCode:E,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!==(i=e.server_upload_time)&&void 0!==i?i:0}};case v.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},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!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case v.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case v.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case v.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),ue=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[A,t,e.substring(0,n)].filter(Boolean).join("_")},ae=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ce=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:if(!h())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return r(this,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){return i=h(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(s=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,s.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return r(this,void 0,void 0,(function(){var i,r,s,u,a,c;return o(this,(function(o){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,s=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=h())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),le=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},n}(se),de=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:fe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),fe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},pe=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),ve=function(){return ve=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ve.apply(this,arguments)},he=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++){if(r[i]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!he(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){he(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!he(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var ge=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ve({},this.identity.userProperties),n=ve(ve({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++){delete t[d=v[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ve({},this.identity)},e.prototype.setIdentity=function(e){var t=ve({},this.identity);this.identity=ve({},e),he(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,me=function(){function e(){this.identityStore=new ge,this.eventBridge=new pe,this.applicationContextProvider=new de}return e.getInstance=function(t){return ye.analyticsConnectorInstances||(ye.analyticsConnectorInstances={}),ye.analyticsConnectorInstances[t]||(ye.analyticsConnectorInstances[t]=new e),ye.analyticsConnectorInstances[t]},e}(),be=function(e){return void 0===e&&(e="$default_instance"),me.getInstance(e)},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=be().identityStore}return e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return e.instanceName&&(this.identityStore=be(e.instanceName).identityStore),[2]}))}))},e}(),Ie=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},we=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Se=function(e){return we(e,"attribution")},Ee=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,we(n,"pageViews"))&&(i=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(i=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:i,trackHistoryChanges:r,eventType:t}},Te=function(e,t){Oe(e,t)},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},ke=function(e){return e&&void 0!==e._q},Pe=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.2.3"),"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,i;return r(this,void 0,void 0,(function(){var r,s,u;return o(this,(function(o){return r=(new Date).getTime(),s=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(i=e.event_id)&&void 0!==i?i:s+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=r),[2,n(n(n(n(n(n(n(n({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:Ie()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:N(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Re=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(i){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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),xe=1e3,Ue=function(e){function n(t){var n,i=this;return(i=e.call(this,null===(n=h())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return t(n,e),n.prototype.set=function(t,n){var i;return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xe?(r=n.length-xe,[4,e.prototype.set.call(this,t,n.slice(0,xe))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(xe,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},n}(Re),qe=function(e){function n(){var t;return e.call(this,null===(t=h())||void 0===t?void 0:t.sessionStorage)||this}return t(n,e),n}(Re),De=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},n}(se),Ne=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){var o=h();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},n}(se),Le=function(e,t,n){return void 0===n&&(n=!0),r(void 0,void 0,void 0,(function(){var i,r,s,a,c,l,d,f,p;return o(this,(function(o){switch(o.label){case 0:return i=function(e){return"".concat(A.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=o.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:o.sent(),o.label=3;case 3:return s=u(r.split("."),6),a=s[0],c=s[1],l=s[2],d=s[3],f=s[4],p=s[5],[2,{deviceId:a,userId:je(c),sessionId:Ae(d),lastEventId:Ae(p),lastEventTime:Ae(f),optOut:Boolean(l)}]}}))}))},Ae=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},je=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ce="[Amplitude]",Me="".concat(Ce," Form Started"),Ve="".concat(Ce," Form Submitted"),Fe="".concat(Ce," File Downloaded"),Qe="session_start",$e="session_end",Ke="".concat(Ce," File Extension"),Be="".concat(Ce," File Name"),ze="".concat(Ce," Link ID"),We="".concat(Ce," Link Text"),Je="".concat(Ce," Link URL"),Ze="".concat(Ce," Form ID"),Ye="".concat(Ce," Form Name"),Ge="".concat(Ce," Form Destination"),He="cookie",Xe=function(e){function n(t,n,i,r,o,s,u,a,c,l,d,p,v,h,g,y,m,b,_,I,w,S,E,T,O,k,P,R,x){void 0===i&&(i=new oe),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=He),void 0===g&&(g=new W),void 0===y&&(y=f.Warn),void 0===b&&(b=!1),void 0===w&&(w=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===O&&(O=new Ue({loggerProvider:g})),void 0===k&&(k={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===R&&(R=!1);var U=e.call(this,{apiKey:t,storageProvider:O,transportProvider:nt(P)})||this;return U.apiKey=t,U.appVersion=n,U.cookieOptions=r,U.defaultTracking=o,U.flushIntervalMillis=u,U.flushMaxRetries=a,U.flushQueueSize=c,U.identityStorage=l,U.ingestionMetadata=d,U.instanceName=p,U.loggerProvider=g,U.logLevel=y,U.minIdLength=m,U.partnerId=_,U.plan=I,U.serverUrl=w,U.serverZone=S,U.sessionTimeout=T,U.storageProvider=O,U.trackingOptions=k,U.transport=P,U.useBatch=R,U._optOut=!1,U._cookieStorage=i,U.deviceId=s,U.lastEventId=v,U.lastEventTime=h,U.optOut=b,U.sessionId=E,U.userId=x,U.loggerProvider.enable(U.logLevel),U}return t(n,e),Object.defineProperty(n.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),n.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId};this.cookieStorage.set(ue(this.apiKey),e)},n}(Z),et=function(e,t,i){return void 0===t&&(t={}),r(void 0,void 0,void 0,(function(){var r,s,u,a,c,l,d,f,p,v,h,y,m,b,_,I,w,S,E,T,O,k,P,R,x,U,q,D,L,A,j,C,M,V,F,Q,$,K,B;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||He,I={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(a=S,[3,4]);case 2:return[4,it()];case 3:a=o.sent(),o.label=4;case 4:u=a,o.label=5;case 5:return s=n.apply(void 0,[(I.domain=u,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=tt(t.identityStorage,s),[4,Le(e,c,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=o.sent(),[4,c.get(ue(e))];case 7:return d=o.sent(),f=g(),p=null!==(R=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==R?R:N(),v=null!==(x=null==d?void 0:d.lastEventId)&&void 0!==x?x:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,y=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,m=null!==(L=null==d?void 0:d.sessionId)&&void 0!==L?L:l.sessionId,b=null!==(j=null!==(A=t.userId)&&void 0!==A?A:null==d?void 0:d.userId)&&void 0!==j?j:l.userId,i.previousSessionDeviceId=null!==(C=null==d?void 0:d.deviceId)&&void 0!==C?C:l.deviceId,i.previousSessionUserId=null!==(M=null==d?void 0:d.userId)&&void 0!==M?M:l.userId,_={ipAddress:null===(F=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===F||F,language:null===($=null===(Q=t.trackingOptions)||void 0===Q?void 0:Q.language)||void 0===$||$,platform:null===(B=null===(K=t.trackingOptions)||void 0===K?void 0:K.platform)||void 0===B||B},[2,new Xe(e,t.appVersion,c,s,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,b)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new qe;case"none":return new oe;default:return new ce(n(n({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new De:"beacon"===e?new Ne:new le},it=function(e){return r(void 0,void 0,void 0,(function(){var t,n,i,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return[4,(new ce).isEnabled()];case 1:if(!o.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",s=n.length-2;s>=0;--s)i.push(n.slice(s).join("."));s=0,o.label=2;case 2:return s<i.length?(u=i[s],[4,(a=new ce({domain:"."+u})).set(r,1)]):[3,7];case 3:return o.sent(),[4,a.get(r)];case 4:return o.sent()?[4,a.remove(r)]:[3,6];case 5:return o.sent(),[2,"."+u];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ot=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}))},st=function(e){var t=this;void 0===e&&(e={});var s={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,s){var a;return r(this,void 0,void 0,(function(){var r,c,l,d,f,p,v,h;return o(this,(function(o){switch(o.label){case 0:return r=n({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(b=null===(a=t.cookieOptions)||void 0===a?void 0:a.domain,_=b,_?(_.startsWith(".")&&(_=_.substring(1)),[new RegExp("".concat(_.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),c=t.cookieStorage,g=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),l=[A,y,g.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new x).parse(),c.get(l)])];case 1:return d=u.apply(void 0,[o.sent(),2]),f=d[0],p=d[1],v=ae(t.sessionTimeout,t.lastEventTime),function(e,t,n,r){void 0===r&&(r=!0);var o=e.referrer,s=e.referring_domain,u=i(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=i(a,["referrer","referring_domain"]);if(ot(n.excludeReferrers,e.referring_domain))return!1;if(!r&&!o&&t)return!1;var d=JSON.stringify(u)!==JSON.stringify(l),f=rt(s||"")!==rt(c||"");return!t||d||f}(f,p,r,v)&&(r.resetSessionOnNewCampaign&&(s.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),h=function(e,t){var i=n(n({},R),e),r=Object.entries(i).reduce((function(e,n){var i,r=u(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new F);return Q(r)}(f,r),s.track(h),c.set(l,f)),[2]}var g,y,m,b,_}))}))},execute:function(e){return r(t,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))}};return s},ut=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},at=function(e){var t;void 0===e&&(e={});var i,s=h(),a=void 0,c=function(){return r(void 0,void 0,void 0,(function(){var t,i,r;return o(this,(function(o){switch(o.label){case 0:return i={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,ct()];case 1:return[2,(i.event_properties=n.apply(void 0,[n.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),i)]}}))}))},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},d="undefined"!=typeof location?location.href:null,f=function(){return r(void 0,void 0,void 0,(function(){var n,i,r,s;return o(this,(function(o){switch(o.label){case 0:return n=location.href,i=dt(e.trackHistoryChanges,n,d||"")&&l(),d=n,i?(null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(r=t).track,[4,c()];case 2:s.apply(r,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return[2]}}))}))},p=function(){f()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,n){return r(void 0,void 0,void 0,(function(){var r,d;return o(this,(function(o){switch(o.label){case 0:return t=n,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s&&(s.addEventListener("popstate",p),i=s.history.pushState,s.history.pushState=new Proxy(s.history.pushState,{apply:function(e,t,n){var i=u(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),f()}})),l()?(a.log("Tracking page view event"),d=(r=t).track,[4,c()]):[3,2];case 1:d.apply(r,[o.sent()]),o.label=2;case 2:return[2]}}))}))},execute:function(t){return r(void 0,void 0,void 0,(function(){var i;return o(this,(function(r){switch(r.label){case 0:return"attribution"===e.trackOn&&lt(t)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),[4,c()]):[3,2];case 1:i=r.sent(),t.event_type=i.event_type,t.event_properties=n(n({},t.event_properties),i.event_properties),r.label=2;case 2:return[2,t]}}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return s&&(s.removeEventListener("popstate",p),i&&(s.history.pushState=i)),[2]}))}))}};return v},ct=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=ut,[4,(new x).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},lt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[c.SET]||{},i=t[c.UNSET]||{},r=a(a([],u(Object.keys(n)),!1),u(Object.keys(i)),!1);return Object.keys(R).every((function(e){return r.includes(e)}))}return!1},dt=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},ft=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return r(void 0,void 0,void 0,(function(){var r;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=pt(e.name),n[Ge]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=pt(e.name),n[Ge]=e.action,n)),i.track(Ve,((r={})[Ze]=e.id,r[Ye]=pt(e.name),r[Ge]=e.action,r)),t=!1}))},Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},pt=function(e){if("string"==typeof e)return e},vt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return r(void 0,void 0,void 0,(function(){var r,s;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=s.exec(n.href),o=null==r?void 0:r[1];o&&function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})}(e,"click",(function(){var t;o&&i.track(Fe,((t={})[Ke]=o,t[Be]=n.pathname,t[ze]=e.id,t[We]=e.text,t[Je]=e.href,t))}))},s=/\.(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(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},ht=!1,gt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.init=function(e,t,i){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=i):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),$(this._init(n(n({},o),{userId:r,apiKey:e})))},i.prototype._init=function(t){var i,s;return r(this,void 0,void 0,(function(){var r,u,a,c,l=this;return o(this,(function(o){switch(o.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,et(t.apiKey,t,this)]);case 1:return r=o.sent(),[4,e.prototype._init.call(this,r)];case 2:return o.sent(),this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),(u=be(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new X).promise];case 3:return o.sent(),[4,this.add(new Pe).promise];case 4:return o.sent(),[4,this.add(new _e).promise];case 5:return o.sent(),f=this.config,ht||void 0!==f.defaultTracking||(f.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."),ht=!0),d=this.config.defaultTracking,we(d,"fileDownloads")?[4,this.add(vt()).promise]:[3,7];case 6:o.sent(),o.label=7;case 7:return function(e){return we(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(ft()).promise]:[3,9];case 8:o.sent(),o.label=9;case 9:return Se(this.config.defaultTracking)?(a=function(e){return Se(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?n({},e.defaultTracking.attribution):{}}(this.config),c=st(a),[4,this.add(c).promise]):[3,11];case 10:o.sent(),o.label=11;case 11:return[4,this.add(at(Ee(this.config))).promise];case 12:return o.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return o.sent(),u.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var d,f}))}))},i.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},i.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){be(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},i.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},i.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){be(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(N()),this.setUserId(void 0)},i.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},i.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,we(n,"sessions")&&(i&&r&&this.track($e,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Qe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=nt(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new F,i)}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)},i.prototype.groupIdentify=function(t,n,i,r){if(ke(i)){var o=i._q;i._q=[],i=Oe(new F,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new B,i)}return e.prototype.revenue.call(this,t,n)},i.prototype.process=function(t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){return n=Date.now(),i=ae(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Qe||t.event_type===$e||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),yt=function(){var e=new gt;return{init:re(e.init.bind(e),"init",te(e),ie(e,["config"])),add:re(e.add.bind(e),"add",te(e),ie(e,["config.apiKey","timeline.plugins"])),remove:re(e.remove.bind(e),"remove",te(e),ie(e,["config.apiKey","timeline.plugins"])),track:re(e.track.bind(e),"track",te(e),ie(e,["config.apiKey","timeline.queue.length"])),logEvent:re(e.logEvent.bind(e),"logEvent",te(e),ie(e,["config.apiKey","timeline.queue.length"])),identify:re(e.identify.bind(e),"identify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:re(e.groupIdentify.bind(e),"groupIdentify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),setGroup:re(e.setGroup.bind(e),"setGroup",te(e),ie(e,["config.apiKey","timeline.queue.length"])),revenue:re(e.revenue.bind(e),"revenue",te(e),ie(e,["config.apiKey","timeline.queue.length"])),flush:re(e.flush.bind(e),"flush",te(e),ie(e,["config.apiKey","timeline.queue.length"])),getUserId:re(e.getUserId.bind(e),"getUserId",te(e),ie(e,["config","config.userId"])),setUserId:re(e.setUserId.bind(e),"setUserId",te(e),ie(e,["config","config.userId"])),getDeviceId:re(e.getDeviceId.bind(e),"getDeviceId",te(e),ie(e,["config","config.deviceId"])),setDeviceId:re(e.setDeviceId.bind(e),"setDeviceId",te(e),ie(e,["config","config.deviceId"])),reset:re(e.reset.bind(e),"reset",te(e),ie(e,["config","config.userId","config.deviceId"])),getSessionId:re(e.getSessionId.bind(e),"getSessionId",te(e),ie(e,["config"])),setSessionId:re(e.setSessionId.bind(e),"setSessionId",te(e),ie(e,["config"])),extendSession:re(e.extendSession.bind(e),"extendSession",te(e),ie(e,["config"])),setOptOut:re(e.setOptOut.bind(e),"setOptOut",te(e),ie(e,["config"])),setTransport:re(e.setTransport.bind(e),"setTransport",te(e),ie(e,["config"]))}},mt=yt(),bt=mt.add,_t=mt.extendSession,It=mt.flush,wt=mt.getDeviceId,St=mt.getSessionId,Et=mt.getUserId,Tt=mt.groupIdentify,Ot=mt.identify,kt=mt.init,Pt=mt.logEvent,Rt=mt.remove,xt=mt.reset,Ut=mt.revenue,qt=mt.setDeviceId,Dt=mt.setGroup,Nt=mt.setOptOut,Lt=mt.setSessionId,At=mt.setTransport,jt=mt.setUserId,Ct=mt.track,Mt=Object.freeze({__proto__:null,add:bt,extendSession:_t,flush:It,getDeviceId:wt,getSessionId:St,getUserId:Et,groupIdentify:Tt,identify:Ot,init:kt,logEvent:Pt,remove:Rt,reset:xt,revenue:Ut,setDeviceId:qt,setGroup:Dt,setOptOut:Nt,setSessionId:Lt,setTransport:At,setUserId:jt,track:Ct,Types:q,createInstance:yt,runQueuedFunctions:Te,Revenue:B,Identify:F});!function(){var e=h();if(e){var t=function(e){var t=yt(),n=h();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Mt,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],Te(Mt,n);for(var i=Object.keys(e.amplitude._iq)||[],r=0;r<i.length;r++){var o=i[r],s=Object.assign(e.amplitude._iq[o],t(o)),u=s._q;s._q=[],Te(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
1
+ !function(){"use strict";var e=function(t,n){return e=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])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function r(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function o(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var c,l,d,f,p,v,h=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},g=function(){var e,t=h();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),i=y(n[0]),r=y(n[1]);return r?(e[i]=r,e):e}),{}):{}},y=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},m="dclid",b="fbclid",_="gbraid",I="gclid",w="ko_click_id",S="li_fat_id",E="msclkid",T="rtd_cid",O="ttclid",k="twclid",P="wbraid",R={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},x=function(){function e(){}return e.prototype.parse=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,n(n(n(n({},R),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=g();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=g();return(e={})[m]=t[m],e[b]=t[b],e[_]=t[_],e[I]=t[I],e[w]=t[w],e[S]=t[S],e[E]=t[E],e[T]=t[T],e[O]=t[O],e[k]=t[k],e[P]=t[P],e},e}(),U="Event rejected due to exceeded retry count";!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"}(c||(c={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(l||(l={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(d||(d={})),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"}(f||(f={})),function(e){e.US="US",e.EU="EU"}(p||(p={})),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"}(v||(v={}));var q=Object.freeze({__proto__:null,get SpecialEventType(){return d},get IdentifyOperation(){return c},get RevenueProperty(){return l},get LogLevel(){return f},get ServerZone(){return p},get Status(){return v}}),D=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=v.Unknown),{event:e,code:t,message:n}},N=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,N)},L=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,s;return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:N(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(s=e.setup)||void 0===s?void 0:s.call(e,t,this.client)];case 1:return r.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.reset=function(e){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.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 r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,f,p,v,h,g,y,m,b,_,I,w,S,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(n({},i))]:[3,4];case 3:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=o.sent(),I={error:f},[3,8];case 7:try{d&&!d.done&&(w=l.return)&&w.call(l)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),o.label=9;case 9:o.trys.push([9,14,15,16]),v=s(p),h=v.next(),o.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(n({},i))]:[3,12];case 11:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=o.sent(),S={error:m},[3,16];case 15:try{h&&!h.done&&(E=v.return)&&E.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),_=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return D(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0]||D(i,100,"Event not tracked, no destination plugins on the instance");a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,n,i=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),A="AMP",j="".concat(A,"_unsent"),C="https://api2.amplitude.com/2/httpapi",M=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!V(t,n))return!1}return!0},V=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&M(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return M(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},F=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(c.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(c.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(c.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(c.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(c.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(c.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(c.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(c.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(c.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[c.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[c.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===c.ADD?"number"==typeof n:e===c.UNSET||e===c.REMOVE||V(t,n)))},e}(),Q=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},$=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new L(this),this.name=e}return e.prototype._init=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return r(this,void 0,void 0,(function(){var t,n,i,r,u,a;return o(this,(function(o){switch(o.label){case 0:t=this[e],this[e]=[],o.label=1;case 1:o.trys.push([1,6,7,8]),n=s(t),i=n.next(),o.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:o.sent(),o.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=o.sent(),u={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return $(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Q(e,t);return $(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:d.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return $(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new F;return o.set(e,t),n(n({},i),{event_type:d.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,i);return $(this.dispatch(r))},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:d.REVENUE,event_properties:e.getEventProperties()})}(e,t);return $(this.dispatch(i))},e.prototype.add=function(e){return this.config?$(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),$())},e.prototype.remove=function(e){return this.config?$(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),$())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(D(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,D(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=D(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return $(this.timeline.flush())},e}(),B=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return M(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[l.REVENUE_PRODUCT_ID]=this.productId,e[l.REVENUE_QUANTITY]=this.quantity,e[l.REVENUE_PRICE]=this.price,e[l.REVENUE_TYPE]=this.revenueType,e[l.REVENUE]=this.revenue,e},e}(),z="Amplitude Logger ",W=function(){function e(){this.logLevel=f.None}return e.prototype.disable=function(){this.logLevel=f.None},e.prototype.enable=function(e){void 0===e&&(e=f.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Verbose||console.log("".concat(z,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Warn||console.warn("".concat(z,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Error||console.error("".concat(z,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Debug||console.log("".concat(z,"[Debug]: ").concat(e.join(" ")))},e}(),J=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:f.Warn,loggerProvider:new W,optOut:!1,serverUrl:C,serverZone:"US",useBatch:!1}},Z=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=J();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=e.instanceName||o.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.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=G(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),Y=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":C},G=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=J().serverZone),void 0===n&&(n=J().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:J().serverZone;return{serverZone:i,serverUrl:Y(i,n)}};function H(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var X=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return r(this,void 0,void 0,(function(){var n,i=this;return o(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(j,"_").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=r.sent(),this.saveEvents(),n&&n.length>0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,U),!1)}));i.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,n,i,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),r=G(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(s=o.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(H(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return u=o.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case v.Success:this.handleSuccessResponse(e,t);break;case v.Invalid:this.handleInvalidResponse(e,t);break;case v.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case v.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 i=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(H(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),c=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(D(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),ee=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},te=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ne=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=s(t.split(".")),o=r.next();!o.done;o=r.next()){var u=o.value;if(!(u in e))return;e=e[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},ie=function(e,t){return function(){var n,i,r={};try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;r[a]=ne(e,a)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},re=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<f.Debug||!c||!a)return e.apply(r,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ee(1),time:{start:(new Date).toISOString()},states:{}};i&&l.states&&(l.states.before=i());var d=e.apply(r,o);return d&&d.promise?d.promise.then((function(){i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},oe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),se=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,p,h,g,y,m,b,_,I,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case v.Success:return{status:T,statusCode:E,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!==(i=e.server_upload_time)&&void 0!==i?i:0}};case v.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},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!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case v.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case v.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case v.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),ue=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[A,t,e.substring(0,n)].filter(Boolean).join("_")},ae=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ce=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n;return o(this,(function(i){switch(i.label){case 0:if(!h())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return r(this,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){return i=h(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(s=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,s.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return r(this,void 0,void 0,(function(){var i,r,s,u,a,c;return o(this,(function(o){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,s=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=h())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),le=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},n}(se),de=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:fe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),fe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},pe=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),ve=function(){return ve=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ve.apply(this,arguments)},he=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++){if(r[i]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!he(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){he(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!he(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var ge=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ve({},this.identity.userProperties),n=ve(ve({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++){delete t[d=v[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ve({},this.identity)},e.prototype.setIdentity=function(e){var t=ve({},this.identity);this.identity=ve({},e),he(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,me=function(){function e(){this.identityStore=new ge,this.eventBridge=new pe,this.applicationContextProvider=new de}return e.getInstance=function(t){return ye.analyticsConnectorInstances||(ye.analyticsConnectorInstances={}),ye.analyticsConnectorInstances[t]||(ye.analyticsConnectorInstances[t]=new e),ye.analyticsConnectorInstances[t]},e}(),be=function(e){return void 0===e&&(e="$default_instance"),me.getInstance(e)},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=be().identityStore}return e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return e.instanceName&&(this.identityStore=be(e.instanceName).identityStore),[2]}))}))},e}(),Ie=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},we=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Se=function(e){return we(e,"attribution")},Ee=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,we(n,"pageViews"))&&(i=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(i=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:i,trackHistoryChanges:r,eventType:t}},Te=function(e,t){Oe(e,t)},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},ke=function(e){return e&&void 0!==e._q},Pe=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.3.0"),"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,i;return r(this,void 0,void 0,(function(){var r,s,u;return o(this,(function(o){return r=(new Date).getTime(),s=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(i=e.event_id)&&void 0!==i?i:s+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=r),[2,n(n(n(n(n(n(n(n({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:Ie()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:N(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Re=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(i){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 r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),xe=1e3,Ue=function(e){function n(t){var n,i=this;return(i=e.call(this,null===(n=h())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return t(n,e),n.prototype.set=function(t,n){var i;return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xe?(r=n.length-xe,[4,e.prototype.set.call(this,t,n.slice(0,xe))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(xe,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},n}(Re),qe=function(e){function n(){var t;return e.call(this,null===(t=h())||void 0===t?void 0:t.sessionStorage)||this}return t(n,e),n}(Re),De=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},n}(se),Ne=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return o(this,(function(i){return[2,new Promise((function(i,r){var o=h();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},n}(se),Le=function(e,t,n){return void 0===n&&(n=!0),r(void 0,void 0,void 0,(function(){var i,r,s,a,c,l,d,f,p;return o(this,(function(o){switch(o.label){case 0:return i=function(e){return"".concat(A.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=o.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:o.sent(),o.label=3;case 3:return s=u(r.split("."),6),a=s[0],c=s[1],l=s[2],d=s[3],f=s[4],p=s[5],[2,{deviceId:a,userId:je(c),sessionId:Ae(d),lastEventId:Ae(p),lastEventTime:Ae(f),optOut:Boolean(l)}]}}))}))},Ae=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},je=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ce="[Amplitude]",Me="".concat(Ce," Form Started"),Ve="".concat(Ce," Form Submitted"),Fe="".concat(Ce," File Downloaded"),Qe="session_start",$e="session_end",Ke="".concat(Ce," File Extension"),Be="".concat(Ce," File Name"),ze="".concat(Ce," Link ID"),We="".concat(Ce," Link Text"),Je="".concat(Ce," Link URL"),Ze="".concat(Ce," Form ID"),Ye="".concat(Ce," Form Name"),Ge="".concat(Ce," Form Destination"),He="cookie",Xe=function(e){function n(t,n,i,r,o,s,u,a,c,l,d,p,v,h,g,y,m,b,_,I,w,S,E,T,O,k,P,R,x){void 0===i&&(i=new oe),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=He),void 0===g&&(g=new W),void 0===y&&(y=f.Warn),void 0===b&&(b=!1),void 0===w&&(w=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===O&&(O=new Ue({loggerProvider:g})),void 0===k&&(k={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===R&&(R=!1);var U=e.call(this,{apiKey:t,storageProvider:O,transportProvider:nt(P)})||this;return U.apiKey=t,U.appVersion=n,U.cookieOptions=r,U.defaultTracking=o,U.flushIntervalMillis=u,U.flushMaxRetries=a,U.flushQueueSize=c,U.identityStorage=l,U.ingestionMetadata=d,U.instanceName=p,U.loggerProvider=g,U.logLevel=y,U.minIdLength=m,U.partnerId=_,U.plan=I,U.serverUrl=w,U.serverZone=S,U.sessionTimeout=T,U.storageProvider=O,U.trackingOptions=k,U.transport=P,U.useBatch=R,U._optOut=!1,U._cookieStorage=i,U.deviceId=s,U.lastEventId=v,U.lastEventTime=h,U.optOut=b,U.sessionId=E,U.userId=x,U.loggerProvider.enable(U.logLevel),U}return t(n,e),Object.defineProperty(n.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),n.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId};this.cookieStorage.set(ue(this.apiKey),e)},n}(Z),et=function(e,t,i){return void 0===t&&(t={}),r(void 0,void 0,void 0,(function(){var r,s,u,a,c,l,d,f,p,v,h,y,m,b,_,I,w,S,E,T,O,k,P,R,x,U,q,D,L,A,j,C,M,V,F,Q,$,K,B;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||He,I={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(a=S,[3,4]);case 2:return[4,it()];case 3:a=o.sent(),o.label=4;case 4:u=a,o.label=5;case 5:return s=n.apply(void 0,[(I.domain=u,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=tt(t.identityStorage,s),[4,Le(e,c,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=o.sent(),[4,c.get(ue(e))];case 7:return d=o.sent(),f=g(),p=null!==(R=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==R?R:N(),v=null!==(x=null==d?void 0:d.lastEventId)&&void 0!==x?x:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,y=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,m=null!==(L=null==d?void 0:d.sessionId)&&void 0!==L?L:l.sessionId,b=null!==(j=null!==(A=t.userId)&&void 0!==A?A:null==d?void 0:d.userId)&&void 0!==j?j:l.userId,i.previousSessionDeviceId=null!==(C=null==d?void 0:d.deviceId)&&void 0!==C?C:l.deviceId,i.previousSessionUserId=null!==(M=null==d?void 0:d.userId)&&void 0!==M?M:l.userId,_={ipAddress:null===(F=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===F||F,language:null===($=null===(Q=t.trackingOptions)||void 0===Q?void 0:Q.language)||void 0===$||$,platform:null===(B=null===(K=t.trackingOptions)||void 0===K?void 0:K.platform)||void 0===B||B},[2,new Xe(e,t.appVersion,c,s,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,b)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new qe;case"none":return new oe;default:return new ce(n(n({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new De:"beacon"===e?new Ne:new le},it=function(e){return r(void 0,void 0,void 0,(function(){var t,n,i,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return[4,(new ce).isEnabled()];case 1:if(!o.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",s=n.length-2;s>=0;--s)i.push(n.slice(s).join("."));s=0,o.label=2;case 2:return s<i.length?(u=i[s],[4,(a=new ce({domain:"."+u})).set(r,1)]):[3,7];case 3:return o.sent(),[4,a.get(r)];case 4:return o.sent()?[4,a.remove(r)]:[3,6];case 5:return o.sent(),[2,"."+u];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ot=function(e,t,n,r){void 0===r&&(r=!0),e.referrer;var o=e.referring_domain,s=i(e,["referrer","referring_domain"]),u=t||{};u.referrer;var a=u.referring_domain,c=i(u,["referrer","referring_domain"]);if(st(n.excludeReferrers,e.referring_domain))return!1;if(!r&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return!1;var l=JSON.stringify(s)!==JSON.stringify(c),d=rt(o||"")!==rt(a||"");return!t||l||d},st=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}))},ut=function(e){var t=this;void 0===e&&(e={});var i={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,i){var s;return r(this,void 0,void 0,(function(){var r,a,c,l,d,f,p,v;return o(this,(function(o){switch(o.label){case 0:return r=n({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(m=null===(s=t.cookieOptions)||void 0===s?void 0:s.domain,b=m,b?(b.startsWith(".")&&(b=b.substring(1)),[new RegExp("".concat(b.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),a=t.cookieStorage,h=t.apiKey,void 0===(g="MKTG")&&(g=""),void 0===y&&(y=10),c=[A,g,h.substring(0,y)].filter(Boolean).join("_"),[4,Promise.all([(new x).parse(),a.get(c)])];case 1:return l=u.apply(void 0,[o.sent(),2]),d=l[0],f=l[1],p=ae(t.sessionTimeout,t.lastEventTime),ot(d,f,r,p)&&(r.resetSessionOnNewCampaign&&(i.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),v=function(e,t){var i=n(n({},R),e),r=Object.entries(i).reduce((function(e,n){var i,r=u(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new F);return Q(r)}(d,r),i.track(v),a.set(c,d)),[2]}var h,g,y,m,b}))}))},execute:function(e){return r(t,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))}};return i},at=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},ct=function(e){var t;void 0===e&&(e={});var i,s=h(),a=void 0,c=function(){return r(void 0,void 0,void 0,(function(){var t,i,r;return o(this,(function(o){switch(o.label){case 0:return i={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,lt()];case 1:return[2,(i.event_properties=n.apply(void 0,[n.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),i)]}}))}))},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},d="undefined"!=typeof location?location.href:null,f=function(){return r(void 0,void 0,void 0,(function(){var n,i,r,s;return o(this,(function(o){switch(o.label){case 0:return n=location.href,i=ft(e.trackHistoryChanges,n,d||"")&&l(),d=n,i?(null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(r=t).track,[4,c()];case 2:s.apply(r,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return[2]}}))}))},p=function(){f()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,n){return r(void 0,void 0,void 0,(function(){var r,d;return o(this,(function(o){switch(o.label){case 0:return t=n,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s&&(s.addEventListener("popstate",p),i=s.history.pushState,s.history.pushState=new Proxy(s.history.pushState,{apply:function(e,t,n){var i=u(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),f()}})),l()?(a.log("Tracking page view event"),d=(r=t).track,[4,c()]):[3,2];case 1:d.apply(r,[o.sent()]),o.label=2;case 2:return[2]}}))}))},execute:function(t){return r(void 0,void 0,void 0,(function(){var i;return o(this,(function(r){switch(r.label){case 0:return"attribution"===e.trackOn&&dt(t)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),[4,c()]):[3,2];case 1:i=r.sent(),t.event_type=i.event_type,t.event_properties=n(n({},t.event_properties),i.event_properties),r.label=2;case 2:return[2,t]}}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return s&&(s.removeEventListener("popstate",p),i&&(s.history.pushState=i)),[2]}))}))}};return v},lt=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=at,[4,(new x).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},dt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[c.SET]||{},i=t[c.UNSET]||{},r=a(a([],u(Object.keys(n)),!1),u(Object.keys(i)),!1);return Object.keys(R).every((function(e){return r.includes(e)}))}return!1},ft=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},pt=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return r(void 0,void 0,void 0,(function(){var r;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=vt(e.name),n[Ge]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=vt(e.name),n[Ge]=e.action,n)),i.track(Ve,((r={})[Ze]=e.id,r[Ye]=vt(e.name),r[Ge]=e.action,r)),t=!1}))},Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},vt=function(e){if("string"==typeof e)return e},ht=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return r(void 0,void 0,void 0,(function(){var r,s;return o(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=s.exec(n.href),o=null==r?void 0:r[1];o&&function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})}(e,"click",(function(){var t;o&&i.track(Fe,((t={})[Ke]=o,t[Be]=n.pathname,t[ze]=e.id,t[We]=e.text,t[Je]=e.href,t))}))},s=/\.(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(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))},teardown:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},gt=!1,yt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.init=function(e,t,i){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=i):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),$(this._init(n(n({},o),{userId:r,apiKey:e})))},i.prototype._init=function(t){var i,s;return r(this,void 0,void 0,(function(){var r,u,a,c,l=this;return o(this,(function(o){switch(o.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,et(t.apiKey,t,this)]);case 1:return r=o.sent(),[4,e.prototype._init.call(this,r)];case 2:return o.sent(),this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),(u=be(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new X).promise];case 3:return o.sent(),[4,this.add(new Pe).promise];case 4:return o.sent(),[4,this.add(new _e).promise];case 5:return o.sent(),f=this.config,gt||void 0!==f.defaultTracking||(f.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."),gt=!0),d=this.config.defaultTracking,we(d,"fileDownloads")?[4,this.add(ht()).promise]:[3,7];case 6:o.sent(),o.label=7;case 7:return function(e){return we(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(pt()).promise]:[3,9];case 8:o.sent(),o.label=9;case 9:return Se(this.config.defaultTracking)?(a=function(e){return Se(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?n({},e.defaultTracking.attribution):{}}(this.config),c=ut(a),[4,this.add(c).promise]):[3,11];case 10:o.sent(),o.label=11;case 11:return[4,this.add(ct(Ee(this.config))).promise];case 12:return o.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return o.sent(),u.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var d,f}))}))},i.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},i.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){be(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},i.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},i.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){be(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(N()),this.setUserId(void 0)},i.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},i.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,we(n,"sessions")&&(i&&r&&this.track($e,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Qe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=nt(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new F,i)}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)},i.prototype.groupIdentify=function(t,n,i,r){if(ke(i)){var o=i._q;i._q=[],i=Oe(new F,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new B,i)}return e.prototype.revenue.call(this,t,n)},i.prototype.process=function(t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){return n=Date.now(),i=ae(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Qe||t.event_type===$e||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),mt=function(){var e=new yt;return{init:re(e.init.bind(e),"init",te(e),ie(e,["config"])),add:re(e.add.bind(e),"add",te(e),ie(e,["config.apiKey","timeline.plugins"])),remove:re(e.remove.bind(e),"remove",te(e),ie(e,["config.apiKey","timeline.plugins"])),track:re(e.track.bind(e),"track",te(e),ie(e,["config.apiKey","timeline.queue.length"])),logEvent:re(e.logEvent.bind(e),"logEvent",te(e),ie(e,["config.apiKey","timeline.queue.length"])),identify:re(e.identify.bind(e),"identify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:re(e.groupIdentify.bind(e),"groupIdentify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),setGroup:re(e.setGroup.bind(e),"setGroup",te(e),ie(e,["config.apiKey","timeline.queue.length"])),revenue:re(e.revenue.bind(e),"revenue",te(e),ie(e,["config.apiKey","timeline.queue.length"])),flush:re(e.flush.bind(e),"flush",te(e),ie(e,["config.apiKey","timeline.queue.length"])),getUserId:re(e.getUserId.bind(e),"getUserId",te(e),ie(e,["config","config.userId"])),setUserId:re(e.setUserId.bind(e),"setUserId",te(e),ie(e,["config","config.userId"])),getDeviceId:re(e.getDeviceId.bind(e),"getDeviceId",te(e),ie(e,["config","config.deviceId"])),setDeviceId:re(e.setDeviceId.bind(e),"setDeviceId",te(e),ie(e,["config","config.deviceId"])),reset:re(e.reset.bind(e),"reset",te(e),ie(e,["config","config.userId","config.deviceId"])),getSessionId:re(e.getSessionId.bind(e),"getSessionId",te(e),ie(e,["config"])),setSessionId:re(e.setSessionId.bind(e),"setSessionId",te(e),ie(e,["config"])),extendSession:re(e.extendSession.bind(e),"extendSession",te(e),ie(e,["config"])),setOptOut:re(e.setOptOut.bind(e),"setOptOut",te(e),ie(e,["config"])),setTransport:re(e.setTransport.bind(e),"setTransport",te(e),ie(e,["config"]))}},bt=mt(),_t=bt.add,It=bt.extendSession,wt=bt.flush,St=bt.getDeviceId,Et=bt.getSessionId,Tt=bt.getUserId,Ot=bt.groupIdentify,kt=bt.identify,Pt=bt.init,Rt=bt.logEvent,xt=bt.remove,Ut=bt.reset,qt=bt.revenue,Dt=bt.setDeviceId,Nt=bt.setGroup,Lt=bt.setOptOut,At=bt.setSessionId,jt=bt.setTransport,Ct=bt.setUserId,Mt=bt.track,Vt=Object.freeze({__proto__:null,add:_t,extendSession:It,flush:wt,getDeviceId:St,getSessionId:Et,getUserId:Tt,groupIdentify:Ot,identify:kt,init:Pt,logEvent:Rt,remove:xt,reset:Ut,revenue:qt,setDeviceId:Dt,setGroup:Nt,setOptOut:Lt,setSessionId:At,setTransport:jt,setUserId:Ct,track:Mt,Types:q,createInstance:mt,runQueuedFunctions:Te,Revenue:B,Identify:F});!function(){var e=h();if(e){var t=function(e){var t=mt(),n=h();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Vt,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],Te(Vt,n);for(var i=Object.keys(e.amplitude._iq)||[],r=0;r<i.length;r++){var o=i[r],s=Object.assign(e.amplitude._iq[o],t(o)),u=s._q;s._q=[],Te(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
Binary file
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";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 i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};function r(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function o(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function s(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function c(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var l,d,f,p,v,h,g="Event rejected due to exceeded retry count";!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"}(l||(l={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(d||(d={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(f||(f={})),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"}(p||(p={})),function(e){e.US="US",e.EU="EU"}(v||(v={})),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"}(h||(h={}));var y=Object.freeze({__proto__:null,get SpecialEventType(){return f},get IdentifyOperation(){return l},get RevenueProperty(){return d},get LogLevel(){return p},get ServerZone(){return v},get Status(){return h}}),m=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=h.Unknown),{event:e,code:t,message:n}},b=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,b)},I=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,r;return o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:b(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)];case 1:return o.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return o(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.reset=function(e){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.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 o(this,void 0,void 0,(function(){var t,n,r,o,c,l,d,f,p,v,h,g,y,b,I,_,w,S,E,T;return s(this,(function(s){switch(s.label){case 0:if(!e)return[2];t=a(e,1),n=t[0],r=a(e,2),o=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),s.label=1;case 1:s.trys.push([1,6,7,8]),l=u(c),d=l.next(),s.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(i({},n))]:[3,4];case 3:if(null===(y=s.sent()))return o({event:n,code:0,message:""}),[2];n=y,s.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=s.sent(),w={error:f},[3,8];case 7:try{d&&!d.done&&(S=l.return)&&S.call(l)}finally{if(w)throw w.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),s.label=9;case 9:s.trys.push([9,14,15,16]),v=u(p),h=v.next(),s.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(i({},n))]:[3,12];case 11:if(null===(y=s.sent()))return o({event:n,code:0,message:""}),[2];n=y,s.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return b=s.sent(),E={error:b},[3,16];case 15:try{h&&!h.done&&(T=v.return)&&T.call(v)}finally{if(E)throw E.error}return[7];case 16:return I=this.plugins.filter((function(e){return"destination"===e.type})),_=I.map((function(e){var t=i({},n);return e.execute(t).catch((function(e){return m(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=a(e,1)[0]||m(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return o(this,void 0,void 0,(function(){var e,t,n,i=this;return s(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),_="AMP",w="".concat(_,"_unsent"),S="https://api2.amplitude.com/2/httpapi",E=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!T(t,n))return!1}return!0},T=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&E(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return E(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},O=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return i({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(l.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(l.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(l.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(l.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(l.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(l.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(l.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(l.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(l.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[l.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[l.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===l.ADD?"number"==typeof n:e===l.UNSET||e===l.REMOVE||T(t,n)))},e}(),k=function(e,t){return i(i({},t),{event_type:f.IDENTIFY,user_properties:e.getUserProperties()})},P=function(e){return{promise:e||Promise.resolve()}},R=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new I(this),this.name=e}return e.prototype._init=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return o(this,void 0,void 0,(function(){var t,n,i,r,o,a;return s(this,(function(s){switch(s.label){case 0:t=this[e],this[e]=[],s.label=1;case 1:s.trys.push([1,6,7,8]),n=u(t),i=n.next(),s.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:s.sent(),s.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=s.sent(),o={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return i(i(i({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return P(this.dispatch(r))},e.prototype.identify=function(e,t){var n=k(e,t);return P(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var o=function(e,t,n,r){var o;return i(i({},r),{event_type:f.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n,r);return P(this.dispatch(o))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,o=new O;return o.set(e,t),i(i({},n),{event_type:f.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return P(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return i(i({},t),{event_type:f.REVENUE,event_properties:e.getEventProperties()})}(e,t);return P(this.dispatch(n))},e.prototype.add=function(e){return this.config?P(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),P())},e.prototype.remove=function(e){return this.config?P(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),P())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(m(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return o(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return o(this,void 0,void 0,(function(){var t,n,i;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,m(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=m(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return P(this.timeline.flush())},e}(),x=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return E(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?i({},this.properties):{};return e[d.REVENUE_PRODUCT_ID]=this.productId,e[d.REVENUE_QUANTITY]=this.quantity,e[d.REVENUE_PRICE]=this.price,e[d.REVENUE_TYPE]=this.revenueType,e[d.REVENUE]=this.revenue,e},e}(),U="Amplitude Logger ",D=function(){function e(){this.logLevel=p.None}return e.prototype.disable=function(){this.logLevel=p.None},e.prototype.enable=function(e){void 0===e&&(e=p.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Verbose||console.log("".concat(U,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Warn||console.warn("".concat(U,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Error||console.error("".concat(U,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Debug||console.log("".concat(U,"[Debug]: ").concat(e.join(" ")))},e}(),N=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:p.Warn,loggerProvider:new D,optOut:!1,serverUrl:S,serverZone:"US",useBatch:!1}},q=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=N();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=e.instanceName||o.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.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=A(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),L=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":S},A=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=N().serverZone),void 0===n&&(n=N().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:N().serverZone;return{serverZone:i,serverUrl:L(i,n)}};function j(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var C=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return o(this,void 0,void 0,(function(){var n,i=this;return s(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(w,"_").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=r.sent(),this.saveEvents(),n&&n.length>0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,g),!1)}));i.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),o(this,void 0,void 0,(function(){var t,n,i,r=this;return s(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),o(this,void 0,void 0,(function(){var n,i,o,u,a;return s(this,(function(s){switch(s.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,r(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},s.label=1;case 1:return s.trys.push([1,3,,4]),i=A(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:return null===(o=s.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(j(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return u=s.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case h.Success:this.handleSuccessResponse(e,t);break;case h.Invalid:this.handleInvalidResponse(e,t);break;case h.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case h.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 i=c(c(c(c([],a(Object.values(e.body.eventsWithInvalidFields)),!1),a(Object.values(e.body.eventsWithMissingFields)),!1),a(Object.values(e.body.eventsWithInvalidIdLengths)),!1),a(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(j(e)),this.addToQueue.apply(this,c([],a(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(j(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,c([],a(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),u=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(j(e)),this.addToQueue.apply(this,c([],a(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,c([],a(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(m(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),M=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},V=function(e){return function(){var t=i({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},F=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=u(t.split(".")),o=r.next();!o.done;o=r.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},Q=function(e,t){return function(){var n,i,r={};try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var a=s.value;r[a]=F(e,a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},$=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<p.Debug||!c||!a)return e.apply(r,o);var l={type:"invoke public method",name:t,args:o,stacktrace:M(1),time:{start:(new Date).toISOString()},states:{}};i&&l.states&&(l.states.before=i());var d=e.apply(r,o);return d&&d.promise?d.promise.then((function(){i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},K=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),B=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,p,v,g,y,m,b,I,_,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case h.Success:return{status:T,statusCode:E,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!==(i=e.server_upload_time)&&void 0!==i?i:0}};case h.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},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!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case h.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case h.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(I=e.throttled_users)&&void 0!==I?I:{},exceededDailyQuotaDevices:null!==(_=e.exceeded_daily_quota_devices)&&void 0!==_?_:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case h.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?h.Success:429===e?h.RateLimit:413===e?h.PayloadTooLarge:408===e?h.Timeout:e>=400&&e<500?h.Invalid:e>=500?h.Failed:h.Unknown},e}(),z=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},W=function(){var e,t=z();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),i=J(n[0]),r=J(n[1]);return r?(e[i]=r,e):e}),{}):{}},J=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Z="dclid",Y="fbclid",G="gbraid",H="gclid",X="ko_click_id",ee="li_fat_id",te="msclkid",ne="rtd_cid",ie="ttclid",re="twclid",oe="wbraid",se={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},ue=function(){function e(){}return e.prototype.parse=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,i(i(i(i({},se),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=W();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=W();return(e={})[Z]=t[Z],e[Y]=t[Y],e[G]=t[G],e[H]=t[H],e[X]=t[X],e[ee]=t[ee],e[te]=t[te],e[ne]=t[ne],e[ie]=t[ie],e[re]=t[re],e[oe]=t[oe],e},e}(),ae=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[_,t,e.substring(0,n)].filter(Boolean).join("_")},ce=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},le=function(){function e(e){this.options=i({},e)}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n;return s(this,(function(i){switch(i.label){case 0:if(!z())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return o(this,void 0,void 0,(function(){var i,r,o;return s(this,(function(s){return i=z(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(o=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return o(this,void 0,void 0,(function(){var i,r,o,u,a,c;return s(this,(function(s){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),o=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=z())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(e){return[2]}))}))},e}(),de=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},t}(B),fe=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:pe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),pe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ve=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),he=function(){return he=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},he.apply(this,arguments)},ge=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++){if(r[i]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!ge(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){ge(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!ge(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var ye=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=he({},this.identity.userProperties),n=he(he({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++){delete t[d=v[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return he({},this.identity)},e.prototype.setIdentity=function(e){var t=he({},this.identity);this.identity=he({},e),ge(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,be=function(){function e(){this.identityStore=new ye,this.eventBridge=new ve,this.applicationContextProvider=new fe}return e.getInstance=function(t){return me.analyticsConnectorInstances||(me.analyticsConnectorInstances={}),me.analyticsConnectorInstances[t]||(me.analyticsConnectorInstances[t]=new e),me.analyticsConnectorInstances[t]},e}(),Ie=function(e){return void 0===e&&(e="$default_instance"),be.getInstance(e)},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ie().identityStore}return e.prototype.execute=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return e.instanceName&&(this.identityStore=Ie(e.instanceName).identityStore),[2]}))}))},e}(),we=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},Se=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Ee=function(e){return Se(e,"attribution")},Te=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,Se(n,"pageViews"))&&(i=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(i=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:i,trackHistoryChanges:r,eventType:t}},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},ke=function(e){return e&&void 0!==e._q},Pe=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.2.3"),"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 o(this,void 0,void 0,(function(){var r,o,u;return s(this,(function(s){return r=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=r),[2,i(i(i(i(i(i(i(i({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:we()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:b(),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:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Re=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n,i;return s(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(i){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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),xe=1e3,Ue=function(e){function t(t){var n,i=this;return(i=e.call(this,null===(n=z())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return n(t,e),t.prototype.set=function(t,n){var i;return o(this,void 0,void 0,(function(){var r;return s(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xe?(r=n.length-xe,[4,e.prototype.set.call(this,t,n.slice(0,xe))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(xe,".")),[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}(Re),De=function(e){function t(){var t;return e.call(this,null===(t=z())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Re),Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(B),qe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(i){return[2,new Promise((function(i,r){var o=z();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},t}(B),Le=function(e,t,n){return void 0===n&&(n=!0),o(void 0,void 0,void 0,(function(){var i,r,o,u,c,l,d,f,p;return s(this,(function(s){switch(s.label){case 0:return i=function(e){return"".concat(_.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=s.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:s.sent(),s.label=3;case 3:return o=a(r.split("."),6),u=o[0],c=o[1],l=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:u,userId:je(c),sessionId:Ae(d),lastEventId:Ae(p),lastEventTime:Ae(f),optOut:Boolean(l)}]}}))}))},Ae=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},je=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ce="[Amplitude]",Me="".concat(Ce," Form Started"),Ve="".concat(Ce," Form Submitted"),Fe="".concat(Ce," File Downloaded"),Qe="session_start",$e="session_end",Ke="".concat(Ce," File Extension"),Be="".concat(Ce," File Name"),ze="".concat(Ce," Link ID"),We="".concat(Ce," Link Text"),Je="".concat(Ce," Link URL"),Ze="".concat(Ce," Form ID"),Ye="".concat(Ce," Form Name"),Ge="".concat(Ce," Form Destination"),He="cookie",Xe=function(e){function t(t,n,i,r,o,s,u,a,c,l,d,f,v,h,g,y,m,b,I,_,w,S,E,T,O,k,P,R,x){void 0===i&&(i=new K),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=He),void 0===g&&(g=new D),void 0===y&&(y=p.Warn),void 0===b&&(b=!1),void 0===w&&(w=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===O&&(O=new Ue({loggerProvider:g})),void 0===k&&(k={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===R&&(R=!1);var U=e.call(this,{apiKey:t,storageProvider:O,transportProvider:nt(P)})||this;return U.apiKey=t,U.appVersion=n,U.cookieOptions=r,U.defaultTracking=o,U.flushIntervalMillis=u,U.flushMaxRetries=a,U.flushQueueSize=c,U.identityStorage=l,U.ingestionMetadata=d,U.instanceName=f,U.loggerProvider=g,U.logLevel=y,U.minIdLength=m,U.partnerId=I,U.plan=_,U.serverUrl=w,U.serverZone=S,U.sessionTimeout=T,U.storageProvider=O,U.trackingOptions=k,U.transport=P,U.useBatch=R,U._optOut=!1,U._cookieStorage=i,U.deviceId=s,U.lastEventId=v,U.lastEventTime=h,U.optOut=b,U.sessionId=E,U.userId=x,U.loggerProvider.enable(U.logLevel),U}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,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}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId};this.cookieStorage.set(ae(this.apiKey),e)},t}(q),et=function(e,t,n){return void 0===t&&(t={}),o(void 0,void 0,void 0,(function(){var r,o,u,a,c,l,d,f,p,v,h,g,y,m,I,_,w,S,E,T,O,k,P,R,x,U,D,N,q,L,A,j,C,M,V,F,Q,$,K;return s(this,(function(s){switch(s.label){case 0:return r=t.identityStorage||He,_={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(a=S,[3,4]);case 2:return[4,it()];case 3:a=s.sent(),s.label=4;case 4:u=a,s.label=5;case 5:return o=i.apply(void 0,[(_.domain=u,_.expiration=365,_.sameSite="Lax",_.secure=!1,_.upgrade=!0,_),t.cookieOptions]),c=tt(t.identityStorage,o),[4,Le(e,c,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=s.sent(),[4,c.get(ae(e))];case 7:return d=s.sent(),f=W(),p=null!==(R=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==R?R:b(),v=null!==(x=null==d?void 0:d.lastEventId)&&void 0!==x?x:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,g=null!==(N=null!==(D=t.optOut)&&void 0!==D?D:null==d?void 0:d.optOut)&&void 0!==N?N:l.optOut,y=null!==(q=null==d?void 0:d.sessionId)&&void 0!==q?q:l.sessionId,m=null!==(A=null!==(L=t.userId)&&void 0!==L?L:null==d?void 0:d.userId)&&void 0!==A?A:l.userId,n.previousSessionDeviceId=null!==(j=null==d?void 0:d.deviceId)&&void 0!==j?j:l.deviceId,n.previousSessionUserId=null!==(C=null==d?void 0:d.userId)&&void 0!==C?C:l.userId,I={ipAddress:null===(V=null===(M=t.trackingOptions)||void 0===M?void 0:M.ipAddress)||void 0===V||V,language:null===(Q=null===(F=t.trackingOptions)||void 0===F?void 0:F.language)||void 0===Q||Q,platform:null===(K=null===($=t.trackingOptions)||void 0===$?void 0:$.platform)||void 0===K||K},[2,new Xe(e,t.appVersion,c,o,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,I,t.transport,t.useBatch,m)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new De;case"none":return new K;default:return new le(i(i({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new Ne:"beacon"===e?new qe:new de},it=function(e){return o(void 0,void 0,void 0,(function(){var t,n,i,r,o,u,a;return s(this,(function(s){switch(s.label){case 0:return[4,(new le).isEnabled()];case 1:if(!s.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",o=n.length-2;o>=0;--o)i.push(n.slice(o).join("."));o=0,s.label=2;case 2:return o<i.length?(u=i[o],[4,(a=new le({domain:"."+u})).set(r,1)]):[3,7];case 3:return s.sent(),[4,a.get(r)];case 4:return s.sent()?[4,a.remove(r)]:[3,6];case 5:return s.sent(),[2,"."+u];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ot=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}))},st=function(e){var t=this;void 0===e&&(e={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,n){var u;return o(this,void 0,void 0,(function(){var o,c,l,d,f,p,v,h;return s(this,(function(s){switch(s.label){case 0:return o=i({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(b=null===(u=t.cookieOptions)||void 0===u?void 0:u.domain,I=b,I?(I.startsWith(".")&&(I=I.substring(1)),[new RegExp("".concat(I.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),c=t.cookieStorage,g=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),l=[_,y,g.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new ue).parse(),c.get(l)])];case 1:return d=a.apply(void 0,[s.sent(),2]),f=d[0],p=d[1],v=ce(t.sessionTimeout,t.lastEventTime),function(e,t,n,i){void 0===i&&(i=!0);var o=e.referrer,s=e.referring_domain,u=r(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=r(a,["referrer","referring_domain"]);if(ot(n.excludeReferrers,e.referring_domain))return!1;if(!i&&!o&&t)return!1;var d=JSON.stringify(u)!==JSON.stringify(l),f=rt(s||"")!==rt(c||"");return!t||d||f}(f,p,o,v)&&(o.resetSessionOnNewCampaign&&(n.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),h=function(e,t){var n=i(i({},se),e),r=Object.entries(n).reduce((function(e,n){var i,r=a(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new O);return k(r)}(f,o),n.track(h),c.set(l,f)),[2]}var g,y,m,b,I}))}))},execute:function(e){return o(t,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))}};return n},ut=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},at=function(e){var t;void 0===e&&(e={});var n,r=z(),u=void 0,c=function(){return o(void 0,void 0,void 0,(function(){var t,n,r;return s(this,(function(o){switch(o.label){case 0:return n={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,ct()];case 1:return[2,(n.event_properties=i.apply(void 0,[i.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),n)]}}))}))},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},d="undefined"!=typeof location?location.href:null,f=function(){return o(void 0,void 0,void 0,(function(){var n,i,r,o;return s(this,(function(s){switch(s.label){case 0:return n=location.href,i=dt(e.trackHistoryChanges,n,d||"")&&l(),d=n,i?(null==u||u.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return o=(r=t).track,[4,c()];case 2:o.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}}))}))},p=function(){f()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,i){return o(void 0,void 0,void 0,(function(){var o,d;return s(this,(function(s){switch(s.label){case 0:return t=i,(u=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",p),n=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var i=a(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),f()}})),l()?(u.log("Tracking page view event"),d=(o=t).track,[4,c()]):[3,2];case 1:d.apply(o,[s.sent()]),s.label=2;case 2:return[2]}}))}))},execute:function(t){return o(void 0,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return"attribution"===e.trackOn&&lt(t)?(null==u||u.log("Enriching campaign event to page view event with campaign parameters"),[4,c()]):[3,2];case 1:n=r.sent(),t.event_type=n.event_type,t.event_properties=i(i({},t.event_properties),n.event_properties),r.label=2;case 2:return[2,t]}}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(e){return r&&(r.removeEventListener("popstate",p),n&&(r.history.pushState=n)),[2]}))}))}};return v},ct=function(){return o(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=ut,[4,(new ue).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},lt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[l.SET]||{},i=t[l.UNSET]||{},r=c(c([],a(Object.keys(n)),!1),a(Object.keys(i)),!1);return Object.keys(se).every((function(e){return r.includes(e)}))}return!1},dt=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},ft=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return o(void 0,void 0,void 0,(function(){var r;return s(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=pt(e.name),n[Ge]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=pt(e.name),n[Ge]=e.action,n)),i.track(Ve,((r={})[Ze]=e.id,r[Ye]=pt(e.name),r[Ge]=e.action,r)),t=!1}))},Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},pt=function(e){if("string"==typeof e)return e},vt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return o(void 0,void 0,void 0,(function(){var r,o;return s(this,(function(s){return i?("undefined"==typeof document||(r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=o.exec(n.href),s=null==r?void 0:r[1];s&&function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})}(e,"click",(function(){var t;s&&i.track(Fe,((t={})[Ke]=s,t[Be]=n.pathname,t[ze]=e.id,t[We]=e.text,t[Je]=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(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},ht=!1,gt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=n):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),P(this._init(i(i({},o),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r;return o(this,void 0,void 0,(function(){var o,u,a,c,l=this;return s(this,(function(s){switch(s.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,et(t.apiKey,t,this)]);case 1:return o=s.sent(),[4,e.prototype._init.call(this,o)];case 2:return s.sent(),this.setSessionId(null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:this.config.sessionId)&&void 0!==r?r:Date.now()),(u=Ie(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new C).promise];case 3:return s.sent(),[4,this.add(new Pe).promise];case 4:return s.sent(),[4,this.add(new _e).promise];case 5:return s.sent(),f=this.config,ht||void 0!==f.defaultTracking||(f.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."),ht=!0),d=this.config.defaultTracking,Se(d,"fileDownloads")?[4,this.add(vt()).promise]:[3,7];case 6:s.sent(),s.label=7;case 7:return function(e){return Se(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(ft()).promise]:[3,9];case 8:s.sent(),s.label=9;case 9:return Ee(this.config.defaultTracking)?(a=function(e){return Ee(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?i({},e.defaultTracking.attribution):{}}(this.config),c=st(a),[4,this.add(c).promise]):[3,11];case 10:s.sent(),s.label=11;case 11:return[4,this.add(at(Te(this.config))).promise];case 12:return s.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return s.sent(),u.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var d,f}))}))},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?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){Ie(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.deviceId=e,function(e,t){Ie(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(b()),this.setUserId(void 0)},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;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,Se(n,"sessions")&&(i&&r&&this.track($e,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Qe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},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=nt(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new O,i)}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,i,r){if(ke(i)){var o=i._q;i._q=[],i=Oe(new O,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new x,i)}return e.prototype.revenue.call(this,t,n)},t.prototype.process=function(t){return o(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){return n=Date.now(),i=ce(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Qe||t.event_type===$e||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},t}(R),yt=function(){var e=new gt;return{init:$(e.init.bind(e),"init",V(e),Q(e,["config"])),add:$(e.add.bind(e),"add",V(e),Q(e,["config.apiKey","timeline.plugins"])),remove:$(e.remove.bind(e),"remove",V(e),Q(e,["config.apiKey","timeline.plugins"])),track:$(e.track.bind(e),"track",V(e),Q(e,["config.apiKey","timeline.queue.length"])),logEvent:$(e.logEvent.bind(e),"logEvent",V(e),Q(e,["config.apiKey","timeline.queue.length"])),identify:$(e.identify.bind(e),"identify",V(e),Q(e,["config.apiKey","timeline.queue.length"])),groupIdentify:$(e.groupIdentify.bind(e),"groupIdentify",V(e),Q(e,["config.apiKey","timeline.queue.length"])),setGroup:$(e.setGroup.bind(e),"setGroup",V(e),Q(e,["config.apiKey","timeline.queue.length"])),revenue:$(e.revenue.bind(e),"revenue",V(e),Q(e,["config.apiKey","timeline.queue.length"])),flush:$(e.flush.bind(e),"flush",V(e),Q(e,["config.apiKey","timeline.queue.length"])),getUserId:$(e.getUserId.bind(e),"getUserId",V(e),Q(e,["config","config.userId"])),setUserId:$(e.setUserId.bind(e),"setUserId",V(e),Q(e,["config","config.userId"])),getDeviceId:$(e.getDeviceId.bind(e),"getDeviceId",V(e),Q(e,["config","config.deviceId"])),setDeviceId:$(e.setDeviceId.bind(e),"setDeviceId",V(e),Q(e,["config","config.deviceId"])),reset:$(e.reset.bind(e),"reset",V(e),Q(e,["config","config.userId","config.deviceId"])),getSessionId:$(e.getSessionId.bind(e),"getSessionId",V(e),Q(e,["config"])),setSessionId:$(e.setSessionId.bind(e),"setSessionId",V(e),Q(e,["config"])),extendSession:$(e.extendSession.bind(e),"extendSession",V(e),Q(e,["config"])),setOptOut:$(e.setOptOut.bind(e),"setOptOut",V(e),Q(e,["config"])),setTransport:$(e.setTransport.bind(e),"setTransport",V(e),Q(e,["config"]))}},mt=yt(),bt=mt.add,It=mt.extendSession,_t=mt.flush,wt=mt.getDeviceId,St=mt.getSessionId,Et=mt.getUserId,Tt=mt.groupIdentify,Ot=mt.identify,kt=mt.init,Pt=mt.logEvent,Rt=mt.remove,xt=mt.reset,Ut=mt.revenue,Dt=mt.setDeviceId,Nt=mt.setGroup,qt=mt.setOptOut,Lt=mt.setSessionId,At=mt.setTransport,jt=mt.setUserId,Ct=mt.track;e.Identify=O,e.Revenue=x,e.Types=y,e.add=bt,e.createInstance=yt,e.extendSession=It,e.flush=_t,e.getDeviceId=wt,e.getSessionId=St,e.getUserId=Et,e.groupIdentify=Tt,e.identify=Ot,e.init=kt,e.logEvent=Pt,e.remove=Rt,e.reset=xt,e.revenue=Ut,e.runQueuedFunctions=function(e,t){Oe(e,t)},e.setDeviceId=Dt,e.setGroup=Nt,e.setOptOut=qt,e.setSessionId=Lt,e.setTransport=At,e.setUserId=jt,e.track=Ct,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";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 i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};function r(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function o(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function s(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function c(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var l,d,f,p,v,h,g="Event rejected due to exceeded retry count";!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"}(l||(l={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(d||(d={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(f||(f={})),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"}(p||(p={})),function(e){e.US="US",e.EU="EU"}(v||(v={})),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"}(h||(h={}));var y=Object.freeze({__proto__:null,get SpecialEventType(){return f},get IdentifyOperation(){return l},get RevenueProperty(){return d},get LogLevel(){return p},get ServerZone(){return v},get Status(){return h}}),m=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=h.Unknown),{event:e,code:t,message:n}},b=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,b)},I=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,r;return o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:b(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)];case 1:return o.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){var t;return o(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:return n=this.plugins.findIndex((function(t){return t.name===e})),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.reset=function(e){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.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 o(this,void 0,void 0,(function(){var t,n,r,o,c,l,d,f,p,v,h,g,y,b,I,_,w,S,E,T;return s(this,(function(s){switch(s.label){case 0:if(!e)return[2];t=a(e,1),n=t[0],r=a(e,2),o=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),s.label=1;case 1:s.trys.push([1,6,7,8]),l=u(c),d=l.next(),s.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(i({},n))]:[3,4];case 3:if(null===(y=s.sent()))return o({event:n,code:0,message:""}),[2];n=y,s.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=s.sent(),w={error:f},[3,8];case 7:try{d&&!d.done&&(S=l.return)&&S.call(l)}finally{if(w)throw w.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),s.label=9;case 9:s.trys.push([9,14,15,16]),v=u(p),h=v.next(),s.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(i({},n))]:[3,12];case 11:if(null===(y=s.sent()))return o({event:n,code:0,message:""}),[2];n=y,s.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return b=s.sent(),E={error:b},[3,16];case 15:try{h&&!h.done&&(T=v.return)&&T.call(v)}finally{if(E)throw E.error}return[7];case 16:return I=this.plugins.filter((function(e){return"destination"===e.type})),_=I.map((function(e){var t=i({},n);return e.execute(t).catch((function(e){return m(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=a(e,1)[0]||m(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return o(this,void 0,void 0,(function(){var e,t,n,i=this;return s(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),_="AMP",w="".concat(_,"_unsent"),S="https://api2.amplitude.com/2/httpapi",E=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!T(t,n))return!1}return!0},T=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&E(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return E(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},O=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return i({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(l.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(l.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(l.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(l.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(l.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(l.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(l.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(l.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(l.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[l.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[l.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===l.ADD?"number"==typeof n:e===l.UNSET||e===l.REMOVE||T(t,n)))},e}(),k=function(e,t){return i(i({},t),{event_type:f.IDENTIFY,user_properties:e.getUserProperties()})},P=function(e){return{promise:e||Promise.resolve()}},R=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new I(this),this.name=e}return e.prototype._init=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return o(this,void 0,void 0,(function(){var t,n,i,r,o,a;return s(this,(function(s){switch(s.label){case 0:t=this[e],this[e]=[],s.label=1;case 1:s.trys.push([1,6,7,8]),n=u(t),i=n.next(),s.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:s.sent(),s.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=s.sent(),o={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return i(i(i({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return P(this.dispatch(r))},e.prototype.identify=function(e,t){var n=k(e,t);return P(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var o=function(e,t,n,r){var o;return i(i({},r),{event_type:f.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n,r);return P(this.dispatch(o))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,o=new O;return o.set(e,t),i(i({},n),{event_type:f.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return P(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return i(i({},t),{event_type:f.REVENUE,event_properties:e.getEventProperties()})}(e,t);return P(this.dispatch(n))},e.prototype.add=function(e){return this.config?P(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),P())},e.prototype.remove=function(e){return this.config?P(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),P())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(m(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return o(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return o(this,void 0,void 0,(function(){var t,n,i;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,m(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=m(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return P(this.timeline.flush())},e}(),x=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return E(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?i({},this.properties):{};return e[d.REVENUE_PRODUCT_ID]=this.productId,e[d.REVENUE_QUANTITY]=this.quantity,e[d.REVENUE_PRICE]=this.price,e[d.REVENUE_TYPE]=this.revenueType,e[d.REVENUE]=this.revenue,e},e}(),U="Amplitude Logger ",D=function(){function e(){this.logLevel=p.None}return e.prototype.disable=function(){this.logLevel=p.None},e.prototype.enable=function(e){void 0===e&&(e=p.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Verbose||console.log("".concat(U,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Warn||console.warn("".concat(U,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Error||console.error("".concat(U,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Debug||console.log("".concat(U,"[Debug]: ").concat(e.join(" ")))},e}(),N=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:p.Warn,loggerProvider:new D,optOut:!1,serverUrl:S,serverZone:"US",useBatch:!1}},q=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=N();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=e.instanceName||o.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.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=A(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),L=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":S},A=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=N().serverZone),void 0===n&&(n=N().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:N().serverZone;return{serverZone:i,serverUrl:L(i,n)}};function j(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var C=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return o(this,void 0,void 0,(function(){var n,i=this;return s(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(w,"_").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=r.sent(),this.saveEvents(),n&&n.length>0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,g),!1)}));i.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),o(this,void 0,void 0,(function(){var t,n,i,r=this;return s(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),o(this,void 0,void 0,(function(){var n,i,o,u,a;return s(this,(function(s){switch(s.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,r(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},s.label=1;case 1:return s.trys.push([1,3,,4]),i=A(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:return null===(o=s.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(j(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return u=s.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case h.Success:this.handleSuccessResponse(e,t);break;case h.Invalid:this.handleInvalidResponse(e,t);break;case h.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case h.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 i=c(c(c(c([],a(Object.values(e.body.eventsWithInvalidFields)),!1),a(Object.values(e.body.eventsWithMissingFields)),!1),a(Object.values(e.body.eventsWithInvalidIdLengths)),!1),a(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(j(e)),this.addToQueue.apply(this,c([],a(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(j(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,c([],a(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),u=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(j(e)),this.addToQueue.apply(this,c([],a(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,c([],a(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(m(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),M=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},V=function(e){return function(){var t=i({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},F=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=u(t.split(".")),o=r.next();!o.done;o=r.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},Q=function(e,t){return function(){var n,i,r={};try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var a=s.value;r[a]=F(e,a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},$=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<p.Debug||!c||!a)return e.apply(r,o);var l={type:"invoke public method",name:t,args:o,stacktrace:M(1),time:{start:(new Date).toISOString()},states:{}};i&&l.states&&(l.states.before=i());var d=e.apply(r,o);return d&&d.promise?d.promise.then((function(){i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(i&&l.states&&(l.states.after=i()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},K=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),B=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,p,v,g,y,m,b,I,_,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case h.Success:return{status:T,statusCode:E,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!==(i=e.server_upload_time)&&void 0!==i?i:0}};case h.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},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!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case h.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case h.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(I=e.throttled_users)&&void 0!==I?I:{},exceededDailyQuotaDevices:null!==(_=e.exceeded_daily_quota_devices)&&void 0!==_?_:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case h.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?h.Success:429===e?h.RateLimit:413===e?h.PayloadTooLarge:408===e?h.Timeout:e>=400&&e<500?h.Invalid:e>=500?h.Failed:h.Unknown},e}(),z=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},W=function(){var e,t=z();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),i=J(n[0]),r=J(n[1]);return r?(e[i]=r,e):e}),{}):{}},J=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Z="dclid",Y="fbclid",G="gbraid",H="gclid",X="ko_click_id",ee="li_fat_id",te="msclkid",ne="rtd_cid",ie="ttclid",re="twclid",oe="wbraid",se={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},ue=function(){function e(){}return e.prototype.parse=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,i(i(i(i({},se),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=W();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=W();return(e={})[Z]=t[Z],e[Y]=t[Y],e[G]=t[G],e[H]=t[H],e[X]=t[X],e[ee]=t[ee],e[te]=t[te],e[ne]=t[ne],e[ie]=t[ie],e[re]=t[re],e[oe]=t[oe],e},e}(),ae=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[_,t,e.substring(0,n)].filter(Boolean).join("_")},ce=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},le=function(){function e(e){this.options=i({},e)}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n;return s(this,(function(i){switch(i.label){case 0:if(!z())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return o(this,void 0,void 0,(function(){var i,r,o;return s(this,(function(s){return i=z(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(o=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return o(this,void 0,void 0,(function(){var i,r,o,u,a,c;return s(this,(function(s){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),o=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=z())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(e){return[2]}))}))},e}(),de=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},t}(B),fe=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:pe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),pe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ve=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),he=function(){return he=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},he.apply(this,arguments)},ge=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++){if(r[i]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!ge(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){ge(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!ge(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var ye=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=he({},this.identity.userProperties),n=he(he({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++){delete t[d=v[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return he({},this.identity)},e.prototype.setIdentity=function(e){var t=he({},this.identity);this.identity=he({},e),ge(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,be=function(){function e(){this.identityStore=new ye,this.eventBridge=new ve,this.applicationContextProvider=new fe}return e.getInstance=function(t){return me.analyticsConnectorInstances||(me.analyticsConnectorInstances={}),me.analyticsConnectorInstances[t]||(me.analyticsConnectorInstances[t]=new e),me.analyticsConnectorInstances[t]},e}(),Ie=function(e){return void 0===e&&(e="$default_instance"),be.getInstance(e)},_e=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ie().identityStore}return e.prototype.execute=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return e.instanceName&&(this.identityStore=Ie(e.instanceName).identityStore),[2]}))}))},e}(),we=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},Se=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Ee=function(e){return Se(e,"attribution")},Te=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,Se(n,"pageViews"))&&(i=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(i=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:i,trackHistoryChanges:r,eventType:t}},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},ke=function(e){return e&&void 0!==e._q},Pe=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.3.0"),"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 o(this,void 0,void 0,(function(){var r,o,u;return s(this,(function(s){return r=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=r),[2,i(i(i(i(i(i(i(i({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:we()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:b(),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:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Re=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n,i;return s(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(i){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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),xe=1e3,Ue=function(e){function t(t){var n,i=this;return(i=e.call(this,null===(n=z())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return n(t,e),t.prototype.set=function(t,n){var i;return o(this,void 0,void 0,(function(){var r;return s(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xe?(r=n.length-xe,[4,e.prototype.set.call(this,t,n.slice(0,xe))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(xe,".")),[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}(Re),De=function(e){function t(){var t;return e.call(this,null===(t=z())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Re),Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(B),qe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(i){return[2,new Promise((function(i,r){var o=z();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},t}(B),Le=function(e,t,n){return void 0===n&&(n=!0),o(void 0,void 0,void 0,(function(){var i,r,o,u,c,l,d,f,p;return s(this,(function(s){switch(s.label){case 0:return i=function(e){return"".concat(_.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=s.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:s.sent(),s.label=3;case 3:return o=a(r.split("."),6),u=o[0],c=o[1],l=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:u,userId:je(c),sessionId:Ae(d),lastEventId:Ae(p),lastEventTime:Ae(f),optOut:Boolean(l)}]}}))}))},Ae=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},je=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ce="[Amplitude]",Me="".concat(Ce," Form Started"),Ve="".concat(Ce," Form Submitted"),Fe="".concat(Ce," File Downloaded"),Qe="session_start",$e="session_end",Ke="".concat(Ce," File Extension"),Be="".concat(Ce," File Name"),ze="".concat(Ce," Link ID"),We="".concat(Ce," Link Text"),Je="".concat(Ce," Link URL"),Ze="".concat(Ce," Form ID"),Ye="".concat(Ce," Form Name"),Ge="".concat(Ce," Form Destination"),He="cookie",Xe=function(e){function t(t,n,i,r,o,s,u,a,c,l,d,f,v,h,g,y,m,b,I,_,w,S,E,T,O,k,P,R,x){void 0===i&&(i=new K),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=He),void 0===g&&(g=new D),void 0===y&&(y=p.Warn),void 0===b&&(b=!1),void 0===w&&(w=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===O&&(O=new Ue({loggerProvider:g})),void 0===k&&(k={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===R&&(R=!1);var U=e.call(this,{apiKey:t,storageProvider:O,transportProvider:nt(P)})||this;return U.apiKey=t,U.appVersion=n,U.cookieOptions=r,U.defaultTracking=o,U.flushIntervalMillis=u,U.flushMaxRetries=a,U.flushQueueSize=c,U.identityStorage=l,U.ingestionMetadata=d,U.instanceName=f,U.loggerProvider=g,U.logLevel=y,U.minIdLength=m,U.partnerId=I,U.plan=_,U.serverUrl=w,U.serverZone=S,U.sessionTimeout=T,U.storageProvider=O,U.trackingOptions=k,U.transport=P,U.useBatch=R,U._optOut=!1,U._cookieStorage=i,U.deviceId=s,U.lastEventId=v,U.lastEventTime=h,U.optOut=b,U.sessionId=E,U.userId=x,U.loggerProvider.enable(U.logLevel),U}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,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}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId};this.cookieStorage.set(ae(this.apiKey),e)},t}(q),et=function(e,t,n){return void 0===t&&(t={}),o(void 0,void 0,void 0,(function(){var r,o,u,a,c,l,d,f,p,v,h,g,y,m,I,_,w,S,E,T,O,k,P,R,x,U,D,N,q,L,A,j,C,M,V,F,Q,$,K;return s(this,(function(s){switch(s.label){case 0:return r=t.identityStorage||He,_={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(a=S,[3,4]);case 2:return[4,it()];case 3:a=s.sent(),s.label=4;case 4:u=a,s.label=5;case 5:return o=i.apply(void 0,[(_.domain=u,_.expiration=365,_.sameSite="Lax",_.secure=!1,_.upgrade=!0,_),t.cookieOptions]),c=tt(t.identityStorage,o),[4,Le(e,c,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=s.sent(),[4,c.get(ae(e))];case 7:return d=s.sent(),f=W(),p=null!==(R=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==R?R:b(),v=null!==(x=null==d?void 0:d.lastEventId)&&void 0!==x?x:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,g=null!==(N=null!==(D=t.optOut)&&void 0!==D?D:null==d?void 0:d.optOut)&&void 0!==N?N:l.optOut,y=null!==(q=null==d?void 0:d.sessionId)&&void 0!==q?q:l.sessionId,m=null!==(A=null!==(L=t.userId)&&void 0!==L?L:null==d?void 0:d.userId)&&void 0!==A?A:l.userId,n.previousSessionDeviceId=null!==(j=null==d?void 0:d.deviceId)&&void 0!==j?j:l.deviceId,n.previousSessionUserId=null!==(C=null==d?void 0:d.userId)&&void 0!==C?C:l.userId,I={ipAddress:null===(V=null===(M=t.trackingOptions)||void 0===M?void 0:M.ipAddress)||void 0===V||V,language:null===(Q=null===(F=t.trackingOptions)||void 0===F?void 0:F.language)||void 0===Q||Q,platform:null===(K=null===($=t.trackingOptions)||void 0===$?void 0:$.platform)||void 0===K||K},[2,new Xe(e,t.appVersion,c,o,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,I,t.transport,t.useBatch,m)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new De;case"none":return new K;default:return new le(i(i({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new Ne:"beacon"===e?new qe:new de},it=function(e){return o(void 0,void 0,void 0,(function(){var t,n,i,r,o,u,a;return s(this,(function(s){switch(s.label){case 0:return[4,(new le).isEnabled()];case 1:if(!s.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",o=n.length-2;o>=0;--o)i.push(n.slice(o).join("."));o=0,s.label=2;case 2:return o<i.length?(u=i[o],[4,(a=new le({domain:"."+u})).set(r,1)]):[3,7];case 3:return s.sent(),[4,a.get(r)];case 4:return s.sent()?[4,a.remove(r)]:[3,6];case 5:return s.sent(),[2,"."+u];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ot=function(e,t,n,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,s=r(e,["referrer","referring_domain"]),u=t||{};u.referrer;var a=u.referring_domain,c=r(u,["referrer","referring_domain"]);if(st(n.excludeReferrers,e.referring_domain))return!1;if(!i&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return!1;var l=JSON.stringify(s)!==JSON.stringify(c),d=rt(o||"")!==rt(a||"");return!t||l||d},st=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}))},ut=function(e){var t=this;void 0===e&&(e={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,n){var r;return o(this,void 0,void 0,(function(){var o,u,c,l,d,f,p,v;return s(this,(function(s){switch(s.label){case 0:return o=i({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(m=null===(r=t.cookieOptions)||void 0===r?void 0:r.domain,b=m,b?(b.startsWith(".")&&(b=b.substring(1)),[new RegExp("".concat(b.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),u=t.cookieStorage,h=t.apiKey,void 0===(g="MKTG")&&(g=""),void 0===y&&(y=10),c=[_,g,h.substring(0,y)].filter(Boolean).join("_"),[4,Promise.all([(new ue).parse(),u.get(c)])];case 1:return l=a.apply(void 0,[s.sent(),2]),d=l[0],f=l[1],p=ce(t.sessionTimeout,t.lastEventTime),ot(d,f,o,p)&&(o.resetSessionOnNewCampaign&&(n.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),v=function(e,t){var n=i(i({},se),e),r=Object.entries(n).reduce((function(e,n){var i,r=a(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new O);return k(r)}(d,o),n.track(v),u.set(c,d)),[2]}var h,g,y,m,b}))}))},execute:function(e){return o(t,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))}};return n},at=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},ct=function(e){var t;void 0===e&&(e={});var n,r=z(),u=void 0,c=function(){return o(void 0,void 0,void 0,(function(){var t,n,r;return s(this,(function(o){switch(o.label){case 0:return n={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,lt()];case 1:return[2,(n.event_properties=i.apply(void 0,[i.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||""}]),n)]}}))}))},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},d="undefined"!=typeof location?location.href:null,f=function(){return o(void 0,void 0,void 0,(function(){var n,i,r,o;return s(this,(function(s){switch(s.label){case 0:return n=location.href,i=ft(e.trackHistoryChanges,n,d||"")&&l(),d=n,i?(null==u||u.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return o=(r=t).track,[4,c()];case 2:o.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}}))}))},p=function(){f()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,i){return o(void 0,void 0,void 0,(function(){var o,d;return s(this,(function(s){switch(s.label){case 0:return t=i,(u=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",p),n=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var i=a(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),f()}})),l()?(u.log("Tracking page view event"),d=(o=t).track,[4,c()]):[3,2];case 1:d.apply(o,[s.sent()]),s.label=2;case 2:return[2]}}))}))},execute:function(t){return o(void 0,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return"attribution"===e.trackOn&&dt(t)?(null==u||u.log("Enriching campaign event to page view event with campaign parameters"),[4,c()]):[3,2];case 1:n=r.sent(),t.event_type=n.event_type,t.event_properties=i(i({},t.event_properties),n.event_properties),r.label=2;case 2:return[2,t]}}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(e){return r&&(r.removeEventListener("popstate",p),n&&(r.history.pushState=n)),[2]}))}))}};return v},lt=function(){return o(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=at,[4,(new ue).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},dt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[l.SET]||{},i=t[l.UNSET]||{},r=c(c([],a(Object.keys(n)),!1),a(Object.keys(i)),!1);return Object.keys(se).every((function(e){return r.includes(e)}))}return!1},ft=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},pt=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return o(void 0,void 0,void 0,(function(){var r;return s(this,(function(o){return i?("undefined"==typeof document||(r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=vt(e.name),n[Ge]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Me,((n={})[Ze]=e.id,n[Ye]=vt(e.name),n[Ge]=e.action,n)),i.track(Ve,((r={})[Ze]=e.id,r[Ye]=vt(e.name),r[Ge]=e.action,r)),t=!1}))},Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},vt=function(e){if("string"==typeof e)return e},ht=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return o(void 0,void 0,void 0,(function(){var r,o;return s(this,(function(s){return i?("undefined"==typeof document||(r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=o.exec(n.href),s=null==r?void 0:r[1];s&&function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})}(e,"click",(function(){var t;s&&i.track(Fe,((t={})[Ke]=s,t[Be]=n.pathname,t[ze]=e.id,t[We]=e.text,t[Je]=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(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})),[2]):(n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},gt=!1,yt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=n):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),P(this._init(i(i({},o),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r;return o(this,void 0,void 0,(function(){var o,u,a,c,l=this;return s(this,(function(s){switch(s.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,et(t.apiKey,t,this)]);case 1:return o=s.sent(),[4,e.prototype._init.call(this,o)];case 2:return s.sent(),this.setSessionId(null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:this.config.sessionId)&&void 0!==r?r:Date.now()),(u=Ie(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new C).promise];case 3:return s.sent(),[4,this.add(new Pe).promise];case 4:return s.sent(),[4,this.add(new _e).promise];case 5:return s.sent(),f=this.config,gt||void 0!==f.defaultTracking||(f.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."),gt=!0),d=this.config.defaultTracking,Se(d,"fileDownloads")?[4,this.add(ht()).promise]:[3,7];case 6:s.sent(),s.label=7;case 7:return function(e){return Se(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(pt()).promise]:[3,9];case 8:s.sent(),s.label=9;case 9:return Ee(this.config.defaultTracking)?(a=function(e){return Ee(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?i({},e.defaultTracking.attribution):{}}(this.config),c=ut(a),[4,this.add(c).promise]):[3,11];case 10:s.sent(),s.label=11;case 11:return[4,this.add(ct(Te(this.config))).promise];case 12:return s.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return s.sent(),u.eventBridge.setEventReceiver((function(e){l.track(e.eventType,e.eventProperties)})),[2]}var d,f}))}))},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?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){Ie(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.deviceId=e,function(e,t){Ie(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(b()),this.setUserId(void 0)},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;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,Se(n,"sessions")&&(i&&r&&this.track($e,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Qe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},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=nt(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new O,i)}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,i,r){if(ke(i)){var o=i._q;i._q=[],i=Oe(new O,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(ke(t)){var i=t._q;t._q=[],t=Oe(new x,i)}return e.prototype.revenue.call(this,t,n)},t.prototype.process=function(t){return o(this,void 0,void 0,(function(){var n,i;return s(this,(function(r){return n=Date.now(),i=ce(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Qe||t.event_type===$e||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},t}(R),mt=function(){var e=new yt;return{init:$(e.init.bind(e),"init",V(e),Q(e,["config"])),add:$(e.add.bind(e),"add",V(e),Q(e,["config.apiKey","timeline.plugins"])),remove:$(e.remove.bind(e),"remove",V(e),Q(e,["config.apiKey","timeline.plugins"])),track:$(e.track.bind(e),"track",V(e),Q(e,["config.apiKey","timeline.queue.length"])),logEvent:$(e.logEvent.bind(e),"logEvent",V(e),Q(e,["config.apiKey","timeline.queue.length"])),identify:$(e.identify.bind(e),"identify",V(e),Q(e,["config.apiKey","timeline.queue.length"])),groupIdentify:$(e.groupIdentify.bind(e),"groupIdentify",V(e),Q(e,["config.apiKey","timeline.queue.length"])),setGroup:$(e.setGroup.bind(e),"setGroup",V(e),Q(e,["config.apiKey","timeline.queue.length"])),revenue:$(e.revenue.bind(e),"revenue",V(e),Q(e,["config.apiKey","timeline.queue.length"])),flush:$(e.flush.bind(e),"flush",V(e),Q(e,["config.apiKey","timeline.queue.length"])),getUserId:$(e.getUserId.bind(e),"getUserId",V(e),Q(e,["config","config.userId"])),setUserId:$(e.setUserId.bind(e),"setUserId",V(e),Q(e,["config","config.userId"])),getDeviceId:$(e.getDeviceId.bind(e),"getDeviceId",V(e),Q(e,["config","config.deviceId"])),setDeviceId:$(e.setDeviceId.bind(e),"setDeviceId",V(e),Q(e,["config","config.deviceId"])),reset:$(e.reset.bind(e),"reset",V(e),Q(e,["config","config.userId","config.deviceId"])),getSessionId:$(e.getSessionId.bind(e),"getSessionId",V(e),Q(e,["config"])),setSessionId:$(e.setSessionId.bind(e),"setSessionId",V(e),Q(e,["config"])),extendSession:$(e.extendSession.bind(e),"extendSession",V(e),Q(e,["config"])),setOptOut:$(e.setOptOut.bind(e),"setOptOut",V(e),Q(e,["config"])),setTransport:$(e.setTransport.bind(e),"setTransport",V(e),Q(e,["config"]))}},bt=mt(),It=bt.add,_t=bt.extendSession,wt=bt.flush,St=bt.getDeviceId,Et=bt.getSessionId,Tt=bt.getUserId,Ot=bt.groupIdentify,kt=bt.identify,Pt=bt.init,Rt=bt.logEvent,xt=bt.remove,Ut=bt.reset,Dt=bt.revenue,Nt=bt.setDeviceId,qt=bt.setGroup,Lt=bt.setOptOut,At=bt.setSessionId,jt=bt.setTransport,Ct=bt.setUserId,Mt=bt.track;e.Identify=O,e.Revenue=x,e.Types=y,e.add=It,e.createInstance=mt,e.extendSession=_t,e.flush=wt,e.getDeviceId=St,e.getSessionId=Et,e.getUserId=Tt,e.groupIdentify=Ot,e.identify=kt,e.init=Pt,e.logEvent=Rt,e.remove=xt,e.reset=Ut,e.revenue=Dt,e.runQueuedFunctions=function(e,t){Oe(e,t)},e.setDeviceId=Nt,e.setGroup=qt,e.setOptOut=Lt,e.setSessionId=At,e.setTransport=jt,e.setUserId=Ct,e.track=Mt,Object.defineProperty(e,"__esModule",{value:!0})}));
Binary file
@@ -1,5 +1,5 @@
1
1
  <script type="text/javascript">
2
- !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<g.length;t++)o(e,g[t],!1);for(var r=0;r<h.length;r++)o(e,h[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-QhN12IHEJCDzzlNZ/ugu3iCq5jVI1saLR0QXlVfubYxdHb8NhKqgMhr9KeruyviR",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-2.2.3-min.js.gz",u.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(c,l[p]);r.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)n(d,f[v]);r.Revenue=d;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],h=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
2
+ !function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var n=0;n<y.length;n++)o(e,y[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-3X3tXIucakqeV9+8J7rNyz7UnAJ4t3FGtY8QrzGYyVpetkZpCpBnbXxk84pmQBaT",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.3.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)r(u,p[l]);n.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}();
3
3
 
4
4
  amplitude.init("<YOUR_API_KEY>");
5
5
  </script>
@@ -1 +1 @@
1
- !function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<g.length;t++)o(e,g[t],!1);for(var r=0;r<h.length;r++)o(e,h[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-QhN12IHEJCDzzlNZ/ugu3iCq5jVI1saLR0QXlVfubYxdHb8NhKqgMhr9KeruyviR",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-2.2.3-min.js.gz",u.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(c,l[p]);r.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)n(d,f[v]);r.Revenue=d;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],h=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(e){return r._iq[e]={_q:[]},i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}();
1
+ !function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var n=0;n<y.length;n++)o(e,y[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-3X3tXIucakqeV9+8J7rNyz7UnAJ4t3FGtY8QrzGYyVpetkZpCpBnbXxk84pmQBaT",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.3.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)r(u,p[l]);n.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset","extendSession"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}();
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.2.3";
1
+ export declare const VERSION = "2.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/analytics-browser",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "description": "Official Amplitude SDK for Web",
5
5
  "keywords": [
6
6
  "analytics",
@@ -47,8 +47,8 @@
47
47
  "@amplitude/analytics-client-common": "^2.0.5",
48
48
  "@amplitude/analytics-core": "^2.0.4",
49
49
  "@amplitude/analytics-types": "^2.1.2",
50
- "@amplitude/plugin-page-view-tracking-browser": "^2.0.9",
51
- "@amplitude/plugin-web-attribution-browser": "^2.0.9",
50
+ "@amplitude/plugin-page-view-tracking-browser": "^2.0.10",
51
+ "@amplitude/plugin-web-attribution-browser": "^2.0.10",
52
52
  "tslib": "^2.4.1"
53
53
  },
54
54
  "devDependencies": {
@@ -66,5 +66,5 @@
66
66
  "files": [
67
67
  "lib"
68
68
  ],
69
- "gitHead": "e5c1ebafc300e517e809f42b015a26adebe7d79b"
69
+ "gitHead": "184f76ec82408f5c028d5292e2d9c952f615699e"
70
70
  }