@amplitude/analytics-browser
Advanced tools
Comparing version 2.0.0-beta.3 to 2.0.0-beta.4
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.0.0-beta.3"; | ||
export declare const VERSION = "2.0.0-beta.4"; | ||
//# sourceMappingURL=version.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '2.0.0-beta.3'; | ||
exports.VERSION = '2.0.0-beta.4'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "2.0.0-beta.3"; | ||
export declare const VERSION = "2.0.0-beta.4"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = '2.0.0-beta.3'; | ||
export var VERSION = '2.0.0-beta.4'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,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=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},h=function(){var e,t=v();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),i=g(n[0]),r=g(n[1]);return r?(e[i]=r,e):e}),{}):{}},g=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},y="dclid",m="fbclid",b="gbraid",I="gclid",_="ko_click_id",w="li_fat_id",S="msclkid",E="rtd_cid",T="ttclid",O="twclid",k="wbraid",P={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},R=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({},P),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=h();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=h();return(e={})[y]=t[y],e[m]=t[m],e[b]=t[b],e[I]=t[I],e[_]=t[_],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},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(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.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"}(p||(p={}));var x=Object.freeze({__proto__:null,get SpecialEventType(){return d},get IdentifyOperation(){return c},get RevenueProperty(){return l},get LogLevel(){return f},get Status(){return p}}),U="AMP",q="".concat(U,"_unsent"),D="https://api2.amplitude.com/2/httpapi",L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!A(t,n))return!1}return!0},A=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&&L(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 L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},N=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return 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||A(t,n)))},e}(),j=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},C=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=p.Unknown),{event:e,code:t,message:n}},M=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,M)},V=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:M(),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){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.reset=function(e){this.applying=!1,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(),_={error:f},[3,8];case 7:try{d&&!d.done&&(w=l.return)&&w.call(l)}finally{if(_)throw _.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})),I=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return C(t,0,String(e))}))})),Promise.all(I).then((function(e){var t=u(e,1)[0];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}(),F="Event rejected due to exceeded retry count",Q=function(e){return{promise:e||Promise.resolve()}},$=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 V(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 Q(this.dispatch(r))},e.prototype.identify=function(e,t){var n=j(e,t);return Q(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 Q(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new N;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 Q(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 Q(this.dispatch(i))},e.prototype.add=function(e){return this.config?Q(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),Q())},e.prototype.remove=function(e){return this.config?Q(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),Q())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(C(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,C(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):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=C(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 Q(this.timeline.flush())},e}(),K=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 L(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;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Verbose||console.log("".concat(B,"[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(B,"[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(B,"[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(B,"[Debug]: ").concat(e.join(" ")))},e}(),W=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,logLevel:f.Warn,loggerProvider:new z,optOut:!1,serverUrl:D,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.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}(),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":D},G=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)}},Y=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(q,"_").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,F),!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:if(null===(s=o.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t){if("body"in s){u="";try{u=JSON.stringify(s.body,null,2)}catch(e){}this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(u))}else this.fulfillRequest(e,s.statusCode,s.status);return[2]}return this.handleReponse(s,e),[3,4];case 3:return a=o.sent(),this.fulfillRequest(e,0,String(a)),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch(e.status){case p.Success:this.handleSuccessResponse(e,t);break;case p.Invalid:this.handleInvalidResponse(e,t);break;case p.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case p.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.handleOtherReponse(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)}));this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(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)}));this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherReponse=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(C(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}(),H=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},X=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ee=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},te=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]=ee(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}},ne=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:H(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}},ie=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}(),re=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,v,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 p.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 p.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!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case p.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case p.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 p.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?p.Success:429===e?p.RateLimit:413===e?p.PayloadTooLarge:408===e?p.Timeout:e>=400&&e<500?p.Invalid:e>=500?p.Failed:p.Unknown},e}(),oe=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[U,t,e.substring(0,n)].filter(Boolean).join("_")},se=function(){function e(e){this.options=n({},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(!v())return[2,!1];t=String(Date.now()),n=new e(this.options),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[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;return r(this,void 0,void 0,(function(){var n,i,r;return o(this,(function(o){return n=v(),i=null!==(t=null==n?void 0:n.document.cookie.split("; "))&&void 0!==t?t:[],(r=i.find((function(t){return 0===t.indexOf(e+"=")})))?[2,r.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=v())&&(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}(),ue=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}(re),ae=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ce(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ce=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},le=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}(),de=function(){return de=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},de.apply(this,arguments)},fe=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(!fe(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){fe(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!fe(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 pe=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=de({},this.identity.userProperties),n=de(de({},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 de({},this.identity)},e.prototype.setIdentity=function(e){var t=de({},this.identity);this.identity=de({},e),fe(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}(),ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,he=function(){function e(){this.identityStore=new pe,this.eventBridge=new le,this.applicationContextProvider=new ae}return e.getInstance=function(t){return ve.analyticsConnectorInstances||(ve.analyticsConnectorInstances={}),ve.analyticsConnectorInstances[t]||(ve.analyticsConnectorInstances[t]=new e),ve.analyticsConnectorInstances[t]},e}(),ge=function(){return he.getInstance("$default_instance")},ye=function(){function e(){this.name="identity",this.type="before",this.identityStore=ge().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 Promise.resolve(void 0)},e}(),me=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:""},be=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Ie=function(e){return be(e,"attribution")},_e=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,be(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}},we=function(e,t){Se(e,t)},Se=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},Ee=function(e){return e&&void 0!==e._q},Te=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.eventId=0,this.library="amplitude-ts/".concat("2.0.0-beta.3"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,this.eventId=this.config.lastEventId?this.config.lastEventId+1:0,Promise.resolve(void 0)},e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){return t=(new Date).getTime(),this.config.lastEventId=this.eventId,[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:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:me()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:M(),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:this.eventId++,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Oe=function(){function 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(!v())return[2,!1];t=String(Date.now()),n=new e,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(),[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=v())||void 0===t?void 0:t.localStorage.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=v())||void 0===n||n.localStorage.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=v())||void 0===t||t.localStorage.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=v())||void 0===e||e.localStorage.clear()}catch(e){}return[2]}))}))},e}(),ke=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}(re),Pe=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=v();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}(re),Re=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;return o(this,(function(o){switch(o.label){case 0:return i=function(e){return"".concat(U.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("."),5),a=s[0],c=s[1],l=s[2],d=s[3],f=s[4],[2,{deviceId:a,userId:Ue(c),sessionId:xe(d),lastEventTime:xe(f),optOut:Boolean(l)}]}}))}))},xe=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ue=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},qe="[Amplitude]",De="".concat(qe," Form Started"),Le="".concat(qe," Form Submitted"),Ae="".concat(qe," File Downloaded"),Ne="session_start",je="session_end",Ce="".concat(qe," File Extension"),Me="".concat(qe," File Name"),Ve="".concat(qe," Link ID"),Fe="".concat(qe," Link Text"),Qe="".concat(qe," Link URL"),$e="".concat(qe," Form ID"),Ke="".concat(qe," Form Name"),Be="".concat(qe," Form Destination"),ze="cookie",We=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){void 0===i&&(i=new ie),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===o&&(o=!0),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=ze),void 0===h&&(h=new z),void 0===g&&(g=f.Warn),void 0===m&&(m=!1),void 0===_&&(_=""),void 0===w&&(w="US"),void 0===E&&(E=18e5),void 0===T&&(T=new Oe),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===k&&(k="fetch"),void 0===P&&(P=!1);var x=e.call(this,{apiKey:t,storageProvider:T,transportProvider:Ge(k)})||this;return x.apiKey=t,x.appVersion=n,x.cookieOptions=r,x.defaultTracking=o,x.flushIntervalMillis=u,x.flushMaxRetries=a,x.flushQueueSize=c,x.identityStorage=l,x.ingestionMetadata=d,x.loggerProvider=h,x.logLevel=g,x.minIdLength=y,x.partnerId=b,x.plan=I,x.serverUrl=_,x.serverZone=w,x.sessionTimeout=E,x.storageProvider=T,x.trackingOptions=O,x.transport=k,x.useBatch=P,x._optOut=!1,x._cookieStorage=i,x.deviceId=s,x.lastEventId=p,x.lastEventTime=v,x.optOut=m,x.sessionId=S,x.userId=R,x.loggerProvider.enable(x.logLevel),x}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(oe(this.apiKey),e)},n}(J),Je=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,g,y,m,b,I,_,w,S,E,T,O,k,P,R,x,U,q,D,L,A,N,j,C,V;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||ze,u=[n({},t.cookieOptions)],w={},r===ze?[3,1]:(a="",[3,5]);case 1:return null===(E=null===(S=t.cookieOptions)||void 0===S?void 0:S.domain)||void 0===E?[3,2]:(c=E,[3,4]);case 2:return[4,Ye()];case 3:c=o.sent(),o.label=4;case 4:a=c,o.label=5;case 5:return s=n.apply(void 0,u.concat([(w.domain=a,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w)])),l=Ze(t.identityStorage,s),[4,Re(e,l,null===(O=null===(T=t.cookieOptions)||void 0===T?void 0:T.upgrade)||void 0===O||O)];case 6:return d=o.sent(),[4,l.get(oe(e))];case 7:return f=o.sent(),p=h(),v=null!==(x=null!==(R=null!==(P=null!==(k=t.deviceId)&&void 0!==k?k:p.deviceId)&&void 0!==P?P:null==f?void 0:f.deviceId)&&void 0!==R?R:d.deviceId)&&void 0!==x?x:M(),g=null==f?void 0:f.lastEventId,y=null!==(U=null==f?void 0:f.lastEventTime)&&void 0!==U?U:d.lastEventTime,m=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==f?void 0:f.optOut)&&void 0!==D?D:d.optOut,b=null!==(A=null!==(L=t.sessionId)&&void 0!==L?L:null==f?void 0:f.sessionId)&&void 0!==A?A:d.sessionId,I=null!==(j=null!==(N=t.userId)&&void 0!==N?N:null==f?void 0:f.userId)&&void 0!==j?j:d.userId,i.previousSessionDeviceId=null!==(C=null==f?void 0:f.deviceId)&&void 0!==C?C:d.deviceId,i.previousSessionUserId=null!==(V=null==f?void 0:f.userId)&&void 0!==V?V:d.userId,_=n(n({},t.trackingOptions),{ipAddress:!0,language:!0,platform:!0}),[2,new We(e,t.appVersion,l,s,t.defaultTracking,v,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,g,y,t.loggerProvider,t.logLevel,t.minIdLength,m,t.partnerId,t.plan,t.serverUrl,t.serverZone,b,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,I)]}}))}))},Ze=function(e,t){switch(void 0===e&&(e=ze),void 0===t&&(t={}),e){case"localStorage":return new Oe;case"none":return new ie;default:return new se(t)}},Ge=function(e){return"xhr"===e?new ke:"beacon"===e?new Pe:new ue},Ye=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 se).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 se({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,""]}}))}))},He=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Xe=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}))},et=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;return o(this,(function(o){switch(o.label){case 0:return r=n({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(m=null===(a=t.cookieOptions)||void 0===a?void 0:a.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."),c=t.cookieStorage,h=t.apiKey,void 0===(g="MKTG")&&(g=""),void 0===y&&(y=10),l=[U,g,h.substring(0,y)].filter(Boolean).join("_"),[4,Promise.all([(new R).parse(),c.get(l)])];case 1:return d=u.apply(void 0,[o.sent(),2]),f=d[0],p=d[1],function(e,t,n){e.referrer;var r=e.referring_domain,o=i(e,["referrer","referring_domain"]),s=t||{};s.referrer;var u=s.referring_domain,a=i(s,["referrer","referring_domain"]);if(Xe(n.excludeReferrers,e.referring_domain))return!1;var c=JSON.stringify(o)!==JSON.stringify(a),l=He(r||"")!==He(u||"");return!t||c||l}(f,p,r)&&(r.resetSessionOnNewCampaign&&(s.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({},P),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 N);return j(r)}(f,r),s.track(v),c.set(l,f)),[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 s},tt=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},nt=function(e){var t;void 0===e&&(e={});var i=v(),s=void 0,a=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,it()];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)]}}))}))},c=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},l="undefined"!=typeof location?location.href:null,d=function(){return r(void 0,void 0,void 0,(function(){var n,i,r;return o(this,(function(o){switch(o.label){case 0:return n=location.href,ot(e.trackHistoryChanges,n,l||"")&&c()?(null==s||s.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return r=(i=t).track,[4,a()];case 2:r.apply(i,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return l=n,[2]}}))}))},f={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,n){return r(void 0,void 0,void 0,(function(){var r,l;return o(this,(function(o){switch(o.label){case 0:return t=n,(s=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),i&&(i.addEventListener("popstate",(function(){d()})),i.history.pushState=new Proxy(i.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]),d()}})),c()?(s.log("Tracking page view event"),l=(r=t).track,[4,a()]):[3,2];case 1:l.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&&rt(t)?(null==s||s.log("Enriching campaign event to page view event with campaign parameters"),[4,a()]):[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]}}))}))}};return f},it=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=tt,[4,(new R).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},rt=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(P).every((function(e){return r.includes(e)}))}return!1},ot=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},st=function(){var e,t;return{name:"@amplitude/plugin-session-handler",type:"before",setup:function(n,i){return r(void 0,void 0,void 0,(function(){return o(this,(function(r){return e=n,t=i,[2]}))}))},execute:function(n){return r(void 0,void 0,void 0,(function(){var i,r;return o(this,(function(o){return i=Date.now(),n.event_type===Ne||n.event_type===je?(e.lastEventTime=i,[2,n]):(r=e.lastEventTime||i,i-r>e.sessionTimeout&&(t.setSessionId(i),n.session_id=t.getSessionId(),n.time=i),e.lastEventTime=i,[2,n])}))}))}}},ut=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.init=function(e,t,i){return void 0===e&&(e=""),Q(this._init(n(n({},i),{userId:t,apiKey:e})))},i.prototype._init=function(t){return r(this,void 0,void 0,(function(){var i,s,u,a,c=this;return o(this,(function(l){switch(l.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Je(t.apiKey,t,this)]);case 1:return i=l.sent(),[4,e.prototype._init.call(this,i)];case 2:return l.sent(),(!this.config.sessionId||this.config.lastEventTime&&Date.now()-this.config.lastEventTime>this.config.sessionTimeout)&&this.setSessionId(Date.now()),(s=ge()).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new Y).promise];case 3:return l.sent(),[4,this.add(new Te).promise];case 4:return l.sent(),[4,this.add(st()).promise];case 5:return l.sent(),[4,this.add(new ye).promise];case 6:return l.sent(),f=this.config.defaultTracking,be(f,"fileDownloads")?[4,this.add({name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(e,t){return r(void 0,void 0,void 0,(function(){var n,i;return o(this,(function(r){return t?(n=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=i.exec(n.href),o=null==r?void 0:r[1];o&&e.addEventListener("click",(function(){var i;o&&t.track(Ae,((i={})[Ce]=o,i[Me]=n.pathname,i[Ve]=e.id,i[Fe]=e.text,i[Qe]=e.href,i))}))},i=/\.(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(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.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]}))}))}}).promise]:[3,8];case 7:l.sent(),l.label=8;case 8:return function(e){return be(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add({name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(i){return t?(n=function(e){var n=!1;e.addEventListener("change",(function(){var i;n||t.track(De,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),n=!0}),{}),e.addEventListener("submit",(function(){var i,r;n||t.track(De,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),t.track(Le,((r={})[$e]=e.id,r[Ke]=e.name,r[Be]=e.action,r)),n=!1}))},Array.from(document.getElementsByTagName("form")).forEach(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.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]}))}))}}).promise]:[3,10];case 9:l.sent(),l.label=10;case 10:return Ie(this.config.defaultTracking)?(d=this.config,u=Ie(d.defaultTracking)&&d.defaultTracking&&"object"==typeof d.defaultTracking&&d.defaultTracking.attribution&&"object"==typeof d.defaultTracking.attribution?n({},d.defaultTracking.attribution):{},a=et(u),[4,this.add(a).promise]):[3,12];case 11:l.sent(),l.label=12;case 12:return[4,this.add(nt(_e(this.config))).promise];case 13:return l.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 14:return l.sent(),s.eventBridge.setEventReceiver((function(e){c.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,this.setSessionId(Date.now()),function(e){ge().identityStore.editIdentity().setUserId(e).commit()}(e)):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){ge().identityStore.editIdentity().setDeviceId(e).commit()}(e)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(M()),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){if(this.config){var t,n=this.getSessionId(),i=this.config.lastEventTime;if(this.config.sessionId=e,this.config.lastEventTime=void 0,t=this.config.defaultTracking,be(t,"sessions")){if(n&&i){var r={session_id:n,time:i+1};r.device_id=this.previousSessionDeviceId,r.user_id=this.previousSessionUserId,this.track(je,void 0,r)}this.track(Ne,void 0,{session_id:e,time:e-1}),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ge(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new N,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(Ee(i)){var o=i._q;i._q=[],i=Se(new N,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new K,i)}return e.prototype.revenue.call(this,t,n)},i}($),at=function(){var e=new ut;return{init:ne(e.init.bind(e),"init",X(e),te(e,["config"])),add:ne(e.add.bind(e),"add",X(e),te(e,["config.apiKey","timeline.plugins"])),remove:ne(e.remove.bind(e),"remove",X(e),te(e,["config.apiKey","timeline.plugins"])),track:ne(e.track.bind(e),"track",X(e),te(e,["config.apiKey","timeline.queue.length"])),logEvent:ne(e.logEvent.bind(e),"logEvent",X(e),te(e,["config.apiKey","timeline.queue.length"])),identify:ne(e.identify.bind(e),"identify",X(e),te(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ne(e.groupIdentify.bind(e),"groupIdentify",X(e),te(e,["config.apiKey","timeline.queue.length"])),setGroup:ne(e.setGroup.bind(e),"setGroup",X(e),te(e,["config.apiKey","timeline.queue.length"])),revenue:ne(e.revenue.bind(e),"revenue",X(e),te(e,["config.apiKey","timeline.queue.length"])),flush:ne(e.flush.bind(e),"flush",X(e),te(e,["config.apiKey","timeline.queue.length"])),getUserId:ne(e.getUserId.bind(e),"getUserId",X(e),te(e,["config","config.userId"])),setUserId:ne(e.setUserId.bind(e),"setUserId",X(e),te(e,["config","config.userId"])),getDeviceId:ne(e.getDeviceId.bind(e),"getDeviceId",X(e),te(e,["config","config.deviceId"])),setDeviceId:ne(e.setDeviceId.bind(e),"setDeviceId",X(e),te(e,["config","config.deviceId"])),reset:ne(e.reset.bind(e),"reset",X(e),te(e,["config","config.userId","config.deviceId"])),getSessionId:ne(e.getSessionId.bind(e),"getSessionId",X(e),te(e,["config"])),setSessionId:ne(e.setSessionId.bind(e),"setSessionId",X(e),te(e,["config"])),setOptOut:ne(e.setOptOut.bind(e),"setOptOut",X(e),te(e,["config"])),setTransport:ne(e.setTransport.bind(e),"setTransport",X(e),te(e,["config"]))}},ct=at(),lt=ct.add,dt=ct.flush,ft=ct.getDeviceId,pt=ct.getSessionId,vt=ct.getUserId,ht=ct.groupIdentify,gt=ct.identify,yt=ct.init,mt=ct.logEvent,bt=ct.remove,It=ct.reset,_t=ct.revenue,wt=ct.setDeviceId,St=ct.setGroup,Et=ct.setOptOut,Tt=ct.setSessionId,Ot=ct.setTransport,kt=ct.setUserId,Pt=ct.track,Rt=Object.freeze({__proto__:null,add:lt,flush:dt,getDeviceId:ft,getSessionId:pt,getUserId:vt,groupIdentify:ht,identify:gt,init:yt,logEvent:mt,remove:bt,reset:It,revenue:_t,setDeviceId:wt,setGroup:St,setOptOut:Et,setSessionId:Tt,setTransport:Ot,setUserId:kt,track:Pt,Types:x,createInstance:at,runQueuedFunctions:we,Revenue:K,Identify:N});!function(){var e=v();if(e){var t=function(e){var t=at(),n=v();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Rt,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],we(Rt,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=[],we(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}(); | ||
!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=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},h=function(){var e,t=v();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),i=g(n[0]),r=g(n[1]);return r?(e[i]=r,e):e}),{}):{}},g=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},y="dclid",m="fbclid",b="gbraid",I="gclid",_="ko_click_id",w="li_fat_id",S="msclkid",E="rtd_cid",T="ttclid",O="twclid",k="wbraid",P={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},R=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({},P),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=h();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=h();return(e={})[y]=t[y],e[m]=t[m],e[b]=t[b],e[I]=t[I],e[_]=t[_],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},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(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.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"}(p||(p={}));var x=Object.freeze({__proto__:null,get SpecialEventType(){return d},get IdentifyOperation(){return c},get RevenueProperty(){return l},get LogLevel(){return f},get Status(){return p}}),U="AMP",q="".concat(U,"_unsent"),D="https://api2.amplitude.com/2/httpapi",L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!A(t,n))return!1}return!0},A=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&&L(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 L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},N=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return 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||A(t,n)))},e}(),j=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},C=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=p.Unknown),{event:e,code:t,message:n}},M=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,M)},V=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:M(),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){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.reset=function(e){this.applying=!1,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(),_={error:f},[3,8];case 7:try{d&&!d.done&&(w=l.return)&&w.call(l)}finally{if(_)throw _.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})),I=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return C(t,0,String(e))}))})),Promise.all(I).then((function(e){var t=u(e,1)[0];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}(),F="Event rejected due to exceeded retry count",Q=function(e){return{promise:e||Promise.resolve()}},$=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 V(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 Q(this.dispatch(r))},e.prototype.identify=function(e,t){var n=j(e,t);return Q(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 Q(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new N;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 Q(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 Q(this.dispatch(i))},e.prototype.add=function(e){return this.config?Q(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),Q())},e.prototype.remove=function(e){return this.config?Q(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),Q())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(C(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,C(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):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=C(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 Q(this.timeline.flush())},e}(),K=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 L(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;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.Verbose||console.log("".concat(B,"[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(B,"[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(B,"[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(B,"[Debug]: ").concat(e.join(" ")))},e}(),W=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,logLevel:f.Warn,loggerProvider:new z,optOut:!1,serverUrl:D,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.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}(),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":D},G=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)}},Y=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(q,"_").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,F),!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:if(null===(s=o.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t){if("body"in s){u="";try{u=JSON.stringify(s.body,null,2)}catch(e){}this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(u))}else this.fulfillRequest(e,s.statusCode,s.status);return[2]}return this.handleReponse(s,e),[3,4];case 3:return a=o.sent(),this.fulfillRequest(e,0,String(a)),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch(e.status){case p.Success:this.handleSuccessResponse(e,t);break;case p.Invalid:this.handleInvalidResponse(e,t);break;case p.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case p.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.handleOtherReponse(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)}));this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(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)}));this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherReponse=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(C(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}(),H=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},X=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ee=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},te=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]=ee(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}},ne=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:H(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}},ie=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}(),re=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,v,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 p.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 p.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!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case p.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case p.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 p.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?p.Success:429===e?p.RateLimit:413===e?p.PayloadTooLarge:408===e?p.Timeout:e>=400&&e<500?p.Invalid:e>=500?p.Failed:p.Unknown},e}(),oe=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[U,t,e.substring(0,n)].filter(Boolean).join("_")},se=function(){function e(e){this.options=n({},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(!v())return[2,!1];t=String(Date.now()),n=new e(this.options),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[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;return r(this,void 0,void 0,(function(){var n,i,r;return o(this,(function(o){return n=v(),i=null!==(t=null==n?void 0:n.document.cookie.split("; "))&&void 0!==t?t:[],(r=i.find((function(t){return 0===t.indexOf(e+"=")})))?[2,r.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=v())&&(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}(),ue=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}(re),ae=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ce(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ce=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},le=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}(),de=function(){return de=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},de.apply(this,arguments)},fe=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(!fe(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){fe(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!fe(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 pe=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=de({},this.identity.userProperties),n=de(de({},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 de({},this.identity)},e.prototype.setIdentity=function(e){var t=de({},this.identity);this.identity=de({},e),fe(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}(),ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,he=function(){function e(){this.identityStore=new pe,this.eventBridge=new le,this.applicationContextProvider=new ae}return e.getInstance=function(t){return ve.analyticsConnectorInstances||(ve.analyticsConnectorInstances={}),ve.analyticsConnectorInstances[t]||(ve.analyticsConnectorInstances[t]=new e),ve.analyticsConnectorInstances[t]},e}(),ge=function(){return he.getInstance("$default_instance")},ye=function(){function e(){this.name="identity",this.type="before",this.identityStore=ge().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 Promise.resolve(void 0)},e}(),me=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:""},be=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Ie=function(e){return be(e,"attribution")},_e=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,be(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}},we=function(e,t){Se(e,t)},Se=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},Ee=function(e){return e&&void 0!==e._q},Te=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.eventId=0,this.library="amplitude-ts/".concat("2.0.0-beta.4"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,this.eventId=this.config.lastEventId?this.config.lastEventId+1:0,Promise.resolve(void 0)},e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){return t=(new Date).getTime(),this.config.lastEventId=this.eventId,[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:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:me()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:M(),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:this.eventId++,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Oe=function(){function 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(!v())return[2,!1];t=String(Date.now()),n=new e,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(),[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=v())||void 0===t?void 0:t.localStorage.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=v())||void 0===n||n.localStorage.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=v())||void 0===t||t.localStorage.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=v())||void 0===e||e.localStorage.clear()}catch(e){}return[2]}))}))},e}(),ke=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}(re),Pe=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=v();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}(re),Re=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;return o(this,(function(o){switch(o.label){case 0:return i=function(e){return"".concat(U.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("."),5),a=s[0],c=s[1],l=s[2],d=s[3],f=s[4],[2,{deviceId:a,userId:Ue(c),sessionId:xe(d),lastEventTime:xe(f),optOut:Boolean(l)}]}}))}))},xe=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ue=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},qe="[Amplitude]",De="".concat(qe," Form Started"),Le="".concat(qe," Form Submitted"),Ae="".concat(qe," File Downloaded"),Ne="session_start",je="session_end",Ce="".concat(qe," File Extension"),Me="".concat(qe," File Name"),Ve="".concat(qe," Link ID"),Fe="".concat(qe," Link Text"),Qe="".concat(qe," Link URL"),$e="".concat(qe," Form ID"),Ke="".concat(qe," Form Name"),Be="".concat(qe," Form Destination"),ze="cookie",We=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){void 0===i&&(i=new ie),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===o&&(o=!0),void 0===u&&(u=1e3),void 0===a&&(a=5),void 0===c&&(c=30),void 0===l&&(l=ze),void 0===h&&(h=new z),void 0===g&&(g=f.Warn),void 0===m&&(m=!1),void 0===_&&(_=""),void 0===w&&(w="US"),void 0===E&&(E=18e5),void 0===T&&(T=new Oe),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===k&&(k="fetch"),void 0===P&&(P=!1);var x=e.call(this,{apiKey:t,storageProvider:T,transportProvider:Ge(k)})||this;return x.apiKey=t,x.appVersion=n,x.cookieOptions=r,x.defaultTracking=o,x.flushIntervalMillis=u,x.flushMaxRetries=a,x.flushQueueSize=c,x.identityStorage=l,x.ingestionMetadata=d,x.loggerProvider=h,x.logLevel=g,x.minIdLength=y,x.partnerId=b,x.plan=I,x.serverUrl=_,x.serverZone=w,x.sessionTimeout=E,x.storageProvider=T,x.trackingOptions=O,x.transport=k,x.useBatch=P,x._optOut=!1,x._cookieStorage=i,x.deviceId=s,x.lastEventId=p,x.lastEventTime=v,x.optOut=m,x.sessionId=S,x.userId=R,x.loggerProvider.enable(x.logLevel),x}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(oe(this.apiKey),e)},n}(J),Je=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,g,y,m,b,I,_,w,S,E,T,O,k,P,R,x,U,q,D,L,A,N,j,C,V;return o(this,(function(o){switch(o.label){case 0:return r=t.identityStorage||ze,u=[n({},t.cookieOptions)],w={},r===ze?[3,1]:(a="",[3,5]);case 1:return null===(E=null===(S=t.cookieOptions)||void 0===S?void 0:S.domain)||void 0===E?[3,2]:(c=E,[3,4]);case 2:return[4,Ye()];case 3:c=o.sent(),o.label=4;case 4:a=c,o.label=5;case 5:return s=n.apply(void 0,u.concat([(w.domain=a,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w)])),l=Ze(t.identityStorage,s),[4,Re(e,l,null===(O=null===(T=t.cookieOptions)||void 0===T?void 0:T.upgrade)||void 0===O||O)];case 6:return d=o.sent(),[4,l.get(oe(e))];case 7:return f=o.sent(),p=h(),v=null!==(x=null!==(R=null!==(P=null!==(k=t.deviceId)&&void 0!==k?k:p.deviceId)&&void 0!==P?P:null==f?void 0:f.deviceId)&&void 0!==R?R:d.deviceId)&&void 0!==x?x:M(),g=null==f?void 0:f.lastEventId,y=null!==(U=null==f?void 0:f.lastEventTime)&&void 0!==U?U:d.lastEventTime,m=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==f?void 0:f.optOut)&&void 0!==D?D:d.optOut,b=null!==(A=null!==(L=t.sessionId)&&void 0!==L?L:null==f?void 0:f.sessionId)&&void 0!==A?A:d.sessionId,I=null!==(j=null!==(N=t.userId)&&void 0!==N?N:null==f?void 0:f.userId)&&void 0!==j?j:d.userId,i.previousSessionDeviceId=null!==(C=null==f?void 0:f.deviceId)&&void 0!==C?C:d.deviceId,i.previousSessionUserId=null!==(V=null==f?void 0:f.userId)&&void 0!==V?V:d.userId,_=n(n({},t.trackingOptions),{ipAddress:!0,language:!0,platform:!0}),[2,new We(e,t.appVersion,l,s,t.defaultTracking,v,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,g,y,t.loggerProvider,t.logLevel,t.minIdLength,m,t.partnerId,t.plan,t.serverUrl,t.serverZone,b,t.sessionTimeout,t.storageProvider,_,t.transport,t.useBatch,I)]}}))}))},Ze=function(e,t){switch(void 0===e&&(e=ze),void 0===t&&(t={}),e){case"localStorage":return new Oe;case"none":return new ie;default:return new se(t)}},Ge=function(e){return"xhr"===e?new ke:"beacon"===e?new Pe:new ue},Ye=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 se).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 se({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,""]}}))}))},He=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Xe=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}))},et=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;return o(this,(function(o){switch(o.label){case 0:return r=n({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(m=null===(a=t.cookieOptions)||void 0===a?void 0:a.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."),c=t.cookieStorage,h=t.apiKey,void 0===(g="MKTG")&&(g=""),void 0===y&&(y=10),l=[U,g,h.substring(0,y)].filter(Boolean).join("_"),[4,Promise.all([(new R).parse(),c.get(l)])];case 1:return d=u.apply(void 0,[o.sent(),2]),f=d[0],p=d[1],function(e,t,n){e.referrer;var r=e.referring_domain,o=i(e,["referrer","referring_domain"]),s=t||{};s.referrer;var u=s.referring_domain,a=i(s,["referrer","referring_domain"]);if(Xe(n.excludeReferrers,e.referring_domain))return!1;var c=JSON.stringify(o)!==JSON.stringify(a),l=He(r||"")!==He(u||"");return!t||c||l}(f,p,r)&&(r.resetSessionOnNewCampaign&&(s.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({},P),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 N);return j(r)}(f,r),s.track(v),c.set(l,f)),[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 s},tt=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},nt=function(e){var t;void 0===e&&(e={});var i=v(),s=void 0,a=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,it()];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)]}}))}))},c=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},l="undefined"!=typeof location?location.href:null,d=function(){return r(void 0,void 0,void 0,(function(){var n,i,r;return o(this,(function(o){switch(o.label){case 0:return n=location.href,ot(e.trackHistoryChanges,n,l||"")&&c()?(null==s||s.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return r=(i=t).track,[4,a()];case 2:r.apply(i,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return l=n,[2]}}))}))},f={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,n){return r(void 0,void 0,void 0,(function(){var r,l;return o(this,(function(o){switch(o.label){case 0:return t=n,(s=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),i&&(i.addEventListener("popstate",(function(){d()})),i.history.pushState=new Proxy(i.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]),d()}})),c()?(s.log("Tracking page view event"),l=(r=t).track,[4,a()]):[3,2];case 1:l.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&&rt(t)?(null==s||s.log("Enriching campaign event to page view event with campaign parameters"),[4,a()]):[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]}}))}))}};return f},it=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=tt,[4,(new R).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},rt=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(P).every((function(e){return r.includes(e)}))}return!1},ot=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},st=function(){var e,t;return{name:"@amplitude/plugin-session-handler",type:"before",setup:function(n,i){return r(void 0,void 0,void 0,(function(){return o(this,(function(r){return e=n,t=i,[2]}))}))},execute:function(n){return r(void 0,void 0,void 0,(function(){var i,r;return o(this,(function(o){return i=Date.now(),n.event_type===Ne||n.event_type===je?(e.lastEventTime=i,[2,n]):(r=e.lastEventTime||i,i-r>e.sessionTimeout&&(t.setSessionId(i),n.session_id=t.getSessionId(),n.time=i),e.lastEventTime=i,[2,n])}))}))}}},ut=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.init=function(e,t,i){return void 0===e&&(e=""),Q(this._init(n(n({},i),{userId:t,apiKey:e})))},i.prototype._init=function(t){return r(this,void 0,void 0,(function(){var i,s,u,a,c=this;return o(this,(function(l){switch(l.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Je(t.apiKey,t,this)]);case 1:return i=l.sent(),[4,e.prototype._init.call(this,i)];case 2:return l.sent(),(!this.config.sessionId||this.config.lastEventTime&&Date.now()-this.config.lastEventTime>this.config.sessionTimeout)&&this.setSessionId(Date.now()),(s=ge()).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new Y).promise];case 3:return l.sent(),[4,this.add(new Te).promise];case 4:return l.sent(),[4,this.add(st()).promise];case 5:return l.sent(),[4,this.add(new ye).promise];case 6:return l.sent(),f=this.config.defaultTracking,be(f,"fileDownloads")?[4,this.add({name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(e,t){return r(void 0,void 0,void 0,(function(){var n,i;return o(this,(function(r){return t?(n=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=i.exec(n.href),o=null==r?void 0:r[1];o&&e.addEventListener("click",(function(){var i;o&&t.track(Ae,((i={})[Ce]=o,i[Me]=n.pathname,i[Ve]=e.id,i[Fe]=e.text,i[Qe]=e.href,i))}))},i=/\.(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(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.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]}))}))}}).promise]:[3,8];case 7:l.sent(),l.label=8;case 8:return function(e){return be(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add({name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(i){return t?(n=function(e){var n=!1;e.addEventListener("change",(function(){var i;n||t.track(De,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),n=!0}),{}),e.addEventListener("submit",(function(){var i,r;n||t.track(De,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),t.track(Le,((r={})[$e]=e.id,r[Ke]=e.name,r[Be]=e.action,r)),n=!1}))},Array.from(document.getElementsByTagName("form")).forEach(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.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]}))}))}}).promise]:[3,10];case 9:l.sent(),l.label=10;case 10:return Ie(this.config.defaultTracking)?(d=this.config,u=Ie(d.defaultTracking)&&d.defaultTracking&&"object"==typeof d.defaultTracking&&d.defaultTracking.attribution&&"object"==typeof d.defaultTracking.attribution?n({},d.defaultTracking.attribution):{},a=et(u),[4,this.add(a).promise]):[3,12];case 11:l.sent(),l.label=12;case 12:return[4,this.add(nt(_e(this.config))).promise];case 13:return l.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 14:return l.sent(),s.eventBridge.setEventReceiver((function(e){c.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,this.setSessionId(Date.now()),function(e){ge().identityStore.editIdentity().setUserId(e).commit()}(e)):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){ge().identityStore.editIdentity().setDeviceId(e).commit()}(e)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(M()),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){if(this.config){var t,n=this.getSessionId(),i=this.config.lastEventTime;if(this.config.sessionId=e,this.config.lastEventTime=void 0,t=this.config.defaultTracking,be(t,"sessions")){if(n&&i){var r={session_id:n,time:i+1};r.device_id=this.previousSessionDeviceId,r.user_id=this.previousSessionUserId,this.track(je,void 0,r)}this.track(Ne,void 0,{session_id:e,time:e-1}),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ge(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new N,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(Ee(i)){var o=i._q;i._q=[],i=Se(new N,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new K,i)}return e.prototype.revenue.call(this,t,n)},i}($),at=function(){var e=new ut;return{init:ne(e.init.bind(e),"init",X(e),te(e,["config"])),add:ne(e.add.bind(e),"add",X(e),te(e,["config.apiKey","timeline.plugins"])),remove:ne(e.remove.bind(e),"remove",X(e),te(e,["config.apiKey","timeline.plugins"])),track:ne(e.track.bind(e),"track",X(e),te(e,["config.apiKey","timeline.queue.length"])),logEvent:ne(e.logEvent.bind(e),"logEvent",X(e),te(e,["config.apiKey","timeline.queue.length"])),identify:ne(e.identify.bind(e),"identify",X(e),te(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ne(e.groupIdentify.bind(e),"groupIdentify",X(e),te(e,["config.apiKey","timeline.queue.length"])),setGroup:ne(e.setGroup.bind(e),"setGroup",X(e),te(e,["config.apiKey","timeline.queue.length"])),revenue:ne(e.revenue.bind(e),"revenue",X(e),te(e,["config.apiKey","timeline.queue.length"])),flush:ne(e.flush.bind(e),"flush",X(e),te(e,["config.apiKey","timeline.queue.length"])),getUserId:ne(e.getUserId.bind(e),"getUserId",X(e),te(e,["config","config.userId"])),setUserId:ne(e.setUserId.bind(e),"setUserId",X(e),te(e,["config","config.userId"])),getDeviceId:ne(e.getDeviceId.bind(e),"getDeviceId",X(e),te(e,["config","config.deviceId"])),setDeviceId:ne(e.setDeviceId.bind(e),"setDeviceId",X(e),te(e,["config","config.deviceId"])),reset:ne(e.reset.bind(e),"reset",X(e),te(e,["config","config.userId","config.deviceId"])),getSessionId:ne(e.getSessionId.bind(e),"getSessionId",X(e),te(e,["config"])),setSessionId:ne(e.setSessionId.bind(e),"setSessionId",X(e),te(e,["config"])),setOptOut:ne(e.setOptOut.bind(e),"setOptOut",X(e),te(e,["config"])),setTransport:ne(e.setTransport.bind(e),"setTransport",X(e),te(e,["config"]))}},ct=at(),lt=ct.add,dt=ct.flush,ft=ct.getDeviceId,pt=ct.getSessionId,vt=ct.getUserId,ht=ct.groupIdentify,gt=ct.identify,yt=ct.init,mt=ct.logEvent,bt=ct.remove,It=ct.reset,_t=ct.revenue,wt=ct.setDeviceId,St=ct.setGroup,Et=ct.setOptOut,Tt=ct.setSessionId,Ot=ct.setTransport,kt=ct.setUserId,Pt=ct.track,Rt=Object.freeze({__proto__:null,add:lt,flush:dt,getDeviceId:ft,getSessionId:pt,getUserId:vt,groupIdentify:ht,identify:gt,init:yt,logEvent:mt,remove:bt,reset:It,revenue:_t,setDeviceId:wt,setGroup:St,setOptOut:Et,setSessionId:Tt,setTransport:Ot,setUserId:kt,track:Pt,Types:x,createInstance:at,runQueuedFunctions:we,Revenue:K,Identify:N});!function(){var e=v();if(e){var t=function(e){var t=at(),n=v();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Rt,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],we(Rt,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=[],we(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}(); |
@@ -1,1 +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,r,o,s,u,a=function(){return a=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},a.apply(this,arguments)};function c(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 l(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 d(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 f(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 p(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 v(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))}!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"}(i||(i={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(o||(o={})),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"}(s||(s={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(u||(u={}));var h=Object.freeze({__proto__:null,get SpecialEventType(){return o},get IdentifyOperation(){return i},get RevenueProperty(){return r},get LogLevel(){return s},get Status(){return u}}),g="AMP",y="".concat(g,"_unsent"),m="https://api2.amplitude.com/2/httpapi",b=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!I(t,n))return!1}return!0},I=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=f(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)r=r&&b(u);else if(!["number","string"].includes(typeof u))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 b(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},_=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return a({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(i.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(i.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(i.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(i.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(i.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(i.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(i.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(i.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(i.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[i.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[i.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===i.ADD?"number"==typeof n:e===i.UNSET||e===i.REMOVE||I(t,n)))},e}(),w=function(e,t){return a(a({},t),{event_type:o.IDENTIFY,user_properties:e.getUserProperties()})},S=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=u.Unknown),{event:e,code:t,message:n}},E=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,E)},T=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 l(this,void 0,void 0,(function(){return d(this,(function(o){switch(o.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:E(),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){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.reset=function(e){this.applying=!1,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 l(this,void 0,void 0,(function(){var t,n,i,r,o,s,u,c,l,v,h,g,y,m,b,I,_,w,E,T;return d(this,(function(d){switch(d.label){case 0:if(!e)return[2];t=p(e,1),n=t[0],i=p(e,2),r=i[1],o=this.plugins.filter((function(e){return"before"===e.type})),d.label=1;case 1:d.trys.push([1,6,7,8]),s=f(o),u=s.next(),d.label=2;case 2:return u.done?[3,5]:(g=u.value).execute?[4,g.execute(a({},n))]:[3,4];case 3:if(null===(y=d.sent()))return r({event:n,code:0,message:""}),[2];n=y,d.label=4;case 4:return u=s.next(),[3,2];case 5:return[3,8];case 6:return c=d.sent(),_={error:c},[3,8];case 7:try{u&&!u.done&&(w=s.return)&&w.call(s)}finally{if(_)throw _.error}return[7];case 8:l=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),d.label=9;case 9:d.trys.push([9,14,15,16]),v=f(l),h=v.next(),d.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(a({},n))]:[3,12];case 11:if(null===(y=d.sent()))return r({event:n,code:0,message:""}),[2];n=y,d.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=d.sent(),E={error:m},[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 b=this.plugins.filter((function(e){return"destination"===e.type})),I=b.map((function(e){var t=a({},n);return e.execute(t).catch((function(e){return S(t,0,String(e))}))})),Promise.all(I).then((function(e){var t=p(e,1)[0];r(t)})),[2]}}))}))},e.prototype.flush=function(){return l(this,void 0,void 0,(function(){var e,t,n,i=this;return d(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}(),O="Event rejected due to exceeded retry count",k=function(e){return{promise:e||Promise.resolve()}},P=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 T(this),this.name=e}return e.prototype._init=function(e){return l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){var t,n,i,r,o,s;return d(this,(function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,6,7,8]),n=f(t),i=n.next(),u.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=u.sent(),o={error:r},[3,8];case 7:try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,n){var i=function(e,t,n){return a(a(a({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return k(this.dispatch(i))},e.prototype.identify=function(e,t){var n=w(e,t);return k(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var r=function(e,t,n,i){var r;return a(a({},i),{event_type:o.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n,i);return k(this.dispatch(r))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,r=new _;return r.set(e,t),a(a({},n),{event_type:o.IDENTIFY,user_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return k(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return a(a({},t),{event_type:o.REVENUE,event_properties:e.getEventProperties()})}(e,t);return k(this.dispatch(n))},e.prototype.add=function(e){return this.config?k(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),k())},e.prototype.remove=function(e){return this.config?k(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),k())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(S(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return l(this,void 0,void 0,(function(){var t=this;return d(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 l(this,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,S(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):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=S(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 k(this.timeline.flush())},e}(),R=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 b(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?a({},this.properties):{};return e[r.REVENUE_PRODUCT_ID]=this.productId,e[r.REVENUE_QUANTITY]=this.quantity,e[r.REVENUE_PRICE]=this.price,e[r.REVENUE_TYPE]=this.revenueType,e[r.REVENUE]=this.revenue,e},e}(),x="Amplitude Logger ",U=function(){function e(){this.logLevel=s.None}return e.prototype.disable=function(){this.logLevel=s.None},e.prototype.enable=function(e){void 0===e&&(e=s.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Verbose||console.log("".concat(x,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Warn||console.warn("".concat(x,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Error||console.error("".concat(x,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Debug||console.log("".concat(x,"[Debug]: ").concat(e.join(" ")))},e}(),D=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,logLevel:s.Warn,loggerProvider:new U,optOut:!1,serverUrl:m,serverZone:"US",useBatch:!1}},q=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=D();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.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=N(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":m},N=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=D().serverZone),void 0===n&&(n=D().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:D().serverZone;return{serverZone:i,serverUrl:L(i,n)}},A=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 l(this,void 0,void 0,(function(){var n,i=this;return d(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(y,"_").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,O),!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),l(this,void 0,void 0,(function(){var t,n,i,r=this;return d(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),l(this,void 0,void 0,(function(){var n,i,r,o,s;return d(this,(function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,c(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},u.label=1;case 1:return u.trys.push([1,3,,4]),i=N(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:if(null===(r=u.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t){if("body"in r){o="";try{o=JSON.stringify(r.body,null,2)}catch(e){}this.fulfillRequest(e,r.statusCode,"".concat(r.status,": ").concat(o))}else this.fulfillRequest(e,r.statusCode,r.status);return[2]}return this.handleReponse(r,e),[3,4];case 3:return s=u.sent(),this.fulfillRequest(e,0,String(s)),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch(e.status){case u.Success:this.handleSuccessResponse(e,t);break;case u.Invalid:this.handleInvalidResponse(e,t);break;case u.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case u.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.handleOtherReponse(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=v(v(v(v([],p(Object.values(e.body.eventsWithInvalidFields)),!1),p(Object.values(e.body.eventsWithMissingFields)),!1),p(Object.values(e.body.eventsWithInvalidIdLengths)),!1),p(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)}));this.addToQueue.apply(this,v([],p(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.flushQueueSize/=2,this.addToQueue.apply(this,v([],p(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),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)}));this.addToQueue.apply(this,v([],p(c),!1))},e.prototype.handleOtherReponse=function(e){var t=this;this.addToQueue.apply(this,v([],p(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(S(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}(),j=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},C=function(e){return function(){var t=a({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},M=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=f(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},V=function(e,t){return function(){var n,i,r={};try{for(var o=f(t),s=o.next();!s.done;s=o.next()){var u=s.value;r[u]=M(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},F=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];var a=n(),c=a.logger,l=a.logLevel;if(l&&l<s.Debug||!l||!c)return e.apply(r,o);var d={type:"invoke public method",name:t,args:o,stacktrace:j(1),time:{start:(new Date).toISOString()},states:{}};i&&d.states&&(d.states.before=i());var f=e.apply(r,o);return f&&f.promise?f.promise.then((function(){i&&d.states&&(d.states.after=i()),d.time&&(d.time.end=(new Date).toISOString()),c.debug(JSON.stringify(d,null,2))})):(i&&d.states&&(d.states.after=i()),d.time&&(d.time.end=(new Date).toISOString()),c.debug(JSON.stringify(d,null,2))),f}},Q=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,(function(){return d(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return l(this,void 0,void 0,(function(){var t;return d(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 l(this,void 0,void 0,(function(){return d(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return l(this,void 0,void 0,(function(){return d(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),$=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,a,c,l,d,f,p,v,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 u.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 u.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!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case u.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case u.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 u.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?u.Success:429===e?u.RateLimit:413===e?u.PayloadTooLarge:408===e?u.Timeout:e>=400&&e<500?u.Invalid:e>=500?u.Failed:u.Unknown},e}(),K=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},B=function(){var e,t=K();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=z(n[0]),r=z(n[1]);return r?(e[i]=r,e):e}),{}):{}},z=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},W="dclid",J="fbclid",Z="gbraid",Y="gclid",G="ko_click_id",H="li_fat_id",X="msclkid",ee="rtd_cid",te="ttclid",ne="twclid",ie="wbraid",re={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},oe=function(){function e(){}return e.prototype.parse=function(){return l(this,void 0,void 0,(function(){return d(this,(function(e){return[2,a(a(a(a({},re),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=B();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=B();return(e={})[W]=t[W],e[J]=t[J],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},e}(),se=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[g,t,e.substring(0,n)].filter(Boolean).join("_")},ue=function(){function e(e){this.options=a({},e)}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:if(!K())return[2,!1];t=String(Date.now()),n=new e(this.options),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 l(this,void 0,void 0,(function(){var t;return d(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;return l(this,void 0,void 0,(function(){var n,i,r;return d(this,(function(o){return n=K(),i=null!==(t=null==n?void 0:n.document.cookie.split("; "))&&void 0!==t?t:[],(r=i.find((function(t){return 0===t.indexOf(e+"=")})))?[2,r.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return l(this,void 0,void 0,(function(){var i,r,o,s,u,a;return d(this,(function(c){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((s=new Date).setTime(s.getTime()+24*r*60*60*1e3),o=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(a=K())&&(a.document.cookie=u)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){return d(this,(function(e){return[2]}))}))},e}(),ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,(function(){var n,i;return d(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}($),ce=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:le(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),le=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},de=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}(),fe=function(){return fe=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},fe.apply(this,arguments)},pe=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(!pe(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){pe(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!pe(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 ve=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=fe({},this.identity.userProperties),n=fe(fe({},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 fe({},this.identity)},e.prototype.setIdentity=function(e){var t=fe({},this.identity);this.identity=fe({},e),pe(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}(),he="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,ge=function(){function e(){this.identityStore=new ve,this.eventBridge=new de,this.applicationContextProvider=new ce}return e.getInstance=function(t){return he.analyticsConnectorInstances||(he.analyticsConnectorInstances={}),he.analyticsConnectorInstances[t]||(he.analyticsConnectorInstances[t]=new e),he.analyticsConnectorInstances[t]},e}(),ye=function(){return ge.getInstance("$default_instance")},me=function(){function e(){this.name="identity",this.type="before",this.identityStore=ye().identityStore}return e.prototype.execute=function(e){return l(this,void 0,void 0,(function(){var t;return d(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return Promise.resolve(void 0)},e}(),be=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:""},Ie=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},_e=function(e){return Ie(e,"attribution")},we=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,Ie(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}},Se=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},Ee=function(e){return e&&void 0!==e._q},Te=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.eventId=0,this.library="amplitude-ts/".concat("2.0.0-beta.3"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,this.eventId=this.config.lastEventId?this.config.lastEventId+1:0,Promise.resolve(void 0)},e.prototype.execute=function(e){return l(this,void 0,void 0,(function(){var t;return d(this,(function(n){return t=(new Date).getTime(),this.config.lastEventId=this.eventId,[2,a(a(a(a(a(a(a(a({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:be()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:E(),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:this.eventId++,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Oe=function(){function e(){}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:if(!K())return[2,!1];t=String(Date.now()),n=new e,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 l(this,void 0,void 0,(function(){var t;return d(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(),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return l(this,void 0,void 0,(function(){return d(this,(function(n){return[2,(null===(t=K())||void 0===t?void 0:t.localStorage.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return l(this,void 0,void 0,(function(){return d(this,(function(i){try{null===(n=K())||void 0===n||n.localStorage.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return l(this,void 0,void 0,(function(){return d(this,(function(n){try{null===(t=K())||void 0===t||t.localStorage.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return l(this,void 0,void 0,(function(){return d(this,(function(t){try{null===(e=K())||void 0===e||e.localStorage.clear()}catch(e){}return[2]}))}))},e}(),ke=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 l(this,void 0,void 0,(function(){var n=this;return d(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}($),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,(function(){var n=this;return d(this,(function(i){return[2,new Promise((function(i,r){var o=K();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}($),Re=function(e,t,n){return void 0===n&&(n=!0),l(void 0,void 0,void 0,(function(){var i,r,o,s,u,a,c,l;return d(this,(function(d){switch(d.label){case 0:return i=function(e){return"".concat(g.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=d.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:d.sent(),d.label=3;case 3:return o=p(r.split("."),5),s=o[0],u=o[1],a=o[2],c=o[3],l=o[4],[2,{deviceId:s,userId:Ue(u),sessionId:xe(c),lastEventTime:xe(l),optOut:Boolean(a)}]}}))}))},xe=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ue=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},De="[Amplitude]",qe="".concat(De," Form Started"),Le="".concat(De," Form Submitted"),Ne="".concat(De," File Downloaded"),Ae="session_start",je="session_end",Ce="".concat(De," File Extension"),Me="".concat(De," File Name"),Ve="".concat(De," Link ID"),Fe="".concat(De," Link Text"),Qe="".concat(De," Link URL"),$e="".concat(De," Form ID"),Ke="".concat(De," Form Name"),Be="".concat(De," Form Destination"),ze="cookie",We=function(e){function t(t,n,i,r,o,u,a,c,l,d,f,p,v,h,g,y,m,b,I,_,w,S,E,T,O,k,P,R){void 0===i&&(i=new Q),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===o&&(o=!0),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=ze),void 0===h&&(h=new U),void 0===g&&(g=s.Warn),void 0===m&&(m=!1),void 0===_&&(_=""),void 0===w&&(w="US"),void 0===E&&(E=18e5),void 0===T&&(T=new Oe),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===k&&(k="fetch"),void 0===P&&(P=!1);var x=e.call(this,{apiKey:t,storageProvider:T,transportProvider:Ye(k)})||this;return x.apiKey=t,x.appVersion=n,x.cookieOptions=r,x.defaultTracking=o,x.flushIntervalMillis=a,x.flushMaxRetries=c,x.flushQueueSize=l,x.identityStorage=d,x.ingestionMetadata=f,x.loggerProvider=h,x.logLevel=g,x.minIdLength=y,x.partnerId=b,x.plan=I,x.serverUrl=_,x.serverZone=w,x.sessionTimeout=E,x.storageProvider=T,x.trackingOptions=O,x.transport=k,x.useBatch=P,x._optOut=!1,x._cookieStorage=i,x.deviceId=u,x.lastEventId=p,x.lastEventTime=v,x.optOut=m,x.sessionId=S,x.userId=R,x.loggerProvider.enable(x.logLevel),x}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(se(this.apiKey),e)},t}(q),Je=function(e,t,n){return void 0===t&&(t={}),l(void 0,void 0,void 0,(function(){var i,r,o,s,u,c,l,f,p,v,h,g,y,m,b,I,_,w,S,T,O,k,P,R,x,U,D,q,L,N,A,j,C,M;return d(this,(function(d){switch(d.label){case 0:return i=t.identityStorage||ze,o=[a({},t.cookieOptions)],_={},i===ze?[3,1]:(s="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(u=S,[3,4]);case 2:return[4,Ge()];case 3:u=d.sent(),d.label=4;case 4:s=u,d.label=5;case 5:return r=a.apply(void 0,o.concat([(_.domain=s,_.expiration=365,_.sameSite="Lax",_.secure=!1,_.upgrade=!0,_)])),c=Ze(t.identityStorage,r),[4,Re(e,c,null===(O=null===(T=t.cookieOptions)||void 0===T?void 0:T.upgrade)||void 0===O||O)];case 6:return l=d.sent(),[4,c.get(se(e))];case 7:return f=d.sent(),p=B(),v=null!==(x=null!==(R=null!==(P=null!==(k=t.deviceId)&&void 0!==k?k:p.deviceId)&&void 0!==P?P:null==f?void 0:f.deviceId)&&void 0!==R?R:l.deviceId)&&void 0!==x?x:E(),h=null==f?void 0:f.lastEventId,g=null!==(U=null==f?void 0:f.lastEventTime)&&void 0!==U?U:l.lastEventTime,y=null!==(q=null!==(D=t.optOut)&&void 0!==D?D:null==f?void 0:f.optOut)&&void 0!==q?q:l.optOut,m=null!==(N=null!==(L=t.sessionId)&&void 0!==L?L:null==f?void 0:f.sessionId)&&void 0!==N?N:l.sessionId,b=null!==(j=null!==(A=t.userId)&&void 0!==A?A:null==f?void 0:f.userId)&&void 0!==j?j:l.userId,n.previousSessionDeviceId=null!==(C=null==f?void 0:f.deviceId)&&void 0!==C?C:l.deviceId,n.previousSessionUserId=null!==(M=null==f?void 0:f.userId)&&void 0!==M?M:l.userId,I=a(a({},t.trackingOptions),{ipAddress:!0,language:!0,platform:!0}),[2,new We(e,t.appVersion,c,r,t.defaultTracking,v,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,h,g,t.loggerProvider,t.logLevel,t.minIdLength,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,I,t.transport,t.useBatch,b)]}}))}))},Ze=function(e,t){switch(void 0===e&&(e=ze),void 0===t&&(t={}),e){case"localStorage":return new Oe;case"none":return new Q;default:return new ue(t)}},Ye=function(e){return"xhr"===e?new ke:"beacon"===e?new Pe:new ae},Ge=function(e){return l(void 0,void 0,void 0,(function(){var t,n,i,r,o,s,u;return d(this,(function(a){switch(a.label){case 0:return[4,(new ue).isEnabled()];case 1:if(!a.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,a.label=2;case 2:return o<i.length?(s=i[o],[4,(u=new ue({domain:"."+s})).set(r,1)]):[3,7];case 3:return a.sent(),[4,u.get(r)];case 4:return a.sent()?[4,u.remove(r)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},He=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Xe=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}))},et=function(e){var t=this;void 0===e&&(e={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,n){var i;return l(this,void 0,void 0,(function(){var r,o,s,u,l,f,v;return d(this,(function(d){switch(d.label){case 0:return r=a({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(b=null===(i=t.cookieOptions)||void 0===i?void 0:i.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."),o=t.cookieStorage,h=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),s=[g,y,h.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new oe).parse(),o.get(s)])];case 1:return u=p.apply(void 0,[d.sent(),2]),l=u[0],f=u[1],function(e,t,n){e.referrer;var i=e.referring_domain,r=c(e,["referrer","referring_domain"]),o=t||{};o.referrer;var s=o.referring_domain,u=c(o,["referrer","referring_domain"]);if(Xe(n.excludeReferrers,e.referring_domain))return!1;var a=JSON.stringify(r)!==JSON.stringify(u),l=He(i||"")!==He(s||"");return!t||a||l}(l,f,r)&&(r.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=a(a({},re),e),i=Object.entries(n).reduce((function(e,n){var i,r=p(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 _);return w(i)}(l,r),n.track(v),o.set(s,l)),[2]}var h,y,m,b,I}))}))},execute:function(e){return l(t,void 0,void 0,(function(){return d(this,(function(t){return[2,e]}))}))}};return n},tt=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},nt=function(e){var t;void 0===e&&(e={});var n=K(),i=void 0,r=function(){return l(void 0,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:return n={event_type:null!==(i=e.eventType)&&void 0!==i?i:"[Amplitude] Page Viewed"},t=[{}],[4,it()];case 1:return[2,(n.event_properties=a.apply(void 0,[a.apply(void 0,t.concat([r.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)]}}))}))},o=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},s="undefined"!=typeof location?location.href:null,u=function(){return l(void 0,void 0,void 0,(function(){var n,u,a;return d(this,(function(c){switch(c.label){case 0:return n=location.href,ot(e.trackHistoryChanges,n,s||"")&&o()?(null==i||i.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return a=(u=t).track,[4,r()];case 2:a.apply(u,[c.sent()]),c.label=3;case 3:c.label=4;case 4:return s=n,[2]}}))}))},c={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return l(void 0,void 0,void 0,(function(){var a,c;return d(this,(function(l){switch(l.label){case 0:return t=s,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",(function(){u()})),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,n){var i=p(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),u()}})),o()?(i.log("Tracking page view event"),c=(a=t).track,[4,r()]):[3,2];case 1:c.apply(a,[l.sent()]),l.label=2;case 2:return[2]}}))}))},execute:function(t){return l(void 0,void 0,void 0,(function(){var n;return d(this,(function(o){switch(o.label){case 0:return"attribution"===e.trackOn&&rt(t)?(null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,r()]):[3,2];case 1:n=o.sent(),t.event_type=n.event_type,t.event_properties=a(a({},t.event_properties),n.event_properties),o.label=2;case 2:return[2,t]}}))}))}};return c},it=function(){return l(void 0,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return e=tt,[4,(new oe).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},rt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[i.SET]||{},r=t[i.UNSET]||{},o=v(v([],p(Object.keys(n)),!1),p(Object.keys(r)),!1);return Object.keys(re).every((function(e){return o.includes(e)}))}return!1},ot=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},st=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){return void 0===e&&(e=""),k(this._init(a(a({},n),{userId:t,apiKey:e})))},t.prototype._init=function(t){return l(this,void 0,void 0,(function(){var n,i,r,o,s=this;return d(this,(function(u){switch(u.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Je(t.apiKey,t,this)]);case 1:return n=u.sent(),[4,e.prototype._init.call(this,n)];case 2:return u.sent(),(!this.config.sessionId||this.config.lastEventTime&&Date.now()-this.config.lastEventTime>this.config.sessionTimeout)&&this.setSessionId(Date.now()),(i=ye()).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new A).promise];case 3:return u.sent(),[4,this.add(new Te).promise];case 4:return u.sent(),[4,this.add({name:"@amplitude/plugin-session-handler",type:"before",setup:function(e,t){return l(void 0,void 0,void 0,(function(){return d(this,(function(n){return p=e,v=t,[2]}))}))},execute:function(e){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(i){return t=Date.now(),e.event_type===Ae||e.event_type===je?(p.lastEventTime=t,[2,e]):(n=p.lastEventTime||t,t-n>p.sessionTimeout&&(v.setSessionId(t),e.session_id=v.getSessionId(),e.time=t),p.lastEventTime=t,[2,e])}))}))}}).promise];case 5:return u.sent(),[4,this.add(new me).promise];case 6:return u.sent(),f=this.config.defaultTracking,Ie(f,"fileDownloads")?[4,this.add({name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,(function(){var n,i;return d(this,(function(r){return t?(n=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=i.exec(n.href),o=null==r?void 0:r[1];o&&e.addEventListener("click",(function(){var i;o&&t.track(Ne,((i={})[Ce]=o,i[Me]=n.pathname,i[Ve]=e.id,i[Fe]=e.text,i[Qe]=e.href,i))}))},i=/\.(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(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return l(void 0,void 0,void 0,(function(){return d(this,(function(t){return[2,e]}))}))}}).promise]:[3,8];case 7:u.sent(),u.label=8;case 8:return function(e){return Ie(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add({name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,(function(){var n;return d(this,(function(i){return t?(n=function(e){var n=!1;e.addEventListener("change",(function(){var i;n||t.track(qe,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),n=!0}),{}),e.addEventListener("submit",(function(){var i,r;n||t.track(qe,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),t.track(Le,((r={})[$e]=e.id,r[Ke]=e.name,r[Be]=e.action,r)),n=!1}))},Array.from(document.getElementsByTagName("form")).forEach(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return l(void 0,void 0,void 0,(function(){return d(this,(function(t){return[2,e]}))}))}}).promise]:[3,10];case 9:u.sent(),u.label=10;case 10:return _e(this.config.defaultTracking)?(c=this.config,r=_e(c.defaultTracking)&&c.defaultTracking&&"object"==typeof c.defaultTracking&&c.defaultTracking.attribution&&"object"==typeof c.defaultTracking.attribution?a({},c.defaultTracking.attribution):{},o=et(r),[4,this.add(o).promise]):[3,12];case 11:u.sent(),u.label=12;case 12:return[4,this.add(nt(we(this.config))).promise];case 13:return u.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 14:return u.sent(),i.eventBridge.setEventReceiver((function(e){s.track(e.eventType,e.eventProperties)})),[2]}var c,f,p,v}))}))},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,this.setSessionId(Date.now()),function(e){ye().identityStore.editIdentity().setUserId(e).commit()}(e)):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){ye().identityStore.editIdentity().setDeviceId(e).commit()}(e)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(E()),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){if(this.config){var t,n=this.getSessionId(),i=this.config.lastEventTime;if(this.config.sessionId=e,this.config.lastEventTime=void 0,t=this.config.defaultTracking,Ie(t,"sessions")){if(n&&i){var r={session_id:n,time:i+1};r.device_id=this.previousSessionDeviceId,r.user_id=this.previousSessionUserId,this.track(je,void 0,r)}this.track(Ae,void 0,{session_id:e,time:e-1}),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ye(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new _,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(Ee(i)){var o=i._q;i._q=[],i=Se(new _,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new R,i)}return e.prototype.revenue.call(this,t,n)},t}(P),ut=function(){var e=new st;return{init:F(e.init.bind(e),"init",C(e),V(e,["config"])),add:F(e.add.bind(e),"add",C(e),V(e,["config.apiKey","timeline.plugins"])),remove:F(e.remove.bind(e),"remove",C(e),V(e,["config.apiKey","timeline.plugins"])),track:F(e.track.bind(e),"track",C(e),V(e,["config.apiKey","timeline.queue.length"])),logEvent:F(e.logEvent.bind(e),"logEvent",C(e),V(e,["config.apiKey","timeline.queue.length"])),identify:F(e.identify.bind(e),"identify",C(e),V(e,["config.apiKey","timeline.queue.length"])),groupIdentify:F(e.groupIdentify.bind(e),"groupIdentify",C(e),V(e,["config.apiKey","timeline.queue.length"])),setGroup:F(e.setGroup.bind(e),"setGroup",C(e),V(e,["config.apiKey","timeline.queue.length"])),revenue:F(e.revenue.bind(e),"revenue",C(e),V(e,["config.apiKey","timeline.queue.length"])),flush:F(e.flush.bind(e),"flush",C(e),V(e,["config.apiKey","timeline.queue.length"])),getUserId:F(e.getUserId.bind(e),"getUserId",C(e),V(e,["config","config.userId"])),setUserId:F(e.setUserId.bind(e),"setUserId",C(e),V(e,["config","config.userId"])),getDeviceId:F(e.getDeviceId.bind(e),"getDeviceId",C(e),V(e,["config","config.deviceId"])),setDeviceId:F(e.setDeviceId.bind(e),"setDeviceId",C(e),V(e,["config","config.deviceId"])),reset:F(e.reset.bind(e),"reset",C(e),V(e,["config","config.userId","config.deviceId"])),getSessionId:F(e.getSessionId.bind(e),"getSessionId",C(e),V(e,["config"])),setSessionId:F(e.setSessionId.bind(e),"setSessionId",C(e),V(e,["config"])),setOptOut:F(e.setOptOut.bind(e),"setOptOut",C(e),V(e,["config"])),setTransport:F(e.setTransport.bind(e),"setTransport",C(e),V(e,["config"]))}},at=ut(),ct=at.add,lt=at.flush,dt=at.getDeviceId,ft=at.getSessionId,pt=at.getUserId,vt=at.groupIdentify,ht=at.identify,gt=at.init,yt=at.logEvent,mt=at.remove,bt=at.reset,It=at.revenue,_t=at.setDeviceId,wt=at.setGroup,St=at.setOptOut,Et=at.setSessionId,Tt=at.setTransport,Ot=at.setUserId,kt=at.track;e.Identify=_,e.Revenue=R,e.Types=h,e.add=ct,e.createInstance=ut,e.flush=lt,e.getDeviceId=dt,e.getSessionId=ft,e.getUserId=pt,e.groupIdentify=vt,e.identify=ht,e.init=gt,e.logEvent=yt,e.remove=mt,e.reset=bt,e.revenue=It,e.runQueuedFunctions=function(e,t){Se(e,t)},e.setDeviceId=_t,e.setGroup=wt,e.setOptOut=St,e.setSessionId=Et,e.setTransport=Tt,e.setUserId=Ot,e.track=kt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!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,r,o,s,u,a=function(){return a=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},a.apply(this,arguments)};function c(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 l(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 d(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 f(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 p(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 v(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))}!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"}(i||(i={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(o||(o={})),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"}(s||(s={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(u||(u={}));var h=Object.freeze({__proto__:null,get SpecialEventType(){return o},get IdentifyOperation(){return i},get RevenueProperty(){return r},get LogLevel(){return s},get Status(){return u}}),g="AMP",y="".concat(g,"_unsent"),m="https://api2.amplitude.com/2/httpapi",b=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!I(t,n))return!1}return!0},I=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=f(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)r=r&&b(u);else if(!["number","string"].includes(typeof u))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 b(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},_=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return a({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(i.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(i.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(i.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(i.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(i.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(i.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(i.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(i.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(i.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[i.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[i.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===i.ADD?"number"==typeof n:e===i.UNSET||e===i.REMOVE||I(t,n)))},e}(),w=function(e,t){return a(a({},t),{event_type:o.IDENTIFY,user_properties:e.getUserProperties()})},S=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=u.Unknown),{event:e,code:t,message:n}},E=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,E)},T=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 l(this,void 0,void 0,(function(){return d(this,(function(o){switch(o.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:E(),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){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.reset=function(e){this.applying=!1,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 l(this,void 0,void 0,(function(){var t,n,i,r,o,s,u,c,l,v,h,g,y,m,b,I,_,w,E,T;return d(this,(function(d){switch(d.label){case 0:if(!e)return[2];t=p(e,1),n=t[0],i=p(e,2),r=i[1],o=this.plugins.filter((function(e){return"before"===e.type})),d.label=1;case 1:d.trys.push([1,6,7,8]),s=f(o),u=s.next(),d.label=2;case 2:return u.done?[3,5]:(g=u.value).execute?[4,g.execute(a({},n))]:[3,4];case 3:if(null===(y=d.sent()))return r({event:n,code:0,message:""}),[2];n=y,d.label=4;case 4:return u=s.next(),[3,2];case 5:return[3,8];case 6:return c=d.sent(),_={error:c},[3,8];case 7:try{u&&!u.done&&(w=s.return)&&w.call(s)}finally{if(_)throw _.error}return[7];case 8:l=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),d.label=9;case 9:d.trys.push([9,14,15,16]),v=f(l),h=v.next(),d.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(a({},n))]:[3,12];case 11:if(null===(y=d.sent()))return r({event:n,code:0,message:""}),[2];n=y,d.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=d.sent(),E={error:m},[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 b=this.plugins.filter((function(e){return"destination"===e.type})),I=b.map((function(e){var t=a({},n);return e.execute(t).catch((function(e){return S(t,0,String(e))}))})),Promise.all(I).then((function(e){var t=p(e,1)[0];r(t)})),[2]}}))}))},e.prototype.flush=function(){return l(this,void 0,void 0,(function(){var e,t,n,i=this;return d(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}(),O="Event rejected due to exceeded retry count",k=function(e){return{promise:e||Promise.resolve()}},P=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 T(this),this.name=e}return e.prototype._init=function(e){return l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){var t,n,i,r,o,s;return d(this,(function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,6,7,8]),n=f(t),i=n.next(),u.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=u.sent(),o={error:r},[3,8];case 7:try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,n){var i=function(e,t,n){return a(a(a({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return k(this.dispatch(i))},e.prototype.identify=function(e,t){var n=w(e,t);return k(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var r=function(e,t,n,i){var r;return a(a({},i),{event_type:o.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n,i);return k(this.dispatch(r))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,r=new _;return r.set(e,t),a(a({},n),{event_type:o.IDENTIFY,user_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return k(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return a(a({},t),{event_type:o.REVENUE,event_properties:e.getEventProperties()})}(e,t);return k(this.dispatch(n))},e.prototype.add=function(e){return this.config?k(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),k())},e.prototype.remove=function(e){return this.config?k(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),k())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(S(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return l(this,void 0,void 0,(function(){var t=this;return d(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 l(this,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,S(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):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=S(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 k(this.timeline.flush())},e}(),R=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 b(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?a({},this.properties):{};return e[r.REVENUE_PRODUCT_ID]=this.productId,e[r.REVENUE_QUANTITY]=this.quantity,e[r.REVENUE_PRICE]=this.price,e[r.REVENUE_TYPE]=this.revenueType,e[r.REVENUE]=this.revenue,e},e}(),x="Amplitude Logger ",U=function(){function e(){this.logLevel=s.None}return e.prototype.disable=function(){this.logLevel=s.None},e.prototype.enable=function(e){void 0===e&&(e=s.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Verbose||console.log("".concat(x,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Warn||console.warn("".concat(x,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Error||console.error("".concat(x,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Debug||console.log("".concat(x,"[Debug]: ").concat(e.join(" ")))},e}(),D=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,logLevel:s.Warn,loggerProvider:new U,optOut:!1,serverUrl:m,serverZone:"US",useBatch:!1}},q=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=D();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.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=N(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":m},N=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=D().serverZone),void 0===n&&(n=D().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:D().serverZone;return{serverZone:i,serverUrl:L(i,n)}},A=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 l(this,void 0,void 0,(function(){var n,i=this;return d(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(y,"_").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,O),!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),l(this,void 0,void 0,(function(){var t,n,i,r=this;return d(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),l(this,void 0,void 0,(function(){var n,i,r,o,s;return d(this,(function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,c(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},u.label=1;case 1:return u.trys.push([1,3,,4]),i=N(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:if(null===(r=u.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t){if("body"in r){o="";try{o=JSON.stringify(r.body,null,2)}catch(e){}this.fulfillRequest(e,r.statusCode,"".concat(r.status,": ").concat(o))}else this.fulfillRequest(e,r.statusCode,r.status);return[2]}return this.handleReponse(r,e),[3,4];case 3:return s=u.sent(),this.fulfillRequest(e,0,String(s)),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch(e.status){case u.Success:this.handleSuccessResponse(e,t);break;case u.Invalid:this.handleInvalidResponse(e,t);break;case u.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case u.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.handleOtherReponse(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=v(v(v(v([],p(Object.values(e.body.eventsWithInvalidFields)),!1),p(Object.values(e.body.eventsWithMissingFields)),!1),p(Object.values(e.body.eventsWithInvalidIdLengths)),!1),p(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)}));this.addToQueue.apply(this,v([],p(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.flushQueueSize/=2,this.addToQueue.apply(this,v([],p(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),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)}));this.addToQueue.apply(this,v([],p(c),!1))},e.prototype.handleOtherReponse=function(e){var t=this;this.addToQueue.apply(this,v([],p(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(S(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}(),j=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},C=function(e){return function(){var t=a({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},M=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=f(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},V=function(e,t){return function(){var n,i,r={};try{for(var o=f(t),s=o.next();!s.done;s=o.next()){var u=s.value;r[u]=M(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},F=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];var a=n(),c=a.logger,l=a.logLevel;if(l&&l<s.Debug||!l||!c)return e.apply(r,o);var d={type:"invoke public method",name:t,args:o,stacktrace:j(1),time:{start:(new Date).toISOString()},states:{}};i&&d.states&&(d.states.before=i());var f=e.apply(r,o);return f&&f.promise?f.promise.then((function(){i&&d.states&&(d.states.after=i()),d.time&&(d.time.end=(new Date).toISOString()),c.debug(JSON.stringify(d,null,2))})):(i&&d.states&&(d.states.after=i()),d.time&&(d.time.end=(new Date).toISOString()),c.debug(JSON.stringify(d,null,2))),f}},Q=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,(function(){return d(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return l(this,void 0,void 0,(function(){var t;return d(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 l(this,void 0,void 0,(function(){return d(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return l(this,void 0,void 0,(function(){return d(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),$=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,a,c,l,d,f,p,v,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 u.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 u.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!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case u.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case u.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 u.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?u.Success:429===e?u.RateLimit:413===e?u.PayloadTooLarge:408===e?u.Timeout:e>=400&&e<500?u.Invalid:e>=500?u.Failed:u.Unknown},e}(),K=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},B=function(){var e,t=K();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=z(n[0]),r=z(n[1]);return r?(e[i]=r,e):e}),{}):{}},z=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},W="dclid",J="fbclid",Z="gbraid",Y="gclid",G="ko_click_id",H="li_fat_id",X="msclkid",ee="rtd_cid",te="ttclid",ne="twclid",ie="wbraid",re={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},oe=function(){function e(){}return e.prototype.parse=function(){return l(this,void 0,void 0,(function(){return d(this,(function(e){return[2,a(a(a(a({},re),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=B();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=B();return(e={})[W]=t[W],e[J]=t[J],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},e}(),se=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[g,t,e.substring(0,n)].filter(Boolean).join("_")},ue=function(){function e(e){this.options=a({},e)}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:if(!K())return[2,!1];t=String(Date.now()),n=new e(this.options),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 l(this,void 0,void 0,(function(){var t;return d(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;return l(this,void 0,void 0,(function(){var n,i,r;return d(this,(function(o){return n=K(),i=null!==(t=null==n?void 0:n.document.cookie.split("; "))&&void 0!==t?t:[],(r=i.find((function(t){return 0===t.indexOf(e+"=")})))?[2,r.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return l(this,void 0,void 0,(function(){var i,r,o,s,u,a;return d(this,(function(c){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((s=new Date).setTime(s.getTime()+24*r*60*60*1e3),o=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(a=K())&&(a.document.cookie=u)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){return d(this,(function(e){return[2]}))}))},e}(),ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,(function(){var n,i;return d(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}($),ce=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:le(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),le=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},de=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}(),fe=function(){return fe=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},fe.apply(this,arguments)},pe=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(!pe(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){pe(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!pe(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 ve=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=fe({},this.identity.userProperties),n=fe(fe({},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 fe({},this.identity)},e.prototype.setIdentity=function(e){var t=fe({},this.identity);this.identity=fe({},e),pe(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}(),he="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,ge=function(){function e(){this.identityStore=new ve,this.eventBridge=new de,this.applicationContextProvider=new ce}return e.getInstance=function(t){return he.analyticsConnectorInstances||(he.analyticsConnectorInstances={}),he.analyticsConnectorInstances[t]||(he.analyticsConnectorInstances[t]=new e),he.analyticsConnectorInstances[t]},e}(),ye=function(){return ge.getInstance("$default_instance")},me=function(){function e(){this.name="identity",this.type="before",this.identityStore=ye().identityStore}return e.prototype.execute=function(e){return l(this,void 0,void 0,(function(){var t;return d(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return Promise.resolve(void 0)},e}(),be=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:""},Ie=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},_e=function(e){return Ie(e,"attribution")},we=function(e){var t,n,i=function(){return!1},r=void 0;return(n=e.defaultTracking,Ie(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}},Se=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},Ee=function(e){return e&&void 0!==e._q},Te=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.eventId=0,this.library="amplitude-ts/".concat("2.0.0-beta.4"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,this.eventId=this.config.lastEventId?this.config.lastEventId+1:0,Promise.resolve(void 0)},e.prototype.execute=function(e){return l(this,void 0,void 0,(function(){var t;return d(this,(function(n){return t=(new Date).getTime(),this.config.lastEventId=this.eventId,[2,a(a(a(a(a(a(a(a({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:be()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:E(),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:this.eventId++,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Oe=function(){function e(){}return e.prototype.isEnabled=function(){return l(this,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:if(!K())return[2,!1];t=String(Date.now()),n=new e,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 l(this,void 0,void 0,(function(){var t;return d(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(),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return l(this,void 0,void 0,(function(){return d(this,(function(n){return[2,(null===(t=K())||void 0===t?void 0:t.localStorage.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return l(this,void 0,void 0,(function(){return d(this,(function(i){try{null===(n=K())||void 0===n||n.localStorage.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return l(this,void 0,void 0,(function(){return d(this,(function(n){try{null===(t=K())||void 0===t||t.localStorage.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return l(this,void 0,void 0,(function(){return d(this,(function(t){try{null===(e=K())||void 0===e||e.localStorage.clear()}catch(e){}return[2]}))}))},e}(),ke=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 l(this,void 0,void 0,(function(){var n=this;return d(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}($),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return l(this,void 0,void 0,(function(){var n=this;return d(this,(function(i){return[2,new Promise((function(i,r){var o=K();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}($),Re=function(e,t,n){return void 0===n&&(n=!0),l(void 0,void 0,void 0,(function(){var i,r,o,s,u,a,c,l;return d(this,(function(d){switch(d.label){case 0:return i=function(e){return"".concat(g.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=d.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:d.sent(),d.label=3;case 3:return o=p(r.split("."),5),s=o[0],u=o[1],a=o[2],c=o[3],l=o[4],[2,{deviceId:s,userId:Ue(u),sessionId:xe(c),lastEventTime:xe(l),optOut:Boolean(a)}]}}))}))},xe=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ue=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},De="[Amplitude]",qe="".concat(De," Form Started"),Le="".concat(De," Form Submitted"),Ne="".concat(De," File Downloaded"),Ae="session_start",je="session_end",Ce="".concat(De," File Extension"),Me="".concat(De," File Name"),Ve="".concat(De," Link ID"),Fe="".concat(De," Link Text"),Qe="".concat(De," Link URL"),$e="".concat(De," Form ID"),Ke="".concat(De," Form Name"),Be="".concat(De," Form Destination"),ze="cookie",We=function(e){function t(t,n,i,r,o,u,a,c,l,d,f,p,v,h,g,y,m,b,I,_,w,S,E,T,O,k,P,R){void 0===i&&(i=new Q),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===o&&(o=!0),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=ze),void 0===h&&(h=new U),void 0===g&&(g=s.Warn),void 0===m&&(m=!1),void 0===_&&(_=""),void 0===w&&(w="US"),void 0===E&&(E=18e5),void 0===T&&(T=new Oe),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===k&&(k="fetch"),void 0===P&&(P=!1);var x=e.call(this,{apiKey:t,storageProvider:T,transportProvider:Ye(k)})||this;return x.apiKey=t,x.appVersion=n,x.cookieOptions=r,x.defaultTracking=o,x.flushIntervalMillis=a,x.flushMaxRetries=c,x.flushQueueSize=l,x.identityStorage=d,x.ingestionMetadata=f,x.loggerProvider=h,x.logLevel=g,x.minIdLength=y,x.partnerId=b,x.plan=I,x.serverUrl=_,x.serverZone=w,x.sessionTimeout=E,x.storageProvider=T,x.trackingOptions=O,x.transport=k,x.useBatch=P,x._optOut=!1,x._cookieStorage=i,x.deviceId=u,x.lastEventId=p,x.lastEventTime=v,x.optOut=m,x.sessionId=S,x.userId=R,x.loggerProvider.enable(x.logLevel),x}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(se(this.apiKey),e)},t}(q),Je=function(e,t,n){return void 0===t&&(t={}),l(void 0,void 0,void 0,(function(){var i,r,o,s,u,c,l,f,p,v,h,g,y,m,b,I,_,w,S,T,O,k,P,R,x,U,D,q,L,N,A,j,C,M;return d(this,(function(d){switch(d.label){case 0:return i=t.identityStorage||ze,o=[a({},t.cookieOptions)],_={},i===ze?[3,1]:(s="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(u=S,[3,4]);case 2:return[4,Ge()];case 3:u=d.sent(),d.label=4;case 4:s=u,d.label=5;case 5:return r=a.apply(void 0,o.concat([(_.domain=s,_.expiration=365,_.sameSite="Lax",_.secure=!1,_.upgrade=!0,_)])),c=Ze(t.identityStorage,r),[4,Re(e,c,null===(O=null===(T=t.cookieOptions)||void 0===T?void 0:T.upgrade)||void 0===O||O)];case 6:return l=d.sent(),[4,c.get(se(e))];case 7:return f=d.sent(),p=B(),v=null!==(x=null!==(R=null!==(P=null!==(k=t.deviceId)&&void 0!==k?k:p.deviceId)&&void 0!==P?P:null==f?void 0:f.deviceId)&&void 0!==R?R:l.deviceId)&&void 0!==x?x:E(),h=null==f?void 0:f.lastEventId,g=null!==(U=null==f?void 0:f.lastEventTime)&&void 0!==U?U:l.lastEventTime,y=null!==(q=null!==(D=t.optOut)&&void 0!==D?D:null==f?void 0:f.optOut)&&void 0!==q?q:l.optOut,m=null!==(N=null!==(L=t.sessionId)&&void 0!==L?L:null==f?void 0:f.sessionId)&&void 0!==N?N:l.sessionId,b=null!==(j=null!==(A=t.userId)&&void 0!==A?A:null==f?void 0:f.userId)&&void 0!==j?j:l.userId,n.previousSessionDeviceId=null!==(C=null==f?void 0:f.deviceId)&&void 0!==C?C:l.deviceId,n.previousSessionUserId=null!==(M=null==f?void 0:f.userId)&&void 0!==M?M:l.userId,I=a(a({},t.trackingOptions),{ipAddress:!0,language:!0,platform:!0}),[2,new We(e,t.appVersion,c,r,t.defaultTracking,v,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,h,g,t.loggerProvider,t.logLevel,t.minIdLength,y,t.partnerId,t.plan,t.serverUrl,t.serverZone,m,t.sessionTimeout,t.storageProvider,I,t.transport,t.useBatch,b)]}}))}))},Ze=function(e,t){switch(void 0===e&&(e=ze),void 0===t&&(t={}),e){case"localStorage":return new Oe;case"none":return new Q;default:return new ue(t)}},Ye=function(e){return"xhr"===e?new ke:"beacon"===e?new Pe:new ae},Ge=function(e){return l(void 0,void 0,void 0,(function(){var t,n,i,r,o,s,u;return d(this,(function(a){switch(a.label){case 0:return[4,(new ue).isEnabled()];case 1:if(!a.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,a.label=2;case 2:return o<i.length?(s=i[o],[4,(u=new ue({domain:"."+s})).set(r,1)]):[3,7];case 3:return a.sent(),[4,u.get(r)];case 4:return a.sent()?[4,u.remove(r)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},He=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Xe=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}))},et=function(e){var t=this;void 0===e&&(e={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,n){var i;return l(this,void 0,void 0,(function(){var r,o,s,u,l,f,v;return d(this,(function(d){switch(d.label){case 0:return r=a({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(b=null===(i=t.cookieOptions)||void 0===i?void 0:i.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."),o=t.cookieStorage,h=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),s=[g,y,h.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new oe).parse(),o.get(s)])];case 1:return u=p.apply(void 0,[d.sent(),2]),l=u[0],f=u[1],function(e,t,n){e.referrer;var i=e.referring_domain,r=c(e,["referrer","referring_domain"]),o=t||{};o.referrer;var s=o.referring_domain,u=c(o,["referrer","referring_domain"]);if(Xe(n.excludeReferrers,e.referring_domain))return!1;var a=JSON.stringify(r)!==JSON.stringify(u),l=He(i||"")!==He(s||"");return!t||a||l}(l,f,r)&&(r.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=a(a({},re),e),i=Object.entries(n).reduce((function(e,n){var i,r=p(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 _);return w(i)}(l,r),n.track(v),o.set(s,l)),[2]}var h,y,m,b,I}))}))},execute:function(e){return l(t,void 0,void 0,(function(){return d(this,(function(t){return[2,e]}))}))}};return n},tt=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},nt=function(e){var t;void 0===e&&(e={});var n=K(),i=void 0,r=function(){return l(void 0,void 0,void 0,(function(){var t,n,i;return d(this,(function(r){switch(r.label){case 0:return n={event_type:null!==(i=e.eventType)&&void 0!==i?i:"[Amplitude] Page Viewed"},t=[{}],[4,it()];case 1:return[2,(n.event_properties=a.apply(void 0,[a.apply(void 0,t.concat([r.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)]}}))}))},o=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},s="undefined"!=typeof location?location.href:null,u=function(){return l(void 0,void 0,void 0,(function(){var n,u,a;return d(this,(function(c){switch(c.label){case 0:return n=location.href,ot(e.trackHistoryChanges,n,s||"")&&o()?(null==i||i.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return a=(u=t).track,[4,r()];case 2:a.apply(u,[c.sent()]),c.label=3;case 3:c.label=4;case 4:return s=n,[2]}}))}))},c={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return l(void 0,void 0,void 0,(function(){var a,c;return d(this,(function(l){switch(l.label){case 0:return t=s,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",(function(){u()})),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,n){var i=p(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),u()}})),o()?(i.log("Tracking page view event"),c=(a=t).track,[4,r()]):[3,2];case 1:c.apply(a,[l.sent()]),l.label=2;case 2:return[2]}}))}))},execute:function(t){return l(void 0,void 0,void 0,(function(){var n;return d(this,(function(o){switch(o.label){case 0:return"attribution"===e.trackOn&&rt(t)?(null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,r()]):[3,2];case 1:n=o.sent(),t.event_type=n.event_type,t.event_properties=a(a({},t.event_properties),n.event_properties),o.label=2;case 2:return[2,t]}}))}))}};return c},it=function(){return l(void 0,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return e=tt,[4,(new oe).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},rt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[i.SET]||{},r=t[i.UNSET]||{},o=v(v([],p(Object.keys(n)),!1),p(Object.keys(r)),!1);return Object.keys(re).every((function(e){return o.includes(e)}))}return!1},ot=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},st=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){return void 0===e&&(e=""),k(this._init(a(a({},n),{userId:t,apiKey:e})))},t.prototype._init=function(t){return l(this,void 0,void 0,(function(){var n,i,r,o,s=this;return d(this,(function(u){switch(u.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Je(t.apiKey,t,this)]);case 1:return n=u.sent(),[4,e.prototype._init.call(this,n)];case 2:return u.sent(),(!this.config.sessionId||this.config.lastEventTime&&Date.now()-this.config.lastEventTime>this.config.sessionTimeout)&&this.setSessionId(Date.now()),(i=ye()).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new A).promise];case 3:return u.sent(),[4,this.add(new Te).promise];case 4:return u.sent(),[4,this.add({name:"@amplitude/plugin-session-handler",type:"before",setup:function(e,t){return l(void 0,void 0,void 0,(function(){return d(this,(function(n){return p=e,v=t,[2]}))}))},execute:function(e){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(i){return t=Date.now(),e.event_type===Ae||e.event_type===je?(p.lastEventTime=t,[2,e]):(n=p.lastEventTime||t,t-n>p.sessionTimeout&&(v.setSessionId(t),e.session_id=v.getSessionId(),e.time=t),p.lastEventTime=t,[2,e])}))}))}}).promise];case 5:return u.sent(),[4,this.add(new me).promise];case 6:return u.sent(),f=this.config.defaultTracking,Ie(f,"fileDownloads")?[4,this.add({name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,(function(){var n,i;return d(this,(function(r){return t?(n=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=i.exec(n.href),o=null==r?void 0:r[1];o&&e.addEventListener("click",(function(){var i;o&&t.track(Ne,((i={})[Ce]=o,i[Me]=n.pathname,i[Ve]=e.id,i[Fe]=e.text,i[Qe]=e.href,i))}))},i=/\.(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(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return l(void 0,void 0,void 0,(function(){return d(this,(function(t){return[2,e]}))}))}}).promise]:[3,8];case 7:u.sent(),u.label=8;case 8:return function(e){return Ie(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add({name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(e,t){return l(void 0,void 0,void 0,(function(){var n;return d(this,(function(i){return t?(n=function(e){var n=!1;e.addEventListener("change",(function(){var i;n||t.track(qe,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),n=!0}),{}),e.addEventListener("submit",(function(){var i,r;n||t.track(qe,((i={})[$e]=e.id,i[Ke]=e.name,i[Be]=e.action,i)),t.track(Le,((r={})[$e]=e.id,r[Ke]=e.name,r[Be]=e.action,r)),n=!1}))},Array.from(document.getElementsByTagName("form")).forEach(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return l(void 0,void 0,void 0,(function(){return d(this,(function(t){return[2,e]}))}))}}).promise]:[3,10];case 9:u.sent(),u.label=10;case 10:return _e(this.config.defaultTracking)?(c=this.config,r=_e(c.defaultTracking)&&c.defaultTracking&&"object"==typeof c.defaultTracking&&c.defaultTracking.attribution&&"object"==typeof c.defaultTracking.attribution?a({},c.defaultTracking.attribution):{},o=et(r),[4,this.add(o).promise]):[3,12];case 11:u.sent(),u.label=12;case 12:return[4,this.add(nt(we(this.config))).promise];case 13:return u.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 14:return u.sent(),i.eventBridge.setEventReceiver((function(e){s.track(e.eventType,e.eventProperties)})),[2]}var c,f,p,v}))}))},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,this.setSessionId(Date.now()),function(e){ye().identityStore.editIdentity().setUserId(e).commit()}(e)):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){ye().identityStore.editIdentity().setDeviceId(e).commit()}(e)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(E()),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){if(this.config){var t,n=this.getSessionId(),i=this.config.lastEventTime;if(this.config.sessionId=e,this.config.lastEventTime=void 0,t=this.config.defaultTracking,Ie(t,"sessions")){if(n&&i){var r={session_id:n,time:i+1};r.device_id=this.previousSessionDeviceId,r.user_id=this.previousSessionUserId,this.track(je,void 0,r)}this.track(Ae,void 0,{session_id:e,time:e-1}),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ye(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new _,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(Ee(i)){var o=i._q;i._q=[],i=Se(new _,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(Ee(t)){var i=t._q;t._q=[],t=Se(new R,i)}return e.prototype.revenue.call(this,t,n)},t}(P),ut=function(){var e=new st;return{init:F(e.init.bind(e),"init",C(e),V(e,["config"])),add:F(e.add.bind(e),"add",C(e),V(e,["config.apiKey","timeline.plugins"])),remove:F(e.remove.bind(e),"remove",C(e),V(e,["config.apiKey","timeline.plugins"])),track:F(e.track.bind(e),"track",C(e),V(e,["config.apiKey","timeline.queue.length"])),logEvent:F(e.logEvent.bind(e),"logEvent",C(e),V(e,["config.apiKey","timeline.queue.length"])),identify:F(e.identify.bind(e),"identify",C(e),V(e,["config.apiKey","timeline.queue.length"])),groupIdentify:F(e.groupIdentify.bind(e),"groupIdentify",C(e),V(e,["config.apiKey","timeline.queue.length"])),setGroup:F(e.setGroup.bind(e),"setGroup",C(e),V(e,["config.apiKey","timeline.queue.length"])),revenue:F(e.revenue.bind(e),"revenue",C(e),V(e,["config.apiKey","timeline.queue.length"])),flush:F(e.flush.bind(e),"flush",C(e),V(e,["config.apiKey","timeline.queue.length"])),getUserId:F(e.getUserId.bind(e),"getUserId",C(e),V(e,["config","config.userId"])),setUserId:F(e.setUserId.bind(e),"setUserId",C(e),V(e,["config","config.userId"])),getDeviceId:F(e.getDeviceId.bind(e),"getDeviceId",C(e),V(e,["config","config.deviceId"])),setDeviceId:F(e.setDeviceId.bind(e),"setDeviceId",C(e),V(e,["config","config.deviceId"])),reset:F(e.reset.bind(e),"reset",C(e),V(e,["config","config.userId","config.deviceId"])),getSessionId:F(e.getSessionId.bind(e),"getSessionId",C(e),V(e,["config"])),setSessionId:F(e.setSessionId.bind(e),"setSessionId",C(e),V(e,["config"])),setOptOut:F(e.setOptOut.bind(e),"setOptOut",C(e),V(e,["config"])),setTransport:F(e.setTransport.bind(e),"setTransport",C(e),V(e,["config"]))}},at=ut(),ct=at.add,lt=at.flush,dt=at.getDeviceId,ft=at.getSessionId,pt=at.getUserId,vt=at.groupIdentify,ht=at.identify,gt=at.init,yt=at.logEvent,mt=at.remove,bt=at.reset,It=at.revenue,_t=at.setDeviceId,wt=at.setGroup,St=at.setOptOut,Et=at.setSessionId,Tt=at.setTransport,Ot=at.setUserId,kt=at.track;e.Identify=_,e.Revenue=R,e.Types=h,e.add=ct,e.createInstance=ut,e.flush=lt,e.getDeviceId=dt,e.getSessionId=ft,e.getUserId=pt,e.groupIdentify=vt,e.identify=ht,e.init=gt,e.logEvent=yt,e.remove=mt,e.reset=bt,e.revenue=It,e.runQueuedFunctions=function(e,t){Se(e,t)},e.setDeviceId=_t,e.setGroup=wt,e.setOptOut=St,e.setSessionId=Et,e.setTransport=Tt,e.setUserId=Ot,e.track=kt,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -1,1 +0,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<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-zMlZAEt5PDHtYNLzgkXmigXA+VAnbXHlTfJUeP4drzM3ep+yolOSH6wl2fNFyjF5",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.0.0-beta.3-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},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(u,l[p]);r.Identify=u;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"],m=["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)}(); | ||
!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<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-gM5sdj6XbaA9NwbELfABjDCTqLxvUQ9Mvk6prMC3AHIE4MlWFo6NsNDjbZfNZf0T",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.0.0-beta.4-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},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(u,l[p]);r.Identify=u;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"],m=["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,2 +0,2 @@ | ||
export declare const VERSION = "2.0.0-beta.3"; | ||
export declare const VERSION = "2.0.0-beta.4"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "@amplitude/analytics-browser", | ||
"version": "2.0.0-beta.3", | ||
"version": "2.0.0-beta.4", | ||
"description": "Official Amplitude SDK for Web", | ||
@@ -49,4 +49,4 @@ "keywords": [ | ||
"@amplitude/analytics-types": "^2.0.0-beta.3", | ||
"@amplitude/plugin-page-view-tracking-browser": "^2.0.0-beta.3", | ||
"@amplitude/plugin-web-attribution-browser": "^2.0.0-beta.3", | ||
"@amplitude/plugin-page-view-tracking-browser": "^2.0.0-beta.4", | ||
"@amplitude/plugin-web-attribution-browser": "^2.0.0-beta.4", | ||
"tslib": "^2.4.1" | ||
@@ -69,3 +69,3 @@ }, | ||
], | ||
"gitHead": "7658bf9e740c0a72e1b18d95173c77049e0f1e00" | ||
"gitHead": "d927e15b5c462762094df039e683462b04c415a1" | ||
} |
@@ -43,3 +43,3 @@ <p align="center"> | ||
<script type="text/javascript"> | ||
!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<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-zMlZAEt5PDHtYNLzgkXmigXA+VAnbXHlTfJUeP4drzM3ep+yolOSH6wl2fNFyjF5",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.0.0-beta.3-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},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(u,l[p]);r.Identify=u;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"],m=["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)}(); | ||
!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<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-gM5sdj6XbaA9NwbELfABjDCTqLxvUQ9Mvk6prMC3AHIE4MlWFo6NsNDjbZfNZf0T",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-2.0.0-beta.4-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},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(u,l[p]);r.Identify=u;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"],m=["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)}(); | ||
@@ -46,0 +46,0 @@ amplitude.init("YOUR_API_KEY_HERE"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package