From 4820f115b7d250892c1c077242d24f22e329fa9c Mon Sep 17 00:00:00 2001 From: amplitude-sdk-bot Date: Tue, 9 Apr 2024 22:10:28 +0000 Subject: [PATCH] chore(release): publish - @amplitude/analytics-browser@2.6.2 - @amplitude/analytics-client-common@2.1.3 - @amplitude/analytics-core@2.2.4 - @amplitude/plugin-global-user-properties@1.2.14 - @amplitude/plugin-page-view-tracking-browser@2.2.6 - @amplitude/plugin-web-attribution-browser@2.1.7 --- packages/analytics-browser/CHANGELOG.md | 9 +++++++++ packages/analytics-browser/README.md | 2 +- .../generated/amplitude-bookmarklet-snippet.js | 4 ++-- .../generated/amplitude-gtm-snippet.js | 4 ++-- .../analytics-browser/generated/amplitude-snippet.js | 4 ++-- packages/analytics-browser/package.json | 10 +++++----- packages/analytics-browser/playground/amplitude.js | 2 +- packages/analytics-browser/src/version.ts | 2 +- packages/analytics-client-common/CHANGELOG.md | 9 +++++++++ packages/analytics-client-common/package.json | 4 ++-- packages/analytics-core/CHANGELOG.md | 9 +++++++++ packages/analytics-core/package.json | 2 +- packages/plugin-global-user-properties/CHANGELOG.md | 9 +++++++++ packages/plugin-global-user-properties/package.json | 4 ++-- .../plugin-page-view-tracking-browser/CHANGELOG.md | 9 +++++++++ .../plugin-page-view-tracking-browser/package.json | 6 +++--- packages/plugin-web-attribution-browser/CHANGELOG.md | 9 +++++++++ packages/plugin-web-attribution-browser/package.json | 8 ++++---- 18 files changed, 80 insertions(+), 26 deletions(-) diff --git a/packages/analytics-browser/CHANGELOG.md b/packages/analytics-browser/CHANGELOG.md index f34919d33..ced37bccd 100644 --- a/packages/analytics-browser/CHANGELOG.md +++ b/packages/analytics-browser/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.6.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-browser@2.6.2-beta.0...@amplitude/analytics-browser@2.6.2) (2024-04-09) + +**Note:** Version bump only for package @amplitude/analytics-browser + +# Change Log + +All notable changes to this project will be documented in this file. See +[Conventional Commits](https://conventionalcommits.org) for commit guidelines. + ## [2.6.2-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-browser@2.6.1...@amplitude/analytics-browser@2.6.2-beta.0) (2024-03-28) **Note:** Version bump only for package @amplitude/analytics-browser diff --git a/packages/analytics-browser/README.md b/packages/analytics-browser/README.md index 4226bad8c..72e4934f5 100644 --- a/packages/analytics-browser/README.md +++ b/packages/analytics-browser/README.md @@ -53,7 +53,7 @@ This SDK is also available through CDN. Copy the script loader below and paste b ```html diff --git a/packages/analytics-browser/generated/amplitude-bookmarklet-snippet.js b/packages/analytics-browser/generated/amplitude-bookmarklet-snippet.js index 961015550..9fdf2f21d 100644 --- a/packages/analytics-browser/generated/amplitude-bookmarklet-snippet.js +++ b/packages/analytics-browser/generated/amplitude-bookmarklet-snippet.js @@ -51,10 +51,10 @@ s.parentNode.insertBefore(autoTrackingPluginScript, s); var as = document.createElement('script'); as.type = 'text/javascript'; - as.integrity = 'sha384-BHj/6N+ZSiRDYRUHPEqr/nwkUsSk3s9r1ryQeFBc4x2OiVz4peW3jSccKZsoU8Ry'; + as.integrity = 'sha384-QTeYiCpDVq3ksW+s2NZ0GnuzzfHHtNW+WQQjENwaJvD2FKX+MB3RXlcDzIEzZatr'; as.crossOrigin = 'anonymous'; as.async = false; - as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.6.2-beta.0-min.js.gz'; + as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.6.2-min.js.gz'; as.onload = function () { if (!window.amplitude.runQueuedFunctions) { console.log('[Amplitude] Error: could not load SDK'); diff --git a/packages/analytics-browser/generated/amplitude-gtm-snippet.js b/packages/analytics-browser/generated/amplitude-gtm-snippet.js index 145ca9e32..ce9d20fa1 100644 --- a/packages/analytics-browser/generated/amplitude-gtm-snippet.js +++ b/packages/analytics-browser/generated/amplitude-gtm-snippet.js @@ -55,10 +55,10 @@ amplitude.invoked = true; var as = document.createElement('script'); as.type = 'text/javascript'; - as.integrity = 'sha384-V7wK+7VpfmGIWvQtCKnagIY8Hzk4z1b+5hGGefNC431Lc2z8C9hQjofHBD+S2OnH'; + as.integrity = 'sha384-zw04Xm66huU81ABAABuDKu+K6Sp5lFZLLjqxwGJr6OWvEXQOnarazPHnfyqKIL+/'; as.crossOrigin = 'anonymous'; as.async = true; - as.src = 'https://cdn.amplitude.com/libs/analytics-browser-gtm-2.6.2-beta.0-min.js.gz'; + as.src = 'https://cdn.amplitude.com/libs/analytics-browser-gtm-2.6.2-min.js.gz'; as.onload = function () { if (!window.amplitudeGTM.runQueuedFunctions) { console.log('[Amplitude] Error: could not load SDK'); diff --git a/packages/analytics-browser/generated/amplitude-snippet.js b/packages/analytics-browser/generated/amplitude-snippet.js index 32cd71fb7..09eb928c1 100644 --- a/packages/analytics-browser/generated/amplitude-snippet.js +++ b/packages/analytics-browser/generated/amplitude-snippet.js @@ -55,10 +55,10 @@ amplitude.invoked = true; var as = document.createElement('script'); as.type = 'text/javascript'; - as.integrity = 'sha384-BHj/6N+ZSiRDYRUHPEqr/nwkUsSk3s9r1ryQeFBc4x2OiVz4peW3jSccKZsoU8Ry'; + as.integrity = 'sha384-QTeYiCpDVq3ksW+s2NZ0GnuzzfHHtNW+WQQjENwaJvD2FKX+MB3RXlcDzIEzZatr'; as.crossOrigin = 'anonymous'; as.async = true; - as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.6.2-beta.0-min.js.gz'; + as.src = 'https://cdn.amplitude.com/libs/analytics-browser-2.6.2-min.js.gz'; as.onload = function () { if (!window.amplitude.runQueuedFunctions) { console.log('[Amplitude] Error: could not load SDK'); diff --git a/packages/analytics-browser/package.json b/packages/analytics-browser/package.json index c81d2ed04..2f612773d 100644 --- a/packages/analytics-browser/package.json +++ b/packages/analytics-browser/package.json @@ -1,6 +1,6 @@ { "name": "@amplitude/analytics-browser", - "version": "2.6.2-beta.0", + "version": "2.6.2", "description": "Official Amplitude SDK for Web", "keywords": [ "analytics", @@ -44,11 +44,11 @@ "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" }, "dependencies": { - "@amplitude/analytics-client-common": "^2.1.3-beta.0", - "@amplitude/analytics-core": "^2.2.4-beta.0", + "@amplitude/analytics-client-common": "^2.1.3", + "@amplitude/analytics-core": "^2.2.4", "@amplitude/analytics-types": "^2.5.0", - "@amplitude/plugin-page-view-tracking-browser": "^2.2.6-beta.0", - "@amplitude/plugin-web-attribution-browser": "^2.1.7-beta.0", + "@amplitude/plugin-page-view-tracking-browser": "^2.2.6", + "@amplitude/plugin-web-attribution-browser": "^2.1.7", "tslib": "^2.4.1" }, "devDependencies": { diff --git a/packages/analytics-browser/playground/amplitude.js b/packages/analytics-browser/playground/amplitude.js index ce2325ea0..f3542dbf0 100644 --- a/packages/analytics-browser/playground/amplitude.js +++ b/packages/analytics-browser/playground/amplitude.js @@ -1,2 +1,2 @@ -!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;n0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]=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>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,q)},D=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:q(),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 L(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0]||L(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}(),N="AMP",A="".concat(N,"_unsent"),j="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(!M(t,n))return!1}return!0},M=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},V=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||M(t,n)))},e}(),F=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 D(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=F(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 V;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(L(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,L(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=L(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}(),Q=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}(),B="Amplitude Logger ",z=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;t0&&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 e.insert_id||(e.insert_id=q()),new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.getTryableList=function(e){var t=this;return e.filter((function(e){return e.attempts0&&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 this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),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(),this.scheduleTryable(n),[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},client_upload_time:(new Date).toISOString()},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(G(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(G(e));var s=this.getTryableList(o);this.scheduleTryable(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(G(e)),this.config.flushQueueSize/=2;var n=this.getTryableList(t);this.scheduleTryable(n)}else 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),a=new Set(o),c=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 a.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(G(e));var l=this.getTryableList(c);this.scheduleTryable(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),i=this.getTryableList(n);this.scheduleTryable(i)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(L(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),X=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},ee=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},te=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},ne=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]=te(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}},ie=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s=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}(),se=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[N,t,e.substring(0,n)].filter(Boolean).join("_")},ue=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ae=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}(),ce=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}(oe),le=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:de(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),de=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},fe=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}(),pe=function(){return pe=Object.assign||function(e){for(var t,n=1,i=arguments.length;nxe?(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),Le=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),qe=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}(oe),De=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}(oe),Ne=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(N.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"),$e="session_start",Ke="session_end",Qe="".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,U,L){void 0===i&&(i=new re),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 z),void 0===y&&(y=f.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===S&&(S=""),void 0===E&&(E="US"),void 0===O&&(O=18e5),void 0===k&&(k=new Ue({loggerProvider:g})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===x&&(x=!1);var q=e.call(this,{apiKey:t,storageProvider:k,transportProvider:nt(R)})||this;return q.apiKey=t,q.appVersion=n,q.cookieOptions=r,q.defaultTracking=o,q.flushIntervalMillis=u,q.flushMaxRetries=a,q.flushQueueSize=c,q.identityStorage=l,q.ingestionMetadata=d,q.instanceName=p,q.loggerProvider=g,q.logLevel=y,q.minIdLength=m,q.offline=b,q.partnerId=I,q.plan=w,q.serverUrl=S,q.serverZone=E,q.sessionTimeout=O,q.storageProvider=k,q.trackingOptions=P,q.transport=R,q.useBatch=x,q._optOut=!1,q._cookieStorage=i,q.deviceId=s,q.lastEventId=v,q.lastEventTime=h,q.optOut=_,q.sessionId=T,q.pageCounter=L,q.userId=U,q.loggerProvider.enable(q.logLevel),q}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}),Object.defineProperty(n.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=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,pageCounter:this._pageCounter};this.cookieStorage.set(se(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,L,D,N,A,j,C,M,V,F,$,K,Q,B,z;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||He,w={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(E=null===(S=t.cookieOptions)||void 0===S?void 0:S.domain)||void 0===E?[3,2]:(a=E,[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,[(w.domain=u,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w),t.cookieOptions]),c=tt(t.identityStorage,s),[4,Ne(e,c,null===(O=null===(T=t.cookieOptions)||void 0===T?void 0:T.upgrade)||void 0===O||O)];case 6:return l=o.sent(),[4,c.get(se(e))];case 7:return d=o.sent(),f=g(),p=null!==(x=null!==(R=null!==(P=null!==(k=t.deviceId)&&void 0!==k?k:f.deviceId)&&void 0!==P?P:null==d?void 0:d.deviceId)&&void 0!==R?R:l.deviceId)&&void 0!==x?x:q(),v=null!==(U=null==d?void 0:d.lastEventId)&&void 0!==U?U:l.lastEventId,h=null!==(L=null==d?void 0:d.lastEventTime)&&void 0!==L?L:l.lastEventTime,y=null!==(N=null!==(D=t.optOut)&&void 0!==D?D:null==d?void 0:d.optOut)&&void 0!==N?N:l.optOut,m=null!==(A=null==d?void 0:d.sessionId)&&void 0!==A?A:l.sessionId,b=null!==(C=null!==(j=t.userId)&&void 0!==j?j:null==d?void 0:d.userId)&&void 0!==C?C:l.userId,i.previousSessionDeviceId=null!==(M=null==d?void 0:d.deviceId)&&void 0!==M?M:l.deviceId,i.previousSessionUserId=null!==(V=null==d?void 0:d.userId)&&void 0!==V?V:l.userId,_={ipAddress:null===($=null===(F=t.trackingOptions)||void 0===F?void 0:F.ipAddress)||void 0===$||$,language:null===(Q=null===(K=t.trackingOptions)||void 0===K?void 0:K.language)||void 0===Q||Q,platform:null===(z=null===(B=t.trackingOptions)||void 0===B?void 0:B.platform)||void 0===z||z},I=null==d?void 0:d.pageCounter,[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,t.offline,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,b,I)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new Le;case"none":return new re;default:return new ae(n(n({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new qe:"beacon"===e?new De:new ce},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 ae).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 s2?(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(),this.config=r,this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),[4,e.prototype._init.call(this,this.config)];case 2:return o.sent(),(u=me(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,4]:[4,this.add(yt()).promise];case 3:o.sent(),o.label=4;case 4:return[4,this.add(new H).promise];case 5:return o.sent(),[4,this.add(new Pe).promise];case 6:return o.sent(),[4,this.add(new be).promise];case 7: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(, {\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,Ie(d,"fileDownloads")?[4,this.add(ht()).promise]:[3,9];case 8:o.sent(),o.label=9;case 9:return function(e){return Ie(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(pt()).promise]:[3,11];case 10:o.sent(),o.label=11;case 11:return we(this.config.defaultTracking)?(a=function(e){return we(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,13];case 12:o.sent(),o.label=13;case 13:return Se(this.config.defaultTracking)?[4,this.add(ct(Ee(this.config))).promise]:[3,15];case 14:o.sent(),o.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16: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){me(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){me(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(q()),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,this.config.pageCounter=0,n=this.config.defaultTracking,Ie(n,"sessions")&&(i&&r&&this.track(Ke,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($e,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 V,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 V,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 Q,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=ue(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===$e||t.event_type===Ke||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),bt=function(){var e=new mt;return{init:ie(e.init.bind(e),"init",ee(e),ne(e,["config"])),add:ie(e.add.bind(e),"add",ee(e),ne(e,["config.apiKey","timeline.plugins"])),remove:ie(e.remove.bind(e),"remove",ee(e),ne(e,["config.apiKey","timeline.plugins"])),track:ie(e.track.bind(e),"track",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),logEvent:ie(e.logEvent.bind(e),"logEvent",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),identify:ie(e.identify.bind(e),"identify",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ie(e.groupIdentify.bind(e),"groupIdentify",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),setGroup:ie(e.setGroup.bind(e),"setGroup",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),revenue:ie(e.revenue.bind(e),"revenue",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),flush:ie(e.flush.bind(e),"flush",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),getUserId:ie(e.getUserId.bind(e),"getUserId",ee(e),ne(e,["config","config.userId"])),setUserId:ie(e.setUserId.bind(e),"setUserId",ee(e),ne(e,["config","config.userId"])),getDeviceId:ie(e.getDeviceId.bind(e),"getDeviceId",ee(e),ne(e,["config","config.deviceId"])),setDeviceId:ie(e.setDeviceId.bind(e),"setDeviceId",ee(e),ne(e,["config","config.deviceId"])),reset:ie(e.reset.bind(e),"reset",ee(e),ne(e,["config","config.userId","config.deviceId"])),getSessionId:ie(e.getSessionId.bind(e),"getSessionId",ee(e),ne(e,["config"])),setSessionId:ie(e.setSessionId.bind(e),"setSessionId",ee(e),ne(e,["config"])),extendSession:ie(e.extendSession.bind(e),"extendSession",ee(e),ne(e,["config"])),setOptOut:ie(e.setOptOut.bind(e),"setOptOut",ee(e),ne(e,["config"])),setTransport:ie(e.setTransport.bind(e),"setTransport",ee(e),ne(e,["config"]))}},_t=bt(),It=_t.add,wt=_t.extendSession,St=_t.flush,Et=_t.getDeviceId,Tt=_t.getSessionId,Ot=_t.getUserId,kt=_t.groupIdentify,Pt=_t.identify,Rt=_t.init,xt=_t.logEvent,Ut=_t.remove,Lt=_t.reset,qt=_t.revenue,Dt=_t.setDeviceId,Nt=_t.setGroup,At=_t.setOptOut,jt=_t.setSessionId,Ct=_t.setTransport,Mt=_t.setUserId,Vt=_t.track,Ft=Object.freeze({__proto__:null,add:It,extendSession:wt,flush:St,getDeviceId:Et,getSessionId:Tt,getUserId:Ot,groupIdentify:kt,identify:Pt,init:Rt,logEvent:xt,remove:Ut,reset:Lt,revenue:qt,setDeviceId:Dt,setGroup:Nt,setOptOut:At,setSessionId:jt,setTransport:Ct,setUserId:Mt,track:Vt,Types:U,createInstance:bt,runQueuedFunctions:Te,Revenue:Q,Identify:V});!function(){var e=h();if(e){var t=function(e){var t=bt(),n=h();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Ft,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],Te(Ft,n);for(var i=Object.keys(e.amplitude._iq)||[],r=0;r0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]=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>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,q)},D=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:q(),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 L(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0]||L(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}(),N="AMP",A="".concat(N,"_unsent"),j="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(!M(t,n))return!1}return!0},M=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},V=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||M(t,n)))},e}(),F=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 D(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=F(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 V;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(L(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,L(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=L(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}(),Q=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}(),B="Amplitude Logger ",z=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;t0&&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 e.insert_id||(e.insert_id=q()),new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.getTryableList=function(e){var t=this;return e.filter((function(e){return e.attempts0&&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 this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),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(),this.scheduleTryable(n),[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},client_upload_time:(new Date).toISOString()},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(G(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(G(e));var s=this.getTryableList(o);this.scheduleTryable(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(G(e)),this.config.flushQueueSize/=2;var n=this.getTryableList(t);this.scheduleTryable(n)}else 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),a=new Set(o),c=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 a.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(G(e));var l=this.getTryableList(c);this.scheduleTryable(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),i=this.getTryableList(n);this.scheduleTryable(i)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(L(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),X=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},ee=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},te=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},ne=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]=te(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}},ie=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s=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}(),se=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[N,t,e.substring(0,n)].filter(Boolean).join("_")},ue=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ae=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}(),ce=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}(oe),le=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:de(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),de=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},fe=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}(),pe=function(){return pe=Object.assign||function(e){for(var t,n=1,i=arguments.length;nxe?(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),Le=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),qe=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}(oe),De=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}(oe),Ne=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(N.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"),$e="session_start",Ke="session_end",Qe="".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,U,L){void 0===i&&(i=new re),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 z),void 0===y&&(y=f.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===S&&(S=""),void 0===E&&(E="US"),void 0===O&&(O=18e5),void 0===k&&(k=new Ue({loggerProvider:g})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===x&&(x=!1);var q=e.call(this,{apiKey:t,storageProvider:k,transportProvider:nt(R)})||this;return q.apiKey=t,q.appVersion=n,q.cookieOptions=r,q.defaultTracking=o,q.flushIntervalMillis=u,q.flushMaxRetries=a,q.flushQueueSize=c,q.identityStorage=l,q.ingestionMetadata=d,q.instanceName=p,q.loggerProvider=g,q.logLevel=y,q.minIdLength=m,q.offline=b,q.partnerId=I,q.plan=w,q.serverUrl=S,q.serverZone=E,q.sessionTimeout=O,q.storageProvider=k,q.trackingOptions=P,q.transport=R,q.useBatch=x,q._optOut=!1,q._cookieStorage=i,q.deviceId=s,q.lastEventId=v,q.lastEventTime=h,q.optOut=_,q.sessionId=T,q.pageCounter=L,q.userId=U,q.loggerProvider.enable(q.logLevel),q}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}),Object.defineProperty(n.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=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,pageCounter:this._pageCounter};this.cookieStorage.set(se(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,L,D,N,A,j,C,M,V,F,$,K,Q,B,z;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||He,w={},r===He?[3,1]:(u="",[3,5]);case 1:return null===(E=null===(S=t.cookieOptions)||void 0===S?void 0:S.domain)||void 0===E?[3,2]:(a=E,[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,[(w.domain=u,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w),t.cookieOptions]),c=tt(t.identityStorage,s),[4,Ne(e,c,null===(O=null===(T=t.cookieOptions)||void 0===T?void 0:T.upgrade)||void 0===O||O)];case 6:return l=o.sent(),[4,c.get(se(e))];case 7:return d=o.sent(),f=g(),p=null!==(x=null!==(R=null!==(P=null!==(k=t.deviceId)&&void 0!==k?k:f.deviceId)&&void 0!==P?P:null==d?void 0:d.deviceId)&&void 0!==R?R:l.deviceId)&&void 0!==x?x:q(),v=null!==(U=null==d?void 0:d.lastEventId)&&void 0!==U?U:l.lastEventId,h=null!==(L=null==d?void 0:d.lastEventTime)&&void 0!==L?L:l.lastEventTime,y=null!==(N=null!==(D=t.optOut)&&void 0!==D?D:null==d?void 0:d.optOut)&&void 0!==N?N:l.optOut,m=null!==(A=null==d?void 0:d.sessionId)&&void 0!==A?A:l.sessionId,b=null!==(C=null!==(j=t.userId)&&void 0!==j?j:null==d?void 0:d.userId)&&void 0!==C?C:l.userId,i.previousSessionDeviceId=null!==(M=null==d?void 0:d.deviceId)&&void 0!==M?M:l.deviceId,i.previousSessionUserId=null!==(V=null==d?void 0:d.userId)&&void 0!==V?V:l.userId,_={ipAddress:null===($=null===(F=t.trackingOptions)||void 0===F?void 0:F.ipAddress)||void 0===$||$,language:null===(Q=null===(K=t.trackingOptions)||void 0===K?void 0:K.language)||void 0===Q||Q,platform:null===(z=null===(B=t.trackingOptions)||void 0===B?void 0:B.platform)||void 0===z||z},I=null==d?void 0:d.pageCounter,[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,t.offline,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,b,I)]}}))}))},tt=function(e,t){switch(void 0===e&&(e=He),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new Le;case"none":return new re;default:return new ae(n(n({},t),{expirationDays:t.expiration}))}},nt=function(e){return"xhr"===e?new qe:"beacon"===e?new De:new ce},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 ae).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 s2?(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(),this.config=r,this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),[4,e.prototype._init.call(this,this.config)];case 2:return o.sent(),(u=me(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,4]:[4,this.add(yt()).promise];case 3:o.sent(),o.label=4;case 4:return[4,this.add(new H).promise];case 5:return o.sent(),[4,this.add(new Pe).promise];case 6:return o.sent(),[4,this.add(new be).promise];case 7: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(, {\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,Ie(d,"fileDownloads")?[4,this.add(ht()).promise]:[3,9];case 8:o.sent(),o.label=9;case 9:return function(e){return Ie(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(pt()).promise]:[3,11];case 10:o.sent(),o.label=11;case 11:return we(this.config.defaultTracking)?(a=function(e){return we(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,13];case 12:o.sent(),o.label=13;case 13:return Se(this.config.defaultTracking)?[4,this.add(ct(Ee(this.config))).promise]:[3,15];case 14:o.sent(),o.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16: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){me(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){me(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(q()),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,this.config.pageCounter=0,n=this.config.defaultTracking,Ie(n,"sessions")&&(i&&r&&this.track(Ke,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($e,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 V,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 V,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 Q,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=ue(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===$e||t.event_type===Ke||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),bt=function(){var e=new mt;return{init:ie(e.init.bind(e),"init",ee(e),ne(e,["config"])),add:ie(e.add.bind(e),"add",ee(e),ne(e,["config.apiKey","timeline.plugins"])),remove:ie(e.remove.bind(e),"remove",ee(e),ne(e,["config.apiKey","timeline.plugins"])),track:ie(e.track.bind(e),"track",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),logEvent:ie(e.logEvent.bind(e),"logEvent",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),identify:ie(e.identify.bind(e),"identify",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ie(e.groupIdentify.bind(e),"groupIdentify",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),setGroup:ie(e.setGroup.bind(e),"setGroup",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),revenue:ie(e.revenue.bind(e),"revenue",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),flush:ie(e.flush.bind(e),"flush",ee(e),ne(e,["config.apiKey","timeline.queue.length"])),getUserId:ie(e.getUserId.bind(e),"getUserId",ee(e),ne(e,["config","config.userId"])),setUserId:ie(e.setUserId.bind(e),"setUserId",ee(e),ne(e,["config","config.userId"])),getDeviceId:ie(e.getDeviceId.bind(e),"getDeviceId",ee(e),ne(e,["config","config.deviceId"])),setDeviceId:ie(e.setDeviceId.bind(e),"setDeviceId",ee(e),ne(e,["config","config.deviceId"])),reset:ie(e.reset.bind(e),"reset",ee(e),ne(e,["config","config.userId","config.deviceId"])),getSessionId:ie(e.getSessionId.bind(e),"getSessionId",ee(e),ne(e,["config"])),setSessionId:ie(e.setSessionId.bind(e),"setSessionId",ee(e),ne(e,["config"])),extendSession:ie(e.extendSession.bind(e),"extendSession",ee(e),ne(e,["config"])),setOptOut:ie(e.setOptOut.bind(e),"setOptOut",ee(e),ne(e,["config"])),setTransport:ie(e.setTransport.bind(e),"setTransport",ee(e),ne(e,["config"]))}},_t=bt(),It=_t.add,wt=_t.extendSession,St=_t.flush,Et=_t.getDeviceId,Tt=_t.getSessionId,Ot=_t.getUserId,kt=_t.groupIdentify,Pt=_t.identify,Rt=_t.init,xt=_t.logEvent,Ut=_t.remove,Lt=_t.reset,qt=_t.revenue,Dt=_t.setDeviceId,Nt=_t.setGroup,At=_t.setOptOut,jt=_t.setSessionId,Ct=_t.setTransport,Mt=_t.setUserId,Vt=_t.track,Ft=Object.freeze({__proto__:null,add:It,extendSession:wt,flush:St,getDeviceId:Et,getSessionId:Tt,getUserId:Ot,groupIdentify:kt,identify:Pt,init:Rt,logEvent:xt,remove:Ut,reset:Lt,revenue:qt,setDeviceId:Dt,setGroup:Nt,setOptOut:At,setSessionId:jt,setTransport:Ct,setUserId:Mt,track:Vt,Types:U,createInstance:bt,runQueuedFunctions:Te,Revenue:Q,Identify:V});!function(){var e=h();if(e){var t=function(e){var t=bt(),n=h();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Ft,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],Te(Ft,n);for(var i=Object.keys(e.amplitude._iq)||[],r=0;r