PageSourceSearch

https://www.fresha.com/assets/b2b-mktg/_next/static/chunks/8879-f256c61b7c17ec0f.js

js fresha.com collected 2026-09-24 08:45:40 UTC 132,096 bytes, 2 lines download raw bytes

1try{!function(){var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="02906e2c-9c70-4632-a768-91b68b6e2452",e._sentryDebugIdIdentifier="sentry-dbid-02906e2c-9c70-4632-a768-91b68b6e2452")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8879],{2609:(e,t,n)=>{n.d(t,{Q:()=>rj});var r,i,o,s,u,a,c,l,d,f,p,h,v,g,_,y,m,b,w,E,S,I,k,T=n(30356);(r=h||(h={}))[r.None=0]="None",r[r.Error=1]="Error",r[r.Warn=2]="Warn",r[r.Verbose=3]="Verbose",r[r.Debug=4]="Debug";var P=function(e){return function(){var t=(0,T.__assign)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},O=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,T.__values)(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},A=function(e,t){return function(){var n,r,i={};try{for(var o=(0,T.__values)(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=O(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},R=function(e,t,n,r,i){return void 0===i&&(i=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<h.Debug||!c||!a)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:(Error().stack||"").split("\n").slice(3).map(function(e){return e.trim()}),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),a.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),a.debug(JSON.stringify(l,null,2))),d}},x=function(e){return{promise:e||Promise.resolve()}},C=function(){var e="ampIntegrationContext";return"u">typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:void 0!==n.g?n.g:void 0},N=function(){var e,t=C();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=U(n[0]),i=U(n[1]);return i&&(e[r]=i),e},{}):{}},U=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},L=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:q(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),q=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},D=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}(),j=function(){return(j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function M(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function F(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var $=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=M(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;
1if(null==e||null==t||e.length!==t.length)return!1;var u=Array.isArray(e),a=Array.isArray(t);if(u!==a)return!1;if(u&&a){for(var c=0;c<e.length;c++)if(!$(e[c],t[c]))return!1}else{if(!$(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var l=!0;return Object.keys(e).forEach(function(n){$(e[n],t[n])||(l=!1)}),l}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var V=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=j({},this.identity.userProperties),n=j(j({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,u,a=n.userProperties||{};try{for(var c=M(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=F(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var h=(i=void 0,M(Object.entries(p))),v=h.next();!v.done;v=h.next()){var g=F(v.value,2),_=g[0],y=g[1];a[_]=y}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}break;case"$unset":try{for(var m=(s=void 0,M(Object.keys(p))),b=m.next();!b.done;b=m.next()){var _=b.value;delete a[_]}}catch(e){s={error:e}}finally{try{b&&!b.done&&(u=m.return)&&u.call(m)}finally{if(s)throw s.error}}break;case"$clearAll":a={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return n.userProperties=a,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return j({},this.identity)},e.prototype.setIdentity=function(e){var t=j({},this.identity);this.identity=j({},e),$(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}(),z="u">typeof globalThis?globalThis:void 0!==n.g?n.g:self,K=function(){function e(){this.identityStore=new V,this.eventBridge=new D,this.applicationContextProvider=new L}return e.getInstance=function(t){return z.analyticsConnectorInstances||(z.analyticsConnectorInstances={}),z.analyticsConnectorInstances[t]||(z.analyticsConnectorInstances[t]=new e),z.analyticsConnectorInstances[t]},e}(),B=function(e){return void 0===e&&(e="$default_instance"),K.getInstance(e)},W=function(e,t){B(t).identityStore.editIdentity().setUserId(e).commit()},H=function(e,t){B(t).identityStore.editIdentity().setDeviceId(e).commit()};(i=v||(v={})).Unknown="unknown",i.Skipped="skipped",i.Success="success",i.RateLimit="rate_limit",i.PayloadTooLarge="payload_too_large",i.Invalid="invalid",i.Failed="failed",i.Timeout="Timeout",i.SystemError="SystemError";var J=n(20602),Q=function(e,t){var n=Math.max(t,1);return e.reduce(function(e,t,r){var i=Math.floor(r/n);return e[i]||(e[i]=[]),e[i].push(t),e},[])},Y=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=v.Unknown),{event:e,code:t,message:n}},G="Amplitude Logger ",Z=function(){function e(){this.logLevel=h.None}return e.prototype.disable=function(){this.logLevel=h.None},e.prototype.enable=function(e){void 0===e&&(e=h.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<h.Verbose||console.log("".concat(G,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<h.Warn||console.warn("".concat(G,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<h.Error||console.error("".concat(G,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<h.Debug||console.log("".concat(G,"[Debug]: ").concat(e.join(" ")))},e}(),X=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:h.Warn,loggerProvider:new Z,offline:!1,optOut:!1,serverUrl:J.mJ,serverZone:"US",useBatch:!1}},ee=function(){function e(e){this._optOut=!1;var t,n,r,i,o=X();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!=(n=e.logLevel)?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!=(r=e.optOut)?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!=(i=e.useBatch)?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=et(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}
1,enumerable:!1,configurable:!0}),e}(),et=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=X().serverZone),void 0===n&&(n=X().useBatch),e)return{serverUrl:e,serverZone:void 0};var r,i=["US","EU"].includes(t)?t:X().serverZone;return{serverZone:i,serverUrl:(r=n,"EU"===i?r?J.OP:J.bu:r?J.pL:J.mJ)}},en=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}(),er=(0,T.__spreadArray)([],(0,T.__read)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),ei=function(e){var t,n=C();if(!(null==(t=null==n?void 0:n.crypto)?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,ei);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,T.__spreadArray)([],(0,T.__read)(r.entries()),!1).map(function(e){var t=(0,T.__read)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(er[r]):er[r]}).join("")};function eo(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var es=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return e.prototype.setup=function(e){var t;return(0,T.__awaiter)(this,void 0,void 0,function(){var n,r=this;return(0,T.__generator)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(J.fS,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=ei()),new Promise(function(n){t.queue.push({event:e,attempts:0,callback:function(e){return n(e)},timeout:0}),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,T.__awaiter)(this,void 0,void 0,function(){var t,n,r=this;return(0,T.__generator)(this,function(i){switch(i.label){case 0:if(this.config.offline)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2];if(this.flushId)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2];return this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),[4,Q(t,this.config.flushQueueSize).reduce(function(t,n){return(0,T.__awaiter)(r,void 0,void 0,function(){return(0,T.__generator)(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())];case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,T.__awaiter)(this,void 0,void 0,function(){var n,r,i,o;return(0,T.__generator)(this,function(s){switch(s.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,T.__rest)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new en,s.label=1;case 1:return s.trys.push([1,3,,4]),r=et(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:if(null===(i=s.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in i?this.fulfillRequest(e,i.statusCode,"".concat(i.status,": ").concat(eo(i))):this.fulfillRequest(e,i.statusCode,i.status),[2];return this.handleResponse(i,e),[3,4];case 3:var u;return o=(u=s.sent())instanceof Error?u.message:String(u),this.config.loggerProvider.error(o),this.handleResponse({status:v.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case v.Success:this.handleSuccessResponse(e,t);break;case v.Invalid:this.handleInvalidResponse(e,t);break;case v.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case v.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))return void this.fulfillRequest(t,e.statusCode,e.body.error);var r=new Set((0,T.__spreadArray)((0,T.__spreadArray)((0,T.__spreadArray)((0,T.__spreadArray)([],(0,T.__read)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,T.__read)(Object.values(e.body.eventsWithMissingFields)),!1),(0,T.__read)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,T.__read)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){return!r.has(i)||void n.fulfillRequest([t],e.statusCode,e.body.error)});i.length>0&&this.config.loggerProvider.warn(eo(e));
1var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(eo(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),u=new Set(i),a=new Set(o),c=t.filter(function(t,r){return t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)?void n.fulfillRequest([t],e.statusCode,e.body.error):(a.has(r)&&(t.timeout=n.throttleTimeout),!0)});c.length>0&&this.config.loggerProvider.warn(eo(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach(function(e){return e.callback(Y(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(t){return!e.some(function(e){return e.event.insert_id===t.event.insert_id})}),this.saveEvents()},e}(),eu=function(){function e(){this.name="identity",this.type="before",this.identityStore=B().identityStore}return e.prototype.execute=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t;return(0,T.__generator)(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return e.instanceName&&(this.identityStore=B(e.instanceName).identityStore),[2]})})},e}(),ea=n(98771),ec=n(84949),el=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){return(0,ec.a)(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?(0,T.__assign)({},this.properties):{};return e[g.REVENUE_PRODUCT_ID]=this.productId,e[g.REVENUE_QUANTITY]=this.quantity,e[g.REVENUE_PRICE]=this.price,e[g.REVENUE_TYPE]=this.revenueType,e[g.REVENUE_CURRENCY]=this.currency,e[g.REVENUE]=this.revenue,e[g.RECEIPT]=this.receipt,e[g.RECEIPT_SIG]=this.receiptSig,e},e}();(o=g||(g={})).REVENUE_PRODUCT_ID="$productId",o.REVENUE_QUANTITY="$quantity",o.REVENUE_PRICE="$price",o.REVENUE_TYPE="$revenueType",o.REVENUE_CURRENCY="$currency",o.REVENUE="$revenue",o.RECEIPT="$receipt",o.RECEIPT_SIG="$receiptSig";var ed=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e};(s=_||(_={})).SET="$set",s.SET_ONCE="$setOnce",s.ADD="$add",s.APPEND="$append",s.PREPEND="$prepend",s.REMOVE="$remove",s.PREINSERT="$preInsert",s.POSTINSERT="$postInsert",s.UNSET="$unset",s.CLEAR_ALL="$clearAll",(u=y||(y={})).IDENTIFY="$identify",u.GROUP_IDENTIFY="$groupidentify",u.REVENUE="revenue_amount";var ef=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(t){return t.name===e.name}))return t.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2];return void 0===e.name&&(e.name=ei(),t.loggerProvider.warn("Plugin name is undefined. \n      Generating a random UUID for plugin name: ".concat(e.name,". \n      Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!=(n=e.type)?n:"enrichment",[4,null==(r=e.setup)?void 0:r.call(e,t,this.client)];case 1:return i.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e,t){var n;return(0,T.__awaiter)(this,void 0,void 0,function(){var r,i;return(0,T.__generator)(this,function(o){switch(o.label){case 0:if(-1===(r=this.plugins.findIndex(function(t){return t.name===e})))return t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2];return i=this.plugins[r],this.plugins.splice(r,1),[4,null==(n=i.teardown)?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this.applying=!1,this.plugins.map(function(e){var t;return null==(t=e.teardown)?void 0:t.call(e)}),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s,u,a,c,l,d,f,p,h;return(0,T.__generator)(this,function(v){switch(v.label){case 0:if(!e)return[2];t=(0,T.__read)(e,1)[0],n=(0,T.__read)(e,2)[1],r=this.plugins.filter(function(e){return"before"===e.type}),v.label=1;case 1:v.trys.push([1,6,7,8]),o=(i=(0,T.__values)(r)).next(),v.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,T.__assign)({},t))];case 3:if(null===(u=v.sent()))return n({event:t,code:0,message:""}),[2];t=u,v.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return d={error:v.sent()},[3,8];case 7:try{o&&!o.done&&(f=i.return)&&f.call(i)}finally{if(d)throw d.error}
1return[7];case 8:a=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),v.label=9;case 9:v.trys.push([9,14,15,16]),l=(c=(0,T.__values)(a)).next(),v.label=10;case 10:if(l.done)return[3,13];if(!(s=l.value).execute)return[3,12];return[4,s.execute((0,T.__assign)({},t))];case 11:if(null===(u=v.sent()))return n({event:t,code:0,message:""}),[2];t=u,v.label=12;case 12:return l=c.next(),[3,10];case 13:return[3,16];case 14:return p={error:v.sent()},[3,16];case 15:try{l&&!l.done&&(h=c.return)&&h.call(c)}finally{if(p)throw p.error}return[7];case 16:return Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){var n=(0,T.__assign)({},t);return e.execute(n).catch(function(e){return Y(n,0,String(e))})})).then(function(e){var r=(0,T.__read)(e,1)[0]||Y(t,100,"Event not tracked, no destination plugins on the instance");n(r)}),[2]}})})},e.prototype.flush=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,T.__generator)(this,function(n){switch(n.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return n.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return n.sent(),[2]}})})},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onIdentityChanged)||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onSessionIdChanged)||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onOptOutChanged)||n.call(t,e)})},e}(),ep=function(e,t){return(0,T.__assign)((0,T.__assign)({},t),{event_type:y.IDENTIFY,user_properties:e.getUserProperties()})},eh=function(e,t,n,r){var i;return(0,T.__assign)((0,T.__assign)({},r),{event_type:y.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:((i={})[e]=t,i)})},ev=function(e,t,n){var r,i=new ea.T$;return i.set(e,t),(0,T.__assign)((0,T.__assign)({},n),{event_type:y.IDENTIFY,user_properties:i.getUserProperties(),groups:((r={})[e]=t,r)})},eg=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new ef(this),this.name=e}return e.prototype._init=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(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(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,T.__generator)(this,function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=(n=(0,T.__values)(t)).next(),u.label=2;case 2:if(r.done)return[3,7];if(!((i=(0,r.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return u.sent(),[3,6];case 4:return[4,i];case 5:u.sent(),u.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return o={error:u.sent()},[3,10];case 9:try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:u.sent(),u.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,n){var r=(0,T.__assign)((0,T.__assign)((0,T.__assign)({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t});return x(this.dispatch(r))},e.prototype.identify=function(e,t){var n=ep(e,t);return x(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=eh(e,t,n,r);return x(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=ev(e,t,n);return x(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=(0,T.__assign)((0,T.__assign)({},t),{event_type:y.REVENUE,event_properties:e.getEventProperties()});return x(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),x())},e.prototype._addPlugin=function(e){return x(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),x())},e.prototype._removePlugin=function(e){return x(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(Y(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t=this;return(0,T.__generator)(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t={};if(void 0===e)return t;var n={};return Object.keys(e).forEach(function(t){Object.values(_).includes(t)||(n[t]=e[t])}),ea.Se.forEach(function(n){if(Object.keys(e).includes(n)){var r=e[n];switch(n){case _.CLEAR_ALL:Object.keys(t).forEach(function(e){delete t[e]});break;case _.UNSET:Object.keys(r).forEach(function(e){delete t[e]});break;case _.SET:Object.assign(t,r)}}}),Object.assign(t,n),t},e.prototype.process=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t,n,r;return(0,T.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),this.config.optOut)return[2,Y(e,0,"Event skipped due to optOut config")];return e.event_type===y.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)];case 1:return 200===(n=i.sent()).code?this.config.loggerProvider.log(n.message):100===n.code?this.config.loggerProvider.warn(n.message):this.config.loggerProvider.error(n.message),[2,n];case 2:return r=String(i.sent()),this.config.loggerProvider.error(r),[2,n=Y(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,!!e))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=!!e)},e.prototype.flush=function(){return x(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});return void 0===t?void this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e)):t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),e_=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},ey=function(e){return e_(e,"attribution")},em=function(e){return e_(e,"pageViews")},eb=function(e){return e_(e,"sessions")},ew=function(e){return"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},eE=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},eS=function(e){if(eE(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},eI=function(e){if(ew(e.autocapture)){if("object"==typeof e.autocapture&&"object"==typeof e.autocapture.
1networkTracking)return e.autocapture.networkTracking;else if(e.networkTrackingOptions)return e.networkTrackingOptions}},ek=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return em(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},eT=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.resolve,u=e&&e[i];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},eP=function(e){return e&&void 0!==e._q},eO=function(){if("u"<typeof navigator)return"";var e,t,n,r,i=navigator.userLanguage;return null!=(r=null!=(n=null!=(t=null==(e=navigator.languages)?void 0:e[0])?t:navigator.language)?n:i)?r:""},eA="2.17.8",eR=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts","/").concat(eA),"u">typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return(0,T.__awaiter)(this,void 0,void 0,function(){var r,i,o;return(0,T.__generator)(this,function(s){return r=new Date().getTime(),i=null!=(t=this.config.lastEventId)?t:-1,o=null!=(n=e.event_id)?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[2,(0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:eO()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:ei(),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:o,library:this.library,user_agent:this.userAgent})]})})},e}(),ex=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t;return(0,T.__generator)(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(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),eC=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[J.r,t,e.substring(0,n)].filter(Boolean).join("_")},eN=function(){function e(e){this.options=(0,T.__assign)({},e)}return e.prototype.isEnabled=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){var t,n;return(0,T.__generator)(this,function(r){switch(r.label){case 0:if(!C())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return r.sent(),[4,t.get(n)];case 3:return[2,r.sent()===e.testValue];case 4:return r.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){var t;return(0,T.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,T.__generator)(this,function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=i.sent()))return[2,void 0];try{if(r=null!=(t=eU(n))?t:eL(n),void 0===r)return console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0];return[2,JSON.parse(r)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}}})})},e.prototype.getRaw=function(e){var t,n;return(0,T.__awaiter)(this,void 0,void 0,function(){var r,i;return(0,T.__generator)(this,function(o){return(i=(null!=(n=null==(t=null==(r=C())?void 0:r.document)?void 0:t.cookie.split("; "))?n:[]).find(function(t){return 0===t.indexOf(e+"=")}))?[2,i.substring(e.length+1)]:[2,void 0]})})},e.prototype.set=function(e,t){var n;return(0,T.__awaiter)(this,void 0,void 0,function(){var r,i,o,s,u,a,c;return(0,T.__generator)(this,function(l){try{r=null!=(n=this.options.expirationDays)?n:0,i=null!==t?r:-1,o=void 0,i&&((s=new Date).setTime(s.getTime()+24*i*36e5),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=C())&&(a.document.cookie=u)}catch(t){c=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}return[2]})})},e.prototype.remove=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(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(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return[2]})})},e}(),eU=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},eL=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},eq=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,n,r,i,o,s,u,a,c,l,d,f,p,h,g,_,y,m,b,w,E,S,I=e.code||0,k=this.buildStatus(I);switch(k){case v.Success:return{status:k,statusCode:I,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(n=e.payload_size_bytes)?n:0,serverUploadTime:null!=(r=e.server_upload_time)?r:0}};case v.Invalid:return{status:k,statusCode:I,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(s=e.events_with_invali
1d_fields)?s:{},eventsWithMissingFields:null!=(u=e.events_with_missing_fields)?u:{},eventsWithInvalidIdLengths:null!=(a=e.events_with_invalid_id_lengths)?a:{},epsThreshold:null!=(c=e.eps_threshold)?c:0,exceededDailyQuotaDevices:null!=(l=e.exceeded_daily_quota_devices)?l:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(f=e.silenced_events)?f:[],throttledDevices:null!=(p=e.throttled_devices)?p:{},throttledEvents:null!=(h=e.throttled_events)?h:[]}};case v.PayloadTooLarge:return{status:k,statusCode:I,body:{error:null!=(g=e.error)?g:""}};case v.RateLimit:return{status:k,statusCode:I,body:{error:null!=(_=e.error)?_:"",epsThreshold:null!=(y=e.eps_threshold)?y:0,throttledDevices:null!=(m=e.throttled_devices)?m:{},throttledUsers:null!=(b=e.throttled_users)?b:{},exceededDailyQuotaDevices:null!=(w=e.exceeded_daily_quota_devices)?w:{},exceededDailyQuotaUsers:null!=(E=e.exceeded_daily_quota_users)?E:{},throttledEvents:null!=(S=e.throttled_events)?S:[]}};case v.Timeout:default:return{status:k,statusCode:I}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),eD=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,T.__extends)(t,e),t.prototype.send=function(e,t){return(0,T.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,T.__generator)(this,function(i){switch(i.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"})];case 1:return[4,(n=i.sent()).text()];case 2:r=i.sent();try{return[2,this.buildResponse(JSON.parse(r))]}catch(e){return[2,this.buildResponse({code:n.status})]}}})})},t}(eq),ej=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){var t,n,r;return(0,T.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return(0,T.__awaiter)(this,void 0,void 0,function(){var t;return(0,T.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];return[2,JSON.parse(t)];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(n){return[2,(null==(t=this.storage)?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(r){try{null==(n=this.storage)||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(n){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),eM=function(e){function t(t){var n,r,i,o=this;try{i=null==(n=C())?void 0:n.localStorage}catch(e){null==(r=null==t?void 0:t.loggerProvider)||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return(0,T.__extends)(t,e),t.prototype.set=function(t,n){var r;return(0,T.__awaiter)(this,void 0,void 0,function(){var i;return(0,T.__generator)(this,function(o){switch(o.label){case 0:if(!(Array.isArray(n)&&n.length>1e3))return[3,2];return i=n.length-1e3,[4,e.prototype.set.call(this,t,n.slice(0,1e3))];case 1:return o.sent(),null==(r=this.loggerProvider)||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(ej),eF=function(e){function t(){var t;return e.call(this,null==(t=C())?void 0:t.sessionStorage)||this}return(0,T.__extends)(t,e),t}(ej),e$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return(0,T.__extends)(t,e),t.prototype.send=function(e,t){return(0,T.__awaiter)(this,void 0,void 0,function(){var n=this;return(0,T.__generator)(this,function(r){return[2,new Promise(function(r,i){"u"<typeof XMLHttpRequest&&i(Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{r(n.buildResponse(JSON.parse(e)))}catch(e){r(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))})]})})},t}(eq),eV=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,T.__extends)(t,e),t.prototype.send=function(e,t){return(0,T.__awaiter)(this,void 0,void 0,function(){var n=this;return(0,T.__generator)(this,function(r){return[2,new Promise(function(r,i){var o=C();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,JSON.stringify(t)))return r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(eq),ez=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},eK=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},eB="[Amplitude]",eW="".concat(eB," Form Started"),eH="".concat(eB," Form Submitted"),eJ="".concat(eB," File Downloaded"),eQ="session_start",eY="session_end",eG="".concat(eB," File Extension"),eZ="".concat(eB," File Name"),eX="".concat(eB," Link ID"),e0="".concat(eB," Link Text"),e1="".concat(eB," Link URL"),e2="".concat(eB," Form ID"),e4="".concat(eB," Form Name"),e3="".concat(eB," Form Destination"),e6="cookie",e5=function(e){function t(t,n,r,i,o,s,u,a,c,l,d,f,p,v,g,_,y,m,b,w,E,S,I,k,T,P,O,A,R,x,C,N,U,L,q){void 0===r&&(r=new ex),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=e6),void 0===_&&(_=new Z),void 0===y&&(y=h.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===I&&(I=""),void 0===k&&(k="US"),void 0===P&&(P=18e5),void 0===O&&(O=new eM({loggerProvider:_})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===R&&(R="fetch"),void 0===x&&(x=!1),void 0===C&&(C=!0);var D=e.call(this,{apiKey:t,storageProvider:O,transportProvider:e8(R)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=i,D.defaultTracking=o,D.autocapture=s,D.flushIntervalMillis=a,D.flushMaxRetries=c,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=f,D.instanceName=p,D.loggerProvider=_,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=E,D.plan=S,D.serverUrl=I,D.serverZone=k,D.sessionTimeout=P,D.storageProvider=O,D.trackingOptions=A,D.transport=R,D.useBatch=x,D.fetchRemoteConfig=C,D.networkTrackingOptions=q,D.version=eA,D._optOut=!1,D._cookieStorage=r,D.deviceId=u,D.lastEventId=v,D.lastEventTime=g,D.optOut=w,D.sessionId=T,D.pageCounter=U,D.userId=N,D.debugLogsEnabled=L,D.loggerProvider.enable(L?h.Debug:D.logLevel),D.networkTrackingOptions=q,D}return(0,T.__extends)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
1,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}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(eC(this.apiKey),e)},t}(ee),e9=function(e,t){switch(void 0===e&&(e=e6),void 0===t&&(t={}),e){case"localStorage":return new eM;case"sessionStorage":return new eF;case"none":return new ex;default:return new eN((0,T.__assign)((0,T.__assign)({},t),{expirationDays:t.expiration}))}},e8=function(e){return"xhr"===e?new e$:"beacon"===e?new eV:new eD},e7=function(){var e="ampIntegrationContext";return"u">typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:void 0!==n.g?n.g:void 0},te=function(){var e,t=e7();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=tt(n[0]),i=tt(n[1]);return i&&(e[r]=i),e},{}):{}},tt=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},tn="dclid",tr="fbclid",ti="gbraid",to="gclid",ts="ko_click_id",tu="li_fat_id",ta="msclkid",tc="rtd_cid",tl="ttclid",td="twclid",tf="wbraid",tp={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},th=function(){function e(){}return e.prototype.parse=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return[2,(0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)({},tp),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=te();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.split("/")[2])?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=te();return(e={})[tn]=t[tn],e[tr]=t[tr],e[ti]=t[ti],e[to]=t[to],e[ts]=t[ts],e[tu]=t[tu],e[ta]=t[ta],e[tc]=t[tc],e[tl]=t[tl],e[td]=t[td],e[tf]=t[tf],e},e}();(a=m||(m={})).SET="$set",a.SET_ONCE="$setOnce",a.ADD="$add",a.APPEND="$append",a.PREPEND="$prepend",a.REMOVE="$remove",a.PREINSERT="$preInsert",a.POSTINSERT="$postInsert",a.UNSET="$unset",a.CLEAR_ALL="$clearAll",(c=b||(b={})).REVENUE_PRODUCT_ID="$productId",c.REVENUE_QUANTITY="$quantity",c.REVENUE_PRICE="$price",c.REVENUE_TYPE="$revenueType",c.REVENUE_CURRENCY="$currency",c.REVENUE="$revenue",(l=w||(w={})).IDENTIFY="$identify",l.GROUP_IDENTIFY="$groupidentify",l.REVENUE="revenue_amount";var tv=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},tg=function(e){void 0===e&&(e={});var t,n,r=e7(),i=void 0,o=!1,s=e.trackOn,u=e.trackHistoryChanges,a=e.eventType,c=void 0===a?"[Amplitude] Page Viewed":a,l=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},d=function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,t,n;return(0,T.__generator)(this,function(r){switch(r.label){case 0:return e=l("u">typeof location&&location.href||""),n={event_type:c},t=[{}],[4,t_()];case 1:return[2,(n.event_properties=T.__assign.apply(void 0,[T.__assign.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"u">typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"u">typeof location&&l(location.pathname)||"","[Amplitude] Page Title":"u">typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}})})},f=function(){return void 0===s||"function"==typeof s&&s()},p="u">typeof location?location.href:null,h=function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,n,r,o;return(0,T.__generator)(this,function(s){switch(s.label){case 0:if(n=tm(u,e=location.href,p||"")&&f(),p=e,!n)return[3,4];if(null==i||i.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return o=(r=t).track,[4,d()];case 2:o.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}})})},v=function(){h()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var u,a;return(0,T.__generator)(this,function(c){switch(c.label){case 0:if(t=s,n=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),o=!0,r&&(r.addEventListener("popstate",v),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=(0,T.__read)(n,3),i=r[0],s=r[1],u=r[2];e.apply(t,[i,s,u]),o&&h()}})),!f())return[3,2];return i.log("Tracking page view event"),a=(u=t).track,[4,d()];case 1:a.apply(u,[c.sent()]),c.label=2;case 2:return[2]}})})},execute:function(e){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var t;return(0,T.__generator)(this,function(r){switch(r.label){case 0:if(!("attribution"===s&&ty(e)))return[3,2];
1return null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,d()];case 1:e.event_type=(t=r.sent()).event_type,e.event_properties=(0,T.__assign)((0,T.__assign)({},e.event_properties),t.event_properties),r.label=2;case 2:return n&&e.event_type===c&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=(0,T.__assign)((0,T.__assign)({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return r&&(r.removeEventListener("popstate",v),o=!1),[2]})})}}},t_=function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,T.__generator)(this,function(t){switch(t.label){case 0:return e=tv,[4,new th().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},ty=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[m.SET]||{},r=t[m.UNSET]||{},i=(0,T.__spreadArray)((0,T.__spreadArray)([],(0,T.__read)(Object.keys(n)),!1),(0,T.__read)(Object.keys(r)),!1);return Object.keys(tp).every(function(e){return i.includes(e)})}return!1},tm=function(e,t,n){if("pathOnly"!==e)return t!==n;if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname},tb=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})},r=function(){t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,T.__generator)(this,function(s){return i=function(){if(!r)return void t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");if("u">typeof document){var i=function(e){var t=!1;n(e,"change",function(){var n,i=tE(e);t||r.track(eW,((n={})[e2]=tw(e.id),n[e4]=tw(e.name),n[e3]=i,n)),t=!0}),n(e,"submit",function(){var n,i,o=tE(e);t||r.track(eW,((n={})[e2]=tw(e.id),n[e4]=tw(e.name),n[e3]=o,n)),r.track(eH,((i={})[e2]=tw(e.id),i[e4]=tw(e.name),i[e3]=o,i)),t=!1})};Array.from(document.getElementsByTagName("form")).forEach(i),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=C())?o.addEventListener("load",i):t.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},tw=function(e){if("string"==typeof e)return e},tE=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},tS=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})},r=function(){t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,r){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,T.__generator)(this,function(s){return i=function(){if(!r)return void t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");if("u">typeof document){var i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&n(e,"click",function(){var n;s&&r.track(eJ,((n={})[eG]=s,n[eZ]=t.pathname,n[eX]=e.id,n[e0]=e.text,n[e1]=e.href,n))})},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;
1Array.from(document.getElementsByTagName("a")).forEach(i),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=C())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},tI=!1,tk=function(e){tI||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n  defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),tI=!0)},tT=function(){var e=C(),t=[],n=function(n,r){e&&(e.addEventListener(n,r),t.push({type:n,handler:r}))},r=function(){t.forEach(function(t){var n=t.type,r=t.handler;e&&e.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(r){return"u"<typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1):(e.offline=!navigator.onLine,n("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]})})},teardown:function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return r(),[2]})})}}};(d=E||(E={})).Unknown="unknown",d.Skipped="skipped",d.Success="success",d.RateLimit="rate_limit",d.PayloadTooLarge="payload_too_large",d.Invalid="invalid",d.Failed="failed",d.Timeout="Timeout",d.SystemError="SystemError",(f=S||(S={})).US="US",f.EU="EU";var tP="Remote config fetch rejected due to timeout after 5 seconds",tO="Unexpected error occurred",tA=function(){function e(e){var t=e.localConfig,n=e.configKeys,r=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(e,t,n){return(0,T.__awaiter)(r,void 0,void 0,function(){var r,i,o;return(0,T.__generator)(this,function(s){switch(s.label){case 0:return r=Date.now(),[4,this.fetchWithTimeout(n)];case 1:if((i=s.sent())&&(o=i.configs&&i.configs[e]))return this.metrics.fetchTimeAPISuccess=Date.now()-r,[2,o[t]];return this.metrics.fetchTimeAPIFail=Date.now()-r,[2,void 0]}})})},this.fetchWithTimeout=function(e){return(0,T.__awaiter)(r,void 0,void 0,function(){var t,n,r;return(0,T.__generator)(this,function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout(function(){return t.abort()},5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}})})},this.fetchRemoteConfig=function(e,t){return(0,T.__awaiter)(r,void 0,void 0,function(){var n,r,i,o,s,u,a,c,l,d,f;return(0,T.__generator)(this,function(p){switch(p.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:tP})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0);p.label=1;case 1:p.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(i=(r=(0,T.__values)(this.configKeys)).next();!i.done;
1i=r.next())o=i.value,n.append("config_keys",o)}catch(e){l={error:e}}finally{try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}}return t&&n.set("session_id",String(t)),s={headers:{Accept:"*/*"},method:"GET"},u="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(u,(0,T.__assign)((0,T.__assign)({},s),{signal:e}))];case 2:if(null===(a=p.sent()))return[2,this.completeRequest({err:tO})];switch(new eq().buildStatus(a.status)){case E.Success:return this.attempts=0,[2,this.parseAndStoreConfig(a)];case E.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:if(c=p.sent(),e.aborted)return[2,this.completeRequest({err:tP})];return[2,this.completeRequest({err:null!=(f=c.message)?f:tO})];case 4:return[2]}})})},this.retryFetch=function(e,t){return(0,T.__awaiter)(r,void 0,void 0,function(){var n=this;return(0,T.__generator)(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){return setTimeout(e,n.attempts*n.retryTimeout)})];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}})})},this.parseAndStoreConfig=function(e){return(0,T.__awaiter)(r,void 0,void 0,function(){var t;return(0,T.__generator)(this,function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}})})},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.serverZone===S.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===S.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),tR=function(e){var t=e.localConfig,n=e.configKeys;return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return[2,new tA({localConfig:t,configKeys:n})]})})},tx=function(){function e(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){var e;return(0,T.__generator)(this,function(t){switch(t.label){case 0:return e=this,[4,tR({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=t.sent(),[2]}})})},e.prototype.generateJoinedConfig=function(){var e,t,n,r,i;return(0,T.__awaiter)(this,void 0,void 0,function(){var o,s,u,a,c,l,d,f,p,h,v,g;return(0,T.__generator)(this,function(_){switch(_.label){case 0:if(_.trys.push([0,3,,4]),!(s=this.remoteConfigFetch))return[3,2];return[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)];case 1:s=_.sent(),_.label=2;case 2:if(o=s,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(o,null,2)),o&&"autocapture"in o){if("boolean"==typeof o.autocapture&&(this.config.autocapture=o.autocapture),"object"==typeof o.autocapture){if(u=(0,T.__assign)({},o.autocapture),void 0===this.config.autocapture&&(this.config.autocapture=o.autocapture),"object"==typeof o.autocapture.elementInteractions&&(null==(e=o.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:e.length)){u.elementInteractions=(0,T.__assign)({},o.autocapture.elementInteractions),c=null!=(t=(a=u.elementInteractions).pageUrlAllowlist)?t:[],l=[];try{for(f=(d=(0,T.__values)(o.autocapture.elementInteractions.pageUrlAllowlistRegex)).next();!f.done;f=d.next()){p=f.value;try{l.push(new RegExp(p))}catch(e){this.config.loggerProvider.warn("Invalid regex pattern: ".concat(p),e)}}}catch(e){v={error:e}}finally{try{f&&!f.done&&(g=d.return)&&g.call(d)}finally{if(v)throw v.error}}a.pageUrlAllowlist=c.concat(l),delete a.pageUrlAllowlistRegex}"boolean"==typeof this.config.autocapture&&(this.config.autocapture=(0,T.__assign)({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},u)),"object"==typeof this.config.autocapture&&(this.config.autocapture=(0,T.__assign)((0,T.__assign)({},this.config.autocapture),u))}this.config.defaultTracking=this.config.autocapture}return this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),null!=(i=this.config).requestMetadata||(i.requestMetadata=new en),(null==(n=this.remoteConfigFetch)?void 0:n.metrics.fetchTimeAPISuccess)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),(null==(r=this.remoteConfigFetch)?void 0:r.metrics.fetchTimeAPIFail)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return h=_.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",h),[3,4];case 4:return[2,this.config]}})})},e}(),tC=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],tN=["div","span","h1","h2","h3","h4","h5","h6"],tU="[Amplitude] Element Clicked",tL="[Amplitude] Element Tag",tq="[Amplitude] Element Text",tD="[Amplitude] Page URL",tj="https://app.amplitude.com",tM={US:tj,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},tF=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function t$(e){return"function"==typeof e}function tV(e){return t$(null==e?void 0:e.then)}function tz(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var tK=tz(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t}});function tB(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var tW=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,n,r,i,o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=(0,T.__values)(o),u=s.next();!u.done;u=s.next())u.value.remove(this)}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var a=this.initialTeardown;
1if(t$(a))try{a()}catch(e){i=e instanceof tK?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=(0,T.__values)(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{tQ(f)}catch(e){i=null!=i?i:[],e instanceof tK?i=(0,T.__spreadArray)((0,T.__spreadArray)([],(0,T.__read)(i)),(0,T.__read)(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new tK(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)tQ(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(n=this._finalizers)?n:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&tB(t,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&tB(n,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),tH=tW.EMPTY;function tJ(e){return e instanceof tW||e&&"closed"in e&&t$(e.remove)&&t$(e.add)&&t$(e.unsubscribe)}function tQ(e){t$(e)?e():e.unsubscribe()}var tY=void 0,tG={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=tG.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,(0,T.__spreadArray)([e,t],(0,T.__read)(n))):setTimeout.apply(void 0,(0,T.__spreadArray)([e,t],(0,T.__read)(n)))},clearTimeout:function(e){var t=tG.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function tZ(e){tG.setTimeout(function(){!1;throw e})}function tX(){}var t0=t1("C",void 0,void 0);function t1(e,t,n){return{kind:e,value:t,error:n}}var t2=null;function t4(e){var t,n,r,i;1;e()}var t3=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,tJ(t)&&t.add(n)):n.destination=nt,n}return(0,T.__extends)(t,e),t.create=function(e,t,n){return new t8(e,t,n)},t.prototype.next=function(e){this.isStopped?ne(t1("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?ne(t1("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?ne(t0,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(tW),t6=Function.prototype.bind;function t5(e,t){return t6.call(e,t)}var t9=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){t7(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){t7(e)}else t7(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){t7(e)}},e}(),t8=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;return t$(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i=t,s.destination=new t9(i),s}return(0,T.__extends)(t,e),t}(t3);function t7(e){1;tZ(e)}function ne(e,t){}var nt={closed:!0,next:tX,error:function(e){throw e},complete:tX},nn="function"==typeof Symbol&&Symbol.observable||"@@observable";function nr(e){return e}var ni=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this,i=!function(e){return e&&e instanceof t3||e&&t$(e.next)&&t$(e.error)&&t$(e.complete)&&tJ(e)}(e)?new t8(e,t,n):e;return t4(function(){var e=r.operator,t=r.source;i.add(e?e.call(i,t):t?r._subscribe(i):r._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=no(t))(function(t,r){var i=new t8({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[nn]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===e.length?nr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=no(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function no(e){var t;return null!=(t=null!=e?e:tY)?t:Promise}function ns(e){return Symbol.asyncIterator&&t$(null==e?void 0:e[Symbol.asyncIterator])}function nu(e){return TypeError("You provided "+(null!==e&&"object"==typeof e?"an invali
1d object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var na="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function nc(e){return t$(null==e?void 0:e[na])}function nl(e){return(0,T.__asyncGenerator)(this,arguments,function(){var t,n,r;return(0,T.__generator)(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,(0,T.__await)(t.read())];case 3:if(r=(n=i.sent()).value,!n.done)return[3,5];return[4,(0,T.__await)(void 0)];case 4:return[2,i.sent()];case 5:return[4,(0,T.__await)(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function nd(e){return t$(null==e?void 0:e.getReader)}function nf(e){if(e instanceof ni)return e;if(null!=e){var t,n,r,i;if(t$(e[nn])){return t=e,new ni(function(e){var n=t[nn]();if(t$(n.subscribe))return n.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if(tF(e)){return n=e,new ni(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}if(tV(e)){return r=e,new ni(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,tZ)})}if(ns(e))return np(e);if(nc(e)){return i=e,new ni(function(e){var t,n;try{for(var r=(0,T.__values)(i),o=r.next();!o.done;o=r.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.complete()})}if(nd(e))return np(nl(e))}throw nu(e)}function np(e){return new ni(function(t){(function(e,t){var n,r,i,o;return(0,T.__awaiter)(this,void 0,void 0,function(){var s;return(0,T.__generator)(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=(0,T.__asyncValues)(e),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return i={error:u.sent()},[3,11];case 6:if(u.trys.push([6,,9,10]),!(r&&!r.done&&(o=n.return)))return[3,8];return[4,o.call(n)];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function nh(e){return function(t){if(t$(null==t?void 0:t.lift))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}function nv(e,t,n,r,i){return new ng(e,t,n,r,i)}var ng=function(e){function t(t,n,r,i,o,s){var u=e.call(this,t)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return(0,T.__extends)(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),n||null==(t=this.onFinalize)||t.call(this)}},t}(t3);function n_(e,t){return nh(function(n,r){var i=0;n.subscribe(nv(r,function(n){r.next(e.call(t,n,i++))}))})}function ny(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function nm(e,t,n){return(void 0===n&&(n=1/0),t$(t))?nm(function(n,r){return n_(function(e,i){return t(n,e,r,i)})(nf(e(n,r)))},n):("number"==typeof t&&(n=t),nh(function(t,r){var i,o,s,u,a,c,l,d;return i=n,o=[],s=0,u=0,a=!1,c=function(){!a||o.length||s||r.complete()},l=function(e){return s<i?d(e):o.push(e)},d=function(t){s++;var n=!1;nf(e(t,u++)).subscribe(nv(r,function(e){r.next(e)},function(){n=!0},void 0,function(){if(n)try{for(s--;o.length&&s<i;)!function(){var e=o.shift();d(e)}();c()}catch(e){r.error(e)}}))},t.subscribe(nv(r,l,function(){a=!0,c()})),function(){}}))}var nb=Array.isArray,nw=["addListener","removeListener"],nE=["addEventListener","removeEventListener"],nS=["on","off"];function nI(e,t,n,r){if(t$(n)&&(r=n,n=void 0),r){return nI(e,t,n).pipe((i=r,n_(function(e){return nb(e)?i.apply(void 0,(0,T.__spreadArray)([],(0,T.__read)(e))):i(e)})))}var i,o,s,u,a=(0,T.__read)(t$((o=e).addEventListener)&&t$(o.removeEventListener)?nE.map(function(r){return function(i){return e[r](t,i,n)}}):t$((s=e).addListener)&&t$(s.removeListener)?nw.map(nk(e,t)):t$((u=e).on)&&t$(u.off)?nS.map(nk(e,t)):[],2),c=a[0],l=a[1];if(!c&&tF(e))return nm(function(e){return nI(e,t,n)})(nf(e));if(!c)throw TypeError("Invalid event target");return new ni(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return c(t),function(){return l(t)}})}function nk(e,t){return function(n){return function(r){return e[n](t,r)}}}var nT=tz(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),nP=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,T.__extends)(t,e),t.prototype.lift=function(e){var t=new nO(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new nT},t.prototype.next=function(e){var t=this;t4(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=(0,T.__values)(t.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;t4(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;t4(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null==(e=this.observers)?void 0:e.length)>0}
1,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this.hasError,r=this.isStopped,i=this.observers;return n||r?tH:(this.currentObservers=null,i.push(e),new tW(function(){t.currentObservers=null,tB(i,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,n=this.thrownError,r=this.isStopped;t?e.error(n):r&&e.complete()},t.prototype.asObservable=function(){var e=new ni;return e.source=this,e},t.create=function(e,t){return new nO(e,t)},t}(ni),nO=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,T.__extends)(t,e),t.prototype.next=function(e){var t,n;null==(n=null==(t=this.destination)?void 0:t.next)||n.call(t,e)},t.prototype.error=function(e){var t,n;null==(n=null==(t=this.destination)?void 0:t.error)||n.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!=(n=null==(t=this.source)?void 0:t.subscribe(e))?n:tH},t}(nP);function nA(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new nP}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,u=e.resetOnRefCountZero,a=void 0===u||u;return function(e){var t,r,o,u=0,c=!1,l=!1,d=function(){null==r||r.unsubscribe(),r=void 0},f=function(){d(),t=o=void 0,c=l=!1},p=function(){var e=t;f(),null==e||e.unsubscribe()};return nh(function(e,h){u++,l||c||d();var v=o=null!=o?o:n();h.add(function(){0!=--u||l||c||(r=nR(p,a))}),v.subscribe(h),!t&&u>0&&(t=new t8({next:function(e){return v.next(e)},error:function(e){l=!0,d(),r=nR(f,i,e),v.error(e)},complete:function(){c=!0,d(),r=nR(f,s),v.complete()}}),nf(e).subscribe(t))})(e)}}function nR(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0===t)return void e();if(!1!==t){var i=new t8({next:function(){i.unsubscribe(),e()}});return nf(t.apply(void 0,(0,T.__spreadArray)([],(0,T.__read)(n)))).subscribe(i)}}var nx=["input","select","textarea"],nC=function(e,t){return function(n,r){var i,o,s,u=e.pageUrlAllowlist,a=e.shouldTrackEventResolver,c=null==(o=null==(i=null==r?void 0:r.tagName)?void 0:i.toLowerCase)?void 0:o.call(i);if(!c)return!1;if(a)return a(n,r);if(!nq(window.location.href,u))return!1;var l=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t&&!t.some(function(e){var t;return!!(null==(t=null==r?void 0:r.matches)?void 0:t.call(r,e))}))return!1;switch(c){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var d=null==(s=null==window?void 0:window.getComputedStyle)?void 0:s.call(window,r);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===n)return!0;return"click"===n}}},nN=function(e){if(null==e)return!1;if("string"==typeof e&&(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(e)))return!1;return!0},nU=function(e){var t,n,r,i=null==(n=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:n.call(t),o=e instanceof HTMLElement&&(null==(r=e.getAttribute("contenteditable"))?void 0:r.toLowerCase())==="true";return!nx.includes(i)&&!o},nL=function(e){var t="";return nU(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach(function(e){var n="";e&&3===e.nodeType?e.textContent&&(n=e.textContent):n=nL(e),t+=n.split(/(\s+)/).filter(nN).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}),t},nq=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},nD=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return null!=r&&("object"!=typeof r||0!==Object.keys(r).length)&&("string"!=typeof r||0!==r.trim().length)&&(t[n]=r),t},{})},nj=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}if(t){var r=t.textContent||"";return nN(r)?r:""}return nj(n)},nM=function(e,t){return e?t.some(function(t){var n;return null==(n=null==e?void 0:e.matches)?void 0:n.call(e,t)})?e:nM(null==e?void 0:e.parentElement,t):null},nF=function(e){if(!e)return{};var t,n,r,i=null==(r=null==(n=null==e?void 0:e.tagName)?void 0:n.toLowerCase)?void 0:r.call(n);return nD(((t={})[tL]=i,t[tq]=nL(e),t[tD]=window.location.href.split("?")[0],t))},n$=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor},nV=function(){function e(e){var t=(void 0===e?{}:e).origin,n=this;this.endpoint=tj,this.requestCallbacks={},this.onSelect=function(e){n.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?n.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&n.notify({action:"track-selector-moved",data:t})},this.endpoint=void 0===t?tj:t}return e.prototype.notify=function(e){var t,n,r,i;null==(n=null==(t=this.logger)?void 0:t.debug)||n.call(t,"Message sent: ",JSON.stringify(e)),null==(i=null==(r=window.opener)?void 0:r.postMessage)||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null==(t=this.logger)||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===tj&&(this.endpoint=i);var a=null;window.addEventListener("message",function(e){if(null==(r=null==(n=t.logger)?void 0:n.debug)||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var n,r,i,c,l,d=null==e?void 0:e.data,f=null==d?void 0:d.action;if(f)if("id"in d)null==(c=null==(i=t.logger)?void 0:i.debug)||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(d);else if("ping"===f)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===f){var p,h=null==d?void 0:d.data;(p="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise(function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=p,r.addEventListener("load",function(){e({status:!0})},{once:!0}),r.addEventListener("error",function(){t({status:!1,message:"Failed to load the script ".concat(p)})}),null==(n=document.head)||n.appendChild(r)}catch(e){t(e)}})).then(function(){var e;a=null==(e=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:e.call(window,{getEventTagProps:nF,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u}),t.notify({action:"selector-loaded"})}).catch(function(){var e;null==(e=t.logger)||e.warn("Failed to initialize visual tagging selector")})}else"close-visual-tagging-selector"===f&&(null==(l=null==a?void 0:a.close)||l.call(a))}}),this.notify({action:"page-loaded"})},e}(),nz=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],nK=["type"],nB=["svg","path","g"],nW=["password","hidden"],nH=function(e){return e?function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n];if(null===r)t+=4;else{var i=function e(t,n){void 0===n&&(n=!1);try{if(null==t){if(n)return"None";return null}if("string"==typeof t){if(n){if((t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"'))return"'".concat(t,"'");if(t.includes("'"))return'"'.concat(t.replace(/'/g,"\\'"),'"');return"'".concat(t,"'")}return t}if("boolean"==typeof t)return t?"True":"False";else if(Array.isArray(t)){var r=t.map(function(t){return e(t,!0)});return"[".concat(r.join(", "),"]")}else if("object"==typeof t){var i=Object.entries(t).filter(function(e){var t=(0,T.__read)(e,1)[0];return null!=t}).map(function(t){var n=(0,T.__read)(t,2),r=n[0],i=n[1];return"".concat(String(e(r,!0)),": ").concat(String(e(i,!0)))}),o="{".concat(i.join(", "),"}");return o.includes("\\'")&&(o=o.replace(/'/g,"'").replace(/'/g,"\\'")),o}return t.toString()}catch(e){return null}}(r);t+=i?Array.from(i).length:4}if(t>1024)return e.slice(0,n)}return e}((function(e){var t=[];if(!e)return t;
1t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t})(e).map(function(e){return function(e){if(null===e)return null;var t,n,r,i,o,s,u=String(e.tagName).toLowerCase(),a={tag:u},c=Array.from(null!=(i=null==(r=e.parentElement)?void 0:r.children)?i:[]);c.length&&(a.index=c.indexOf(e),a.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var l=null==(s=null==(o=e.previousElementSibling)?void 0:o.tagName)?void 0:s.toLowerCase();l&&(a.prevSib=String(l));var d=e.getAttribute("id");d&&(a.id=String(d));var f=Array.from(e.classList);f.length&&(a.classes=f);var p={},h=Array.from(e.attributes).filter(function(e){return!nz.includes(e.name)}),v=!nU(e);if(!nW.includes(String(e.getAttribute("type")))&&!nB.includes(u))try{for(var g=(0,T.__values)(h),_=g.next();!_.done;_=g.next()){var y=_.value;(!v||nK.includes(y.name))&&(p[y.name]=String(y.value).substring(0,128))}}catch(e){t={error:e}}finally{try{_&&!_.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}return Object.keys(p).length&&(a.attrs=p),a}(e)})):[]};function nJ(e,t){return nh(function(n,r){var i=0;n.subscribe(nv(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}var nQ=function(e){function t(t,n){return e.call(this)||this}return(0,T.__extends)(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(tW),nY={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=nY.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,(0,T.__spreadArray)([e,t],(0,T.__read)(n))):setInterval.apply(void 0,(0,T.__spreadArray)([e,t],(0,T.__read)(n)))},clearInterval:function(e){var t=nY.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},nG=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return(0,T.__extends)(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n,r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!=(n=this.id)?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),nY.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&nY.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,tB(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(nQ),nZ={now:function(){return(nZ.delegate||Date).now()},delegate:void 0},nX=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=nZ.now,e}(),n0=new(function(e){function t(t,n){void 0===n&&(n=nX.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return(0,T.__extends)(t,e),t.prototype.flush=function(e){var t,n=this.actions;if(this._active)return void n.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,t){for(;e=n.shift();)e.unsubscribe();throw t}},t}(nX))(nG);function n1(e){return void 0===e&&(e=1/0),nm(nr,e)}var n2=new ni(function(e){return e.complete()});function n4(e){return e&&t$(e.schedule)}function n3(e){return e[e.length-1]}function n6(e){return n4(n3(e))?e.pop():void 0}function n5(e,t){return void 0===t&&(t=0),nh(function(n,r){n.subscribe(nv(r,function(n){return ny(r,e,function(){return r.next(n)},t)},function(){return ny(r,e,function(){return r.complete()},t)},function(n){return ny(r,e,function(){return r.error(n)},t)}))})}function n9(e,t){return void 0===t&&(t=0),nh(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function n8(e,t){if(!e)throw Error("Iterable cannot be null");return new ni(function(n){ny(n,t,function(){var r=e[Symbol.asyncIterator]();ny(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function n7(e,t){return t?function(e,t){if(null!=e){if(t$(e[nn]))return nf(e).pipe(n9(t),n5(t));if(tF(e))return new ni(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})});if(tV(e))return nf(e).pipe(n9(t),n5(t));if(ns(e))return n8(e,t);if(nc(e))return new ni(function(n){var r;return ny(n,t,function(){r=e[na](),ny(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){n.error(e);return}i?n.complete():n.next(t)},0,!0)}),function(){return t$(null==r?void 0:r.return)&&r.return()}});if(nd(e))return n8(nl(e),t)}throw nu(e)}(e,t):nf(e)}function re(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=n6(t),i=(e=1/0,"number"==typeof n3(t)?t.pop():e);
1return t.length?1===t.length?nf(t[0]):n1(i)(n7(t,r)):n2}function rt(e){return e<=0?function(){return n2}:nh(function(t,n){var r=0;t.subscribe(nv(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}function rn(e){return e instanceof Date&&!isNaN(e)}var rr=tz(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function ri(e){throw new rr(e)}(p=I||(I={})).ClickObservable="clickObservable",p.ChangeObservable="changeObservable",p.NavigateObservable="navigateObservable",p.MutationObservable="mutationObservable";var ro=function(e){void 0===e&&(e={});var t,n,r,i=e.dataAttributePrefix,o=void 0===i?"data-amp-track-":i,s=e.visualTaggingOptions,u=void 0===s?{enabled:!0,messenger:new nV}:s;e.cssSelectorAllowlist=null!=(t=e.cssSelectorAllowlist)?t:tC,e.actionClickAllowlist=null!=(n=e.actionClickAllowlist)?n:tN,e.debounceTime=null!=(r=e.debounceTime)?r:0;var a="@amplitude/plugin-autocapture-browser",c=[],l=function(){var e,t,n=nI(document,"click",{capture:!0}).pipe(n_(function(e){return f(e,"click")}),nA()),r=nI(document,"change",{capture:!0}).pipe(n_(function(e){return f(e,"change")}),nA());window.navigation&&(t=nI(window.navigation,"navigate").pipe(n_(function(e){return f(e,"navigate")}),nA()));var i=new ni(function(e){var t=new MutationObserver(function(t){e.next(t)});return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}}).pipe(n_(function(e){return f(e,"mutation")}),nA());return(e={})[I.ClickObservable]=n,e[I.ChangeObservable]=r,e[I.NavigateObservable]=t,e[I.MutationObservable]=i,e},d=function(e,t){var n,r,i,s=null==(i=null==(r=null==t?void 0:t.tagName)?void 0:r.toLowerCase)?void 0:i.call(r),u="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),c=t.getAttributeNames().reduce(function(e,n){if(n.startsWith(o)){var r=n.replace(o,""),i=t.getAttribute(n);r&&(e[r]=i||"")}return e},{}),l=nj(t),d=((n={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",n["[Amplitude] Element Class"]=t.getAttribute("class"),n["[Amplitude] Element Hierarchy"]=nH(t),n[tL]=s,n[tq]=nL(t),n["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),n["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=c,n["[Amplitude] Element Parent Label"]=l,n[tD]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="u">typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===s&&"click"===e&&t instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=t.href),nD(d)},f=function(t,n){var r={event:t,timestamp:Date.now(),type:n};if(("click"===r.type||"change"===r.type)&&null!==r.event.target){var i=nM(r.event.target,e.cssSelectorAllowlist);i&&(r.closestTrackedAncestor=i,r.targetElementProperties=d(r.type,i))}return r};return{name:a,type:"enrichment",setup:function(t,n){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var r,i,o,s,f,p,h,v,g,_;return(0,T.__generator)(this,function(y){var m,b,w,E,S,I,k,P,O,A,R,x,C,N,U,L,q,D,j,M,F,$,V,z,K,B,W,H,J,Q,Y,G,Z,X;return"u"<typeof document?[2]:(r=nC(e,e.cssSelectorAllowlist),i=nC(e,e.actionClickAllowlist),b=(m={allObservables:o=l(),options:e,amplitude:n,shouldTrackEvent:r}).amplitude,w=m.allObservables,E=m.options,S=m.shouldTrackEvent,O=re((I=w.clickObservable).pipe(nh(function(e,t){var n,r=!1;e.subscribe(nv(t,function(e){var i=n;n=e,r&&t.next([i,e]),r=!0}))}),nJ(function(e){var t=(0,T.__read)(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=20>=Math.abs(r.event.screenX-n.event.screenX)&&20>=Math.abs(r.event.screenY-n.event.screenY);return i&&!o})),I.pipe((k=E.debounceTime,void 0===P&&(P=n0),nh(function(e,t){var n=null,r=null,i=null,o=function(){if(n){n.unsubscribe(),n=null;var e=r;r=null,t.next(e)}};function s(){var e=i+k,r=P.now();if(r<e){n=this.schedule(void 0,e-r),t.add(n);return}o()}e.subscribe(nv(t,function(e){r=e,i=P.now(),n||(n=P.schedule(s,k),t.add(n))},function(){o(),t.complete()},void 0,function(){r=n=null}))})),n_(function(){return"timeout"}))),s=I.pipe((void 0===A&&(A=n0),R=0,x=A,void 0===R&&(R=0),void 0===C&&(C=n0),N=-1,null!=x&&(n4(x)?C=x:N=x),U=new ni(function(e){var t=rn(R)?R-C.now():R;t<0&&(t=0);var n=0;return C.schedule(function(){e.closed||(e.next(n++),0<=N?this.schedule(void 0,N):e.complete())},t)}),function e(t,n){return n?function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n1(1)(n7(e,n6(e)))}(n.pipe(rt(1),nh(function(e,t){e.subscribe(nv(t,tX))})),r.pipe(e(t)))}:nm(function(e,n){return nf(t(e,n)).pipe(rt(1),n_(function(){return e}))})}(function(){return U})),nJ(n$),nJ(function(e){return S("click",e.closestTrackedAncestor)}),nh(function(e,t){var n=[];return e.subscribe(nv(t,function(e){return n.push(e)},function(){t.next(n),t.complete()}
1)),nf(O).subscribe(nv(t,function(){var e=n;n=[],t.next(e)},tX)),function(){n=null}})).subscribe(function(e){var t,n,r=(e.length,tU);try{for(var i=(0,T.__values)(e),o=i.next();!o.done;o=i.next()){var s=o.value;null==b||b.track(r,s.targetElementProperties)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}),c.push(s),q=(L={allObservables:o,getEventProperties:d,amplitude:n,shouldTrackEvent:r}).amplitude,D=L.allObservables,j=L.getEventProperties,M=L.shouldTrackEvent,f=D.changeObservable.pipe(nJ(n$),nJ(function(e){return M("change",e.closestTrackedAncestor)})).subscribe(function(e){null==q||q.track("[Amplitude] Element Changed",j("change",e.closestTrackedAncestor))}),c.push(f),$=(F={allObservables:o,options:e,getEventProperties:d,amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:i}).amplitude,V=F.allObservables,z=F.options,K=F.getEventProperties,B=F.shouldTrackEvent,W=F.shouldTrackActionClick,H=V.clickObservable,J=V.mutationObservable,Q=V.navigateObservable,Y=H.pipe(nJ(function(e){return!B("click",e.closestTrackedAncestor)}),n_(function(e){var t=nM(e.event.target,z.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=K(e.type,e.closestTrackedAncestor)),e}),nJ(n$),nJ(function(e){return W("click",e.closestTrackedAncestor)})),G=[J],Q&&G.push(Q),Z=re.apply(void 0,(0,T.__spreadArray)([],(0,T.__read)(G),!1)),p=Y.pipe((X=function(e){return Z.pipe(rt(1),function(e){var t=rn(e)?{first:e}:"number"==typeof e?{each:e}:e,n=t.first,r=t.each,i=t.with,o=void 0===i?ri:i,s=t.scheduler,u=void 0===s?n0:s,a=t.meta,c=void 0===a?null:a;if(null==n&&null==r)throw TypeError("No timeout provided.");return nh(function(e,t){var i,s,a=null,l=0,d=function(e){s=ny(t,u,function(){try{i.unsubscribe(),nf(o({meta:c,lastValue:a,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};i=e.subscribe(nv(t,function(e){null==s||s.unsubscribe(),l++,t.next(a=e),r>0&&d(r)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),a=null})),l||d(null!=n?"number"==typeof n?n:n-u.now():r)})}({first:500,with:function(){return n2}}),n_(function(){return e}))},nh(function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(nv(t,function(e){null==n||n.unsubscribe();r++;nf(X(e)).subscribe(n=nv(t,function(e){return t.next(e)},function(){n=null,o()}))},function(){i=!0,o()}))}))).subscribe(function(e){null==$||$.track(tU,K("click",e.closestTrackedAncestor))}),c.push(p),null==(g=null==t?void 0:t.loggerProvider)||g.log("".concat(a," has been successfully added.")),window.opener&&u.enabled&&(h=e.cssSelectorAllowlist,v=e.actionClickAllowlist,null==(_=u.messenger)||_.setup((0,T.__assign)((0,T.__assign)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:tM[t.serverZone]}),{isElementSelectable:nC(e,(0,T.__spreadArray)((0,T.__spreadArray)([],(0,T.__read)(h),!1),(0,T.__read)(v),!1)),cssSelectorAllowlist:h,actionClickAllowlist:v}))),[2])})})},execute:function(e){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,T.__generator)(this,function(i){try{for(t=(e=(0,T.__values)(c)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},rs=function(){function e(e){this.request=e}return Object.defineProperty(e.prototype,"headers",{get:function(){if(this._headers)return this._headers;var e=this.request.headers;if(Array.isArray(e))this._headers=e.reduce(function(e,t){var n=(0,T.__read)(t,2),r=n[0],i=n[1];return e[r]=i,e},{});else if(e instanceof Headers){var t={};e.forEach(function(e,n){t[n]=e}),this._headers=t}else"object"==typeof e&&(this._headers=e);return this._headers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=C();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=ra(t,100),this._bodySize}}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),e}(),ru=function(){function e(e){this.body=e}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return ra(this.body,100)},enumerable:!1,configurable:!0}),e}();function ra(e,t){var n,r,i,o,s=C(),u=null==s?void 0:s.TextEncoder;if(u){if("string"==typeof e)o=e,i=new u().encode(o).length;else if(e instanceof Blob)i=(o=e).size;else if(e instanceof URLSearchParams)o=e,i=new u().encode(o.toString()).length;else if(ArrayBuffer.isView(e))i=(o=e).byteLength;else if(e instanceof ArrayBuffer)i=(o=e).byteLength;else if(e instanceof FormData){var a=0,c=0;try{for(var l=(0,T.__values)(e.entries()),d=l.next();!d.done;d=l.next()){var f=(0,T.__read)(d.value,2),p=f[0],h=f[1];if(a+=p.length,"string"==typeof h)a+=new u().encode(h).length;else{if(!(h instanceof Blob))return;a+=h.size}if(++c>=t)return}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}i=a}else if(e instanceof ReadableStream){o=e;return}return i}}var rc=function(){function e(e){this.response=e}return Object.defineProperty(e.prototype,"headers",{get:function(){var e;if(this._headers)return this._headers;if(this.response.headers instanceof Headers){var t=this.response.headers,n={};return null==(e=null==t?void 0:t.forEach)||e.call(t,function(e,t){n[t]=e}),this._headers=n,n}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodySize",{get:function(){if(void 0!==this._bodySize)return this._bodySize;var e,t,n=null==(t=null==(e=this.response.headers)?void 0:e.get)?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e}(),rl=function(){function e(e,t,n){this.statusCode=e,this.headersString=t,this.size=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headers",{get:function(){if(this.headersString){var e,t,n={},r=this.headersString.split("\r\n");try{for(var i=(0,T.__values)(r),o=i.next();!o.done;o=i.next()){var s=o.value,u=(0,T.__read)(s.split(": "),2),a=u[0],c=u[1];a&&c&&(n[a]=c)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n}},enumerable:!1,configurable:!0}),e}(),rd=function(){function e(e,t,n,r,i,o,s,u,a,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=s,this.duration=u,this.responseWrapper=a,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r;return Object.fromEntries(Object.entries({type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null==(e=this.requestWrapper)?void 0:e.headers,requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(n=this.responseWrapper)?void 0:n.headers,responseBodySize:null==(r=this.responseWrapper)?void 0:r.bodySize}).filter(function(e){var t=(0,T.__read)(e,2);return void 0!==(t[0],t[1])}))},e}(),rf=function(e,t){void 0===t&&(t=ei()),this.callback=e,this.id=t},rp=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=C();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=C();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,u,a;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var c=null==(i=null==(r=null==(n=this.globalScope)?void 0:n.XMLHttpRequest)?void 0:r.prototype)?void 0:i.open,l=null==(u=null==(s=null==(o=this.globalScope)?void 0:o.XMLHttpRequest)?void 0:s.prototype)?void 0:u.send;c&&l&&this.observeXhr(c,l);var d=null==(a=this.globalScope)?void 0:a.fetch;d&&this.observeFetch(d),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){var r;try{n.callback(e)}catch(e){null==(r=t.logger)||r.debug("an unexpected error occurred while triggering event callbacks",e)}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){if
1(void 0!==o&&void 0!==s){var u,a,c,l,d="GET";"object"==typeof t&&null!==t&&"url"in t&&"method"in t?(a=t.url,d=t.method):a=null==(u=null==t?void 0:t.toString)?void 0:u.call(t),d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var f=Math.floor(performance.now()-s),p=Math.floor(o+f),h=new rd(e,d,o,o,a,n,c,f,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null==(e=Date.now)?void 0:e.call(Date),durationStart:null==(t=null==performance?void 0:performance.now)?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return(0,T.__awaiter)(t,void 0,void 0,function(){var t,i,o,s,u;return(0,T.__generator)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){null==(s=this.logger)||s.debug("an unexpected error occurred while retrieving timestamps",e)}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new rs(r):void 0,i?new rc(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null==(u=this.logger)||u.debug("an unexpected error occurred while handling fetch",e)}if(i)return[2,i];throw o}})})})},e.prototype.observeXhr=function(e,t){if(this.globalScope&&e&&t){var n=this.globalScope.XMLHttpRequest.prototype,r=this;n.open=function(){for(var t,n,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s=(0,T.__read)(i,2),u=s[0],a=s[1];try{this.$$AmplitudeAnalyticsEvent=(0,T.__assign)({method:u,url:null==(t=null==a?void 0:a.toString)?void 0:t.call(a)},r.getTimestamps())}catch(e){null==(n=r.logger)||n.debug("an unexpected error occurred while calling xhr open",e)}return e.apply(this,i)},n.send=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this,o=e[0],s=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",function(){var e;try{var t=i.getAllResponseHeaders(),n=i.getResponseHeader("content-length"),u=new rl(i.status,t,n?parseInt(n,10):void 0),a=new ru(o);s.status=i.status,r.handleNetworkRequestEvent("xhr",{url:s.url,method:s.method},a,u,void 0,s.startTime,s.durationStart)}catch(t){null==(e=r.logger)||e.debug("an unexpected error occurred while handling xhr send",t)}}),t.apply(i,e)}}},e}()),rh="500-599";function rv(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function rg(e,t){var n,r,i=t.split(",");try{for(var o=(0,T.__values)(i),s=o.next();!s.done;s=o.next()){var u=s.value,a=(0,T.__read)(u.split("-").map(Number),2),c=a[0],l=a[1];if(e===c&&void 0===l||e>=c&&e<=l)return!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function r_(e){var t;if(e)try{var n=null==(t=C())?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,u=r.host;r.hash="",r.search="";var a=r.href;return{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:a,host:u}}catch(e){return}}(k||(k={})).NetworkObservable="networkObservable";var ry=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],i=function(){var e,n=new ni(function(e){var n=new rf(function(t){var n={event:t,timestamp:Date.now(),type:"network"};e.next(n)});return rp.subscribe(n,t),function(){rp.unsubscribe(n)}});return(e={})[k.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(o,s){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var u;return(0,T.__generator)(this,function(a){var c,l,d,f;return"u"<typeof document?[2]:(l=(c={allObservables:i(),networkTrackingOptions:e,amplitude:s}).allObservables,d=c.networkTrackingOptions,f=c.amplitude,u=l.networkObservable.pipe(nJ(function(e){return function(e,t){void 0===t&&(t={});var n,r,i=r_(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(rv(o,"*.amplitude.com")||rv(o,"amplitude.com"))||(null==(n=t.ignoreHosts)?void 0:n.find(function(e){return rv(o,e)})))&&(!!t.captureRules||void 0===e.status||!!rg(e.status,rh))&&(!t.captureRules||((0,T.__spreadArray)([],(0,T.__read)(t.captureRules),!1).reverse().find(function(t){return void 0!==(r=function(e,t,n){if(!e.hosts||e.hosts.find(function(e){return rv(t,e)}))return(!n&&0!==n||!!rg(n,e.statusCodeRange||rh))&&!0}(t,o,e.status))}),!!r))&&!0}(e.event,d)})).subscribe(function(e){var t,n,r,i=e.event,o=r_(i.url);if(o){var s=null==(n=i.responseWrapper)?void 0:n.bodySize,u=null==(r=i.requestWrapper)?void 0:r.bodySize,a=((t={})["[Amplitude] URL"]=o.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=o.query,t["[Amplitude] URL Fragment"]=o.fragment,t["[Amplitude] Request Method"]=i.method,t["[Amplitude] Status Code"]=i.status,t["[Amplitude] Start Time"]=i.startTime,t["[Amplitude] Completion Time"]=i.endTime,t["[Amplitude] Duration"]=i.duration,t["[Amplitude] Request Body Size"]=u,t["[Amplitude] Response Body Size"]=s,t["[Amplitude] Request Type"]=i.type,t);null==f||f.track("[Amplitude] Network Request",a)}}),r.push(u),null==(t=null==o?void 0:o.loggerProvider)||t.log("".concat(n," has been successfully added.")),[2])})})},execute:function(e){return(0,T.__awaiter)(void 0,void 0,void 0,function(){return(0,T.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,i;return(0,T.__generator)(this,function(o){try{for(t=(e=(0,T.__values)(r)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}},rm="dclid",rb="fbclid",rw="gbraid",rE="gclid",rS="ko_click_id",rI="li_fat_id",rk="msclkid",rT="rtd_cid",rP="ttclid",rO="twcli
1d",rA="wbraid",rR={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},rx=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rC=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,s=(0,T.__rest)(e,["referrer","referring_domain"]),u=t||{},a=(u.referrer,u.referring_domain),c=(0,T.__rest)(u,["referrer","referring_domain"]);if(rN(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&Object.values(e).every(function(e){return!e})&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var l=JSON.stringify(s)!==JSON.stringify(c),d=rx(o||"")!==rx(a||""),f=!t||l||d;return f?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),f},rN=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})},rU=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},rL=function(){function e(){}return e.prototype.parse=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(e){return[2,(0,T.__assign)((0,T.__assign)((0,T.__assign)((0,T.__assign)({},rR),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=N();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.split("/")[2])?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=N();return(e={})[rm]=t[rm],e[rb]=t[rb],e[rw]=t[rw],e[rE]=t[rE],e[rS]=t[rS],e[rI]=t[rI],e[rk]=t[rk],e[rT]=t[rT],e[rP]=t[rP],e[rO]=t[rO],e[rA]=t[rA],e},e}(),rq=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=(0,T.__assign)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:rU(null==(n=t.cookieOptions)?void 0:n.domain)},e),this.storage=t.cookieStorage,this.storageKey=(r=t.apiKey,void 0===i&&(i=10),[J.r,"MKTG",r.substring(0,i)].filter(Boolean).join("_")),this.currentCampaign=rR,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,T.__generator)(this,function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:if(t=T.__read.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||ed(this.sessionTimeout,this.lastEventTime),!rC(this.currentCampaign,this.previousCampaign,this.options,this.logger,e))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return(0,T.__awaiter)(this,void 0,void 0,function(){return(0,T.__generator)(this,function(e){switch(e.label){case 0:return[4,Promise.all([new rL().parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r=(t=this.currentCampaign,n=this.options,ep(Object.entries((0,T.__assign)((0,T.__assign)({},rR),t)).reduce(function(e,t){var r,i=(0,T.__read)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!=(r=null!=s?s:n.initialEmptyValue)?r:"EMPTY"),s)?e.set(o,s):e.unset(o)},new ea.T$)));return e&&(r.event_id=e),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),rD=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,T.__extends)(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>
12?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),x(this._init((0,T.__assign)((0,T.__assign)({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i;return(0,T.__awaiter)(this,void 0,void 0,function(){var o,s,u,a,c,l=this;return(0,T.__generator)(this,function(d){var f,p,h,v,g;switch(d.label){case 0:if(this.initializing)return[2];return this.initializing=!0,[4,(f=t.apiKey,p=t,h=this,void 0===p&&(p={}),(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,u,a,c,l,d,v,g,_,y,m,b,w,E,S,I,k,P,O,A,R,x,C,U,L,q,D,j,M,F,$,V,z,K,B,W,H;return(0,T.__generator)(this,function(Q){switch(Q.label){case 0:if(e=p.identityStorage||e6,w={},e===e6)return[3,1];return n="",[3,5];case 1:if(null==(S=null==(E=p.cookieOptions)?void 0:E.domain))return[3,2];return r=S,[3,4];case 2:return[4,(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,i,o;return(0,T.__generator)(this,function(s){switch(s.label){case 0:return[4,new eN().isEnabled()];case 1:if(!s.sent()||"u"<typeof location||!location.hostname)return[2,""];for(e=(0,location.hostname).split("."),t=[],n="AMP_TLDTEST",r=e.length-2;r>=0;--r)t.push(e.slice(r).join("."));r=0,s.label=2;case 2:if(!(r<t.length))return[3,7];return[4,(o=new eN({domain:"."+(i=t[r])})).set(n,1)];case 3:return s.sent(),[4,o.get(n)];case 4:if(!s.sent())return[3,6];return[4,o.remove(n)];case 5:return s.sent(),[2,"."+i];case 6:return r++,[3,2];case 7:return[2,""]}})})];case 3:r=Q.sent(),Q.label=4;case 4:n=r,Q.label=5;case 5:var Y,G;return t=T.__assign.apply(void 0,[(w.domain=n,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w),p.cookieOptions]),[4,(Y=i=e9(p.identityStorage,t),void 0===(G=null==(k=null==(I=p.cookieOptions)?void 0:I.upgrade)||k)&&(G=!0),(0,T.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,u,a;return(0,T.__generator)(this,function(c){switch(c.label){case 0:return e="".concat(J.r.toLowerCase(),"_").concat(f.substring(0,6)),[4,Y.getRaw(e)];case 1:if(!(t=c.sent()))return[2,{optOut:!1}];if(!G)return[3,3];
1return[4,Y.remove(e)];case 2:c.sent(),c.label=3;case 3:return r=(n=(0,T.__read)(t.split("."),6))[0],i=n[1],o=n[2],s=n[3],u=n[4],a=n[5],[2,{deviceId:r,userId:eK(i),sessionId:ez(s),lastEventId:ez(a),lastEventTime:ez(u),optOut:!!o}]}})}))];case 6:return o=Q.sent(),[4,i.get(eC(f))];case 7:return s=Q.sent(),u=N(),a=null!=(x=null!=(R=null!=(A=null!=(O=null!=(P=p.deviceId)?P:u.ampDeviceId)?O:u.deviceId)?A:null==s?void 0:s.deviceId)?R:o.deviceId)?x:ei(),c=null!=(C=null==s?void 0:s.lastEventId)?C:o.lastEventId,l=null!=(U=null==s?void 0:s.lastEventTime)?U:o.lastEventTime,d=null!=(q=null!=(L=p.optOut)?L:null==s?void 0:s.optOut)?q:o.optOut,v=null!=(D=null==s?void 0:s.sessionId)?D:o.sessionId,g=null!=(M=null!=(j=p.userId)?j:null==s?void 0:s.userId)?M:o.userId,h.previousSessionDeviceId=null!=(F=null==s?void 0:s.deviceId)?F:o.deviceId,h.previousSessionUserId=null!=($=null==s?void 0:s.userId)?$:o.userId,_={ipAddress:null==(z=null==(V=p.trackingOptions)?void 0:V.ipAddress)||z,language:null==(B=null==(K=p.trackingOptions)?void 0:K.language)||B,platform:null==(H=null==(W=p.trackingOptions)?void 0:W.platform)||H},y=null==s?void 0:s.pageCounter,m=null==s?void 0:s.debugLogsEnabled,void 0!==p.autocapture&&(p.defaultTracking=p.autocapture),[4,(b=new e5(f,p.appVersion,i,t,p.defaultTracking,p.autocapture,a,p.flushIntervalMillis,p.flushMaxRetries,p.flushQueueSize,e,p.ingestionMetadata,p.instanceName,c,l,p.loggerProvider,p.logLevel,p.minIdLength,p.offline,d,p.partnerId,p.plan,p.serverUrl,p.serverZone,v,p.sessionTimeout,p.storageProvider,_,p.transport,p.useBatch,p.fetchRemoteConfig,g,y,m,p.networkTrackingOptions)).storageProvider.isEnabled()];case 8:return Q.sent()||(b.loggerProvider.warn("Storage provider ".concat(b.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),b.storageProvider=new ex),[2,b]}})}))];case 1:if(!(o=d.sent()).fetchRemoteConfig)return[3,4];return[4,(v=o,(0,T.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,T.__generator)(this,function(t){switch(t.label){case 0:return[4,(e=new tx(v)).initialize()];case 1:return t.sent(),[2,e]}})}))];case 2:return[4,d.sent().generateJoinedConfig()];case 3:o=d.sent(),d.label=4;case 4:return[4,e.prototype._init.call(this,o)];case 5:if(d.sent(),this.logBrowserOptions(o),!ey(this.config.defaultTracking))return[3,7];return s=ey((g=this.config).defaultTracking)&&g.defaultTracking&&"object"==typeof g.defaultTracking&&g.defaultTracking.attribution&&"object"==typeof g.defaultTracking.attribution?(0,T.__assign)({},g.defaultTracking.attribution):{},this.webAttribution=new rq(s,this.config),[4,this.webAttribution.init()];case 6:d.sent(),d.label=7;case 7:if(a=Number.isNaN(Number((u=N()).ampSessionId))?void 0:Number(u.ampSessionId),this.setSessionId(null!=(i=null!=(r=null!=(n=t.sessionId)?n:a)?r:this.config.sessionId)?i:Date.now()),(c=B(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,9];return[4,this.add(tT()).promise];case 8:d.sent(),d.label=9;case 9:return[4,this.add(new es).promise];case 10:return d.sent(),[4,this.add(new eR).promise];case 11:return d.sent(),[4,this.add(new eu).promise];case 12:if(d.sent(),tk(this.config),!e_(this.config.defaultTracking,"fileDownloads"))return[3,14];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(tS()).promise];case 13:d.sent(),d.label=14;case 14:if(!e_(this.config.defaultTracking,"formInteractions"))return[3,16];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(tb()).promise];case 15:d.sent(),d.label=16;case 16:if(!em(this.config.defaultTracking))return[3,18];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(tg(ek(this.config))).promise];case 17:d.sent(),d.label=18;case 18:if(!eE(this.config.autocapture))return[3,20];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(ro(eS(this.config))).promise];case 19:d.sent(),d.label=20;case 20:if(!ew(this.config.autocapture))return[3,22];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ry(eI(this.config))).promise];case 21:d.sent(),d.label=22;case 22:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 23:return d.sent(),c.eventBridge.setEventReceiver(function(e){l.track(e.eventType,e.eventProperties)}),[2]}})})},t.prototype.getUserId=function(){var e;return null==(e=this.config)?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),W(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null==(e=this.config)?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),H(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(ei()),this.setUserId(void 0)},t.prototype.getSessionId=function(){var e;return null==(e=this.config)?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),x(Promise.resolve());if(e===this.config.sessionId)return x(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!=(t=this.config.lastEventId)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,eb(this.config.defaultTracking)&&(r&&i&&n.push(this.track(eY,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return eb(this.config.defaultTracking)&&n.push(this.track(eQ,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,x(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=
1Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=e8(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(eP(t)){var r=t._q;t._q=[],t=eT(new ea.T$,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(eP(r)){var o=r._q;r._q=[],r=eT(new ea.T$,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(eP(t)){var r=t._q;t._q=[],t=eT(new el,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,T.__awaiter)(this,void 0,void 0,function(){var n,r,i;return(0,T.__generator)(this,function(o){return n=Date.now(),r=ed(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==eQ&&t.event_type!==eY&&(!t.session_id||t.session_id===this.getSessionId())&&(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,T.__assign)((0,T.__assign)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t}(eg),rj=function(){var e=new rD;return{init:R(e.init.bind(e),"init",P(e),A(e,["config"])),add:R(e.add.bind(e),"add",P(e),A(e,["config.apiKey","timeline.plugins"])),remove:R(e.remove.bind(e),"remove",P(e),A(e,["config.apiKey","timeline.plugins"])),track:R(e.track.bind(e),"track",P(e),A(e,["config.apiKey","timeline.queue.length"])),logEvent:R(e.logEvent.bind(e),"logEvent",P(e),A(e,["config.apiKey","timeline.queue.length"])),identify:R(e.identify.bind(e),"identify",P(e),A(e,["config.apiKey","timeline.queue.length"])),groupIdentify:R(e.groupIdentify.bind(e),"groupIdentify",P(e),A(e,["config.apiKey","timeline.queue.length"])),setGroup:R(e.setGroup.bind(e),"setGroup",P(e),A(e,["config.apiKey","timeline.queue.length"])),revenue:R(e.revenue.bind(e),"revenue",P(e),A(e,["config.apiKey","timeline.queue.length"])),flush:R(e.flush.bind(e),"flush",P(e),A(e,["config.apiKey","timeline.queue.length"])),getUserId:R(e.getUserId.bind(e),"getUserId",P(e),A(e,["config","config.userId"])),setUserId:R(e.setUserId.bind(e),"setUserId",P(e),A(e,["config","config.userId"])),getDeviceId:R(e.getDeviceId.bind(e),"getDeviceId",P(e),A(e,["config","config.deviceId"])),setDeviceId:R(e.setDeviceId.bind(e),"setDeviceId",P(e),A(e,["config","config.deviceId"])),reset:R(e.reset.bind(e),"reset",P(e),A(e,["config","config.userId","config.deviceId"])),getSessionId:R(e.getSessionId.bind(e),"getSessionId",P(e),A(e,["config"])),setSessionId:R(e.setSessionId.bind(e),"setSessionId",P(e),A(e,["config"])),extendSession:R(e.extendSession.bind(e),"extendSession",P(e),A(e,["config"])),setOptOut:R(e.setOptOut.bind(e),"setOptOut",P(e),A(e,["config"])),setTransport:R(e.setTransport.bind(e),"setTransport",P(e),A(e,["config"]))}};rj()},3023:(e,t,n)=>{var r,i;n.d(t,{e:()=>r}),(i=r||(r={})).US="US",i.EU="EU",i.STAGING="STAGING"},20602:(e,t,n)=>{n.d(t,{OP:()=>c,bu:()=>u,fS:()=>o,mG:()=>r,mJ:()=>s,pL:()=>a,r:()=>i});var r="-",i="AMP",o="".concat(i,"_unsent"),s="https://api2.amplitude.com/2/httpapi",u="https://api.eu.amplitude.com/2/httpapi",a="https://api2.amplitude.com/batch",c="https://api.eu.amplitude.com/batch"},84949:(e,t,n)=>{n.d(t,{E:()=>o,a:()=>i});var r=n(30356),i=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!o(t,n))return!1}return!0},o=function(e,t){var n,o;if("string"!=typeof e)return!1;if(Array.isArray(t)){var s=!0;try{for(var u=(0,r.__values)(t),a=u.next();!a.done;a=u.next()){var c=a.value;if(Array.isArray(c))return!1;if("object"==typeof c)s=s&&i(c);else if(!["number","string"].includes(typeof c))return!1;if(!s)return!1}}catch(e){n={error:e}}
1finally{try{a&&!a.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}else if(null==t)return!1;else if("object"==typeof t)return i(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0}},98771:(e,t,n)=>{n.d(t,{Se:()=>c,T$:()=>a});var r,i,o=n(30356),s=n(20602),u=n(84949),a=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,o.__assign)({},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,s.mG),this},e.prototype.clearAll=function(){return this._properties={},this._properties[i.CLEAR_ALL]=s.mG,this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return!(void 0!==this._properties[i.CLEAR_ALL]||this._propertySet.has(t))&&(e===i.ADD?"number"==typeof n:e===i.UNSET||e===i.REMOVE||(0,u.E)(t,n))},e}();(r=i||(i={})).SET="$set",r.SET_ONCE="$setOnce",r.ADD="$add",r.APPEND="$append",r.PREPEND="$prepend",r.REMOVE="$remove",r.PREINSERT="$preInsert",r.POSTINSERT="$postInsert",r.UNSET="$unset",r.CLEAR_ALL="$clearAll";var c=[i.CLEAR_ALL,i.UNSET,i.SET,i.SET_ONCE,i.ADD,i.APPEND,i.PREPEND,i.PREINSERT,i.POSTINSERT,i.REMOVE]}}]);
2//# sourceMappingURL=8879-f256c61b7c17ec0f.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.