choco-one-click-payment 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/780.index.esm.js +1 -0
- package/780.index.js +1 -0
- package/README.md +2 -6
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +5 -1
package/780.index.esm.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkchoco_one_click_payment=self.webpackChunkchoco_one_click_payment||[]).push([[780],{780:function(e,t,n){n.d(t,{createInstance:function(){return gt}});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o,s=function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)};function u(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,u)}a((i=i.apply(e,t||[])).next())})}function c(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function l(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function f(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(o||(o={}));var p,v=function(e){return function(){var t=s({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},h=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=l(t.split(".")),o=r.next();!o.done;o=r.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},g=function(e,t){return function(){var n,i,r={};try{for(var o=l(t),s=o.next();!s.done;s=o.next()){var u=s.value;r[u]=h(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},y=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];var a=n(),c=a.logger,l=a.logLevel;if(l&&l<o.Debug||!l||!c)return e.apply(r,s);var d,f={type:"invoke public method",name:t,args:s,stacktrace:(d=1,void 0===d&&(d=0),((new Error).stack||"").split("\n").slice(2+d).map(function(e){return e.trim()})),time:{start:(new Date).toISOString()},states:{}};i&&f.states&&(f.states.before=i());var p=e.apply(r,s);return p&&p.promise?p.promise.then(function(){i&&f.states&&(f.states.after=i()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))}):(i&&f.states&&(f.states.after=i()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))),p}},m=function(e){return{promise:e||Promise.resolve()}};!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(p||(p={}));var b="AMP",_="".concat(b,"_unsent"),I="https://api2.amplitude.com/2/httpapi",w=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=p.Unknown),{event:e,code:t,message:n}},S="Amplitude Logger ",E=function(){function e(){this.logLevel=o.None}return e.prototype.disable=function(){this.logLevel=o.None},e.prototype.enable=function(e){void 0===e&&(e=o.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Verbose||console.log("".concat(S,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Warn||console.warn("".concat(S,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Error||console.error("".concat(S,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Debug||console.log("".concat(S,"[Debug]: ").concat(e.join(" ")))},e}(),T=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:o.Warn,loggerProvider:new E,offline:!1,optOut:!1,serverUrl:I,serverZone:"US",useBatch:!1}},k=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=T();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=P(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),O=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":I},P=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=T().serverZone),void 0===n&&(n=T().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:T().serverZone;return{serverZone:i,serverUrl:O(i,n)}},R=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,R)};function x(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var L,U,N,D=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return a(this,void 0,void 0,function(){var n,i=this;return c(this,function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(_,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=r.sent())&&n.length>0&&Promise.all(n.map(function(e){return i.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=R()),new Promise(function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)})},e.prototype.getTryableList=function(e){var t=this;return e.filter(function(e){return e.attempts<t.config.flushMaxRetries?(e.attempts+=1,!0):(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleTryable=function(e,t){var n=this;void 0===t&&(t=!1),e.forEach(function(e){t&&(n.queue=n.queue.concat(e)),0!==e.timeout?setTimeout(function(){e.timeout=0,n.schedule(0)},e.timeout):n.schedule(n.config.flushIntervalMillis)})},e.prototype.addToQueue=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.getTryableList(e);this.scheduleTryable(n,!0),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,function(){var t,n,i,r=this;return c(this,function(o){switch(o.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce(function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e},[]),[4,Promise.all(i.map(function(t){return r.send(t,e)}))]);case 1:return o.sent(),this.scheduleTryable(n),[2]}var s,u,a})})},e.prototype.send=function(e,t){return void 0===t&&(t=!0),a(this,void 0,void 0,function(){var n,i,r,o,s;return c(this,function(a){switch(a.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,u(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString()},a.label=1;case 1:return a.trys.push([1,3,,4]),i=P(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:return null===(r=a.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(r,e),[3,4]):("body"in r?this.fulfillRequest(e,r.statusCode,"".concat(r.status,": ").concat(x(r))):this.fulfillRequest(e,r.statusCode,r.status),[2]);case 3:return o=a.sent(),s=(c=o)instanceof Error?c.message:String(c),this.config.loggerProvider.error(s),this.fulfillRequest(e,0,s),[3,4];case 4:return[2]}var c})})},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case p.Success:this.handleSuccessResponse(e,t);break;case p.Invalid:this.handleInvalidResponse(e,t);break;case p.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case p.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var i=f(f(f(f([],d(Object.values(e.body.eventsWithInvalidFields)),!1),d(Object.values(e.body.eventsWithMissingFields)),!1),d(Object.values(e.body.eventsWithInvalidIdLengths)),!1),d(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter(function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(x(e));var s=this.getTryableList(o);this.scheduleTryable(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(x(e)),this.config.flushQueueSize/=2;var n=this.getTryableList(t);this.scheduleTryable(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),u=new Set(r),a=new Set(o),c=t.filter(function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(x(e));var l=this.getTryableList(c);this.scheduleTryable(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),i=this.getTryableList(n);this.scheduleTryable(i)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach(function(e){return e.callback(w(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}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(L||(L={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(U||(U={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(N||(N={}));var q=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!A(t,n))return!1}return!0},A=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=l(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)r=r&&q(u);else if(!["number","string"].includes(typeof u))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return q(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},C=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return s({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(L.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(L.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(L.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(L.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(L.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(L.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(L.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(L.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(L.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[L.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[L.CLEAR_ALL]&&!this._propertySet.has(t)&&(e===L.ADD?"number"==typeof n:e===L.UNSET||e===L.REMOVE||A(t,n))},e}(),j=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return q(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?s({},this.properties):{};return e[U.REVENUE_PRODUCT_ID]=this.productId,e[U.REVENUE_QUANTITY]=this.quantity,e[U.REVENUE_PRICE]=this.price,e[U.REVENUE_TYPE]=this.revenueType,e[U.REVENUE]=this.revenue,e},e}(),M=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,r;return a(this,void 0,void 0,function(){return c(this,function(o){switch(o.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:R(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)];case 1:return o.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e){var t;return a(this,void 0,void 0,function(){var n,i;return c(this,function(r){switch(r.label){case 0:return n=this.plugins.findIndex(function(t){return t.name===e}),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}})})},e.prototype.reset=function(e){this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return a(this,void 0,void 0,function(){var t,n,i,r,o,u,a,f,p,v,h,g,y,m,b,_,I,S,E,T;return c(this,function(c){switch(c.label){case 0:if(!e)return[2];t=d(e,1),n=t[0],i=d(e,2),r=i[1],o=this.plugins.filter(function(e){return"before"===e.type}),c.label=1;case 1:c.trys.push([1,6,7,8]),u=l(o),a=u.next(),c.label=2;case 2:return a.done?[3,5]:(g=a.value).execute?[4,g.execute(s({},n))]:[3,4];case 3:if(null===(y=c.sent()))return r({event:n,code:0,message:""}),[2];n=y,c.label=4;case 4:return a=u.next(),[3,2];case 5:return[3,8];case 6:return f=c.sent(),I={error:f},[3,8];case 7:try{a&&!a.done&&(S=u.return)&&S.call(u)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),c.label=9;case 9:c.trys.push([9,14,15,16]),v=l(p),h=v.next(),c.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(s({},n))]:[3,12];case 11:if(null===(y=c.sent()))return r({event:n,code:0,message:""}),[2];n=y,c.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=c.sent(),E={error:m},[3,16];case 15:try{h&&!h.done&&(T=v.return)&&T.call(v)}finally{if(E)throw E.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),_=b.map(function(e){var t=s({},n);return e.execute(t).catch(function(e){return w(t,0,String(e))})}),Promise.all(_).then(function(e){var t=d(e,1)[0]||w(n,100,"Event not tracked, no destination plugins on the instance");r(t)}),[2]}})})},e.prototype.flush=function(){return a(this,void 0,void 0,function(){var e,t,n,i=this;return c(this,function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return i.apply(e)}))];case 1:return r.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return r.sent(),[2]}})})},e}(),V=function(e,t){return s(s({},t),{event_type:N.IDENTIFY,user_properties:e.getUserProperties()})},F=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new M(this),this.name=e}return e.prototype._init=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e){return a(this,void 0,void 0,function(){var t,n,i,r,o,s;return c(this,function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,6,7,8]),n=l(t),i=n.next(),u.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=u.sent(),o={error:r},[3,8];case 7:try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.track=function(e,t,n){var i=function(e,t,n){return s(s(s({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return m(this.dispatch(i))},e.prototype.identify=function(e,t){var n=V(e,t);return m(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var r=function(e,t,n,i){var r;return s(s({},i),{event_type:N.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n,i);return m(this.dispatch(r))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,r=new C;return r.set(e,t),s(s({},n),{event_type:N.IDENTIFY,user_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return m(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return s(s({},t),{event_type:N.REVENUE,event_properties:e.getEventProperties()})}(e,t);return m(this.dispatch(n))},e.prototype.add=function(e){return this.config?m(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),m())},e.prototype.remove=function(e){return this.config?m(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),m())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(w(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return a(this,void 0,void 0,function(){var t=this;return c(this,function(n){return this.config?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.process=function(e){return a(this,void 0,void 0,function(){var t,n,i;return c(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,w(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=w(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return m(this.timeline.flush())},e}(),$=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:K(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),K=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Q=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}(),B=function(){return B=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},B.apply(this,arguments)},z=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++)if(r[i]===n)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!z(u,a))return!1;var c=!0;return Object.keys(e).forEach(function(n){z(e[n],t[n])||(c=!1)}),c}for(var l=0;l<e.length;l++)if(!z(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var W=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=B({},this.identity.userProperties),n=B(B({},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){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++)delete t[d=v[p]];break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return B({},this.identity)},e.prototype.setIdentity=function(e){var t=B({},this.identity);this.identity=B({},e),z(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}(),J="undefined"!=typeof globalThis?globalThis:void 0!==n.g?n.g:self,Y=function(){function e(){this.identityStore=new W,this.eventBridge=new Q,this.applicationContextProvider=new $}return e.getInstance=function(t){return J.analyticsConnectorInstances||(J.analyticsConnectorInstances={}),J.analyticsConnectorInstances[t]||(J.analyticsConnectorInstances[t]=new e),J.analyticsConnectorInstances[t]},e}(),Z=function(e){return void 0===e&&(e="$default_instance"),Y.getInstance(e)},G=function(){function e(){this.name="identity",this.type="before",this.identityStore=Z().identityStore}return e.prototype.execute=function(e){return a(this,void 0,void 0,function(){var t;return c(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){return e.instanceName&&(this.identityStore=Z(e.instanceName).identityStore),[2]})})},e}(),H=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},X=function(e){return H(e,"attribution")},ee=function(e){return H(e,"pageViews")},te=function(e){var t,n=function(){return!1},i=void 0,r=e.pageCounter;return ee(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&&(i=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:i,eventType:t,pageCounter:r}},ne=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ie=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},re=function(e){return e&&void 0!==e._q},oe=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:r)&&void 0!==i?i:""},se=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.6.2"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return a(this,void 0,void 0,function(){var i,r,o;return c(this,function(u){return i=(new Date).getTime(),r=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:r+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=i),[2,s(s(s(s(s(s(s(s({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:oe()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:R(),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}(),ue=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return a(this,void 0,void 0,function(){return c(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return a(this,void 0,void 0,function(){var t;return c(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 a(this,void 0,void 0,function(){return c(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return a(this,void 0,void 0,function(){return c(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),ae=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[b,t,e.substring(0,n)].filter(Boolean).join("_")},ce=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==n.g?n.g:void 0},le=function(){var e,t=ce();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),i=de(n[0]),r=de(n[1]);return r?(e[i]=r,e):e},{}):{}},de=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},fe=function(){function e(e){this.options=s({},e)}return e.prototype.isEnabled=function(){return a(this,void 0,void 0,function(){var t,n;return c(this,function(i){switch(i.label){case 0:if(!ce())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return a(this,void 0,void 0,function(){var t;return c(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}}})})},e.prototype.getRaw=function(e){var t,n;return a(this,void 0,void 0,function(){var i,r,o;return c(this,function(s){return i=ce(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(o=r.find(function(t){return 0===t.indexOf(e+"=")}))?[2,o.substring(e.length+1)]:[2,void 0]})})},e.prototype.set=function(e,t){var n;return a(this,void 0,void 0,function(){var i,r,o,s,u,a;return c(this,function(c){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((s=new Date).setTime(s.getTime()+24*r*60*60*1e3),o=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(a=ce())&&(a.document.cookie=u)}catch(e){}return[2]})})},e.prototype.remove=function(e){return a(this,void 0,void 0,function(){return c(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 a(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e}(),pe=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,v,h,g,y,m,b,_,I,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case p.Success:return{status:T,statusCode:E,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(i=e.server_upload_time)&&void 0!==i?i:0}};case p.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case p.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case p.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case p.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?p.Success:429===e?p.RateLimit:413===e?p.PayloadTooLarge:408===e?p.Timeout:e>=400&&e<500?p.Invalid:e>=500?p.Failed:p.Unknown},e}(),ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,function(){var n,i;return c(this,function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}})})},t}(pe),he=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return a(this,void 0,void 0,function(){var t,n,i;return c(this,function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return a(this,void 0,void 0,function(){var t;return c(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return a(this,void 0,void 0,function(){return c(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return a(this,void 0,void 0,function(){return c(this,function(i){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return a(this,void 0,void 0,function(){return c(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return a(this,void 0,void 0,function(){return c(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),ge=1e3,ye=function(e){function t(t){var n,i=this;return(i=e.call(this,null===(n=ce())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return r(t,e),t.prototype.set=function(t,n){var i;return a(this,void 0,void 0,function(){var r;return c(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>ge?(r=n.length-ge,[4,e.prototype.set.call(this,t,n.slice(0,ge))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(ge,".")),[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}(he),me=function(e){function t(){var t;return e.call(this,null===(t=ce())||void 0===t?void 0:t.sessionStorage)||this}return r(t,e),t}(he),be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return r(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,function(){var n=this;return c(this,function(i){return[2,new Promise(function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))})]})})},t}(pe),_e=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,function(){var n=this;return c(this,function(i){return[2,new Promise(function(i,r){var o=ce();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}})]})})},t}(pe),Ie=function(e,t,n){return void 0===n&&(n=!0),a(void 0,void 0,void 0,function(){var i,r,o,s,u,a,l,f,p;return c(this,function(c){switch(c.label){case 0:return i=function(e){return"".concat(b.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=c.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:c.sent(),c.label=3;case 3:return o=d(r.split("."),6),s=o[0],u=o[1],a=o[2],l=o[3],f=o[4],p=o[5],[2,{deviceId:s,userId:Se(u),sessionId:we(l),lastEventId:we(p),lastEventTime:we(f),optOut:Boolean(a)}]}})})},we=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Se=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ee="[Amplitude]",Te=("".concat(Ee," Page Viewed"),"".concat(Ee," Form Started")),ke="".concat(Ee," Form Submitted"),Oe="".concat(Ee," File Downloaded"),Pe="session_start",Re="session_end",xe="".concat(Ee," File Extension"),Le="".concat(Ee," File Name"),Ue="".concat(Ee," Link ID"),Ne="".concat(Ee," Link Text"),De="".concat(Ee," Link URL"),qe="".concat(Ee," Form ID"),Ae="".concat(Ee," Form Name"),Ce="".concat(Ee," Form Destination"),je="cookie",Me=function(e){function t(t,n,i,r,s,u,a,c,l,d,f,p,v,h,g,y,m,b,_,I,w,S,T,k,O,P,R,x,L,U,N){void 0===i&&(i=new ue),void 0===r&&(r={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=je),void 0===g&&(g=new E),void 0===y&&(y=o.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===S&&(S=""),void 0===T&&(T="US"),void 0===O&&(O=18e5),void 0===P&&(P=new ye({loggerProvider:g})),void 0===R&&(R={ipAddress:!0,language:!0,platform:!0}),void 0===x&&(x="fetch"),void 0===L&&(L=!1);var D=e.call(this,{apiKey:t,storageProvider:P,transportProvider:$e(x)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=r,D.defaultTracking=s,D.flushIntervalMillis=a,D.flushMaxRetries=c,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=f,D.instanceName=p,D.loggerProvider=g,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=I,D.plan=w,D.serverUrl=S,D.serverZone=T,D.sessionTimeout=O,D.storageProvider=P,D.trackingOptions=R,D.transport=x,D.useBatch=L,D._optOut=!1,D._cookieStorage=i,D.deviceId=u,D.lastEventId=v,D.lastEventTime=h,D.optOut=_,D.sessionId=k,D.pageCounter=N,D.userId=U,D.loggerProvider.enable(D.logLevel),D}return r(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),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}),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};this.cookieStorage.set(ae(this.apiKey),e)},t}(k),Ve=function(e,t,n){return void 0===t&&(t={}),a(void 0,void 0,void 0,function(){var i,r,o,u,a,l,d,f,p,v,h,g,y,m,b,_,I,w,S,E,T,k,O,P,x,L,U,N,D,q,A,C,j,M,V,F,$,K,Q,B;return c(this,function(c){switch(c.label){case 0:return i=t.identityStorage||je,I={},i===je?[3,1]:(o="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(u=S,[3,4]);case 2:return[4,Ke()];case 3:u=c.sent(),c.label=4;case 4:o=u,c.label=5;case 5:return r=s.apply(void 0,[(I.domain=o,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),a=Fe(t.identityStorage,r),[4,Ie(e,a,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=c.sent(),[4,a.get(ae(e))];case 7:return d=c.sent(),f=le(),p=null!==(x=null!==(P=null!==(O=null!==(k=t.deviceId)&&void 0!==k?k:f.deviceId)&&void 0!==O?O:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==x?x:R(),v=null!==(L=null==d?void 0:d.lastEventId)&&void 0!==L?L:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,g=null!==(D=null!==(N=t.optOut)&&void 0!==N?N:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,y=null!==(q=null==d?void 0:d.sessionId)&&void 0!==q?q:l.sessionId,m=null!==(C=null!==(A=t.userId)&&void 0!==A?A:null==d?void 0:d.userId)&&void 0!==C?C:l.userId,n.previousSessionDeviceId=null!==(j=null==d?void 0:d.deviceId)&&void 0!==j?j:l.deviceId,n.previousSessionUserId=null!==(M=null==d?void 0:d.userId)&&void 0!==M?M:l.userId,b={ipAddress:null===(F=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===F||F,language:null===(K=null===($=t.trackingOptions)||void 0===$?void 0:$.language)||void 0===K||K,platform:null===(B=null===(Q=t.trackingOptions)||void 0===Q?void 0:Q.platform)||void 0===B||B},_=null==d?void 0:d.pageCounter,[2,new Me(e,t.appVersion,a,r,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,b,t.transport,t.useBatch,m,_)]}})})},Fe=function(e,t){switch(void 0===e&&(e=je),void 0===t&&(t={}),e){case"localStorage":return new ye;case"sessionStorage":return new me;case"none":return new ue;default:return new fe(s(s({},t),{expirationDays:t.expiration}))}},$e=function(e){return"xhr"===e?new be:"beacon"===e?new _e:new ve},Ke=function(e){return a(void 0,void 0,void 0,function(){var t,n,i,r,o,s,u;return c(this,function(a){switch(a.label){case 0:return[4,(new fe).isEnabled()];case 1:if(!a.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",o=n.length-2;o>=0;--o)i.push(n.slice(o).join("."));o=0,a.label=2;case 2:return o<i.length?(s=i[o],[4,(u=new fe({domain:"."+s})).set(r,1)]):[3,7];case 3:return a.sent(),[4,u.get(r)];case 4:return a.sent()?[4,u.remove(r)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}})})},Qe="dclid",Be="fbclid",ze="gbraid",We="gclid",Je="ko_click_id",Ye="li_fat_id",Ze="msclkid",Ge="rtd_cid",He="ttclid",Xe="twclid",et="wbraid",tt={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},nt=function(){function e(){}return e.prototype.parse=function(){return a(this,void 0,void 0,function(){return c(this,function(e){return[2,s(s(s(s({},tt),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=le();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=le();return(e={})[Qe]=t[Qe],e[Be]=t[Be],e[ze]=t[ze],e[We]=t[We],e[Je]=t[Je],e[Ye]=t[Ye],e[Ze]=t[Ze],e[Ge]=t[Ge],e[He]=t[He],e[Xe]=t[Xe],e[et]=t[et],e},e}(),it=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rt=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})},ot=function(e){var t=this;void 0===e&&(e={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,n){var i;return a(this,void 0,void 0,function(){var r,o,a,l,f,p,v,h;return c(this,function(c){switch(c.label){case 0:return r=s({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(_=null===(i=t.cookieOptions)||void 0===i?void 0:i.domain,I=_,I?(I.startsWith(".")&&(I=I.substring(1)),[new RegExp("".concat(I.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),o=t.cookieStorage,g=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),a=[b,y,g.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new nt).parse(),o.get(a)])];case 1:return l=d.apply(void 0,[c.sent(),2]),f=l[0],p=l[1],v=ne(t.sessionTimeout,t.lastEventTime),function(e,t,n,i){void 0===i&&(i=!0),e.referrer;var r=e.referring_domain,o=u(e,["referrer","referring_domain"]),s=t||{},a=(s.referrer,s.referring_domain),c=u(s,["referrer","referring_domain"]);if(rt(n.excludeReferrers,e.referring_domain))return!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return!1;var l=JSON.stringify(o)!==JSON.stringify(c),d=it(r||"")!==it(a||"");return!t||l||d}(f,p,r,v)&&(r.resetSessionOnNewCampaign&&(n.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),h=function(e,t){var n=s(s({},tt),e),i=Object.entries(n).reduce(function(e,n){var i,r=d(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)},new C);return V(i)}(f,r),n.track(h),o.set(a,f)),[2]}var g,y,m,_,I})})},execute:function(e){return a(t,void 0,void 0,function(){return c(this,function(t){return[2,e]})})}};return n},st=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},ut=function(e){var t;void 0===e&&(e={});var n,i,r=ce(),o=void 0,u=function(){return a(void 0,void 0,void 0,function(){var t,n,r;return c(this,function(o){switch(o.label){case 0:return i.pageCounter=i.pageCounter?i.pageCounter+1:1,n={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,at()];case 1:return[2,(n.event_properties=s.apply(void 0,[s.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||"","[Amplitude] Page Counter":i.pageCounter}]),n)]}})})},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},f="undefined"!=typeof location?location.href:null,p=function(){return a(void 0,void 0,void 0,function(){var n,i,r,s;return c(this,function(a){switch(a.label){case 0:return n=location.href,i=lt(e.trackHistoryChanges,n,f||"")&&l(),f=n,i?(null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(r=t).track,[4,u()];case 2:s.apply(r,[a.sent()]),a.label=3;case 3:a.label=4;case 4:return[2]}})})},v=function(){p()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return a(void 0,void 0,void 0,function(){var a,f;return c(this,function(c){switch(c.label){case 0:return t=s,i=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",v),n=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var i=d(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),p()}})),l()?(o.log("Tracking page view event"),f=(a=t).track,[4,u()]):[3,2];case 1:f.apply(a,[c.sent()]),c.label=2;case 2:return[2]}})})},execute:function(t){return a(void 0,void 0,void 0,function(){var n;return c(this,function(i){switch(i.label){case 0:return"attribution"===e.trackOn&&ct(t)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,u()]):[3,2];case 1:n=i.sent(),t.event_type=n.event_type,t.event_properties=s(s({},t.event_properties),n.event_properties),i.label=2;case 2:return[2,t]}})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(e){return r&&(r.removeEventListener("popstate",v),n&&(r.history.pushState=n)),[2]})})}}},at=function(){return a(void 0,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:return e=st,[4,(new nt).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},ct=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[L.SET]||{},i=t[L.UNSET]||{},r=f(f([],d(Object.keys(n)),!1),d(Object.keys(i)),!1);return Object.keys(tt).every(function(e){return r.includes(e)})}return!1},lt=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},dt=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return a(void 0,void 0,void 0,function(){return c(this,function(r){return window.addEventListener("load",function(){if(i){if("undefined"!=typeof document){var r=function(e){var t=!1;n(e,"change",function(){var n;t||i.track(Te,((n={})[qe]=ft(e.id),n[Ae]=ft(e.name),n[Ce]=e.action,n)),t=!0}),n(e,"submit",function(){var n,r;t||i.track(Te,((n={})[qe]=ft(e.id),n[Ae]=ft(e.name),n[Ce]=e.action,n)),i.track(ke,((r={})[qe]=ft(e.id),r[Ae]=ft(e.name),r[Ce]=e.action,r)),t=!1})};Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)})})})).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")}),[2]})})},execute:function(e){return a(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)}),t=[],[2]})})}}},ft=function(e){if("string"==typeof e)return e},pt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return a(void 0,void 0,void 0,function(){return c(this,function(r){return window.addEventListener("load",function(){if(i){if("undefined"!=typeof document){var r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r,s,u,a=o.exec(n.href),c=null==a?void 0:a[1];c&&(s="click",u=function(){var t;c&&i.track(Oe,((t={})[xe]=c,t[Le]=n.pathname,t[Ue]=e.id,t[Ne]=e.text,t[De]=e.href,t))},(r=e).addEventListener(s,u),t.push({element:r,type:s,handler:u}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;Array.from(document.getElementsByTagName("a")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")}),[2]})})},execute:function(e){return a(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)}),t=[],[2]})})}}},vt=!1,ht=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.init=function(e,t,n){var i,r;return void 0===e&&(e=""),arguments.length>2?(i=t,r=n):"string"==typeof t?(i=t,r=void 0):(i=null==t?void 0:t.userId,r=t),m(this._init(s(s({},r),{userId:i,apiKey:e})))},t.prototype._init=function(t){var n,i;return a(this,void 0,void 0,function(){var r,o,u,l,d=this;return c(this,function(f){switch(f.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Ve(t.apiKey,t,this)]);case 1:return r=f.sent(),this.config=r,this.setSessionId(null!==(i=null!==(n=t.sessionId)&&void 0!==n?n:this.config.sessionId)&&void 0!==i?i:Date.now()),[4,e.prototype._init.call(this,this.config)];case 2:return f.sent(),(o=Z(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,4]:[4,this.add((p=ce(),v=[],h=function(e,t){p&&(p.addEventListener(e,t),v.push({type:e,handler:t}))},{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return a(void 0,void 0,void 0,function(){return c(this,function(n){return e.offline=!navigator.onLine,h("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),h("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2]})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(e){return v.forEach(function(e){var t=e.type,n=e.handler;p&&p.removeEventListener(t,n)}),v=[],[2]})})}})).promise];case 3:f.sent(),f.label=4;case 4:return[4,this.add(new D).promise];case 5:return f.sent(),[4,this.add(new se).promise];case 6:return f.sent(),[4,this.add(new G).promise];case 7:return f.sent(),y=this.config,vt||void 0!==y.defaultTracking||(y.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."),vt=!0),g=this.config.defaultTracking,H(g,"fileDownloads")?[4,this.add(pt()).promise]:[3,9];case 8:f.sent(),f.label=9;case 9:return function(e){return H(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(dt()).promise]:[3,11];case 10:f.sent(),f.label=11;case 11:return X(this.config.defaultTracking)?(u=function(e){return X(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?s({},e.defaultTracking.attribution):{}}(this.config),l=ot(u),[4,this.add(l).promise]):[3,13];case 12:f.sent(),f.label=13;case 13:return ee(this.config.defaultTracking)?[4,this.add(ut(te(this.config))).promise]:[3,15];case 14:f.sent(),f.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16:return f.sent(),o.eventBridge.setEventReceiver(function(e){d.track(e.eventType,e.eventProperties)}),[2]}var p,v,h,g,y})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){Z(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){Z(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(R()),this.setUserId(void 0)},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,n=this.config.defaultTracking,H(n,"sessions")&&(i&&r&&this.track(Re,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Pe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=$e(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(re(t)){var i=t._q;t._q=[],t=ie(new C,i)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,i,r){if(re(i)){var o=i._q;i._q=[],i=ie(new C,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(re(t)){var i=t._q;t._q=[],t=ie(new j,i)}return e.prototype.revenue.call(this,t,n)},t.prototype.process=function(t){return a(this,void 0,void 0,function(){var n,i;return c(this,function(r){return n=Date.now(),i=ne(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Pe||t.event_type===Re||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]})})},t}(F),gt=function(){var e=new ht;return{init:y(e.init.bind(e),"init",v(e),g(e,["config"])),add:y(e.add.bind(e),"add",v(e),g(e,["config.apiKey","timeline.plugins"])),remove:y(e.remove.bind(e),"remove",v(e),g(e,["config.apiKey","timeline.plugins"])),track:y(e.track.bind(e),"track",v(e),g(e,["config.apiKey","timeline.queue.length"])),logEvent:y(e.logEvent.bind(e),"logEvent",v(e),g(e,["config.apiKey","timeline.queue.length"])),identify:y(e.identify.bind(e),"identify",v(e),g(e,["config.apiKey","timeline.queue.length"])),groupIdentify:y(e.groupIdentify.bind(e),"groupIdentify",v(e),g(e,["config.apiKey","timeline.queue.length"])),setGroup:y(e.setGroup.bind(e),"setGroup",v(e),g(e,["config.apiKey","timeline.queue.length"])),revenue:y(e.revenue.bind(e),"revenue",v(e),g(e,["config.apiKey","timeline.queue.length"])),flush:y(e.flush.bind(e),"flush",v(e),g(e,["config.apiKey","timeline.queue.length"])),getUserId:y(e.getUserId.bind(e),"getUserId",v(e),g(e,["config","config.userId"])),setUserId:y(e.setUserId.bind(e),"setUserId",v(e),g(e,["config","config.userId"])),getDeviceId:y(e.getDeviceId.bind(e),"getDeviceId",v(e),g(e,["config","config.deviceId"])),setDeviceId:y(e.setDeviceId.bind(e),"setDeviceId",v(e),g(e,["config","config.deviceId"])),reset:y(e.reset.bind(e),"reset",v(e),g(e,["config","config.userId","config.deviceId"])),getSessionId:y(e.getSessionId.bind(e),"getSessionId",v(e),g(e,["config"])),setSessionId:y(e.setSessionId.bind(e),"setSessionId",v(e),g(e,["config"])),extendSession:y(e.extendSession.bind(e),"extendSession",v(e),g(e,["config"])),setOptOut:y(e.setOptOut.bind(e),"setOptOut",v(e),g(e,["config"])),setTransport:y(e.setTransport.bind(e),"setTransport",v(e),g(e,["config"]))}},yt=gt();yt.add,yt.extendSession,yt.flush,yt.getDeviceId,yt.getSessionId,yt.getUserId,yt.groupIdentify,yt.identify,yt.init,yt.logEvent,yt.remove,yt.reset,yt.revenue,yt.setDeviceId,yt.setGroup,yt.setOptOut,yt.setSessionId,yt.setTransport,yt.setUserId,yt.track}}]);
|
package/780.index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkChocoOneClickWidget=this.webpackChunkChocoOneClickWidget||[]).push([[780],{780:function(e,t,n){n.d(t,{createInstance:function(){return gt}});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o,s=function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)};function u(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,u)}a((i=i.apply(e,t||[])).next())})}function c(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function l(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function f(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(o||(o={}));var p,v=function(e){return function(){var t=s({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},h=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=l(t.split(".")),o=r.next();!o.done;o=r.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},g=function(e,t){return function(){var n,i,r={};try{for(var o=l(t),s=o.next();!s.done;s=o.next()){var u=s.value;r[u]=h(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},y=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];var a=n(),c=a.logger,l=a.logLevel;if(l&&l<o.Debug||!l||!c)return e.apply(r,s);var d,f={type:"invoke public method",name:t,args:s,stacktrace:(d=1,void 0===d&&(d=0),((new Error).stack||"").split("\n").slice(2+d).map(function(e){return e.trim()})),time:{start:(new Date).toISOString()},states:{}};i&&f.states&&(f.states.before=i());var p=e.apply(r,s);return p&&p.promise?p.promise.then(function(){i&&f.states&&(f.states.after=i()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))}):(i&&f.states&&(f.states.after=i()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))),p}},m=function(e){return{promise:e||Promise.resolve()}};!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(p||(p={}));var b="AMP",_="".concat(b,"_unsent"),I="https://api2.amplitude.com/2/httpapi",w=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=p.Unknown),{event:e,code:t,message:n}},S="Amplitude Logger ",E=function(){function e(){this.logLevel=o.None}return e.prototype.disable=function(){this.logLevel=o.None},e.prototype.enable=function(e){void 0===e&&(e=o.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Verbose||console.log("".concat(S,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Warn||console.warn("".concat(S,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Error||console.error("".concat(S,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<o.Debug||console.log("".concat(S,"[Debug]: ").concat(e.join(" ")))},e}(),T=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:o.Warn,loggerProvider:new E,offline:!1,optOut:!1,serverUrl:I,serverZone:"US",useBatch:!1}},O=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=T();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=P(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),k=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":I},P=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=T().serverZone),void 0===n&&(n=T().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:T().serverZone;return{serverZone:i,serverUrl:k(i,n)}},R=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,R)};function x(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var L,U,N,D=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return e.prototype.setup=function(e){var t;return a(this,void 0,void 0,function(){var n,i=this;return c(this,function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(_,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=r.sent())&&n.length>0&&Promise.all(n.map(function(e){return i.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=R()),new Promise(function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)})},e.prototype.getTryableList=function(e){var t=this;return e.filter(function(e){return e.attempts<t.config.flushMaxRetries?(e.attempts+=1,!0):(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleTryable=function(e,t){var n=this;void 0===t&&(t=!1),e.forEach(function(e){t&&(n.queue=n.queue.concat(e)),0!==e.timeout?setTimeout(function(){e.timeout=0,n.schedule(0)},e.timeout):n.schedule(n.config.flushIntervalMillis)})},e.prototype.addToQueue=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.getTryableList(e);this.scheduleTryable(n,!0),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,function(){var t,n,i,r=this;return c(this,function(o){switch(o.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce(function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e},[]),[4,Promise.all(i.map(function(t){return r.send(t,e)}))]);case 1:return o.sent(),this.scheduleTryable(n),[2]}var s,u,a})})},e.prototype.send=function(e,t){return void 0===t&&(t=!0),a(this,void 0,void 0,function(){var n,i,r,o,s;return c(this,function(a){switch(a.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,u(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString()},a.label=1;case 1:return a.trys.push([1,3,,4]),i=P(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:return null===(r=a.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(r,e),[3,4]):("body"in r?this.fulfillRequest(e,r.statusCode,"".concat(r.status,": ").concat(x(r))):this.fulfillRequest(e,r.statusCode,r.status),[2]);case 3:return o=a.sent(),s=(c=o)instanceof Error?c.message:String(c),this.config.loggerProvider.error(s),this.fulfillRequest(e,0,s),[3,4];case 4:return[2]}var c})})},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case p.Success:this.handleSuccessResponse(e,t);break;case p.Invalid:this.handleInvalidResponse(e,t);break;case p.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case p.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var i=f(f(f(f([],d(Object.values(e.body.eventsWithInvalidFields)),!1),d(Object.values(e.body.eventsWithMissingFields)),!1),d(Object.values(e.body.eventsWithInvalidIdLengths)),!1),d(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter(function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(x(e));var s=this.getTryableList(o);this.scheduleTryable(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(x(e)),this.config.flushQueueSize/=2;var n=this.getTryableList(t);this.scheduleTryable(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),u=new Set(r),a=new Set(o),c=t.filter(function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(x(e));var l=this.getTryableList(c);this.scheduleTryable(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),i=this.getTryableList(n);this.scheduleTryable(i)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach(function(e){return e.callback(w(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}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(L||(L={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE="$revenue"}(U||(U={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(N||(N={}));var q=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!A(t,n))return!1}return!0},A=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=l(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)r=r&&q(u);else if(!["number","string"].includes(typeof u))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return q(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},C=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return s({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(L.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(L.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(L.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(L.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(L.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(L.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(L.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(L.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(L.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[L.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[L.CLEAR_ALL]&&!this._propertySet.has(t)&&(e===L.ADD?"number"==typeof n:e===L.UNSET||e===L.REMOVE||A(t,n))},e}(),j=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return q(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?s({},this.properties):{};return e[U.REVENUE_PRODUCT_ID]=this.productId,e[U.REVENUE_QUANTITY]=this.quantity,e[U.REVENUE_PRICE]=this.price,e[U.REVENUE_TYPE]=this.revenueType,e[U.REVENUE]=this.revenue,e},e}(),M=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,r;return a(this,void 0,void 0,function(){return c(this,function(o){switch(o.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:R(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)];case 1:return o.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e){var t;return a(this,void 0,void 0,function(){var n,i;return c(this,function(r){switch(r.label){case 0:return n=this.plugins.findIndex(function(t){return t.name===e}),i=this.plugins[n],this.plugins.splice(n,1),[4,null===(t=i.teardown)||void 0===t?void 0:t.call(i)];case 1:return r.sent(),[2]}})})},e.prototype.reset=function(e){this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return a(this,void 0,void 0,function(){var t,n,i,r,o,u,a,f,p,v,h,g,y,m,b,_,I,S,E,T;return c(this,function(c){switch(c.label){case 0:if(!e)return[2];t=d(e,1),n=t[0],i=d(e,2),r=i[1],o=this.plugins.filter(function(e){return"before"===e.type}),c.label=1;case 1:c.trys.push([1,6,7,8]),u=l(o),a=u.next(),c.label=2;case 2:return a.done?[3,5]:(g=a.value).execute?[4,g.execute(s({},n))]:[3,4];case 3:if(null===(y=c.sent()))return r({event:n,code:0,message:""}),[2];n=y,c.label=4;case 4:return a=u.next(),[3,2];case 5:return[3,8];case 6:return f=c.sent(),I={error:f},[3,8];case 7:try{a&&!a.done&&(S=u.return)&&S.call(u)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),c.label=9;case 9:c.trys.push([9,14,15,16]),v=l(p),h=v.next(),c.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(s({},n))]:[3,12];case 11:if(null===(y=c.sent()))return r({event:n,code:0,message:""}),[2];n=y,c.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=c.sent(),E={error:m},[3,16];case 15:try{h&&!h.done&&(T=v.return)&&T.call(v)}finally{if(E)throw E.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),_=b.map(function(e){var t=s({},n);return e.execute(t).catch(function(e){return w(t,0,String(e))})}),Promise.all(_).then(function(e){var t=d(e,1)[0]||w(n,100,"Event not tracked, no destination plugins on the instance");r(t)}),[2]}})})},e.prototype.flush=function(){return a(this,void 0,void 0,function(){var e,t,n,i=this;return c(this,function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return i.apply(e)}))];case 1:return r.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return r.sent(),[2]}})})},e}(),V=function(e,t){return s(s({},t),{event_type:N.IDENTIFY,user_properties:e.getUserProperties()})},F=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new M(this),this.name=e}return e.prototype._init=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e){return a(this,void 0,void 0,function(){var t,n,i,r,o,s;return c(this,function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,6,7,8]),n=l(t),i=n.next(),u.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=u.sent(),o={error:r},[3,8];case 7:try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.track=function(e,t,n){var i=function(e,t,n){return s(s(s({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return m(this.dispatch(i))},e.prototype.identify=function(e,t){var n=V(e,t);return m(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var r=function(e,t,n,i){var r;return s(s({},i),{event_type:N.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n,i);return m(this.dispatch(r))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,r=new C;return r.set(e,t),s(s({},n),{event_type:N.IDENTIFY,user_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return m(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return s(s({},t),{event_type:N.REVENUE,event_properties:e.getEventProperties()})}(e,t);return m(this.dispatch(n))},e.prototype.add=function(e){return this.config?m(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),m())},e.prototype.remove=function(e){return this.config?m(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),m())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(w(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return a(this,void 0,void 0,function(){var t=this;return c(this,function(n){return this.config?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.process=function(e){return a(this,void 0,void 0,function(){var t,n,i;return c(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,w(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):100===i.code?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=w(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return m(this.timeline.flush())},e}(),$=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:K(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),K=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Q=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}(),B=function(){return B=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},B.apply(this,arguments)},W=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var i=0,r=["string","number","boolean","undefined"];i<r.length;i++)if(r[i]===n)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!W(u,a))return!1;var c=!0;return Object.keys(e).forEach(function(n){W(e[n],t[n])||(c=!1)}),c}for(var l=0;l<e.length;l++)if(!W(e[l],t[l]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var z=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=B({},this.identity.userProperties),n=B(B({},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){for(var t=n.userProperties||{},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var p=0,v=Object.keys(u);p<v.length;p++)delete t[d=v[p]];break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return B({},this.identity)},e.prototype.setIdentity=function(e){var t=B({},this.identity);this.identity=B({},e),W(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}(),J="undefined"!=typeof globalThis?globalThis:void 0!==n.g?n.g:self,Y=function(){function e(){this.identityStore=new z,this.eventBridge=new Q,this.applicationContextProvider=new $}return e.getInstance=function(t){return J.analyticsConnectorInstances||(J.analyticsConnectorInstances={}),J.analyticsConnectorInstances[t]||(J.analyticsConnectorInstances[t]=new e),J.analyticsConnectorInstances[t]},e}(),Z=function(e){return void 0===e&&(e="$default_instance"),Y.getInstance(e)},G=function(){function e(){this.name="identity",this.type="before",this.identityStore=Z().identityStore}return e.prototype.execute=function(e){return a(this,void 0,void 0,function(){var t;return c(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){return e.instanceName&&(this.identityStore=Z(e.instanceName).identityStore),[2]})})},e}(),H=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},X=function(e){return H(e,"attribution")},ee=function(e){return H(e,"pageViews")},te=function(e){var t,n=function(){return!1},i=void 0,r=e.pageCounter;return ee(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&&(i=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:i,eventType:t,pageCounter:r}},ne=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ie=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},re=function(e){return e&&void 0!==e._q},oe=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:r)&&void 0!==i?i:""},se=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.6.2"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return a(this,void 0,void 0,function(){var i,r,o;return c(this,function(u){return i=(new Date).getTime(),r=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:r+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=i),[2,s(s(s(s(s(s(s(s({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:oe()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:R(),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}(),ue=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return a(this,void 0,void 0,function(){return c(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return a(this,void 0,void 0,function(){var t;return c(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 a(this,void 0,void 0,function(){return c(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return a(this,void 0,void 0,function(){return c(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return a(this,void 0,void 0,function(){return c(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),ae=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[b,t,e.substring(0,n)].filter(Boolean).join("_")},ce=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==n.g?n.g:void 0},le=function(){var e,t=ce();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),i=de(n[0]),r=de(n[1]);return r?(e[i]=r,e):e},{}):{}},de=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},fe=function(){function e(e){this.options=s({},e)}return e.prototype.isEnabled=function(){return a(this,void 0,void 0,function(){var t,n;return c(this,function(i){switch(i.label){case 0:if(!ce())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return a(this,void 0,void 0,function(){var t;return c(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}}})})},e.prototype.getRaw=function(e){var t,n;return a(this,void 0,void 0,function(){var i,r,o;return c(this,function(s){return i=ce(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(o=r.find(function(t){return 0===t.indexOf(e+"=")}))?[2,o.substring(e.length+1)]:[2,void 0]})})},e.prototype.set=function(e,t){var n;return a(this,void 0,void 0,function(){var i,r,o,s,u,a;return c(this,function(c){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((s=new Date).setTime(s.getTime()+24*r*60*60*1e3),o=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(a=ce())&&(a.document.cookie=u)}catch(e){}return[2]})})},e.prototype.remove=function(e){return a(this,void 0,void 0,function(){return c(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 a(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e}(),pe=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,f,v,h,g,y,m,b,_,I,w,S;if("object"!=typeof e)return null;var E=e.code||0,T=this.buildStatus(E);switch(T){case p.Success:return{status:T,statusCode:E,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(i=e.server_upload_time)&&void 0!==i?i:0}};case p.Invalid:return{status:T,statusCode:E,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case p.PayloadTooLarge:return{status:T,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case p.RateLimit:return{status:T,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case p.Timeout:default:return{status:T,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?p.Success:429===e?p.RateLimit:413===e?p.PayloadTooLarge:408===e?p.Timeout:e>=400&&e<500?p.Invalid:e>=500?p.Failed:p.Unknown},e}(),ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,function(){var n,i;return c(this,function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}})})},t}(pe),he=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return a(this,void 0,void 0,function(){var t,n,i;return c(this,function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return a(this,void 0,void 0,function(){var t;return c(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return a(this,void 0,void 0,function(){return c(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return a(this,void 0,void 0,function(){return c(this,function(i){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return a(this,void 0,void 0,function(){return c(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return a(this,void 0,void 0,function(){return c(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),ge=1e3,ye=function(e){function t(t){var n,i=this;return(i=e.call(this,null===(n=ce())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return r(t,e),t.prototype.set=function(t,n){var i;return a(this,void 0,void 0,function(){var r;return c(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>ge?(r=n.length-ge,[4,e.prototype.set.call(this,t,n.slice(0,ge))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(ge,".")),[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}(he),me=function(e){function t(){var t;return e.call(this,null===(t=ce())||void 0===t?void 0:t.sessionStorage)||this}return r(t,e),t}(he),be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return r(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,function(){var n=this;return c(this,function(i){return[2,new Promise(function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done)try{var e=o.responseText,t=JSON.parse(e),s=n.buildResponse(t);i(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))})]})})},t}(pe),_e=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,function(){var n=this;return c(this,function(i){return[2,new Promise(function(i,r){var o=ce();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}})]})})},t}(pe),Ie=function(e,t,n){return void 0===n&&(n=!0),a(void 0,void 0,void 0,function(){var i,r,o,s,u,a,l,f,p;return c(this,function(c){switch(c.label){case 0:return i=function(e){return"".concat(b.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=c.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:c.sent(),c.label=3;case 3:return o=d(r.split("."),6),s=o[0],u=o[1],a=o[2],l=o[3],f=o[4],p=o[5],[2,{deviceId:s,userId:Se(u),sessionId:we(l),lastEventId:we(p),lastEventTime:we(f),optOut:Boolean(a)}]}})})},we=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Se=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ee="[Amplitude]",Te=("".concat(Ee," Page Viewed"),"".concat(Ee," Form Started")),Oe="".concat(Ee," Form Submitted"),ke="".concat(Ee," File Downloaded"),Pe="session_start",Re="session_end",xe="".concat(Ee," File Extension"),Le="".concat(Ee," File Name"),Ue="".concat(Ee," Link ID"),Ne="".concat(Ee," Link Text"),De="".concat(Ee," Link URL"),qe="".concat(Ee," Form ID"),Ae="".concat(Ee," Form Name"),Ce="".concat(Ee," Form Destination"),je="cookie",Me=function(e){function t(t,n,i,r,s,u,a,c,l,d,f,p,v,h,g,y,m,b,_,I,w,S,T,O,k,P,R,x,L,U,N){void 0===i&&(i=new ue),void 0===r&&(r={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=je),void 0===g&&(g=new E),void 0===y&&(y=o.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===S&&(S=""),void 0===T&&(T="US"),void 0===k&&(k=18e5),void 0===P&&(P=new ye({loggerProvider:g})),void 0===R&&(R={ipAddress:!0,language:!0,platform:!0}),void 0===x&&(x="fetch"),void 0===L&&(L=!1);var D=e.call(this,{apiKey:t,storageProvider:P,transportProvider:$e(x)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=r,D.defaultTracking=s,D.flushIntervalMillis=a,D.flushMaxRetries=c,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=f,D.instanceName=p,D.loggerProvider=g,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=I,D.plan=w,D.serverUrl=S,D.serverZone=T,D.sessionTimeout=k,D.storageProvider=P,D.trackingOptions=R,D.transport=x,D.useBatch=L,D._optOut=!1,D._cookieStorage=i,D.deviceId=u,D.lastEventId=v,D.lastEventTime=h,D.optOut=_,D.sessionId=O,D.pageCounter=N,D.userId=U,D.loggerProvider.enable(D.logLevel),D}return r(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),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}),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};this.cookieStorage.set(ae(this.apiKey),e)},t}(O),Ve=function(e,t,n){return void 0===t&&(t={}),a(void 0,void 0,void 0,function(){var i,r,o,u,a,l,d,f,p,v,h,g,y,m,b,_,I,w,S,E,T,O,k,P,x,L,U,N,D,q,A,C,j,M,V,F,$,K,Q,B;return c(this,function(c){switch(c.label){case 0:return i=t.identityStorage||je,I={},i===je?[3,1]:(o="",[3,5]);case 1:return null===(S=null===(w=t.cookieOptions)||void 0===w?void 0:w.domain)||void 0===S?[3,2]:(u=S,[3,4]);case 2:return[4,Ke()];case 3:u=c.sent(),c.label=4;case 4:o=u,c.label=5;case 5:return r=s.apply(void 0,[(I.domain=o,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),a=Fe(t.identityStorage,r),[4,Ie(e,a,null===(T=null===(E=t.cookieOptions)||void 0===E?void 0:E.upgrade)||void 0===T||T)];case 6:return l=c.sent(),[4,a.get(ae(e))];case 7:return d=c.sent(),f=le(),p=null!==(x=null!==(P=null!==(k=null!==(O=t.deviceId)&&void 0!==O?O:f.deviceId)&&void 0!==k?k:null==d?void 0:d.deviceId)&&void 0!==P?P:l.deviceId)&&void 0!==x?x:R(),v=null!==(L=null==d?void 0:d.lastEventId)&&void 0!==L?L:l.lastEventId,h=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,g=null!==(D=null!==(N=t.optOut)&&void 0!==N?N:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,y=null!==(q=null==d?void 0:d.sessionId)&&void 0!==q?q:l.sessionId,m=null!==(C=null!==(A=t.userId)&&void 0!==A?A:null==d?void 0:d.userId)&&void 0!==C?C:l.userId,n.previousSessionDeviceId=null!==(j=null==d?void 0:d.deviceId)&&void 0!==j?j:l.deviceId,n.previousSessionUserId=null!==(M=null==d?void 0:d.userId)&&void 0!==M?M:l.userId,b={ipAddress:null===(F=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===F||F,language:null===(K=null===($=t.trackingOptions)||void 0===$?void 0:$.language)||void 0===K||K,platform:null===(B=null===(Q=t.trackingOptions)||void 0===Q?void 0:Q.platform)||void 0===B||B},_=null==d?void 0:d.pageCounter,[2,new Me(e,t.appVersion,a,r,t.defaultTracking,p,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,t.instanceName,v,h,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,b,t.transport,t.useBatch,m,_)]}})})},Fe=function(e,t){switch(void 0===e&&(e=je),void 0===t&&(t={}),e){case"localStorage":return new ye;case"sessionStorage":return new me;case"none":return new ue;default:return new fe(s(s({},t),{expirationDays:t.expiration}))}},$e=function(e){return"xhr"===e?new be:"beacon"===e?new _e:new ve},Ke=function(e){return a(void 0,void 0,void 0,function(){var t,n,i,r,o,s,u;return c(this,function(a){switch(a.label){case 0:return[4,(new fe).isEnabled()];case 1:if(!a.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",o=n.length-2;o>=0;--o)i.push(n.slice(o).join("."));o=0,a.label=2;case 2:return o<i.length?(s=i[o],[4,(u=new fe({domain:"."+s})).set(r,1)]):[3,7];case 3:return a.sent(),[4,u.get(r)];case 4:return a.sent()?[4,u.remove(r)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}})})},Qe="dclid",Be="fbclid",We="gbraid",ze="gclid",Je="ko_click_id",Ye="li_fat_id",Ze="msclkid",Ge="rtd_cid",He="ttclid",Xe="twclid",et="wbraid",tt={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},nt=function(){function e(){}return e.prototype.parse=function(){return a(this,void 0,void 0,function(){return c(this,function(e){return[2,s(s(s(s({},tt),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=le();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=le();return(e={})[Qe]=t[Qe],e[Be]=t[Be],e[We]=t[We],e[ze]=t[ze],e[Je]=t[Je],e[Ye]=t[Ye],e[Ze]=t[Ze],e[Ge]=t[Ge],e[He]=t[He],e[Xe]=t[Xe],e[et]=t[et],e},e}(),it=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rt=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})},ot=function(e){var t=this;void 0===e&&(e={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(t,n){var i;return a(this,void 0,void 0,function(){var r,o,a,l,f,p,v,h;return c(this,function(c){switch(c.label){case 0:return r=s({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(_=null===(i=t.cookieOptions)||void 0===i?void 0:i.domain,I=_,I?(I.startsWith(".")&&(I=I.substring(1)),[new RegExp("".concat(I.replace(".","\\."),"$"))]):[])},e),t.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),o=t.cookieStorage,g=t.apiKey,void 0===(y="MKTG")&&(y=""),void 0===m&&(m=10),a=[b,y,g.substring(0,m)].filter(Boolean).join("_"),[4,Promise.all([(new nt).parse(),o.get(a)])];case 1:return l=d.apply(void 0,[c.sent(),2]),f=l[0],p=l[1],v=ne(t.sessionTimeout,t.lastEventTime),function(e,t,n,i){void 0===i&&(i=!0),e.referrer;var r=e.referring_domain,o=u(e,["referrer","referring_domain"]),s=t||{},a=(s.referrer,s.referring_domain),c=u(s,["referrer","referring_domain"]);if(rt(n.excludeReferrers,e.referring_domain))return!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return!1;var l=JSON.stringify(o)!==JSON.stringify(c),d=it(r||"")!==it(a||"");return!t||l||d}(f,p,r,v)&&(r.resetSessionOnNewCampaign&&(n.setSessionId(Date.now()),t.loggerProvider.log("Created a new session for new campaign.")),t.loggerProvider.log("Tracking attribution."),h=function(e,t){var n=s(s({},tt),e),i=Object.entries(n).reduce(function(e,n){var i,r=d(n,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:t.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)},new C);return V(i)}(f,r),n.track(h),o.set(a,f)),[2]}var g,y,m,_,I})})},execute:function(e){return a(t,void 0,void 0,function(){return c(this,function(t){return[2,e]})})}};return n},st=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},ut=function(e){var t;void 0===e&&(e={});var n,i,r=ce(),o=void 0,u=function(){return a(void 0,void 0,void 0,function(){var t,n,r;return c(this,function(o){switch(o.label){case 0:return i.pageCounter=i.pageCounter?i.pageCounter+1:1,n={event_type:null!==(r=e.eventType)&&void 0!==r?r:"[Amplitude] Page Viewed"},t=[{}],[4,at()];case 1:return[2,(n.event_properties=s.apply(void 0,[s.apply(void 0,t.concat([o.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":"undefined"!=typeof location&&location.href||"","[Amplitude] Page Path":"undefined"!=typeof location&&location.pathname||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":"undefined"!=typeof location&&location.href.split("?")[0]||"","[Amplitude] Page Counter":i.pageCounter}]),n)]}})})},l=function(){return void 0===e.trackOn||"function"==typeof e.trackOn&&e.trackOn()},f="undefined"!=typeof location?location.href:null,p=function(){return a(void 0,void 0,void 0,function(){var n,i,r,s;return c(this,function(a){switch(a.label){case 0:return n=location.href,i=lt(e.trackHistoryChanges,n,f||"")&&l(),f=n,i?(null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(r=t).track,[4,u()];case 2:s.apply(r,[a.sent()]),a.label=3;case 3:a.label=4;case 4:return[2]}})})},v=function(){p()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return a(void 0,void 0,void 0,function(){var a,f;return c(this,function(c){switch(c.label){case 0:return t=s,i=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",v),n=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var i=d(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),p()}})),l()?(o.log("Tracking page view event"),f=(a=t).track,[4,u()]):[3,2];case 1:f.apply(a,[c.sent()]),c.label=2;case 2:return[2]}})})},execute:function(t){return a(void 0,void 0,void 0,function(){var n;return c(this,function(i){switch(i.label){case 0:return"attribution"===e.trackOn&&ct(t)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,u()]):[3,2];case 1:n=i.sent(),t.event_type=n.event_type,t.event_properties=s(s({},t.event_properties),n.event_properties),i.label=2;case 2:return[2,t]}})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(e){return r&&(r.removeEventListener("popstate",v),n&&(r.history.pushState=n)),[2]})})}}},at=function(){return a(void 0,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:return e=st,[4,(new nt).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},ct=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[L.SET]||{},i=t[L.UNSET]||{},r=f(f([],d(Object.keys(n)),!1),d(Object.keys(i)),!1);return Object.keys(tt).every(function(e){return r.includes(e)})}return!1},lt=function(e,t,n){return"pathOnly"===e?t.split("?")[0]!==n.split("?")[0]:t!==n},dt=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return a(void 0,void 0,void 0,function(){return c(this,function(r){return window.addEventListener("load",function(){if(i){if("undefined"!=typeof document){var r=function(e){var t=!1;n(e,"change",function(){var n;t||i.track(Te,((n={})[qe]=ft(e.id),n[Ae]=ft(e.name),n[Ce]=e.action,n)),t=!0}),n(e,"submit",function(){var n,r;t||i.track(Te,((n={})[qe]=ft(e.id),n[Ae]=ft(e.name),n[Ce]=e.action,n)),i.track(Oe,((r={})[qe]=ft(e.id),r[Ae]=ft(e.name),r[Ce]=e.action,r)),t=!1})};Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)})})})).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")}),[2]})})},execute:function(e){return a(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)}),t=[],[2]})})}}},ft=function(e){if("string"==typeof e)return e},pt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return a(void 0,void 0,void 0,function(){return c(this,function(r){return window.addEventListener("load",function(){if(i){if("undefined"!=typeof document){var r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r,s,u,a=o.exec(n.href),c=null==a?void 0:a[1];c&&(s="click",u=function(){var t;c&&i.track(ke,((t={})[xe]=c,t[Le]=n.pathname,t[Ue]=e.id,t[Ne]=e.text,t[De]=e.href,t))},(r=e).addEventListener(s,u),t.push({element:r,type:s,handler:u}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;Array.from(document.getElementsByTagName("a")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")}),[2]})})},execute:function(e){return a(void 0,void 0,void 0,function(){return c(this,function(t){return[2,e]})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)}),t=[],[2]})})}}},vt=!1,ht=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.init=function(e,t,n){var i,r;return void 0===e&&(e=""),arguments.length>2?(i=t,r=n):"string"==typeof t?(i=t,r=void 0):(i=null==t?void 0:t.userId,r=t),m(this._init(s(s({},r),{userId:i,apiKey:e})))},t.prototype._init=function(t){var n,i;return a(this,void 0,void 0,function(){var r,o,u,l,d=this;return c(this,function(f){switch(f.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Ve(t.apiKey,t,this)]);case 1:return r=f.sent(),this.config=r,this.setSessionId(null!==(i=null!==(n=t.sessionId)&&void 0!==n?n:this.config.sessionId)&&void 0!==i?i:Date.now()),[4,e.prototype._init.call(this,this.config)];case 2:return f.sent(),(o=Z(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,4]:[4,this.add((p=ce(),v=[],h=function(e,t){p&&(p.addEventListener(e,t),v.push({type:e,handler:t}))},{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return a(void 0,void 0,void 0,function(){return c(this,function(n){return e.offline=!navigator.onLine,h("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),h("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2]})})},teardown:function(){return a(void 0,void 0,void 0,function(){return c(this,function(e){return v.forEach(function(e){var t=e.type,n=e.handler;p&&p.removeEventListener(t,n)}),v=[],[2]})})}})).promise];case 3:f.sent(),f.label=4;case 4:return[4,this.add(new D).promise];case 5:return f.sent(),[4,this.add(new se).promise];case 6:return f.sent(),[4,this.add(new G).promise];case 7:return f.sent(),y=this.config,vt||void 0!==y.defaultTracking||(y.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."),vt=!0),g=this.config.defaultTracking,H(g,"fileDownloads")?[4,this.add(pt()).promise]:[3,9];case 8:f.sent(),f.label=9;case 9:return function(e){return H(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add(dt()).promise]:[3,11];case 10:f.sent(),f.label=11;case 11:return X(this.config.defaultTracking)?(u=function(e){return X(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?s({},e.defaultTracking.attribution):{}}(this.config),l=ot(u),[4,this.add(l).promise]):[3,13];case 12:f.sent(),f.label=13;case 13:return ee(this.config.defaultTracking)?[4,this.add(ut(te(this.config))).promise]:[3,15];case 14:f.sent(),f.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16:return f.sent(),o.eventBridge.setEventReceiver(function(e){d.track(e.eventType,e.eventProperties)}),[2]}var p,v,h,g,y})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){Z(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){Z(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(R()),this.setUserId(void 0)},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,n=this.config.defaultTracking,H(n,"sessions")&&(i&&r&&this.track(Re,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Pe,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=$e(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(re(t)){var i=t._q;t._q=[],t=ie(new C,i)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,i,r){if(re(i)){var o=i._q;i._q=[],i=ie(new C,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(re(t)){var i=t._q;t._q=[],t=ie(new j,i)}return e.prototype.revenue.call(this,t,n)},t.prototype.process=function(t){return a(this,void 0,void 0,function(){var n,i;return c(this,function(r){return n=Date.now(),i=ne(this.config.sessionTimeout,this.config.lastEventTime),t.event_type===Pe||t.event_type===Re||t.session_id&&t.session_id!==this.getSessionId()||!i||this.setSessionId(n),[2,e.prototype.process.call(this,t)]})})},t}(F),gt=function(){var e=new ht;return{init:y(e.init.bind(e),"init",v(e),g(e,["config"])),add:y(e.add.bind(e),"add",v(e),g(e,["config.apiKey","timeline.plugins"])),remove:y(e.remove.bind(e),"remove",v(e),g(e,["config.apiKey","timeline.plugins"])),track:y(e.track.bind(e),"track",v(e),g(e,["config.apiKey","timeline.queue.length"])),logEvent:y(e.logEvent.bind(e),"logEvent",v(e),g(e,["config.apiKey","timeline.queue.length"])),identify:y(e.identify.bind(e),"identify",v(e),g(e,["config.apiKey","timeline.queue.length"])),groupIdentify:y(e.groupIdentify.bind(e),"groupIdentify",v(e),g(e,["config.apiKey","timeline.queue.length"])),setGroup:y(e.setGroup.bind(e),"setGroup",v(e),g(e,["config.apiKey","timeline.queue.length"])),revenue:y(e.revenue.bind(e),"revenue",v(e),g(e,["config.apiKey","timeline.queue.length"])),flush:y(e.flush.bind(e),"flush",v(e),g(e,["config.apiKey","timeline.queue.length"])),getUserId:y(e.getUserId.bind(e),"getUserId",v(e),g(e,["config","config.userId"])),setUserId:y(e.setUserId.bind(e),"setUserId",v(e),g(e,["config","config.userId"])),getDeviceId:y(e.getDeviceId.bind(e),"getDeviceId",v(e),g(e,["config","config.deviceId"])),setDeviceId:y(e.setDeviceId.bind(e),"setDeviceId",v(e),g(e,["config","config.deviceId"])),reset:y(e.reset.bind(e),"reset",v(e),g(e,["config","config.userId","config.deviceId"])),getSessionId:y(e.getSessionId.bind(e),"getSessionId",v(e),g(e,["config"])),setSessionId:y(e.setSessionId.bind(e),"setSessionId",v(e),g(e,["config"])),extendSession:y(e.extendSession.bind(e),"extendSession",v(e),g(e,["config"])),setOptOut:y(e.setOptOut.bind(e),"setOptOut",v(e),g(e,["config"])),setTransport:y(e.setTransport.bind(e),"setTransport",v(e),g(e,["config"]))}},yt=gt();yt.add,yt.extendSession,yt.flush,yt.getDeviceId,yt.getSessionId,yt.getUserId,yt.groupIdentify,yt.identify,yt.init,yt.logEvent,yt.remove,yt.reset,yt.revenue,yt.setDeviceId,yt.setGroup,yt.setOptOut,yt.setSessionId,yt.setTransport,yt.setUserId,yt.track}}]);
|
package/README.md
CHANGED
|
@@ -25,12 +25,8 @@ const widget = new ChocoOneClickWidget({
|
|
|
25
25
|
onSuccess: (data) => console.log('Success', data),
|
|
26
26
|
onError: (error) => console.error('Error', error),
|
|
27
27
|
onCancel: () => console.log('Cancelled'),
|
|
28
|
-
onConfirmPay: (method) =>
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
onPaymentMethodSelected: (method) => {
|
|
32
|
-
console.log('payment method selected', method?.type);
|
|
33
|
-
}
|
|
28
|
+
onConfirmPay: (method) => console.log('payment button was pressed', method?.type),
|
|
29
|
+
onPaymentMethodSelected: (method) => console.log('payment method selected', method?.type)
|
|
34
30
|
});
|
|
35
31
|
|
|
36
32
|
await widget.init();
|