@letscooee/web-sdk 9.0.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/dist/shopify-sdk.min.js +1 -1
- package/dist/widget-sdk.min.css +1 -1
- package/dist/widget-sdk.min.js +25 -7
- package/package.json +32 -28
- package/CHANGELOG.md +0 -1738
- package/angular.json +0 -272
- package/projects/analytics-sdk/.eslintrc.json +0 -37
- package/projects/analytics-sdk/public/favicon.ico +0 -0
- package/projects/analytics-sdk/tsconfig.app.json +0 -15
- package/projects/analytics-sdk/tsconfig.spec.json +0 -15
- package/projects/core-lib/.eslintrc.json +0 -37
- package/projects/core-lib/README.md +0 -5
- package/projects/core-lib/ng-package.json +0 -7
- package/projects/core-lib/package.json +0 -12
- package/projects/core-lib/tsconfig.lib.json +0 -15
- package/projects/core-lib/tsconfig.lib.prod.json +0 -11
- package/projects/core-lib/tsconfig.spec.json +0 -15
- package/projects/widget-sdk/.eslintrc.json +0 -37
- package/projects/widget-sdk/public/favicon.ico +0 -0
- package/projects/widget-sdk/tsconfig.app.json +0 -15
- package/projects/widget-sdk/tsconfig.spec.json +0 -15
package/dist/shopify-sdk.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see shopify-sdk.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var __webpack_modules__={780:(t,e)=>{"use strict";e.d=void 0;var n=function(){function t(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1))}catch(t){console.error("Un-parsable URL",t)}}return t.prototype.appendQueryParam=function(t,e){this.params.append(t,e?e.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(t){this.params.delete(t)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(t){if(!this.params)return"";var e=this.params.get(t);return e&&"undefined"!==e&&"null"!==e?e:void 0},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(t){return this.base.pathname=t,this},t.prototype.setQueryParam=function(t,e){return this.params.set(t,e?e.toString():""),this},t.prototype.setQueryString=function(t){if(t)return"?"===t[0]&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},t.prototype.toString=function(){var t=this.params.toString();return this.base.search=""===t?"":"?"+t,this.base.toString()},t}();e.d=n},110:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{A:()=>__webpack_exports__default});var __nested_webpack_require_1336__={d:(t,e)=>{for(var n in e)__nested_webpack_require_1336__.o(e,n)&&!__nested_webpack_require_1336__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},__nested_webpack_exports__={};__nested_webpack_require_1336__.d(__nested_webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__,k:()=>detectIncognito});var __awaiter=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},__generator=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};function detectIncognito(){return __awaiter(this,void 0,Promise,(function(){return __generator(this,(function(_a){switch(_a.label){case 0:return[4,new Promise((function(resolve,reject){var browserName="Unknown";function __callback(t){resolve({isPrivate:t,browserName})}function identifyChromium(){var t=navigator.userAgent;return t.match(/Chrome/)?void 0!==navigator.brave?"Brave":t.match(/Edg/)?"Edge":t.match(/OPR/)?"Opera":"Chrome":"Chromium"}function assertEvalToString(t){return t===eval.toString().length}function feid(){var toFixedEngineID=0;try{eval("(-1).toFixed(-1);")}catch(t){toFixedEngineID=t.message.length}return toFixedEngineID}function isSafari(){return 44===feid()}function isChrome(){return 51===feid()}function isFirefox(){return 25===feid()}function isMSIE(){return void 0!==navigator.msSaveBlob&&assertEvalToString(39)}function newSafariTest(){var t=String(Math.random());try{window.indexedDB.open(t,1).onupgradeneeded=function(e){var n,r,i=null===(n=e.target)||void 0===n?void 0:n.result;try{i.createObjectStore("test",{autoIncrement:!0}).put(new Blob),__callback(!1)}catch(t){var o=t;return t instanceof Error&&(o=null!==(r=t.message)&&void 0!==r?r:t),"string"!=typeof o?void __callback(!1):void __callback(o.includes("BlobURLs are not yet supported"))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch(t){__callback(!1)}}function oldSafariTest(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch(t){return void __callback(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch(t){return void __callback(!0)}__callback(!1)}function safariPrivateTest(){void 0!==navigator.maxTouchPoints?newSafariTest():oldSafariTest()}function getQuotaLimit(){var t=window;return void 0!==t.performance&&void 0!==t.performance.memory&&void 0!==t.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824}function storageQuotaChromePrivateTest(){navigator.webkitTemporaryStorage.queryUsageAndQuota((function(t,e){__callback(Math.round(e/1048576)<2*Math.round(getQuotaLimit()/1048576))}),(function(t){reject(new Error("detectIncognito somehow failed to query storage quota: "+t.message))}))}function oldChromePrivateTest(){(0,window.webkitRequestFileSystem)(0,1,(function(){__callback(!1)}),(function(){__callback(!0)}))}function chromePrivateTest(){void 0!==self.Promise&&void 0!==self.Promise.allSettled?storageQuotaChromePrivateTest():oldChromePrivateTest()}function firefoxPrivateTest(){__callback(void 0===navigator.serviceWorker)}function msiePrivateTest(){__callback(void 0===window.indexedDB)}function main(){isSafari()?(browserName="Safari",safariPrivateTest()):isChrome()?(browserName=identifyChromium(),chromePrivateTest()):isFirefox()?(browserName="Firefox",firefoxPrivateTest()):isMSIE()?(browserName="Internet Explorer",msiePrivateTest()):reject(new Error("detectIncognito cannot determine the browser"))}main()}))];case 1:return[2,_a.sent()]}}))}))}"undefined"!=typeof window&&(window.detectIncognito=detectIncognito);const __WEBPACK_DEFAULT_EXPORT__=detectIncognito;var __webpack_exports__default=__nested_webpack_exports__.A,__webpack_exports__detectIncognito=__nested_webpack_exports__.k},318:function(t){t.exports=function(){"use strict";function t(t){return Number.isInteger(t)&&t>=0}function e(t){this.name="ArgumentError",this.message=t}return function(n,r){if(r=r||{},"function"!=typeof n)throw new e("fetch must be a function");if("object"!=typeof r)throw new e("defaults must be an object");if(void 0!==r.retries&&!t(r.retries))throw new e("retries must be a positive integer");if(void 0!==r.retryDelay&&!t(r.retryDelay)&&"function"!=typeof r.retryDelay)throw new e("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==r.retryOn&&!Array.isArray(r.retryOn)&&"function"!=typeof r.retryOn)throw new e("retryOn property expects an array or function");return r=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},r),function(i,o){var s=r.retries,a=r.retryDelay,c=r.retryOn;if(o&&void 0!==o.retries){if(!t(o.retries))throw new e("retries must be a positive integer");s=o.retries}if(o&&void 0!==o.retryDelay){if(!t(o.retryDelay)&&"function"!=typeof o.retryDelay)throw new e("retryDelay must be a positive integer or a function returning a positive integer");a=o.retryDelay}if(o&&o.retryOn){if(!Array.isArray(o.retryOn)&&"function"!=typeof o.retryOn)throw new e("retryOn property expects an array or function");c=o.retryOn}return new Promise((function(t,e){var r=function(r){var a="undefined"!=typeof Request&&i instanceof Request?i.clone():i;n(a,o).then((function(n){if(Array.isArray(c)&&-1===c.indexOf(n.status))t(n);else if("function"==typeof c)try{return Promise.resolve(c(r,null,n)).then((function(e){e?u(r,null,n):t(n)})).catch(e)}catch(t){e(t)}else r<s?u(r,null,n):t(n)})).catch((function(t){if("function"==typeof c)try{Promise.resolve(c(r,t,null)).then((function(n){n?u(r,t,null):e(t)})).catch((function(t){e(t)}))}catch(t){e(t)}else r<s?u(r,t,null):e(t)}))};function u(t,e,n){var i="function"==typeof a?a(t,e,n):a;setTimeout((function(){r(++t)}),i)}r(0)}))}}}()},586:function(t,e,n){var r,i;!function(){"use strict";var o,s={VERSION:"1.6.1"},a={},c=function(t,e){return function(){return e.apply(t,arguments)}},u=function(){var t,e,n=arguments,r=n[0];for(e=1;e<n.length;e++)for(t in n[e])!(t in r)&&n[e].hasOwnProperty(t)&&(r[t]=n[e][t]);return r},l=function(t,e){return{value:t,name:e}};s.TRACE=l(1,"TRACE"),s.DEBUG=l(2,"DEBUG"),s.INFO=l(3,"INFO"),s.TIME=l(4,"TIME"),s.WARN=l(5,"WARN"),s.ERROR=l(8,"ERROR"),s.OFF=l(99,"OFF");var h=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};h.prototype={setLevel:function(t){t&&"value"in t&&(this.context.filterLevel=t)},getLevel:function(){return this.context.filterLevel},enabledFor:function(t){var e=this.context.filterLevel;return t.value>=e.value},trace:function(){this.invoke(s.TRACE,arguments)},debug:function(){this.invoke(s.DEBUG,arguments)},info:function(){this.invoke(s.INFO,arguments)},warn:function(){this.invoke(s.WARN,arguments)},error:function(){this.invoke(s.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"end"])},invoke:function(t,e){o&&this.enabledFor(t)&&o(e,u({level:t},this.context))}};var p,d=new h({filterLevel:s.OFF});(p=s).enabledFor=c(d,d.enabledFor),p.trace=c(d,d.trace),p.debug=c(d,d.debug),p.time=c(d,d.time),p.timeEnd=c(d,d.timeEnd),p.info=c(d,d.info),p.warn=c(d,d.warn),p.error=c(d,d.error),p.log=p.info,s.setHandler=function(t){o=t},s.setLevel=function(t){for(var e in d.setLevel(t),a)a.hasOwnProperty(e)&&a[e].setLevel(t)},s.getLevel=function(){return d.getLevel()},s.get=function(t){return a[t]||(a[t]=new h(u({name:t},d.context)))},s.createDefaultHandler=function(t){(t=t||{}).formatter=t.formatter||function(t,e){e.name&&t.unshift("["+e.name+"]")};var e={},n=function(t,e){Function.prototype.apply.call(t,console,e)};return"undefined"==typeof console?function(){}:function(r,i){r=Array.prototype.slice.call(r);var o,a=console.log;i.level===s.TIME?(o=(i.name?"["+i.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(o):e[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):n(a,[o+": "+((new Date).getTime()-e[o])+"ms"])):(i.level===s.WARN&&console.warn?a=console.warn:i.level===s.ERROR&&console.error?a=console.error:i.level===s.INFO&&console.info?a=console.info:i.level===s.DEBUG&&console.debug?a=console.debug:i.level===s.TRACE&&console.trace&&(a=console.trace),t.formatter(r,i),n(a,r))}},s.useDefaults=function(t){s.setLevel(t&&t.defaultLevel||s.DEBUG),s.setHandler(s.createDefaultHandler(t))},s.setDefaults=s.useDefaults,void 0===(i="function"==typeof(r=s)?r.call(e,n,e,t):r)||(t.exports=i)}()},790:(t,e,n)=>{t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return i(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var o=void 0,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e,r){(function(t){"use strict";var n,r,i=t.MutationObserver||t.WebKitMutationObserver;if(i){var o=0,s=new i(l),a=t.document.createTextNode("");s.observe(a,{characterData:!0}),n=function(){a.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){l(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(l,0)};else{var c=new t.MessageChannel;c.port1.onmessage=l,n=function(){c.port2.postMessage(0)}}var u=[];function l(){var t,e;r=!0;for(var n=u.length;n;){for(e=u,u=[],t=-1;++t<n;)e[t]();n=u.length}r=!1}e.exports=function(t){1!==u.push(t)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){"use strict";var r=t(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function u(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,t!==i&&d(this,t)}function l(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(t,e,n){r((function(){var r;try{r=e(n)}catch(e){return o.reject(t,e)}r===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,r)}))}function p(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function d(t,e){var n=!1;function r(e){n||(n=!0,o.reject(t,e))}function i(e){n||(n=!0,o.resolve(t,e))}var s=f((function(){e(i,r)}));"error"===s.status&&r(s.value)}function f(t,e){var n={};try{n.value=t(e),n.status="success"}catch(t){n.status="error",n.value=t}return n}e.exports=u,u.prototype.catch=function(t){return this.then(null,t)},u.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===s)return this;var n=new this.constructor(i);return this.state!==c?h(n,this.state===a?t:e,this.outcome):this.queue.push(new l(n,t,e)),n},l.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},l.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},l.prototype.callRejected=function(t){o.reject(this.promise,t)},l.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},o.resolve=function(t,e){var n=f(p,e);if("error"===n.status)return o.reject(t,n.value);var r=n.value;if(r)d(t,r);else{t.state=a,t.outcome=e;for(var i=-1,s=t.queue.length;++i<s;)t.queue[i].callFulfilled(e)}return t},o.reject=function(t,e){t.state=s,t.outcome=e;for(var n=-1,r=t.queue.length;++n<r;)t.queue[n].callRejected(e);return t},u.resolve=function(t){return t instanceof this?t:o.resolve(new this(i),t)},u.reject=function(t){var e=new this(i);return o.reject(e,t)},u.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,c=-1,u=new this(i);++c<n;)l(t[c],c);return u;function l(t,i){e.resolve(t).then((function(t){s[i]=t,++a!==n||r||(r=!0,o.resolve(u,s))}),(function(t){r||(r=!0,o.reject(u,t))}))}},u.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n,r=t.length,s=!1;if(!r)return this.resolve([]);for(var a=-1,c=new this(i);++a<r;)n=t[a],e.resolve(n).then((function(t){s||(s=!0,o.resolve(c,t))}),(function(t){s||(s=!0,o.reject(c,t))}));return c}},{1:1}],3:[function(t,e,r){(function(e){"use strict";"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var i=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(t){return}}();function o(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<t.length;r+=1)n.append(t[r]);return n.getBlob(e.type)}}"undefined"==typeof Promise&&t(3);var s=Promise;function a(t,e){e&&t.then((function(t){e(null,t)}),(function(t){e(t)}))}function c(t,e,n){"function"==typeof e&&t.then(e),"function"==typeof n&&t.catch(n)}function u(t){return"string"!=typeof t&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function l(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var h="local-forage-detect-blob-support",p=void 0,d={},f=Object.prototype.toString,g="readonly",m="readwrite";function y(t){for(var e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n),i=0;i<e;i++)r[i]=t.charCodeAt(i);return n}function _(t){return"boolean"==typeof p?s.resolve(p):function(t){return new s((function(e){var n=t.transaction(h,m),r=o([""]);n.objectStore(h).put(r,"key"),n.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},n.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);e(n||!t||parseInt(t[1],10)>=43)}})).catch((function(){return!1}))}(t).then((function(t){return p=t}))}function v(t){var e=d[t.name],n={};n.promise=new s((function(t,e){n.resolve=t,n.reject=e})),e.deferredOperations.push(n),e.dbReady?e.dbReady=e.dbReady.then((function(){return n.promise})):e.dbReady=n.promise}function b(t){var e=d[t.name].deferredOperations.pop();if(e)return e.resolve(),e.promise}function w(t,e){var n=d[t.name].deferredOperations.pop();if(n)return n.reject(e),n.promise}function E(t,e){return new s((function(n,r){if(d[t.name]=d[t.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},t.db){if(!e)return n(t.db);v(t),t.db.close()}var o=[t.name];e&&o.push(t.version);var s=i.open.apply(i,o);e&&(s.onupgradeneeded=function(e){var n=s.result;try{n.createObjectStore(t.storeName),e.oldVersion<=1&&n.createObjectStore(h)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+t.name+'" has been upgraded from version '+e.oldVersion+" to version "+e.newVersion+', but the storage "'+t.storeName+'" already exists.')}}),s.onerror=function(t){t.preventDefault(),r(s.error)},s.onsuccess=function(){var e=s.result;e.onversionchange=function(t){t.target.close()},n(e),b(t)}}))}function S(t){return E(t,!1)}function I(t){return E(t,!0)}function T(t,e){if(!t.db)return!0;var n=!t.db.objectStoreNames.contains(t.storeName),r=t.version<t.db.version,i=t.version>t.db.version;if(r&&(t.version!==e&&console.warn('The database "'+t.name+"\" can't be downgraded from version "+t.db.version+" to version "+t.version+"."),t.version=t.db.version),i||n){if(n){var o=t.db.version+1;o>t.version&&(t.version=o)}return!0}return!1}function C(t){return o([y(atob(t.data))],{type:t.type})}function D(t){return t&&t.__local_forage_encoded_blob}function O(t){var e=this,n=e._initReady().then((function(){var t=d[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady}));return c(n,t,t),n}function x(t,e,n,r){void 0===r&&(r=1);try{var i=t.db.transaction(t.storeName,e);n(null,i)}catch(i){if(r>0&&(!t.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return s.resolve().then((function(){if(!t.db||"NotFoundError"===i.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),I(t)})).then((function(){return function(t){v(t);for(var e=d[t.name],n=e.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return t.db=null,S(t).then((function(e){return t.db=e,T(t)?I(t):e})).then((function(r){t.db=e.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(e){throw w(t,e),e}))}(t).then((function(){x(t,e,n,r-1)}))})).catch(n);n(i)}}var N={_driver:"asyncStorage",_initStorage:function(t){var e=this,n={db:null};if(t)for(var r in t)n[r]=t[r];var i=d[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},d[n.name]=i),i.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=O);var o=[];function a(){return s.resolve()}for(var c=0;c<i.forages.length;c++){var u=i.forages[c];u!==e&&o.push(u._initReady().catch(a))}var l=i.forages.slice(0);return s.all(o).then((function(){return n.db=i.db,S(n)})).then((function(t){return n.db=t,T(n,e._defaultConfig.version)?I(n):t})).then((function(t){n.db=i.db=t,e._dbInfo=n;for(var r=0;r<l.length;r++){var o=l[r];o!==e&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(t){return!1}}(),iterate:function(t,e){var n=this,r=new s((function(e,r){n.ready().then((function(){x(n._dbInfo,g,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var n=s.result;if(n){var r=n.value;D(r)&&(r=C(r));var i=t(r,n.key,a++);void 0!==i?e(i):n.continue()}else e()},s.onerror=function(){r(s.error)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},getItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){x(n._dbInfo,g,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).get(t);s.onsuccess=function(){var t=s.result;void 0===t&&(t=null),D(t)&&(t=C(t)),e(t)},s.onerror=function(){r(s.error)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},setItem:function(t,e,n){var r=this;t=u(t);var i=new s((function(n,i){var o;r.ready().then((function(){return o=r._dbInfo,"[object Blob]"===f.call(e)?_(o.db).then((function(t){return t?e:(n=e,new s((function(t,e){var r=new FileReader;r.onerror=e,r.onloadend=function(e){var r=btoa(e.target.result||"");t({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):e})).then((function(e){x(r._dbInfo,m,(function(o,s){if(o)return i(o);try{var a=s.objectStore(r._dbInfo.storeName);null===e&&(e=void 0);var c=a.put(e,t);s.oncomplete=function(){void 0===e&&(e=null),n(e)},s.onabort=s.onerror=function(){var t=c.error?c.error:c.transaction.error;i(t)}}catch(t){i(t)}}))})).catch(i)}));return a(i,n),i},removeItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){x(n._dbInfo,m,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).delete(t);o.oncomplete=function(){e()},o.onerror=function(){r(s.error)},o.onabort=function(){var t=s.error?s.error:s.transaction.error;r(t)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},clear:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){x(e._dbInfo,m,(function(r,i){if(r)return n(r);try{var o=i.objectStore(e._dbInfo.storeName).clear();i.oncomplete=function(){t()},i.onabort=i.onerror=function(){var t=o.error?o.error:o.transaction.error;n(t)}}catch(t){n(t)}}))})).catch(n)}));return a(n,t),n},length:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){x(e._dbInfo,g,(function(r,i){if(r)return n(r);try{var o=i.objectStore(e._dbInfo.storeName).count();o.onsuccess=function(){t(o.result)},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,t),n},key:function(t,e){var n=this,r=new s((function(e,r){t<0?e(null):n.ready().then((function(){x(n._dbInfo,g,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName),a=!1,c=s.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===t||a?e(n.key):(a=!0,n.advance(t)):e(null)},c.onerror=function(){r(c.error)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},keys:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){x(e._dbInfo,g,(function(r,i){if(r)return n(r);try{var o=i.objectStore(e._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var e=o.result;e?(s.push(e.key),e.continue()):t(s)},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,t),n},dropInstance:function(t,e){e=l.apply(this,arguments);var n,r=this.config();if((t="function"!=typeof t&&t||{}).name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName),t.name){var o=t.name===r.name&&this._dbInfo.db?s.resolve(this._dbInfo.db):S(t).then((function(e){var n=d[t.name],r=n.forages;n.db=e;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=e;return e}));n=t.storeName?o.then((function(e){if(e.objectStoreNames.contains(t.storeName)){var n=e.version+1;v(t);var r=d[t.name],o=r.forages;e.close();for(var a=0;a<o.length;a++){var c=o[a];c._dbInfo.db=null,c._dbInfo.version=n}var u=new s((function(e,r){var o=i.open(t.name,n);o.onerror=function(t){o.result.close(),r(t)},o.onupgradeneeded=function(){o.result.deleteObjectStore(t.storeName)},o.onsuccess=function(){var t=o.result;t.close(),e(t)}}));return u.then((function(t){r.db=t;for(var e=0;e<o.length;e++){var n=o[e];n._dbInfo.db=t,b(n._dbInfo)}})).catch((function(e){throw(w(t,e)||s.resolve()).catch((function(){})),e}))}})):o.then((function(e){v(t);var n=d[t.name],r=n.forages;e.close();for(var o=0;o<r.length;o++)r[o]._dbInfo.db=null;var a=new s((function(e,n){var r=i.deleteDatabase(t.name);r.onerror=function(){var t=r.result;t&&t.close(),n(r.error)},r.onblocked=function(){console.warn('dropInstance blocked for database "'+t.name+'" until all open connections are closed')},r.onsuccess=function(){var t=r.result;t&&t.close(),e(t)}}));return a.then((function(t){n.db=t;for(var e=0;e<r.length;e++)b(r[e]._dbInfo)})).catch((function(e){throw(w(t,e)||s.resolve()).catch((function(){})),e}))}))}else n=s.reject("Invalid arguments");return a(n,e),n}};var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P=/^~~local_forage_type~([^~]+)~/,L="__lfsc__:",R="arbf",k="blob",U="si08",M="ui08",B="uic8",j="si16",F="si32",H="ur16",$="ui32",V="fl32",G="fl64",W=Object.prototype.toString;function q(t){var e,n,r,i,o,s=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var u=new ArrayBuffer(s),l=new Uint8Array(u);for(e=0;e<a;e+=4)n=A.indexOf(t[e]),r=A.indexOf(t[e+1]),i=A.indexOf(t[e+2]),o=A.indexOf(t[e+3]),l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|i>>2,l[c++]=(3&i)<<6|63&o;return u}function z(t){var e,n=new Uint8Array(t),r="";for(e=0;e<n.length;e+=3)r+=A[n[e]>>2],r+=A[(3&n[e])<<4|n[e+1]>>4],r+=A[(15&n[e+1])<<2|n[e+2]>>6],r+=A[63&n[e+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var K={serialize:function(t,e){var n="";if(t&&(n=W.call(t)),t&&("[object ArrayBuffer]"===n||t.buffer&&"[object ArrayBuffer]"===W.call(t.buffer))){var r,i=L;t instanceof ArrayBuffer?(r=t,i+=R):(r=t.buffer,"[object Int8Array]"===n?i+=U:"[object Uint8Array]"===n?i+=M:"[object Uint8ClampedArray]"===n?i+=B:"[object Int16Array]"===n?i+=j:"[object Uint16Array]"===n?i+=H:"[object Int32Array]"===n?i+=F:"[object Uint32Array]"===n?i+=$:"[object Float32Array]"===n?i+=V:"[object Float64Array]"===n?i+=G:e(new Error("Failed to get type for BinaryArray"))),e(i+z(r))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){var n="~~local_forage_type~"+t.type+"~"+z(this.result);e(L+k+n)},o.readAsArrayBuffer(t)}else try{e(JSON.stringify(t))}catch(n){console.error("Couldn't convert value into a JSON string: ",t),e(null,n)}},deserialize:function(t){if(t.substring(0,9)!==L)return JSON.parse(t);var e,n=t.substring(13),r=t.substring(9,13);if(r===k&&P.test(n)){var i=n.match(P);e=i[1],n=n.substring(i[0].length)}var s=q(n);switch(r){case R:return s;case k:return o([s],{type:e});case U:return new Int8Array(s);case M:return new Uint8Array(s);case B:return new Uint8ClampedArray(s);case j:return new Int16Array(s);case H:return new Uint16Array(s);case F:return new Int32Array(s);case $:return new Uint32Array(s);case V:return new Float32Array(s);case G:return new Float64Array(s);default:throw new Error("Unkown type: "+r)}},stringToBuffer:q,bufferToString:z};function Y(t,e,n,r){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function J(t,e,n,r,i,o){t.executeSql(n,r,i,(function(t,s){s.code===s.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[e.storeName],(function(t,a){a.rows.length?o(t,s):Y(t,e,(function(){t.executeSql(n,r,i,o)}),o)}),o):o(t,s)}),o)}function X(t,e,n,r){var i=this;t=u(t);var o=new s((function(o,s){i.ready().then((function(){void 0===e&&(e=null);var a=e,c=i._dbInfo;c.serializer.serialize(e,(function(e,u){u?s(u):c.db.transaction((function(n){J(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,e],(function(){o(a)}),(function(t,e){s(e)}))}),(function(e){if(e.code===e.QUOTA_ERR){if(r>0)return void o(X.apply(i,[t,a,n,r-1]));s(e)}}))}))})).catch(s)}));return a(o,n),o}var Q={_driver:"webSQLStorage",_initStorage:function(t){var e=this,n={db:null};if(t)for(var r in t)n[r]="string"!=typeof t[r]?t[r].toString():t[r];var i=new s((function(t,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(t){return r(t)}n.db.transaction((function(i){Y(i,n,(function(){e._dbInfo=n,t()}),(function(t,e){r(e)}))}),r)}));return n.serializer=K,i},_support:"function"==typeof openDatabase,iterate:function(t,e){var n=this,r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"SELECT * FROM "+i.storeName,[],(function(n,r){for(var o=r.rows,s=o.length,a=0;a<s;a++){var c=o.item(a),u=c.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=t(u,c.key,a+1)))return void e(u)}e()}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},getItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[t],(function(t,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),e(r)}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},setItem:function(t,e,n){return X.apply(this,[t,e,n,1])},removeItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[t],(function(){e()}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},clear:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){var r=e._dbInfo;r.db.transaction((function(e){J(e,r,"DELETE FROM "+r.storeName,[],(function(){t()}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,t),n},length:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){var r=e._dbInfo;r.db.transaction((function(e){J(e,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(e,n){var r=n.rows.item(0).c;t(r)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,t),n},key:function(t,e){var n=this,r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[t+1],(function(t,n){var r=n.rows.length?n.rows.item(0).key:null;e(r)}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},keys:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){var r=e._dbInfo;r.db.transaction((function(e){J(e,r,"SELECT key FROM "+r.storeName,[],(function(e,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);t(r)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,t),n},dropInstance:function(t,e){e=l.apply(this,arguments);var n=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||n.name,t.storeName=t.storeName||n.storeName);var r,i=this;return r=t.name?new s((function(e){var r;r=t.name===n.name?i._dbInfo.db:openDatabase(t.name,"","",0),t.storeName?e({db:r,storeNames:[t.storeName]}):e(function(t){return new s((function(e,n){t.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var i=[],o=0;o<r.rows.length;o++)i.push(r.rows.item(o).name);e({db:t,storeNames:i})}),(function(t,e){n(e)}))}),(function(t){n(t)}))}))}(r))})).then((function(t){return new s((function(e,n){t.db.transaction((function(r){function i(t){return new s((function(e,n){r.executeSql("DROP TABLE IF EXISTS "+t,[],(function(){e()}),(function(t,e){n(e)}))}))}for(var o=[],a=0,c=t.storeNames.length;a<c;a++)o.push(i(t.storeNames[a]));s.all(o).then((function(){e()})).catch((function(t){n(t)}))}),(function(t){n(t)}))}))})):s.reject("Invalid arguments"),a(r,e),r}};function Z(t,e){var n=t.name+"/";return t.storeName!==e.storeName&&(n+=t.storeName+"/"),n}function tt(){return!function(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch(t){return!0}}()||localStorage.length>0}var et={_driver:"localStorageWrapper",_initStorage:function(t){var e={};if(t)for(var n in t)e[n]=t[n];return e.keyPrefix=Z(t,this._defaultConfig),tt()?(this._dbInfo=e,e.serializer=K,s.resolve()):s.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(t,e){var n=this,r=n.ready().then((function(){for(var e=n._dbInfo,r=e.keyPrefix,i=r.length,o=localStorage.length,s=1,a=0;a<o;a++){var c=localStorage.key(a);if(0===c.indexOf(r)){var u=localStorage.getItem(c);if(u&&(u=e.serializer.deserialize(u)),void 0!==(u=t(u,c.substring(i),s++)))return u}}}));return a(r,e),r},getItem:function(t,e){var n=this;t=u(t);var r=n.ready().then((function(){var e=n._dbInfo,r=localStorage.getItem(e.keyPrefix+t);return r&&(r=e.serializer.deserialize(r)),r}));return a(r,e),r},setItem:function(t,e,n){var r=this;t=u(t);var i=r.ready().then((function(){void 0===e&&(e=null);var n=e;return new s((function(i,o){var s=r._dbInfo;s.serializer.serialize(e,(function(e,r){if(r)o(r);else try{localStorage.setItem(s.keyPrefix+t,e),i(n)}catch(t){"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||o(t),o(t)}}))}))}));return a(i,n),i},removeItem:function(t,e){var n=this;t=u(t);var r=n.ready().then((function(){var e=n._dbInfo;localStorage.removeItem(e.keyPrefix+t)}));return a(r,e),r},clear:function(t){var e=this,n=e.ready().then((function(){for(var t=e._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(t)&&localStorage.removeItem(r)}}));return a(n,t),n},length:function(t){var e=this.keys().then((function(t){return t.length}));return a(e,t),e},key:function(t,e){var n=this,r=n.ready().then((function(){var e,r=n._dbInfo;try{e=localStorage.key(t)}catch(t){e=null}return e&&(e=e.substring(r.keyPrefix.length)),e}));return a(r,e),r},keys:function(t){var e=this,n=e.ready().then((function(){for(var t=e._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var o=localStorage.key(i);0===o.indexOf(t.keyPrefix)&&r.push(o.substring(t.keyPrefix.length))}return r}));return a(n,t),n},dropInstance:function(t,e){if(e=l.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var n=this.config();t.name=t.name||n.name,t.storeName=t.storeName||n.storeName}var r,i=this;return r=t.name?new s((function(e){t.storeName?e(Z(t,i._defaultConfig)):e(t.name+"/")})).then((function(t){for(var e=localStorage.length-1;e>=0;e--){var n=localStorage.key(e);0===n.indexOf(t)&&localStorage.removeItem(n)}})):s.reject("Invalid arguments"),a(r,e),r}},nt=function(t,e){for(var n=t.length,r=0;r<n;){if((i=t[r])===(o=e)||"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))return!0;r++}var i,o;return!1},rt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},it={},ot={},st={INDEXEDDB:N,WEBSQL:Q,LOCALSTORAGE:et},at=[st.INDEXEDDB._driver,st.WEBSQL._driver,st.LOCALSTORAGE._driver],ct=["dropInstance"],ut=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ct),lt={description:"",driver:at.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ht(t,e){t[e]=function(){var n=arguments;return t.ready().then((function(){return t[e].apply(t,n)}))}}function pt(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var n in e)e.hasOwnProperty(n)&&(rt(e[n])?arguments[0][n]=e[n].slice():arguments[0][n]=e[n])}return arguments[0]}var dt=function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),st)if(st.hasOwnProperty(n)){var r=st[n],i=r._driver;this[n]=i,it[i]||this.defineDriver(r)}this._defaultConfig=pt({},lt),this._config=pt({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return t.prototype.config=function(t){if("object"===(void 0===t?"undefined":r(t))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t)||!t.driver||this.setDriver(this._config.driver)}return"string"==typeof t?this._config[t]:this._config},t.prototype.defineDriver=function(t,e,n){var r=new s((function(e,n){try{var r=t._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver)return void n(i);for(var o=ut.concat("_initStorage"),c=0,u=o.length;c<u;c++){var l=o[c];if((!nt(ct,l)||t[l])&&"function"!=typeof t[l])return void n(i)}!function(){for(var e=function(t){return function(){var e=new Error("Method "+t+" is not implemented by the current driver"),n=s.reject(e);return a(n,arguments[arguments.length-1]),n}},n=0,r=ct.length;n<r;n++){var i=ct[n];t[i]||(t[i]=e(i))}}();var h=function(n){it[r]&&console.info("Redefining LocalForage driver: "+r),it[r]=t,ot[r]=n,e()};"_support"in t?t._support&&"function"==typeof t._support?t._support().then(h,n):h(!!t._support):h(!0)}catch(t){n(t)}}));return c(r,e,n),r},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(t,e,n){var r=it[t]?s.resolve(it[t]):s.reject(new Error("Driver not found."));return c(r,e,n),r},t.prototype.getSerializer=function(t){var e=s.resolve(K);return c(e,t),e},t.prototype.ready=function(t){var e=this,n=e._driverSet.then((function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready}));return c(n,t,t),n},t.prototype.setDriver=function(t,e,n){var r=this;rt(t)||(t=[t]);var i=this._getSupportedDrivers(t);function o(){r._config.driver=r.driver()}function a(t){return r._extend(t),o(),r._ready=r._initStorage(r._config),r._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return s.resolve()})):s.resolve();return this._driverSet=u.then((function(){var t=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(t).then((function(t){r._driver=t._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(t){return function(){var e=0;return function n(){for(;e<t.length;){var i=t[e];return e++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(a).catch(n)}o();var c=new Error("No available storage method found.");return r._driverSet=s.reject(c),r._driverSet}()}}(i)}))})).catch((function(){o();var t=new Error("No available storage method found.");return r._driverSet=s.reject(t),r._driverSet})),c(this._driverSet,e,n),this._driverSet},t.prototype.supports=function(t){return!!ot[t]},t.prototype._extend=function(t){pt(this,t)},t.prototype._getSupportedDrivers=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];this.supports(i)&&e.push(i)}return e},t.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=ut.length;t<e;t++)ht(this,ut[t])},t.prototype.createInstance=function(e){return new t(e)},t}(),ft=new dt;e.exports=ft},{3:3}]},{},[4])(4)},232:function(t,e,n){var r;!function(i,o){"use strict";var s="function",a="undefined",c="object",u="string",l="major",h="model",p="name",d="type",f="vendor",g="version",m="architecture",y="console",_="mobile",v="tablet",b="smarttv",w="wearable",E="embedded",S="Amazon",I="Apple",T="ASUS",C="BlackBerry",D="Browser",O="Chrome",x="Firefox",N="Google",A="Huawei",P="LG",L="Microsoft",R="Motorola",k="Opera",U="Samsung",M="Sharp",B="Sony",j="Xiaomi",F="Zebra",H="Facebook",$="Chromium OS",V="Mac OS",G=" Browser",W=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},q=function(t,e){return typeof t===u&&-1!==z(e).indexOf(z(t))},z=function(t){return t.toLowerCase()},K=function(t,e){if(typeof t===u)return t=t.replace(/^\s\s*/,""),typeof e===a?t:t.substring(0,500)},Y=function(t,e){for(var n,r,i,a,u,l,h=0;h<e.length&&!u;){var p=e[h],d=e[h+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(t))for(i=0;i<d.length;i++)l=u[++r],typeof(a=d[i])===c&&a.length>0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):o:this[a[0]]=l?a[1].call(this,l,a[2]):o:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):o):this[a]=l||o;h+=2}},J=function(t,e){for(var n in e)if(typeof e[n]===c&&e[n].length>0){for(var r=0;r<e[n].length;r++)if(q(e[n][r],t))return"?"===n?o:n}else if(q(e[n],t))return"?"===n?o:n;return e.hasOwnProperty("*")?e["*"]:t},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Q={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,g],[/opios[\/ ]+([\w\.]+)/i],[g,[p,k+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[p,k+" GX"]],[/\bopr\/([\w\.]+)/i],[g,[p,k]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[p,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[p,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[p,"Quark"]],[/\bddg\/([\w\.]+)/i],[g,[p,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[p,"UC"+D]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[g,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[p,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[p,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[g,[p,"Smart Lenovo "+D]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+D],g],[/\bfocus\/([\w\.]+)/i],[g,[p,x+" Focus"]],[/\bopt\/([\w\.]+)/i],[g,[p,k+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[g,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[g,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[g,[p,k+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[g,[p,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[g,[p,x]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[p,"360"]],[/\b(qq)\/([\w\.]+)/i],[[p,/(.+)/,"$1Browser"],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1"+G],g],[/samsungbrowser\/([\w\.]+)/i],[g,[p,U+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[g,[p,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[p,"Sogou Mobile"],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[p,g],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[p],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,H],g],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[p,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[p,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[p,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[p,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,O+" WebView"],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[p,"Android "+D]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[g,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[p,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[p,x+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[p,[g,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[p,[g,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,z]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[f,U],[d,v]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[h,[f,U],[d,_]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[f,I],[d,_]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[f,I],[d,v]],[/(macintosh);/i],[h,[f,I]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[f,M],[d,_]],[/(?:honor)([-\w ]+)[;\)]/i],[h,[f,"Honor"],[d,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[f,A],[d,v]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[f,A],[d,_]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[h,/_/g," "],[f,j],[d,_]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[f,j],[d,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[f,"OPPO"],[d,_]],[/\b(opd2\d{3}a?) bui/i],[h,[f,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[f,"Vivo"],[d,_]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[h,[f,"Realme"],[d,_]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[f,R],[d,_]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[f,R],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[f,P],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[f,P],[d,_]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[f,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[f,"Nokia"],[d,_]],[/(pixel c)\b/i],[h,[f,N],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[f,N],[d,_]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[f,B],[d,_]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[f,B],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[f,"OnePlus"],[d,_]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[f,S],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[f,S],[d,_]],[/(playbook);[-\w\),; ]+(rim)/i],[h,f,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[f,C],[d,_]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[f,T],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[f,T],[d,_]],[/(nexus 9)/i],[h,[f,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[h,/_/g," "],[d,_]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[h,[f,"TCL"],[d,v]],[/(itel) ((\w+))/i],[[f,z],h,[d,J,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[f,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[f,"Meizu"],[d,_]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[h,[f,"Ulefone"],[d,_]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[h,[f,"Energizer"],[d,_]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[h,[f,"Cat"],[d,_]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[h,[f,"Smartfren"],[d,_]],[/droid.+; (a(?:015|06[35]|142p?))/i],[h,[f,"Nothing"],[d,_]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,h,[d,_]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,h,[d,v]],[/(surface duo)/i],[h,[f,L],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[f,"Fairphone"],[d,_]],[/(u304aa)/i],[h,[f,"AT&T"],[d,_]],[/\bsie-(\w*)/i],[h,[f,"Siemens"],[d,_]],[/\b(rct\w+) b/i],[h,[f,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[h,[f,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[h,[f,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[f,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[h,[f,"NuVision"],[d,v]],[/\b(k88) b/i],[h,[f,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[h,[f,"ZTE"],[d,_]],[/\b(gen\d{3}) b.+49h/i],[h,[f,"Swiss"],[d,_]],[/\b(zur\d{3}) b/i],[h,[f,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[h,[f,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],h,[d,v]],[/\b(ns-?\w{0,9}) b/i],[h,[f,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[f,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],h,[d,_]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],h,[d,_]],[/\b(ph-1) /i],[h,[f,"Essential"],[d,_]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[f,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[h,[f,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[h,[f,"Rotor"],[d,v]],[/(shield[\w ]+) b/i],[h,[f,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[f,h,[d,_]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[f,L],[d,_]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[f,F],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[f,F],[d,_]],[/smart-tv.+(samsung)/i],[f,[d,b]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[f,U],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,P],[d,b]],[/(apple) ?tv/i],[f,[h,I+" TV"],[d,b]],[/crkey/i],[[h,O+"cast"],[f,N],[d,b]],[/droid.+aft(\w+)( bui|\))/i],[h,[f,S],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[f,M],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[h,[f,B],[d,b]],[/(mitv-\w{5}) bui/i],[h,[f,j],[d,b]],[/Hbbtv.*(technisat) (.*);/i],[f,h,[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[f,K],[h,K],[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,h,[d,y]],[/droid.+; (shield) bui/i],[h,[f,"Nvidia"],[d,y]],[/(playstation [345portablevi]+)/i],[h,[f,B],[d,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[f,L],[d,y]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[h,[f,U],[d,w]],[/((pebble))app/i],[f,h,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[f,I],[d,w]],[/droid.+; (glass) \d/i],[h,[f,N],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[h,[f,F],[d,w]],[/droid.+; (glass) \d/i],[h,[f,N],[d,w]],[/(pico) (4|neo3(?: link|pro)?)/i],[f,h,[d,w]],[/; (quest( \d| pro)?)/i],[h,[f,H],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,E]],[/(aeobc)\b/i],[h,[f,S],[d,E]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[h,[d,_]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,_]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[p,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[p,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,g],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,g],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[p,[g,J,X]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,J,X],[p,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,V],[g,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,g],[/\(bb(10);/i],[g,[p,C]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[g,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[p,x+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[g,[p,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,$],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,g],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,g]]},Z=function(t,e){if(typeof t===c&&(e=t,t=o),!(this instanceof Z))return new Z(t,e).getResult();var n=typeof i!==a&&i.navigator?i.navigator:o,r=t||(n&&n.userAgent?n.userAgent:""),y=n&&n.userAgentData?n.userAgentData:o,b=e?function(t,e){var n={};for(var r in t)e[r]&&e[r].length%2==0?n[r]=e[r].concat(t[r]):n[r]=t[r];return n}(Q,e):Q,w=n&&n.userAgent==r;return this.getBrowser=function(){var t,e={};return e[p]=o,e[g]=o,Y.call(e,r,b.browser),e[l]=typeof(t=e[g])===u?t.replace(/[^\d\.]/g,"").split(".")[0]:o,w&&n&&n.brave&&typeof n.brave.isBrave==s&&(e[p]="Brave"),e},this.getCPU=function(){var t={};return t[m]=o,Y.call(t,r,b.cpu),t},this.getDevice=function(){var t={};return t[f]=o,t[h]=o,t[d]=o,Y.call(t,r,b.device),w&&!t[d]&&y&&y.mobile&&(t[d]=_),w&&"Macintosh"==t[h]&&n&&typeof n.standalone!==a&&n.maxTouchPoints&&n.maxTouchPoints>2&&(t[h]="iPad",t[d]=v),t},this.getEngine=function(){var t={};return t[p]=o,t[g]=o,Y.call(t,r,b.engine),t},this.getOS=function(){var t={};return t[p]=o,t[g]=o,Y.call(t,r,b.os),w&&!t[p]&&y&&y.platform&&"Unknown"!=y.platform&&(t[p]=y.platform.replace(/chrome os/i,$).replace(/macos/i,V)),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(t){return r=typeof t===u&&t.length>500?K(t,500):t,this},this.setUA(r),this};Z.VERSION="1.0.40",Z.BROWSER=W([p,g,l]),Z.CPU=W([m]),Z.DEVICE=W([h,f,d,y,_,b,v,w,E]),Z.ENGINE=Z.OS=W([p,g]),typeof e!==a?(t.exports&&(e=t.exports=Z),e.UAParser=Z):n.amdO?(r=function(){return Z}.call(e,n,e,t))===o||(t.exports=r):typeof i!==a&&(i.UAParser=Z);var tt=typeof i!==a&&(i.jQuery||i.Zepto);if(tt&&!tt.ua){var et=new Z;tt.ua=et.getResult(),tt.ua.get=function(){return et.getUA()},tt.ua.set=function(t){et.setUA(t);var e=et.getResult();for(var n in e)tt.ua[n]=e[n]}}}("object"==typeof window?window:this)}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.amdO={},__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>rp});const t=!1;var e=__webpack_require__(586),n=__webpack_require__.n(e);class r{static SDK_VERSION="9.0.0";static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=1800;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static CTA_EVENT="letscooee:outbound:cta";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static{const t=r.SDK_VERSION.split(".").map((t=>t.padStart(2,"0"))).join("");r.SDK_VERSION_CODE=parseInt(t,10)}}class i{static log(...t){n().info(...t)}static debug(...t){n().debug(...t)}static error(...t){n().error(...t)}static warn(...t){n().warn(...t)}static info(...t){n().info(...t)}static trace(...t){n().trace(...t)}static configure(){n().useDefaults({formatter:function(t){t.unshift(`${r.LOG_PREFIX} (v${r.SDK_VERSION}):`)}});const t=this.getDebugParam();"1"!==t&&"on"!==t||(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?n().setLevel(n()[localStorage.cooeeLogLevel]):n().setLevel(n().OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let t="\n";t+="📣 Drive higher conversions with AI-powered onsite engagement\n",t+="🔍 Track real-time visitor intent & optimize engagement\n",t+="📊 Improve Meta Ads ROAS with intent-driven campaigns\n",t+="🛍️ Boost purchases & repeat sales effortlessly\n",t+="\n\n",t+=`Learn more: https://www.letscooee.com\nCooee SDK: v${r.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee 🚀 ","\n display: inline-block;\n font-size: 14px;\n background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);\n color: white;\n padding: 4px;\n border-radius: 4px;\n "),console.log(`%c${t}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}}class o{static entityMap={'"':"""};static escapeHtml(t){return String(t).replace(/"/g,(t=>o.entityMap[t]))}}var s,a,c,u,l,h,p,d,f,g,m,y,_,v,b,w,E,S,I,T,C,D,O,x,N,A,P,L,R,k,U,M,B,j,F;!function(t){t[t.IMAGE=1]="IMAGE",t[t.VIDEO=2]="VIDEO",t[t.GIF=3]="GIF",t[t.SCREENSHOT=4]="SCREENSHOT",t[t.THREE_D=5]="THREE_D",t[t.FONT=6]="FONT",t[t.TEXT=7]="TEXT",t[t.JSON=8]="JSON",t[t.SVG=9]="SVG",t[t.HTML=10]="HTML",t[t.LOGO=11]="LOGO",t[t.OTHERS=1e3]="OTHERS"}(s||(s={})),function(t){t[t.DRAFT=1]="DRAFT",t[t.PUBLISHED=2]="PUBLISHED",t[t.DISABLED=3]="DISABLED"}(a||(a={})),function(t){t[t.ONCE_PER_USER=1]="ONCE_PER_USER",t[t.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",t[t.EVERY_TIME=3]="EVERY_TIME"}(c||(c={})),function(t){t[t.ONE_TIME=1]="ONE_TIME",t[t.MULTIPLE=2]="MULTIPLE",t[t.RECURRING=3]="RECURRING"}(u||(u={})),function(t){t[t.NOW=1]="NOW",t[t.LATER=2]="LATER",t[t.NEVER=3]="NEVER"}(l||(l={})),function(t){t[t.PUBLISHED=1]="PUBLISHED",t[t.DRAFT=2]="DRAFT",t[t.PAUSED=3]="PAUSED",t[t.FAILED=4]="FAILED",t[t.STOPPED=5]="STOPPED",t[t.COMPLETED=6]="COMPLETED",t[t.ARCHIVED=7]="ARCHIVED",t[t.UNINSTALLED=8]="UNINSTALLED"}(h||(h={})),function(t){t[t.POPUP=1]="POPUP",t[t.LEAD_GENERATION=2]="LEAD_GENERATION",t[t.PRODUCT_WIDGET=3]="PRODUCT_WIDGET",t[t.PRODUCT_BUNDLE=4]="PRODUCT_BUNDLE",t[t.ANNOUNCEMENT_BAR=5]="ANNOUNCEMENT_BAR",t[t.CART_REMINDER=6]="CART_REMINDER",t[t.CRO_COPILOT=10]="CRO_COPILOT",t[t.OTHER=11]="OTHER"}(p||(p={})),function(t){t[t.NONE=0]="NONE",t[t.RULE_BASED=1]="RULE_BASED",t[t.INTENT_BASED=2]="INTENT_BASED"}(d||(d={})),function(t){t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING"}(f||(f={})),function(t){t[t.ALL=0]="ALL",t[t.NEW_ONLY=1]="NEW_ONLY",t[t.RETURNING_ONLY=2]="RETURNING_ONLY"}(g||(g={})),function(t){t[t.ALL=0]="ALL",t[t.LOGGED_IN_ONLY=3]="LOGGED_IN_ONLY",t[t.NON_LOGGED_IN_ONLY=4]="NON_LOGGED_IN_ONLY",t[t.PURCHASED=5]="PURCHASED",t[t.NON_PURCHASED=6]="NON_PURCHASED",t[t.ABANDON_CART=7]="ABANDON_CART",t[t.RETURNING_AND_NON_PURCHASED=8]="RETURNING_AND_NON_PURCHASED"}(m||(m={})),function(t){t.ALL="ALL",t.LOGGED_IN="LOGGED_IN",t.NON_LOGGED_IN="NON_LOGGED_IN"}(y||(y={})),function(t){t.ALL="ALL",t.PURCHASED="PURCHASED",t.NON_PURCHASED="NON_PURCHASED"}(_||(_={})),function(t){t[t.NONE=0]="NONE",t[t.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",t[t.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",t[t.SINGLE_ITEM=3]="SINGLE_ITEM",t[t.TOP_SELLING=4]="TOP_SELLING",t[t.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",t[t.NEW_ARRIVALS=6]="NEW_ARRIVALS",t[t.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",t[t.EVENT_ITEM=8]="EVENT_ITEM",t[t.CART_ITEM=9]="CART_ITEM",t[t.BUNDLE=10]="BUNDLE",t[t.CURRENT_ITEM=11]="CURRENT_ITEM",t[t.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",t[t.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",t[t.TRENDING_ITEMS=14]="TRENDING_ITEMS"}(v||(v={})),function(t){t[t.LAST_ADDED=1]="LAST_ADDED",t[t.FIRST_ADDED=2]="FIRST_ADDED",t[t.HIGHEST_PRICE=3]="HIGHEST_PRICE",t[t.LOWEST_PRICE=4]="LOWEST_PRICE",t[t.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",t[t.ALL=6]="ALL"}(b||(b={})),function(t){t[t.ALL=0]="ALL",t[t.ONLY_ORGANIC=1]="ONLY_ORGANIC",t[t.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",t[t.INCLUDES=3]="INCLUDES",t[t.EXCLUDES=4]="EXCLUDES"}(w||(w={})),function(t){t[t.NONE=0]="NONE",t[t.LIKE=1]="LIKE",t[t.NOT_LIKE=2]="NOT_LIKE",t[t.EQUALS=3]="EQUALS",t[t.NOT_EQUALS=4]="NOT_EQUALS"}(E||(E={})),function(t){t[t.NONE=0]="NONE",t[t.LESS_THAN=1]="LESS_THAN",t[t.GREATER_THAN=2]="GREATER_THAN",t[t.BETWEEN=3]="BETWEEN",t[t.EQUALS=4]="EQUALS"}(S||(S={})),function(t){t[t.ALL=0]="ALL",t[t.INCLUDES=1]="INCLUDES",t[t.EXCLUDES=2]="EXCLUDES"}(I||(I={})),function(t){t[t.NONE=0]="NONE",t[t.AMOUNT=1]="AMOUNT",t[t.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",t[t.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT"}(T||(T={})),function(t){t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION"}(C||(C={})),function(t){t[t.NONE=0]="NONE",t[t.SINGLE=1]="SINGLE",t[t.MULTIPLE=2]="MULTIPLE"}(D||(D={})),function(t){t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast"}(O||(O={})),function(t){t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer"}(x||(x={})),function(t){t.ONCE_IN_SESSION="ONCE_IN_SESSION",t.ACROSS_SESSIONS="ACROSS_SESSIONS"}(N||(N={})),function(t){t.DAYS="DAYS",t.HOURS="HOURS",t.MINUTES="MINUTES",t.SECONDS="SECONDS"}(A||(A={})),function(t){t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION"}(P||(P={})),function(t){t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR"}(L||(L={})),function(t){t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR"}(R||(R={})),function(t){t.COOEE="COOEE",t.KLAVIYO="KLAVIYO"}(k||(k={})),function(t){t.ICONS="ICONS",t.TILES="TILES"}(U||(U={})),function(t){t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT"}(M||(M={})),function(t){t.VIEW_ITEM="VIEW_ITEM",t.ADD_TO_CART="ADD_TO_CART",t.VIEW_CATEGORY="VIEW_CATEGORY",t.VIEW_TAG="VIEW_TAG",t.SEARCH="SEARCH",t.APPLY_COUPON="APPLY_COUPON"}(B||(B={})),function(t){t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE"}(j||(j={})),function(t){t.FIXED_AMOUNT="fixed_amount",t.PERCENTAGE="percentage"}(F||(F={}));class H{static of(t,e){return void 0!==e?new Array(t).fill(e):Array.from({length:t},((t,e)=>e))}static remove(t,e){const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)}static swap(t,e,n){[t[e],t[n]]=[t[n],t[e]]}static sum(t,e){return t.reduce(((t,n)=>t+Math.max(e?e(n):+n,0)),0)}static unique(t,e){return t.filter(((t,n,r)=>r.findIndex((n=>n[e]===t[e]))===n))}static shuffle(t){let e=t.length;for(;0!=e;){const n=Math.floor(Math.random()*e);e--,H.swap(t,e,n)}}}var $,V,G,W,q,z,K,Y,J,X,Q,Z,tt={},et=[],nt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,rt=Array.isArray;function it(t,e){for(var n in e)t[n]=e[n];return t}function ot(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function st(t,e,n){var r,i,o,s={};for(o in e)"key"==o?r=e[o]:"ref"==o?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?$.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===s[o]&&(s[o]=t.defaultProps[o]);return at(t,s,r,i,null)}function at(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++G:i,__i:-1,__u:0};return null==i&&null!=V.vnode&&V.vnode(o),o}function ct(t){return t.children}function ut(t,e){this.props=t,this.context=e}function lt(t,e){if(null==e)return t.__?lt(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?lt(t):null}function ht(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return ht(t)}}function pt(t){(!t.__d&&(t.__d=!0)&&q.push(t)&&!dt.__r++||z!==V.debounceRendering)&&((z=V.debounceRendering)||K)(dt)}function dt(){var t,e,n,r,i,o,s,a;for(q.sort(Y);t=q.shift();)t.__d&&(e=q.length,r=void 0,o=(i=(n=t).__v).__e,s=[],a=[],n.__P&&((r=it({},i)).__v=i.__v+1,V.vnode&&V.vnode(r),wt(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[o]:null,s,null==o?lt(i):o,!!(32&i.__u),a),r.__v=i.__v,r.__.__k[r.__i]=r,Et(s,r,a),r.__e!=o&&ht(r)),q.length>e&&q.sort(Y));dt.__r=0}function ft(t,e,n,r,i,o,s,a,c,u,l){var h,p,d,f,g,m,y=r&&r.__k||et,_=e.length;for(c=gt(n,e,y,c,_),h=0;h<_;h++)null!=(d=n.__k[h])&&(p=-1===d.__i?tt:y[d.__i]||tt,d.__i=h,m=wt(t,d,p,i,o,s,a,c,u,l),f=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&It(p.ref,null,d),l.push(d.ref,d.__c||f,d)),null==g&&null!=f&&(g=f),4&d.__u||p.__k===d.__k?c=mt(d,c,t):"function"==typeof d.type&&void 0!==m?c=m:f&&(c=f.nextSibling),d.__u&=-7);return n.__e=g,c}function gt(t,e,n,r,i){var o,s,a,c,u,l=n.length,h=l,p=0;for(t.__k=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(c=o+p,(s=t.__k[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?at(null,s,null,null,null):rt(s)?at(ct,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?at(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,-1!==(u=s.__i=yt(s,n,c,h))&&(h--,(a=n[u])&&(a.__u|=2)),null==a||null===a.__v?(-1==u&&p--,"function"!=typeof s.type&&(s.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,s.__u|=4))):t.__k[o]=null;if(h)for(o=0;o<l;o++)null!=(a=n[o])&&!(2&a.__u)&&(a.__e==r&&(r=lt(a)),Tt(a,a));return r}function mt(t,e,n){var r,i;if("function"==typeof t.type){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=mt(r[i],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=lt(t)),n.insertBefore(t.__e,e||null),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function yt(t,e,n,r){var i,o,s=t.key,a=t.type,c=e[n];if(null===c||c&&s==c.key&&a===c.type&&!(2&c.__u))return n;if(r>(null==c||2&c.__u?0:1))for(i=n-1,o=n+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&!(2&c.__u)&&s==c.key&&a===c.type)return i;i--}if(o<e.length){if((c=e[o])&&!(2&c.__u)&&s==c.key&&a===c.type)return o;o++}}return-1}function _t(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||nt.test(e)?n:n+"px"}function vt(t,e,n,r,i){var o;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||_t(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||_t(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(J,"$1")),e=e.toLowerCase()in t||"onFocusOut"==e||"onFocusIn"==e?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=X,t.addEventListener(e,o?Z:Q,o)):t.removeEventListener(e,o?Z:Q,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function bt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(null==e.t)e.t=X++;else if(e.t<n.u)return;return n(V.event?V.event(e):e)}}}function wt(t,e,n,r,i,o,s,a,c,u){var l,h,p,d,f,g,m,y,_,v,b,w,E,S,I,T,C,D=e.type;if(void 0!==e.constructor)return null;128&n.__u&&(c=!!(32&n.__u),o=[a=e.__e=n.__e]),(l=V.__b)&&l(e);t:if("function"==typeof D)try{if(y=e.props,_="prototype"in D&&D.prototype.render,v=(l=D.contextType)&&r[l.__c],b=l?v?v.props.value:l.__:r,n.__c?m=(h=e.__c=n.__c).__=h.__E:(_?e.__c=h=new D(y,b):(e.__c=h=new ut(y,b),h.constructor=D,h.render=Ct),v&&v.sub(h),h.props=y,h.state||(h.state={}),h.context=b,h.__n=r,p=h.__d=!0,h.__h=[],h._sb=[]),_&&null==h.__s&&(h.__s=h.state),_&&null!=D.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=it({},h.__s)),it(h.__s,D.getDerivedStateFromProps(y,h.__s))),d=h.props,f=h.state,h.__v=e,p)_&&null==D.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),_&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(_&&null==D.getDerivedStateFromProps&&y!==d&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(y,b),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,b)||e.__v==n.__v)){for(e.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some((function(t){t&&(t.__=e)})),w=0;w<h._sb.length;w++)h.__h.push(h._sb[w]);h._sb=[],h.__h.length&&s.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,b),_&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(d,f,g)}))}if(h.context=b,h.props=y,h.__P=t,h.__e=!1,E=V.__r,S=0,_){for(h.state=h.__s,h.__d=!1,E&&E(e),l=h.render(h.props,h.state,h.context),I=0;I<h._sb.length;I++)h.__h.push(h._sb[I]);h._sb=[]}else do{h.__d=!1,E&&E(e),l=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++S<25);h.state=h.__s,null!=h.getChildContext&&(r=it(it({},r),h.getChildContext())),_&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(d,f)),a=ft(t,rt(T=null!=l&&l.type===ct&&null==l.key?l.props.children:l)?T:[T],e,n,r,i,o,s,a,c,u),h.base=e.__e,e.__u&=-161,h.__h.length&&s.push(h),m&&(h.__E=h.__=null)}catch(t){if(e.__v=null,c||null!=o)if(t.then){for(e.__u|=c?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(C=o.length;C--;)ot(o[C]);else e.__e=n.__e,e.__k=n.__k;V.__e(t,e,n)}else null==o&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=St(n.__e,e,n,r,i,o,s,c,u);return(l=V.diffed)&&l(e),128&e.__u?void 0:a}function Et(t,e,n){for(var r=0;r<n.length;r++)It(n[r],n[++r],n[++r]);V.__c&&V.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){V.__e(t,e.__v)}}))}function St(t,e,n,r,i,o,s,a,c){var u,l,h,p,d,f,g,m=n.props,y=e.props,_=e.type;if("svg"==_?i="http://www.w3.org/2000/svg":"math"==_?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=o)for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!_&&(_?d.localName==_:3==d.nodeType)){t=d,o[u]=null;break}if(null==t){if(null==_)return document.createTextNode(y);t=document.createElementNS(i,_,y.is&&y),a&&(V.__m&&V.__m(e,o),a=!1),o=null}if(null===_)m===y||a&&t.data===y||(t.data=y);else{if(o=o&&$.call(t.childNodes),m=n.props||tt,!a&&null!=o)for(m={},u=0;u<t.attributes.length;u++)m[(d=t.attributes[u]).name]=d.value;for(u in m)if(d=m[u],"children"==u);else if("dangerouslySetInnerHTML"==u)h=d;else if(!(u in y)){if("value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y)continue;vt(t,u,null,d,i)}for(u in y)d=y[u],"children"==u?p=d:"dangerouslySetInnerHTML"==u?l=d:"value"==u?f=d:"checked"==u?g=d:a&&"function"!=typeof d||m[u]===d||vt(t,u,d,m[u],i);if(l)a||h&&(l.__html===h.__html||l.__html===t.innerHTML)||(t.innerHTML=l.__html),e.__k=[];else if(h&&(t.innerHTML=""),ft(t,rt(p)?p:[p],e,n,r,"foreignObject"==_?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&<(n,0),a,c),null!=o)for(u=o.length;u--;)ot(o[u]);a||(u="value","progress"==_&&null==f?t.removeAttribute("value"):void 0!==f&&(f!==t[u]||"progress"==_&&!f||"option"==_&&f!==m[u])&&vt(t,u,f,m[u],i),u="checked",void 0!==g&&g!==t[u]&&vt(t,u,g,m[u],i))}return t}function It(t,e,n){try{if("function"==typeof t){var r="function"==typeof t.__u;r&&t.__u(),r&&null==e||(t.__u=t(e))}else t.current=e}catch(t){V.__e(t,n)}}function Tt(t,e,n){var r,i;if(V.unmount&&V.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||It(r,null,e)),null!=(r=t.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(t){V.__e(t,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Tt(r[i],e,n||"function"!=typeof t.type);n||ot(t.__e),t.__c=t.__=t.__e=void 0}function Ct(t,e,n){return this.constructor(t,n)}function Dt(t,e,n){var r,i,o,s;e==document&&(e=document.documentElement),V.__&&V.__(t,e),i=(r="function"==typeof n)?null:n&&n.__k||e.__k,o=[],s=[],wt(e,t=(!r&&n||e).__k=st(ct,null,[t]),i||tt,tt,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?$.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,s),Et(o,t,s)}$=et.slice,V={__e:function(t,e,n,r){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.__d),s)return i.__E=i}catch(e){t=e}throw t}},G=0,W=function(t){return null!=t&&null==t.constructor},ut.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=it({},this.state),"function"==typeof t&&(t=t(it({},n),this.props)),t&&it(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),pt(this))},ut.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),pt(this))},ut.prototype.render=ct,q=[],K="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Y=function(t,e){return t.__v.__b-e.__v.__b},dt.__r=0,J=/(PointerCapture)$|Capture$/i,X=0,Q=bt(!1),Z=bt(!0);var Ot,xt,Nt,At,Pt=0,Lt=[],Rt=V,kt=Rt.__b,Ut=Rt.__r,Mt=Rt.diffed,Bt=Rt.__c,jt=Rt.unmount,Ft=Rt.__;function Ht(t,e){var n=function(t,e){Rt.__h&&Rt.__h(xt,t,Pt||e),Pt=0;var n=xt.__H||(xt.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}(Ot++,7);return function(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function $t(){for(var t;t=Lt.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Wt),t.__H.__h.forEach(qt),t.__H.__h=[]}catch(e){t.__H.__h=[],Rt.__e(e,t.__v)}}Rt.__b=function(t){xt=null,kt&&kt(t)},Rt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ft&&Ft(t,e)},Rt.__r=function(t){Ut&&Ut(t),Ot=0;var e=(xt=t.__c).__H;e&&(Nt===xt?(e.__h=[],xt.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0}))):(e.__h.forEach(Wt),e.__h.forEach(qt),e.__h=[],Ot=0)),Nt=xt},Rt.diffed=function(t){Mt&&Mt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Lt.push(e)&&At===Rt.requestAnimationFrame||((At=Rt.requestAnimationFrame)||Gt)($t)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.i=void 0}))),Nt=xt=null},Rt.__c=function(t,e){e.some((function(t){try{t.__h.forEach(Wt),t.__h=t.__h.filter((function(t){return!t.__||qt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],Rt.__e(n,t.__v)}})),Bt&&Bt(t,e)},Rt.unmount=function(t){jt&&jt(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{Wt(t)}catch(t){e=t}})),n.__H=void 0,e&&Rt.__e(e,n.__v))};var Vt="function"==typeof requestAnimationFrame;function Gt(t){var e,n=function(){clearTimeout(r),Vt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);Vt&&(e=requestAnimationFrame(n))}function Wt(t){var e=xt,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),xt=e}function qt(t){var e=xt;t.__c=t.__(),xt=e}var zt=Symbol.for("preact-signals");function Kt(){if(Qt>1)Qt--;else{for(var t,e=!1;void 0!==Xt;){var n=Xt;for(Xt=void 0,Zt++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ie(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=r}}if(Zt=0,Qt--,e)throw t}}var Yt,Jt=void 0,Xt=void 0,Qt=0,Zt=0,te=0;function ee(t){if(void 0!==Jt){var e=t.n;if(void 0===e||e.t!==Jt)return e={i:0,S:t,p:Jt.s,n:void 0,t:Jt,e:void 0,x:void 0,r:e},void 0!==Jt.s&&(Jt.s.n=e),Jt.s=e,t.n=e,32&Jt.f&&t.S(e),e;if(-1===e.i)return e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=Jt.s,e.n=void 0,Jt.s.n=e,Jt.s=e),e}}function ne(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function re(t){return new ne(t)}function ie(t){for(var e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function oe(t){for(var e=t.s;void 0!==e;e=e.n){var n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function se(t){for(var e=t.s,n=void 0;void 0!==e;){var r=e.p;-1===e.i?(e.S.U(e),void 0!==r&&(r.n=e.n),void 0!==e.n&&(e.n.p=r)):n=e,e.S.n=e.r,void 0!==e.r&&(e.r=void 0),e=r}t.s=n}function ae(t){ne.call(this,void 0),this.x=t,this.s=void 0,this.g=te-1,this.f=4}function ce(t){var e=t.u;if(t.u=void 0,"function"==typeof e){Qt++;var n=Jt;Jt=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,ue(t),e}finally{Jt=n,Kt()}}}function ue(t){for(var e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ce(t)}function le(t){if(Jt!==this)throw new Error("Out-of-order effect");se(this),Jt=t,this.f&=-2,8&this.f&&ue(this),Kt()}function he(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function pe(t){var e=new he(t);try{e.c()}catch(t){throw e.d(),t}return e.d.bind(e)}function de(t,e){V[t]=e.bind(null,V[t]||function(){})}function fe(t){Yt&&Yt(),Yt=t&&t.S()}function ge(t){var e=this,n=t.data,r=function(t){return Ht((function(){return re(t)}),[])}(n);r.value=n;var i=Ht((function(){for(var t=e.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}return e.__$u.c=function(){var t,n=e.__$u.S(),r=i.value;n(),W(r)||3!==(null==(t=e.base)?void 0:t.nodeType)?(e.__$f|=1,e.setState({})):e.base.data=r},new ae((function(){var t=r.value.value;return 0===t?0:!0===t?"":t||""}))}),[]);return i.value}function me(t,e,n,r){var i=e in t&&void 0===t.ownerSVGElement,o=re(n);return{o:function(t,e){o.value=t,r=e},d:pe((function(){var n=o.value.value;r[e]!==n&&(r[e]=n,i?t[e]=n:n?t.setAttribute(e,n):t.removeAttribute(e))}))}}ne.prototype.brand=zt,ne.prototype.h=function(){return!0},ne.prototype.S=function(t){this.t!==t&&void 0===t.e&&(t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},ne.prototype.U=function(t){if(void 0!==this.t){var e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n)}},ne.prototype.subscribe=function(t){var e=this;return pe((function(){var n=e.value,r=Jt;Jt=void 0;try{t(n)}finally{Jt=r}}))},ne.prototype.valueOf=function(){return this.value},ne.prototype.toString=function(){return this.value+""},ne.prototype.toJSON=function(){return this.value},ne.prototype.peek=function(){var t=Jt;Jt=void 0;try{return this.value}finally{Jt=t}},Object.defineProperty(ne.prototype,"value",{get:function(){var t=ee(this);return void 0!==t&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Zt>100)throw new Error("Cycle detected");this.v=t,this.i++,te++,Qt++;try{for(var e=this.t;void 0!==e;e=e.x)e.t.N()}finally{Kt()}}}}),(ae.prototype=new ne).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===te)return!0;if(this.g=te,this.f|=1,this.i>0&&!ie(this))return this.f&=-2,!0;var t=Jt;try{oe(this),Jt=this;var e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Jt=t,se(this),this.f&=-2,!0},ae.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(var e=this.s;void 0!==e;e=e.n)e.S.S(e)}ne.prototype.S.call(this,t)},ae.prototype.U=function(t){if(void 0!==this.t&&(ne.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(var e=this.s;void 0!==e;e=e.n)e.S.U(e)}},ae.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;void 0!==t;t=t.x)t.t.N()}},Object.defineProperty(ae.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ee(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),he.prototype.c=function(){var t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var e=this.x();"function"==typeof e&&(this.u=e)}finally{t()}},he.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ce(this),oe(this),Qt++;var t=Jt;return Jt=this,le.bind(this,t)},he.prototype.N=function(){2&this.f||(this.f|=2,this.o=Xt,Xt=this)},he.prototype.d=function(){this.f|=8,1&this.f||ue(this)},ge.displayName="_st",Object.defineProperties(ne.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ge},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),de("__b",(function(t,e){if("string"==typeof e.type){var n,r=e.props;for(var i in r)if("children"!==i){var o=r[i];o instanceof ne&&(n||(e.__np=n={}),n[i]=o,r[i]=o.peek())}}t(e)})),de("__r",(function(t,e){fe();var n,r=e.__c;r&&(r.__$f&=-2,void 0===(n=r.__$u)&&(r.__$u=n=function(){var t;return pe((function(){t=this})),t.c=function(){r.__$f|=1,r.setState({})},t}())),fe(n),t(e)})),de("__e",(function(t,e,n,r){fe(),t(e,n,r)})),de("diffed",(function(t,e){var n;if(fe(),"string"==typeof e.type&&(n=e.__e)){var r=e.__np,i=e.props;if(r){var o=n.U;if(o)for(var s in o){var a=o[s];void 0===a||s in r||(a.d(),o[s]=void 0)}else n.U=o={};for(var c in r){var u=o[c],l=r[c];void 0===u?(u=me(n,c,l,i),o[c]=u):u.o(l,i)}}}t(e)})),de("unmount",(function(t,e){if("string"==typeof e.type){var n=e.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var o=r[i];o&&o.d()}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)})),de("__h",(function(t,e,n,r){(r<3||9===r)&&(e.__$f|=2),t(e,n,r)})),ut.prototype.shouldComponentUpdate=function(t,e){var n=this.__$u,r=n&&void 0!==n.s;for(var i in e)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(r||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var o in t)if("__source"!==o&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};var ye=Object.prototype.toString,_e=Array.isArray||function(t){return"[object Array]"===ye.call(t)};function ve(t){return"function"==typeof t}function be(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function we(t,e){return null!=t&&"object"==typeof t&&e in t}var Ee=RegExp.prototype.test,Se=/\S/;var Ie={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},Te=/\s*/,Ce=/\s+/,De=/\s*=/,Oe=/\s*\}/,xe=/#|\^|\/|>|\{|&|=|!/;function Ne(t){this.string=t,this.tail=t,this.pos=0}function Ae(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Pe(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Ne.prototype.eos=function(){return""===this.tail},Ne.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var n=e[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},Ne.prototype.scanUntil=function(t){var e,n=this.tail.search(t);switch(n){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=e.length,e},Ae.prototype.push=function(t){return new Ae(t,this)},Ae.prototype.lookup=function(t){var e,n,r,i=this.cache;if(i.hasOwnProperty(t))e=i[t];else{for(var o,s,a,c=this,u=!1;c;){if(t.indexOf(".")>0)for(o=c.view,s=t.split("."),a=0;null!=o&&a<s.length;)a===s.length-1&&(u=we(o,s[a])||(n=o,r=s[a],null!=n&&"object"!=typeof n&&n.hasOwnProperty&&n.hasOwnProperty(r))),o=o[s[a++]];else o=c.view[t],u=we(c.view,t);if(u){e=o;break}c=c.parent}i[t]=e}return ve(e)&&(e=e.call(this.view)),e},Pe.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},Pe.prototype.parse=function(t,e){var n=this.templateCache,r=t+":"+(e||Le.tags).join(":"),i=void 0!==n,o=i?n.get(r):void 0;return null==o&&(o=function(t,e){if(!t)return[];var n,r,i,o,s=!1,a=[],c=[],u=[],l=!1,h=!1,p="",d=0;function f(){if(l&&!h)for(;u.length;)delete c[u.pop()];else u=[];l=!1,h=!1}function g(t){if("string"==typeof t&&(t=t.split(Ce,2)),!_e(t)||2!==t.length)throw new Error("Invalid tags: "+t);n=new RegExp(be(t[0])+"\\s*"),r=new RegExp("\\s*"+be(t[1])),i=new RegExp("\\s*"+be("}"+t[1]))}g(e||Le.tags);for(var m,y,_,v,b,w,E=new Ne(t);!E.eos();){if(m=E.pos,_=E.scanUntil(n))for(var S=0,I=_.length;S<I;++S)o=v=_.charAt(S),function(t,e){return Ee.call(t,e)}(Se,o)?(h=!0,s=!0,p+=" "):(u.push(c.length),p+=v),c.push(["text",v,m,m+1]),m+=1,"\n"===v&&(f(),p="",d=0,s=!1);if(!E.scan(n))break;if(l=!0,y=E.scan(xe)||"name",E.scan(Te),"="===y?(_=E.scanUntil(De),E.scan(De),E.scanUntil(r)):"{"===y?(_=E.scanUntil(i),E.scan(Oe),E.scanUntil(r),y="&"):_=E.scanUntil(r),!E.scan(r))throw new Error("Unclosed tag at "+E.pos);if(b=">"==y?[y,_,m,E.pos,p,d,s]:[y,_,m,E.pos],d++,c.push(b),"#"===y||"^"===y)a.push(b);else if("/"===y){if(!(w=a.pop()))throw new Error('Unopened section "'+_+'" at '+m);if(w[1]!==_)throw new Error('Unclosed section "'+w[1]+'" at '+m)}else"name"===y||"{"===y||"&"===y?h=!0:"="===y&&g(_)}if(f(),w=a.pop())throw new Error('Unclosed section "'+w[1]+'" at '+E.pos);return function(t){for(var e,n=[],r=n,i=[],o=0,s=t.length;o<s;++o)switch((e=t[o])[0]){case"#":case"^":r.push(e),i.push(e),r=e[4]=[];break;case"/":i.pop()[5]=e[2],r=i.length>0?i[i.length-1][4]:n;break;default:r.push(e)}return n}(function(t){for(var e,n,r=[],i=0,o=t.length;i<o;++i)(e=t[i])&&("text"===e[0]&&n&&"text"===n[0]?(n[1]+=e[1],n[3]=e[3]):(r.push(e),n=e));return r}(c))}(t,e),i&&n.set(r,o)),o},Pe.prototype.render=function(t,e,n,r){var i=this.getConfigTags(r),o=this.parse(t,i),s=e instanceof Ae?e:new Ae(e,void 0);return this.renderTokens(o,s,n,t,r)},Pe.prototype.renderTokens=function(t,e,n,r,i){for(var o,s,a,c="",u=0,l=t.length;u<l;++u)a=void 0,"#"===(s=(o=t[u])[0])?a=this.renderSection(o,e,n,r,i):"^"===s?a=this.renderInverted(o,e,n,r,i):">"===s?a=this.renderPartial(o,e,n,i):"&"===s?a=this.unescapedValue(o,e):"name"===s?a=this.escapedValue(o,e,i):"text"===s&&(a=this.rawValue(o)),void 0!==a&&(c+=a);return c},Pe.prototype.renderSection=function(t,e,n,r,i){var o=this,s="",a=e.lookup(t[1]);if(a){if(_e(a))for(var c=0,u=a.length;c<u;++c)s+=this.renderTokens(t[4],e.push(a[c]),n,r,i);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)s+=this.renderTokens(t[4],e.push(a),n,r,i);else if(ve(a)){if("string"!=typeof r)throw new Error("Cannot use higher-order sections without the original template");null!=(a=a.call(e.view,r.slice(t[3],t[5]),(function(t){return o.render(t,e,n,i)})))&&(s+=a)}else s+=this.renderTokens(t[4],e,n,r,i);return s}},Pe.prototype.renderInverted=function(t,e,n,r,i){var o=e.lookup(t[1]);if(!o||_e(o)&&0===o.length)return this.renderTokens(t[4],e,n,r,i)},Pe.prototype.indentPartial=function(t,e,n){for(var r=e.replace(/[^ \t]/g,""),i=t.split("\n"),o=0;o<i.length;o++)i[o].length&&(o>0||!n)&&(i[o]=r+i[o]);return i.join("\n")},Pe.prototype.renderPartial=function(t,e,n,r){if(n){var i=this.getConfigTags(r),o=ve(n)?n(t[1]):n[t[1]];if(null!=o){var s=t[6],a=t[5],c=t[4],u=o;0==a&&c&&(u=this.indentPartial(o,c,s));var l=this.parse(u,i);return this.renderTokens(l,e,n,u,r)}}},Pe.prototype.unescapedValue=function(t,e){var n=e.lookup(t[1]);if(null!=n)return n},Pe.prototype.escapedValue=function(t,e,n){var r=this.getConfigEscape(n)||Le.escape,i=e.lookup(t[1]);if(null!=i)return"number"==typeof i&&r===Le.escape?String(i):r(i)},Pe.prototype.rawValue=function(t){return t[1]},Pe.prototype.getConfigTags=function(t){return _e(t)?t:t&&"object"==typeof t?t.tags:void 0},Pe.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!_e(t)?t.escape:void 0};var Le={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Re.templateCache=t},get templateCache(){return Re.templateCache}},Re=new Pe;Le.clearCache=function(){return Re.clearCache()},Le.parse=function(t,e){return Re.parse(t,e)},Le.render=function(t,e,n,r){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+(_e(i=t)?"array":typeof i)+'" was given as the first argument for mustache#render(template, view, partials)');var i;return Re.render(t,e,n,r)},Le.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return Ie[t]}))},Le.Scanner=Ne,Le.Context=Ae,Le.Writer=Pe;const ke=Le;var Ue=__webpack_require__(232),Me=__webpack_require__.n(Ue);class Be{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new(Me());constructor(){}static get(){return Be._instance||(Be._instance=new Be),Be._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Be.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Be.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return"mobile"===this.parser.getDevice().type}calculateScalingFactor(t){const e=t.max,n=t.cont.w,r=t.cont.h,i=t.spc;let o=Be.get().getWidth(),s=Be.get().getHeight();e&&(o=o?Math.min(o,e):e,s=s?Math.min(s,e):e),s&&(o-=i.getHorizontal(),s-=i.getVertical(),this.scalingFactor=o/s<n/r?o/n:s/r,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(t){return this.doc.createElement(t)}appendChild(t,e){t.appendChild(e)}setStyles(t,e){Object.assign(t.style,e)}setStyle(t,e,n){e&&(n?t.style.setProperty(e,n,"important"):t.style.removeProperty(e))}setAttribute(t,e,n){t.setAttribute(e,n)}removeInApp(t){const e=document.querySelector(`.${t.rootClassName}`);e&&e.parentElement.removeChild(e)}setParentContainer(t){this.parentContainer=t,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}}class je{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart"}var Fe=__webpack_require__(790),He=__webpack_require__.n(Fe);function $e(t){return He().createInstance({name:"lc",storeName:t,driver:He().LOCALSTORAGE})}class Ve{static storage;static async get(t,e){return await(this.storage?.getItem(t))??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}}class Ge extends Ve{static storeName="ses";static{this.storage=$e(this.storeName)}}class We extends Ve{static storeName="usr";static{this.storage=$e(this.storeName)}}class qe{static INSTANCE=new qe;isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;_shopCurrencyCode;_moneyFormat;_jsLoadTime=new Date;constructor(){}get currencyCode(){return this._currencyCode}get shopCurrencyCode(){return this._shopCurrencyCode}get moneyFormat(){return this._moneyFormat}get jsLoadTime(){return this._jsLoadTime}set currencyCode(t){this._currencyCode=t}set moneyFormat(t){this._moneyFormat=t}set shopCurrencyCode(t){this._shopCurrencyCode=t}set jsLoadTime(t){this._jsLoadTime=t}static getInstance(){return this.INSTANCE}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return null==this.lastEnterInactive}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=t}}class ze{static COOEE_URL_PREFIX="?from=cooee";static isShopify(){return!!window.Shopify}static getShopName(){if(this.isShopify())return window.Shopify.shop?.split(".")?.[0]}static getPageName(){if(!this.isShopify())return;const t=new URL(window.location.href).pathname.slice(1).split("/"),e=t[0];return""===e?"home":"collections"===e?"products"===t[2]?"product":"collection":"products"===e?"product":"cart"===e?"cart":location.href.includes("thank_you")?"thank_you":void 0}static getProductSlug(t){const e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(t){return this.getRootPrefix()+t+this.COOEE_URL_PREFIX}}class Ke{isLocked=!1;queue=[];async acquire(){this.isLocked?await new Promise((t=>this.queue.push(t))):this.isLocked=!0}release(){if(this.queue.length>0){const t=this.queue.shift();t&&t()}else this.isLocked=!1}}class Ye{static CURRENT;token;items;total_price;currency;item_count;attributes;lock=new Ke;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new Ye),this.CURRENT}async getNormalisedCart(t){await this.fetchCartFromShopify(t);const e=this.convertToCooeeCart();return t&&await We.set(je.CURRENT_CART,e),e}async addCooeeAttributes(){await this.lock.acquire();const t=await Ge.get(je.ID),e=await We.get(je.DEVICE_ID);if(this.attributes?.letscooee_did===e&&this.attributes?.letscooee_sid===t)return i.log("Not calling Shopify update.js API.","Current attributes:",this.attributes),void this.lock.release();const n={letscooee_did:e,letscooee_sid:t,__letscooee_time:(new Date).toLocaleString()};i.log("Updating Shopify cart with attributes:",n);const r=ze.getCartURL("cart/update.js"),o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})}),s=await o.json();i.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(t){return this.token=t.token,this.items=t.items,this.total_price=t.total_price,this.currency=t.currency,this.item_count=t.item_count,this.attributes=t.attributes,qe.getInstance().currencyCode=this.currency,i.log(`Updated ShopifyCart. Current value: ${this}`),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(t){if(!t)return i.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);const e=[];for(const n of t){if(!n.id||!n.title){i.warn("Invalid item received",n);continue}const t={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0},r=n.selling_plan_allocation?.selling_plan;r?(t.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:r.fixed_selling_plan,id:r.id,name:r.name,recurringDeliveries:r.recurring_deliveries}},e.push(t)):e.push(t)}return e}async fetchCartFromShopify(t){if(!t&&this.token)return void i.debug("Not fetching cart");i.debug("Fetching cart");const e=ze.getCartURL("cart.js"),n=await(await fetch(e)).json();this.update(n)}}var Je=function(t,e){return Je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Je(t,e)};function Xe(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Je(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function Qe(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Ze(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function tn(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function en(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function nn(t){return this instanceof nn?(this.v=t,this):new nn(t)}function rn(t){return"function"==typeof t}function on(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var sn=on((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function an(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var cn=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=Ze(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}else o.remove(this);var c=this.initialTeardown;if(rn(c))try{c()}catch(t){i=t instanceof sn?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=Ze(u),h=l.next();!h.done;h=l.next()){var p=h.value;try{hn(p)}catch(t){i=null!=i?i:[],t instanceof sn?i=en(en([],tn(i)),tn(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new sn(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)hn(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&an(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&an(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),un=cn.EMPTY;function ln(t){return t instanceof cn||t&&"closed"in t&&rn(t.remove)&&rn(t.add)&&rn(t.unsubscribe)}function hn(t){rn(t)?t():t.unsubscribe()}var pn=null,dn=null,fn=void 0,gn=!1,mn=!1,yn={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=yn.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,en([t,e],tn(n))):setTimeout.apply(void 0,en([t,e],tn(n)))},clearTimeout:function(t){var e=yn.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function _n(t){yn.setTimeout((function(){if(!pn)throw t;pn(t)}))}function vn(){}var bn=wn("C",void 0,void 0);function wn(t,e,n){return{kind:t,value:e,error:n}}var En=null;function Sn(t){if(gn){var e=!En;if(e&&(En={errorThrown:!1,error:null}),t(),e){var n=En,r=n.errorThrown,i=n.error;if(En=null,r)throw i}}else t()}var In=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,ln(e)&&e.add(n)):n.destination=An,n}return Xe(e,t),e.create=function(t,e,n){return new On(t,e,n)},e.prototype.next=function(t){this.isStopped?Nn(function(t){return wn("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Nn(wn("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Nn(bn,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(cn),Tn=Function.prototype.bind;function Cn(t,e){return Tn.call(t,e)}var Dn=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){xn(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){xn(t)}else xn(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){xn(t)}},t}(),On=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;return rn(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&mn?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&Cn(e.next,o),error:e.error&&Cn(e.error,o),complete:e.complete&&Cn(e.complete,o)}):i=e,s.destination=new Dn(i),s}return Xe(e,t),e}(In);function xn(t){var e;gn?(e=t,gn&&En&&(En.errorThrown=!0,En.error=e)):_n(t)}function Nn(t,e){var n=dn;n&&yn.setTimeout((function(){return n(t,e)}))}var An={closed:!0,next:vn,error:function(t){throw t},complete:vn},Pn="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ln(t){return t}var Rn=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof In||function(t){return t&&rn(t.next)&&rn(t.error)&&rn(t.complete)}(r)&&ln(r)?t:new On(t,e,n);return Sn((function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=kn(e))((function(e,r){var i=new On({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[Pn]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(n=t).length?Ln:1===n.length?n[0]:function(t){return n.reduce((function(t,e){return e(t)}),t)})(this);var n},t.prototype.toPromise=function(t){var e=this;return new(t=kn(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function kn(t){var e;return null!==(e=null!=t?t:fn)&&void 0!==e?e:Promise}var Un=on((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Mn=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return Xe(e,t),e.prototype.lift=function(t){var e=new Bn(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Un},e.prototype.next=function(t){var e=this;Sn((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=Ze(e.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(t)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;Sn((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;Sn((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?un:(this.currentObservers=null,o.push(t),new cn((function(){e.currentObservers=null,an(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new Rn;return t.source=this,t},e.create=function(t,e){return new Bn(t,e)},e}(Rn),Bn=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return Xe(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:un},e}(Mn),jn=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return Xe(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(Mn),Fn=function(t){function e(e,n){return t.call(this)||this}return Xe(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(cn),Hn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Hn.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,en([t,e],tn(n))):setInterval.apply(void 0,en([t,e],tn(n)))},clearInterval:function(t){var e=Hn.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},$n=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return Xe(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),Hn.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&Hn.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,an(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Fn),Vn={now:function(){return(Vn.delegate||Date).now()},delegate:void 0},Gn=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=Vn.now,t}(),Wn=new(function(t){function e(e,n){void 0===n&&(n=Gn.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return Xe(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(Gn))($n);function qn(t){return function(e){if(function(t){return rn(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function zn(t,e,n,r,i){return new Yn(t,e,n,r,i)}var Kn,Yn=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return Xe(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(In);function Jn(t,e){return void 0===e&&(e=Wn),qn((function(n,r){var i=null,o=null,s=null,a=function(){if(i){i.unsubscribe(),i=null;var t=o;o=null,r.next(t)}};function c(){var n=s+t,o=e.now();if(o<n)return i=this.schedule(void 0,n-o),void r.add(i);a()}n.subscribe(zn(r,(function(n){o=n,s=e.now(),i||(i=e.schedule(c,t),r.add(i))}),(function(){a(),r.complete()}),void 0,(function(){o=i=null})))}))}class Xn{static INSTANCE=new Xn;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(t,e){this.topics[t]||(this.topics[t]=new Mn),this.topics[t].next({topic:t,data:e})}subscriber(t){return this.topics[t]||(this.topics[t]=new Mn),this.topics[t].asObservable()}}class Qn{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=tr.get().website??{};currentState=!1;drawerSubject=new jn({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble"].join(",");cartSelector=[Qn.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize()}get element(){return this.cartDrawerElement}static get(){return Qn._instance||(Qn._instance=new Qn),Qn._instance}static forceUpdate(){Qn._instance=new Qn}isOpen(){const t=this.inShadow?this.isPresent():this.isVisible();return n().log("Cart drawer is currently "+(t?"open":"close")),t}open(){if(this.isOpen())return void i.log("Drawer is already open");document.dispatchEvent(new CustomEvent(r.CTA_OPEN_CART_EVENT));const t=document.querySelector(this.iconSelector);t?t.click():i.debug("No clickable cart icon found with selector",this.iconSelector)}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===Qn.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&"mini-cart"===this.element?.id}refreshUI(t){this.isMiniCart()&&this.element?._rerenderCart?this.element._rerenderCart({detail:{cart:t}}):this.isShopifyDefaultDrawer()?this.element?.renderContents&&t&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(t)):this.element?.onCartDrawerUpdate?this.element.onCartDrawerUpdate():window.icartCartActivityEvent?window.icartCartActivityEvent():window.theme?.CartDrawer?(new window.theme.CartDrawer).init():window.Hs_CartDrawer?.updateSlideCart?window.Hs_CartDrawer.updateSlideCart():window.theme?.fetch_side_cart?window.theme.fetch_side_cart():window.theme?.Cart?.updateCart?window.theme.Cart.updateCart():window.cartUpdate?window.cartUpdate():this.element?._onCartRefresh?this.element._onCartRefresh():"cart-drawer-component"===this.element?.tagName?.toLowerCase()?document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart")):"sidebar-cart"===this.element?.id?document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}})):i.info("No method found to update the cart without refreshing"),Xn.get().broadcast(r.CART_UPDATE_BROADCAST)}async initialize(){const t=this.configWebsite.cartDrawerSelector;if(!t)return void await this.findCartDrawer();const e=t.split(":shadow");1===e.length?(this.selector=e[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=e[0]?.trim(),this.selector=e[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!ze.isShopify())return;const t=this.selector||this.cartSelector;this.cartDrawerElement=await rr.retrySelector(t),this.cartDrawerElement?(n().log("Found",this.cartDrawerElement,`from selector: ${t}`),this.createMutationObserver()):n().warn("Max attempts exhausted to find cart drawer")}async findCartDrawerWithShadow(){if(!ze.isShopify()||!this.shadowParentElementSelector)return;const t=await rr.retrySelector(this.shadowParentElementSelector),e=t?.shadowRoot;"open"===e?.mode&&(this.cartDrawerShadowElement=e,this.createMutationObserver())}isVisible(){if(!this.cartDrawerElement)return!1;const t=this.cartDrawerElement.getBoundingClientRect(),e=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,r=t.top<=e&&t.bottom>=0,i=t.left<=n&&t.right>=0,o=r&&i,s=this.cartDrawerElement.tagName.toLowerCase()===Qn.DEFAULT_SELECTOR&&this.cartDrawerElement.open,a=getComputedStyle(this.cartDrawerElement),c="none"!==a.display&&"hidden"!==a.visibility&&parseFloat(a.opacity)>0,u=!this.cartDrawerElement.hidden,l=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,h=a.transform.match(/matrix\(([^)]+)\)/);let p=0,d=0;if(h){const t=h[1].split(", ").map(parseFloat);p=t[4],d=t[5]}const f=p+t.left>n||p+t.right<0||d+t.top>e||d+t.bottom<0,g=Math.max(0,Math.min(t.right,n)-Math.max(t.left,0))*Math.max(0,Math.min(t.bottom,e)-Math.max(t.top,0)),m=t.width*t.height;return(o||s||!f)&&c&&u&&l&&m>0&&g/m>=.1}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;const t=this.cartDrawerElement||this.cartDrawerShadowElement,e=new Mn;this.mutationObserver=new MutationObserver((()=>{e.next()})),this.mutationObserver.observe(t,{attributes:!0,subtree:!0,childList:this.inShadow}),e.pipe(Jn(500)).subscribe((()=>{const t=this.isOpen();this.currentState!==t&&(this.currentState=t,this.drawerSubject.next({open:t,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))}))}isPresent(){return!(!this.selector||!this.cartDrawerShadowElement||!this.cartDrawerShadowElement.querySelector(this.selector))}}class Zn extends Ve{static storeName="app";static{this.storage=$e(this.storeName)}}class tr{static INSTANCE=new tr;gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;currency;static{Zn.get(je.APP_CONFIG,{}).then((t=>this.INSTANCE.update(t)))}constructor(){}static get(){return this.INSTANCE}static async set(t){this.INSTANCE.update(t);try{await Zn.set(je.APP_CONFIG,this.INSTANCE),i.log("App configurations stored")}catch(t){i.error(t)}return this.INSTANCE}update(t){t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,Qn.forceUpdate()}}class er{static format(t,e){return e.replace(/{{\s*(\w+)\s*}}/,((e,n)=>{switch(n){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return e}}))}static formatWithDelimiters(t,e=2,n=",",r="."){if(isNaN(t)||null==t)return"0";const i=(t/100).toFixed(e).split(".");return i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n)+(i[1]?r+i[1]:"")}}class nr{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}static parseToAny(t){try{return JSON.parse(t.toString())}catch(t){}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise((e=>setTimeout(e,t)))}static hasKeys(t){return!!t&&Object.keys(t).length>=1}static convertObjectToArray(t,e){return e.reduce(((e,n)=>(t.hasOwnProperty(n)&&null!=t[n]&&e.push({[n]:t[n]}),e)),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce(((e,n)=>(null!==t[n]&&void 0!==t[n]&&(e[n]=t[n]),e)),{})}static stringify(t){return JSON.stringify(t,(function(t,e){return void 0===e?null:e}))}}class rr{static tz;static isValidURL(t){try{return new URL(t)}catch(t){return}}static isNull(t){return!t||"null"===t||"undefined"===t}static removeFromArray(t,e){const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)}static formatCurrency(t,e){if(0==t&&e)return"Free";const n=qe.getInstance(),r=tr.get(),i=n.shopCurrencyCode??r.currency,o=n.currencyCode,s=r.money?.format??n.moneyFormat;let a;return s&&i===o?a=er.format(100*t,s):(a=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:o,minimumFractionDigits:0,maximumFractionDigits:2}).format(t),a=a.replace("₹","Rs. "),r.money?.showCurrency&&"INR"!==o&&(a=a.concat(` ${o}`))),a}static formatNumber(t){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(t)}static getLang(){return void 0!==navigator.languages?navigator.languages[0].split("-")[0]:navigator.language??"en"}static getTimezone(){if(this.tz)return this.tz;try{return this.tz=Intl.DateTimeFormat().resolvedOptions().timeZone,this.tz}catch(t){return""}}static documentReady(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}static onDocumentLoaded(t){"complete"===document.readyState?t():document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&t()}))}static showSnackbar(t){const e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout((()=>{e.classList.remove("show"),document.body.removeChild(e)}),3e3)}static async retrySelectorForElements(t,e=10,n=document){let r=0,o=document.querySelectorAll("nonexistent-tag");for(;r<e;){const e=Math.min(100*2**r,5e3);if(await nr.sleep(e),o=n.querySelectorAll(t),o.length)return i.debug(`Attempt ${r+1}: ${o.length} elements found with ${t}`),o;i.debug(`Attempt ${r+1}: Elements not found with ${t}. Retrying after ${e}ms.`),r++}return i.warn(`Max attempts reached. Element not found with ${t}.`),o}static async retrySelector(t,e=10,n=document){return(await this.retrySelectorForElements(t,e,n)).item(0)}}class ir{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price}}class or{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}}class sr{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=t.d}}class ar{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}}class cr{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map((t=>new or(t)))??[],this.link=t.link,this.price=new sr(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,t.sellingPlans?.length&&(this.selectedSellingPlan=re(void 0)),this.sellingPlans=t.sellingPlans?.map((t=>{const e=new ar(t);return e.isSelected&&(this.selectedSellingPlan.value=e),e}))}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.INACTIVE=2]="INACTIVE",t[t.DRAFT=3]="DRAFT",t[t.ARCHIVED=4]="ARCHIVED",t[t.OUT_OF_STOCK=5]="OUT_OF_STOCK"}(Kn||(Kn={}));class ur{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;selectedOrFirstVariant;selected=re(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=re(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find((t=>t.isAvailable))??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.portraitVideos=t.videos?.filter((t=>"PORTRAIT"===t.orientation)),t.vars&&(this.vars=t.vars.map((t=>new cr(t)))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new ir({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}}class lr{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}}class hr{enabled;constructor(t){this.enabled=t.enabled}}class pr extends hr{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}}class dr{productQuantity;constructor(t){t??={},this.productQuantity=new pr(t.productQuantity)}}const fr="a-f\\d",gr=`#?[${fr}]{3}[${fr}]?`,mr=`#?[${fr}]{6}([${fr}]{2})?`,yr=new RegExp(`[^#${fr}]`,"gi"),_r=new RegExp(`^${gr}$|^${mr}$`,"i");class vr{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return function(t,e={}){if("string"!=typeof t||yr.test(t)||!_r.test(t))throw new TypeError("Expected a valid hex string");let n=1;8===(t=t.replace(/^#/,"")).length&&(n=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),4===t.length&&(n=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const r=Number.parseInt(t,16),i=r>>16,o=r>>8&255,s=255&r,a="number"==typeof e.alpha?e.alpha:n;return"array"===e.format?[i,o,s,a]:"css"===e.format?`rgb(${i} ${o} ${s}${1===a?"":` / ${Number((100*a).toFixed(2))}%`})`:{red:i,green:o,blue:s,alpha:a}}(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}}class br{static DEFAULT_FALLBACK=new vr({h:"#000000",a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new vr(t.c)),t.fb&&(this.fb=new vr(t.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??br.DEFAULT_FALLBACK}}class wr{s;g;i;constructor(t){t.s&&(this.s=new vr(t.s)),t.g&&(this.g=new br(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}}class Er{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new vr(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Sr[this.s??Sr.SOLID]}}var Sr,Ir,Tr,Cr,Dr,Or,xr,Nr,Ar,Pr,Lr,Rr,kr,Ur,Mr,Br,jr,Fr;!function(t){t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED"}(Sr||(Sr={}));class Hr{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new vr(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}}class $r{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}}class Vr{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}}class Gr{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new wr(t.bg)),t.br&&(this.br=new Er(t.br)),t.shd&&(this.shd=new Hr(t.shd)),t.spc&&(this.spc=new $r(t.spc)),this.trf=new Vr(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Ir[this.t]}get click(){return this.clc}}!function(t){t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE"}(Ir||(Ir={}));class Wr extends Gr{o;constructor(t){super(t),this.o=t.o??Tr.C,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}}!function(t){t[t.NW=1]="NW",t[t.N=2]="N",t[t.NE=3]="NE",t[t.W=4]="W",t[t.C=5]="C",t[t.E=6]="E",t[t.SW=7]="SW",t[t.S=8]="S",t[t.SE=9]="SE"}(Tr||(Tr={}));class qr extends Gr{src;constructor(t){super(t),this.src=t.src}}!function(t){t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY"}(Cr||(Cr={})),function(t){t.NONE="",t.UNDERLINE="underline",t.LINE_THROUGH="line-through"}(Dr||(Dr={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(Or||(Or={})),function(t){t[t.ADD_TO_CART=1]="ADD_TO_CART",t[t.VIEW_ITEM=2]="VIEW_ITEM"}(xr||(xr={}));class zr{name;fonts;constructor(t){(t=t??{}).name&&(t.name="Arial"!==t.name?t.name:""),this.name=t.name,this.fonts=t.fonts?.map((t=>new Kr(t)))}}class Kr{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===Nr.ITALICS||this.style===Nr.BOLD_ITALICS?"italic":"normal",weight:this.style===Nr.BOLD_ITALICS||this.style===Nr.BOLD?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}}!function(t){t[t.REGULAR=1]="REGULAR",t[t.ITALICS=2]="ITALICS",t[t.BOLD=3]="BOLD",t[t.BOLD_ITALICS=4]="BOLD_ITALICS"}(Nr||(Nr={}));class Yr{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return Cr[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){(t=t??{}).lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new vr(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new vr(t.tc),this.ta=t.ta??Cr.CENTER,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new zr(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}}class Jr extends Gr{typo;constructor(t){super(t);const e={...t.f,...t.typo};t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new Yr(e)}get color(){return this.typography.tc}get typography(){return this.typo}}class Xr extends Jr{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}}!function(t){t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY"}(Ar||(Ar={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SUPER=1]="SUPER",t[t.SUB=2]="SUB"}(Pr||(Pr={}));class Qr extends Gr{constructor(t){super(t)}}!function(t){t[t.FIXED=1]="FIXED",t[t.RELATIVE=2]="RELATIVE"}(Lr||(Lr={}));class Zr{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let n=new Date;t===Lr.RELATIVE?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;const r=window.setInterval((()=>{const t=(new Date).getTime(),i=n.getTime()-t;if(i<1)return void clearInterval(r);const o=Math.floor(i/864e5),s=Math.floor(i%864e5/36e5),a=Math.floor(i%36e5/6e4),c=Math.floor(i%6e4/1e3);e({days:o,hours:s,minutes:a,seconds:c})}),1e3);return r}}class ti extends Jr{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Zr(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}}class ei{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new vr(t.c??{})}get text(){return this.txt}get color(){return this.c}}class ni extends Jr{ph;constructor(t){super(t),this.ph=new ei(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}}class ri extends ni{constructor(t){t??={},super(t)}}class ii extends ni{}class oi extends ni{}class si extends qr{}!function(t){t[t.ABOVE_PAGE=1]="ABOVE_PAGE",t[t.EMBEDDED=2]="EMBEDDED"}(Rr||(Rr={})),function(t){t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH"}(kr||(kr={}));class ai{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case Ur.SLIDE_IN_TOP:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case Ur.SLIDE_IN_DOWN:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case Ur.SLIDE_IN_LEFT:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case Ur.SLIDE_IN_RIGHT:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case Ur.SLIDE_IN_TOP_LEFT:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case Ur.SLIDE_IN_TOP_RIGHT:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case Ur.SLIDE_IN_BOTTOM_LEFT:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case Ur.SLIDE_IN_BOTTOM_RIGHT:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case Ur.POP:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case Mr.SLIDE_OUT_TOP:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case Mr.SLIDE_OUT_DOWN:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case Mr.SLIDE_OUT_LEFT:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case Mr.SLIDE_OUT_RIGHT:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case Mr.SLIDE_OUT_TOP_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case Mr.SLIDE_OUT_TOP_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case Mr.SLIDE_OUT_BOTTOM_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case Mr.SLIDE_OUT_BOTTOM_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case Mr.POP:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}}!function(t){t[t.NONE=1]="NONE",t[t.SLIDE_IN_TOP=2]="SLIDE_IN_TOP",t[t.SLIDE_IN_DOWN=3]="SLIDE_IN_DOWN",t[t.SLIDE_IN_LEFT=4]="SLIDE_IN_LEFT",t[t.SLIDE_IN_RIGHT=5]="SLIDE_IN_RIGHT",t[t.SLIDE_IN_TOP_LEFT=6]="SLIDE_IN_TOP_LEFT",t[t.SLIDE_IN_TOP_RIGHT=7]="SLIDE_IN_TOP_RIGHT",t[t.SLIDE_IN_BOTTOM_LEFT=8]="SLIDE_IN_BOTTOM_LEFT",t[t.SLIDE_IN_BOTTOM_RIGHT=9]="SLIDE_IN_BOTTOM_RIGHT",t[t.POP=10]="POP"}(Ur||(Ur={})),function(t){t[t.NONE=1]="NONE",t[t.SLIDE_OUT_TOP=2]="SLIDE_OUT_TOP",t[t.SLIDE_OUT_DOWN=3]="SLIDE_OUT_DOWN",t[t.SLIDE_OUT_LEFT=4]="SLIDE_OUT_LEFT",t[t.SLIDE_OUT_RIGHT=5]="SLIDE_OUT_RIGHT",t[t.SLIDE_OUT_TOP_LEFT=6]="SLIDE_OUT_TOP_LEFT",t[t.SLIDE_OUT_TOP_RIGHT=7]="SLIDE_OUT_TOP_RIGHT",t[t.SLIDE_OUT_BOTTOM_LEFT=8]="SLIDE_OUT_BOTTOM_LEFT",t[t.SLIDE_OUT_BOTTOM_RIGHT=9]="SLIDE_OUT_BOTTOM_RIGHT",t[t.POP=10]="POP"}(Mr||(Mr={}));class ci extends Gr{gvt;max;cover;anim;embedded;position;constructor(t){super(t=t??{}),this.gvt=t.gvt??Br.C,this.max=t.max,this.cover=t.cover??!0,this.anim=new ai(t.anim),this.embedded=t.embedded,this.position=t.position??Rr.ABOVE_PAGE,this.spc||(this.spc=new $r({pl:r.IN_APP_DEFAULT_PADDING,pr:r.IN_APP_DEFAULT_PADDING,pt:r.IN_APP_DEFAULT_PADDING,pb:r.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===Rr.EMBEDDED&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}}class ui extends ci{cont;elems=[];mob;constructor(t){super(t=t??{}),this.cont=new Wr(t.cont),this.mob=new ci(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach((t=>{t.t===Ir.IMAGE?this.elems.push(new qr(t)):t.t===Ir.TEXT||t.t===Ir.BUTTON?this.elems.push(new Xr(t)):t.t===Ir.SHAPE?this.elems.push(new Qr(t)):t.t===Ir.EMAIL_INPUT?this.elems.push(new ii(t)):t.t===Ir.PHONE_INPUT?this.elems.push(new oi(t)):t.t===Ir.COUNTDOWN_TIMER?this.elems.push(new ti(t)):t.t===Ir.PRODUCT_VARIATIONS||t.t===Ir.PRODUCT_VARIATIONS_SELLING_PLANS?this.elems.push(new ri(t)):t.t===Ir.PRODUCT_IMAGE&&this.elems.push(new si(t))}))}getStylesForWrapper(){if(this.cover)return{};let t;return t=this.gvt===Br.NW?{top:0,left:0}:this.gvt===Br.N?{top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===Br.NE?{top:0,right:0}:this.gvt===Br.E?{top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===Br.SE?{bottom:0,right:0}:this.gvt===Br.S?{bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===Br.SW?{bottom:0,left:0}:this.gvt===Br.W?{top:"50%",left:0,transform:"translateY(-50%)"}:{top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){const t={display:"flex",flexDirection:"row"};let e,n;return this.gvt===Br.NW?(e="flex-start",n="flex-start"):this.gvt===Br.N?(e="center",n="flex-start"):this.gvt===Br.NE?(e="flex-end",n="flex-start"):this.gvt===Br.W?(e="flex-start",n="center"):this.gvt===Br.E?(e="flex-end",n="center"):this.gvt===Br.SW?(e="flex-start",n="flex-end"):this.gvt===Br.S?(e="center",n="flex-end"):this.gvt===Br.SE?(e="flex-end",n="flex-end"):(e="center",n="center"),t.alignItems=n,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}}!function(t){t[t.NW=1]="NW",t[t.N=2]="N",t[t.NE=3]="NE",t[t.W=4]="W",t[t.C=5]="C",t[t.E=6]="E",t[t.SW=7]="SW",t[t.S=8]="S",t[t.SE=9]="SE"}(Br||(Br={}));class li{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}}class hi{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}}class pi{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}}class di{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new $r(t.spc),t.size&&(this.size=new pi(t.size)),t.bg&&(this.bg=new wr(t.bg)),t.br&&(this.br=new Er(t.br)),t.typo&&(this.typo=new Yr(t.typo)),t.lout&&(this.lout=new hi(t.lout)),t.flex&&(this.flex=new li(t.flex))}}class fi{sm;lg;constructor(t){t??={},this.sm=new di(t.sm),this.lg=new di(t.lg)}}class gi{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new fi(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Ir[this.t]}}class mi extends gi{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??Ir.TEXT,t),t??={},this.text=t.text}}class yi extends mi{constructor(t,e){super(t,e??Ir.BUTTON)}}class _i extends gi{value;constructor(t){super(Ir.CHECKBOX,t),t??={},this.value=t.value}}class vi extends mi{constructor(t=Ir.PRODUCT_VARIATIONS,e){super(e,t)}}class bi{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new vr(t.color)}}class wi{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new vr(t.color)}}class Ei{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new wi(t.navigation),this.pagination=new bi(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}}class Si extends gi{conf;slide;formData;values;allowedTypes;constructor(t){super(Ir.CAROUSEL,t),t&&this.update(t)}update(t){t??={},this.slide=Di.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new Ei(t.conf),this.allowedTypes=t.allowedTypes}}class Ii extends mi{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,Ir.COUNTDOWN_TIMER),this.gap=t.gap,this.timerType=t.type,this.timer=new Zr(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}}class Ti extends gi{elems;constructor(t){super(Ir.FLEXBOX,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach((t=>{const e=Di.getParsedElement(t);e&&this.elems.push(e)}))}}class Ci extends gi{src;sm;lg;constructor(t,e){super(e??Ir.IMAGE,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}}class Di{static getParsedElements(t){const e=[];return t?.forEach((t=>{const n=Di.getParsedElement(t);n&&e.push(n)})),e}static getParsedElement(t){switch(t.t){case Ir.TEXT:return new mi(t);case Ir.BUTTON:return new yi(t);case Ir.CHECKBOX:return new _i(t);case Ir.PRODUCTS:return new xi(t);case Ir.PRODUCT:return new Oi(t);case Ir.COUNTDOWN_TIMER:return new Ii(t);case Ir.FLEXBOX:return new Ti(t);case Ir.IMAGE:return new Ci(t);case Ir.PRODUCT_IMAGE:return new Ci(t,Ir.PRODUCT_IMAGE);case Ir.PRODUCT_TITLE:return new mi(t,Ir.PRODUCT_TITLE);case Ir.PRODUCT_VARIATIONS:case Ir.PRODUCT_VARIATIONS_SELLING_PLANS:return new vi(t.t,t);case Ir.PRODUCT_BUTTON:return new yi(t,Ir.PRODUCT_BUTTON);case Ir.CAROUSEL:return new Si(t);default:return void n().error("Unknown element type",t.t)}}static parseAlignmentToJustifyContent(t){switch(t){case Cr.CENTER:return"center";case Cr.END:return"flex-end";case Cr.START:default:return"flex-start"}}}class Oi extends gi{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(Ir.PRODUCT,t),this.show=t.show,this.elems=Di.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new _i(t.cBox)),this.elems.push(new Ci(t.img,Ir.PRODUCT_IMAGE));const e=new mi(t.title,Ir.PRODUCT_TITLE);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);const n=new mi(t.price);n.text="{{ product.price }}",n.hide=!t.show?.price;const r=new mi(t.compareAt);r.text="{{ product.compare_price }}",r.hide=!t.show?.price,t.compareAt||(r.style=new fi(n.style),r.style.lg.typo=new Yr({...r.style.lg.typo,td:Dr.LINE_THROUGH}),r.style.sm.typo=new Yr({...r.style.sm.typo,td:Dr.LINE_THROUGH}));const i=new Ti({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Di.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});i.elems.push(r),i.elems.push(n),this.elems.push(i);const o=new vi(Ir.PRODUCT_VARIATIONS,t.variantDD);if(o.hide=!t.show?.variantDD,this.elems.push(o),t.btn){const e=new yi(t.btn,Ir.PRODUCT_BUTTON);e.hide=!t.show?.btn,this.elems.push(e)}}t.symbol&&(this.symbol=new mi(t.symbol))}}class xi extends gi{conf;prod;constructor(t){super(Ir.PRODUCTS,t),t??={},this.conf=new Ai(t.conf),this.prod=new Oi(t.prod)}}!function(t){t[t.SIMPLE_SCROLL=0]="SIMPLE_SCROLL",t[t.GRID=1]="GRID",t[t.CAROUSAL=2]="CAROUSAL"}(jr||(jr={}));class Ni extends Ei{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}}class Ai{lg;sm;constructor(t){t??={},this.lg=new Ni(t.lg),this.sm=new Ni(t.sm)}}class Pi extends Ti{constructor(t){super(t)}}class Li{cont;elems=[];constructor(t){t=t??{},this.cont=new Pi(t.cont),t.elems?.forEach((t=>{this.addRawElement(t)}))}addRawElement(t){const e=Di.getParsedElement(t);return e&&this.elems.push(e),e}}class Ri{minValue;rewardType;label;reachingText;reachedText;discount;items;constructor(t){this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map((t=>new ir(t)))}}class ki{layout;milestones;constructor(t){this.layout=t.layout??U.ICONS,this.milestones=t.milestones?.map((t=>new Ri(t)))}}!function(t){t.FIXED_AMOUNT="fixed_amount",t.PERCENTAGE="percentage"}(Fr||(Fr={}));class Ui{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===f.EXCLUSION}isABTesting(){return this.contentType===f.ABTESTING}isSingleContent(){return this.contentType===f.SINGLE}}class Mi extends Ui{static SWIPER_ELEMENTS=new Set([Ir.PRODUCTS,Ir.CAROUSEL]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;discountData=re({});constructor(t){super(t),this.id=t.id,this.nudgeID=t.nudgeID,this.currency=qe.getInstance().currencyCode??"USD",this.contentID=t.contentID,this.variation=t.variation,t.widget&&(this.widget=new Li(t.widget)),this.previewType=t.previewType,this.occurred=t.occurred??new Date,this.props=t.props,this.embeddedItems=t.embeddedItems?.map((t=>new ir(t))),this.items=t.items?.map((t=>new ur(t)))??[],this.nonMutableItems=t.items?.map((t=>new ur(t)))??[],this.collections=t.collections?.map((t=>new lr(t)))??[],this.discount=t.discount,this.placement=t.placement,this.customerData=t.customerData,this.ian=t.ian?this.processIAN(t.ian):void 0,this.promotionType=t.promotionType,this.manipulation=new dr(t.manipulation),this.contentSource=t.contentSource,this.klaviyoFormID=t.klaviyoFormID,this.hasMultiplePlacement=t.hasMultiplePlacement,this.skipSubscribedItems=t.skipSubscribedItems,t.progressBarConfig&&(this.progressBarConfig=new ki(t.progressBarConfig)),t.bundleFrom&&(this.bundleFrom=new ur(t.bundleFrom))}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){const t=(new Date).getTime()-this.occurred.getTime();return 1e3*this.delay-t}isBundle(){return this.objective===R.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===L.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===L.PAGE_EMBED}isProgressBar(){return this.objective===R.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===R.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===R.CART_RECOVERY}isProductPromotion(){return this.objective===R.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===R.BYOB}isShoppableVideo(){return this.objective===R.SHOPPABLE_VIDEO}processIAN(t){const e=JSON.stringify(t),n=this.items[0];let i={},o={};if(n){const t=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:t.mID,image:n.variantImage,price:rr.formatCurrency(t.price.d),comparePrice:rr.formatCurrency(t.price.cmp),quantity:n.quantity},o={quantity:t.quantity}}const s={productCount:Ye.getCurrent().item_count};let a=ke.render(e,{product:i,variant:o,cart:s,discount:this.discount,customer:this.customerData});return n&&(a=a.replace(new RegExp(r.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new ui(JSON.parse(a))}calculateDiscountData(t,e){const n=H.sum(t,(t=>t.selectedOrFirstVariant.value.price.d)),r={actualPrice:n,discountAmount:0,discountPercentage:0,discountedPrice:n};if(t?.length&&e&&this.discount?.type){if([j.UNIQUE_FLAT_ITEMS,j.STATIC].includes(this.discount.type)&&this.discount.values?.length)r.discountPercentage=this.discount.values[0],r.discountAmount=r.actualPrice*r.discountPercentage/100;else if(this.discount.type===j.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)r.discountAmount=r.actualPrice-this.discount.values[0],r.discountPercentage=r.discountAmount/r.actualPrice*100;else if(this.discount.type===j.UNIQUE_CHEAPEST_ITEM_FREE){t.sort(((t,e)=>e.selectedOrFirstVariant.value.price.d-t.selectedOrFirstVariant.value.price.d));const e=t[t.length-1];e.selectedOrFirstVariant.value.price.effective=0,r.discountAmount=e.selectedOrFirstVariant.value.price.d,r.discountPercentage=r.discountAmount/r.actualPrice*100}r.discountedPrice=r.actualPrice-r.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(r)}else this.discountData.value=this.formatCurrencyAndNumber(r)}getPrivateAttributesForLineItem(){return{_via:"Cooee",_letscooee_campaign:this.shortID}}isBundleDiscount(){return[j.UNIQUE_FIXED_ITEMS,j.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===L.CART_EMBED&&this.objective===R.BUNDLE_AND_UPSELL}hasSwiperElement(){const t=this.widget?.elems.find((t=>Mi.SWIPER_ELEMENTS.has(t.t)));if(!t)return!1;if(t.t===Ir.CAROUSEL)return!0;const e=Be.get().isMobile()?"sm":"lg";return t.conf[e].disp===jr.CAROUSAL}toString(){return`Engagement(id=${this.shortID})`}formatCurrencyAndNumber(t){if(!t)return{};const e={discountPercentage:rr.formatNumber(t.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map((n=>{e[n]=rr.formatCurrency(t[n])})),e}}for(var Bi=[],ji=[],Fi="undefined"!=typeof Uint8Array?Uint8Array:Array,Hi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$i=0;$i<64;++$i)Bi[$i]=Hi[$i],ji[Hi.charCodeAt($i)]=$i;function Vi(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function Gi(t,e,n){for(var r,i,o=[],s=e;s<n;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(Bi[(i=r)>>18&63]+Bi[i>>12&63]+Bi[i>>6&63]+Bi[63&i]);return o.join("")}ji["-".charCodeAt(0)]=62,ji["_".charCodeAt(0)]=63;var Wi,qi,zi=function(t){var e,n,r=Vi(t),i=r[0],o=r[1],s=new Fi(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,c=o>0?i-4:i;for(n=0;n<c;n+=4)e=ji[t.charCodeAt(n)]<<18|ji[t.charCodeAt(n+1)]<<12|ji[t.charCodeAt(n+2)]<<6|ji[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=ji[t.charCodeAt(n)]<<2|ji[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=ji[t.charCodeAt(n)]<<10|ji[t.charCodeAt(n+1)]<<4|ji[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},Ki=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(Gi(t,s,s+o>a?a:s+o));return 1===r?(e=t[n-1],i.push(Bi[e>>2]+Bi[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Bi[e>>10]+Bi[e>>4&63]+Bi[e<<2&63]+"=")),i.join("")},Yi=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,p=n?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=p,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},Ji=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?p/c:p*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+d]=255&s,d+=f,s/=256,u-=8);t[n+d-f]|=128*g},Xi=(Wi=function(t,e){var n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return s(t,e,n)}function s(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|p(t,e),r=i(n),s=r.write(t,e);return s!==n&&(r=r.slice(0,s)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(B(t,Uint8Array)){var e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(B(t,SharedArrayBuffer)||t&&B(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);var s=function(t){if(o.isBuffer(t)){var e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||j(t.length)?i(0):u(t):"Buffer"===t.type&&Array.isArray(t.data)?u(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return a(t),i(t<0?0:0|h(t))}function u(t){for(var e=t.length<0?0:0|h(t.length),n=i(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function l(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,o.prototype),r}function h(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function p(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(i)return r?-1:k(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return E(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function f(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),j(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var h=!0,p=0;p<c;p++)if(u(t,o+p)!==u(e,p)){h=!1;break}if(h)return o}return-1}function y(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(j(a))return s;t[n+s]=a}return s}function _(t,e,n,r){return M(k(e,t.length-n),t,n,r)}function v(t,e,n,r){return M(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n,r){return M(U(e),t,n,r)}function w(t,e,n,r){return M(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function E(t,e,n){return 0===e&&n===t.length?Ki(t):Ki(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=I));return n}(r)}e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,n){return s(t,e,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,n){return function(t,e,n){return a(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},o.allocUnsafe=function(t){return c(t)},o.allocUnsafeSlow=function(t){return c(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(B(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),B(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=o.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(B(s,Uint8Array))i+s.length>r.length?o.from(s).copy(r,i):Uint8Array.prototype.set.call(r,s,i);else{if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i)}i+=s.length}return r},o.byteLength=p,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)f(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)f(this,e,e+3),f(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)f(this,e,e+7),f(this,e+1,e+6),f(this,e+2,e+5),f(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):d.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(B(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(s,a),u=this.slice(r,i),l=t.slice(e,n),h=0;h<c;++h)if(u[h]!==l[h]){s=u[h],a=l[h];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":case"latin1":case"binary":return v(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function D(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=F[t[o]];return i}function O(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function x(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function A(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,i){return e=+e,n>>>=0,i||A(t,0,n,4),Ji(t,e,n,r,23,4),n+4}function L(t,e,n,r,i){return e=+e,n>>>=0,i||A(t,0,n,8),Ji(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),Yi(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),Yi(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),Yi(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),Yi(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return L(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return L(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var i=t.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=o.isBuffer(t)?t:o.from(t,r),c=a.length;if(0===c)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%c]}return this};var R=/[^+/0-9A-Za-z-_]/g;function k(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(t){return zi(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function B(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function j(t){return t!=t}var F=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)e[r+i]=t[n]+t[i];return e}()},Wi(qi={exports:{}},qi.exports),qi.exports),Qi=Xi.Buffer;Xi.SlowBuffer,Xi.INSPECT_MAX_BYTES,Xi.kMaxLength;var Zi=function(t,e){return Zi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Zi(t,e)};function to(t,e){function n(){this.constructor=t}Zi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var eo=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return to(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),no=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return to(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function ro(t){return t&&t.Math==Math&&t}function io(){return ro("object"==typeof globalThis&&globalThis)||ro("object"==typeof window&&window)||ro("object"==typeof self&&self)||ro("object"==typeof __webpack_require__.g&&__webpack_require__.g)||Function("return this")()}var oo=function(t){var e=function(){var t=io();return"object"==typeof t.navigator&&"ReactNative"===t.navigator.product}()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var n=Qi.alloc(t),r=0;r<t;++r)n[r]=Math.floor(256*Math.random());return n},so=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Qi.alloc(e))}}return void 0!==__webpack_require__.g&&__webpack_require__.g.crypto&&__webpack_require__.g.crypto.getRandomValues?function(t){return __webpack_require__.g.crypto.getRandomValues(Qi.alloc(t))}:oo}();function ao(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function co(t){return"object"==typeof t&&null!==t}function uo(t,e){var n=!1;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return n||(console.warn(e),n=!0),t.apply(this,r)}}function lo(t){if(ArrayBuffer.isView(t))return Qi.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return Qi.from(t);var e;throw new no("Must use either Buffer or TypedArray")}var ho=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,po=function(t){return"string"==typeof t&&ho.test(t)},fo=function(t){if(!po(t))throw new no('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Qi.from(e,"hex")},go=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},mo=(Math.pow(2,63),Math.pow(2,63),Math.pow(2,53)),yo=-Math.pow(2,53),_o=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new no("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=Qi.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=Qi.from(e,"binary"):Array.isArray(e)?this.buffer=Qi.from(e):this.buffer=lo(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new no("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new no("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||n>255)throw new no("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var r=Qi.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=n}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var n=Qi.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(lo(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===n.length?"0"+n:n}:{$binary:{base64:e,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new vo(this.buffer.slice(0,this.position));throw new eo('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,n){var r,i;if(n=n||{},"$binary"in e?n.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,r=Qi.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=Qi.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,r=fo(e.$uuid)),!r)throw new no("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 4===i?new vo(r):new t(r,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(_o.prototype,"_bsontype",{value:"Binary"});var vo=function(t){function e(n){var r,i,o=this;if(null==n)r=e.generate();else if(n instanceof e)r=Qi.from(n.buffer),i=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)r=lo(n);else{if("string"!=typeof n)throw new no("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");r=fo(n)}return(o=t.call(this,r,4)||this).__id=i,o}return to(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=go(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=go(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new _o(this.id,_o.SUBTYPE_UUID)},e.generate=function(){var t=so(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,Qi.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?po(t):!(!ao(t)||16!==t.length||64!=(240&t[6])||128&~t[8])))},e.createFromHexString=function(t){return new e(fo(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(_o),bo=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);this.code=e,this.scope=n}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();Object.defineProperty(bo.prototype,"_bsontype",{value:"Code"});var wo=function(){function t(e,n,r,i){if(!(this instanceof t))return new t(e,n,r,i);var o=e.split(".");2===o.length&&(r=o.shift(),e=o.shift()),this.collection=e,this.oid=n,this.db=r,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var n=Object.assign({},e);return delete n.$ref,delete n.$id,delete n.$db,new t(e.$ref,e.$id,e.$db,n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(wo.prototype,"_bsontype",{value:"DBRef"});var Eo=void 0;try{Eo=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}var So=4294967296,Io=0x10000000000000000,To=Io/2,Co={},Do={},Oo=function(){function t(e,n,r){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,n,r);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!n)):"string"==typeof e?Object.assign(this,t.fromString(e,!!n)):(this.low=0|e,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,n,r){return new t(e,n,r)},t.fromInt=function(e,n){var r,i,o;return n?(o=0<=(e>>>=0)&&e<256)&&(i=Do[e])?i:(r=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(Do[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=Co[e])?i:(r=t.fromBits(e,e<0?-1:0,!1),o&&(Co[e]=r),r)},t.fromNumber=function(e,n){if(isNaN(e))return n?t.UZERO:t.ZERO;if(n){if(e<0)return t.UZERO;if(e>=Io)return t.MAX_UNSIGNED_VALUE}else{if(e<=-To)return t.MIN_VALUE;if(e+1>=To)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%So|0,e/So|0,n)},t.fromBigInt=function(e,n){return t.fromString(e.toString(),n)},t.fromString=function(e,n,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return t.fromString(e.substring(1),n,r).neg();for(var o=t.fromNumber(Math.pow(r,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),u=parseInt(e.substring(a,a+c),r);if(c<8){var l=t.fromNumber(Math.pow(r,c));s=s.mul(l).add(t.fromNumber(u))}else s=(s=s.mul(o)).add(t.fromNumber(u))}return s.unsigned=n,s},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},t.isLong=function(t){return co(t)&&!0===t.__isLong__},t.fromValue=function(e,n){return"number"==typeof e?t.fromNumber(e,n):"string"==typeof e?t.fromString(e,n):t.fromBits(e.low,e.high,"boolean"==typeof n?n:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,c=e.low>>>16,u=0,l=0,h=0,p=0;return h+=(p+=o+(65535&e.low))>>>16,p&=65535,l+=(h+=i+c)>>>16,h&=65535,u+=(l+=r+a)>>>16,l&=65535,u+=n+s,u&=65535,t.fromBits(h<<16|p,u<<16|l,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Eo){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?Eo.div_u:Eo.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Eo.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),c=t.fromNumber(r),u=c.mul(e);u.isNegative()||u.gt(i);)r-=a,u=(c=t.fromNumber(r,this.unsigned)).mul(e);c.isZero()&&(c=t.ONE),o=o.add(c),i=i.sub(u)}return o},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,n=0!==this.high?this.high:this.low;for(e=31;e>0&&!(n&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return!(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return!(1&~this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Eo){var n=(this.unsigned?Eo.rem_u:Eo.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Eo.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Eo){var n=Eo.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,Eo.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,c=65535&e.high,u=e.low>>>16,l=65535&e.low,h=0,p=0,d=0,f=0;return d+=(f+=s*l)>>>16,f&=65535,p+=(d+=o*l)>>>16,d&=65535,p+=(d+=s*u)>>>16,d&=65535,h+=(p+=i*l)>>>16,p&=65535,h+=(p+=o*u)>>>16,p&=65535,h+=(p+=s*c)>>>16,p&=65535,h+=r*l+i*u+o*c+s*a,h&=65535,t.fromBits(d<<16|f,h<<16|p,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0==(e&=63))return this;var n=this.high;if(e<32){var r=this.low;return t.fromBits(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?t.fromBits(n,0,this.unsigned):t.fromBits(n>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*So+(this.low>>>0):this.high*So+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var n=t.fromNumber(e),r=this.div(n),i=r.mul(n).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),u=(s.sub(c.mul(o)).toInt()>>>0).toString(e);if((s=c).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,n){var r=t.fromString(e.$numberLong);return n&&n.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Oo.prototype,"__isLong__",{value:!0}),Object.defineProperty(Oo.prototype,"_bsontype",{value:"Long"});var xo=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,No=/^(\+|-)?(Infinity|inf)$/i,Ao=/^(\+|-)?NaN$/i,Po=6111,Lo=-6176,Ro=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ko=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Uo=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Mo=/^([-+])?(\d+)?$/;function Bo(t){return!isNaN(parseInt(t,10))}function jo(t){var e=Oo.fromNumber(1e9),n=Oo.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new Oo(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function Fo(t,e){throw new no('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Ho=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!ao(e))throw new no("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new no("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(e){var n,r=!1,i=!1,o=!1,s=0,a=0,c=0,u=0,l=0,h=[0],p=0,d=0,f=0,g=0,m=0,y=0,_=new Oo(0,0),v=new Oo(0,0),b=0;if(e.length>=7e3)throw new no(e+" not a valid Decimal128 string");var w=e.match(xo),E=e.match(No),S=e.match(Ao);if(!w&&!E&&!S||0===e.length)throw new no(e+" not a valid Decimal128 string");if(w){var I=w[2],T=w[4],C=w[5],D=w[6];T&&void 0===D&&Fo(e,"missing exponent power"),T&&void 0===I&&Fo(e,"missing exponent base"),void 0===T&&(C||D)&&Fo(e,"missing e before exponent")}if("+"!==e[b]&&"-"!==e[b]||(r="-"===e[b++]),!Bo(e[b])&&"."!==e[b]){if("i"===e[b]||"I"===e[b])return new t(Qi.from(r?ko:Uo));if("N"===e[b])return new t(Qi.from(Ro))}for(;Bo(e[b])||"."===e[b];)"."!==e[b]?(p<34&&("0"!==e[b]||o)&&(o||(l=a),o=!0,h[d++]=parseInt(e[b],10),p+=1),o&&(c+=1),i&&(u+=1),a+=1,b+=1):(i&&Fo(e,"contains multiple periods"),i=!0,b+=1);if(i&&!a)throw new no(e+" not a valid Decimal128 string");if("e"===e[b]||"E"===e[b]){var O=e.substr(++b).match(Mo);if(!O||!O[2])return new t(Qi.from(Ro));m=parseInt(O[0],10),b+=O[0].length}if(e[b])return new t(Qi.from(Ro));if(f=0,p){if(g=p-1,1!==(s=c))for(;0===h[l+s-1];)s-=1}else f=0,g=0,h[0]=0,c=1,p=1,s=0;for(m<=u&&u-m>16384?m=Lo:m-=u;m>Po;){if((g+=1)-f>34){if(h.join("").match(/^0+$/)){m=Po;break}Fo(e,"overflow")}m-=1}for(;m<Lo||p<c;){if(0===g&&s<p){m=Lo,s=0;break}if(p<c?c-=1:g-=1,m<Po)m+=1;else{if(h.join("").match(/^0+$/)){m=Po;break}Fo(e,"overflow")}}if(g-f+1<s){var x=a;i&&(l+=1,x+=1),r&&(l+=1,x+=1);var N=parseInt(e[l+g+1],10),A=0;if(N>=5&&(A=1,5===N))for(A=h[g]%2==1?1:0,y=l+g+2;y<x;y++)if(parseInt(e[y],10)){A=1;break}if(A)for(var P=g;P>=0;P--)if(++h[P]>9&&(h[P]=0,0===P)){if(!(m<Po))return new t(Qi.from(r?ko:Uo));m+=1,h[P]=1}}if(_=Oo.fromNumber(0),v=Oo.fromNumber(0),0===s)_=Oo.fromNumber(0),v=Oo.fromNumber(0);else if(g-f<17)for(P=f,v=Oo.fromNumber(h[P++]),_=new Oo(0,0);P<=g;P++)v=(v=v.multiply(Oo.fromNumber(10))).add(Oo.fromNumber(h[P]));else{for(P=f,_=Oo.fromNumber(h[P++]);P<=g-17;P++)_=(_=_.multiply(Oo.fromNumber(10))).add(Oo.fromNumber(h[P]));for(v=Oo.fromNumber(h[P++]);P<=g;P++)v=(v=v.multiply(Oo.fromNumber(10))).add(Oo.fromNumber(h[P]))}var L,R,k,U,M=function(t,e){if(!t&&!e)return{high:Oo.fromNumber(0),low:Oo.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new Oo(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new Oo(e.getLowBits(),0),s=n.multiply(i),a=n.multiply(o),c=r.multiply(i),u=r.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new Oo(a.getLowBits(),0).add(c).add(u.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:u=a.shiftLeft(32).add(new Oo(u.getLowBits(),0))}}(_,Oo.fromString("100000000000000000"));M.low=M.low.add(v),R=v,((k=(L=M.low).high>>>0)<(U=R.high>>>0)||k===U&&L.low>>>0<R.low>>>0)&&(M.high=M.high.add(Oo.fromNumber(1))),n=m+6176;var B={low:Oo.fromNumber(0),high:Oo.fromNumber(0)};M.high.shiftRightUnsigned(49).and(Oo.fromNumber(1)).equals(Oo.fromNumber(1))?(B.high=B.high.or(Oo.fromNumber(3).shiftLeft(61)),B.high=B.high.or(Oo.fromNumber(n).and(Oo.fromNumber(16383).shiftLeft(47))),B.high=B.high.or(M.high.and(Oo.fromNumber(0x7fffffffffff)))):(B.high=B.high.or(Oo.fromNumber(16383&n).shiftLeft(49)),B.high=B.high.or(M.high.and(Oo.fromNumber(562949953421311)))),B.low=M.low,r&&(B.high=B.high.or(Oo.fromString("9223372036854775808")));var j=Qi.alloc(16);return b=0,j[b++]=255&B.low.low,j[b++]=B.low.low>>8&255,j[b++]=B.low.low>>16&255,j[b++]=B.low.low>>24&255,j[b++]=255&B.low.high,j[b++]=B.low.high>>8&255,j[b++]=B.low.high>>16&255,j[b++]=B.low.high>>24&255,j[b++]=255&B.high.low,j[b++]=B.high.low>>8&255,j[b++]=B.high.low>>16&255,j[b++]=B.high.low>>24&255,j[b++]=255&B.high.high,j[b++]=B.high.high>>8&255,j[b++]=B.high.high>>16&255,j[b++]=B.high.high>>24&255,new t(j)},t.prototype.toString=function(){for(var t,e=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var i,o,s,a=0,c=!1,u={parts:[0,0,0,0]},l=[];a=0;var h=this.bytes,p=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24,d=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24,f=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24,g=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24;a=0,(new Oo(p,d),new Oo(f,g)).lessThan(Oo.ZERO)&&l.push("-");var m=g>>26&31;if(m>>3==3){if(30===m)return l.join("")+"Infinity";if(31===m)return"NaN";t=g>>15&16383,i=8+(g>>14&1)}else i=g>>14&7,t=g>>17&16383;var y=t-6176;if(u.parts[0]=(16383&g)+((15&i)<<14),u.parts[1]=f,u.parts[2]=d,u.parts[3]=p,0===u.parts[0]&&0===u.parts[1]&&0===u.parts[2]&&0===u.parts[3])c=!0;else for(s=3;s>=0;s--){var _=0,v=jo(u);if(u=v.quotient,_=v.rem.low)for(o=8;o>=0;o--)n[9*s+o]=_%10,_=Math.floor(_/10)}if(c)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var b=e-1+y;if(b>=34||b<=-7||y>0){if(e>34)return l.push("".concat(0)),y>0?l.push("E+".concat(y)):y<0&&l.push("E".concat(y)),l.join("");for(l.push("".concat(n[a++])),(e-=1)&&l.push("."),r=0;r<e;r++)l.push("".concat(n[a++]));l.push("E"),b>0?l.push("+".concat(b)):l.push("".concat(b))}else if(y>=0)for(r=0;r<e;r++)l.push("".concat(n[a++]));else{var w=e+y;if(w>0)for(r=0;r<w;r++)l.push("".concat(n[a++]));else l.push("0");for(l.push(".");w++<0;)l.push("0");for(r=0;r<e-Math.max(w-1,0);r++)l.push("".concat(n[a++]))}return l.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Ho.prototype,"_bsontype",{value:"Decimal128"});var $o=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,n){var r=parseFloat(e.$numberDouble);return n&&n.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty($o.prototype,"_bsontype",{value:"Double"});var Vo=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,n){return n&&n.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(Vo.prototype,"_bsontype",{value:"Int32"});var Go=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Go.prototype,"_bsontype",{value:"MaxKey"});var Wo=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Wo.prototype,"_bsontype",{value:"MinKey"});var qo=new RegExp("^[0-9a-fA-F]{24}$"),zo=null,Ko=Symbol("id"),Yo=function(){function t(e){if(!(this instanceof t))return new t(e);var n;if("object"==typeof e&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new no("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?Qi.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Ko]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Ko]=n instanceof Qi?n:lo(n);else{if("string"!=typeof n)throw new no("Argument passed in does not match the accepted types");if(12===n.length){var r=Qi.from(n);if(12!==r.byteLength)throw new no("Argument passed in must be a string of 12 bytes");this[Ko]=r}else{if(24!==n.length||!qo.test(n))throw new no("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Ko]=Qi.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ko]},set:function(e){this[Ko]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var n=t.getInc(),r=Qi.alloc(12);return r.writeUInt32BE(e,0),null===zo&&(zo=so(5)),r[4]=zo[0],r[5]=zo[1],r[6]=zo[2],r[7]=zo[3],r[8]=zo[4],r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(null==e)return!1;if(e instanceof t)return this[Ko][11]===e[Ko][11]&&this[Ko].equals(e[Ko]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&ao(this.id))return e===Qi.prototype.toString.call(this.id,"latin1");if("string"==typeof e&&t.isValid(e)&&24===e.length)return e.toLowerCase()===this.toHexString();if("string"==typeof e&&t.isValid(e)&&12===e.length)return Qi.from(e).equals(this.id);if("object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString){var n=e.toHexString(),r=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===r}return!1},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var n=Qi.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(e,0),new t(n)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new no("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Qi.from(e,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(Yo.prototype,"generate",{value:uo((function(t){return Yo.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Yo.prototype,"getInc",{value:uo((function(){return Yo.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Yo.prototype,"get_inc",{value:uo((function(){return Yo.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Yo,"get_inc",{value:uo((function(){return Yo.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Yo.prototype,"_bsontype",{value:"ObjectID"});var Jo=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(this.pattern=e,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new eo("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new eo("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new eo("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new no("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Jo.prototype,"_bsontype",{value:"BSONRegExp"});var Xo=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(Xo.prototype,"_bsontype",{value:"Symbol"});var Qo=function(t){function e(n,r){var i=this;return i instanceof e?(i=Oo.isLong(n)?t.call(this,n.low,n.high,!0)||this:co(n)&&void 0!==n.t&&void 0!==n.i?t.call(this,n.i,n.t,!0)||this:t.call(this,n,r,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(n,r)}return to(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Oo.fromInt(t,!0))},e.fromNumber=function(t){return new e(Oo.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(Oo.fromString(t,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=Oo.MAX_UNSIGNED_VALUE,e}(Oo);var Zo=2147483647,ts=-2147483648,es=0x8000000000000000,ns=-0x8000000000000000,rs={$oid:Yo,$binary:_o,$uuid:_o,$symbol:Xo,$numberInt:Vo,$numberDecimal:Ho,$numberDouble:$o,$numberLong:Oo,$minKey:Wo,$maxKey:Go,$regex:Jo,$regularExpression:Jo,$timestamp:Qo};function is(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=ts&&t<=Zo)return new Vo(t);if(t>=ns&&t<=es)return Oo.fromNumber(t)}return new $o(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var n=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),r=0;r<n.length;r++){var i=rs[n[r]];if(i)return i.fromExtendedJSON(t,e)}if(null!=t.$date){var o=t.$date,s=new Date;return e.legacy?"number"==typeof o?s.setTime(o):"string"==typeof o&&s.setTime(Date.parse(o)):"string"==typeof o?s.setTime(Date.parse(o)):Oo.isLong(o)?s.setTime(o.toNumber()):"number"==typeof o&&e.relaxed&&s.setTime(o),s}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=is(t.$scope)),bo.fromExtendedJSON(t)}if(function(t){return co(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof wo)return c;var u=Object.keys(c).filter((function(t){return t.startsWith("$")})),l=!0;if(u.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(l=!1)})),l)return wo.fromExtendedJSON(c)}return t}function os(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function ss(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var r=e.seenObjects.map((function(t){return t.propertyName})),i=r.slice(0,n).map((function(t){return"".concat(t," -> ")})).join(""),o=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(t){return"".concat(t," -> ")})).join(""),a=r[r.length-1],c=" ".repeat(i.length+o.length/2),u="-".repeat(s.length+(o.length+a.length)/2-1);throw new no("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(c,"\\").concat(u,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return ss(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||function(t){return co(t)&&"[object Date]"===Object.prototype.toString.call(t)}(t)){var l=t.getTime(),h=l>-1&&l<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:os(t)}:e.relaxed&&h?{$date:os(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var p=t>=ns&&t<=es;if(t>=ts&&t<=Zo)return{$numberInt:t.toString()};if(p)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(t)){var d=t.flags;if(void 0===d){var f=t.toString().match(/[gimuy]*$/);f&&(d=f[0])}return new Jo(t.source,d).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new eo("not an object instance");var n=t._bsontype;if(void 0===n){var r={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=ss(t[i],e);"__proto__"===i?Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):r[i]=o}finally{e.seenObjects.pop()}}return r}if(function(t){return co(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=cs[t._bsontype];if(!a)throw new no("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new bo(s.code,ss(s.scope,e)):"DBRef"===n&&s.oid&&(s=new wo(ss(s.collection,e),ss(s.oid,e),ss(s.db,e),ss(s.fields,e))),s.toExtendedJSON(e)}throw new eo("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var as,cs={Binary:function(t){return new _o(t.value(),t.sub_type)},Code:function(t){return new bo(t.code,t.scope)},DBRef:function(t){return new wo(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Ho(t.bytes)},Double:function(t){return new $o(t.value)},Int32:function(t){return new Vo(t.value)},Long:function(t){return Oo.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new Go},MinKey:function(){return new Wo},ObjectID:function(t){return new Yo(t)},ObjectId:function(t){return new Yo(t)},BSONRegExp:function(t){return new Jo(t.pattern,t.options)},Symbol:function(t){return new Xo(t.value)},Timestamp:function(t){return Qo.fromBits(t.low,t.high)}};!function(t){function e(t,e){var n=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new eo("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return is(e,n)}))}function n(t,e,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==e||"object"!=typeof e||Array.isArray(e)||(r=e,e=void 0,n=0);var i=ss(t,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,e,n)}t.parse=e,t.stringify=n,t.serialize=function(t,e){return e=e||{},JSON.parse(n(t,e))},t.deserialize=function(t,n){return n=n||{},e(JSON.stringify(t),n)}}(as||(as={}));var us=io();us.Map?us.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var n=t[e],r=n[0],i=n[1];this._keys.push(r),this._values[r]={v:i,i:this._keys.length-1}}}t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?[n,t._values[n].v]:void 0,done:void 0===n}}}},t.prototype.forEach=function(t,e){e=e||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];t.call(e,this._values[r].v,r,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?t._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}(),Oo.fromNumber(mo),Oo.fromNumber(yo),new Set(["$db","$ref","$id","$clusterTime"]);var ls=new Uint8Array(8);new DataView(ls.buffer,ls.byteOffset,ls.byteLength);Qi.alloc(17825792);class hs{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}}class ps{name;properties;trigger;items;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;constructor(t,e={},n,r){this.name=t,this.properties=e,this.id=r?new Yo(r):new Yo,this.occurred=new Date,n&&(this.trigger=new hs(n)),this.newEvent=!r}}var ds=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t},fs="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function gs(t){if(t instanceof Rn)return t;if(null!=t){if(function(t){return rn(t[Pn])}(t))return o=t,new Rn((function(t){var e=o[Pn]();if(rn(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ds(t))return i=t,new Rn((function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()}));if(rn(null==(r=t)?void 0:r.then))return n=t,new Rn((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,_n)}));if(function(t){return Symbol.asyncIterator&&rn(null==t?void 0:t[Symbol.asyncIterator])}(t))return ms(t);if(function(t){return rn(null==t?void 0:t[fs])}(t))return e=t,new Rn((function(t){var n,r;try{for(var i=Ze(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(function(t){return rn(null==t?void 0:t.getReader)}(t))return ms(function(t){return function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(t){return function(e){return Promise.resolve(e).then(t,u)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(t,e){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||a(t,e)}))},e&&(r[t]=e(r[t])))}function a(t,e){try{(n=i[t](e)).value instanceof nn?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function c(t){a("next",t)}function u(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}(this,arguments,(function(){var e,n,r;return Qe(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,nn(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,nn(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,nn(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}(t))}var e,n,r,i,o;throw function(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(t)}function ms(t){return new Rn((function(e){(function(t,e){var n,r,i,o;return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function(){var s,a;return Qe(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=Ze(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){!function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)}(r,i,(e=t[n](e)).done,e.value)}))}}}(t),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function ys(t,e){return qn((function(n,r){var i=0;n.subscribe(zn(r,(function(n){r.next(t.call(e,n,i++))})))}))}function _s(t,e,n){return void 0===n&&(n=1/0),rn(e)?_s((function(n,r){return ys((function(t,i){return e(n,t,r,i)}))(gs(t(n,r)))}),n):("number"==typeof e&&(n=e),qn((function(e,r){return function(t,e,n,r){var i=[],o=0,s=0,a=!1,c=function(){!a||i.length||o||e.complete()},u=function(t){return o<r?l(t):i.push(t)},l=function(t){o++;var a=!1;gs(n(t,s++)).subscribe(zn(e,(function(t){e.next(t)}),(function(){a=!0}),void 0,(function(){if(a)try{o--;for(var t=function(){var t=i.shift();l(t)};i.length&&o<r;)t();c()}catch(t){e.error(t)}})))};return t.subscribe(zn(e,u,(function(){a=!0,c()}))),function(){}}(e,r,t,n)})))}var vs=Array.isArray;var bs=["addListener","removeListener"],ws=["addEventListener","removeEventListener"],Es=["on","off"];function Ss(t,e,n,r){if(rn(n)&&(r=n,n=void 0),r)return Ss(t,e,n).pipe(function(t){return ys((function(e){return function(t,e){return vs(e)?t.apply(void 0,en([],tn(e))):t(e)}(t,e)}))}(r));var i=tn(function(t){return rn(t.addEventListener)&&rn(t.removeEventListener)}(t)?ws.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return rn(t.addListener)&&rn(t.removeListener)}(t)?bs.map(Is(t,e)):function(t){return rn(t.on)&&rn(t.off)}(t)?Es.map(Is(t,e)):[],2),o=i[0],s=i[1];if(!o&&ds(t))return _s((function(t){return Ss(t,e,n)}))(gs(t));if(!o)throw new TypeError("Invalid event target");return new Rn((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return s(e)}}))}function Is(t,e){return function(n){return function(r){return t[n](e,r)}}}class Ts{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}}var Cs,Ds=/bot|crawl|http|lighthouse|scan|search|spider/i;var Os=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Vn);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return Xe(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(e),!o&&i.push(s.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},e}(Mn);const xs=Object.prototype.toString;function Ns(t){switch(xs.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Fs(t,Error)}}function As(t,e){return xs.call(t)===`[object ${e}]`}function Ps(t){return As(t,"ErrorEvent")}function Ls(t){return As(t,"DOMError")}function Rs(t){return As(t,"String")}function ks(t){return"object"==typeof t&&null!==t&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Us(t){return null===t||ks(t)||"object"!=typeof t&&"function"!=typeof t}function Ms(t){return As(t,"Object")}function Bs(t){return"undefined"!=typeof Event&&Fs(t,Event)}function js(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function Fs(t,e){try{return t instanceof e}catch(t){return!1}}function Hs(t){return!("object"!=typeof t||null===t||!t.__isVue&&!t._isVue)}const $s="8.18.0",Vs=globalThis;function Gs(t,e,n){const r=n||Vs,i=r.__SENTRY__=r.__SENTRY__||{},o=i[$s]=i[$s]||{};return o[t]||(o[t]=e())}const Ws=Vs;function qs(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let u;const l=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(u=zs(n,l),!("html"===u||o>1&&s+i.length*c+u.length>=h));)i.push(u),s+=u.length,n=n.parentNode;return i.reverse().join(a)}catch(t){return"<unknown>"}}function zs(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(Ws.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e&&e.length?e.filter((t=>n.getAttribute(t))).map((t=>[t,n.getAttribute(t)])):null;if(i&&i.length)i.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else{n.id&&r.push(`#${n.id}`);const t=n.className;if(t&&Rs(t)){const e=t.split(/\s+/);for(const t of e)r.push(`.${t}`)}}const o=["aria-label","type","name","title","alt"];for(const t of o){const e=n.getAttribute(t);e&&r.push(`[${t}="${e}"]`)}return r.join("")}const Ks="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Ys=["debug","info","warn","error","log","assert","trace"],Js={};function Xs(t){if(!("console"in Vs))return t();const e=Vs.console,n={},r=Object.keys(Js);r.forEach((t=>{const r=Js[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}const Qs=function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Ks?Ys.forEach((n=>{e[n]=(...e)=>{t&&Xs((()=>{Vs.console[n](`Sentry Logger [${n}]:`,...e)}))}})):Ys.forEach((t=>{e[t]=()=>{}})),e}();function Zs(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function ta(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{Hs(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(t){n.push("[value cannot be serialized]")}}return n.join(e)}function ea(t,e=[],n=!1){return e.some((e=>function(t,e,n=!1){return!!Rs(t)&&(As(e,"RegExp")?e.test(t):!!Rs(e)&&(n?t===e:t.includes(e)))}(t,e,n)))}function na(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);"function"==typeof i&&ia(i,r),t[e]=i}function ra(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch(n){Ks&&Qs.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ia(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,ra(t,"__sentry_original__",e)}catch(t){}}function oa(t){return t.__sentry_original__}function sa(t){if(Ns(t))return{message:t.message,name:t.name,stack:t.stack,...ca(t)};if(Bs(t)){const e={type:t.type,target:aa(t.target),currentTarget:aa(t.currentTarget),...ca(t)};return"undefined"!=typeof CustomEvent&&Fs(t,CustomEvent)&&(e.detail=t.detail),e}return t}function aa(t){try{return"undefined"!=typeof Element&&Fs(t,Element)?qs(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}}function ca(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function ua(t){return la(t,new Map)}function la(t,e){if(function(t){if(!Ms(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||"Object"===e}catch(t){return!0}}(t)){const n=e.get(t);if(void 0!==n)return n;const r={};e.set(t,r);for(const n of Object.keys(t))void 0!==t[n]&&(r[n]=la(t[n],e));return r}if(Array.isArray(t)){const n=e.get(t);if(void 0!==n)return n;const r=[];return e.set(t,r),t.forEach((t=>{r.push(la(t,e))})),r}return t}function ha(){const t=Vs,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function pa(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function da(t){const{message:e,event_id:n}=t;if(e)return e;const r=pa(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function fa(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=n||"Error")}function ga(t,e){const n=pa(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r&&r.data,...e.data};n.mechanism.data=t}}function ma(t){if(t&&t.__sentry_captured__)return!0;try{ra(t,"__sentry_captured__",!0)}catch(t){}return!1}function ya(){return{traceId:ha(),spanId:ha().substring(16)}}function _a(){return Date.now()/1e3}const va=function(){const{performance:t}=Vs;if(!t||!t.now)return _a;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/1e3}();let ba;function wa(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||va(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:ha()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}(()=>{const{performance:t}=Vs;if(!t||!t.now)return void(ba="none");const e=36e5,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=i<e,s=t.timing&&t.timing.navigationStart,a="number"==typeof s?Math.abs(s+n-r):e;o||a<e?i<=a?(ba="timeOrigin",t.timeOrigin):ba="navigationStart":ba="dateNow"})();const Ea="_sentrySpan";function Sa(t,e){e?ra(t,Ea,e):delete t[Ea]}function Ia(t){return t[Ea]}class Ta{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=ya()}clone(){const t=new Ta;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,Sa(t,Ia(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&wa(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts[t]=e,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,[n,r]=e instanceof Ca?[e.getScopeData(),e.getRequestSession()]:Ms(e)?[t,t.requestSession]:[],{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:u=[],propagationContext:l}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),u.length&&(this._fingerprint=u),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Sa(this,void 0),this._attachments=[],this._propagationContext=ya(),this._notifyScopeListeners(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:_a(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Ia(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:ha();if(!this._client)return Qs.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:ha();if(!this._client)return Qs.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:ha();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(Qs.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Ca=Ta,Da="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Oa=[];function xa(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function Na(t,e,n){if(n[e.name])Da&&Qs.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===Oa.indexOf(e.name)&&"function"==typeof e.setupOnce&&(e.setupOnce(),Oa.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",((e,r)=>n(e,r,t)))}if("function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign(((e,r)=>n(e,r,t)),{id:e.name});t.addEventProcessor(r)}Da&&Qs.log(`Integration installed: ${e.name}`)}}const Aa=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler"],Pa=(t={})=>({name:"InboundFilters",processEvent(e,n,r){const i=r.getOptions(),o=function(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Aa],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:void 0===t.ignoreInternal||t.ignoreInternal}}(t,i);return function(t,e){return e.ignoreInternal&&function(t){try{return"SentryError"===t.exception.values[0].type}catch(t){}return!1}(t)?(Da&&Qs.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${da(t)}`),!0):function(t,e){return!(t.type||!e||!e.length)&&function(t){const e=[];let n;t.message&&e.push(t.message);try{n=t.exception.values[t.exception.values.length-1]}catch(t){}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),e}(t).some((t=>ea(t,e)))}(t,e.ignoreErrors)?(Da&&Qs.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${da(t)}`),!0):function(t){return!t.type&&(!(!t.exception||!t.exception.values||0===t.exception.values.length)&&(!t.message&&!t.exception.values.some((t=>t.stacktrace||t.type&&"Error"!==t.type||t.value))))}(t)?(Da&&Qs.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${da(t)}`),!0):function(t,e){if("transaction"!==t.type||!e||!e.length)return!1;const n=t.transaction;return!!n&&ea(n,e)}(t,e.ignoreTransactions)?(Da&&Qs.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${da(t)}`),!0):function(t,e){if(!e||!e.length)return!1;const n=La(t);return!!n&&ea(n,e)}(t,e.denyUrls)?(Da&&Qs.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${da(t)}.\nUrl: ${La(t)}`),!0):!function(t,e){if(!e||!e.length)return!0;const n=La(t);return!n||ea(n,e)}(t,e.allowUrls)&&(Da&&Qs.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${da(t)}.\nUrl: ${La(t)}`),!0)}(e,o)?null:e}});function La(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch(t){}return e?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(e):null}catch(e){return Da&&Qs.error(`Cannot extract url for event ${da(t)}`),null}}function Ra(){return ka(Vs),Vs}function ka(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||$s,e[$s]=e[$s]||{}}class Ua{constructor(t,e){let n,r;n=t||new Ca,r=e||new Ca,this._stack=[{scope:n}],this._isolationScope=r}withScope(t){const e=this._pushScope();let n;try{n=t(e)}catch(t){throw this._popScope(),t}return js(n)?n.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1||!this._stack.pop())}}function Ma(){const t=ka(Ra());return t.stack=t.stack||new Ua(Gs("defaultCurrentScope",(()=>new Ca)),Gs("defaultIsolationScope",(()=>new Ca)))}function Ba(t){return Ma().withScope(t)}function ja(t,e){const n=Ma();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function Fa(t){return Ma().withScope((()=>t(Ma().getIsolationScope())))}function Ha(t){const e=ka(t);return e.acs?e.acs:{withIsolationScope:Fa,withScope:Ba,withSetScope:ja,withSetIsolationScope:(t,e)=>Fa(e),getCurrentScope:()=>Ma().getScope(),getIsolationScope:()=>Ma().getIsolationScope()}}function $a(){return Ha(Ra()).getCurrentScope()}function Va(){return Ha(Ra()).getIsolationScope()}function Ga(){return $a().getClient()}let Wa;const qa=new WeakMap,za=()=>({name:"FunctionToString",setupOnce(){Wa=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=oa(this),n=qa.has(Ga())&&void 0!==e?e:this;return Wa.apply(n,t)}}catch(t){}},setup(t){qa.set(t,!0)}}),Ka="?",Ya=/\(error: (.*)\)/,Ja=/captureMessage|captureException/;function Xa(t){return t[t.length-1]||{}}const Qa="<anonymous>";function Za(t){try{return t&&"function"==typeof t&&t.name||Qa}catch(t){return Qa}}function tc(t){const e=t.exception;if(e){const t=[];try{return e.values.forEach((e=>{e.stacktrace.frames&&t.push(...e.stacktrace.frames)})),t}catch(t){return}}}const ec=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&(!!function(t,e){const n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!rc(t,e)&&!!nc(t,e))))}(t,e)||!!function(t,e){const n=ic(e),r=ic(t);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!rc(t,e)&&!!nc(t,e)))}(t,e))}(e,t))return Da&&Qs.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(t){}return t=e}}};function nc(t,e){let n=tc(t),r=tc(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],i=n[t];if(e.filename!==i.filename||e.lineno!==i.lineno||e.colno!==i.colno||e.function!==i.function)return!1}return!0}function rc(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(t){return!1}}function ic(t){return t.exception&&t.exception.values&&t.exception.values[0]}const oc={},sc={};function ac(t,e){oc[t]=oc[t]||[],oc[t].push(e)}function cc(t,e){sc[t]||(e(),sc[t]=!0)}function uc(t,e){const n=t&&oc[t];if(n)for(const r of n)try{r(e)}catch(e){Ks&&Qs.error(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${Za(r)}\nError:`,e)}}const lc=Vs;let hc,pc,dc;function fc(){if(!lc.document)return;const t=uc.bind(null,"dom"),e=gc(t,!0);lc.document.addEventListener("click",e,!1),lc.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach((e=>{const n=lc[e]&&lc[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(na(n,"addEventListener",(function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},s=o[n]=o[n]||{refCount:0};if(!s.handler){const r=gc(t);s.handler=r,e.call(this,n,r,i)}s.refCount++}catch(t){}return e.call(this,n,r,i)}})),na(n,"removeEventListener",(function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this,i=n.__sentry_instrumentation_handlers__||{},o=i[e];o&&(o.refCount--,o.refCount<=0&&(t.call(this,e,o.handler,r),o.handler=void 0,delete i[e]),0===Object.keys(i).length&&delete n.__sentry_instrumentation_handlers__)}catch(t){}return t.call(this,e,n,r)}})))}))}function gc(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(t){try{return t.target}catch(t){return null}}(n);if(function(t,e){return"keypress"===t&&(!e||!e.tagName||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&!e.isContentEditable)}(n.type,r))return;ra(n,"_sentryCaptured",!0),r&&!r._sentryId&&ra(r,"_sentryId",ha());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==pc)return!1;try{if(!t.target||t.target._sentryId!==dc)return!1}catch(t){}return!0})(n)||(t({event:n,name:i,global:e}),pc=n.type,dc=r?r._sentryId:void 0),clearTimeout(hc),hc=lc.setTimeout((()=>{dc=void 0,pc=void 0}),1e3)}}const mc="__sentry_xhr_v3__";function yc(){if(!lc.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;na(t,"open",(function(t){return function(...e){const n=1e3*va(),r=Rs(e[0])?e[0].toUpperCase():void 0,i=function(t){if(Rs(t))return t;try{return t.toString()}catch(t){}}(e[1]);if(!r||!i)return t.apply(this,e);this[mc]={method:r,url:i,request_headers:{}},"POST"===r&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const t=this[mc];if(t&&4===this.readyState){try{t.status_code=this.status}catch(t){}uc("xhr",{endTimestamp:1e3*va(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?na(this,"onreadystatechange",(function(t){return function(...e){return o(),t.apply(this,e)}})):this.addEventListener("readystatechange",o),na(this,"setRequestHeader",(function(t){return function(...e){const[n,r]=e,i=this[mc];return i&&Rs(n)&&Rs(r)&&(i.request_headers[n.toLowerCase()]=r),t.apply(this,e)}})),t.apply(this,e)}})),na(t,"send",(function(t){return function(...e){const n=this[mc];return n?(void 0!==e[0]&&(n.body=e[0]),uc("xhr",{startTimestamp:1e3*va(),xhr:this}),t.apply(this,e)):t.apply(this,e)}}))}const _c=Vs;let vc;function bc(){if(!function(){const t=_c.chrome,e=t&&t.app&&t.app.runtime,n="history"in _c&&!!_c.history.pushState&&!!_c.history.replaceState;return!e&&n}())return;const t=lc.onpopstate;function e(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const t=vc,e=String(n);vc=e,uc("history",{from:t,to:e})}return t.apply(this,e)}}lc.onpopstate=function(...e){const n=lc.location.href,r=vc;if(vc=n,uc("history",{from:r,to:n}),t)try{return t.apply(this,e)}catch(t){}},na(lc.history,"pushState",e),na(lc.history,"replaceState",e)}const wc=100;function Ec(t,e){const n=Ga(),r=Va();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=wc}=n.getOptions();if(o<=0)return;const s={timestamp:_a(),...t},a=i?Xs((()=>i(s,e))):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}function Sc(){"console"in Vs&&Ys.forEach((function(t){t in Vs.console&&na(Vs.console,t,(function(e){return Js[t]=e,function(...e){uc("console",{args:e,level:t});const n=Js[t];n&&n.apply(Vs.console,e)}}))}))}const Ic=Vs;function Tc(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Cc(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in Ic))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch(t){return!1}}())return!1;if(Tc(Ic.fetch))return!0;let t=!1;const e=Ic.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=Tc(n.contentWindow.fetch)),e.head.removeChild(n)}catch(t){Ks&&Qs.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return t})()&&na(Vs,"fetch",(function(t){return function(...e){const{method:n,url:r}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:Oc(e),method:Dc(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:Oc(e),method:Dc(e,"method")?String(e.method).toUpperCase():"GET"}}(e),i={args:e,fetchData:{method:n,url:r},startTimestamp:1e3*va()};uc("fetch",{...i});const o=(new Error).stack;return t.apply(Vs,e).then((t=>(uc("fetch",{...i,endTimestamp:1e3*va(),response:t}),t)),(t=>{throw uc("fetch",{...i,endTimestamp:1e3*va(),error:t}),Ns(t)&&void 0===t.stack&&(t.stack=o,ra(t,"framesToPop",1)),t}))}}))}function Dc(t,e){return!!t&&"object"==typeof t&&!!t[e]}function Oc(t){return"string"==typeof t?t:t?Dc(t,"url")?t.url:t.toString?t.toString():"":""}const xc=["fatal","error","warning","log","info","debug"];function Nc(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}const Ac="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Pc(t,e=100,n=1/0){try{return Rc("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Lc(t,e=3,n=102400){const r=Pc(t,e);return i=r,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(i))>n?Lc(t,e-1,n):r;var i}function Rc(t,e,n=1/0,r=1/0,i=function(){const t="function"==typeof WeakSet,e=t?new WeakSet:[];return[function(n){if(t)return!!e.has(n)||(e.add(n),!1);for(let t=0;t<e.length;t++)if(e[t]===n)return!0;return e.push(n),!1},function(n){if(t)e.delete(n);else for(let t=0;t<e.length;t++)if(e[t]===n){e.splice(t,1);break}}]}()){const[o,s]=i;if(null==e||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;const a=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e._events)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(Hs(e))return"[VueViewModel]";if(Ms(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof e&&e!=e)return"[NaN]";if("function"==typeof e)return`[Function: ${Za(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c="number"==typeof e.__sentry_override_normalization_depth__?e.__sentry_override_normalization_depth__:n;if(0===c)return a.replace("object ","");if(o(e))return"[Circular ~]";const u=e;if(u&&"function"==typeof u.toJSON)try{return Rc("",u.toJSON(),c-1,r,i)}catch(t){}const l=Array.isArray(e)?[]:{};let h=0;const p=sa(e);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){l[t]="[MaxProperties ~]";break}const e=p[t];l[t]=Rc(t,e,c-1,r,i),h++}return s(e),l}const kc="production";var Uc;function Mc(t){return new jc((e=>{e(t)}))}function Bc(t){return new jc(((e,n)=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(Uc||(Uc={}));class jc{constructor(t){jc.prototype.__init.call(this),jc.prototype.__init2.call(this),jc.prototype.__init3.call(this),jc.prototype.__init4.call(this),this._state=Uc.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(t){this._reject(t)}}then(t,e){return new jc(((n,r)=>{this._handlers.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this._executeHandlers()}))}catch(t){return this.then((t=>t),t)}finally(t){return new jc(((e,n)=>{let r,i;return this.then((e=>{i=!1,r=e,t&&t()}),(e=>{i=!0,r=e,t&&t()})).then((()=>{i?n(r):e(r)}))}))}__init(){this._resolve=t=>{this._setResult(Uc.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(Uc.REJECTED,t)}}__init3(){this._setResult=(t,e)=>{this._state===Uc.PENDING&&(js(e)?e.then(this._resolve,this._reject):(this._state=t,this._value=e,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===Uc.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach((t=>{t[0]||(this._state===Uc.RESOLVED&&t[1](this._value),this._state===Uc.REJECTED&&t[2](this._value),t[0]=!0)}))}}}function Fc(t,e,n,r=0){return new jc(((i,o)=>{const s=t[r];if(null===e||"function"!=typeof s)i(e);else{const a=s({...e},n);Da&&s.id&&null===a&&Qs.log(`Event processor "${s.id}" dropped event`),js(a)?a.then((e=>Fc(t,e,n,r+1).then(i))).then(null,o):Fc(t,a,n,r+1).then(i).then(null,o)}}))}const Hc=/^sentry-/;function $c(t){return t.split(",").map((t=>t.split("=").map((t=>decodeURIComponent(t.trim()))))).reduce(((t,[e,n])=>(e&&n&&(t[e]=n),t)),{})}function Vc(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[t,r]]of e)(n[t]||(n[t]=[])).push(ua(r));return n}function Gc(t){const{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=zc(t);return ua({parent_span_id:r,span_id:e,trace_id:n})}function Wc(t){return"number"==typeof t?qc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?qc(t.getTime()):va()}function qc(t){return t>9999999999?t/1e3:t}function zc(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,parentSpanId:a,status:c}=t;return ua({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Wc(i),timestamp:Wc(s)||void 0,status:Kc(c),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:Vc(t)})}return{span_id:e,trace_id:n}}catch(t){return{}}}function Kc(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"unknown_error"}function Yc(t){return t._sentryRootSpan||t}function Jc(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=ua({environment:n.environment||kc,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function Xc(t){const e=Ga();if(!e)return{};const n=Jc(zc(t).trace_id||"",e),r=Yc(t),i=r._frozenDsc;if(i)return i;const o=r.spanContext().traceState,s=o&&o.get("sentry.dsc"),a=s&&function(t){const e=function(t){if(t&&(Rs(t)||Array.isArray(t)))return Array.isArray(t)?t.reduce(((t,e)=>{const n=$c(e);return Object.entries(n).forEach((([e,n])=>{t[e]=n})),t}),{}):$c(t)}(t);if(!e)return;const n=Object.entries(e).reduce(((t,[e,n])=>(e.match(Hc)&&(t[e.slice(7)]=n),t)),{});return Object.keys(n).length>0?n:void 0}(s);if(a)return a;const c=zc(r),u=c.data||{},l=u["sentry.sample_rate"];null!=l&&(n.sample_rate=`${l}`);const h=u["sentry.source"],p=c.description;return"url"!==h&&p&&(n.transaction=p),n.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return 1===e}(r)),e.emit("createDsc",n,r),n}function Qc(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:h,propagationContext:p,transactionName:d,span:f}=e;Zc(t,"extra",n),Zc(t,"tags",r),Zc(t,"user",i),Zc(t,"contexts",o),Zc(t,"sdkProcessingMetadata",a),s&&(t.level=s),d&&(t.transactionName=d),f&&(t.span=f),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),l.length&&(t.eventProcessors=[...t.eventProcessors,...l]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...p}}function Zc(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function tu(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||ha(),timestamp:e.timestamp||_a()},u=n.integrations||t.integrations.map((t=>t.name));!function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;"environment"in t||(t.environment="environment"in e?n:kc),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=Zs(t.message,o));const s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=Zs(s.value,o));const a=t.request;a&&a.url&&(a.url=Zs(a.url,o))}(c,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(c,u),i&&i.emit("applyFrameMetadata",e),void 0===e.type&&function(t,e){const n=Vs._sentryDebugIds;if(!n)return;let r;const i=eu.get(e);i?r=i:(r=new Map,eu.set(e,r));const o=Object.entries(n).reduce(((t,[n,i])=>{let o;const s=r.get(n);s?o=s:(o=e(n),r.set(n,o));for(let e=o.length-1;e>=0;e--){const n=o[e];if(n.filename){t[n.filename]=i;break}}return t}),{});try{t.exception.values.forEach((t=>{t.stacktrace.frames.forEach((t=>{t.filename&&(t.debug_id=o[t.filename])}))}))}catch(t){}}(c,t.stackParser);const l=function(t,e){if(!e)return t;const n=t?t.clone():new Ca;return n.update(e),n}(r,n.captureContext);n.mechanism&&ga(c,n.mechanism);const h=i?i.getEventProcessors():[],p=Gs("globalScope",(()=>new Ca)).getScopeData();o&&Qc(p,o.getScopeData()),l&&Qc(p,l.getScopeData());const d=[...n.attachments||[],...p.attachments];return d.length&&(n.attachments=d),function(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;!function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e,c=ua(n);c&&Object.keys(c).length&&(t.extra={...c,...t.extra});const u=ua(r);u&&Object.keys(u).length&&(t.tags={...u,...t.tags});const l=ua(i);l&&Object.keys(l).length&&(t.user={...l,...t.user});const h=ua(o);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts}),s&&(t.level=s),a&&"transaction"!==t.type&&(t.transaction=a)}(t,e),r&&function(t,e){t.contexts={trace:Gc(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Xc(e),...t.sdkProcessingMetadata};const n=zc(Yc(e)).description;n&&!t.transaction&&"transaction"===t.type&&(t.transaction=n)}(t,r),function(t,e){var n;t.fingerprint=t.fingerprint?(n=t.fingerprint,Array.isArray(n)?n:[n]):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}(c,p),Fc([...h,...p.eventProcessors],c,n).then((t=>(t&&function(t){const e={};try{t.exception.values.forEach((t=>{t.stacktrace.frames.forEach((t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)}))}))}catch(t){}if(0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach((([t,e])=>{n.push({type:"sourcemap",code_file:t,debug_id:e})}))}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map((t=>({...t,...t.data&&{data:Pc(t.data,e,n)}})))},...t.user&&{user:Pc(t.user,e,n)},...t.contexts&&{contexts:Pc(t.contexts,e,n)},...t.extra&&{extra:Pc(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pc(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map((t=>({...t,...t.data&&{data:Pc(t.data,e,n)}})))),r}(t,s,a):t)))}const eu=new WeakMap;const nu=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function ru(t,e){return $a().captureEvent(t,e)}const iu=Vs;let ou=0;function su(){return ou>0}function au(t,e={},n){if("function"!=typeof t)return t;try{const e=t.__sentry_wrapped__;if(e)return e;if(oa(t))return t}catch(e){return t}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map((t=>au(t,e)));return t.apply(this,i)}catch(t){throw ou++,setTimeout((()=>{ou--})),function(...t){const e=Ha(Ra());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}e.withScope(t[0])}((n=>{var i;n.addEventProcessor((t=>(e.mechanism&&(fa(t,void 0,void 0),ga(t,e.mechanism)),t.extra={...t.extra,arguments:r},t))),i=t,$a().captureException(i,function(t){if(t)return function(t){return t instanceof Ca||"function"==typeof t}(t)||function(t){return Object.keys(t).some((t=>nu.includes(t)))}(t)?{captureContext:t}:t}(undefined))})),t}};try{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}catch(t){}ia(r,t),ra(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>t.name})}catch(t){}return r}const cu=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(t){var n;e.console&&function(t){const e="console";ac(e,t),cc(e,Sc)}(function(t){return function(e){if(Ga()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,"warn"===r?"warning":xc.includes(r)?r:"log"),message:ta(e.args," ")};var r;if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${ta(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}Ec(n,{input:e.args,level:e.level})}}(t)),e.dom&&(n=function(t,e){return function(n){if(Ga()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>1024&&(Ac&&Qs.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof o&&(o=[o]);try{const t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=qs(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!Ws.HTMLElement)return null;let e=t;for(let t=0;t<5;t++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}(e)}catch(t){r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),Ec(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom),ac("dom",n),cc("dom",fc)),e.xhr&&function(t){ac("xhr",t),cc("xhr",yc)}(function(t){return function(e){if(Ga()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[mc];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i;Ec({category:"xhr",data:{method:o,url:s,status_code:a},type:"http"},{xhr:e.xhr,input:c,startTimestamp:n,endTimestamp:r})}}(t)),e.fetch&&function(t){const e="fetch";ac(e,t),cc(e,Cc)}(function(t){return function(e){if(Ga()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error)Ec({category:"fetch",data:e.fetchData,level:"error",type:"http"},{data:e.error,input:e.args,startTimestamp:n,endTimestamp:r});else{const t=e.response;Ec({category:"fetch",data:{...e.fetchData,status_code:t&&t.status},type:"http"},{input:e.args,response:t,startTimestamp:n,endTimestamp:r})}}}(t)),e.history&&function(t){const e="history";ac(e,t),cc(e,bc)}(function(t){return function(e){if(Ga()!==t)return;let n=e.from,r=e.to;const i=Nc(iu.location.href);let o=n?Nc(n):void 0;const s=Nc(r);o&&o.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Ec({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on("beforeSendEvent",function(t){return function(e){Ga()===t&&Ec({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:da(e)},{event:e})}}(t))}}},uu=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],lu=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&na(iu,"setTimeout",hu),e.setInterval&&na(iu,"setInterval",hu),e.requestAnimationFrame&&na(iu,"requestAnimationFrame",pu),e.XMLHttpRequest&&"XMLHttpRequest"in iu&&na(XMLHttpRequest.prototype,"send",du);const t=e.eventTarget;t&&(Array.isArray(t)?t:uu).forEach(fu)}}};function hu(t){return function(...e){const n=e[0];return e[0]=au(n,{mechanism:{data:{function:Za(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function pu(t){return function(e){return t.apply(this,[au(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Za(t)},handled:!1,type:"instrument"}})])}}function du(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((t=>{t in n&&"function"==typeof n[t]&&na(n,t,(function(e){const n={mechanism:{data:{function:t,handler:Za(e)},handled:!1,type:"instrument"}},r=oa(e);return r&&(n.mechanism.data.handler=Za(r)),au(e,n)}))})),t.apply(this,e)}}function fu(t){const e=iu,n=e[t]&&e[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(na(n,"addEventListener",(function(e){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=au(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Za(r),target:t},handled:!1,type:"instrument"}}))}catch(t){}return e.apply(this,[n,au(r,{mechanism:{data:{function:"addEventListener",handler:Za(r),target:t},handled:!1,type:"instrument"}}),i])}})),na(n,"removeEventListener",(function(t){return function(e,n,r){const i=n;try{const n=i&&i.__sentry_wrapped__;n&&t.call(this,e,n,r)}catch(t){}return t.call(this,e,i,r)}})))}let gu=null;function mu(){gu=Vs.onerror,Vs.onerror=function(t,e,n,r,i){return uc("error",{column:r,error:i,line:n,msg:t,url:e}),!(!gu||gu.__SENTRY_LOADER__)&&gu.apply(this,arguments)},Vs.onerror.__SENTRY_INSTRUMENTED__=!0}let yu=null;function _u(){yu=Vs.onunhandledrejection,Vs.onunhandledrejection=function(t){return uc("unhandledrejection",t),!(yu&&!yu.__SENTRY_LOADER__)||yu.apply(this,arguments)},Vs.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function vu(t,e){const n=wu(t,e),r={type:e&&e.name,value:Su(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function bu(t,e){return{exception:{values:[vu(t,e)]}}}function wu(t,e){const n=e.stacktrace||e.stack||"",r=function(t){return t&&Eu.test(t.message)?1:0}(e),i=function(t){return"number"==typeof t.framesToPop?t.framesToPop:0}(e);try{return t(n,r,i)}catch(t){}return[]}const Eu=/Minified React error #\d+;/i;function Su(t){const e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function Iu(t,e,n,r,i){let o;if(Ps(e)&&e.error)return bu(t,e.error);if(Ls(e)||As(e,"DOMException")){const i=e;if("stack"in e)o=bu(t,e);else{const e=i.name||(Ls(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=Tu(t,s,n,r),fa(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Ns(e)?bu(t,e):Ms(e)||Bs(e)?(o=function(t,e,n,r){const i=Ga(),o=i&&i.getOptions().normalizeDepth,s=function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}(e),a={__serialized__:Lc(e,o)};if(s)return{exception:{values:[vu(t,s)]},extra:a};const c={exception:{values:[{type:Bs(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Cu(e,{isUnhandledRejection:r})}]},extra:a};if(n){const e=wu(t,n);e.length&&(c.exception.values[0].stacktrace={frames:e})}return c}(t,e,n,i),ga(o,{synthetic:!0}),o):(o=Tu(t,e,n,r),fa(o,`${e}`,void 0),ga(o,{synthetic:!0}),o)}function Tu(t,e,n,r){const i={};if(r&&n){const r=wu(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]})}if(ks(e)){const{__sentry_template_string__:t,__sentry_template_values__:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function Cu(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(sa(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Zs(r,e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:Zs(r,e)}return""}(t),r=e?"promise rejection":"exception";return Ps(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Bs(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}const Du=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(){const e="error";ac(e,(e=>{const{stackParser:n,attachStacktrace:r}=xu();if(Ga()!==t||su())return;const{msg:i,url:o,line:s,column:a,error:c}=e,u=function(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],u=isNaN(parseInt(r,10))?void 0:r,l=isNaN(parseInt(n,10))?void 0:n,h=Rs(e)&&e.length>0?e:function(){try{return Ws.document.location.href}catch(t){return""}}();return 0===c.length&&c.push({colno:u,filename:h,function:Ka,in_app:!0,lineno:l}),t}(Iu(n,c||i,void 0,r,!1),o,s,a);u.level="error",ru(u,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})),cc(e,mu)}()}(t),Ou("onerror")),e.onunhandledrejection&&(function(t){!function(){const e="unhandledrejection";ac(e,(e=>{const{stackParser:n,attachStacktrace:r}=xu();if(Ga()!==t||su())return;const i=function(t){if(Us(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}(e),o=Us(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:Iu(n,i,void 0,r,!0);o.level="error",ru(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})),cc(e,_u)}()}(t),Ou("onunhandledrejection"))}}};function Ou(t){Ac&&Qs.log(`Global Handler attached: ${t}`)}function xu(){const t=Ga();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function Nu(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&Fs(s.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var c,u;a&&(o.exception.values=(c=Au(t,e,i,s.originalException,r,o.exception.values,a,0),u=n,c.map((t=>(t.value&&(t.value=Zs(t.value,u)),t)))))}function Au(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Fs(r[i],Error)){Pu(s,a);const o=t(e,r[i]),u=c.length;Lu(o,i,u,a),c=Au(t,e,n,r[i],i,[o,...c],o,u)}return Array.isArray(r.errors)&&r.errors.forEach(((r,o)=>{if(Fs(r,Error)){Pu(s,a);const u=t(e,r),l=c.length;Lu(u,`errors[${o}]`,l,a),c=Au(t,e,n,r,i,[u,...c],u,l)}})),c}function Pu(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function Lu(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}const Ru=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(t,r,i){const o=i.getOptions();Nu(vu,o.stackParser,o.maxValueLength,n,e,t,r)}}};const ku=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Uu(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Mu(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Bu(t,e=[]){return[t,e]}function ju(t,e){const[n,r]=t;return[n,[...r,e]]}function Fu(t,e){const n=t[1];for(const t of n)if(e(t,t[0].type))return!0;return!1}function Hu(t){return Vs.__SENTRY__&&Vs.__SENTRY__.encodePolyfill?Vs.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function $u(t){const[e,n]=t;let r=JSON.stringify(e);function i(t){"string"==typeof r?r="string"==typeof t?r+t:[Hu(r),t]:r.push("string"==typeof t?Hu(t):t)}for(const t of n){const[e,n]=t;if(i(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let t;try{t=JSON.stringify(n)}catch(e){t=JSON.stringify(Pc(n))}i(t)}}return"string"==typeof r?r:function(t){const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}function Vu(t){const e="string"==typeof t.data?Hu(t.data):t.data;return[ua({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const Gu={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Wu(t){return Gu[t]}function qu(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}class zu extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}}function Ku(t,e,n){return e||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(t)}?${function(t,e){return n={sentry_key:t.publicKey,sentry_version:"7",...e&&{sentry_client:`${e.name}/${e.version}`}},Object.keys(n).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(n[t])}`)).join("&");var n}(t,n)}`}const Yu="Not capturing exception because it's already been captured.";class Ju{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=function(t){const e="string"==typeof t?function(t){const e=ku.exec(t);if(!e)return void Xs((()=>{console.error(`Invalid Sentry Dsn: ${t}`)}));const[n,r,i="",o="",s="",a=""]=e.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const t=u.match(/^\d+/);t&&(u=t[0])}return Mu({host:o,pass:i,path:c,projectId:u,port:s,protocol:n,publicKey:r})}(t):Mu(t);if(e&&function(t){if(!Ks)return!0;const{port:e,projectId:n,protocol:r}=t;return!(["protocol","publicKey","host","projectId"].find((e=>!t[e]&&(Qs.error(`Invalid Sentry Dsn: ${e} missing`),!0)))||(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?e&&isNaN(parseInt(e,10))&&(Qs.error(`Invalid Sentry Dsn: Invalid port ${e}`),1):(Qs.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Qs.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(e))return e}(t.dsn):Da&&Qs.warn("No DSN provided, client will not send events."),this._dsn){const e=Ku(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:e})}}captureException(t,e,n){const r=ha();if(ma(t))return Da&&Qs.log(Yu),r;const i={event_id:r,...e};return this._process(this.eventFromException(t,i).then((t=>this._captureEvent(t,i,n)))),i.event_id}captureMessage(t,e,n,r){const i={event_id:ha(),...n},o=ks(t)?t:String(t),s=Us(t)?this.eventFromMessage(o,e,i):this.eventFromException(t,i);return this._process(s.then((t=>this._captureEvent(t,i,r)))),i.event_id}captureEvent(t,e,n){const r=ha();if(e&&e.originalException&&ma(e.originalException))return Da&&Qs.log(Yu),r;const i={event_id:r,...e},o=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,o||n)),i.event_id}captureSession(t){"string"!=typeof t.release?Da&&Qs.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),wa(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){const e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then((n=>e.flush(t).then((t=>n&&t))))):Mc(!0)}close(t){return this.flush(t).then((t=>(this.getOptions().enabled=!1,this.emit("close"),t)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const e=this._integrations[t.name];Na(this,t,this._integrations),e||xa(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=function(t,e,n,r){const i=qu(n),o=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]])}(t,n&&n.sdk);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Uu(r)},...i&&{trace:ua({...i})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Bu(s,[[{type:o},t]])}(t,this._dsn,this._options._metadata,this._options.tunnel);for(const t of e.attachments||[])n=ju(n,Vu(t));const r=this.sendEnvelope(n);r&&r.then((e=>this.emit("afterSendEvent",t,e)),null)}sendSession(t){const e=function(t,e,n,r){const i=qu(n);return Bu({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:Uu(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,n){if(this._options.sendClientReports){const n=`${t}:${e}`;Da&&Qs.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){const n=this._hooks[t]=this._hooks[t]||[];return n.push(e),()=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)}}emit(t,...e){const n=this._hooks[t];n&&n.forEach((t=>t(...e)))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,(t=>(Da&&Qs.error("Error while sending event:",t),t))):(Da&&Qs.error("Transport disabled"),Mc({}))}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=function(t,e){const n={};return e.forEach((e=>{e&&Na(t,e,n)})),n}(this,t),xa(this,t)}_updateSessionFromEvent(t,e){let n=!1,r=!1;const i=e.exception&&e.exception.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(e&&!1===e.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(wa(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}_isClientDoneProcessing(t){return new jc((e=>{let n=0;const r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),e(!0)):(n+=1,t&&n>=t&&(clearInterval(r),e(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(t,e,n,r=Va()){const i=this.getOptions(),o=Object.keys(this._integrations);return!e.integrations&&o.length>0&&(e.integrations=o),this.emit("preprocessEvent",t,e),t.type||r.setLastEventId(t.event_id||e.event_id),tu(i,t,e,n,this,r).then((t=>{if(null===t)return t;const e={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if((!t.contexts||!t.contexts.trace)&&e){const{traceId:n,spanId:r,parentSpanId:i,dsc:o}=e;t.contexts={trace:ua({trace_id:n,span_id:r,parent_span_id:i}),...t.contexts};const s=o||Jc(n,this);t.sdkProcessingMetadata={dynamicSamplingContext:s,...t.sdkProcessingMetadata}}return t}))}_captureEvent(t,e={},n){return this._processEvent(t,e,n).then((t=>t.event_id),(t=>{if(Da){const e=t;"log"===e.logLevel?Qs.log(e.message):Qs.warn(e)}}))}_processEvent(t,e,n){const r=this.getOptions(),{sampleRate:i}=r,o=Qu(t),s=Xu(t),a=t.type||"error",c=`before send for type \`${a}\``,u=void 0===i?void 0:function(t){if("boolean"==typeof t)return Number(t);const e="string"==typeof t?parseFloat(t):t;if(!("number"!=typeof e||isNaN(e)||e<0||e>1))return e;Da&&Qs.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`)}(i);if(s&&"number"==typeof u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error",t),Bc(new zu(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const l="replay_event"===a?"replay":a,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,n,h).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",l,t),new zu("An event processor returned `null`, will not send event.","log");if(e.data&&!0===e.data.__sentry__)return n;const i=function(t,e,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e;if(Xu(n)&&i)return i(n,r);if(Qu(n)){if(n.spans&&s){const e=[];for(const r of n.spans){const n=s(r);n?e.push(n):t.recordDroppedEvent("before_send","span")}n.spans=e}if(o)return o(n,r)}return n}(this,r,n,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if(js(t))return t.then((t=>{if(!Ms(t)&&null!==t)throw new zu(n);return t}),(t=>{throw new zu(`${e} rejected with ${t}`)}));if(!Ms(t)&&null!==t)throw new zu(n);return t}(i,c)})).then((r=>{if(null===r){if(this.recordDroppedEvent("before_send",l,t),Qu(t)){const e=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+e}throw new zu(`${c} returned \`null\`, will not send event.`,"log")}const i=n&&n.getSession();!o&&i&&this._updateSessionFromEvent(i,r);const s=r.transaction_info;if(o&&s&&r.transaction!==t.transaction){const t="custom";r.transaction_info={...s,source:t}}return this.sendEvent(r,e),r})).then(null,(t=>{if(t instanceof zu)throw t;throw this.captureException(t,{data:{__sentry__:!0},originalException:t}),new zu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)}))}_process(t){this._numProcessing++,t.then((t=>(this._numProcessing--,t)),(t=>(this._numProcessing--,t)))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map((([t,e])=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e}}))}}function Xu(t){return void 0===t.type}function Qu(t){return"transaction"===t.type}class Zu extends Ju{constructor(t){const e={parentSpanIsAlwaysRootSpan:!0,...t};!function(t,e,n=[e],r="npm"){const i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map((t=>({name:`${r}:@sentry/${t}`,version:$s}))),version:$s}),t._metadata=i}(e,"browser",["browser"],iu.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&iu.document&&iu.document.addEventListener("visibilitychange",(()=>{"hidden"===iu.document.visibilityState&&this._flushOutcomes()}))}eventFromException(t,e){return function(t,e,n,r){const i=Iu(t,e,n&&n.syntheticException||void 0,r);return ga(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),Mc(i)}(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=Tu(t,e,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Mc(o)}(this._options.stackParser,t,e,n,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled())return void(Ac&&Qs.warn("SDK not enabled, will not capture user feedback."));const e=function(t,{metadata:e,tunnel:n,dsn:r}){const i={event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:Uu(r)}},o=function(t){return[{type:"user_report"},t]}(t);return Bu(i,[o])}(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,n)}_flushOutcomes(){const t=this._clearOutcomes();if(0===t.length)return void(Ac&&Qs.log("No outcomes to send"));if(!this._dsn)return void(Ac&&Qs.log("No dsn provided, will not send outcomes"));Ac&&Qs.log("Sending outcomes:",t);const e=(n=t,Bu((r=this._options.tunnel&&Uu(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:_a(),discarded_events:n}]]));var n,r;this.sendEnvelope(e)}}const tl="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,el={};function nl(t){el[t]=void 0}function rl(t,e,n=function(t){const e=[];function n(t){return e.splice(e.indexOf(t),1)[0]||Promise.resolve(void 0)}return{$:e,add:function(r){if(!(void 0===t||e.length<t))return Bc(new zu("Not adding Promise because buffer limit was reached."));const i=r();return-1===e.indexOf(i)&&e.push(i),i.then((()=>n(i))).then(null,(()=>n(i).then(null,(()=>{})))),i},drain:function(t){return new jc(((n,r)=>{let i=e.length;if(!i)return n(!0);const o=setTimeout((()=>{t&&t>0&&n(!1)}),t);e.forEach((t=>{Mc(t).then((()=>{--i||(clearTimeout(o),n(!0))}),r)}))}))}}}(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Fu(i,((e,n)=>{const i=Wu(n);if(function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)){const r=il(e,n);t.recordDroppedEvent("ratelimit_backoff",i,r)}else o.push(e)})),0===o.length)return Mc({});const s=Bu(i[0],o),a=e=>{Fu(s,((n,r)=>{const i=il(n,r);t.recordDroppedEvent(e,Wu(r),i)}))};return n.add((()=>e({body:$u(s)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&Da&&Qs.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=function(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n&&n["x-sentry-rate-limits"],s=n&&n["retry-after"];if(o)for(const t of o.trim().split(",")){const[e,n,,,o]=t.split(":",5),s=parseInt(e,10),a=1e3*(isNaN(s)?60:s);if(n)for(const t of n.split(";"))"metric_bucket"===t&&o&&!o.split(";").includes("custom")||(i[t]=r+a);else i.all=r+a}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}(r,t),t)),(t=>{throw a("network_error"),t})))).then((t=>t),(t=>{if(t instanceof zu)return Da&&Qs.error("Skipped sending event because buffer is full."),a("queue_overflow"),Mc({});throw t}))},flush:t=>n.drain(t)}}function il(t,e){if("event"===e||"transaction"===e)return Array.isArray(t)?t[1]:void 0}function ol(t,e=function(t){const e=el[t];if(e)return e;let n=lc[t];if(Tc(n))return el[t]=n.bind(lc);const r=lc.document;if(r&&"function"==typeof r.createElement)try{const e=r.createElement("iframe");e.hidden=!0,r.head.appendChild(e);const i=e.contentWindow;i&&i[t]&&(n=i[t]),r.head.removeChild(e)}catch(e){tl&&Qs.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,e)}return n?el[t]=n.bind(lc):n}("fetch")){let n=0,r=0;return rl(t,(function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return nl("fetch"),Bc("No fetch implementation available");try{return e(t.url,s).then((t=>(n-=o,r--,{statusCode:t.status,headers:{"x-sentry-rate-limits":t.headers.get("X-Sentry-Rate-Limits"),"retry-after":t.headers.get("Retry-After")}})))}catch(t){return nl("fetch"),n-=o,r--,Bc(t)}}))}function sl(t,e,n,r){const i={filename:t,function:"<anonymous>"===e?Ka:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const al=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ul=/\((\S*)(?::(\d+))(?::(\d+))\)/,ll=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pl=function(...t){const e=t.sort(((t,e)=>t[0]-e[0])).map((t=>t[1]));return(t,n=0,r=0)=>{const i=[],o=t.split("\n");for(let t=n;t<o.length;t++){const n=o[t];if(n.length>1024)continue;const s=Ya.test(n)?n.replace(Ya,"$1"):n;if(!s.match(/\S*Error: /)){for(const t of e){const e=t(s);if(e){i.push(e);break}}if(i.length>=50+r)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Xa(e).function||"")&&e.pop(),e.reverse(),Ja.test(Xa(e).function||"")&&(e.pop(),Ja.test(Xa(e).function||"")&&e.pop()),e.slice(0,50).map((t=>({...t,filename:t.filename||Xa(e).filename,function:t.function||Ka})))}(i.slice(r))}}([30,t=>{const e=al.exec(t);if(e){const[,t,n,r]=e;return sl(t,Ka,+n,+r)}const n=cl.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=ul.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,e]=dl(n[1]||Ka,n[2]);return sl(e,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=ll.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=hl.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||Ka;return[n,t]=dl(n,t),sl(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),dl=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:Ka,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};class fl extends Error{cause;constructor(t,e){super(t),this.cause=e}}class gl{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new gl),this.INSTANCE}captureException(t,e,n){i.error(t),this.getNewScope(e,n).captureException(t)}captureMessage(t,e,n,r){this.getNewScope(n,r).captureMessage(t,e??"error")}captureError(t,e,n,r){i.error(t,e);const o=this.getNewScope(n,r),s=new fl(t,e);o.captureException(s)}setGlobalContext(t,e){this.contexts[t]={context:e,...this.contexts[t]}}setUser(t){this.user=t}setTags(t){this.tags=t}getNewScope(t,e){const n=new Ca;if(n.setClient(this.client),n.setUser(this.user),t?.triggerContext){const e=t.triggerContext;n.setExtras(e.triggerData.sentryContext()),delete t.triggerContext}return t&&n.setExtras(t),this.tags&&n.setTags(this.tags),e&&n.setTags(e),Object.keys(this.contexts).forEach((t=>{n.setContext(t,this.contexts[t])})),n.setTag("language",navigator.language),n.setTag("timezone",rr.getTimezone()),n}init(){const e=[Pa(),za(),lu(),cu(),Du(),Ru(),ec(),{name:"HttpContext",preprocessEvent(t){if(!iu.navigator&&!iu.location&&!iu.document)return;const e=t.request&&t.request.url||iu.location&&iu.location.href,{referrer:n}=iu.document||{},{userAgent:r}=iu.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}}].filter((t=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(t.name)));this.client=new Zu({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:ol,stackParser:pl,integrations:e,environment:"production",release:`web-sdk@${r.SDK_VERSION}`,debug:t}),this.client.init()}}var ml=__webpack_require__(780);class yl{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new ml.d(location.href)}catch(t){return{}}const e={};this.UTM_PARAMS.forEach((n=>{const r=t.getQueryParam(n);r&&(e[n]=r)}));const n={};return Object.keys(this.TW_PARAMS).forEach((e=>{const r=t.getQueryParam(this.TW_PARAMS[e]);r&&(n[e]=r)})),{...n,...e}}}class _l{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(t){this.name=t.name,this.path=t.path,this.qs=t.qs,this.referrer=t.referrer,this.utmSource=t.utmSource||t.utm_source,this.utmMedium=t.utmMedium||t.utm_medium,this.utmCampaign=t.utmCampaign||t.utm_campaign,this.utmId=t.utmId||t.utm_id,this.utmTerm=t.utmTerm||t.utm_term,this.utmContent=t.utmContent||t.utm_content}static parseFromCurrent(){const t="/"===location.pathname?location.pathname:location.pathname.replace(/\/+$/,"");return new _l({origin:location.origin,path:t,qs:location.search,referrer:yl.getReferrer(),name:qe.getInstance().pageName,...yl.getUTMParams()})}}var vl=__webpack_require__(110);class bl{parser;result={};constructor(){this.parser=Be.get().getUAParser()}async get(){const t=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},t.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},t.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},t.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},t.navigatorUA=navigator.userAgent,t.isHeadless=navigator.webdriver,t}getDeviceMemory(){const t=navigator;if(!t.deviceMemory)return;const e=t.deviceMemory;this.result.mem={tot:1024*e}}getNetworkType(){const t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){const t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){const t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);const e=window.devicePixelRatio||1,n=t.offsetWidth*e;return document.body.removeChild(t),n}async getLocation(){if(navigator.geolocation&&navigator.permissions)return"granted"==(await navigator.permissions.query({name:"geolocation"})).state?new Promise((t=>{navigator.geolocation.getCurrentPosition((e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()}),(()=>t()))})):void 0}async getBatteryInfo(){if("getBattery"in navigator)try{const t=await navigator.getBattery();this.result.bat={l:100*t.level,c:t.charging}}catch(t){}}}class wl{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;const e=kr[t]?.toLowerCase();e&&(i.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&"function"==typeof window.clarity}}class El{static isOn=!1;static element;static watch(){const t=i.getDebugParam();"1"!==t&&"on"!==t||$h.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),"on"===t?sessionStorage.cooeeDebug="1":"off"===t&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;const e=document.createElement("div");e.innerHTML="• "+(new Date).toLocaleString()+" - "+t,this.element.prepend(e)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),document.body.appendChild(this.element)}static dragElement(){let t=0,e=0,n=0,r=0;const i=i=>{(i=i||window.event).preventDefault(),t=n-i.clientX,e=r-i.clientY,n=i.clientX,r=i.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=t=>{(t=t||window.event).preventDefault(),n=t.clientX,r=t.clientY,document.onmouseup=o,document.onmousemove=i}}static getDebugMillis(){return(new Date).getTime()+216e5}}class Sl{static processConfiguration(){const t=tr.get();t.gaMeasurementID&&t.gaEnabled&&this.sendClientID()}static async sendClientID(){const t=await this.getClientID();t&&$h.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){const t=await We.get(je.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await We.set(je.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){const t=tr.get().gaMeasurementID;if(t&&window.gtag)return new Promise((e=>{window.gtag("get",t,"client_id",(t=>{e(t)}))}))}}class Il{static injectRawScript(t){if(!t)return;const e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;const n=document.createElement("style");n.textContent=t,e.appendChild(n)}static injectStylesheet(t,e=document.head){if(!t)return;const n=document.createElement("link");n.rel="stylesheet",n.href=t,e.appendChild(n)}}class Tl{_startTime;_triggerData;intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];constructor(t,e){this._startTime=t,this._triggerData=e}get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return"test"===t&&(t="test-"+this.startTime.getTime().toString()),r.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter((t=>t.selected.value))}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};const n={eventName:t,duration:((new Date).getTime()-this.startTime.getTime())/1e3,...e};this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach((n=>{n.id!==t||(n.isValid=e)}))}hasManipulatedProductQuantity(){const t=this.triggerData.manipulation.productQuantity;return t.enabled&&null!=t.min&&null!=t.max}getManipulatedQuantity(t){const{min:e=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(e>n)return i.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=n)return t;const r=t%100;return r<e?e:r>n?n:r}stopIntervals(){this.intervals.forEach((t=>clearInterval(t)))}}var Cl=__webpack_require__(318),Dl=__webpack_require__.n(Cl);class Ol{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return ze.isShopify()}}const xl=Dl()(fetch),Nl={retryDelay:r.API_CALL_RETRY_DELAY,retryOn:(t,e,n)=>!(t>=r.API_CALL_MAX_ATTEMPTS||!(null!==e||n?.status&&n?.status>=500))};class Al{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Al),this.INSTANCE}async validateSession(t){return this.post("/v1/event/validate-session",t)}updateUserData(t){this.put("/v1/user/update",t).then((async t=>{i.log("Updated user profile"),await bh.getInstance().storeAndPopulateAuthData(t)})).catch((t=>{i.error("Error saving user profile",t)}))}trackOrder(t){this.post("/v1/event/track-order",t).then((()=>{i.log("Sent Order")})).catch((t=>{i.error("Error sending track order",t)}))}generateDiscount(t){return this.post("/v1/event/generate-discount",t)}updateDeviceProps(t){this.put("/v1/device/update",t).then((()=>{i.log("Updated device property")})).catch((async t=>{i.error("Error saving device property",t)}))}logout(){this.get("/v1/user/logout").then((async t=>{i.log("User logged out"),await bh.getInstance().storeAndPopulateAuthData(t),Ts.get(wh).startNewSession()})).catch((t=>{i.error(t)}))}setAPIToken(t){this.apiToken=t??""}setFirstSeen(t){this.firstSeen=t?.toUTCString()??""}get(t){return this.requestBackend("GET",t)}post(t,e){return this.requestBackend("POST",t,e)}put(t,e){return this.requestBackend("PUT",t,e)}async requestBackend(t,e,n){if(!Ol.isECommerceApp()&&!Ol.getFlags().allowEvents)return i.log(`Rejecting ${t} ${e} as this is not e-commerce app`),Promise.reject();e.startsWith("http")||(e="https://api.sdk.letscooee.com"+e);const r=this.getDefaultHeaders(),o="keepalive"in new Request("");if(n&&!o&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(e,r,n)}catch(t){return gl.getInstance().captureException(t,{body:JSON.stringify(n)}),{}}const s={method:t,headers:r,keepalive:!0};return n&&(s.body=JSON.stringify(n)),this.request(e,s)}async request(t,e){const n={...Nl,...e},r=await xl(t,n);if(!r.ok)throw r;return r.json()}performXMLHttpRequest(t,e,n){return new Promise(((r,i)=>{const o=new XMLHttpRequest;o.open("POST",t,!0),e.forEach(((t,e)=>{o.setRequestHeader(e,t)})),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{const t=o.getResponseHeader("Content-Type");t?.includes("application/json")?r(JSON.parse(o.responseText)):i(new Error("Content-Type of response header is not json"))}catch(t){i(t)}else i(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{i(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))}))}getDefaultHeaders(){const t=new Headers;return t.set("content-type","application/json"),t.set("cooee-sdk",r.SDK),t.set("cooee-sdk-code",r.SDK_VERSION_CODE.toString()),t.set("cooee-sdk-version",r.SDK_VERSION),t.set("cooee-first-seen",this.firstSeen),this.apiToken&&t.append("cooee-sdk-token",this.apiToken),t}}class Pl{static sentryService=gl.getInstance();static httpApiService=Al.getInstance();static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){const e=(await Ye.getCurrent().getNormalisedCart()).items.map((t=>t.mID));t.items=t.items.filter((t=>!e.includes(t.mID)))}if(t.isCartRecovery()){const e=Ye.getCurrent().items,n=[];for(const r of t.items)for(const t of r.vars){const i=e.find((e=>e.variant_id.toString()===t.mID));if(!i)continue;const o=new ur(r);o.name=i.title;const s=new cr(t);s.name=i.variant_title,s.price.d=i.discounted_price/100,o.variants=[s],n.push(o)}return n}if(tr.get().currencyCount<=1)return t.items;const e=t.items.length,n=t.items.map((e=>this.updatedItem(e,t.engagementID))),i=(await Promise.all(n)).filter((t=>null!=t));if(e&&!i.length){const e="Failed to fetch any product from Ajax API",n=new ps(r.EVENT_CAMPAIGN_FAILED,{reason:e,currency:t.currency},t);throw $h.getInstance().sendEvent(n),new Error(e)}return i}static async updatedItem(t,e){const n=t;let r;const o=ze.getRootPrefix()+`products/${n.slug}.js`;try{r=await this.httpApiService.request(o)}catch(t){return i.error(`Failed to fetch ${o}`,t),t instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${t.status}`,"error",{item:n,path:o},{"engagement.id":e}):this.sentryService.captureException(t,{item:n,path:o},{"engagement.id":e}),null}return r?(n.name=r.title,n.vars.map((t=>{const e=r.variants.find((e=>e.id===+t.mID));t.name=e.title,t.price.d=e.price?e.price/100:e.price,t.price.cmp=e.compare_at_price?e.compare_at_price/100:e.compare_at_price})),n):(i.error("Item not found after AJAX call for:",n),null)}}var Ll,Rl,kl=0;function Ul(t,e,n,r,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)"ref"==a?s=e[a]:c[a]=e[a];var u={type:t,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--kl,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===c[a]&&(c[a]=s[a]);return V.vnode&&V.vnode(u),u}Array.isArray,function(t){t[t.CAMERA=1]="CAMERA",t[t.LOCATION=2]="LOCATION",t[t.PUSH=3]="PUSH"}(Ll||(Ll={})),function(t){t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION"}(Rl||(Rl={}));class Ml{static navigate(t,e,n){const o=`${location.origin}/discount/${t}`;switch(i.log(`Applying discount code ${t}`,e,n),e){case x.CART_PAGE:location.href=`${o}?redirect=/cart`;break;case x.CART_DRAWER:location.href=`${o}?redirect=${location.pathname}#${r.HASH_OPEN_CART_DRAWER}=1`;break;case x.SHOPIFY_CHECKOUT:location.href=`${o}?redirect=/checkout`;break;case x.THIRD_PARTY_CHECKOUT:location.href=`${o}?redirect=/cart#${r.HASH_INITIATE_CHECKOUT}=1`;break;default:location.href=`${o}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(t,e){switch(t){case x.CART_PAGE:location.href="/cart";break;case x.SHOPIFY_CHECKOUT:location.href="/checkout";break;case x.THIRD_PARTY_CHECKOUT:location.href=`/cart#${r.HASH_INITIATE_CHECKOUT}=1`;break;case x.CART_DRAWER:default:{const t=Qn.get();!t.isOpen()&&t.open(),t.refreshUI(e)}}}static async applyWithStorefront(t){const e=tr.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");const n=new Headers;n.append("Content-Type","application/json"),n.append("X-Shopify-Storefront-Access-Token",e);const i={method:"POST",headers:n,body:JSON.stringify({query:"\nmutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n id\n }\n userErrors {\n field\n message\n }\n }\n}\n",variables:{cartId:`gid://shopify/Cart/${Ye.getCurrent().token}`,discountCodes:[t]}})};await Al.getInstance().request(r.GRAPHQL_API_PATH,i)}}class Bl{listen(){document.addEventListener(r.CTA_EVENT,(async t=>{await this.processEvent(t)}),!1)}async performAddToCart(t,e){if(!t.length)return;const n=t.map((t=>{const{vID:n,quantity:r}=this.getVIDAndQuantity(t);return{id:n?+n:+t.mID,quantity:r,properties:e.getPrivateAttributesForLineItem()}})),r=ze.getCartURL("cart/add.js"),o={items:n},s=Qn.get();s.isMiniCart()?o.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(o.sections=s.element.getSectionsToRender?.().map((t=>t.section??t.id)));const a=JSON.stringify(o);try{const e=await fetch(r,{body:a,method:"post",headers:{"Content-Type":"application/json"}});if(200===e.status||302===e.status)return i.log(`Added ${t.length} items to Cart`),rr.showSnackbar("Product added to your cart"),e.json()}catch(t){i.error("Failed to add product in cart",t)}}async performCopyCoupon(t){if(t)try{await navigator.clipboard.writeText(t),i.log(`Code-${t} copied`),rr.showSnackbar("Discount code copied")}catch(t){i.error("Failed to copy code",t)}}performGoToItem(t){if(!t?.link)return;const e=ze.getProductSlug(t.link);e&&(location.pathname=ze.getRootPrefix()+"products/"+e)}async upgradeToSubscription(t,e){if(!t)return void i.warn("Trying to upgrade to subscription with no item");const n=await Ye.getCurrent().getNormalisedCart(),r=t.selectedOrFirstVariant.value,o=n.items.findIndex((t=>t.vID===r.mID)),s=r.selectedSellingPlan.value,a=ze.getCartURL("cart/change.js"),c={line:o+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},u=JSON.stringify(c);try{const e=await fetch(a,{body:u,method:"post",headers:{"Content-Type":"application/json"}});200!==e.status&&302!==e.status||(i.log(`Upgraded ${t} selling plan`),rr.showSnackbar("Line item updated"),Ye.getCurrent().update(e.json()))}catch(t){i.error("Failed to add product in cart",t)}}async processEvent(t){const e=t?.detail;if(!e)return;const n=e.clickAction,r=e.items,o=e.triggerData;if(n.at){const t=n;if(i.log(`Performing ${JSON.stringify(t)} action`),t.at===Rl.GO_TO_PRODUCT)r?.length&&this.performGoToItem(r[0]);else if(t.at===Rl.ADD_TO_CART)r?.length&&await this.performAddToCart(r,o);else if(t.at===Rl.COPY_COUPON_CODE)await this.performCopyCoupon(o.discount.code);else if(t.at===Rl.OPEN_CART)Qn.get().open();else if(t.at===Rl.GO_TO_COLLECTION){const t=e.collections;if(!t?.length)return;location.pathname=ze.getRootPrefix()+"collections/"+t[0].handle}}n.applyDiscount&&o.discount?.code&&Ml.navigate(o.discount.code,o.redirectBehaviour)}getVIDAndQuantity(t){let e,n;if(t instanceof ir)e=t.vID,n=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,n=1}return{vID:e,quantity:n}}}class jl{triggerContext;element;safeHTTP=$h.getInstance();constructor(t,e){this.triggerContext=t,this.element=e}async execute(t){const e=t.clickAction||this.element?.clc;if(!e)return;const r=t.item,o=this.triggerContext,s=new Bl,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount.type&&!!e?.applyDiscount;let u,l={selectedVariants:o.triggerData.nonMutableItems.map((t=>({itemMID:t.mID,mID:t.selectedOrFirstVariant.value.mID}))),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},h="",p=[],d=r?[r.toEmbed()]:[];if(e.at===Rl.ADD_BUNDLE){const e=o.selectedItems;if(d=t.embeddedItems??e.map((t=>t.toEmbed())),e.length===o.triggerData.items.length||t.embeddedItems?.length){let n;n=t.embeddedItems?t.embeddedItems.map((t=>({itemMID:t.mID,mID:t.vID,quantity:t.quantity}))):e.map((t=>({itemMID:t.mID,mID:t.selectedOrFirstVariant.value.mID})));const r=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&r&&n.push({itemMID:r.mID,mID:r.selectedOrFirstVariant.value.mID}),l.selectedVariants=n}else l=void 0;p=t.embeddedItems??e}else if(e.at===Rl.INITIATE_CHECKOUT){const t=await Ye.getCurrent().getNormalisedCart();d=t.items,l.selectedVariants=t.items.map((t=>({itemMID:t.mID,mID:t.vID})))}else if(e.at===Rl.ADD_TO_CART)p=[r];else if(e.at===Rl.GO_TO_PRODUCT)h=ze.getRootPrefix()+"products/"+r.slug;else if(e.at===Rl.GO_TO_URL){const t=rr.isValidURL(e.gu?.u);t&&(h=t.pathname+t.search+t.hash)}else e.at===Rl.UPGRADE_TO_SUBSCRIPTION&&(await s.upgradeToSubscription(r,o.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(d,{from:"button"}),i.debug({redirectPath:h,redirectBehaviour:a,hasDiscount:c}),!c&&h)return void(location.href=h);let f,g=!1;try{u=await this.getOrGenerateDiscountCode(l),i.debug("Discount code (if any) to apply",u)}catch(t){if(!this.triggerContext.triggerData.isBYOB())return void n().error("Unable to get a discount code",t)}u&&e.at===Rl.COPY_COUPON_CODE&&await(new Bl).performCopyCoupon(u);try{u&&await Ml.applyWithStorefront(u)}catch(t){i.error(t),g=!0}p?.length&&(f=await s.performAddToCart(p,o.triggerData)),g&&u?Ml.navigate(u,a,h):h?location.href=h:Ml.navigateWithoutDiscount(a,f)}sendTriggerClicked(t,e){const n=r.EVENT_TRIGGER_CLICKED,i=new ps(n,e,this.triggerContext.triggerData);i.items=t,this.safeHTTP.sendEvent(i)}async getOrGenerateDiscountCode(t){if(!t?.selectedVariants?.length)return void i.warn("No variant selected for the discount");const e=this.triggerContext.triggerData.discount;if(!e?.type)return;let n="";if(e.type===j.STATIC){if(!e.code)throw gl.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(n=await this.generateDiscount(t),!n)throw i.error("No discount code found",t),new Error("Discount code not found or generated");return n}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw rr.showSnackbar("Failed to generate a discount code"),i.error("Error generating discount code",e,t),gl.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}}class Fl{scalingFactor;constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};const e={display:t.disp};return t.of&&(e.objectFit=t.of),"absolute"===t.pos&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){const e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};const e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){const e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};const e={};if(t.glossy){const n="backdrop-filter",r="-webkit-"+n,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(r,i)&&!CSS.supports(n,i))return{background:t.glossy.fallback.rgba};if(e[r]=i,e[n]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};const n=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,n){if(n??={},"LINEAR"===t.type){let r=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(r+=`, ${t.c3}`),r+=")",n[e]=r}return n}getColourStyles(t,e="color",n){return n??={},t?t.grad?this.getGradientStyles(t.grad,e,n):(t.hex&&(n[e]=t.rgba),n):n}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}}class Hl extends ut{stylesConverter=new Fl(1);renderer=Be.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new jl(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),{...this.stylesConverter.getFlexStyles(this.mediaStyle.flex),...this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg),...this.stylesConverter.getBorderStyles(this.mediaStyle.br),...this.stylesConverter.getSizeStyles(this.mediaStyle.size),...this.stylesConverter.getSpaceStyles(this.mediaStyle.spc),...this.stylesConverter.getLayoutStyles(this.mediaStyle.lout),boxSizing:"border-box",outline:"none",...this.getComponentStyles(),...this.props.style}}matchWhenCondition(t){if(!t?.op)return!0;const{lhs:e,rhs:n}=t;switch(t.op){case"eq":return e===n;case"gt":return+e>+n;case"gte":return+e>=+n;case"lt":return+e<+n;case"lte":return+e<=+n;case"ne":return e!==n;case"null":return null==e;case"empty":return""===e.trim();default:return i.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){const t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle={...this.mediaStyle,...t.style.sm})}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t){await this.clickExecutor.execute(t)}}class $l extends Hl{componentDidMount(){this.setState((()=>({text:this.props.element.text}))),pe(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){const t=this.getCompiledStyles();let e=this.state.text;return e||(t.display="none",e=""),Ul("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:Ul("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(null==this.props.element.text)return;const t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData},n=ke.render(JSON.stringify(this.props.element),e),r=new mi(JSON.parse(n));this.matchWhenCondition(r.when)?this.setState((()=>({text:r.text}))):this.setState((()=>({text:""})))}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Yr;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return{...this.getTypoStyles()}}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}}class Vl extends $l{render(){return Ul("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:Ul("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.props.element.text}})})}getComponentStyles(){return{...super.getComponentStyles(),cursor:"pointer"}}}class Gl extends ut{render(){if(this.props.element.show[this.props.label.toLowerCase()])return"end"===this.props.element.lblPos?Ul("div",{style:{...this.getElementStyle(),...this.props.styles},children:[Ul("span",{children:this.props.time}),Ul("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):Ul("div",{style:{...this.getElementStyle(),...this.props.styles},children:[Ul("span",{style:this.getTimeLabelStyle(),children:this.props.label}),Ul("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){const t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}}class Wl extends $l{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState((()=>({...this.labels}))),this.processAndStartTimer()}render(){return Ul("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map((t=>Ul(Gl,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element})))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return{...super.getComponentStyles(),...this.getDisplayStyles()}}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,(t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState((()=>({...this.labels})))}))}}class ql extends Hl{componentDidMount(){pe((()=>{this.setState((()=>({checked:this.props.item.selected.value})))}))}render(){return Ul("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:Ul("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){const{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Yr;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return{...this.getTypoStyles(),display:"flex"}}}class zl extends Hl{constructor(t,e){super(t,e)}render(){const t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return Ul("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){const t=this.mediaStyle.lout;if(!t||"absolute"!==t.pos)return{};const e={zIndex:t.zIndex};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){const e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}}class Kl extends Hl{render(){if(!this.props.element.hide&&this.matchWhenCondition(this.props.element.when))return Ul("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Ul(oh,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){const t=this.mediaStyle.flex??new li,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return"nowrap"===t.wrap&&t.scroll&&("column"===t.dir?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}}class Yl extends Kl{render(){if(!this.props.element.hide&&this.matchWhenCondition(this.props.element.when))return Ul("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Ul(Ql,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}}class Jl extends Hl{render(){return Ul("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){pe((()=>{this.setState((()=>({disabled:!!this.props.triggerContext.triggerData.isBundle()&&!this.props.item.selected.value})))}))}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Yr;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){const t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),{...t,...this.getTypoStyles()}}createSelectItems(){const t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(Ul("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(const n of e.sellingPlans??[])t.push(Ul("option",{value:n.mID,selected:n.isSelected,children:n.name}));return t}onChange(t){const e=t.target.value;this.props.selectedVariant.selectedSellingPlan.value=e?this.props.selectedVariant.sellingPlans.find((t=>t.mID===e)):void 0}}class Xl extends Hl{render(){return Ul("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){pe((()=>{this.setState((()=>({disabled:!!this.props.triggerContext.triggerData.isBundle()&&!this.props.item.selected.value})))}))}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Yr;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){const t={};return 1===this.props.item.vars?.length&&"Default Title"===this.props.item.vars[0].name&&(t.visibility="hidden"),{...t,...this.getTypoStyles()}}createSelectItems(){const t=[];for(const e of this.props.item.vars)t.push(Ul("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){const e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find((t=>t.mID===e))}}class Ql extends Hl{constructor(t,e){super(t,e),this.setState((()=>({decoration:"unset"})))}renderElement(t){if(!t.hide&&this.matchWhenCondition(t.when)){if(t.t===Ir.FLEXBOX){const e=t;return Ul(Yl,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===Ir.CHECKBOX){if(!this.props.triggerContext.triggerData.isBundle())return;return Ul(ql,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}if(t.t===Ir.PRODUCT_IMAGE){const e=t,n=this.props.item,r=n.variantImage??n.imageURL,i=n.variantSecondaryImage??n.secondaryImageURL;e.lg=e.sm={src:r,name:n.name,secondarySrc:i};const o=Ul(zl,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?o:Ul("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:o})}if(t.t===Ir.PRODUCT_TITLE)return this.renderProductTitle(t);if(t.t===Ir.PRODUCT_VARIATIONS){const e=t;if(this.props.triggerContext.triggerData.isCartEmbed()&&1===this.props.item.vars?.length&&"Default Title"===this.props.item.vars[0].name)return;return Ul(Xl,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===Ir.PRODUCT_VARIATIONS_SELLING_PLANS?Ul(Jl,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===Ir.PRODUCT_BUTTON||t.t===Ir.BUTTON?Ul(Vl,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):Ul(oh,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map((t=>this.renderElement(t)))}getComponentStyles(){return{}}renderProductTitle(t){const e=Ul($l,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:Ul("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState((()=>({decoration:"underline"})))}onMouseLeave(){this.setState((()=>({decoration:"unset"})))}}class Zl extends Hl{productElement;constructor(t,e){super(t,e),this.setState((()=>({decoration:"unset"})))}render(){const t=JSON.stringify(this.props.element),e=ke.render(t,this.getProductData());if(this.productElement=new Oi(JSON.parse(e)),!this.productElement.hide&&this.matchWhenCondition(this.productElement.when))return Ul("div",{style:{...this.getCompiledStyles()},class:"lc-single-product",children:Ul(Ql,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};const t=this.props.item.selectedOrFirstVariant.value,e=t.price,n=this.props.item.name,r=this.props.item.category,i=rr.formatCurrency(e.d,!0),o=this.props.item.variantImage??this.props.item.imageURL,s=this.props.item.meta,a=e.cmp&&e.cmp>e.d,c={name:n,price:i,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,image_url:o,meta:s,effective_price:e.effective,category:r};if(a){c.compare_price=rr.formatCurrency(e.cmp);const t=e.cmp-e.d;c.discount_percent=(t/e.cmp*100).toFixed(0),c.discount_price=rr.formatCurrency(t)}return{product:c,variant:{name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity}}}}function th(){return new Promise((t=>{const e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";if(Array.from(document.scripts).some((t=>t.src.includes(e))))return void t();const n=document.createElement("script");n.src=e,n.onload=()=>{t()},document.body.appendChild(n)}))}function eh(t,e){if(!t||!window.Swiper)return;const n=new window.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(t,n)=>`\n <span class="${n}"\n style="background-color: ${e.pagination.color?.rgba};"></span>\n `,renderProgressbar:t=>`\n <span class="${t}"\n style="background-color: ${e.pagination.color?.rgba};">\n </span>\n `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:!!e.autoplay?.enabled&&{delay:e.autoplay?.delay,disableOnInteraction:!1},autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function nh(t,e,n){const r={color:t.navigation.color?.rgba};return t.pagination.enabled&&(r.transform="translateY(-25%)"),Ul("div",{class:"swiper-container",ref:e,children:[Ul("div",{class:"swiper-wrapper",children:n()}),t.navigation.enabled&&Ul("div",{class:"swiper-button-next",style:r,children:Ul("span",{})}),t.navigation.enabled&&Ul("div",{class:"swiper-button-prev",style:r,children:Ul("span",{})}),t.pagination.enabled&&Ul("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}class rh extends Hl{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===jr.CAROUSAL&&th().then((()=>{this.swiperInstance=eh(this.swiperRef,this.props.element.conf[this.deviceTypeKey])}))}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){const t=this.props.triggerContext.triggerData.items;let e;if(t.splice(this.configuration.maxItems??10),this.configuration.disp===jr.CAROUSAL){const n=t=>{this.swiperRef=t},r=()=>t?.map((t=>Ul("div",{class:"swiper-slide",children:this.getProductFragment(t)})));e=Ul("div",{style:{...this.getCompiledStyles(),display:"block"},class:"lc-product-swiper-list",children:nh(this.configuration,n,r)})}else e=Ul("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map(((e,n)=>this.getProductFragment(e,n!==t.length-1)))});return e}getComponentStyles(){const t=[jr.SIMPLE_SCROLL,jr.CAROUSAL].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if("row"===e.flexDirection)if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===jr.GRID){const t=this.props.triggerContext.triggerData,n=t.items.length;let r;r=t.isBundle()?!0!==this.props.element.prod.symbol?.hide?2*n-1:n:this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${r}, auto)`}return e}getProductFragment(t,e=!1){return Ul(ct,{children:[Ul(Zl,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&Ul("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Ul($l,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}}class ih extends Hl{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){th().then((()=>{this.swiperInstance=eh(this.swiperRef,this.props.element.conf)}))}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){const t=this.props.element;return nh(t.conf,(t=>{this.swiperRef=t}),(()=>t.values?.map((t=>Ul("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(t)}),children:this.renderElement(t)})))))}getComponentStyles(){return{}}renderElement(t){const e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case Ir.IMAGE:return Ul(zl,{element:e,triggerContext:this.props.triggerContext});case Ir.FLEXBOX:return Ul(Kl,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:i.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){const n=JSON.stringify(t),r=ke.render(n,{form:e});return Di.getParsedElement(JSON.parse(r))}getClickAction(t){const e={...this.props.element.clc},n=JSON.stringify(e),r=ke.render(n,{form:t});return JSON.parse(r)}}class oh extends Hl{constructor(t,e){super(t,e),this.setState((()=>({decoration:"unset"}))),pe((()=>{this.setState((()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length})))}))}renderElement(t){if(!t.hide){if(t.t===Ir.FLEXBOX){const e=t;return Ul(Kl,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===Ir.COUNTDOWN_TIMER)return Ul(Wl,{element:t,triggerContext:this.props.triggerContext});if(t.t===Ir.BUTTON){if(!this.state.showButton)return;return Ul(Vl,{element:t,triggerContext:this.props.triggerContext})}return t.t===Ir.TEXT?Ul($l,{element:t,triggerContext:this.props.triggerContext}):t.t===Ir.IMAGE?Ul(zl,{element:t,triggerContext:this.props.triggerContext}):t.t===Ir.PRODUCTS?Ul(rh,{element:t,triggerContext:this.props.triggerContext}):t.t===Ir.PRODUCT?Ul(Zl,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext}):t.t===Ir.CAROUSEL?Ul(ih,{element:t,triggerContext:this.props.triggerContext}):void 0}}render(){return this.props.elements.map((t=>this.renderElement(t)))}getComponentStyles(){return{}}}class sh extends Hl{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===Rl.GO_TO_URL&&this.clickAction.gu?.u}componentDidMount(){pe((()=>{const t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems,n=e.length===t.items.length;t.calculateDiscountData(e,n)}))}render(){return Ul(ct,{children:[Ul("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:Ul(oh,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),"preview"===this.props.triggerContext.triggerData.id&&Ul("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){const t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t){if(this.isClickable)return super.onClick(t)}}class ah{engagementTrigger;static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widget;triggerContext;observers=[];runtimeData=Ts.get(qe);widgetAPIService=Ts.get(yh);safeHTTPService=Ts.get($h);scrollSubscription;variation;isExclusionWithBVariation;constructor(t){this.engagementTrigger=t,this.triggerContext=new Tl(new Date,this.engagementTrigger)}renderSilently(){this.render().catch((t=>gl.getInstance().captureException(t,{...this.engagementTrigger.sentryContext()})))}destroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach((t=>{t?.disconnect&&t.disconnect()})),this.rootContainer?.remove(),ah.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){const t=await this.getVariation();if(!t)return void i.warn(`${this.engagementTrigger} no variation found for device`);this.handleVariationResponse(t)}this.rootContainer=await this.getWidgetContainer(!0),this.rootContainer?(this.widget=this.engagementTrigger.widget,await this.getWidgetData(),this.shouldStopRendering()||(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)):i.warn(`${this.engagementTrigger} no section found to render the widget`)}isSameTrigger(t){return this.engagementTrigger.shortID===t.shortID}update(t){n().log(`${this.engagementTrigger} will be updated`),this.updateItems(t.items,this.engagementTrigger.items)}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getWidgetData(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget)return void i.log(`${this.engagementTrigger} already has required data to render widget`);const t=await this.observeWidgetContainerInViewport();t?this.handleVariationResponse(t):i.warn(`No variation found for device in ${this.engagementTrigger}`)}handleVariationResponse(t){t.items?.length&&(this.engagementTrigger.items=t.items.map((t=>new ur(t))),this.engagementTrigger.nonMutableItems=t.items.map((t=>new ur(t)))),t.bundleFrom&&(this.engagementTrigger.bundleFrom=new ur(t.bundleFrom)),t.discount&&(this.engagementTrigger.discount=t.discount),t.placement&&(this.triggerContext.triggerData.placement=t.placement),t.props&&nr.hasKeys(t.props)&&(this.engagementTrigger.props={...this.engagementTrigger.props,...t.props}),this.triggerContext.triggerData.widget=this.widget=new Li(t.widget),this.triggerContext.triggerData.contentID=t.contentID,this.triggerContext.triggerData.variation=this.variation=t.variation,this.triggerContext.triggerData.placement=t.placement,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&"b"===this.variation,this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px")}addToRendered(){ah.renderedEngagements.push(this)}getVariation(){return this.widgetAPIService.getTreatment({engagementID:this.engagementTrigger.engagementID,isPreview:"preview"===this.engagementTrigger.id})}async observeWidgetContainerInViewport(){if(!this.rootContainer)return void i.warn("No root container found to register Intersection observer",this.engagementTrigger.shortID);const t=.3*window.innerHeight,e={root:null,rootMargin:`-${t}px 0px ${t}px 0px`,threshold:0};return await this.isInViewport()?this.getVariation():new Promise((t=>{const n=new IntersectionObserver(((e,n)=>{e.forEach((async e=>{if(e.isIntersecting){i.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);const e=await this.getVariation();t(e),n.unobserve(this.rootContainer)}}))}),e);n.observe(this.rootContainer),this.observers.push(n)}))}attachScroll(){this.scrollSubscription=Ss(window,"scroll").pipe(Jn(ah.DEBOUNCE_TIME)).subscribe((()=>{this.checkAndSendEvent()}))}async checkAndSendEvent(){const t=this.engagementTrigger.shortID;if(ah.engagementIDsWithTrackedDisplay.has(t))return;if(!await this.isInViewport())return;const e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.engagementTrigger.items?.map((t=>t.mID)));const n=this.isExclusionWithBVariation?r.EVENT_CAMPAIGN_HOLDOUT:r.EVENT_TRIGGER_DISPLAYED,i=new ps(n,e,this.engagementTrigger);i.name===r.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),ah.engagementIDsWithTrackedDisplay.add(t),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}async isInViewport(){const t=(await this.getWidgetContainer())?.getBoundingClientRect();if(!t)return!1;const e=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(t.bottom,e)-Math.max(t.top,0))*t.width/(t.width*t.height)*100;return this.engagementTrigger.isAnySplit()?n>0:n>=30}async getWidgetContainer(t){if(this.rootContainer?.isConnected)return this.rootContainer;const e=await this.createParentElementWithPlacement(t);if(e)return e;const n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(t){const e=this.engagementTrigger.placement;if(!e?.selector)return i.warn(`${this.engagementTrigger} does not have a selector`),null;i.debug(`${this.engagementTrigger} attempt to render ${e.position}-${e.selector}`);const n=await rr.retrySelector(e.selector);if(!n)return i.warn(`${this.engagementTrigger} no placement found with ${e.selector}`),null;const r=this.generateParentElementID(),o=this.getParentElement(r);if(!t)return o;switch(e.position){case O.BEFORE:n.parentElement?.insertBefore(o,n);break;case O.INSIDE_FIRST:n.insertBefore(o,n.firstChild);break;case O.INSIDE_LAST:n.appendChild(o);break;case O.AFTER:default:n.parentElement?.insertBefore(o,n.nextSibling)}return o}async startRendering(){let t;try{t=await Pl.refreshItems(this.engagementTrigger)}catch(t){return void i.error(`${this.engagementTrigger} error refreshing the items`,t)}t?.length||!this.engagementTrigger.isProductPromoted()?(this.engagementTrigger.items=t,this.renderContainer()):i.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`)}getParentElement(t){let e=document.getElementById(t);if(e)return e;const n=this.engagementTrigger.shortID;return e=document.createElement("div"),e.id=t,e.className=`letscooee letscooee-engagement engagement-${n}`,e.dataset.engagementId=n,"preview"===this.engagementTrigger.id&&(e.className+=" letscooee-preview"),e.style.display="block",e.style.minHeight="0.5px",e}renderContainer(){if(!this.widget)return;let t=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){const e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=tr.get().website.commonCSS;n&&Il.injectRawCSS(n,e),Il.injectStylesheet("https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@latest/dist/widget-sdk.min.css",e),Il.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",e),t=e}Dt(st(sh,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),t),this.addToRendered()}updateItems(t,e){const n=this.getItemDiff(t,e),r=this.getItemDiff(e,t);e.push(...n);for(const t of r)H.remove(e,t)}getItemDiff(t,e){return t.filter((t=>!e.some((e=>e.selectedOrFirstVariant.value.mID===t.selectedOrFirstVariant.value.mID))))}}class ch extends ah{static renderedEngagements=[];constructor(t){super(t)}addToRendered(){ch.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let t=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(t+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),t}async checkAndSendEvent(){if(Qn.get().isOpen()||"cart"===this.runtimeData.pageName)return super.checkAndSendEvent();i.log("Do not send display event as neither the cart drawer nor the cart page is open.")}}class uh{engagementTrigger;element;cartItems;constructor(t,e){this.engagementTrigger=t,this.element=e,this.cartItems=Ye.getCurrent().items}static renderCartUpsell(t){const e=t.placement;if(!e?.selector)return void i.warn(`No placement available for ${t.objective}`,t.shortID);const n=Array.from(document.querySelectorAll(e.selector));if(n?.length)for(const e of n)new uh(t,e).render();else i.warn(`No placement found for ${t.objective}`,t.shortID)}render(){const t=this.findCartItemFromHTMLElement();if(!t)return;if(this.engagementTrigger.skipSubscribedItems&&t.selling_plan_allocation)return;const e=this.engagementTrigger.items.find((e=>e.mID===t.product_id.toString()));if(!e)return;const n=e.vars.find((e=>e.mID===t.id.toString()));if(!n)return;const r=new cr(n),i=t.selling_plan_allocation?.selling_plan;if(i)for(const t of r.sellingPlans??[])t.mID===i.id.toString()&&(t.isSelected=!0,r.changeSellingPlan(t));const o=new ur(e);o.vars=[r],o.selectedOrFirstVariant.value=r;const s=`lc-cart-item-${this.engagementTrigger.shortID}-${e.mID}`;this.element.classList.add(s);const a=new Mi(this.engagementTrigger);a.placement.selector=`.${s}`,a.items=[o];const c=new ch(a);c.renderSilently(),this.watchForCartItemDeletion(c,s)}watchForCartItemDeletion(t,e){const n=new MutationObserver((r=>{r.forEach((r=>{r.removedNodes.forEach((r=>{r===this.element&&(i.debug(`${e} has been removed`),t.destroy(),n.disconnect())}))}))}));n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){const t=this.element.innerHTML;return this.cartItems.find((e=>{if(!t.includes(e.url)&&!t.includes(e.variant_id)){if(!t.includes(e.product_title))return!1;if(e.variant_title&&!t.includes(e.variant_title))return!1}const n=e.selling_plan_allocation?.selling_plan?.name;return!(n&&!t.includes(n))}))}}class lh extends ah{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){const t=document.createElement("cooee-progressbar");t.className="cooee-root",t.engagementTrigger=this.engagementTrigger,this.rootContainer.appendChild(t)}}const hh=new Oi({t:12,style:{lg:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"100%",h:"auto"},br:{r:4,w:0,s:1,c:{h:"#94a3b8",a:100}}},sm:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"240px",h:"auto"},br:{r:0,w:0,s:1,c:{h:"#94a3b8",a:100}}}},elems:[{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}}},clc:{},elems:[{t:13,style:{lg:{spc:{mb:5},size:{w:"70px",h:"auto"},lout:{of:"cover"}},sm:{spc:{mb:5},size:{w:"80px",h:"auto"},lout:{of:"cover"}}},src:"{{{ product.image_url }}}"},{t:4,style:{lg:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:7,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}}},clc:{},elems:[{t:14,style:{lg:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#313131",a:100},ta:0,fw:600,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#575757",a:100},ta:0,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.name }}"},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:14,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:12,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.compare_price }}"},{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:14,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.price }}"},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"Save {{ product.discount_price }}",when:{lhs:"{{ product.discount_price }}",op:"gt",rhs:0}},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#0d8d00",a:100},ta:1,fw:400,ls:0,fam:{name:"DINNextRoundedLTPro-Medium"}}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"({{ product.discount_percent }}% off)",when:{lhs:"{{ product.discount_percent }}",op:"gt",rhs:0}}]},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:3,style:{lg:{spc:{p:7,pl:7,pr:7,pt:7,pb:7},size:{w:"100%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{p:7,pl:7,pr:7,pt:8,pb:8},size:{w:"70%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"Add",clc:{at:102},allowedTypes:[102]}]}]}]}]}),ph=new mi({t:2,style:{lg:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}},sm:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}}},text:"WATCH & SHOP - NEW LAUNCHES"});class dh extends Hl{render(){return Ul("div",{style:{marginTop:30},class:"lc-container",children:[Ul($l,{element:ph,triggerContext:this.props.triggerContext}),Ul("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map((t=>{if(t.portraitVideos?.length)return Ul("div",{class:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[Ul("a",{href:t.link,onClick:()=>{this.sendTriggerClicked([new ir(t)],{from:"video"})},children:Ul("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),Ul(Zl,{element:hh,item:t,triggerContext:this.props.triggerContext})]})}))})]})}getSources(t){const e=t.map((t=>Ul("source",{src:t.url,type:t.mimeType,media:`(max-width:${t.width}px)`}))),n=t.filter((t=>"mp4"===t.format)).sort(((t,e)=>e.width-t.width))[0];n&&e.push(Ul("source",{src:n.url,type:n.mimeType}));const r=t.filter((t=>"m3u8"===t.format)).sort(((t,e)=>e.width-t.width))[0];return r&&e.push(Ul("source",{src:r.url,type:r.mimeType})),e}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}}class fh extends ah{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){Dt(st(dh,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}}class gh extends ah{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){const t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(r.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){const e=this.engagementTrigger,n=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,r=t.detail;if(!nr.hasKeys(r))return void i.error(`No detail received for ${n}`);i.log("Detail received for BYOB",r);const o=r.campaignID??r.campaignId??r.campaign_id;if(o!==e.shortID&&o!==e.engagementID)return void i.warn(`Current ${n} is not BYOB. Received: ${o}`);const s=r.items;if(!s?.length)return;const a=s.map((t=>new ir({mID:t.product_id,vID:t.variant_id,quantity:t.quantity||1})));await new jl(this.triggerContext).execute({embeddedItems:a,clickAction:{at:Rl.ADD_BUNDLE,applyDiscount:!0}})}}class mh{runtimeData=qe.getInstance();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;const e=[...ch.renderedEngagements];ch.renderedEngagements.length=0;for(const n of t)i.log(`${n} received as cart embed`),this.findAndUpdateCurrent(n,e)||(i.log(`${n} is new`),n.isProgressBar()?new lh(n).renderSilently():n.isSubscriptionUpsell()?uh.renderCartUpsell(n):new ch(n).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){const e=[...ah.renderedEngagements];ah.renderedEngagements.length=0;for(const n of t)i.log(`${n} received as page embed`),this.findAndUpdateCurrent(n,e)||(i.log(`${n} is new`),n.isShoppableVideo()?new fh(n).renderSilently():n.isBYOB()?new gh(n).renderSilently():new ah(n).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){const n=e.findIndex((e=>e.isSameTrigger(t)));return!(n<0||t.isSubscriptionUpsell()||(e[n].update(t),e[n].renderSilently(),e.splice(n,1),0))}removeOldWidgets(t){for(const e of t)e.destroy()}}class yh{static INSTANCE;httpService=Ts.get(Al);sessionManager=Ts.get(wh);runtimeData=Ts.get(qe);loadWidgetsSubject=new Mn;constructor(){this.loadWidgetsSubject.pipe(Jn(300)).subscribe((()=>{this.loadCartWidgets().catch((t=>i.error("Unable to initiate cart widgets",t))),this.loadPageWidgets().catch((t=>i.error("Unable to initiate page widgets",t)))})),Xn.get().subscriber(r.CART_UPDATE_BROADCAST).subscribe((()=>this.loadWidgetsSubject.next()))}static getInstance(){return this.INSTANCE||(this.INSTANCE=new yh),this.INSTANCE}loadOrRenderCartWidgets(){this.runtimeData.isCartDirty?this.loadCartWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){wh.replaySubject.subscribe((async()=>{this.loadPageWidgets().catch((t=>i.error("Unable to initiate load page widgets",t)))}))}loadCartWidgetsSilently(){wh.replaySubject.subscribe((async()=>{this.loadWidgetsSubject.next()}))}async loadPageWidgets(){const t=await this.getWidgetProps();i.log("Load widgets",t),this.httpService.post("/v1/engagement/page-widgets",t).then((async t=>{const e=t.widgets.map((t=>new Mi(t)));(new mh).processPageWidgetResponse(e)})).catch((t=>{i.error("Error sending widget getter",t)}))}async loadCartWidgets(){const t=await this.getWidgetProps();i.log("Load cart widgets",t),this.httpService.post("/v1/engagement/cart-widgets",t).then((async t=>{const e=t.widgets.map((t=>new Mi(t)));(new mh).processCartWidgetResponse(e)})).catch((t=>{i.error("Error sending widget getter",t)}))}async getTreatment(t){i.log("Load widget data for ",t.engagementID);const e=await this.getWidgetProps();try{return this.httpService.post("/v1/engagement/get-variant",{...t,...e})}catch(t){i.error("Error getting widget data",t)}}renderCachedCartWidgets(){(new mh).processCartWidgetResponse(this.runtimeData.cartEngagements)}async addSessionContext(t){const e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=_l.parseFromCurrent()}addAvailableEngagementShortIDs(){const t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach((t=>{const n=t.dataset.engagementId;n&&+n&&e.push(n)})),e}async getWidgetProps(){const t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),await this.addSessionContext(t),t.currentItem=qe.getInstance().getCurrentItem();try{t.cart=await Ye.getCurrent().getNormalisedCart()}catch(t){i.error("Error fetching Shopify cart before sending widget call",t)}const e=new URLSearchParams(location.search),n=e.get("cooee-preview");n?t.previewIDs=n.trim().split(",").filter((t=>Number.isInteger(+t))):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);const r=e.get("cooee-variant");return r?t.previewVariant=r:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}}class _h{static INSTANCE;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new _h),this.INSTANCE}async processAppConfigurations(t){i.log("Received app configuration",t),t.currencyCount=t.currencies?.length;const e=await tr.set(t);Sl.processConfiguration(),e.website&&(Il.injectRawScript(e.website.commonJS),Il.injectRawCSS(e.website.commonCSS)),Qn.get().onToggle().subscribe((async({open:t})=>{i.info("Cart drawer is now",t?"open":"closed"),t&&(Ts.get(yh).loadOrRenderCartWidgets(),await this.trackViewCartEvent())}))}async trackViewCartEvent(){const t=await Ye.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},n={items:t.items,amount:e,drawer:!0};$h.getInstance().sendEvent(new ps(r.EVENT_VIEW_CART,n))}}class vh{static META_REQUIRED_FIELDS=["ad_id","campaign_id","fbclid"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(t){this.adID=t.adID,this.campaignID=t.campaignID,this.source=t.source}static getAdParams(){let t;try{t=new ml.d(location.href)}catch(t){return{}}let e={};const n=this.META_REQUIRED_FIELDS.every((e=>Array.from(t.getParams().keys()).includes(e)));if(n)return e={source:"META",adID:t.getQueryParam("ad_id")?.trim(),campaignID:t.getQueryParam("campaign_id")?.trim()},new vh(e);const r=this.GOOGLE_REQUIRED_FIELDS.every((e=>Array.from(t.getParams().keys()).includes(e)));return r?(e={source:"GOOGLE"},new vh(e)):void 0}}class bh{static INSTANCE=new bh;apiService=Al.getInstance();coreService=_h.getInstance();sentryService=gl.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE}init(t){this.appID=t.appID,this.shopifyShop=t.shopifyShop}async storeAndPopulateAuthData(t){t&&(t.userID&&(this.userID=t.userID,await We.set(je.ID,t.userID)),t.deviceID&&(this.deviceID=t.deviceID,await We.set(je.DEVICE_ID,t.deviceID)),t.sdkToken&&(this.sdkToken=t.sdkToken,await We.set(je.SDK_TOKEN,t.sdkToken)),this.updateAPIClient())}async validateSession(t){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),i.log("Validating session with server");const e=await this.getSessionValidateData(t);try{const t=await this.apiService.validateSession(e);i.log("Validating session Response",t),await this.coreService.processAppConfigurations(t.appSettings),await this.storeAndPopulateAuthData(t)}catch(t){throw i.error(t),t}}async populateUserDataFromStorage(){this.sdkToken=await We.get(je.SDK_TOKEN),this.sdkToken?(this.userID=await We.get(je.ID),this.userID||i.warn("No user ID found in local storage"),this.deviceID=await We.get(je.DEVICE_ID),this.deviceID||i.warn("No device ID found in local storage"),this.updateAPIClient()):i.warn("No SDK token found in local storage")}updateAPIClient(){i.log("SDK Token:",this.sdkToken),i.log("Device ID:",this.deviceID),i.log("User ID:",this.userID),wl.trackDeviceID(this.deviceID),El.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.apiService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(t){const e=await(new bl).get();e.host=location.origin;try{const t=await(0,vl.A)();t?.isPrivate&&(e.private=!0)}catch(t){n().error("Unable to detect private/incognito window",t)}let i=await We.get(je.DEVICE_ID);return i||(i=(new Yo).toHexString(),await We.set(je.DEVICE_ID,i)),{deviceID:i,deviceProps:e,appID:this.appID,shopifyShop:this.shopifyShop,...t,sdk:r.SDK,page:_l.parseFromCurrent(),ad:vh.getAdParams(),occurred:this.getSessionStartTime(qe.getInstance().jsLoadTime),currentItem:qe.getInstance().getCurrentItem(),cart:await Ye.getCurrent().getNormalisedCart(),properties:{}}}async populateFirstSeen(){const t=await We.get(je.FIRST_SEEN),e=t?new Date(t):new Date;t||await We.set(je.FIRST_SEEN,e.toISOString()),this.apiService.setFirstSeen(e),this.sentryService.setGlobalContext("Visitor Info",{first_seen:e.toISOString()})}getSessionStartTime(t){return((new Date).getTime()-t.getTime())/1e3>r.IDLE_TIME_IN_SECONDS?new Date:t}}class wh{static replaySubject=new Os(1);static INSTANCE;sentryService=Ts.get(gl);lock=new Ke;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new wh),this.INSTANCE}init(t){var e;i.debug("Initialising SDK",t),e=navigator.userAgent,Boolean(e)&&function(){if(Cs instanceof RegExp)return Cs;try{Cs=new RegExp(" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/5\\.0\\s[a-z\\.-]+$|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|trace|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab","i")}catch(t){Cs=Ds}return Cs}().test(e)?i.info("This seems to be a bot. Disabling SDK"):(bh.getInstance().init(t),wh.INSTANCE.checkForNewSession(!0).then((async()=>{wh.replaySubject.next(!0),wh.replaySubject.complete()})).catch((t=>i.error("Unable to perform device init",t))))}getCurrentSessionID(){return Ge.set(je.SESSION_LAST_USED_TIME,(new Date).getTime()),Ge.get(je.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){const t=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:t[0],number:t[1],landing_page:t[2]}),t}async checkForNewSession(t){await this.lock.acquire();let e=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),t=!0,e=!0):await this.notSynced()&&(e=!0),t){const t=await this.getContext();await bh.getInstance().validateSession({sessionID:t[0],sessionNumber:t[1],landingPage:t[2],newSession:e}),await Ge.set(je.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){i.debug("Starting new session"),await Ge.clear(),i.debug("Cleared SessionStorage before starting new session");const t=new Date,e=(new Yo).toHexString();i.debug("New session ID to be used",e);const n=await We.get(je.SESSION_NUMBER,0)+1;El.prepend(`New Session ID: <strong>${e}</strong> & number: ${n}`),await Promise.all([We.set(je.SESSION_NUMBER,n),Ge.set(je.ID,e),Ge.set(je.SESSION_LAST_USED_TIME,t.getTime()),Ge.set(je.SESSION_LANDING_PAGE,_l.parseFromCurrent())])}getLandingPage(){return Ge.get(je.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return We.get(je.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await Ge.get(je.ID))return!0;const t=await Ge.get(je.SESSION_LAST_USED_TIME,0);return!t||((new Date).getTime()-t)/1e3>r.IDLE_TIME_IN_SECONDS}async notSynced(){return!await Ge.get(je.SESSION_SYNCED,!1)}}class Eh{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach((t=>{t instanceof Jr&&this.loadFamily(t.typography?.fam)}))}async loadFamily(t){if(!t?.fonts)return;if(this.loadedFonts.indexOf(t.name)>-1)return;const e=[];t.fonts.forEach((n=>{if(n.url){const i=new FontFace(r.COOEE+t.name,n.getURL(),n.getFontDescriptor());e.push(i.load())}})),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach((t=>{document.fonts.add(t)}))}}class Sh{static updateIdentity(t){if(!this.isInstalled())return;const e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),i.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&"object"==typeof window.klaviyo}}class Ih{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=$h.getInstance(),this.triggerContext=e}async execute(){const t=this.containsCTA()?r.EVENT_TRIGGER_CLICKED:r.EVENT_TRIGGER_CLOSED;switch(this.action.at!==Rl.SUBMIT_FORM&&this.closeTriggerAndSendEvent(t),this.action.at){case Rl.ACCEPT_POPUP:break;case Rl.GO_TO_URL:this.gotoURLAction();break;case Rl.SHARE:this.shareAction();break;case Rl.SUBMIT_FORM:this.collectFormData();break;case void 0:break;default:return void i.error("Received an invalid ClickActionType: ",this.action.at)}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;rr.isValidURL(t)||(t=`//${t}`),window.open(t,"_self")}}prompt(){const t=this.action.pmpt;t&&(t===Ll.LOCATION&&this.promptLocationPermission(),t===Ll.PUSH&&this.promptPushNotificationPermission(),t===Ll.CAMERA&&this.promptCameraPermission())}closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),this.dispatchEvent()}shareAction(){this.action.share&&(navigator.share?navigator.share({text:this.action.share.text,title:"Share"}).then((t=>console.log(t))).catch((t=>console.error(t))):i.warn("Navigator.share is not compatible with this browser"))}containsCTA(){return!(!this.action.at||this.action.at===Rl.REJECT_POPUP)||!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return!t||0===Object.keys(t).length}promptLocationPermission(){navigator.geolocation&&navigator.permissions&&navigator.geolocation.getCurrentPosition((t=>{this.apiService.updateDeviceProps({coords:[t.coords.latitude,t.coords.longitude]}),this.sendPermissionData()}))}promptPushNotificationPermission(){"Notification"in window?"default"===Notification.permission?Notification.requestPermission().then((()=>{this.sendPermissionData()})):this.apiService.updateDeviceProps({pnPerm:Notification.permission}):i.warn("This browser does not support desktop notification")}promptCameraPermission(){navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally((()=>{this.sendPermissionData()}))}checkPermission(t){return navigator.permissions.query({name:t}).then((t=>t.state.toString()))}async checkAllPermission(){return{camera:await this.checkPermission("camera"),location:await this.checkPermission("geolocation"),notification:Notification.permission}}sendPermissionData(){this.checkAllPermission().then((t=>{this.apiService.updateDeviceProps({perm:t})}))}collectFormData(){const t={};for(const e of this.triggerContext.inputs){if(!e.isValid)return;const n=document.getElementById(e.id).value;e.type===Ir.EMAIL_INPUT?t.email=n:e.type===Ir.PHONE_INPUT&&(t.mobile=n)}this.closeTriggerAndSendEvent(r.EVENT_FORM_SUBMITTED,{form:t}),rr.showSnackbar("Coupon applied on cart"),Sh.updateIdentity(t)}dispatchEvent(){const t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};document.dispatchEvent(new CustomEvent(r.CTA_EVENT,{detail:e}));const n={action:this.containsCTA()?r.CAMPAIGN_CLICKED_ACTIVITY:r.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(r.POPUP_ACTIVITY_EVENT,{detail:n}))}}class Th{renderer=Be.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,n){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=n,this.stylesConverter=new Fl(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();const t={...this.getDisplayStyles(),...this.getSpaceStyles(),...this.getBorderStyles(),...this.getBackgroundStyles(),boxSizing:"border-box",outline:"none"};this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){const t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){const t=this.inappElement.alpha;if(!isNaN(t)){const e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){const t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){const t=new Vr(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){const t=this.inappElement.clc;t&&0!==Object.keys(t).length&&(this.inappHTMLEl.addEventListener("click",(e=>{e.stopPropagation(),new Ih(t,this.triggerContext).execute()})),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}}class Ch extends Th{constructor(t,e,n){super(t,e,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){const t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=r.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){const n=[];e.u&&n.push("underline"),e.st&&n.push("line-through"),n.length||n.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",n.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){const t=this.inappElement.typography.ta;let e=t?Cr[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}}class Dh extends Ch{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach((t=>{const e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)})),this.processCommonBlocks()}}class Oh extends Th{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}}class xh extends Th{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}}class Nh extends Th{parent;static MAX_Z_INDEX="2147483647";constructor(t,e,n){super(t,e,n),this.parent=t,this.inappHTMLEl=this.renderer.createElement("div")}render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(r.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",Nh.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){const t=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{const e=this.inappElement.spc,n=this.stylesConverter.getScaledSize(t.w)+e.getHorizontal(),r=this.stylesConverter.getScaledSize(t.h)+e.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",r+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return{display:"flex",...this.inappElement.getStylesForWrapper(),...this.inappElement.getFlexStylesForContainer()}}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded())return void this.renderer.setStyle(this.inappHTMLEl,"position","block");this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}}class Ah extends Th{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(r.IN_APP_CONTAINER_NAME),this}}class Ph extends Ch{borderColor="";constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){const t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",(t=>{t.stopPropagation()})),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}}class Lh extends Ph{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(t,e,n){super(t,e,n)}setInputType(){const t=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",t),t}addListener(t,e){t.addEventListener("keydown",(n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),t.value.match(Lh.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(e,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(e,!1)),n.stopPropagation()}))}}class Rh extends Ph{static MOBILE_REGEX=/^\d+$/;constructor(t,e,n){super(t,e,n)}setInputType(){const t=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",t),t}addListener(t,e){t.addEventListener("keydown",(n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),t.value.match(Rh.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(e,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(e,!1)),n.stopPropagation()}))}}class kh extends Ch{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();const t={flex:"1 1 0",...this.stylesConverter.getBackgroundStyles(this.inappElement.bg),...this.stylesConverter.getBorderStyles(this.inappElement.br),...this.stylesConverter.getSpaceStyles(this.inappElement.spc),marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)};this.addStylesToTimer(t)}getBackgroundStyles(){return{}}processFontBlock(){const t=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.addStylesToTimer(t),t}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(t){this.elements.forEach((e=>this.renderer.setStyles(e,t)))}addTimerChildren(){const t=this.inappElement.show;this.elements=[],t.day&&this.elements.push(this.getChild(kh.DAYS)),t.hour&&this.elements.push(this.getChild(kh.HOURS)),t.minute&&this.elements.push(this.getChild(kh.MINUTES)),t.second&&this.elements.push(this.getChild(kh.SECONDS)),this.elements.forEach((t=>this.inappHTMLEl.appendChild(t)))}getChild(t){const e=this.renderer.createElement("div"),n=this.renderer.createElement("span"),r=this.renderer.createElement("span");return r.innerText=t,n.innerText="00",n.id=`lc-${t}`,this.renderer.setStyle(r,"font-size","0.5em"),this.renderer.setStyle(r,"text-align","center"),this.renderer.setStyle(r,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),"start"===this.inappElement.lblPos?(e.appendChild(r),e.appendChild(n)):(e.appendChild(n),e.appendChild(r)),this.renderer.setStyle(e,"display","flex"),this.renderer.setStyle(e,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(e,"justify-content","center"),this.renderer.setStyle(e,"align-items","center"),this.renderer.setStyle(e,"gap","5px"),this.spans.push(n),e}processAndStartTimer(){const t=this.inappElement.timer.start(this.inappElement.timerType,(t=>{this.spans.forEach((e=>{e.id===`lc-${kh.DAYS}`?e.innerText=String(t.days).padStart(2,"0"):e.id===`lc-${kh.HOURS}`?e.innerText=String(t.hours).padStart(2,"0"):e.id===`lc-${kh.MINUTES}`?e.innerText=String(t.minutes).padStart(2,"0"):e.id===`lc-${kh.SECONDS}`&&(e.innerText=String(t.seconds).padStart(2,"0"))}))}));this.triggerContext.intervals.push(t)}}class Uh extends Ch{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",(t=>{t.stopPropagation()})),t.addEventListener("change",(()=>{const e=new cr(JSON.parse(t.value));this.updateItems(e)}))}updateItems(t){const e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];const n=this.parentHTMLEl.querySelector(`#coo-${Ir.PRODUCT_IMAGE}`);if(!n)return;const r=t.imgs[0]??e.imgs?.at(0);r?.url&&n.setAttribute("src",r.url)}addOptions(){const t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length)return void e.add(this.createOption(this.inappElement.placeholderText));const n=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach((t=>{e.add(this.createOption(t.name??"Default",t,t.mID===n?.vID))}))}createOption(t,e,n){const r=this.renderer.createElement("option");return r.text=t,r.value=JSON.stringify(e),n&&(r.selected=!0),e||(r.disabled=!0),r}}class Mh extends xh{constructor(t,e,n){super(t,e,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}}class Bh{static ACTIVE_TRIGGER_DATA;renderer=Be.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(t){this.safeHTTP=$h.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(t)}setParentContainer(t){this.parent=t??document.body,this.renderer.setParentContainer(this.parent)}render(t){this.renderEngagement(new Mi(t))}async renderEngagement(t){if(t.previewType||!Bh.ACTIVE_TRIGGER_DATA){if(Bh.ACTIVE_TRIGGER_DATA=t,this.triggerContext=new Tl(new Date,t),this.triggerContext.onClose((t=>{this.closeInApp(t)})),this.ian=t.ian,(this.renderer.isMobile()||"mobile"===t.previewType)&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){const t=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(t)}await this.preloadImages(t),t.shouldDelay()?window.setTimeout((()=>{this.withCartDrawerClosed()}),t.getDelaySeconds()):this.withCartDrawerClosed()}else{const e={triggerShown:new hs(Bh.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(t,e)}}withCartDrawerClosed(){Qn.get().isOpen()&&this.renderer.isMobile()?this.cartDrawerToggleSubscription=Qn.get().onToggle().subscribe((({open:t})=>{!t&&this.startRenderingOnce()})):this.startRenderingOnce()}startRenderingOnce(){if(qe.getInstance().isGoKwikPopupOpen)this.skipTrigger(this.triggerContext.triggerData,{reason:"GoKwik popup is open"});else{try{this.startRendering()}catch(t){return void gl.getInstance().captureException(t,{triggerData:JSON.stringify(this.triggerContext.triggerData)})}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Nh(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(t){throw i.error(t),t}}sendTriggerDisplayed(){const t={};this.triggerContext.triggerData.items?.length&&(t.promotedMIDs=this.triggerContext.triggerData.items?.map((t=>t.mID)));const e=new ps(r.EVENT_TRIGGER_DISPLAYED,t,this.triggerContext.triggerData);this.safeHTTP.sendEvent(e);const n={action:r.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(r.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(t){const e=t.eventName;delete t.eventName;const n=new ps(e,t,this.triggerContext.triggerData);n.name===r.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map((t=>t.toEmbed()))),this.safeHTTP.sendEvent(n)}addEnterAnimation(t){this.containerHTMLElement.animate(t.getEnterAnimation(),{duration:500})}renderElement(t,e,n){e instanceof ii?new Lh(t,e,n).render():e instanceof oi?new Rh(t,e,n).render():e instanceof Xr?new Dh(t,e,n).render():e instanceof si?new Mh(t,e,n).render():e instanceof qr?new xh(t,e,n).render():e instanceof Qr?new Oh(t,e,n).render():e instanceof ti?new kh(t,e,n).render():e instanceof ri?new Uh(t,e,n).render():i.error("Unsupported element type- "+e.type)}renderContainer(t){const e=this.ian?.cont;e&&(this.containerHTMLElement=new Ah(this.rootContainer,e,t).render().getHTMLElement(),(new Eh).loadAllFonts(this.ian),this.ian.elems?.forEach((async e=>{await this.renderElement(this.containerHTMLElement,e,t)})),this.addEnterAnimation(this.ian.anim))}closeInApp(t){const e=this.ian.anim.getExitAnimation();this.sendTriggerClosed(t),Bh.ACTIVE_TRIGGER_DATA=void 0,this.containerHTMLElement.animate(e,{duration:500,easing:"ease-in-out"}).onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){Be.get().removeInApp(this.triggerContext)}skipTrigger(t,e){const n=new ps(r.EVENT_CAMPAIGN_REJECTED,e,t);this.safeHTTP.sendEvent(n)}async preloadImages(t){const e=t.ian;if(!e)return;const n=[];e.elems.forEach((t=>{const e=t.bg?.img?.src;if(e&&n.push(this.getPromise(e)),t.t===Ir.IMAGE){const e=t.src;if(!e)return;n.push(this.getPromise(e))}})),e.bg?.img?.src&&n.push(this.getPromise(e.bg.img.src)),e.cont.bg?.img?.src&&n.push(this.getPromise(e.cont.bg.img.src)),await Promise.all(n)}getPromise(t){return new Promise((e=>{const n=new Image;n.onload=e,n.src=t,n.style.display="none"}))}}class jh{triggerData;safeHttpService=$h.getInstance();render(t){t.contentSource===k.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if("klaviyoForms"!==t.type)return;const e=t.detail;if(e.formId===this.triggerData.klaviyoFormID)switch(e.type){case"open":this.safeHttpService.sendEvent(new ps(r.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{const t=this.getFormDetails(e);this.safeHttpService.sendEvent(new ps(r.EVENT_FORM_SUBMITTED,{form:t},this.triggerData)),this.safeHttpService.updateProfile(t);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new ps(r.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData))}else i.warn("Received invalid trigger callback")}getFormDetails(t){const e={id:t.formId},n=t.metaData;if(nr.hasKeys(n)){const t=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach((r=>{t.includes(r)||(e[r]=n[r])})),e.email=n.$email??n.email,e.mobile=n.$phone_number??n.phone_number;const r=n.$first_name??n.first_name,i=n.$last_name??n.last_name;(r?.length||i?.length)&&(e.name=r+" "+i)}return e}}class Fh{static trackIntent(t){if(!this.isInstalled())return void i.log("Facebook pixel not installed");if(!tr.get().pixelPush)return void i.log("Facebook pixel push not enabled");const e=kr[t.intent]?.toLowerCase(),n=t.segmentName;(e||n)&&(i.debug(`Sending ${e} intent and ${n} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&"function"==typeof window.fbq}}class Hh{static INSTANCE=new Hh;httpService=Ts.get(Al);sentryService=Ts.get(gl);sessionManager=Ts.get(wh);runtime=Ts.get(qe);constructor(){}static getInstance(){return this.INSTANCE}sendSilently(t){this.send(t).catch((e=>i.error(`Failed to send ${t.name}`,e)))}async send(t){i.debug(`Sending event ${t.name}`),El.prepend(`Sending event <strong>${t.name}</strong> with id ${t.id}`),this.shouldReject(t)?i.info(`Rejecting event ${t.name}`):(await Promise.all([this.addSessionContext(t),this.addShopifyContext(t)]),this.addShopifyAttributes(),t.name!==r.EVENT_APP_BACKGROUND&&this.runtime.setActive(),t.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",t).then((async e=>{i.log("Event tracked:",t.name),El.prepend(`Event <strong>${e.eventName}</strong> tracked`),this.processEventResponse(t,e)})).catch((e=>{i.error(`Error sending event ${t.name} to server`,e)})))}shouldReject(t){if("test"===t.trigger?.triggerID||"preview"===t.trigger?.triggerID)throw Error("Not sending event as this is a test trigger");return!1}async addSessionContext(t){const e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=_l.parseFromCurrent()}async addShopifyContext(t){if(ze.isShopify())try{t.cart=await Ye.getCurrent().getNormalisedCart()}catch(t){i.error("Error fetching Shopify cart before sending the event",t)}}processEventResponse(t,e){this.renderWidgetIfAny(t,e).catch((n=>{i.error("Failed to display a campaign",n,t,e),this.sentryService.captureException(n,{event:t,response:e})})),this.utiliseIntentIfCalculated(e),bh.getInstance().storeAndPopulateAuthData(e)}async renderWidgetIfAny(t,e){if(!e.triggerData)return void i.log(`Nothing to engage after ${t.name}`);i.log(`Campaign(id=${e.triggerData.shortID}) will be shown`,e.triggerData);const n=new Mi(e.triggerData);let r;n.occurred=t.occurred;try{r=await Pl.refreshItems(n)}catch(t){return void i.error("Failed to refresh the products",t)}n.items=r,n.contentSource!==k.KLAVIYO?(new Bh).renderEngagement(n).catch((e=>{i.error("Failed to render popup",e),this.sentryService.captureException(e,{event:t,triggerData:n})})):(new jh).render(n)}utiliseIntentIfCalculated(t){t.intent&&(wl.trackIntent(t.intent),Fh.trackIntent(t),El.prepend(`Intent is <strong>${kr[t.intent]}</strong>`))}addShopifyAttributes(){ze.isShopify()&&Ye.getCurrent().addCooeeAttributes().catch((t=>{i.error("Fail to add attributes in cart",t)}))}}class $h{static INSTANCE;httpApiService=Al.getInstance();eventAPIService=Hh.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new $h),this.INSTANCE}sendEvent(t){i.debug(`Sending event ${t.name} via SafeHTTPService`),wh.replaySubject.subscribe((async()=>{this.eventAPIService.sendSilently(t)}))}updateProfile(t){wh.replaySubject.subscribe((()=>{this.httpApiService.updateUserData(t??{})}))}trackOrder(t){wh.replaySubject.subscribe((()=>{this.httpApiService.trackOrder(t)}))}updateDeviceProps(t){wh.replaySubject.subscribe((()=>{this.httpApiService.updateDeviceProps({props:t})}))}logout(){wh.replaySubject.subscribe((()=>{this.httpApiService.logout()}))}generateDiscount(t){return this.httpApiService.generateDiscount(t)}}class Vh{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=r.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}}class Gh{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=Ts.get($h);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(t){this._lastScreenOrScroll=t}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Gh),this.INSTANCE}resetScrollID(t){Vh.remove(r.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=t??new Date}listen(){if(window.scrollY){const t=this.getPercentScrolledY();this.shouldSendScroll(t)&&this.sendScroll(t)}rr.onDocumentLoaded((()=>{this.observeWindowScroll()}))}observeWindowScroll(){Ss(window,"scroll").pipe(Jn(Gh.DEBOUNCE_TIME),ys((()=>{const t=this.getPercentScrolledY();if(!(t>100))return this.shouldSendScroll(t)?t:void 0;i.warn("Received scroll percent is more than 100",t)}))).subscribe((t=>{this.sendScroll(t)}))}shouldSendScroll(t){return Math.abs(this.lastPercent-t)>=Gh.THRESHOLD||this.lastPercent!==t&&100===t}sendScroll(t){if(null==t)return;const e={percent:t,timeMS:(new Date).getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=t;const n=Vh.getString(r.SESSION_STORAGE_SCROLL_ID,""),i=new ps(r.EVENT_SCROLL,e,null,n);this.safeHttpService.sendEvent(i),Vh.setString(r.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){const t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}}class Wh{selectors;eventName;static INSTANCE;elements;selectorString;constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}clickListenerCallback=t=>{const e=t.currentTarget,n=new ps(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});$h.getInstance().sendEvent(n),this.removeClickListener(this.clickListenerCallback)};async listen(){this.elements=await rr.retrySelectorForElements(this.selectorString),this.elements.forEach((t=>{t.addEventListener("click",this.clickListenerCallback)}))}removeClickListener(t){this.elements?.forEach((e=>{e.removeEventListener("click",t)}))}}class qh extends Wh{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(qh.selectors,r.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new qh),this.INSTANCE}}class zh extends Wh{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(zh.selectors,r.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new zh),this.INSTANCE}}class Kh{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",(async()=>{const t=await Ye.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},n=new ps(r.EVENT_CHECKOUT_STARTED,e);$h.getInstance().sendEvent(n)}))}}ke.escape=o.escapeHtml;class Yh{static initialized;static runtimeData=Ts.get(qe);static safeHttpService=Ts.get($h);static widgetAPIService=Ts.get(yh);static pageScrollListener=Ts.get(Gh);static async init(t){if(this.initialized)return;const e=t.appID?.trim(),n=t.shopifyShop;!rr.isNull(e)&&24===e.length||!rr.isNull(n)?(this.initialized=!0,Ts.get(wh).init(t),this.loadPageWidgets(),this.attachGoKwikListeners(),zh.getInstance().listen(),qh.getInstance().listen(),this.storePreviewParams()):i.warn("Cooee App ID or Shop name is not configured")}static sendEvent(t,e,n){for(const t in e)if(t.length>3&&t.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");const r=new ps(t,e);r.occurred=n??new Date,this.safeHttpService.sendEvent(r)}static updateProfile(t){for(const e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");this.safeHttpService.updateProfile(t)}static setPageName(t){if(!t)return;const e=this.runtimeData.pageName;if(t===e)return;if(this.runtimeData.pageName=t,"cart"===t&&this.widgetAPIService.loadOrRenderCartWidgets(),r.BLACKLISTED_PAGE_NAMES.some((e=>t.includes(e))))return void this.pageScrollListener.resetScrollID();const n={};e&&(n.ps=e);const i=new ps(r.EVENT_SCREEN_VIEW,n);i.occurred=this.runtimeData.jsLoadTime,this.safeHttpService.sendEvent(i),this.pageScrollListener.resetScrollID(i.occurred)}static previewPopup(t,e){new Bh(e).render(t)}static previewWidget(t){new ah(new Mi(t)).render()}static logout(){this.safeHttpService.logout()}static loadPageWidgets(){this.widgetAPIService.loadPageWidgetsSilently()}static loadCartWidgets(){this.widgetAPIService.loadCartWidgetsSilently()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){i.error(t)}window.addEventListener("message",(t=>{if(i.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;const e=t.data;"object"==typeof e&&("POPUP_PREVIEW"===e.action?(Yh.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):"WIDGET_PREVIEW"===e.action&&(Yh.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))}))}}static attachGoKwikListeners(){window.addEventListener("kp-modal:opened",(()=>{this.runtimeData.isGoKwikPopupOpen=!0})),window.addEventListener("user-loggedin",(t=>{const{token:e}=t.detail;e&&this.updateProfile({goKwikToken:e})})),window.gokwikSdk?Kh.attachCheckoutListener():window.addEventListener("gokwikLoaded",Kh.attachCheckoutListener)}static storePreviewParams(){const t=new URLSearchParams(location.search),e=t.get("cooee-preview");e&&(this.runtimeData.previewIDs=e.trim().split(",").filter((t=>Number.isInteger(+t))));const n=t.get("cooee-variant");n&&(this.runtimeData.previewVariant=n)}}class Jh{existingSDKObject=window.CooeeSDK;runTimeData=qe.getInstance();meddleSilently(){this.meddle().catch((t=>gl.getInstance().captureException(t)))}async meddle(){this.existingSDKObject||(this.existingSDKObject=window.CooeeSDK={events:[],profile:[],account:[],screen:[],page:[]}),this.existingSDKObject.account=this.existingSDKObject.account??[],this.existingSDKObject.profile=this.existingSDKObject.profile??[],this.existingSDKObject.events=this.existingSDKObject.events??[],this.existingSDKObject.screen=this.existingSDKObject.screen??[],this.existingSDKObject.page=this.existingSDKObject.page??[],this.existingSDKObject.loadWidgets=Yh.loadPageWidgets.bind(Yh),this.existingSDKObject.loadCartWidgets=Yh.loadCartWidgets.bind(Yh),this.existingSDKObject.previewWidget=Yh.previewWidget.bind(Yh),this.existingSDKObject.previewPopup=Yh.previewPopup.bind(Yh),this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen();const t=this.getAppIDFromScript(),e=ze.getShopName();(t||e)&&await Yh.init({appID:t,shopifyShop:e})}getAppIDFromScript(){const t=document.currentScript?.src;if(t)return new URL(t).searchParams.get("appID")}overwritePush(t,e){Object.defineProperty(t,"push",{enumerable:!1,configurable:!1,writable:!1,value:e})}meddleAccount(){this.overwritePush(this.existingSDKObject.account,(async(...t)=>{await this.processAccount(t[0])})),this.existingSDKObject.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(this.existingSDKObject.events,((...t)=>{this.processEvent(t[0])})),this.existingSDKObject.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(this.existingSDKObject.profile,((...t)=>{this.processProfile(t[0])})),this.existingSDKObject.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(this.existingSDKObject.screen,((...t)=>{this.processPageName(t[0])})),this.existingSDKObject.screen.forEach(this.processPageName.bind(this))}async processAccount(t){t&&(t.appID&&await Yh.init(t),t.flags&&Ol.setFlags(t.flags))}processEvent(t){t&&(r.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?Yh.sendEvent(t[0],t[1],this.runTimeData.jsLoadTime):Yh.sendEvent(t[0],t[1]))}processProfile(t){t&&Yh.updateProfile(t)}processPageName(t){t&&Yh.setPageName(t)}meddlePage(){this.overwritePush(this.existingSDKObject.page,((...t)=>{this.processPage(t[0])})),this.existingSDKObject.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runTimeData.setCurrentItem(t.currentItem),t.currency&&(this.runTimeData.currencyCode=t.currency),t.shopCurrency&&(this.runTimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runTimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runTimeData.jsLoadTime=t.jsLoad),t.pageName&&Yh.setPageName(t.pageName)}}class Xh{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=Ts.get($h);runtimeData=Ts.get(qe);listen(){document.onvisibilitychange=()=>{"visible"===document.visibilityState?this.onVisible():"hidden"===document.visibilityState&&this.onHidden()}}async onVisible(){}async onHidden(){const t=await this.runtimeData.setInactive();if(0===t)return void i.info("Not sending background event as user was inactive on website");i.info(`Sending background event with ${t} seconds`);const e={};e[Xh.ACTIVE_DURATION]=t,this.apiService.sendEvent(new ps(r.EVENT_APP_BACKGROUND,e))}}class Qh{compareCartItemSubject=new Mn;constructor(){this.compareCartItemSubject.pipe(Jn(100)).subscribe(this.compareCartItems.bind(this))}listen(){return this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod(),this}overwriteXMLHttpRequest(){const t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",(function(){t.performEvent(this._url).catch((t=>i.error("Unable to process cart change in XMLHttpRequest",t)))})),e.apply(this,arguments)},i.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){const t=this,e=window.fetch;window.fetch=function(n){return e.apply(window,arguments).then((e=>(t.performEvent(n.toString()).catch((t=>i.error("Unable to process cart change in fetch",t))),e)))},i.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(qe.getInstance().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){const n=t?.items,o=e.items,s=[],a=[];if(i.debug(`Comparing cart change with old count ${n?.length} to new count ${o.length}`),o?.forEach((t=>{const e=n?.find((e=>e.vID===t.vID));if(e){if(e.quantity!==t.quantity){const n=e.quantity<t.quantity,r=Math.abs(e.quantity-t.quantity),i={...t,quantity:r};n?s.push(i):a.push(i)}n&&rr.removeFromArray(n,e)}else s.push(t)})),n)for(const t of n)a.push(t);i.debug(`Cart delta: added: ${s.length}, removed: ${a.length}`),s.length&&Yh.sendEvent(r.EVENT_ADD_TO_CART,{items:s}),a.length&&t.token===e.token&&Yh.sendEvent(r.EVENT_REMOVE_FROM_CART,{items:a}),(a.length||s.length)&&Xn.get().broadcast(r.CART_UPDATE_BROADCAST,{itemsAdded:s,itemsRemoved:a})}async compareCartItems(){const t=await We.get(je.CURRENT_CART,{}),e=await Ye.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}}class Zh{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){const t=this,e=window.fetch;window.fetch=async function(n,r){try{await t.modifyRequest(n,r)}catch(t){gl.getInstance().captureError("Failed to modify graphql request",t,{body:JSON.stringify(r?.body)})}return e(n,r)},i.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){const n="string"==typeof t?t:t instanceof Request?t.url:"";if(!n.includes("graphql.json")||"POST"!==e?.method)return;if(!e.body)return;i.log("Intercepted fetch request of:",n);const r="string"==typeof e.body?JSON.parse(e.body):e.body;r.query.includes("cartCreate")&&(e.body=await this.updatedBody(r),this.sendBuyNowEvent())}async updatedBody(t){const e=await We.get(je.DEVICE_ID),n=await Ts.get(wh).getCurrentSessionID(),r=t.variables.input.attributes??[],i=[{key:"letscooee_did",value:e},{key:"letscooee_sid",value:n},{key:"__letscooee_time",value:(new Date).toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}];return t.variables.input.attributes=[...r,...i],JSON.stringify(t)}sendBuyNowEvent(){const t=qe.getInstance().getCurrentItem();if(!t)return;const e=new ps(r.EVENT_BUY_NOW_CLICKED,{items:[t]});$h.getInstance().sendEvent(e)}}class tp{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){rr.onDocumentLoaded((()=>{i.debug("Execution order:","document ready"),this.useLocationHash()}))}useLocationHash(){const t=window.location.hash?.substring(1);if(t)if(t.includes(r.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(r.THIRD_PARTY_CHECKOUT_EVENT));const t=document.querySelector(this.selector);if(!t)return void i.debug("No clickable cart checkout button found");i.debug("Clickable cart checkout button found",t),t.click()}else t.includes(r.HASH_OPEN_CART_DRAWER)&&Qn.get().open()}}class ep{trackSilently(){this.track().catch((t=>gl.getInstance().captureException(t)))}async track(){const t=window.Shopify?.checkout,e=window.Shopify?.Checkout;if(!t&&!e)return;const n={};this.processSmallCheckout(t,n),this.processBigCheckout(e,n);const r=this.getTokenFromCurrentURLPath();if(r&&(n.urlToken=r),!Object.keys(n).length)return void i.warn("No processable data found in",t,e);n.referrer=document.referrer,n.url=location.href;const o=await Ts.get(wh).checkSessionAndGetContext();n.sessionID=o[0],this.trackOrder(n)}processSmallCheckout(t,e){t&&(t.order_id&&(e.orderID=t.order_id.toString()),t.token&&(e.checkoutToken=t.token.toString()),t.customer_id&&(e.customerID=t.customer_id.toString()))}processBigCheckout(t,e){t&&(t.token&&!e.checkoutToken&&(e.checkoutToken=t.token.toString()),t.cartToken&&(e.cartToken=t.cartToken.toString()))}trackOrder(t){i.info("Found order to be send",t),$h.getInstance().trackOrder(t)}getTokenFromCurrentURLPath(){const t=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find((e=>e.length&&t.test(e)))}}class np{async migrate(){}}i.configure(),i.logBrand(),i.debug("Execution order:","top"),window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>{i.debug("Execution order:","IIFE start"),window.cooeeSDKPreview||(await(new np).migrate(),(new Jh).meddleSilently(),(new Xh).listen(),El.watch(),Ts.get(Gh).listen(),Yh.setupPreviewListeners(),(new ep).trackSilently(),(new Bl).listen(),(new Qh).listen(),(new Zh).listen(),(new tp).listen()),i.debug("Execution order:","IIFE end")})()),i.debug("Execution order:","bottom");const rp=Yh})();var __webpack_export_target__=CooeeSDK="undefined"==typeof CooeeSDK?{}:CooeeSDK,__webpack_exports_export__=__webpack_exports__.default;for(var i in __webpack_exports_export__)__webpack_export_target__[i]=__webpack_exports_export__[i];__webpack_exports_export__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})})();
|
|
2
|
+
(()=>{var __webpack_modules__={780:(t,e)=>{"use strict";e.d=void 0;var n=function(){function t(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1))}catch(t){console.error("Un-parsable URL",t)}}return t.prototype.appendQueryParam=function(t,e){this.params.append(t,e?e.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(t){this.params.delete(t)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(t){if(!this.params)return"";var e=this.params.get(t);return e&&"undefined"!==e&&"null"!==e?e:void 0},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(t){return this.base.pathname=t,this},t.prototype.setQueryParam=function(t,e){return this.params.set(t,e?e.toString():""),this},t.prototype.setQueryString=function(t){if(t)return"?"===t[0]&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},t.prototype.toString=function(){var t=this.params.toString();return this.base.search=""===t?"":"?"+t,this.base.toString()},t}();e.d=n},110:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{A:()=>__webpack_exports__default});var __nested_webpack_require_1336__={d:(t,e)=>{for(var n in e)__nested_webpack_require_1336__.o(e,n)&&!__nested_webpack_require_1336__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},__nested_webpack_exports__={};__nested_webpack_require_1336__.d(__nested_webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__,k:()=>detectIncognito});var __awaiter=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},__generator=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};function detectIncognito(){return __awaiter(this,void 0,Promise,(function(){return __generator(this,(function(_a){switch(_a.label){case 0:return[4,new Promise((function(resolve,reject){var browserName="Unknown";function __callback(t){resolve({isPrivate:t,browserName})}function identifyChromium(){var t=navigator.userAgent;return t.match(/Chrome/)?void 0!==navigator.brave?"Brave":t.match(/Edg/)?"Edge":t.match(/OPR/)?"Opera":"Chrome":"Chromium"}function assertEvalToString(t){return t===eval.toString().length}function feid(){var toFixedEngineID=0;try{eval("(-1).toFixed(-1);")}catch(t){toFixedEngineID=t.message.length}return toFixedEngineID}function isSafari(){return 44===feid()}function isChrome(){return 51===feid()}function isFirefox(){return 25===feid()}function isMSIE(){return void 0!==navigator.msSaveBlob&&assertEvalToString(39)}function newSafariTest(){var t=String(Math.random());try{window.indexedDB.open(t,1).onupgradeneeded=function(e){var n,r,i=null===(n=e.target)||void 0===n?void 0:n.result;try{i.createObjectStore("test",{autoIncrement:!0}).put(new Blob),__callback(!1)}catch(t){var o=t;return t instanceof Error&&(o=null!==(r=t.message)&&void 0!==r?r:t),"string"!=typeof o?void __callback(!1):void __callback(o.includes("BlobURLs are not yet supported"))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch(t){__callback(!1)}}function oldSafariTest(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch(t){return void __callback(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch(t){return void __callback(!0)}__callback(!1)}function safariPrivateTest(){void 0!==navigator.maxTouchPoints?newSafariTest():oldSafariTest()}function getQuotaLimit(){var t=window;return void 0!==t.performance&&void 0!==t.performance.memory&&void 0!==t.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824}function storageQuotaChromePrivateTest(){navigator.webkitTemporaryStorage.queryUsageAndQuota((function(t,e){__callback(Math.round(e/1048576)<2*Math.round(getQuotaLimit()/1048576))}),(function(t){reject(new Error("detectIncognito somehow failed to query storage quota: "+t.message))}))}function oldChromePrivateTest(){(0,window.webkitRequestFileSystem)(0,1,(function(){__callback(!1)}),(function(){__callback(!0)}))}function chromePrivateTest(){void 0!==self.Promise&&void 0!==self.Promise.allSettled?storageQuotaChromePrivateTest():oldChromePrivateTest()}function firefoxPrivateTest(){__callback(void 0===navigator.serviceWorker)}function msiePrivateTest(){__callback(void 0===window.indexedDB)}function main(){isSafari()?(browserName="Safari",safariPrivateTest()):isChrome()?(browserName=identifyChromium(),chromePrivateTest()):isFirefox()?(browserName="Firefox",firefoxPrivateTest()):isMSIE()?(browserName="Internet Explorer",msiePrivateTest()):reject(new Error("detectIncognito cannot determine the browser"))}main()}))];case 1:return[2,_a.sent()]}}))}))}"undefined"!=typeof window&&(window.detectIncognito=detectIncognito);const __WEBPACK_DEFAULT_EXPORT__=detectIncognito;var __webpack_exports__default=__nested_webpack_exports__.A,__webpack_exports__detectIncognito=__nested_webpack_exports__.k},318:function(t){t.exports=function(){"use strict";function t(t){return Number.isInteger(t)&&t>=0}function e(t){this.name="ArgumentError",this.message=t}return function(n,r){if(r=r||{},"function"!=typeof n)throw new e("fetch must be a function");if("object"!=typeof r)throw new e("defaults must be an object");if(void 0!==r.retries&&!t(r.retries))throw new e("retries must be a positive integer");if(void 0!==r.retryDelay&&!t(r.retryDelay)&&"function"!=typeof r.retryDelay)throw new e("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==r.retryOn&&!Array.isArray(r.retryOn)&&"function"!=typeof r.retryOn)throw new e("retryOn property expects an array or function");return r=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},r),function(i,o){var s=r.retries,a=r.retryDelay,c=r.retryOn;if(o&&void 0!==o.retries){if(!t(o.retries))throw new e("retries must be a positive integer");s=o.retries}if(o&&void 0!==o.retryDelay){if(!t(o.retryDelay)&&"function"!=typeof o.retryDelay)throw new e("retryDelay must be a positive integer or a function returning a positive integer");a=o.retryDelay}if(o&&o.retryOn){if(!Array.isArray(o.retryOn)&&"function"!=typeof o.retryOn)throw new e("retryOn property expects an array or function");c=o.retryOn}return new Promise((function(t,e){var r=function(r){var a="undefined"!=typeof Request&&i instanceof Request?i.clone():i;n(a,o).then((function(n){if(Array.isArray(c)&&-1===c.indexOf(n.status))t(n);else if("function"==typeof c)try{return Promise.resolve(c(r,null,n)).then((function(e){e?u(r,null,n):t(n)})).catch(e)}catch(t){e(t)}else r<s?u(r,null,n):t(n)})).catch((function(t){if("function"==typeof c)try{Promise.resolve(c(r,t,null)).then((function(n){n?u(r,t,null):e(t)})).catch((function(t){e(t)}))}catch(t){e(t)}else r<s?u(r,t,null):e(t)}))};function u(t,e,n){var i="function"==typeof a?a(t,e,n):a;setTimeout((function(){r(++t)}),i)}r(0)}))}}}()},586:function(t,e,n){var r,i;!function(){"use strict";var o,s={VERSION:"1.6.1"},a={},c=function(t,e){return function(){return e.apply(t,arguments)}},u=function(){var t,e,n=arguments,r=n[0];for(e=1;e<n.length;e++)for(t in n[e])!(t in r)&&n[e].hasOwnProperty(t)&&(r[t]=n[e][t]);return r},l=function(t,e){return{value:t,name:e}};s.TRACE=l(1,"TRACE"),s.DEBUG=l(2,"DEBUG"),s.INFO=l(3,"INFO"),s.TIME=l(4,"TIME"),s.WARN=l(5,"WARN"),s.ERROR=l(8,"ERROR"),s.OFF=l(99,"OFF");var h=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};h.prototype={setLevel:function(t){t&&"value"in t&&(this.context.filterLevel=t)},getLevel:function(){return this.context.filterLevel},enabledFor:function(t){var e=this.context.filterLevel;return t.value>=e.value},trace:function(){this.invoke(s.TRACE,arguments)},debug:function(){this.invoke(s.DEBUG,arguments)},info:function(){this.invoke(s.INFO,arguments)},warn:function(){this.invoke(s.WARN,arguments)},error:function(){this.invoke(s.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(s.TIME,[t,"end"])},invoke:function(t,e){o&&this.enabledFor(t)&&o(e,u({level:t},this.context))}};var p,d=new h({filterLevel:s.OFF});(p=s).enabledFor=c(d,d.enabledFor),p.trace=c(d,d.trace),p.debug=c(d,d.debug),p.time=c(d,d.time),p.timeEnd=c(d,d.timeEnd),p.info=c(d,d.info),p.warn=c(d,d.warn),p.error=c(d,d.error),p.log=p.info,s.setHandler=function(t){o=t},s.setLevel=function(t){for(var e in d.setLevel(t),a)a.hasOwnProperty(e)&&a[e].setLevel(t)},s.getLevel=function(){return d.getLevel()},s.get=function(t){return a[t]||(a[t]=new h(u({name:t},d.context)))},s.createDefaultHandler=function(t){(t=t||{}).formatter=t.formatter||function(t,e){e.name&&t.unshift("["+e.name+"]")};var e={},n=function(t,e){Function.prototype.apply.call(t,console,e)};return"undefined"==typeof console?function(){}:function(r,i){r=Array.prototype.slice.call(r);var o,a=console.log;i.level===s.TIME?(o=(i.name?"["+i.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(o):e[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):n(a,[o+": "+((new Date).getTime()-e[o])+"ms"])):(i.level===s.WARN&&console.warn?a=console.warn:i.level===s.ERROR&&console.error?a=console.error:i.level===s.INFO&&console.info?a=console.info:i.level===s.DEBUG&&console.debug?a=console.debug:i.level===s.TRACE&&console.trace&&(a=console.trace),t.formatter(r,i),n(a,r))}},s.useDefaults=function(t){s.setLevel(t&&t.defaultLevel||s.DEBUG),s.setHandler(s.createDefaultHandler(t))},s.setDefaults=s.useDefaults,void 0===(i="function"==typeof(r=s)?r.call(e,n,e,t):r)||(t.exports=i)}()},790:(t,e,n)=>{t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return i(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var o=void 0,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e,r){(function(t){"use strict";var n,r,i=t.MutationObserver||t.WebKitMutationObserver;if(i){var o=0,s=new i(l),a=t.document.createTextNode("");s.observe(a,{characterData:!0}),n=function(){a.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){l(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(l,0)};else{var c=new t.MessageChannel;c.port1.onmessage=l,n=function(){c.port2.postMessage(0)}}var u=[];function l(){var t,e;r=!0;for(var n=u.length;n;){for(e=u,u=[],t=-1;++t<n;)e[t]();n=u.length}r=!1}e.exports=function(t){1!==u.push(t)||r||n()}}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){"use strict";var r=t(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function u(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,t!==i&&d(this,t)}function l(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(t,e,n){r((function(){var r;try{r=e(n)}catch(e){return o.reject(t,e)}r===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,r)}))}function p(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function d(t,e){var n=!1;function r(e){n||(n=!0,o.reject(t,e))}function i(e){n||(n=!0,o.resolve(t,e))}var s=f((function(){e(i,r)}));"error"===s.status&&r(s.value)}function f(t,e){var n={};try{n.value=t(e),n.status="success"}catch(t){n.status="error",n.value=t}return n}e.exports=u,u.prototype.catch=function(t){return this.then(null,t)},u.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===s)return this;var n=new this.constructor(i);return this.state!==c?h(n,this.state===a?t:e,this.outcome):this.queue.push(new l(n,t,e)),n},l.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},l.prototype.otherCallFulfilled=function(t){h(this.promise,this.onFulfilled,t)},l.prototype.callRejected=function(t){o.reject(this.promise,t)},l.prototype.otherCallRejected=function(t){h(this.promise,this.onRejected,t)},o.resolve=function(t,e){var n=f(p,e);if("error"===n.status)return o.reject(t,n.value);var r=n.value;if(r)d(t,r);else{t.state=a,t.outcome=e;for(var i=-1,s=t.queue.length;++i<s;)t.queue[i].callFulfilled(e)}return t},o.reject=function(t,e){t.state=s,t.outcome=e;for(var n=-1,r=t.queue.length;++n<r;)t.queue[n].callRejected(e);return t},u.resolve=function(t){return t instanceof this?t:o.resolve(new this(i),t)},u.reject=function(t){var e=new this(i);return o.reject(e,t)},u.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,c=-1,u=new this(i);++c<n;)l(t[c],c);return u;function l(t,i){e.resolve(t).then((function(t){s[i]=t,++a!==n||r||(r=!0,o.resolve(u,s))}),(function(t){r||(r=!0,o.reject(u,t))}))}},u.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n,r=t.length,s=!1;if(!r)return this.resolve([]);for(var a=-1,c=new this(i);++a<r;)n=t[a],e.resolve(n).then((function(t){s||(s=!0,o.resolve(c,t))}),(function(t){s||(s=!0,o.reject(c,t))}));return c}},{1:1}],3:[function(t,e,r){(function(e){"use strict";"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var i=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(t){return}}();function o(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<t.length;r+=1)n.append(t[r]);return n.getBlob(e.type)}}"undefined"==typeof Promise&&t(3);var s=Promise;function a(t,e){e&&t.then((function(t){e(null,t)}),(function(t){e(t)}))}function c(t,e,n){"function"==typeof e&&t.then(e),"function"==typeof n&&t.catch(n)}function u(t){return"string"!=typeof t&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function l(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var h="local-forage-detect-blob-support",p=void 0,d={},f=Object.prototype.toString,g="readonly",m="readwrite";function y(t){for(var e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n),i=0;i<e;i++)r[i]=t.charCodeAt(i);return n}function _(t){return"boolean"==typeof p?s.resolve(p):function(t){return new s((function(e){var n=t.transaction(h,m),r=o([""]);n.objectStore(h).put(r,"key"),n.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},n.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);e(n||!t||parseInt(t[1],10)>=43)}})).catch((function(){return!1}))}(t).then((function(t){return p=t}))}function v(t){var e=d[t.name],n={};n.promise=new s((function(t,e){n.resolve=t,n.reject=e})),e.deferredOperations.push(n),e.dbReady?e.dbReady=e.dbReady.then((function(){return n.promise})):e.dbReady=n.promise}function b(t){var e=d[t.name].deferredOperations.pop();if(e)return e.resolve(),e.promise}function w(t,e){var n=d[t.name].deferredOperations.pop();if(n)return n.reject(e),n.promise}function E(t,e){return new s((function(n,r){if(d[t.name]=d[t.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},t.db){if(!e)return n(t.db);v(t),t.db.close()}var o=[t.name];e&&o.push(t.version);var s=i.open.apply(i,o);e&&(s.onupgradeneeded=function(e){var n=s.result;try{n.createObjectStore(t.storeName),e.oldVersion<=1&&n.createObjectStore(h)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+t.name+'" has been upgraded from version '+e.oldVersion+" to version "+e.newVersion+', but the storage "'+t.storeName+'" already exists.')}}),s.onerror=function(t){t.preventDefault(),r(s.error)},s.onsuccess=function(){var e=s.result;e.onversionchange=function(t){t.target.close()},n(e),b(t)}}))}function S(t){return E(t,!1)}function I(t){return E(t,!0)}function T(t,e){if(!t.db)return!0;var n=!t.db.objectStoreNames.contains(t.storeName),r=t.version<t.db.version,i=t.version>t.db.version;if(r&&(t.version!==e&&console.warn('The database "'+t.name+"\" can't be downgraded from version "+t.db.version+" to version "+t.version+"."),t.version=t.db.version),i||n){if(n){var o=t.db.version+1;o>t.version&&(t.version=o)}return!0}return!1}function C(t){return o([y(atob(t.data))],{type:t.type})}function D(t){return t&&t.__local_forage_encoded_blob}function O(t){var e=this,n=e._initReady().then((function(){var t=d[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady}));return c(n,t,t),n}function x(t,e,n,r){void 0===r&&(r=1);try{var i=t.db.transaction(t.storeName,e);n(null,i)}catch(i){if(r>0&&(!t.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return s.resolve().then((function(){if(!t.db||"NotFoundError"===i.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),I(t)})).then((function(){return function(t){v(t);for(var e=d[t.name],n=e.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return t.db=null,S(t).then((function(e){return t.db=e,T(t)?I(t):e})).then((function(r){t.db=e.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(e){throw w(t,e),e}))}(t).then((function(){x(t,e,n,r-1)}))})).catch(n);n(i)}}var N={_driver:"asyncStorage",_initStorage:function(t){var e=this,n={db:null};if(t)for(var r in t)n[r]=t[r];var i=d[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},d[n.name]=i),i.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=O);var o=[];function a(){return s.resolve()}for(var c=0;c<i.forages.length;c++){var u=i.forages[c];u!==e&&o.push(u._initReady().catch(a))}var l=i.forages.slice(0);return s.all(o).then((function(){return n.db=i.db,S(n)})).then((function(t){return n.db=t,T(n,e._defaultConfig.version)?I(n):t})).then((function(t){n.db=i.db=t,e._dbInfo=n;for(var r=0;r<l.length;r++){var o=l[r];o!==e&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(t){return!1}}(),iterate:function(t,e){var n=this,r=new s((function(e,r){n.ready().then((function(){x(n._dbInfo,g,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var n=s.result;if(n){var r=n.value;D(r)&&(r=C(r));var i=t(r,n.key,a++);void 0!==i?e(i):n.continue()}else e()},s.onerror=function(){r(s.error)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},getItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){x(n._dbInfo,g,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).get(t);s.onsuccess=function(){var t=s.result;void 0===t&&(t=null),D(t)&&(t=C(t)),e(t)},s.onerror=function(){r(s.error)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},setItem:function(t,e,n){var r=this;t=u(t);var i=new s((function(n,i){var o;r.ready().then((function(){return o=r._dbInfo,"[object Blob]"===f.call(e)?_(o.db).then((function(t){return t?e:(n=e,new s((function(t,e){var r=new FileReader;r.onerror=e,r.onloadend=function(e){var r=btoa(e.target.result||"");t({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):e})).then((function(e){x(r._dbInfo,m,(function(o,s){if(o)return i(o);try{var a=s.objectStore(r._dbInfo.storeName);null===e&&(e=void 0);var c=a.put(e,t);s.oncomplete=function(){void 0===e&&(e=null),n(e)},s.onabort=s.onerror=function(){var t=c.error?c.error:c.transaction.error;i(t)}}catch(t){i(t)}}))})).catch(i)}));return a(i,n),i},removeItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){x(n._dbInfo,m,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).delete(t);o.oncomplete=function(){e()},o.onerror=function(){r(s.error)},o.onabort=function(){var t=s.error?s.error:s.transaction.error;r(t)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},clear:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){x(e._dbInfo,m,(function(r,i){if(r)return n(r);try{var o=i.objectStore(e._dbInfo.storeName).clear();i.oncomplete=function(){t()},i.onabort=i.onerror=function(){var t=o.error?o.error:o.transaction.error;n(t)}}catch(t){n(t)}}))})).catch(n)}));return a(n,t),n},length:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){x(e._dbInfo,g,(function(r,i){if(r)return n(r);try{var o=i.objectStore(e._dbInfo.storeName).count();o.onsuccess=function(){t(o.result)},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,t),n},key:function(t,e){var n=this,r=new s((function(e,r){t<0?e(null):n.ready().then((function(){x(n._dbInfo,g,(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName),a=!1,c=s.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===t||a?e(n.key):(a=!0,n.advance(t)):e(null)},c.onerror=function(){r(c.error)}}catch(t){r(t)}}))})).catch(r)}));return a(r,e),r},keys:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){x(e._dbInfo,g,(function(r,i){if(r)return n(r);try{var o=i.objectStore(e._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var e=o.result;e?(s.push(e.key),e.continue()):t(s)},o.onerror=function(){n(o.error)}}catch(t){n(t)}}))})).catch(n)}));return a(n,t),n},dropInstance:function(t,e){e=l.apply(this,arguments);var n,r=this.config();if((t="function"!=typeof t&&t||{}).name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName),t.name){var o=t.name===r.name&&this._dbInfo.db?s.resolve(this._dbInfo.db):S(t).then((function(e){var n=d[t.name],r=n.forages;n.db=e;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=e;return e}));n=t.storeName?o.then((function(e){if(e.objectStoreNames.contains(t.storeName)){var n=e.version+1;v(t);var r=d[t.name],o=r.forages;e.close();for(var a=0;a<o.length;a++){var c=o[a];c._dbInfo.db=null,c._dbInfo.version=n}var u=new s((function(e,r){var o=i.open(t.name,n);o.onerror=function(t){o.result.close(),r(t)},o.onupgradeneeded=function(){o.result.deleteObjectStore(t.storeName)},o.onsuccess=function(){var t=o.result;t.close(),e(t)}}));return u.then((function(t){r.db=t;for(var e=0;e<o.length;e++){var n=o[e];n._dbInfo.db=t,b(n._dbInfo)}})).catch((function(e){throw(w(t,e)||s.resolve()).catch((function(){})),e}))}})):o.then((function(e){v(t);var n=d[t.name],r=n.forages;e.close();for(var o=0;o<r.length;o++)r[o]._dbInfo.db=null;var a=new s((function(e,n){var r=i.deleteDatabase(t.name);r.onerror=function(){var t=r.result;t&&t.close(),n(r.error)},r.onblocked=function(){console.warn('dropInstance blocked for database "'+t.name+'" until all open connections are closed')},r.onsuccess=function(){var t=r.result;t&&t.close(),e(t)}}));return a.then((function(t){n.db=t;for(var e=0;e<r.length;e++)b(r[e]._dbInfo)})).catch((function(e){throw(w(t,e)||s.resolve()).catch((function(){})),e}))}))}else n=s.reject("Invalid arguments");return a(n,e),n}};var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P=/^~~local_forage_type~([^~]+)~/,L="__lfsc__:",R="arbf",k="blob",U="si08",M="ui08",B="uic8",j="si16",F="si32",$="ur16",H="ui32",V="fl32",G="fl64",W=Object.prototype.toString;function q(t){var e,n,r,i,o,s=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var u=new ArrayBuffer(s),l=new Uint8Array(u);for(e=0;e<a;e+=4)n=A.indexOf(t[e]),r=A.indexOf(t[e+1]),i=A.indexOf(t[e+2]),o=A.indexOf(t[e+3]),l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|i>>2,l[c++]=(3&i)<<6|63&o;return u}function z(t){var e,n=new Uint8Array(t),r="";for(e=0;e<n.length;e+=3)r+=A[n[e]>>2],r+=A[(3&n[e])<<4|n[e+1]>>4],r+=A[(15&n[e+1])<<2|n[e+2]>>6],r+=A[63&n[e+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var Y={serialize:function(t,e){var n="";if(t&&(n=W.call(t)),t&&("[object ArrayBuffer]"===n||t.buffer&&"[object ArrayBuffer]"===W.call(t.buffer))){var r,i=L;t instanceof ArrayBuffer?(r=t,i+=R):(r=t.buffer,"[object Int8Array]"===n?i+=U:"[object Uint8Array]"===n?i+=M:"[object Uint8ClampedArray]"===n?i+=B:"[object Int16Array]"===n?i+=j:"[object Uint16Array]"===n?i+=$:"[object Int32Array]"===n?i+=F:"[object Uint32Array]"===n?i+=H:"[object Float32Array]"===n?i+=V:"[object Float64Array]"===n?i+=G:e(new Error("Failed to get type for BinaryArray"))),e(i+z(r))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){var n="~~local_forage_type~"+t.type+"~"+z(this.result);e(L+k+n)},o.readAsArrayBuffer(t)}else try{e(JSON.stringify(t))}catch(n){console.error("Couldn't convert value into a JSON string: ",t),e(null,n)}},deserialize:function(t){if(t.substring(0,9)!==L)return JSON.parse(t);var e,n=t.substring(13),r=t.substring(9,13);if(r===k&&P.test(n)){var i=n.match(P);e=i[1],n=n.substring(i[0].length)}var s=q(n);switch(r){case R:return s;case k:return o([s],{type:e});case U:return new Int8Array(s);case M:return new Uint8Array(s);case B:return new Uint8ClampedArray(s);case j:return new Int16Array(s);case $:return new Uint16Array(s);case F:return new Int32Array(s);case H:return new Uint32Array(s);case V:return new Float32Array(s);case G:return new Float64Array(s);default:throw new Error("Unkown type: "+r)}},stringToBuffer:q,bufferToString:z};function K(t,e,n,r){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function J(t,e,n,r,i,o){t.executeSql(n,r,i,(function(t,s){s.code===s.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[e.storeName],(function(t,a){a.rows.length?o(t,s):K(t,e,(function(){t.executeSql(n,r,i,o)}),o)}),o):o(t,s)}),o)}function X(t,e,n,r){var i=this;t=u(t);var o=new s((function(o,s){i.ready().then((function(){void 0===e&&(e=null);var a=e,c=i._dbInfo;c.serializer.serialize(e,(function(e,u){u?s(u):c.db.transaction((function(n){J(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,e],(function(){o(a)}),(function(t,e){s(e)}))}),(function(e){if(e.code===e.QUOTA_ERR){if(r>0)return void o(X.apply(i,[t,a,n,r-1]));s(e)}}))}))})).catch(s)}));return a(o,n),o}var Q={_driver:"webSQLStorage",_initStorage:function(t){var e=this,n={db:null};if(t)for(var r in t)n[r]="string"!=typeof t[r]?t[r].toString():t[r];var i=new s((function(t,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(t){return r(t)}n.db.transaction((function(i){K(i,n,(function(){e._dbInfo=n,t()}),(function(t,e){r(e)}))}),r)}));return n.serializer=Y,i},_support:"function"==typeof openDatabase,iterate:function(t,e){var n=this,r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"SELECT * FROM "+i.storeName,[],(function(n,r){for(var o=r.rows,s=o.length,a=0;a<s;a++){var c=o.item(a),u=c.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=t(u,c.key,a+1)))return void e(u)}e()}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},getItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[t],(function(t,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),e(r)}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},setItem:function(t,e,n){return X.apply(this,[t,e,n,1])},removeItem:function(t,e){var n=this;t=u(t);var r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[t],(function(){e()}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},clear:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){var r=e._dbInfo;r.db.transaction((function(e){J(e,r,"DELETE FROM "+r.storeName,[],(function(){t()}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,t),n},length:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){var r=e._dbInfo;r.db.transaction((function(e){J(e,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(e,n){var r=n.rows.item(0).c;t(r)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,t),n},key:function(t,e){var n=this,r=new s((function(e,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){J(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[t+1],(function(t,n){var r=n.rows.length?n.rows.item(0).key:null;e(r)}),(function(t,e){r(e)}))}))})).catch(r)}));return a(r,e),r},keys:function(t){var e=this,n=new s((function(t,n){e.ready().then((function(){var r=e._dbInfo;r.db.transaction((function(e){J(e,r,"SELECT key FROM "+r.storeName,[],(function(e,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);t(r)}),(function(t,e){n(e)}))}))})).catch(n)}));return a(n,t),n},dropInstance:function(t,e){e=l.apply(this,arguments);var n=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||n.name,t.storeName=t.storeName||n.storeName);var r,i=this;return a(r=t.name?new s((function(e){var r;r=t.name===n.name?i._dbInfo.db:openDatabase(t.name,"","",0),t.storeName?e({db:r,storeNames:[t.storeName]}):e(function(t){return new s((function(e,n){t.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var i=[],o=0;o<r.rows.length;o++)i.push(r.rows.item(o).name);e({db:t,storeNames:i})}),(function(t,e){n(e)}))}),(function(t){n(t)}))}))}(r))})).then((function(t){return new s((function(e,n){t.db.transaction((function(r){function i(t){return new s((function(e,n){r.executeSql("DROP TABLE IF EXISTS "+t,[],(function(){e()}),(function(t,e){n(e)}))}))}for(var o=[],a=0,c=t.storeNames.length;a<c;a++)o.push(i(t.storeNames[a]));s.all(o).then((function(){e()})).catch((function(t){n(t)}))}),(function(t){n(t)}))}))})):s.reject("Invalid arguments"),e),r}};function Z(t,e){var n=t.name+"/";return t.storeName!==e.storeName&&(n+=t.storeName+"/"),n}function tt(){return!function(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch(t){return!0}}()||localStorage.length>0}var et={_driver:"localStorageWrapper",_initStorage:function(t){var e={};if(t)for(var n in t)e[n]=t[n];return e.keyPrefix=Z(t,this._defaultConfig),tt()?(this._dbInfo=e,e.serializer=Y,s.resolve()):s.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(t,e){var n=this,r=n.ready().then((function(){for(var e=n._dbInfo,r=e.keyPrefix,i=r.length,o=localStorage.length,s=1,a=0;a<o;a++){var c=localStorage.key(a);if(0===c.indexOf(r)){var u=localStorage.getItem(c);if(u&&(u=e.serializer.deserialize(u)),void 0!==(u=t(u,c.substring(i),s++)))return u}}}));return a(r,e),r},getItem:function(t,e){var n=this;t=u(t);var r=n.ready().then((function(){var e=n._dbInfo,r=localStorage.getItem(e.keyPrefix+t);return r&&(r=e.serializer.deserialize(r)),r}));return a(r,e),r},setItem:function(t,e,n){var r=this;t=u(t);var i=r.ready().then((function(){void 0===e&&(e=null);var n=e;return new s((function(i,o){var s=r._dbInfo;s.serializer.serialize(e,(function(e,r){if(r)o(r);else try{localStorage.setItem(s.keyPrefix+t,e),i(n)}catch(t){"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||o(t),o(t)}}))}))}));return a(i,n),i},removeItem:function(t,e){var n=this;t=u(t);var r=n.ready().then((function(){var e=n._dbInfo;localStorage.removeItem(e.keyPrefix+t)}));return a(r,e),r},clear:function(t){var e=this,n=e.ready().then((function(){for(var t=e._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(t)&&localStorage.removeItem(r)}}));return a(n,t),n},length:function(t){var e=this.keys().then((function(t){return t.length}));return a(e,t),e},key:function(t,e){var n=this,r=n.ready().then((function(){var e,r=n._dbInfo;try{e=localStorage.key(t)}catch(t){e=null}return e&&(e=e.substring(r.keyPrefix.length)),e}));return a(r,e),r},keys:function(t){var e=this,n=e.ready().then((function(){for(var t=e._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var o=localStorage.key(i);0===o.indexOf(t.keyPrefix)&&r.push(o.substring(t.keyPrefix.length))}return r}));return a(n,t),n},dropInstance:function(t,e){if(e=l.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var n=this.config();t.name=t.name||n.name,t.storeName=t.storeName||n.storeName}var r,i=this;return r=t.name?new s((function(e){t.storeName?e(Z(t,i._defaultConfig)):e(t.name+"/")})).then((function(t){for(var e=localStorage.length-1;e>=0;e--){var n=localStorage.key(e);0===n.indexOf(t)&&localStorage.removeItem(n)}})):s.reject("Invalid arguments"),a(r,e),r}},nt=function(t,e){for(var n=t.length,r=0;r<n;){if((i=t[r])===(o=e)||"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))return!0;r++}var i,o;return!1},rt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},it={},ot={},st={INDEXEDDB:N,WEBSQL:Q,LOCALSTORAGE:et},at=[st.INDEXEDDB._driver,st.WEBSQL._driver,st.LOCALSTORAGE._driver],ct=["dropInstance"],ut=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ct),lt={description:"",driver:at.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ht(t,e){t[e]=function(){var n=arguments;return t.ready().then((function(){return t[e].apply(t,n)}))}}function pt(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var n in e)e.hasOwnProperty(n)&&(rt(e[n])?arguments[0][n]=e[n].slice():arguments[0][n]=e[n])}return arguments[0]}var dt=function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),st)if(st.hasOwnProperty(n)){var r=st[n],i=r._driver;this[n]=i,it[i]||this.defineDriver(r)}this._defaultConfig=pt({},lt),this._config=pt({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return t.prototype.config=function(t){if("object"===(void 0===t?"undefined":r(t))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t)||!t.driver||this.setDriver(this._config.driver)}return"string"==typeof t?this._config[t]:this._config},t.prototype.defineDriver=function(t,e,n){var r=new s((function(e,n){try{var r=t._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver)return void n(i);for(var o=ut.concat("_initStorage"),c=0,u=o.length;c<u;c++){var l=o[c];if((!nt(ct,l)||t[l])&&"function"!=typeof t[l])return void n(i)}!function(){for(var e=function(t){return function(){var e=new Error("Method "+t+" is not implemented by the current driver"),n=s.reject(e);return a(n,arguments[arguments.length-1]),n}},n=0,r=ct.length;n<r;n++){var i=ct[n];t[i]||(t[i]=e(i))}}();var h=function(n){it[r]&&console.info("Redefining LocalForage driver: "+r),it[r]=t,ot[r]=n,e()};"_support"in t?t._support&&"function"==typeof t._support?t._support().then(h,n):h(!!t._support):h(!0)}catch(t){n(t)}}));return c(r,e,n),r},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(t,e,n){var r=it[t]?s.resolve(it[t]):s.reject(new Error("Driver not found."));return c(r,e,n),r},t.prototype.getSerializer=function(t){var e=s.resolve(Y);return c(e,t),e},t.prototype.ready=function(t){var e=this,n=e._driverSet.then((function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready}));return c(n,t,t),n},t.prototype.setDriver=function(t,e,n){var r=this;rt(t)||(t=[t]);var i=this._getSupportedDrivers(t);function o(){r._config.driver=r.driver()}function a(t){return r._extend(t),o(),r._ready=r._initStorage(r._config),r._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return s.resolve()})):s.resolve();return this._driverSet=u.then((function(){var t=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(t).then((function(t){r._driver=t._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(t){return function(){var e=0;return function n(){for(;e<t.length;){var i=t[e];return e++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(a).catch(n)}o();var c=new Error("No available storage method found.");return r._driverSet=s.reject(c),r._driverSet}()}}(i)}))})).catch((function(){o();var t=new Error("No available storage method found.");return r._driverSet=s.reject(t),r._driverSet})),c(this._driverSet,e,n),this._driverSet},t.prototype.supports=function(t){return!!ot[t]},t.prototype._extend=function(t){pt(this,t)},t.prototype._getSupportedDrivers=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];this.supports(i)&&e.push(i)}return e},t.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=ut.length;t<e;t++)ht(this,ut[t])},t.prototype.createInstance=function(e){return new t(e)},t}(),ft=new dt;e.exports=ft},{3:3}]},{},[4])(4)},232:function(t,e,n){var r;!function(i,o){"use strict";var s="function",a="undefined",c="object",u="string",l="major",h="model",p="name",d="type",f="vendor",g="version",m="architecture",y="console",_="mobile",v="tablet",b="smarttv",w="wearable",E="embedded",S="Amazon",I="Apple",T="ASUS",C="BlackBerry",D="Browser",O="Chrome",x="Firefox",N="Google",A="Huawei",P="LG",L="Microsoft",R="Motorola",k="Opera",U="Samsung",M="Sharp",B="Sony",j="Xiaomi",F="Zebra",$="Facebook",H="Chromium OS",V="Mac OS",G=" Browser",W=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},q=function(t,e){return typeof t===u&&-1!==z(e).indexOf(z(t))},z=function(t){return t.toLowerCase()},Y=function(t,e){if(typeof t===u)return t=t.replace(/^\s\s*/,""),typeof e===a?t:t.substring(0,500)},K=function(t,e){for(var n,r,i,a,u,l,h=0;h<e.length&&!u;){var p=e[h],d=e[h+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(t))for(i=0;i<d.length;i++)l=u[++r],typeof(a=d[i])===c&&a.length>0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):o:this[a[0]]=l?a[1].call(this,l,a[2]):o:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):o):this[a]=l||o;h+=2}},J=function(t,e){for(var n in e)if(typeof e[n]===c&&e[n].length>0){for(var r=0;r<e[n].length;r++)if(q(e[n][r],t))return"?"===n?o:n}else if(q(e[n],t))return"?"===n?o:n;return e.hasOwnProperty("*")?e["*"]:t},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Q={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,g],[/opios[\/ ]+([\w\.]+)/i],[g,[p,k+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[p,k+" GX"]],[/\bopr\/([\w\.]+)/i],[g,[p,k]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[p,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[p,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[p,"Quark"]],[/\bddg\/([\w\.]+)/i],[g,[p,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[p,"UC"+D]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[g,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[p,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[p,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[g,[p,"Smart Lenovo "+D]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+D],g],[/\bfocus\/([\w\.]+)/i],[g,[p,x+" Focus"]],[/\bopt\/([\w\.]+)/i],[g,[p,k+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[g,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[g,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[g,[p,k+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[g,[p,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[g,[p,x]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[p,"360"]],[/\b(qq)\/([\w\.]+)/i],[[p,/(.+)/,"$1Browser"],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1"+G],g],[/samsungbrowser\/([\w\.]+)/i],[g,[p,U+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[g,[p,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[p,"Sogou Mobile"],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[p,g],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[p],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,$],g],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[p,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[p,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[p,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[p,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,O+" WebView"],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[p,"Android "+D]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[g,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[p,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[p,x+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[p,[g,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[p,[g,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,z]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",z]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[f,U],[d,v]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[h,[f,U],[d,_]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[f,I],[d,_]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[f,I],[d,v]],[/(macintosh);/i],[h,[f,I]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[f,M],[d,_]],[/(?:honor)([-\w ]+)[;\)]/i],[h,[f,"Honor"],[d,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[f,A],[d,v]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[f,A],[d,_]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[h,/_/g," "],[f,j],[d,_]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[f,j],[d,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[f,"OPPO"],[d,_]],[/\b(opd2\d{3}a?) bui/i],[h,[f,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[f,"Vivo"],[d,_]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[h,[f,"Realme"],[d,_]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[f,R],[d,_]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[f,R],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[f,P],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[f,P],[d,_]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[f,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[f,"Nokia"],[d,_]],[/(pixel c)\b/i],[h,[f,N],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[f,N],[d,_]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[f,B],[d,_]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[f,B],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[f,"OnePlus"],[d,_]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[f,S],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[f,S],[d,_]],[/(playbook);[-\w\),; ]+(rim)/i],[h,f,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[f,C],[d,_]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[f,T],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[f,T],[d,_]],[/(nexus 9)/i],[h,[f,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[h,/_/g," "],[d,_]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[h,[f,"TCL"],[d,v]],[/(itel) ((\w+))/i],[[f,z],h,[d,J,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[f,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[f,"Meizu"],[d,_]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[h,[f,"Ulefone"],[d,_]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[h,[f,"Energizer"],[d,_]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[h,[f,"Cat"],[d,_]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[h,[f,"Smartfren"],[d,_]],[/droid.+; (a(?:015|06[35]|142p?))/i],[h,[f,"Nothing"],[d,_]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,h,[d,_]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,h,[d,v]],[/(surface duo)/i],[h,[f,L],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[f,"Fairphone"],[d,_]],[/(u304aa)/i],[h,[f,"AT&T"],[d,_]],[/\bsie-(\w*)/i],[h,[f,"Siemens"],[d,_]],[/\b(rct\w+) b/i],[h,[f,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[h,[f,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[h,[f,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[f,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[h,[f,"NuVision"],[d,v]],[/\b(k88) b/i],[h,[f,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[h,[f,"ZTE"],[d,_]],[/\b(gen\d{3}) b.+49h/i],[h,[f,"Swiss"],[d,_]],[/\b(zur\d{3}) b/i],[h,[f,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[h,[f,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],h,[d,v]],[/\b(ns-?\w{0,9}) b/i],[h,[f,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[f,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],h,[d,_]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],h,[d,_]],[/\b(ph-1) /i],[h,[f,"Essential"],[d,_]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[f,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[h,[f,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[h,[f,"Rotor"],[d,v]],[/(shield[\w ]+) b/i],[h,[f,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[f,h,[d,_]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[f,L],[d,_]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[f,F],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[f,F],[d,_]],[/smart-tv.+(samsung)/i],[f,[d,b]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[f,U],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,P],[d,b]],[/(apple) ?tv/i],[f,[h,I+" TV"],[d,b]],[/crkey/i],[[h,O+"cast"],[f,N],[d,b]],[/droid.+aft(\w+)( bui|\))/i],[h,[f,S],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[f,M],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[h,[f,B],[d,b]],[/(mitv-\w{5}) bui/i],[h,[f,j],[d,b]],[/Hbbtv.*(technisat) (.*);/i],[f,h,[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[f,Y],[h,Y],[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,h,[d,y]],[/droid.+; (shield) bui/i],[h,[f,"Nvidia"],[d,y]],[/(playstation [345portablevi]+)/i],[h,[f,B],[d,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[f,L],[d,y]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[h,[f,U],[d,w]],[/((pebble))app/i],[f,h,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[f,I],[d,w]],[/droid.+; (glass) \d/i],[h,[f,N],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[h,[f,F],[d,w]],[/droid.+; (glass) \d/i],[h,[f,N],[d,w]],[/(pico) (4|neo3(?: link|pro)?)/i],[f,h,[d,w]],[/; (quest( \d| pro)?)/i],[h,[f,$],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[d,E]],[/(aeobc)\b/i],[h,[f,S],[d,E]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[h,[d,_]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,_]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[p,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[p,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,g],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,g],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[p,[g,J,X]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,J,X],[p,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,V],[g,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,g],[/\(bb(10);/i],[g,[p,C]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[g,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[p,x+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[g,[p,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,H],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,g],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,g]]},Z=function(t,e){if(typeof t===c&&(e=t,t=o),!(this instanceof Z))return new Z(t,e).getResult();var n=typeof i!==a&&i.navigator?i.navigator:o,r=t||(n&&n.userAgent?n.userAgent:""),y=n&&n.userAgentData?n.userAgentData:o,b=e?function(t,e){var n={};for(var r in t)e[r]&&e[r].length%2==0?n[r]=e[r].concat(t[r]):n[r]=t[r];return n}(Q,e):Q,w=n&&n.userAgent==r;return this.getBrowser=function(){var t,e={};return e[p]=o,e[g]=o,K.call(e,r,b.browser),e[l]=typeof(t=e[g])===u?t.replace(/[^\d\.]/g,"").split(".")[0]:o,w&&n&&n.brave&&typeof n.brave.isBrave==s&&(e[p]="Brave"),e},this.getCPU=function(){var t={};return t[m]=o,K.call(t,r,b.cpu),t},this.getDevice=function(){var t={};return t[f]=o,t[h]=o,t[d]=o,K.call(t,r,b.device),w&&!t[d]&&y&&y.mobile&&(t[d]=_),w&&"Macintosh"==t[h]&&n&&typeof n.standalone!==a&&n.maxTouchPoints&&n.maxTouchPoints>2&&(t[h]="iPad",t[d]=v),t},this.getEngine=function(){var t={};return t[p]=o,t[g]=o,K.call(t,r,b.engine),t},this.getOS=function(){var t={};return t[p]=o,t[g]=o,K.call(t,r,b.os),w&&!t[p]&&y&&y.platform&&"Unknown"!=y.platform&&(t[p]=y.platform.replace(/chrome os/i,H).replace(/macos/i,V)),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(t){return r=typeof t===u&&t.length>500?Y(t,500):t,this},this.setUA(r),this};Z.VERSION="1.0.40",Z.BROWSER=W([p,g,l]),Z.CPU=W([m]),Z.DEVICE=W([h,f,d,y,_,b,v,w,E]),Z.ENGINE=Z.OS=W([p,g]),typeof e!==a?(t.exports&&(e=t.exports=Z),e.UAParser=Z):n.amdO?(r=function(){return Z}.call(e,n,e,t))===o||(t.exports=r):typeof i!==a&&(i.UAParser=Z);var tt=typeof i!==a&&(i.jQuery||i.Zepto);if(tt&&!tt.ua){var et=new Z;tt.ua=et.getResult(),tt.ua.get=function(){return et.getUA()},tt.ua.set=function(t){et.setUA(t);var e=et.getResult();for(var n in e)tt.ua[n]=e[n]}}}("object"==typeof window?window:this)}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.amdO={},__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{"use strict";const t=!1;var e=__webpack_require__(586),n=__webpack_require__.n(e);class r{static SDK_VERSION="9.1.1";static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=1800;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static CTA_EVENT="letscooee:outbound:cta";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static{const t=r.SDK_VERSION.split(".").map((t=>t.padStart(2,"0"))).join("");r.SDK_VERSION_CODE=parseInt(t,10)}}class i{static log(...t){n().info(...t)}static debug(...t){n().debug(...t)}static error(...t){n().error(...t)}static warn(...t){n().warn(...t)}static info(...t){n().info(...t)}static trace(...t){n().trace(...t)}static configure(t=r.LOG_PREFIX){n().useDefaults({formatter:function(e){e.unshift(`${t} (v${r.SDK_VERSION}):`)}});const e=this.getDebugParam();"1"!==e&&"on"!==e||(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?n().setLevel(n()[localStorage.cooeeLogLevel]):n().setLevel(n().OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let t="\n";t+="📣 Drive higher conversions with AI-powered onsite engagement\n",t+="🔍 Track real-time visitor intent & optimize engagement\n",t+="📊 Improve Meta Ads ROAS with intent-driven campaigns\n",t+="🛍️ Boost purchases & repeat sales effortlessly\n",t+="\n\n",t+=`Learn more: https://www.letscooee.com\nCooee SDK: v${r.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee 🚀 ","\n display: inline-block;\n font-size: 14px;\n background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);\n color: white;\n padding: 4px;\n border-radius: 4px;\n "),console.log(`%c${t}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}}class o{static entityMap={'"':"""};static escapeHtml(t){return String(t).replace(/"/g,(t=>o.entityMap[t]))}}class s{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this}}var a,c,u,l,h,p,d,f,g,m,y,_,v,b,w,E,S,I,T,C,D,O,x,N,A,P,L,R,k,U,M,B;!function(t){t[t.ONCE_PER_USER=1]="ONCE_PER_USER",t[t.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",t[t.EVERY_TIME=3]="EVERY_TIME"}(a||(a={})),function(t){t[t.ONE_TIME=1]="ONE_TIME",t[t.MULTIPLE=2]="MULTIPLE",t[t.RECURRING=3]="RECURRING"}(c||(c={})),function(t){t[t.NOW=1]="NOW",t[t.LATER=2]="LATER",t[t.NEVER=3]="NEVER"}(u||(u={})),function(t){t[t.PUBLISHED=1]="PUBLISHED",t[t.DRAFT=2]="DRAFT",t[t.PAUSED=3]="PAUSED",t[t.FAILED=4]="FAILED",t[t.STOPPED=5]="STOPPED",t[t.COMPLETED=6]="COMPLETED",t[t.ARCHIVED=7]="ARCHIVED",t[t.UNINSTALLED=8]="UNINSTALLED"}(l||(l={})),function(t){t[t.POPUP=1]="POPUP",t[t.LEAD_GENERATION=2]="LEAD_GENERATION",t[t.PRODUCT_WIDGET=3]="PRODUCT_WIDGET",t[t.PRODUCT_BUNDLE=4]="PRODUCT_BUNDLE",t[t.ANNOUNCEMENT_BAR=5]="ANNOUNCEMENT_BAR",t[t.CART_REMINDER=6]="CART_REMINDER",t[t.CRO_COPILOT=10]="CRO_COPILOT",t[t.OTHER=11]="OTHER"}(h||(h={})),function(t){t[t.NONE=0]="NONE",t[t.RULE_BASED=1]="RULE_BASED",t[t.INTENT_BASED=2]="INTENT_BASED"}(p||(p={})),function(t){t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING"}(d||(d={})),function(t){t[t.ALL=0]="ALL",t[t.NEW_ONLY=1]="NEW_ONLY",t[t.RETURNING_ONLY=2]="RETURNING_ONLY"}(f||(f={})),function(t){t[t.ALL=0]="ALL",t[t.LOGGED_IN_ONLY=3]="LOGGED_IN_ONLY",t[t.NON_LOGGED_IN_ONLY=4]="NON_LOGGED_IN_ONLY",t[t.PURCHASED=5]="PURCHASED",t[t.NON_PURCHASED=6]="NON_PURCHASED",t[t.ABANDON_CART=7]="ABANDON_CART",t[t.RETURNING_AND_NON_PURCHASED=8]="RETURNING_AND_NON_PURCHASED"}(g||(g={})),function(t){t.ALL="ALL",t.LOGGED_IN="LOGGED_IN",t.NON_LOGGED_IN="NON_LOGGED_IN"}(m||(m={})),function(t){t.ALL="ALL",t.PURCHASED="PURCHASED",t.NON_PURCHASED="NON_PURCHASED"}(y||(y={})),function(t){t[t.NONE=0]="NONE",t[t.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",t[t.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",t[t.SINGLE_ITEM=3]="SINGLE_ITEM",t[t.TOP_SELLING=4]="TOP_SELLING",t[t.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",t[t.NEW_ARRIVALS=6]="NEW_ARRIVALS",t[t.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",t[t.EVENT_ITEM=8]="EVENT_ITEM",t[t.CART_ITEM=9]="CART_ITEM",t[t.BUNDLE=10]="BUNDLE",t[t.CURRENT_ITEM=11]="CURRENT_ITEM",t[t.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",t[t.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",t[t.TRENDING_ITEMS=14]="TRENDING_ITEMS"}(_||(_={})),function(t){t[t.LAST_ADDED=1]="LAST_ADDED",t[t.FIRST_ADDED=2]="FIRST_ADDED",t[t.HIGHEST_PRICE=3]="HIGHEST_PRICE",t[t.LOWEST_PRICE=4]="LOWEST_PRICE",t[t.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",t[t.ALL=6]="ALL"}(v||(v={})),function(t){t[t.ALL=0]="ALL",t[t.ONLY_ORGANIC=1]="ONLY_ORGANIC",t[t.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",t[t.INCLUDES=3]="INCLUDES",t[t.EXCLUDES=4]="EXCLUDES"}(b||(b={})),function(t){t[t.NONE=0]="NONE",t[t.LIKE=1]="LIKE",t[t.NOT_LIKE=2]="NOT_LIKE",t[t.EQUALS=3]="EQUALS",t[t.NOT_EQUALS=4]="NOT_EQUALS"}(w||(w={})),function(t){t[t.NONE=0]="NONE",t[t.LESS_THAN=1]="LESS_THAN",t[t.GREATER_THAN=2]="GREATER_THAN",t[t.BETWEEN=3]="BETWEEN",t[t.EQUALS=4]="EQUALS"}(E||(E={})),function(t){t[t.ALL=0]="ALL",t[t.INCLUDES=1]="INCLUDES",t[t.EXCLUDES=2]="EXCLUDES"}(S||(S={})),function(t){t[t.NONE=0]="NONE",t[t.AMOUNT=1]="AMOUNT",t[t.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",t[t.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT"}(I||(I={})),function(t){t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION"}(T||(T={})),function(t){t[t.NONE=0]="NONE",t[t.SINGLE=1]="SINGLE",t[t.MULTIPLE=2]="MULTIPLE"}(C||(C={})),function(t){t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast"}(D||(D={})),function(t){t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer"}(O||(O={})),function(t){t.ONCE_IN_SESSION="ONCE_IN_SESSION",t.ACROSS_SESSIONS="ACROSS_SESSIONS"}(x||(x={})),function(t){t.DAYS="DAYS",t.HOURS="HOURS",t.MINUTES="MINUTES",t.SECONDS="SECONDS"}(N||(N={})),function(t){t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION"}(A||(A={})),function(t){t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR"}(P||(P={})),function(t){t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR"}(L||(L={})),function(t){t.COOEE="COOEE",t.KLAVIYO="KLAVIYO"}(R||(R={})),function(t){t.ICONS="ICONS",t.TILES="TILES"}(k||(k={})),function(t){t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT"}(U||(U={})),function(t){t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE"}(M||(M={})),function(t){t.FIXED_AMOUNT="fixed_amount",t.PERCENTAGE="percentage"}(B||(B={}));class j{static of(t,e){return void 0!==e?new Array(t).fill(e):Array.from({length:t},((t,e)=>e))}static remove(t,e){const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)}static swap(t,e,n){[t[e],t[n]]=[t[n],t[e]]}static sum(t,e){return t.reduce(((t,n)=>t+Math.max(e?e(n):+n,0)),0)}static unique(t,e){return t.filter(((t,n,r)=>r.findIndex((n=>n[e]===t[e]))===n))}static shuffle(t){let e=t.length;for(;0!=e;){const n=Math.floor(Math.random()*e);e--,j.swap(t,e,n)}}}var F,$,H,V,G,W,q,z,Y,K,J,X,Q={},Z=[],tt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,et=Array.isArray;function nt(t,e){for(var n in e)t[n]=e[n];return t}function rt(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function it(t,e,n){var r,i,o,s={};for(o in e)"key"==o?r=e[o]:"ref"==o?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?F.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===s[o]&&(s[o]=t.defaultProps[o]);return ot(t,s,r,i,null)}function ot(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++H:i,__i:-1,__u:0};return null==i&&null!=$.vnode&&$.vnode(o),o}function st(t){return t.children}function at(t,e){this.props=t,this.context=e}function ct(t,e){if(null==e)return t.__?ct(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?ct(t):null}function ut(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return ut(t)}}function lt(t){(!t.__d&&(t.__d=!0)&&G.push(t)&&!ht.__r++||W!==$.debounceRendering)&&((W=$.debounceRendering)||q)(ht)}function ht(){var t,e,n,r,i,o,s,a;for(G.sort(z);t=G.shift();)t.__d&&(e=G.length,r=void 0,o=(i=(n=t).__v).__e,s=[],a=[],n.__P&&((r=nt({},i)).__v=i.__v+1,$.vnode&&$.vnode(r),vt(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[o]:null,s,null==o?ct(i):o,!!(32&i.__u),a),r.__v=i.__v,r.__.__k[r.__i]=r,bt(s,r,a),r.__e!=o&&ut(r)),G.length>e&&G.sort(z));ht.__r=0}function pt(t,e,n,r,i,o,s,a,c,u,l){var h,p,d,f,g,m,y=r&&r.__k||Z,_=e.length;for(c=dt(n,e,y,c,_),h=0;h<_;h++)null!=(d=n.__k[h])&&(p=-1===d.__i?Q:y[d.__i]||Q,d.__i=h,m=vt(t,d,p,i,o,s,a,c,u,l),f=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Et(p.ref,null,d),l.push(d.ref,d.__c||f,d)),null==g&&null!=f&&(g=f),4&d.__u||p.__k===d.__k?c=ft(d,c,t):"function"==typeof d.type&&void 0!==m?c=m:f&&(c=f.nextSibling),d.__u&=-7);return n.__e=g,c}function dt(t,e,n,r,i){var o,s,a,c,u,l=n.length,h=l,p=0;for(t.__k=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(c=o+p,(s=t.__k[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?ot(null,s,null,null,null):et(s)?ot(st,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?ot(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,-1!==(u=s.__i=gt(s,n,c,h))&&(h--,(a=n[u])&&(a.__u|=2)),null==a||null===a.__v?(-1==u&&p--,"function"!=typeof s.type&&(s.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,s.__u|=4))):t.__k[o]=null;if(h)for(o=0;o<l;o++)null!=(a=n[o])&&!(2&a.__u)&&(a.__e==r&&(r=ct(a)),St(a,a));return r}function ft(t,e,n){var r,i;if("function"==typeof t.type){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=ft(r[i],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=ct(t)),n.insertBefore(t.__e,e||null),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function gt(t,e,n,r){var i,o,s=t.key,a=t.type,c=e[n];if(null===c||c&&s==c.key&&a===c.type&&!(2&c.__u))return n;if(r>(null==c||2&c.__u?0:1))for(i=n-1,o=n+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&!(2&c.__u)&&s==c.key&&a===c.type)return i;i--}if(o<e.length){if((c=e[o])&&!(2&c.__u)&&s==c.key&&a===c.type)return o;o++}}return-1}function mt(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||tt.test(e)?n:n+"px"}function yt(t,e,n,r,i){var o;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||mt(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||mt(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(Y,"$1")),e=e.toLowerCase()in t||"onFocusOut"==e||"onFocusIn"==e?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=K,t.addEventListener(e,o?X:J,o)):t.removeEventListener(e,o?X:J,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function _t(t){return function(e){if(this.l){var n=this.l[e.type+t];if(null==e.t)e.t=K++;else if(e.t<n.u)return;return n($.event?$.event(e):e)}}}function vt(t,e,n,r,i,o,s,a,c,u){var l,h,p,d,f,g,m,y,_,v,b,w,E,S,I,T,C,D=e.type;if(void 0!==e.constructor)return null;128&n.__u&&(c=!!(32&n.__u),o=[a=e.__e=n.__e]),(l=$.__b)&&l(e);t:if("function"==typeof D)try{if(y=e.props,_="prototype"in D&&D.prototype.render,v=(l=D.contextType)&&r[l.__c],b=l?v?v.props.value:l.__:r,n.__c?m=(h=e.__c=n.__c).__=h.__E:(_?e.__c=h=new D(y,b):(e.__c=h=new at(y,b),h.constructor=D,h.render=It),v&&v.sub(h),h.props=y,h.state||(h.state={}),h.context=b,h.__n=r,p=h.__d=!0,h.__h=[],h._sb=[]),_&&null==h.__s&&(h.__s=h.state),_&&null!=D.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=nt({},h.__s)),nt(h.__s,D.getDerivedStateFromProps(y,h.__s))),d=h.props,f=h.state,h.__v=e,p)_&&null==D.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),_&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(_&&null==D.getDerivedStateFromProps&&y!==d&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(y,b),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,b)||e.__v==n.__v)){for(e.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some((function(t){t&&(t.__=e)})),w=0;w<h._sb.length;w++)h.__h.push(h._sb[w]);h._sb=[],h.__h.length&&s.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,b),_&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(d,f,g)}))}if(h.context=b,h.props=y,h.__P=t,h.__e=!1,E=$.__r,S=0,_){for(h.state=h.__s,h.__d=!1,E&&E(e),l=h.render(h.props,h.state,h.context),I=0;I<h._sb.length;I++)h.__h.push(h._sb[I]);h._sb=[]}else do{h.__d=!1,E&&E(e),l=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++S<25);h.state=h.__s,null!=h.getChildContext&&(r=nt(nt({},r),h.getChildContext())),_&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(d,f)),a=pt(t,et(T=null!=l&&l.type===st&&null==l.key?l.props.children:l)?T:[T],e,n,r,i,o,s,a,c,u),h.base=e.__e,e.__u&=-161,h.__h.length&&s.push(h),m&&(h.__E=h.__=null)}catch(t){if(e.__v=null,c||null!=o)if(t.then){for(e.__u|=c?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(C=o.length;C--;)rt(o[C]);else e.__e=n.__e,e.__k=n.__k;$.__e(t,e,n)}else null==o&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=wt(n.__e,e,n,r,i,o,s,c,u);return(l=$.diffed)&&l(e),128&e.__u?void 0:a}function bt(t,e,n){for(var r=0;r<n.length;r++)Et(n[r],n[++r],n[++r]);$.__c&&$.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){$.__e(t,e.__v)}}))}function wt(t,e,n,r,i,o,s,a,c){var u,l,h,p,d,f,g,m=n.props,y=e.props,_=e.type;if("svg"==_?i="http://www.w3.org/2000/svg":"math"==_?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=o)for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!_&&(_?d.localName==_:3==d.nodeType)){t=d,o[u]=null;break}if(null==t){if(null==_)return document.createTextNode(y);t=document.createElementNS(i,_,y.is&&y),a&&($.__m&&$.__m(e,o),a=!1),o=null}if(null===_)m===y||a&&t.data===y||(t.data=y);else{if(o=o&&F.call(t.childNodes),m=n.props||Q,!a&&null!=o)for(m={},u=0;u<t.attributes.length;u++)m[(d=t.attributes[u]).name]=d.value;for(u in m)if(d=m[u],"children"==u);else if("dangerouslySetInnerHTML"==u)h=d;else if(!(u in y)){if("value"==u&&"defaultValue"in y||"checked"==u&&"defaultChecked"in y)continue;yt(t,u,null,d,i)}for(u in y)d=y[u],"children"==u?p=d:"dangerouslySetInnerHTML"==u?l=d:"value"==u?f=d:"checked"==u?g=d:a&&"function"!=typeof d||m[u]===d||yt(t,u,d,m[u],i);if(l)a||h&&(l.__html===h.__html||l.__html===t.innerHTML)||(t.innerHTML=l.__html),e.__k=[];else if(h&&(t.innerHTML=""),pt(t,et(p)?p:[p],e,n,r,"foreignObject"==_?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&&ct(n,0),a,c),null!=o)for(u=o.length;u--;)rt(o[u]);a||(u="value","progress"==_&&null==f?t.removeAttribute("value"):void 0!==f&&(f!==t[u]||"progress"==_&&!f||"option"==_&&f!==m[u])&&yt(t,u,f,m[u],i),u="checked",void 0!==g&&g!==t[u]&&yt(t,u,g,m[u],i))}return t}function Et(t,e,n){try{if("function"==typeof t){var r="function"==typeof t.__u;r&&t.__u(),r&&null==e||(t.__u=t(e))}else t.current=e}catch(t){$.__e(t,n)}}function St(t,e,n){var r,i;if($.unmount&&$.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||Et(r,null,e)),null!=(r=t.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(t){$.__e(t,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&St(r[i],e,n||"function"!=typeof t.type);n||rt(t.__e),t.__c=t.__=t.__e=void 0}function It(t,e,n){return this.constructor(t,n)}function Tt(t,e,n){var r,i,o,s;e==document&&(e=document.documentElement),$.__&&$.__(t,e),i=(r="function"==typeof n)?null:n&&n.__k||e.__k,o=[],s=[],vt(e,t=(!r&&n||e).__k=it(st,null,[t]),i||Q,Q,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?F.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,s),bt(o,t,s)}F=Z.slice,$={__e:function(t,e,n,r){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.__d),s)return i.__E=i}catch(e){t=e}throw t}},H=0,V=function(t){return null!=t&&null==t.constructor},at.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=nt({},this.state),"function"==typeof t&&(t=t(nt({},n),this.props)),t&&nt(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),lt(this))},at.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),lt(this))},at.prototype.render=st,G=[],q="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,z=function(t,e){return t.__v.__b-e.__v.__b},ht.__r=0,Y=/(PointerCapture)$|Capture$/i,K=0,J=_t(!1),X=_t(!0);var Ct,Dt,Ot,xt,Nt=0,At=[],Pt=$,Lt=Pt.__b,Rt=Pt.__r,kt=Pt.diffed,Ut=Pt.__c,Mt=Pt.unmount,Bt=Pt.__;function jt(t,e){var n=function(t,e){Pt.__h&&Pt.__h(Dt,t,Nt||e),Nt=0;var n=Dt.__H||(Dt.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}(Ct++,7);return function(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Ft(){for(var t;t=At.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Vt),t.__H.__h.forEach(Gt),t.__H.__h=[]}catch(e){t.__H.__h=[],Pt.__e(e,t.__v)}}Pt.__b=function(t){Dt=null,Lt&&Lt(t)},Pt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Bt&&Bt(t,e)},Pt.__r=function(t){Rt&&Rt(t),Ct=0;var e=(Dt=t.__c).__H;e&&(Ot===Dt?(e.__h=[],Dt.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0}))):(e.__h.forEach(Vt),e.__h.forEach(Gt),e.__h=[],Ct=0)),Ot=Dt},Pt.diffed=function(t){kt&&kt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==At.push(e)&&xt===Pt.requestAnimationFrame||((xt=Pt.requestAnimationFrame)||Ht)(Ft)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.i=void 0}))),Ot=Dt=null},Pt.__c=function(t,e){e.some((function(t){try{t.__h.forEach(Vt),t.__h=t.__h.filter((function(t){return!t.__||Gt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],Pt.__e(n,t.__v)}})),Ut&&Ut(t,e)},Pt.unmount=function(t){Mt&&Mt(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{Vt(t)}catch(t){e=t}})),n.__H=void 0,e&&Pt.__e(e,n.__v))};var $t="function"==typeof requestAnimationFrame;function Ht(t){var e,n=function(){clearTimeout(r),$t&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);$t&&(e=requestAnimationFrame(n))}function Vt(t){var e=Dt,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),Dt=e}function Gt(t){var e=Dt;t.__c=t.__(),Dt=e}var Wt=Symbol.for("preact-signals");function qt(){if(Jt>1)Jt--;else{for(var t,e=!1;void 0!==Kt;){var n=Kt;for(Kt=void 0,Xt++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ne(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=r}}if(Xt=0,Jt--,e)throw t}}var zt,Yt=void 0,Kt=void 0,Jt=0,Xt=0,Qt=0;function Zt(t){if(void 0!==Yt){var e=t.n;if(void 0===e||e.t!==Yt)return e={i:0,S:t,p:Yt.s,n:void 0,t:Yt,e:void 0,x:void 0,r:e},void 0!==Yt.s&&(Yt.s.n=e),Yt.s=e,t.n=e,32&Yt.f&&t.S(e),e;if(-1===e.i)return e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=Yt.s,e.n=void 0,Yt.s.n=e,Yt.s=e),e}}function te(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function ee(t){return new te(t)}function ne(t){for(var e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function re(t){for(var e=t.s;void 0!==e;e=e.n){var n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function ie(t){for(var e=t.s,n=void 0;void 0!==e;){var r=e.p;-1===e.i?(e.S.U(e),void 0!==r&&(r.n=e.n),void 0!==e.n&&(e.n.p=r)):n=e,e.S.n=e.r,void 0!==e.r&&(e.r=void 0),e=r}t.s=n}function oe(t){te.call(this,void 0),this.x=t,this.s=void 0,this.g=Qt-1,this.f=4}function se(t){var e=t.u;if(t.u=void 0,"function"==typeof e){Jt++;var n=Yt;Yt=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,ae(t),e}finally{Yt=n,qt()}}}function ae(t){for(var e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,se(t)}function ce(t){if(Yt!==this)throw new Error("Out-of-order effect");ie(this),Yt=t,this.f&=-2,8&this.f&&ae(this),qt()}function ue(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function le(t){var e=new ue(t);try{e.c()}catch(t){throw e.d(),t}return e.d.bind(e)}function he(t,e){$[t]=e.bind(null,$[t]||function(){})}function pe(t){zt&&zt(),zt=t&&t.S()}function de(t){var e=this,n=t.data,r=function(t){return jt((function(){return ee(t)}),[])}(n);r.value=n;var i=jt((function(){for(var t=e.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}return e.__$u.c=function(){var t,n=e.__$u.S(),r=i.value;n(),V(r)||3!==(null==(t=e.base)?void 0:t.nodeType)?(e.__$f|=1,e.setState({})):e.base.data=r},new oe((function(){var t=r.value.value;return 0===t?0:!0===t?"":t||""}))}),[]);return i.value}function fe(t,e,n,r){var i=e in t&&void 0===t.ownerSVGElement,o=ee(n);return{o:function(t,e){o.value=t,r=e},d:le((function(){var n=o.value.value;r[e]!==n&&(r[e]=n,i?t[e]=n:n?t.setAttribute(e,n):t.removeAttribute(e))}))}}te.prototype.brand=Wt,te.prototype.h=function(){return!0},te.prototype.S=function(t){this.t!==t&&void 0===t.e&&(t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},te.prototype.U=function(t){if(void 0!==this.t){var e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n)}},te.prototype.subscribe=function(t){var e=this;return le((function(){var n=e.value,r=Yt;Yt=void 0;try{t(n)}finally{Yt=r}}))},te.prototype.valueOf=function(){return this.value},te.prototype.toString=function(){return this.value+""},te.prototype.toJSON=function(){return this.value},te.prototype.peek=function(){var t=Yt;Yt=void 0;try{return this.value}finally{Yt=t}},Object.defineProperty(te.prototype,"value",{get:function(){var t=Zt(this);return void 0!==t&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Xt>100)throw new Error("Cycle detected");this.v=t,this.i++,Qt++,Jt++;try{for(var e=this.t;void 0!==e;e=e.x)e.t.N()}finally{qt()}}}}),(oe.prototype=new te).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Qt)return!0;if(this.g=Qt,this.f|=1,this.i>0&&!ne(this))return this.f&=-2,!0;var t=Yt;try{re(this),Yt=this;var e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Yt=t,ie(this),this.f&=-2,!0},oe.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(var e=this.s;void 0!==e;e=e.n)e.S.S(e)}te.prototype.S.call(this,t)},oe.prototype.U=function(t){if(void 0!==this.t&&(te.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(var e=this.s;void 0!==e;e=e.n)e.S.U(e)}},oe.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;void 0!==t;t=t.x)t.t.N()}},Object.defineProperty(oe.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Zt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),ue.prototype.c=function(){var t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var e=this.x();"function"==typeof e&&(this.u=e)}finally{t()}},ue.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,se(this),re(this),Jt++;var t=Yt;return Yt=this,ce.bind(this,t)},ue.prototype.N=function(){2&this.f||(this.f|=2,this.o=Kt,Kt=this)},ue.prototype.d=function(){this.f|=8,1&this.f||ae(this)},de.displayName="_st",Object.defineProperties(te.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:de},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),he("__b",(function(t,e){if("string"==typeof e.type){var n,r=e.props;for(var i in r)if("children"!==i){var o=r[i];o instanceof te&&(n||(e.__np=n={}),n[i]=o,r[i]=o.peek())}}t(e)})),he("__r",(function(t,e){pe();var n,r=e.__c;r&&(r.__$f&=-2,void 0===(n=r.__$u)&&(r.__$u=n=function(){var t;return le((function(){t=this})),t.c=function(){r.__$f|=1,r.setState({})},t}())),pe(n),t(e)})),he("__e",(function(t,e,n,r){pe(),t(e,n,r)})),he("diffed",(function(t,e){var n;if(pe(),"string"==typeof e.type&&(n=e.__e)){var r=e.__np,i=e.props;if(r){var o=n.U;if(o)for(var s in o){var a=o[s];void 0===a||s in r||(a.d(),o[s]=void 0)}else n.U=o={};for(var c in r){var u=o[c],l=r[c];void 0===u?(u=fe(n,c,l,i),o[c]=u):u.o(l,i)}}}t(e)})),he("unmount",(function(t,e){if("string"==typeof e.type){var n=e.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var o=r[i];o&&o.d()}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)})),he("__h",(function(t,e,n,r){(r<3||9===r)&&(e.__$f|=2),t(e,n,r)})),at.prototype.shouldComponentUpdate=function(t,e){var n=this.__$u,r=n&&void 0!==n.s;for(var i in e)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(r||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var o in t)if("__source"!==o&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};var ge=Object.prototype.toString,me=Array.isArray||function(t){return"[object Array]"===ge.call(t)};function ye(t){return"function"==typeof t}function _e(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ve(t,e){return null!=t&&"object"==typeof t&&e in t}var be=RegExp.prototype.test,we=/\S/;var Ee={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},Se=/\s*/,Ie=/\s+/,Te=/\s*=/,Ce=/\s*\}/,De=/#|\^|\/|>|\{|&|=|!/;function Oe(t){this.string=t,this.tail=t,this.pos=0}function xe(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Ne(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}Oe.prototype.eos=function(){return""===this.tail},Oe.prototype.scan=function(t){var e=this.tail.match(t);if(!e||0!==e.index)return"";var n=e[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},Oe.prototype.scanUntil=function(t){var e,n=this.tail.search(t);switch(n){case-1:e=this.tail,this.tail="";break;case 0:e="";break;default:e=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=e.length,e},xe.prototype.push=function(t){return new xe(t,this)},xe.prototype.lookup=function(t){var e,n,r,i=this.cache;if(i.hasOwnProperty(t))e=i[t];else{for(var o,s,a,c=this,u=!1;c;){if(t.indexOf(".")>0)for(o=c.view,s=t.split("."),a=0;null!=o&&a<s.length;)a===s.length-1&&(u=ve(o,s[a])||(n=o,r=s[a],null!=n&&"object"!=typeof n&&n.hasOwnProperty&&n.hasOwnProperty(r))),o=o[s[a++]];else o=c.view[t],u=ve(c.view,t);if(u){e=o;break}c=c.parent}i[t]=e}return ye(e)&&(e=e.call(this.view)),e},Ne.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},Ne.prototype.parse=function(t,e){var n=this.templateCache,r=t+":"+(e||Ae.tags).join(":"),i=void 0!==n,o=i?n.get(r):void 0;return null==o&&(o=function(t,e){if(!t)return[];var n,r,i,o,s=!1,a=[],c=[],u=[],l=!1,h=!1,p="",d=0;function f(){if(l&&!h)for(;u.length;)delete c[u.pop()];else u=[];l=!1,h=!1}function g(t){if("string"==typeof t&&(t=t.split(Ie,2)),!me(t)||2!==t.length)throw new Error("Invalid tags: "+t);n=new RegExp(_e(t[0])+"\\s*"),r=new RegExp("\\s*"+_e(t[1])),i=new RegExp("\\s*"+_e("}"+t[1]))}g(e||Ae.tags);for(var m,y,_,v,b,w,E=new Oe(t);!E.eos();){if(m=E.pos,_=E.scanUntil(n))for(var S=0,I=_.length;S<I;++S)o=v=_.charAt(S),function(t,e){return be.call(t,e)}(we,o)?(h=!0,s=!0,p+=" "):(u.push(c.length),p+=v),c.push(["text",v,m,m+1]),m+=1,"\n"===v&&(f(),p="",d=0,s=!1);if(!E.scan(n))break;if(l=!0,y=E.scan(De)||"name",E.scan(Se),"="===y?(_=E.scanUntil(Te),E.scan(Te),E.scanUntil(r)):"{"===y?(_=E.scanUntil(i),E.scan(Ce),E.scanUntil(r),y="&"):_=E.scanUntil(r),!E.scan(r))throw new Error("Unclosed tag at "+E.pos);if(b=">"==y?[y,_,m,E.pos,p,d,s]:[y,_,m,E.pos],d++,c.push(b),"#"===y||"^"===y)a.push(b);else if("/"===y){if(!(w=a.pop()))throw new Error('Unopened section "'+_+'" at '+m);if(w[1]!==_)throw new Error('Unclosed section "'+w[1]+'" at '+m)}else"name"===y||"{"===y||"&"===y?h=!0:"="===y&&g(_)}if(f(),w=a.pop())throw new Error('Unclosed section "'+w[1]+'" at '+E.pos);return function(t){for(var e,n=[],r=n,i=[],o=0,s=t.length;o<s;++o)switch((e=t[o])[0]){case"#":case"^":r.push(e),i.push(e),r=e[4]=[];break;case"/":i.pop()[5]=e[2],r=i.length>0?i[i.length-1][4]:n;break;default:r.push(e)}return n}(function(t){for(var e,n,r=[],i=0,o=t.length;i<o;++i)(e=t[i])&&("text"===e[0]&&n&&"text"===n[0]?(n[1]+=e[1],n[3]=e[3]):(r.push(e),n=e));return r}(c))}(t,e),i&&n.set(r,o)),o},Ne.prototype.render=function(t,e,n,r){var i=this.getConfigTags(r),o=this.parse(t,i),s=e instanceof xe?e:new xe(e,void 0);return this.renderTokens(o,s,n,t,r)},Ne.prototype.renderTokens=function(t,e,n,r,i){for(var o,s,a,c="",u=0,l=t.length;u<l;++u)a=void 0,"#"===(s=(o=t[u])[0])?a=this.renderSection(o,e,n,r,i):"^"===s?a=this.renderInverted(o,e,n,r,i):">"===s?a=this.renderPartial(o,e,n,i):"&"===s?a=this.unescapedValue(o,e):"name"===s?a=this.escapedValue(o,e,i):"text"===s&&(a=this.rawValue(o)),void 0!==a&&(c+=a);return c},Ne.prototype.renderSection=function(t,e,n,r,i){var o=this,s="",a=e.lookup(t[1]);if(a){if(me(a))for(var c=0,u=a.length;c<u;++c)s+=this.renderTokens(t[4],e.push(a[c]),n,r,i);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)s+=this.renderTokens(t[4],e.push(a),n,r,i);else if(ye(a)){if("string"!=typeof r)throw new Error("Cannot use higher-order sections without the original template");null!=(a=a.call(e.view,r.slice(t[3],t[5]),(function(t){return o.render(t,e,n,i)})))&&(s+=a)}else s+=this.renderTokens(t[4],e,n,r,i);return s}},Ne.prototype.renderInverted=function(t,e,n,r,i){var o=e.lookup(t[1]);if(!o||me(o)&&0===o.length)return this.renderTokens(t[4],e,n,r,i)},Ne.prototype.indentPartial=function(t,e,n){for(var r=e.replace(/[^ \t]/g,""),i=t.split("\n"),o=0;o<i.length;o++)i[o].length&&(o>0||!n)&&(i[o]=r+i[o]);return i.join("\n")},Ne.prototype.renderPartial=function(t,e,n,r){if(n){var i=this.getConfigTags(r),o=ye(n)?n(t[1]):n[t[1]];if(null!=o){var s=t[6],a=t[5],c=t[4],u=o;0==a&&c&&(u=this.indentPartial(o,c,s));var l=this.parse(u,i);return this.renderTokens(l,e,n,u,r)}}},Ne.prototype.unescapedValue=function(t,e){var n=e.lookup(t[1]);if(null!=n)return n},Ne.prototype.escapedValue=function(t,e,n){var r=this.getConfigEscape(n)||Ae.escape,i=e.lookup(t[1]);if(null!=i)return"number"==typeof i&&r===Ae.escape?String(i):r(i)},Ne.prototype.rawValue=function(t){return t[1]},Ne.prototype.getConfigTags=function(t){return me(t)?t:t&&"object"==typeof t?t.tags:void 0},Ne.prototype.getConfigEscape=function(t){return t&&"object"==typeof t&&!me(t)?t.escape:void 0};var Ae={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Pe.templateCache=t},get templateCache(){return Pe.templateCache}},Pe=new Ne;Ae.clearCache=function(){return Pe.clearCache()},Ae.parse=function(t,e){return Pe.parse(t,e)},Ae.render=function(t,e,n,r){if("string"!=typeof t)throw new TypeError('Invalid template! Template should be a "string" but "'+(me(i=t)?"array":typeof i)+'" was given as the first argument for mustache#render(template, view, partials)');var i;return Pe.render(t,e,n,r)},Ae.escape=function(t){return String(t).replace(/[&<>"'`=\/]/g,(function(t){return Ee[t]}))},Ae.Scanner=Oe,Ae.Context=xe,Ae.Writer=Ne;const Le=Ae;var Re=__webpack_require__(232),ke=__webpack_require__.n(Re);class Ue{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new(ke());constructor(){}static get(){return Ue._instance||(Ue._instance=new Ue),Ue._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Ue.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Ue.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return"mobile"===this.parser.getDevice().type}calculateScalingFactor(t){const e=t.max,n=t.cont.w,r=t.cont.h,i=t.spc;let o=Ue.get().getWidth(),s=Ue.get().getHeight();e&&(o=o?Math.min(o,e):e,s=s?Math.min(s,e):e),s&&(o-=i.getHorizontal(),s-=i.getVertical(),this.scalingFactor=o/s<n/r?o/n:s/r,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(t){return this.doc.createElement(t)}appendChild(t,e){t.appendChild(e)}setStyles(t,e){Object.assign(t.style,e)}setStyle(t,e,n){e&&(n?t.style.setProperty(e,n,"important"):t.style.removeProperty(e))}setAttribute(t,e,n){t.setAttribute(e,n)}removeInApp(t){const e=document.querySelector(`.${t.rootClassName}`);e&&e.parentElement.removeChild(e)}setParentContainer(t){this.parentContainer=t,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}}class Me{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart"}var Be,je=__webpack_require__(790),Fe=__webpack_require__.n(je);function $e(t){return Fe().createInstance({name:"lc",storeName:t,driver:Fe().LOCALSTORAGE})}class He{static storage;static async get(t,e){return await(this.storage?.getItem(t))??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}}class Ve extends He{static storeName="ses";static{this.storage=$e(this.storeName)}}class Ge extends He{static storeName="usr";static{this.storage=$e(this.storeName)}}class We{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return null==this.lastEnterInactive}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=t}}class qe{static COOEE_URL_PREFIX="?from=cooee";static isShopify(){return!!window.Shopify}static getShopName(){if(this.isShopify())return window.Shopify.shop?.split(".")?.[0]}static getPageName(){if(!this.isShopify())return;const t=new URL(window.location.href).pathname.slice(1).split("/"),e=t[0];return""===e?"home":"collections"===e?"products"===t[2]?"product":"collection":"products"===e?"product":"cart"===e?"cart":location.href.includes("thank_you")?"thank_you":void 0}static getProductSlug(t){const e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(t){return this.getRootPrefix()+t+this.COOEE_URL_PREFIX}}class ze{isLocked=!1;queue=[];async acquire(){this.isLocked?await new Promise((t=>this.queue.push(t))):this.isLocked=!0}release(){if(this.queue.length>0){const t=this.queue.shift();t&&t()}else this.isLocked=!1}}class Ye{static CURRENT;token;items;total_price;currency;item_count;attributes;lock=new ze;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new Ye),this.CURRENT}async getNormalisedCart(t){await this.fetchCartFromShopify(t);const e=this.convertToCooeeCart();return t&&await Ge.set(Me.CURRENT_CART,e),e}async addCooeeAttributes(){await this.lock.acquire();const t=await Ve.get(Me.ID),e=await Ge.get(Me.DEVICE_ID);if(this.attributes?.letscooee_did===e&&this.attributes?.letscooee_sid===t)return i.log("Not calling Shopify update.js API.","Current attributes:",this.attributes),void this.lock.release();const n={letscooee_did:e,letscooee_sid:t,__letscooee_time:(new Date).toLocaleString()};i.log("Updating Shopify cart with attributes:",n);const r=qe.getCartURL("cart/update.js"),o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})}),s=await o.json();i.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(t){return this.token=t.token,this.items=t.items,this.total_price=t.total_price,this.currency=t.currency,this.item_count=t.item_count,this.attributes=t.attributes,We.get().currencyCode=this.currency,i.log(`Updated ShopifyCart. Current value: ${this}`),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(t){if(!t)return i.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);const e=[];for(const n of t){if(!n.id||!n.title){i.warn("Invalid item received",n);continue}const t={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,properties:n.properties},r=n.selling_plan_allocation?.selling_plan;r?(t.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:r.fixed_selling_plan,id:r.id,name:r.name,recurringDeliveries:r.recurring_deliveries}},e.push(t)):e.push(t)}return e}async fetchCartFromShopify(t){if(!t&&this.token)return void i.debug("Not fetching cart");i.debug("Fetching cart");const e=qe.getCartURL("cart.js"),n=await(await fetch(e)).json();this.update(n)}}class Ke{static format(t,e){return e.replace(/{{\s*(\w+)\s*}}/,((e,n)=>{switch(n){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return e}}))}static formatWithDelimiters(t,e=2,n=",",r="."){if(isNaN(t)||null==t)return"0";const i=(t/100).toFixed(e).split(".");return i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n)+(i[1]?r+i[1]:"")}}class Je{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}static parseToAny(t){try{return JSON.parse(t.toString())}catch(t){}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise((e=>setTimeout(e,t)))}static hasKeys(t){return!!t&&Object.keys(t).length>=1}static convertObjectToArray(t,e){return e.reduce(((e,n)=>(t.hasOwnProperty(n)&&null!=t[n]&&e.push({[n]:t[n]}),e)),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce(((e,n)=>(null!==t[n]&&void 0!==t[n]&&(e[n]=t[n]),e)),{})}static stringify(t){return JSON.stringify(t,(function(t,e){return void 0===e?null:e}))}}class Xe{static tz;static isValidURL(t){try{return new URL(t)}catch(t){return}}static isNull(t){return!t||"null"===t||"undefined"===t}static removeFromArray(t,e){const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)}static formatCurrency(t,e){if(0==t&&e)return"Free";const n=We.get(),r=s.get(),i=n.shopCurrencyCode??r.currency,o=n.currencyCode,a=r.money?.format??n.moneyFormat;let c;return a&&i===o?c=Ke.format(100*t,a):(c=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:o,minimumFractionDigits:0,maximumFractionDigits:2}).format(t),c=c.replace("₹","Rs. "),r.money?.showCurrency&&"INR"!==o&&(c=c.concat(` ${o}`))),c}static formatNumber(t){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(t)}static getLang(){return void 0!==navigator.languages?navigator.languages[0].split("-")[0]:navigator.language??"en"}static getTimezone(){if(this.tz)return this.tz;try{return this.tz=Intl.DateTimeFormat().resolvedOptions().timeZone,this.tz}catch(t){return""}}static documentReady(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}static onDocumentLoaded(t){"complete"===document.readyState?t():document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&t()}))}static showSnackbar(t){const e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout((()=>{e.classList.remove("show"),document.body.removeChild(e)}),3e3)}static async retrySelectorForElements(t,e=10,n=document){let r=0,o=document.querySelectorAll("nonexistent-tag");for(;r<e;){const e=Math.min(100*2**r,5e3);if(await Je.sleep(e),o=n.querySelectorAll(t),o.length)return i.debug(`Attempt ${r+1}: ${o.length} elements found with ${t}`),o;i.debug(`Attempt ${r+1}: Elements not found with ${t}. Retrying after ${e}ms.`),r++}return i.warn(`Max attempts reached. Element not found with ${t}.`),o}static async retrySelector(t,e=10,n=document){return(await this.retrySelectorForElements(t,e,n)).item(0)}}function Qe(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:n})}class Ze{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price}}class tn{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}}class en{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=t.d}}class nn{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}}class rn{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map((t=>new tn(t)))??[],this.link=t.link,this.price=new en(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,t.sellingPlans?.length&&(this.selectedSellingPlan=ee(void 0)),this.sellingPlans=t.sellingPlans?.map((t=>{const e=new nn(t);return e.isSelected&&(this.selectedSellingPlan.value=e),e}))}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.INACTIVE=2]="INACTIVE",t[t.DRAFT=3]="DRAFT",t[t.ARCHIVED=4]="ARCHIVED",t[t.OUT_OF_STOCK=5]="OUT_OF_STOCK"}(Be||(Be={}));class on{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;selectedOrFirstVariant;selected=ee(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=ee(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find((t=>t.isAvailable))??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.portraitVideos=t.videos?.filter((t=>"PORTRAIT"===t.orientation)),t.vars&&(this.vars=t.vars.map((t=>new rn(t)))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new Ze({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}}class sn{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}}class an{enabled;constructor(t){this.enabled=t.enabled}}class cn extends an{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}}class un{productQuantity;constructor(t){t??={},this.productQuantity=new cn(t.productQuantity)}}class ln{s;g;i;constructor(t){t.s&&(this.s=new mn(t.s)),t.g&&(this.g=new Un(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}}const hn="a-f\\d",pn=`#?[${hn}]{3}[${hn}]?`,dn=`#?[${hn}]{6}([${hn}]{2})?`,fn=new RegExp(`[^#${hn}]`,"gi"),gn=new RegExp(`^${pn}$|^${dn}$`,"i");class mn{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return function(t,e={}){if("string"!=typeof t||fn.test(t)||!gn.test(t))throw new TypeError("Expected a valid hex string");let n=1;8===(t=t.replace(/^#/,"")).length&&(n=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),4===t.length&&(n=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const r=Number.parseInt(t,16),i=r>>16,o=r>>8&255,s=255&r,a="number"==typeof e.alpha?e.alpha:n;return"array"===e.format?[i,o,s,a]:"css"===e.format?`rgb(${i} ${o} ${s}${1===a?"":` / ${Number((100*a).toFixed(2))}%`})`:{red:i,green:o,blue:s,alpha:a}}(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}}class yn{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new mn(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return _n[this.s??_n.SOLID]}}var _n,vn,bn,wn,En,Sn,In,Tn,Cn,Dn,On,xn,Nn,An,Pn,Ln,Rn,kn;!function(t){t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED"}(_n||(_n={}));class Un{static DEFAULT_FALLBACK=new mn({h:"#000000",a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new mn(t.c)),t.fb&&(this.fb=new mn(t.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??Un.DEFAULT_FALLBACK}}class Mn{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new mn(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}}class Bn{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}}class jn{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}}class Fn{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new ln(t.bg)),t.br&&(this.br=new yn(t.br)),t.shd&&(this.shd=new Mn(t.shd)),t.spc&&(this.spc=new Bn(t.spc)),this.trf=new jn(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return vn[this.t]}get click(){return this.clc}}!function(t){t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE"}(vn||(vn={}));class $n extends Fn{constructor(t){super(t)}}class Hn extends Fn{src;constructor(t){super(t),this.src=t.src}}!function(t){t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY"}(bn||(bn={})),function(t){t.NONE="",t.UNDERLINE="underline",t.LINE_THROUGH="line-through"}(wn||(wn={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(En||(En={})),function(t){t[t.ADD_TO_CART=1]="ADD_TO_CART",t[t.VIEW_ITEM=2]="VIEW_ITEM"}(Sn||(Sn={}));class Vn{name;fonts;constructor(t){(t=t??{}).name&&(t.name="Arial"!==t.name?t.name:""),this.name=t.name,this.fonts=t.fonts?.map((t=>new Gn(t)))}}class Gn{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===In.ITALICS||this.style===In.BOLD_ITALICS?"italic":"normal",weight:this.style===In.BOLD_ITALICS||this.style===In.BOLD?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}}!function(t){t[t.REGULAR=1]="REGULAR",t[t.ITALICS=2]="ITALICS",t[t.BOLD=3]="BOLD",t[t.BOLD_ITALICS=4]="BOLD_ITALICS"}(In||(In={}));class Wn{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return bn[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){(t=t??{}).lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new mn(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new mn(t.tc),this.ta=t.ta??bn.CENTER,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Vn(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}}class qn extends Fn{typo;constructor(t){super(t);const e={...t.f,...t.typo};t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new Wn(e)}get color(){return this.typography.tc}get typography(){return this.typo}}class zn extends qn{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}}!function(t){t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY"}(Tn||(Tn={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SUPER=1]="SUPER",t[t.SUB=2]="SUB"}(Cn||(Cn={}));class Yn extends Fn{o;constructor(t){super(t),this.o=t.o??Dn.C,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}}!function(t){t[t.NW=1]="NW",t[t.N=2]="N",t[t.NE=3]="NE",t[t.W=4]="W",t[t.C=5]="C",t[t.E=6]="E",t[t.SW=7]="SW",t[t.S=8]="S",t[t.SE=9]="SE"}(Dn||(Dn={})),function(t){t[t.FIXED=1]="FIXED",t[t.RELATIVE=2]="RELATIVE"}(On||(On={}));class Kn{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let n=new Date;t===On.RELATIVE?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;const r=window.setInterval((()=>{const t=(new Date).getTime(),i=n.getTime()-t;if(i<1)return void clearInterval(r);const o=Math.floor(i/864e5),s=Math.floor(i%864e5/36e5),a=Math.floor(i%36e5/6e4),c=Math.floor(i%6e4/1e3);e({days:o,hours:s,minutes:a,seconds:c})}),1e3);return r}}class Jn extends qn{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Kn(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}}class Xn{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new mn(t.c??{})}get text(){return this.txt}get color(){return this.c}}class Qn extends qn{ph;constructor(t){super(t),this.ph=new Xn(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}}class Zn extends Qn{constructor(t){t??={},super(t)}}class tr extends Qn{}class er extends Qn{}class nr extends Hn{}!function(t){t[t.ABOVE_PAGE=1]="ABOVE_PAGE",t[t.EMBEDDED=2]="EMBEDDED"}(xn||(xn={})),function(t){t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH"}(Nn||(Nn={}));class rr{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case An.SLIDE_IN_TOP:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case An.SLIDE_IN_DOWN:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case An.SLIDE_IN_LEFT:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case An.SLIDE_IN_RIGHT:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case An.SLIDE_IN_TOP_LEFT:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case An.SLIDE_IN_TOP_RIGHT:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case An.SLIDE_IN_BOTTOM_LEFT:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case An.SLIDE_IN_BOTTOM_RIGHT:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case An.POP:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case Pn.SLIDE_OUT_TOP:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case Pn.SLIDE_OUT_DOWN:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case Pn.SLIDE_OUT_LEFT:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case Pn.SLIDE_OUT_RIGHT:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case Pn.SLIDE_OUT_TOP_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case Pn.SLIDE_OUT_TOP_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case Pn.SLIDE_OUT_BOTTOM_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case Pn.SLIDE_OUT_BOTTOM_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case Pn.POP:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}}!function(t){t[t.NONE=1]="NONE",t[t.SLIDE_IN_TOP=2]="SLIDE_IN_TOP",t[t.SLIDE_IN_DOWN=3]="SLIDE_IN_DOWN",t[t.SLIDE_IN_LEFT=4]="SLIDE_IN_LEFT",t[t.SLIDE_IN_RIGHT=5]="SLIDE_IN_RIGHT",t[t.SLIDE_IN_TOP_LEFT=6]="SLIDE_IN_TOP_LEFT",t[t.SLIDE_IN_TOP_RIGHT=7]="SLIDE_IN_TOP_RIGHT",t[t.SLIDE_IN_BOTTOM_LEFT=8]="SLIDE_IN_BOTTOM_LEFT",t[t.SLIDE_IN_BOTTOM_RIGHT=9]="SLIDE_IN_BOTTOM_RIGHT",t[t.POP=10]="POP"}(An||(An={})),function(t){t[t.NONE=1]="NONE",t[t.SLIDE_OUT_TOP=2]="SLIDE_OUT_TOP",t[t.SLIDE_OUT_DOWN=3]="SLIDE_OUT_DOWN",t[t.SLIDE_OUT_LEFT=4]="SLIDE_OUT_LEFT",t[t.SLIDE_OUT_RIGHT=5]="SLIDE_OUT_RIGHT",t[t.SLIDE_OUT_TOP_LEFT=6]="SLIDE_OUT_TOP_LEFT",t[t.SLIDE_OUT_TOP_RIGHT=7]="SLIDE_OUT_TOP_RIGHT",t[t.SLIDE_OUT_BOTTOM_LEFT=8]="SLIDE_OUT_BOTTOM_LEFT",t[t.SLIDE_OUT_BOTTOM_RIGHT=9]="SLIDE_OUT_BOTTOM_RIGHT",t[t.POP=10]="POP"}(Pn||(Pn={}));class ir extends Fn{gvt;max;cover;anim;embedded;position;constructor(t){super(t=t??{}),this.gvt=t.gvt??Ln.C,this.max=t.max,this.cover=t.cover??!0,this.anim=new rr(t.anim),this.embedded=t.embedded,this.position=t.position??xn.ABOVE_PAGE,this.spc||(this.spc=new Bn({pl:r.IN_APP_DEFAULT_PADDING,pr:r.IN_APP_DEFAULT_PADDING,pt:r.IN_APP_DEFAULT_PADDING,pb:r.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===xn.EMBEDDED&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}}class or extends ir{cont;elems=[];mob;constructor(t){super(t=t??{}),this.cont=new Yn(t.cont),this.mob=new ir(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach((t=>{t.t===vn.IMAGE?this.elems.push(new Hn(t)):t.t===vn.TEXT||t.t===vn.BUTTON?this.elems.push(new zn(t)):t.t===vn.SHAPE?this.elems.push(new $n(t)):t.t===vn.EMAIL_INPUT?this.elems.push(new tr(t)):t.t===vn.PHONE_INPUT?this.elems.push(new er(t)):t.t===vn.COUNTDOWN_TIMER?this.elems.push(new Jn(t)):t.t===vn.PRODUCT_VARIATIONS||t.t===vn.PRODUCT_VARIATIONS_SELLING_PLANS?this.elems.push(new Zn(t)):t.t===vn.PRODUCT_IMAGE&&this.elems.push(new nr(t))}))}getStylesForWrapper(){if(this.cover)return{};let t;return t=this.gvt===Ln.NW?{top:0,left:0}:this.gvt===Ln.N?{top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===Ln.NE?{top:0,right:0}:this.gvt===Ln.E?{top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===Ln.SE?{bottom:0,right:0}:this.gvt===Ln.S?{bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===Ln.SW?{bottom:0,left:0}:this.gvt===Ln.W?{top:"50%",left:0,transform:"translateY(-50%)"}:{top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){const t={display:"flex",flexDirection:"row"};let e,n;return this.gvt===Ln.NW?(e="flex-start",n="flex-start"):this.gvt===Ln.N?(e="center",n="flex-start"):this.gvt===Ln.NE?(e="flex-end",n="flex-start"):this.gvt===Ln.W?(e="flex-start",n="center"):this.gvt===Ln.E?(e="flex-end",n="center"):this.gvt===Ln.SW?(e="flex-start",n="flex-end"):this.gvt===Ln.S?(e="center",n="flex-end"):this.gvt===Ln.SE?(e="flex-end",n="flex-end"):(e="center",n="center"),t.alignItems=n,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}}!function(t){t[t.NW=1]="NW",t[t.N=2]="N",t[t.NE=3]="NE",t[t.W=4]="W",t[t.C=5]="C",t[t.E=6]="E",t[t.SW=7]="SW",t[t.S=8]="S",t[t.SE=9]="SE"}(Ln||(Ln={}));class sr{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}}class ar{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}}class cr{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}}class ur{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Bn(t.spc),t.size&&(this.size=new cr(t.size)),t.bg&&(this.bg=new ln(t.bg)),t.br&&(this.br=new yn(t.br)),t.typo&&(this.typo=new Wn(t.typo)),t.lout&&(this.lout=new ar(t.lout)),t.flex&&(this.flex=new sr(t.flex))}}class lr{sm;lg;constructor(t){t??={},this.sm=new ur(t.sm),this.lg=new ur(t.lg)}}class hr{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new lr(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return vn[this.t]}}class pr extends hr{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??vn.TEXT,t),t??={},this.text=t.text}}class dr extends pr{constructor(t,e){super(t,e??vn.BUTTON)}}class fr extends hr{value;constructor(t){super(vn.CHECKBOX,t),t??={},this.value=t.value}}class gr extends pr{constructor(t=vn.PRODUCT_VARIATIONS,e){super(e,t)}}class mr{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new mn(t.color)}}class yr{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new mn(t.color)}}class _r{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new yr(t.navigation),this.pagination=new mr(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}}class vr extends hr{conf;slide;formData;values;allowedTypes;constructor(t){super(vn.CAROUSEL,t),t&&this.update(t)}update(t){t??={},this.slide=Sr.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new _r(t.conf),this.allowedTypes=t.allowedTypes}}class br extends pr{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,vn.COUNTDOWN_TIMER),this.gap=t.gap,this.timerType=t.type,this.timer=new Kn(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}}class wr extends hr{elems;constructor(t){super(vn.FLEXBOX,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach((t=>{const e=Sr.getParsedElement(t);e&&this.elems.push(e)}))}}class Er extends hr{src;sm;lg;constructor(t,e){super(e??vn.IMAGE,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}}class Sr{static getParsedElements(t){const e=[];return t?.forEach((t=>{const n=Sr.getParsedElement(t);n&&e.push(n)})),e}static getParsedElement(t){switch(t.t){case vn.TEXT:return new pr(t);case vn.BUTTON:return new dr(t);case vn.CHECKBOX:return new fr(t);case vn.PRODUCTS:return new Tr(t);case vn.PRODUCT:return new Ir(t);case vn.COUNTDOWN_TIMER:return new br(t);case vn.FLEXBOX:return new wr(t);case vn.IMAGE:return new Er(t);case vn.PRODUCT_IMAGE:return new Er(t,vn.PRODUCT_IMAGE);case vn.PRODUCT_TITLE:return new pr(t,vn.PRODUCT_TITLE);case vn.PRODUCT_VARIATIONS:case vn.PRODUCT_VARIATIONS_SELLING_PLANS:return new gr(t.t,t);case vn.PRODUCT_BUTTON:return new dr(t,vn.PRODUCT_BUTTON);case vn.CAROUSEL:return new vr(t);default:return void n().error("Unknown element type",t.t)}}static parseAlignmentToJustifyContent(t){switch(t){case bn.CENTER:return"center";case bn.END:return"flex-end";case bn.START:default:return"flex-start"}}}class Ir extends hr{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(vn.PRODUCT,t),this.show=t.show,this.elems=Sr.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new fr(t.cBox)),this.elems.push(new Er(t.img,vn.PRODUCT_IMAGE));const e=new pr(t.title,vn.PRODUCT_TITLE);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);const n=new pr(t.price);n.text="{{ product.price }}",n.hide=!t.show?.price;const r=new pr(t.compareAt);r.text="{{ product.compare_price }}",r.hide=!t.show?.price,t.compareAt||(r.style=new lr(n.style),r.style.lg.typo=new Wn({...r.style.lg.typo,td:wn.LINE_THROUGH}),r.style.sm.typo=new Wn({...r.style.sm.typo,td:wn.LINE_THROUGH}));const i=new wr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Sr.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});i.elems.push(r),i.elems.push(n),this.elems.push(i);const o=new gr(vn.PRODUCT_VARIATIONS,t.variantDD);if(o.hide=!t.show?.variantDD,this.elems.push(o),t.btn){const e=new dr(t.btn,vn.PRODUCT_BUTTON);e.hide=!t.show?.btn,this.elems.push(e)}}t.symbol&&(this.symbol=new pr(t.symbol))}}class Tr extends hr{conf;prod;constructor(t){super(vn.PRODUCTS,t),t??={},this.conf=new Dr(t.conf),this.prod=new Ir(t.prod)}}!function(t){t[t.SIMPLE_SCROLL=0]="SIMPLE_SCROLL",t[t.GRID=1]="GRID",t[t.CAROUSAL=2]="CAROUSAL"}(Rn||(Rn={}));class Cr extends _r{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}}class Dr{lg;sm;constructor(t){t??={},this.lg=new Cr(t.lg),this.sm=new Cr(t.sm)}}class Or extends wr{constructor(t){super(t)}}class xr{cont;elems=[];constructor(t){t=t??{},this.cont=new Or(t.cont),t.elems?.forEach((t=>{this.addRawElement(t)}))}addRawElement(t){const e=Sr.getParsedElement(t);return e&&this.elems.push(e),e}}class Nr{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(t){this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map((t=>new Ze(t)))}}class Ar{layout;milestones;constructor(t){this.layout=t.layout??k.ICONS,this.milestones=t.milestones?.map((t=>new Nr(t)))??[]}}class Pr{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}}!function(t){t.FIXED_AMOUNT="fixed_amount",t.PERCENTAGE="percentage"}(kn||(kn={}));class Lr{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===d.EXCLUSION}isABTesting(){return this.contentType===d.ABTESTING}isSingleContent(){return this.contentType===d.SINGLE}}class Rr extends Lr{static SWIPER_ELEMENTS=new Set([vn.PRODUCTS,vn.CAROUSEL]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;bundleConfig;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;discountData=ee({});constructor(t){super(t),this.id=t.id,this.nudgeID=t.nudgeID,this.currency=We.get().currencyCode??"USD",this.contentID=t.contentID,this.variation=t.variation,t.widget&&(this.widget=new xr(t.widget)),this.previewType=t.previewType,this.occurred=t.occurred??new Date,this.props=t.props,this.embeddedItems=t.embeddedItems?.map((t=>new Ze(t))),this.items=t.items?.map((t=>new on(t)))??[],this.nonMutableItems=t.items?.map((t=>new on(t)))??[],this.collections=t.collections?.map((t=>new sn(t)))??[],this.discount=t.discount,this.placement=t.placement,this.customerData=t.customerData,this.ian=t.ian?this.processPopup(t.ian):void 0,this.promotionType=t.promotionType,this.manipulation=new un(t.manipulation),this.contentSource=t.contentSource,this.klaviyoFormID=t.klaviyoFormID,this.hasMultiplePlacement=t.hasMultiplePlacement,this.skipSubscribedItems=t.skipSubscribedItems,t.progressBarConfig&&(this.progressBarConfig=new Ar(t.progressBarConfig)),t.bundleConfig&&(this.bundleConfig=new Pr(t.bundleConfig)),t.bundleFrom&&(this.bundleFrom=new on(t.bundleFrom))}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){const t=(new Date).getTime()-this.occurred.getTime();return 1e3*this.delay-t}isBundle(){return this.objective===L.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===P.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===P.PAGE_EMBED}isProgressBar(){return this.objective===L.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===L.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===L.CART_RECOVERY}isProductPromotion(){return this.objective===L.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===L.BYOB}isShoppableVideo(){return this.objective===L.SHOPPABLE_VIDEO}processPopup(t){const e=JSON.stringify(t),n=this.items[0];let i={},o={};if(n){const t=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:t.mID,image:n.variantImage,price:Xe.formatCurrency(t.price.d),comparePrice:Xe.formatCurrency(t.price.cmp),quantity:n.quantity},o={quantity:t.quantity}}const s={productCount:Ye.getCurrent().item_count};let a=Le.render(e,{product:i,variant:o,cart:s,discount:this.discount,customer:this.customerData});return n&&(a=a.replace(new RegExp(r.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new or(JSON.parse(a))}calculateDiscountData(t,e){const n=j.sum(t,(t=>t.selectedOrFirstVariant.value.price.d)),r={actualPrice:n,discountAmount:0,discountPercentage:0,discountedPrice:n};if(t?.length&&e&&this.discount?.type){if([M.UNIQUE_FLAT_ITEMS,M.STATIC].includes(this.discount.type)&&this.discount.values?.length)r.discountPercentage=this.discount.values[0],r.discountAmount=r.actualPrice*r.discountPercentage/100;else if(this.discount.type===M.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)r.discountAmount=r.actualPrice-this.discount.values[0],r.discountPercentage=r.discountAmount/r.actualPrice*100;else if(this.discount.type===M.UNIQUE_CHEAPEST_ITEM_FREE){t.sort(((t,e)=>e.selectedOrFirstVariant.value.price.d-t.selectedOrFirstVariant.value.price.d));const e=t[t.length-1];e.selectedOrFirstVariant.value.price.effective=0,r.discountAmount=e.selectedOrFirstVariant.value.price.d,r.discountPercentage=r.discountAmount/r.actualPrice*100}r.discountedPrice=r.actualPrice-r.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(r)}else this.discountData.value=this.formatCurrencyAndNumber(r)}getPrivateAttributesForLineItem(){return{_via:"Cooee",[r.CAMPAIGN_ATTRIBUTE]:this.shortID}}isBundleDiscount(){return[M.UNIQUE_FIXED_ITEMS,M.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===P.CART_EMBED&&this.objective===L.BUNDLE_AND_UPSELL}hasSwiperElement(){const t=this.widget?.elems.find((t=>Rr.SWIPER_ELEMENTS.has(t.t)));if(!t)return!1;if(t.t===vn.CAROUSEL)return!0;const e=Ue.get().isMobile()?"sm":"lg";return t.conf[e].disp===Rn.CAROUSAL}toString(){return`Engagement(id=${this.shortID})`}formatCurrencyAndNumber(t){if(!t)return{};const e={discountPercentage:Xe.formatNumber(t.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map((n=>{e[n]=Xe.formatCurrency(t[n])})),e}}for(var kr=[],Ur=[],Mr="undefined"!=typeof Uint8Array?Uint8Array:Array,Br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jr=0;jr<64;++jr)kr[jr]=Br[jr],Ur[Br.charCodeAt(jr)]=jr;function Fr(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function $r(t,e,n){for(var r,i,o=[],s=e;s<n;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(kr[(i=r)>>18&63]+kr[i>>12&63]+kr[i>>6&63]+kr[63&i]);return o.join("")}Ur["-".charCodeAt(0)]=62,Ur["_".charCodeAt(0)]=63;var Hr,Vr,Gr=function(t){var e,n,r=Fr(t),i=r[0],o=r[1],s=new Mr(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,c=o>0?i-4:i;for(n=0;n<c;n+=4)e=Ur[t.charCodeAt(n)]<<18|Ur[t.charCodeAt(n+1)]<<12|Ur[t.charCodeAt(n+2)]<<6|Ur[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=Ur[t.charCodeAt(n)]<<2|Ur[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=Ur[t.charCodeAt(n)]<<10|Ur[t.charCodeAt(n+1)]<<4|Ur[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},Wr=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push($r(t,s,s+o>a?a:s+o));return 1===r?(e=t[n-1],i.push(kr[e>>2]+kr[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(kr[e>>10]+kr[e>>4&63]+kr[e<<2&63]+"=")),i.join("")},qr=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,p=n?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=p,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},zr=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?p/c:p*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+d]=255&s,d+=f,s/=256,u-=8);t[n+d-f]|=128*g},Yr=(Hr=function(t,e){var n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return s(t,e,n)}function s(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|p(t,e),r=i(n),s=r.write(t,e);return s!==n&&(r=r.slice(0,s)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(B(t,Uint8Array)){var e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(B(t,SharedArrayBuffer)||t&&B(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);var s=function(t){if(o.isBuffer(t)){var e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||j(t.length)?i(0):u(t):"Buffer"===t.type&&Array.isArray(t.data)?u(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return a(t),i(t<0?0:0|h(t))}function u(t){for(var e=t.length<0?0:0|h(t.length),n=i(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function l(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,o.prototype),r}function h(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function p(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(i)return r?-1:k(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return E(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function f(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),j(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var h=!0,p=0;p<c;p++)if(u(t,o+p)!==u(e,p)){h=!1;break}if(h)return o}return-1}function y(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(j(a))return s;t[n+s]=a}return s}function _(t,e,n,r){return M(k(e,t.length-n),t,n,r)}function v(t,e,n,r){return M(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n,r){return M(U(e),t,n,r)}function w(t,e,n,r){return M(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function E(t,e,n){return 0===e&&n===t.length?Wr(t):Wr(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=I));return n}(r)}e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,n){return s(t,e,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,n){return function(t,e,n){return a(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},o.allocUnsafe=function(t){return c(t)},o.allocUnsafeSlow=function(t){return c(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(B(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),B(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=o.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(B(s,Uint8Array))i+s.length>r.length?o.from(s).copy(r,i):Uint8Array.prototype.set.call(r,s,i);else{if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i)}i+=s.length}return r},o.byteLength=p,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)f(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)f(this,e,e+3),f(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)f(this,e,e+7),f(this,e+1,e+6),f(this,e+2,e+5),f(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):d.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(B(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),c=Math.min(s,a),u=this.slice(r,i),l=t.slice(e,n),h=0;h<c;++h)if(u[h]!==l[h]){s=u[h],a=l[h];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":case"latin1":case"binary":return v(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function D(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=F[t[o]];return i}function O(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function x(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function A(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,i){return e=+e,n>>>=0,i||A(t,0,n,4),zr(t,e,n,r,23,4),n+4}function L(t,e,n,r,i){return e=+e,n>>>=0,i||A(t,0,n,8),zr(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||x(t,4,this.length),qr(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),qr(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),qr(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),qr(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return L(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return L(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var i=t.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=o.isBuffer(t)?t:o.from(t,r),c=a.length;if(0===c)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%c]}return this};var R=/[^+/0-9A-Za-z-_]/g;function k(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(t){return Gr(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function B(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function j(t){return t!=t}var F=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)e[r+i]=t[n]+t[i];return e}()},Hr(Vr={exports:{}},Vr.exports),Vr.exports),Kr=Yr.Buffer;Yr.SlowBuffer,Yr.INSPECT_MAX_BYTES,Yr.kMaxLength;var Jr=function(t,e){return Jr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Jr(t,e)};function Xr(t,e){function n(){this.constructor=t}Jr(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Qr=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return Xr(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),Zr=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return Xr(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function ti(t){return t&&t.Math==Math&&t}function ei(){return ti("object"==typeof globalThis&&globalThis)||ti("object"==typeof window&&window)||ti("object"==typeof self&&self)||ti("object"==typeof __webpack_require__.g&&__webpack_require__.g)||Function("return this")()}var ni=function(t){var e=function(){var t=ei();return"object"==typeof t.navigator&&"ReactNative"===t.navigator.product}()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var n=Kr.alloc(t),r=0;r<t;++r)n[r]=Math.floor(256*Math.random());return n},ri=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Kr.alloc(e))}}return void 0!==__webpack_require__.g&&__webpack_require__.g.crypto&&__webpack_require__.g.crypto.getRandomValues?function(t){return __webpack_require__.g.crypto.getRandomValues(Kr.alloc(t))}:ni}();function ii(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function oi(t){return"object"==typeof t&&null!==t}function si(t,e){var n=!1;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return n||(console.warn(e),n=!0),t.apply(this,r)}}function ai(t){if(ArrayBuffer.isView(t))return Kr.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return Kr.from(t);var e;throw new Zr("Must use either Buffer or TypedArray")}var ci=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,ui=function(t){return"string"==typeof t&&ci.test(t)},li=function(t){if(!ui(t))throw new Zr('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Kr.from(e,"hex")},hi=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},pi=(Math.pow(2,63),Math.pow(2,63),Math.pow(2,53)),di=-Math.pow(2,53),fi=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new Zr("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=Kr.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=Kr.from(e,"binary"):Array.isArray(e)?this.buffer=Kr.from(e):this.buffer=ai(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new Zr("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new Zr("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||n>255)throw new Zr("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var r=Kr.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=n}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var n=Kr.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(ai(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===n.length?"0"+n:n}:{$binary:{base64:e,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new gi(this.buffer.slice(0,this.position));throw new Qr('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,n){var r,i;if(n=n||{},"$binary"in e?n.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,r=Kr.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=Kr.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,r=li(e.$uuid)),!r)throw new Zr("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 4===i?new gi(r):new t(r,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(fi.prototype,"_bsontype",{value:"Binary"});var gi=function(t){function e(n){var r,i,o=this;if(null==n)r=e.generate();else if(n instanceof e)r=Kr.from(n.buffer),i=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)r=ai(n);else{if("string"!=typeof n)throw new Zr("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");r=li(n)}return(o=t.call(this,r,4)||this).__id=i,o}return Xr(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=hi(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=hi(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new fi(this.id,fi.SUBTYPE_UUID)},e.generate=function(){var t=ri(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,Kr.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?ui(t):!(!ii(t)||16!==t.length||64!=(240&t[6])||128&~t[8])))},e.createFromHexString=function(t){return new e(li(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(fi),mi=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);this.code=e,this.scope=n}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();Object.defineProperty(mi.prototype,"_bsontype",{value:"Code"});var yi=function(){function t(e,n,r,i){if(!(this instanceof t))return new t(e,n,r,i);var o=e.split(".");2===o.length&&(r=o.shift(),e=o.shift()),this.collection=e,this.oid=n,this.db=r,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var n=Object.assign({},e);return delete n.$ref,delete n.$id,delete n.$db,new t(e.$ref,e.$id,e.$db,n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(yi.prototype,"_bsontype",{value:"DBRef"});var _i=void 0;try{_i=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}var vi=4294967296,bi=0x10000000000000000,wi=bi/2,Ei={},Si={},Ii=function(){function t(e,n,r){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,n,r);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!n)):"string"==typeof e?Object.assign(this,t.fromString(e,!!n)):(this.low=0|e,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,n,r){return new t(e,n,r)},t.fromInt=function(e,n){var r,i,o;return n?(o=0<=(e>>>=0)&&e<256)&&(i=Si[e])?i:(r=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(Si[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=Ei[e])?i:(r=t.fromBits(e,e<0?-1:0,!1),o&&(Ei[e]=r),r)},t.fromNumber=function(e,n){if(isNaN(e))return n?t.UZERO:t.ZERO;if(n){if(e<0)return t.UZERO;if(e>=bi)return t.MAX_UNSIGNED_VALUE}else{if(e<=-wi)return t.MIN_VALUE;if(e+1>=wi)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%vi|0,e/vi|0,n)},t.fromBigInt=function(e,n){return t.fromString(e.toString(),n)},t.fromString=function(e,n,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return t.fromString(e.substring(1),n,r).neg();for(var o=t.fromNumber(Math.pow(r,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),u=parseInt(e.substring(a,a+c),r);if(c<8){var l=t.fromNumber(Math.pow(r,c));s=s.mul(l).add(t.fromNumber(u))}else s=(s=s.mul(o)).add(t.fromNumber(u))}return s.unsigned=n,s},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},t.isLong=function(t){return oi(t)&&!0===t.__isLong__},t.fromValue=function(e,n){return"number"==typeof e?t.fromNumber(e,n):"string"==typeof e?t.fromString(e,n):t.fromBits(e.low,e.high,"boolean"==typeof n?n:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,c=e.low>>>16,u=0,l=0,h=0,p=0;return h+=(p+=o+(65535&e.low))>>>16,p&=65535,l+=(h+=i+c)>>>16,h&=65535,u+=(l+=r+a)>>>16,l&=65535,u+=n+s,u&=65535,t.fromBits(h<<16|p,u<<16|l,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(_i){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?_i.div_u:_i.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,_i.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),c=t.fromNumber(r),u=c.mul(e);u.isNegative()||u.gt(i);)r-=a,u=(c=t.fromNumber(r,this.unsigned)).mul(e);c.isZero()&&(c=t.ONE),o=o.add(c),i=i.sub(u)}return o},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,n=0!==this.high?this.high:this.low;for(e=31;e>0&&!(n&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return!(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return!(1&~this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),_i){var n=(this.unsigned?_i.rem_u:_i.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,_i.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),_i){var n=_i.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,_i.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,c=65535&e.high,u=e.low>>>16,l=65535&e.low,h=0,p=0,d=0,f=0;return d+=(f+=s*l)>>>16,f&=65535,p+=(d+=o*l)>>>16,d&=65535,p+=(d+=s*u)>>>16,d&=65535,h+=(p+=i*l)>>>16,p&=65535,h+=(p+=o*u)>>>16,p&=65535,h+=(p+=s*c)>>>16,p&=65535,h+=r*l+i*u+o*c+s*a,h&=65535,t.fromBits(d<<16|f,h<<16|p,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0==(e&=63))return this;var n=this.high;if(e<32){var r=this.low;return t.fromBits(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?t.fromBits(n,0,this.unsigned):t.fromBits(n>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*vi+(this.low>>>0):this.high*vi+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var n=t.fromNumber(e),r=this.div(n),i=r.mul(n).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),u=(s.sub(c.mul(o)).toInt()>>>0).toString(e);if((s=c).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,n){var r=t.fromString(e.$numberLong);return n&&n.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Ii.prototype,"__isLong__",{value:!0}),Object.defineProperty(Ii.prototype,"_bsontype",{value:"Long"});var Ti=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Ci=/^(\+|-)?(Infinity|inf)$/i,Di=/^(\+|-)?NaN$/i,Oi=6111,xi=-6176,Ni=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ai=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Pi=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Li=/^([-+])?(\d+)?$/;function Ri(t){return!isNaN(parseInt(t,10))}function ki(t){var e=Ii.fromNumber(1e9),n=Ii.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new Ii(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function Ui(t,e){throw new Zr('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Mi=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!ii(e))throw new Zr("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new Zr("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(e){var n,r=!1,i=!1,o=!1,s=0,a=0,c=0,u=0,l=0,h=[0],p=0,d=0,f=0,g=0,m=0,y=0,_=new Ii(0,0),v=new Ii(0,0),b=0;if(e.length>=7e3)throw new Zr(e+" not a valid Decimal128 string");var w=e.match(Ti),E=e.match(Ci),S=e.match(Di);if(!w&&!E&&!S||0===e.length)throw new Zr(e+" not a valid Decimal128 string");if(w){var I=w[2],T=w[4],C=w[5],D=w[6];T&&void 0===D&&Ui(e,"missing exponent power"),T&&void 0===I&&Ui(e,"missing exponent base"),void 0===T&&(C||D)&&Ui(e,"missing e before exponent")}if("+"!==e[b]&&"-"!==e[b]||(r="-"===e[b++]),!Ri(e[b])&&"."!==e[b]){if("i"===e[b]||"I"===e[b])return new t(Kr.from(r?Ai:Pi));if("N"===e[b])return new t(Kr.from(Ni))}for(;Ri(e[b])||"."===e[b];)"."!==e[b]?(p<34&&("0"!==e[b]||o)&&(o||(l=a),o=!0,h[d++]=parseInt(e[b],10),p+=1),o&&(c+=1),i&&(u+=1),a+=1,b+=1):(i&&Ui(e,"contains multiple periods"),i=!0,b+=1);if(i&&!a)throw new Zr(e+" not a valid Decimal128 string");if("e"===e[b]||"E"===e[b]){var O=e.substr(++b).match(Li);if(!O||!O[2])return new t(Kr.from(Ni));m=parseInt(O[0],10),b+=O[0].length}if(e[b])return new t(Kr.from(Ni));if(f=0,p){if(g=p-1,1!==(s=c))for(;0===h[l+s-1];)s-=1}else f=0,g=0,h[0]=0,c=1,p=1,s=0;for(m<=u&&u-m>16384?m=xi:m-=u;m>Oi;){if((g+=1)-f>34){if(h.join("").match(/^0+$/)){m=Oi;break}Ui(e,"overflow")}m-=1}for(;m<xi||p<c;){if(0===g&&s<p){m=xi,s=0;break}if(p<c?c-=1:g-=1,m<Oi)m+=1;else{if(h.join("").match(/^0+$/)){m=Oi;break}Ui(e,"overflow")}}if(g-f+1<s){var x=a;i&&(l+=1,x+=1),r&&(l+=1,x+=1);var N=parseInt(e[l+g+1],10),A=0;if(N>=5&&(A=1,5===N))for(A=h[g]%2==1?1:0,y=l+g+2;y<x;y++)if(parseInt(e[y],10)){A=1;break}if(A)for(var P=g;P>=0;P--)if(++h[P]>9&&(h[P]=0,0===P)){if(!(m<Oi))return new t(Kr.from(r?Ai:Pi));m+=1,h[P]=1}}if(_=Ii.fromNumber(0),v=Ii.fromNumber(0),0===s)_=Ii.fromNumber(0),v=Ii.fromNumber(0);else if(g-f<17)for(P=f,v=Ii.fromNumber(h[P++]),_=new Ii(0,0);P<=g;P++)v=(v=v.multiply(Ii.fromNumber(10))).add(Ii.fromNumber(h[P]));else{for(P=f,_=Ii.fromNumber(h[P++]);P<=g-17;P++)_=(_=_.multiply(Ii.fromNumber(10))).add(Ii.fromNumber(h[P]));for(v=Ii.fromNumber(h[P++]);P<=g;P++)v=(v=v.multiply(Ii.fromNumber(10))).add(Ii.fromNumber(h[P]))}var L,R,k,U,M=function(t,e){if(!t&&!e)return{high:Ii.fromNumber(0),low:Ii.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new Ii(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new Ii(e.getLowBits(),0),s=n.multiply(i),a=n.multiply(o),c=r.multiply(i),u=r.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new Ii(a.getLowBits(),0).add(c).add(u.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:u=a.shiftLeft(32).add(new Ii(u.getLowBits(),0))}}(_,Ii.fromString("100000000000000000"));M.low=M.low.add(v),R=v,((k=(L=M.low).high>>>0)<(U=R.high>>>0)||k===U&&L.low>>>0<R.low>>>0)&&(M.high=M.high.add(Ii.fromNumber(1))),n=m+6176;var B={low:Ii.fromNumber(0),high:Ii.fromNumber(0)};M.high.shiftRightUnsigned(49).and(Ii.fromNumber(1)).equals(Ii.fromNumber(1))?(B.high=B.high.or(Ii.fromNumber(3).shiftLeft(61)),B.high=B.high.or(Ii.fromNumber(n).and(Ii.fromNumber(16383).shiftLeft(47))),B.high=B.high.or(M.high.and(Ii.fromNumber(0x7fffffffffff)))):(B.high=B.high.or(Ii.fromNumber(16383&n).shiftLeft(49)),B.high=B.high.or(M.high.and(Ii.fromNumber(562949953421311)))),B.low=M.low,r&&(B.high=B.high.or(Ii.fromString("9223372036854775808")));var j=Kr.alloc(16);return b=0,j[b++]=255&B.low.low,j[b++]=B.low.low>>8&255,j[b++]=B.low.low>>16&255,j[b++]=B.low.low>>24&255,j[b++]=255&B.low.high,j[b++]=B.low.high>>8&255,j[b++]=B.low.high>>16&255,j[b++]=B.low.high>>24&255,j[b++]=255&B.high.low,j[b++]=B.high.low>>8&255,j[b++]=B.high.low>>16&255,j[b++]=B.high.low>>24&255,j[b++]=255&B.high.high,j[b++]=B.high.high>>8&255,j[b++]=B.high.high>>16&255,j[b++]=B.high.high>>24&255,new t(j)},t.prototype.toString=function(){for(var t,e=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var i,o,s,a=0,c=!1,u={parts:[0,0,0,0]},l=[];a=0;var h=this.bytes,p=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24,d=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24,f=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24,g=h[a++]|h[a++]<<8|h[a++]<<16|h[a++]<<24;a=0,(new Ii(p,d),new Ii(f,g)).lessThan(Ii.ZERO)&&l.push("-");var m=g>>26&31;if(m>>3==3){if(30===m)return l.join("")+"Infinity";if(31===m)return"NaN";t=g>>15&16383,i=8+(g>>14&1)}else i=g>>14&7,t=g>>17&16383;var y=t-6176;if(u.parts[0]=(16383&g)+((15&i)<<14),u.parts[1]=f,u.parts[2]=d,u.parts[3]=p,0===u.parts[0]&&0===u.parts[1]&&0===u.parts[2]&&0===u.parts[3])c=!0;else for(s=3;s>=0;s--){var _=0,v=ki(u);if(u=v.quotient,_=v.rem.low)for(o=8;o>=0;o--)n[9*s+o]=_%10,_=Math.floor(_/10)}if(c)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var b=e-1+y;if(b>=34||b<=-7||y>0){if(e>34)return l.push("".concat(0)),y>0?l.push("E+".concat(y)):y<0&&l.push("E".concat(y)),l.join("");for(l.push("".concat(n[a++])),(e-=1)&&l.push("."),r=0;r<e;r++)l.push("".concat(n[a++]));l.push("E"),b>0?l.push("+".concat(b)):l.push("".concat(b))}else if(y>=0)for(r=0;r<e;r++)l.push("".concat(n[a++]));else{var w=e+y;if(w>0)for(r=0;r<w;r++)l.push("".concat(n[a++]));else l.push("0");for(l.push(".");w++<0;)l.push("0");for(r=0;r<e-Math.max(w-1,0);r++)l.push("".concat(n[a++]))}return l.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Mi.prototype,"_bsontype",{value:"Decimal128"});var Bi=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,n){var r=parseFloat(e.$numberDouble);return n&&n.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty(Bi.prototype,"_bsontype",{value:"Double"});var ji=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,n){return n&&n.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(ji.prototype,"_bsontype",{value:"Int32"});var Fi=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(Fi.prototype,"_bsontype",{value:"MaxKey"});var $i=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty($i.prototype,"_bsontype",{value:"MinKey"});var Hi=new RegExp("^[0-9a-fA-F]{24}$"),Vi=null,Gi=Symbol("id"),Wi=function(){function t(e){if(!(this instanceof t))return new t(e);var n;if("object"==typeof e&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new Zr("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?Kr.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Gi]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Gi]=n instanceof Kr?n:ai(n);else{if("string"!=typeof n)throw new Zr("Argument passed in does not match the accepted types");if(12===n.length){var r=Kr.from(n);if(12!==r.byteLength)throw new Zr("Argument passed in must be a string of 12 bytes");this[Gi]=r}else{if(24!==n.length||!Hi.test(n))throw new Zr("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Gi]=Kr.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Gi]},set:function(e){this[Gi]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var n=t.getInc(),r=Kr.alloc(12);return r.writeUInt32BE(e,0),null===Vi&&(Vi=ri(5)),r[4]=Vi[0],r[5]=Vi[1],r[6]=Vi[2],r[7]=Vi[3],r[8]=Vi[4],r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(null==e)return!1;if(e instanceof t)return this[Gi][11]===e[Gi][11]&&this[Gi].equals(e[Gi]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&ii(this.id))return e===Kr.prototype.toString.call(this.id,"latin1");if("string"==typeof e&&t.isValid(e)&&24===e.length)return e.toLowerCase()===this.toHexString();if("string"==typeof e&&t.isValid(e)&&12===e.length)return Kr.from(e).equals(this.id);if("object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString){var n=e.toHexString(),r=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===r}return!1},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var n=Kr.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(e,0),new t(n)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new Zr("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Kr.from(e,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(Wi.prototype,"generate",{value:si((function(t){return Wi.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Wi.prototype,"getInc",{value:si((function(){return Wi.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Wi.prototype,"get_inc",{value:si((function(){return Wi.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Wi,"get_inc",{value:si((function(){return Wi.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Wi.prototype,"_bsontype",{value:"ObjectID"});var qi=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(this.pattern=e,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new Qr("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new Qr("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new Qr("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new Zr("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(qi.prototype,"_bsontype",{value:"BSONRegExp"});var zi=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(zi.prototype,"_bsontype",{value:"Symbol"});var Yi=function(t){function e(n,r){var i=this;return i instanceof e?(i=Ii.isLong(n)?t.call(this,n.low,n.high,!0)||this:oi(n)&&void 0!==n.t&&void 0!==n.i?t.call(this,n.i,n.t,!0)||this:t.call(this,n,r,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(n,r)}return Xr(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Ii.fromInt(t,!0))},e.fromNumber=function(t){return new e(Ii.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(Ii.fromString(t,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=Ii.MAX_UNSIGNED_VALUE,e}(Ii);var Ki=2147483647,Ji=-2147483648,Xi=0x8000000000000000,Qi=-0x8000000000000000,Zi={$oid:Wi,$binary:fi,$uuid:fi,$symbol:zi,$numberInt:ji,$numberDecimal:Mi,$numberDouble:Bi,$numberLong:Ii,$minKey:$i,$maxKey:Fi,$regex:qi,$regularExpression:qi,$timestamp:Yi};function to(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Ji&&t<=Ki)return new ji(t);if(t>=Qi&&t<=Xi)return Ii.fromNumber(t)}return new Bi(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var n=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),r=0;r<n.length;r++){var i=Zi[n[r]];if(i)return i.fromExtendedJSON(t,e)}if(null!=t.$date){var o=t.$date,s=new Date;return e.legacy?"number"==typeof o?s.setTime(o):"string"==typeof o&&s.setTime(Date.parse(o)):"string"==typeof o?s.setTime(Date.parse(o)):Ii.isLong(o)?s.setTime(o.toNumber()):"number"==typeof o&&e.relaxed&&s.setTime(o),s}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=to(t.$scope)),mi.fromExtendedJSON(t)}if(function(t){return oi(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof yi)return c;var u=Object.keys(c).filter((function(t){return t.startsWith("$")})),l=!0;if(u.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(l=!1)})),l)return yi.fromExtendedJSON(c)}return t}function eo(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function no(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var r=e.seenObjects.map((function(t){return t.propertyName})),i=r.slice(0,n).map((function(t){return"".concat(t," -> ")})).join(""),o=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(t){return"".concat(t," -> ")})).join(""),a=r[r.length-1],c=" ".repeat(i.length+o.length/2),u="-".repeat(s.length+(o.length+a.length)/2-1);throw new Zr("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(c,"\\").concat(u,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return no(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||function(t){return oi(t)&&"[object Date]"===Object.prototype.toString.call(t)}(t)){var l=t.getTime(),h=l>-1&&l<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:eo(t)}:e.relaxed&&h?{$date:eo(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var p=t>=Qi&&t<=Xi;if(t>=Ji&&t<=Ki)return{$numberInt:t.toString()};if(p)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(t)){var d=t.flags;if(void 0===d){var f=t.toString().match(/[gimuy]*$/);f&&(d=f[0])}return new qi(t.source,d).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new Qr("not an object instance");var n=t._bsontype;if(void 0===n){var r={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=no(t[i],e);"__proto__"===i?Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):r[i]=o}finally{e.seenObjects.pop()}}return r}if(function(t){return oi(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=io[t._bsontype];if(!a)throw new Zr("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new mi(s.code,no(s.scope,e)):"DBRef"===n&&s.oid&&(s=new yi(no(s.collection,e),no(s.oid,e),no(s.db,e),no(s.fields,e))),s.toExtendedJSON(e)}throw new Qr("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var ro,io={Binary:function(t){return new fi(t.value(),t.sub_type)},Code:function(t){return new mi(t.code,t.scope)},DBRef:function(t){return new yi(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Mi(t.bytes)},Double:function(t){return new Bi(t.value)},Int32:function(t){return new ji(t.value)},Long:function(t){return Ii.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new Fi},MinKey:function(){return new $i},ObjectID:function(t){return new Wi(t)},ObjectId:function(t){return new Wi(t)},BSONRegExp:function(t){return new qi(t.pattern,t.options)},Symbol:function(t){return new zi(t.value)},Timestamp:function(t){return Yi.fromBits(t.low,t.high)}};!function(t){function e(t,e){var n=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new Qr("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return to(e,n)}))}function n(t,e,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==e||"object"!=typeof e||Array.isArray(e)||(r=e,e=void 0,n=0);var i=no(t,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,e,n)}t.parse=e,t.stringify=n,t.serialize=function(t,e){return e=e||{},JSON.parse(n(t,e))},t.deserialize=function(t,n){return n=n||{},e(JSON.stringify(t),n)}}(ro||(ro={}));var oo=ei();oo.Map?oo.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var n=t[e],r=n[0],i=n[1];this._keys.push(r),this._values[r]={v:i,i:this._keys.length-1}}}t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?[n,t._values[n].v]:void 0,done:void 0===n}}}},t.prototype.forEach=function(t,e){e=e||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];t.call(e,this._values[r].v,r,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?t._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}(),Ii.fromNumber(pi),Ii.fromNumber(di),new Set(["$db","$ref","$id","$clusterTime"]);var so=new Uint8Array(8);new DataView(so.buffer,so.byteOffset,so.byteLength);Kr.alloc(17825792);class ao{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}}class co{name;properties;trigger;items;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;constructor(t,e={},n,r){this.name=t,this.properties=e,this.id=r?new Wi(r):new Wi,this.occurred=new Date,n&&(this.trigger=new ao(n)),this.newEvent=!r}}class uo{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}}var lo=function(t,e){return lo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},lo(t,e)};function ho(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}lo(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function po(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function fo(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function go(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function mo(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function yo(t){return this instanceof yo?(this.v=t,this):new yo(t)}function _o(t){return"function"==typeof t}function vo(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var bo=vo((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function wo(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Eo=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=fo(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}else o.remove(this);var c=this.initialTeardown;if(_o(c))try{c()}catch(t){i=t instanceof bo?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=fo(u),h=l.next();!h.done;h=l.next()){var p=h.value;try{To(p)}catch(t){i=null!=i?i:[],t instanceof bo?i=mo(mo([],go(i)),go(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new bo(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)To(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&wo(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&wo(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),So=Eo.EMPTY;function Io(t){return t instanceof Eo||t&&"closed"in t&&_o(t.remove)&&_o(t.add)&&_o(t.unsubscribe)}function To(t){_o(t)?t():t.unsubscribe()}var Co=null,Do=null,Oo=void 0,xo=!1,No=!1,Ao={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Ao.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,mo([t,e],go(n))):setTimeout.apply(void 0,mo([t,e],go(n)))},clearTimeout:function(t){var e=Ao.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Po(t){Ao.setTimeout((function(){if(!Co)throw t;Co(t)}))}function Lo(){}var Ro=ko("C",void 0,void 0);function ko(t,e,n){return{kind:t,value:e,error:n}}var Uo=null;function Mo(t){if(xo){var e=!Uo;if(e&&(Uo={errorThrown:!1,error:null}),t(),e){var n=Uo,r=n.errorThrown,i=n.error;if(Uo=null,r)throw i}}else t()}var Bo=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,Io(e)&&e.add(n)):n.destination=Wo,n}return ho(e,t),e.create=function(t,e,n){return new Ho(t,e,n)},e.prototype.next=function(t){this.isStopped?Go(function(t){return ko("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Go(ko("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Go(Ro,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Eo),jo=Function.prototype.bind;function Fo(t,e){return jo.call(t,e)}var $o=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){Vo(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){Vo(t)}else Vo(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){Vo(t)}},t}(),Ho=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;return _o(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&No?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&Fo(e.next,o),error:e.error&&Fo(e.error,o),complete:e.complete&&Fo(e.complete,o)}):i=e,s.destination=new $o(i),s}return ho(e,t),e}(Bo);function Vo(t){var e;xo?(e=t,xo&&Uo&&(Uo.errorThrown=!0,Uo.error=e)):Po(t)}function Go(t,e){var n=Do;n&&Ao.setTimeout((function(){return n(t,e)}))}var Wo={closed:!0,next:Lo,error:function(t){throw t},complete:Lo},qo="function"==typeof Symbol&&Symbol.observable||"@@observable";function zo(t){return t}var Yo=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof Bo||function(t){return t&&_o(t.next)&&_o(t.error)&&_o(t.complete)}(r)&&Io(r)?t:new Ho(t,e,n);return Mo((function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=Ko(e))((function(e,r){var i=new Ho({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[qo]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0===(n=t).length?zo:1===n.length?n[0]:function(t){return n.reduce((function(t,e){return e(t)}),t)})(this);var n},t.prototype.toPromise=function(t){var e=this;return new(t=Ko(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function Ko(t){var e;return null!==(e=null!=t?t:Oo)&&void 0!==e?e:Promise}var Jo=vo((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Xo=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return ho(e,t),e.prototype.lift=function(t){var e=new Qo(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Jo},e.prototype.next=function(t){var e=this;Mo((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=fo(e.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(t)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;Mo((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;Mo((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?So:(this.currentObservers=null,o.push(t),new Eo((function(){e.currentObservers=null,wo(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new Yo;return t.source=this,t},e.create=function(t,e){return new Qo(t,e)},e}(Yo),Qo=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return ho(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:So},e}(Xo),Zo=function(t){function e(e,n){return t.call(this)||this}return ho(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(Eo),ts={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=ts.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,mo([t,e],go(n))):setInterval.apply(void 0,mo([t,e],go(n)))},clearInterval:function(t){var e=ts.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},es=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return ho(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),ts.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&ts.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,wo(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Zo),ns={now:function(){return(ns.delegate||Date).now()},delegate:void 0},rs=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=ns.now,t}(),is=new(function(t){function e(e,n){void 0===n&&(n=rs.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return ho(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(rs))(es);function os(t){return function(e){if(function(t){return _o(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function ss(t,e,n,r,i){return new as(t,e,n,r,i)}var as=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return ho(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(Bo);function cs(t,e){return void 0===e&&(e=is),os((function(n,r){var i=null,o=null,s=null,a=function(){if(i){i.unsubscribe(),i=null;var t=o;o=null,r.next(t)}};function c(){var n=s+t,o=e.now();if(o<n)return i=this.schedule(void 0,n-o),void r.add(i);a()}n.subscribe(ss(r,(function(n){o=n,s=e.now(),i||(i=e.schedule(c,t),r.add(i))}),(function(){a(),r.complete()}),void 0,(function(){o=i=null})))}))}var us=__webpack_require__(780);class ls{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new us.d(location.href)}catch(t){return{}}const e={};this.UTM_PARAMS.forEach((n=>{const r=t.getQueryParam(n);r&&(e[n]=r)}));const n={};return Object.keys(this.TW_PARAMS).forEach((e=>{const r=t.getQueryParam(this.TW_PARAMS[e]);r&&(n[e]=r)})),{...n,...e}}}class hs{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(t){this.name=t.name,this.path=t.path,this.qs=t.qs,this.referrer=t.referrer,this.utmSource=t.utmSource||t.utm_source,this.utmMedium=t.utmMedium||t.utm_medium,this.utmCampaign=t.utmCampaign||t.utm_campaign,this.utmId=t.utmId||t.utm_id,this.utmTerm=t.utmTerm||t.utm_term,this.utmContent=t.utmContent||t.utm_content}static parseFromCurrent(){const t="/"===location.pathname?location.pathname:location.pathname.replace(/\/+$/,"");return new hs({origin:location.origin,path:t,qs:location.search,referrer:ls.getReferrer(),name:We.get().pageName,...ls.getUTMParams()})}}var ps=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return ho(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(Xo);class ds{static INSTANCE=new ds;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(t,e){this.topics[t]||(this.topics[t]=new Xo),this.topics[t].next(e)}subscriber(t){return this.topics[t]||(this.topics[t]=new Xo),this.topics[t].asObservable()}}class fs{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=s.get().website??{};currentState=!1;drawerSubject=new ps({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble"].join(",");cartSelector=[fs.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize()}get element(){return this.cartDrawerElement}static get(){return fs._instance||(fs._instance=new fs),fs._instance}static forceUpdate(){fs._instance=new fs}isOpen(){const t=this.inShadow?this.isPresent():this.isVisible();return n().log("Cart drawer is currently "+(t?"open":"close")),t}open(){if(this.isOpen())return void i.log("Drawer is already open");document.dispatchEvent(new CustomEvent(r.CTA_OPEN_CART_EVENT));const t=document.querySelector(this.iconSelector);t?t.click():i.debug("No clickable cart icon found with selector",this.iconSelector)}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===fs.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&"mini-cart"===this.element?.id}refreshUI(t,e=!0){this.isMiniCart()&&this.element?._rerenderCart?this.element._rerenderCart({detail:{cart:t}}):this.isShopifyDefaultDrawer()?this.element?.renderContents&&t&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(t)):this.element?.onCartDrawerUpdate?this.element.onCartDrawerUpdate():window.icartCartActivityEvent?window.icartCartActivityEvent():window.theme?.CartDrawer?(new window.theme.CartDrawer).init():window.Hs_CartDrawer?.updateSlideCart?window.Hs_CartDrawer.updateSlideCart():window.theme?.fetch_side_cart?window.theme.fetch_side_cart():window.theme?.Cart?.updateCart?window.theme.Cart.updateCart():window.cartUpdate?window.cartUpdate():this.element?._onCartRefresh?this.element._onCartRefresh():"cart-drawer-component"===this.element?.tagName?.toLowerCase()?document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart")):"sidebar-cart"===this.element?.id?document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}})):i.info("No method found to update the cart without refreshing"),e&&ds.get().broadcast(r.CART_UPDATE_BROADCAST)}async initialize(){const t=this.configWebsite.cartDrawerSelector;if(!t)return void await this.findCartDrawer();const e=t.split(":shadow");1===e.length?(this.selector=e[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=e[0]?.trim(),this.selector=e[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!qe.isShopify())return;const t=this.selector||this.cartSelector;this.cartDrawerElement=await Xe.retrySelector(t),this.cartDrawerElement?(n().log("Found",this.cartDrawerElement,`from selector: ${t}`),this.createMutationObserver()):n().warn("Max attempts exhausted to find cart drawer")}async findCartDrawerWithShadow(){if(!qe.isShopify()||!this.shadowParentElementSelector)return;const t=await Xe.retrySelector(this.shadowParentElementSelector),e=t?.shadowRoot;"open"===e?.mode&&(this.cartDrawerShadowElement=e,this.createMutationObserver())}isVisible(){if(!this.cartDrawerElement)return!1;const t=this.cartDrawerElement.getBoundingClientRect(),e=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,r=t.top<=e&&t.bottom>=0,i=t.left<=n&&t.right>=0,o=r&&i,s=this.cartDrawerElement.tagName.toLowerCase()===fs.DEFAULT_SELECTOR&&this.cartDrawerElement.open,a=getComputedStyle(this.cartDrawerElement),c="none"!==a.display&&"hidden"!==a.visibility&&parseFloat(a.opacity)>0,u=!this.cartDrawerElement.hidden,l=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,h=a.transform.match(/matrix\(([^)]+)\)/);let p=0,d=0;if(h){const t=h[1].split(", ").map(parseFloat);p=t[4],d=t[5]}const f=p+t.left>n||p+t.right<0||d+t.top>e||d+t.bottom<0,g=Math.max(0,Math.min(t.right,n)-Math.max(t.left,0))*Math.max(0,Math.min(t.bottom,e)-Math.max(t.top,0)),m=t.width*t.height;return(o||s||!f)&&c&&u&&l&&m>0&&g/m>=.1}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;const t=this.cartDrawerElement||this.cartDrawerShadowElement,e=new Xo;this.mutationObserver=new MutationObserver((()=>{e.next()})),this.mutationObserver.observe(t,{attributes:!0,subtree:!0,childList:this.inShadow}),e.pipe(cs(500)).subscribe((()=>{const t=this.isOpen();this.currentState!==t&&(this.currentState=t,this.drawerSubject.next({open:t,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))}))}isPresent(){return!(!this.selector||!this.cartDrawerShadowElement||!this.cartDrawerShadowElement.querySelector(this.selector))}}class gs{_startTime;_triggerData;intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];constructor(t,e){this._startTime=t,this._triggerData=e}get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return"test"===t&&(t="test-"+this.startTime.getTime().toString()),r.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter((t=>t.selected.value))}get shouldGiveFBTDiscount(){const t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};const n={eventName:t,duration:((new Date).getTime()-this.startTime.getTime())/1e3,...e};this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach((n=>{n.id!==t||(n.isValid=e)}))}hasManipulatedProductQuantity(){const t=this.triggerData.manipulation.productQuantity;return t.enabled&&null!=t.min&&null!=t.max}getManipulatedQuantity(t){const{min:e=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(e>n)return i.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=n)return t;const r=t%100;return r<e?e:r>n?n:r}stopIntervals(){this.intervals.forEach((t=>clearInterval(t)))}}const ms=Object.prototype.toString;function ys(t){switch(ms.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Ds(t,Error)}}function _s(t,e){return ms.call(t)===`[object ${e}]`}function vs(t){return _s(t,"ErrorEvent")}function bs(t){return _s(t,"DOMError")}function ws(t){return _s(t,"String")}function Es(t){return"object"==typeof t&&null!==t&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Ss(t){return null===t||Es(t)||"object"!=typeof t&&"function"!=typeof t}function Is(t){return _s(t,"Object")}function Ts(t){return"undefined"!=typeof Event&&Ds(t,Event)}function Cs(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function Ds(t,e){try{return t instanceof e}catch(t){return!1}}function Os(t){return!("object"!=typeof t||null===t||!t.__isVue&&!t._isVue)}const xs="8.18.0",Ns=globalThis;function As(t,e,n){const r=n||Ns,i=r.__SENTRY__=r.__SENTRY__||{},o=i[xs]=i[xs]||{};return o[t]||(o[t]=e())}const Ps=Ns;function Ls(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let u;const l=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(u=Rs(n,l),!("html"===u||o>1&&s+i.length*c+u.length>=h));)i.push(u),s+=u.length,n=n.parentNode;return i.reverse().join(a)}catch(t){return"<unknown>"}}function Rs(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(Ps.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e&&e.length?e.filter((t=>n.getAttribute(t))).map((t=>[t,n.getAttribute(t)])):null;if(i&&i.length)i.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else{n.id&&r.push(`#${n.id}`);const t=n.className;if(t&&ws(t)){const e=t.split(/\s+/);for(const t of e)r.push(`.${t}`)}}const o=["aria-label","type","name","title","alt"];for(const t of o){const e=n.getAttribute(t);e&&r.push(`[${t}="${e}"]`)}return r.join("")}const ks="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Us=["debug","info","warn","error","log","assert","trace"],Ms={};function Bs(t){if(!("console"in Ns))return t();const e=Ns.console,n={},r=Object.keys(Ms);r.forEach((t=>{const r=Ms[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}const js=function(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return ks?Us.forEach((n=>{e[n]=(...e)=>{t&&Bs((()=>{Ns.console[n](`Sentry Logger [${n}]:`,...e)}))}})):Us.forEach((t=>{e[t]=()=>{}})),e}();function Fs(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function $s(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{Os(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(t){n.push("[value cannot be serialized]")}}return n.join(e)}function Hs(t,e=[],n=!1){return e.some((e=>function(t,e,n=!1){return!!ws(t)&&(_s(e,"RegExp")?e.test(t):!!ws(e)&&(n?t===e:t.includes(e)))}(t,e,n)))}function Vs(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);"function"==typeof i&&Ws(i,r),t[e]=i}function Gs(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch(n){ks&&js.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Ws(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Gs(t,"__sentry_original__",e)}catch(t){}}function qs(t){return t.__sentry_original__}function zs(t){if(ys(t))return{message:t.message,name:t.name,stack:t.stack,...Ks(t)};if(Ts(t)){const e={type:t.type,target:Ys(t.target),currentTarget:Ys(t.currentTarget),...Ks(t)};return"undefined"!=typeof CustomEvent&&Ds(t,CustomEvent)&&(e.detail=t.detail),e}return t}function Ys(t){try{return"undefined"!=typeof Element&&Ds(t,Element)?Ls(t):Object.prototype.toString.call(t)}catch(t){return"<unknown>"}}function Ks(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Js(t){return Xs(t,new Map)}function Xs(t,e){if(function(t){if(!Is(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||"Object"===e}catch(t){return!0}}(t)){const n=e.get(t);if(void 0!==n)return n;const r={};e.set(t,r);for(const n of Object.keys(t))void 0!==t[n]&&(r[n]=Xs(t[n],e));return r}if(Array.isArray(t)){const n=e.get(t);if(void 0!==n)return n;const r=[];return e.set(t,r),t.forEach((t=>{r.push(Xs(t,e))})),r}return t}function Qs(){const t=Ns,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch(t){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function Zs(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function ta(t){const{message:e,event_id:n}=t;if(e)return e;const r=Zs(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ea(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=n||"Error")}function na(t,e){const n=Zs(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r&&r.data,...e.data};n.mechanism.data=t}}function ra(t){if(t&&t.__sentry_captured__)return!0;try{Gs(t,"__sentry_captured__",!0)}catch(t){}return!1}function ia(){return{traceId:Qs(),spanId:Qs().substring(16)}}function oa(){return Date.now()/1e3}const sa=function(){const{performance:t}=Ns;if(!t||!t.now)return oa;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/1e3}();let aa;function ca(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||sa(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:Qs()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}(()=>{const{performance:t}=Ns;if(!t||!t.now)return void(aa="none");const e=36e5,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=i<e,s=t.timing&&t.timing.navigationStart,a="number"==typeof s?Math.abs(s+n-r):e;o||a<e?i<=a?(aa="timeOrigin",t.timeOrigin):aa="navigationStart":aa="dateNow"})();const ua="_sentrySpan";function la(t,e){e?Gs(t,ua,e):delete t[ua]}function ha(t){return t[ua]}class pa{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=ia()}clone(){const t=new pa;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,la(t,ha(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&ca(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts[t]=e,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,[n,r]=e instanceof da?[e.getScopeData(),e.getRequestSession()]:Is(e)?[t,t.requestSession]:[],{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:u=[],propagationContext:l}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),u.length&&(this._fingerprint=u),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,la(this,void 0),this._attachments=[],this._propagationContext=ia(),this._notifyScopeListeners(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:oa(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ha(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:Qs();if(!this._client)return js.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:Qs();if(!this._client)return js.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:Qs();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(js.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const da=pa,fa="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ga=[];function ma(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function ya(t,e,n){if(n[e.name])fa&&js.log(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===ga.indexOf(e.name)&&"function"==typeof e.setupOnce&&(e.setupOnce(),ga.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",((e,r)=>n(e,r,t)))}if("function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign(((e,r)=>n(e,r,t)),{id:e.name});t.addEventProcessor(r)}fa&&js.log(`Integration installed: ${e.name}`)}}const _a=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler"],va=(t={})=>({name:"InboundFilters",processEvent(e,n,r){const i=r.getOptions(),o=function(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:_a],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:void 0===t.ignoreInternal||t.ignoreInternal}}(t,i);return function(t,e){return e.ignoreInternal&&function(t){try{return"SentryError"===t.exception.values[0].type}catch(t){}return!1}(t)?(fa&&js.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${ta(t)}`),!0):function(t,e){return!(t.type||!e||!e.length)&&function(t){const e=[];let n;t.message&&e.push(t.message);try{n=t.exception.values[t.exception.values.length-1]}catch(t){}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),e}(t).some((t=>Hs(t,e)))}(t,e.ignoreErrors)?(fa&&js.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${ta(t)}`),!0):function(t){return!t.type&&(!(!t.exception||!t.exception.values||0===t.exception.values.length)&&(!t.message&&!t.exception.values.some((t=>t.stacktrace||t.type&&"Error"!==t.type||t.value))))}(t)?(fa&&js.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${ta(t)}`),!0):function(t,e){if("transaction"!==t.type||!e||!e.length)return!1;const n=t.transaction;return!!n&&Hs(n,e)}(t,e.ignoreTransactions)?(fa&&js.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${ta(t)}`),!0):function(t,e){if(!e||!e.length)return!1;const n=ba(t);return!!n&&Hs(n,e)}(t,e.denyUrls)?(fa&&js.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${ta(t)}.\nUrl: ${ba(t)}`),!0):!function(t,e){if(!e||!e.length)return!0;const n=ba(t);return!n||Hs(n,e)}(t,e.allowUrls)&&(fa&&js.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${ta(t)}.\nUrl: ${ba(t)}`),!0)}(e,o)?null:e}});function ba(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch(t){}return e?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(e):null}catch(e){return fa&&js.error(`Cannot extract url for event ${ta(t)}`),null}}function wa(){return Ea(Ns),Ns}function Ea(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||xs,e[xs]=e[xs]||{}}class Sa{constructor(t,e){let n,r;n=t||new da,r=e||new da,this._stack=[{scope:n}],this._isolationScope=r}withScope(t){const e=this._pushScope();let n;try{n=t(e)}catch(t){throw this._popScope(),t}return Cs(n)?n.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1||!this._stack.pop())}}function Ia(){const t=Ea(wa());return t.stack=t.stack||new Sa(As("defaultCurrentScope",(()=>new da)),As("defaultIsolationScope",(()=>new da)))}function Ta(t){return Ia().withScope(t)}function Ca(t,e){const n=Ia();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function Da(t){return Ia().withScope((()=>t(Ia().getIsolationScope())))}function Oa(t){const e=Ea(t);return e.acs?e.acs:{withIsolationScope:Da,withScope:Ta,withSetScope:Ca,withSetIsolationScope:(t,e)=>Da(e),getCurrentScope:()=>Ia().getScope(),getIsolationScope:()=>Ia().getIsolationScope()}}function xa(){return Oa(wa()).getCurrentScope()}function Na(){return Oa(wa()).getIsolationScope()}function Aa(){return xa().getClient()}let Pa;const La=new WeakMap,Ra=()=>({name:"FunctionToString",setupOnce(){Pa=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=qs(this),n=La.has(Aa())&&void 0!==e?e:this;return Pa.apply(n,t)}}catch(t){}},setup(t){La.set(t,!0)}}),ka="?",Ua=/\(error: (.*)\)/,Ma=/captureMessage|captureException/;function Ba(t){return t[t.length-1]||{}}const ja="<anonymous>";function Fa(t){try{return t&&"function"==typeof t&&t.name||ja}catch(t){return ja}}function $a(t){const e=t.exception;if(e){const t=[];try{return e.values.forEach((e=>{e.stacktrace.frames&&t.push(...e.stacktrace.frames)})),t}catch(t){return}}}const Ha=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&(!!function(t,e){const n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!Ga(t,e)&&!!Va(t,e))))}(t,e)||!!function(t,e){const n=Wa(e),r=Wa(t);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!Ga(t,e)&&!!Va(t,e)))}(t,e))}(e,t))return fa&&js.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(t){}return t=e}}};function Va(t,e){let n=$a(t),r=$a(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],i=n[t];if(e.filename!==i.filename||e.lineno!==i.lineno||e.colno!==i.colno||e.function!==i.function)return!1}return!0}function Ga(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(t){return!1}}function Wa(t){return t.exception&&t.exception.values&&t.exception.values[0]}const qa={},za={};function Ya(t,e){qa[t]=qa[t]||[],qa[t].push(e)}function Ka(t,e){za[t]||(e(),za[t]=!0)}function Ja(t,e){const n=t&&qa[t];if(n)for(const r of n)try{r(e)}catch(e){ks&&js.error(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${Fa(r)}\nError:`,e)}}const Xa=Ns;let Qa,Za,tc;function ec(){if(!Xa.document)return;const t=Ja.bind(null,"dom"),e=nc(t,!0);Xa.document.addEventListener("click",e,!1),Xa.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach((e=>{const n=Xa[e]&&Xa[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(Vs(n,"addEventListener",(function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},s=o[n]=o[n]||{refCount:0};if(!s.handler){const r=nc(t);s.handler=r,e.call(this,n,r,i)}s.refCount++}catch(t){}return e.call(this,n,r,i)}})),Vs(n,"removeEventListener",(function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this,i=n.__sentry_instrumentation_handlers__||{},o=i[e];o&&(o.refCount--,o.refCount<=0&&(t.call(this,e,o.handler,r),o.handler=void 0,delete i[e]),0===Object.keys(i).length&&delete n.__sentry_instrumentation_handlers__)}catch(t){}return t.call(this,e,n,r)}})))}))}function nc(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(t){try{return t.target}catch(t){return null}}(n);if(function(t,e){return"keypress"===t&&(!e||!e.tagName||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&!e.isContentEditable)}(n.type,r))return;Gs(n,"_sentryCaptured",!0),r&&!r._sentryId&&Gs(r,"_sentryId",Qs());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==Za)return!1;try{if(!t.target||t.target._sentryId!==tc)return!1}catch(t){}return!0})(n)||(t({event:n,name:i,global:e}),Za=n.type,tc=r?r._sentryId:void 0),clearTimeout(Qa),Qa=Xa.setTimeout((()=>{tc=void 0,Za=void 0}),1e3)}}const rc="__sentry_xhr_v3__";function ic(){if(!Xa.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;Vs(t,"open",(function(t){return function(...e){const n=1e3*sa(),r=ws(e[0])?e[0].toUpperCase():void 0,i=function(t){if(ws(t))return t;try{return t.toString()}catch(t){}}(e[1]);if(!r||!i)return t.apply(this,e);this[rc]={method:r,url:i,request_headers:{}},"POST"===r&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const t=this[rc];if(t&&4===this.readyState){try{t.status_code=this.status}catch(t){}Ja("xhr",{endTimestamp:1e3*sa(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?Vs(this,"onreadystatechange",(function(t){return function(...e){return o(),t.apply(this,e)}})):this.addEventListener("readystatechange",o),Vs(this,"setRequestHeader",(function(t){return function(...e){const[n,r]=e,i=this[rc];return i&&ws(n)&&ws(r)&&(i.request_headers[n.toLowerCase()]=r),t.apply(this,e)}})),t.apply(this,e)}})),Vs(t,"send",(function(t){return function(...e){const n=this[rc];return n?(void 0!==e[0]&&(n.body=e[0]),Ja("xhr",{startTimestamp:1e3*sa(),xhr:this}),t.apply(this,e)):t.apply(this,e)}}))}const oc=Ns;let sc;function ac(){if(!function(){const t=oc.chrome,e=t&&t.app&&t.app.runtime,n="history"in oc&&!!oc.history.pushState&&!!oc.history.replaceState;return!e&&n}())return;const t=Xa.onpopstate;function e(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const t=sc,e=String(n);sc=e,Ja("history",{from:t,to:e})}return t.apply(this,e)}}Xa.onpopstate=function(...e){const n=Xa.location.href,r=sc;if(sc=n,Ja("history",{from:r,to:n}),t)try{return t.apply(this,e)}catch(t){}},Vs(Xa.history,"pushState",e),Vs(Xa.history,"replaceState",e)}const cc=100;function uc(t,e){const n=Aa(),r=Na();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=cc}=n.getOptions();if(o<=0)return;const s={timestamp:oa(),...t},a=i?Bs((()=>i(s,e))):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}function lc(){"console"in Ns&&Us.forEach((function(t){t in Ns.console&&Vs(Ns.console,t,(function(e){return Ms[t]=e,function(...e){Ja("console",{args:e,level:t});const n=Ms[t];n&&n.apply(Ns.console,e)}}))}))}const hc=Ns;function pc(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function dc(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in hc))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch(t){return!1}}())return!1;if(pc(hc.fetch))return!0;let t=!1;const e=hc.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=pc(n.contentWindow.fetch)),e.head.removeChild(n)}catch(t){ks&&js.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return t})()&&Vs(Ns,"fetch",(function(t){return function(...e){const{method:n,url:r}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:gc(e),method:fc(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:gc(e),method:fc(e,"method")?String(e.method).toUpperCase():"GET"}}(e),i={args:e,fetchData:{method:n,url:r},startTimestamp:1e3*sa()};Ja("fetch",{...i});const o=(new Error).stack;return t.apply(Ns,e).then((t=>(Ja("fetch",{...i,endTimestamp:1e3*sa(),response:t}),t)),(t=>{throw Ja("fetch",{...i,endTimestamp:1e3*sa(),error:t}),ys(t)&&void 0===t.stack&&(t.stack=o,Gs(t,"framesToPop",1)),t}))}}))}function fc(t,e){return!!t&&"object"==typeof t&&!!t[e]}function gc(t){return"string"==typeof t?t:t?fc(t,"url")?t.url:t.toString?t.toString():"":""}const mc=["fatal","error","warning","log","info","debug"];function yc(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}const _c="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function vc(t,e=100,n=1/0){try{return wc("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function bc(t,e=3,n=102400){const r=vc(t,e);return i=r,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(i))>n?bc(t,e-1,n):r;var i}function wc(t,e,n=1/0,r=1/0,i=function(){const t="function"==typeof WeakSet,e=t?new WeakSet:[];return[function(n){if(t)return!!e.has(n)||(e.add(n),!1);for(let t=0;t<e.length;t++)if(e[t]===n)return!0;return e.push(n),!1},function(n){if(t)e.delete(n);else for(let t=0;t<e.length;t++)if(e[t]===n){e.splice(t,1);break}}]}()){const[o,s]=i;if(null==e||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;const a=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e._events)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(Os(e))return"[VueViewModel]";if(Is(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof e&&e!=e)return"[NaN]";if("function"==typeof e)return`[Function: ${Fa(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c="number"==typeof e.__sentry_override_normalization_depth__?e.__sentry_override_normalization_depth__:n;if(0===c)return a.replace("object ","");if(o(e))return"[Circular ~]";const u=e;if(u&&"function"==typeof u.toJSON)try{return wc("",u.toJSON(),c-1,r,i)}catch(t){}const l=Array.isArray(e)?[]:{};let h=0;const p=zs(e);for(const t in p){if(!Object.prototype.hasOwnProperty.call(p,t))continue;if(h>=r){l[t]="[MaxProperties ~]";break}const e=p[t];l[t]=wc(t,e,c-1,r,i),h++}return s(e),l}const Ec="production";var Sc;function Ic(t){return new Cc((e=>{e(t)}))}function Tc(t){return new Cc(((e,n)=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(Sc||(Sc={}));class Cc{constructor(t){Cc.prototype.__init.call(this),Cc.prototype.__init2.call(this),Cc.prototype.__init3.call(this),Cc.prototype.__init4.call(this),this._state=Sc.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(t){this._reject(t)}}then(t,e){return new Cc(((n,r)=>{this._handlers.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this._executeHandlers()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Cc(((e,n)=>{let r,i;return this.then((e=>{i=!1,r=e,t&&t()}),(e=>{i=!0,r=e,t&&t()})).then((()=>{i?n(r):e(r)}))}))}__init(){this._resolve=t=>{this._setResult(Sc.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(Sc.REJECTED,t)}}__init3(){this._setResult=(t,e)=>{this._state===Sc.PENDING&&(Cs(e)?e.then(this._resolve,this._reject):(this._state=t,this._value=e,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===Sc.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach((t=>{t[0]||(this._state===Sc.RESOLVED&&t[1](this._value),this._state===Sc.REJECTED&&t[2](this._value),t[0]=!0)}))}}}function Dc(t,e,n,r=0){return new Cc(((i,o)=>{const s=t[r];if(null===e||"function"!=typeof s)i(e);else{const a=s({...e},n);fa&&s.id&&null===a&&js.log(`Event processor "${s.id}" dropped event`),Cs(a)?a.then((e=>Dc(t,e,n,r+1).then(i))).then(null,o):Dc(t,a,n,r+1).then(i).then(null,o)}}))}const Oc=/^sentry-/;function xc(t){return t.split(",").map((t=>t.split("=").map((t=>decodeURIComponent(t.trim()))))).reduce(((t,[e,n])=>(e&&n&&(t[e]=n),t)),{})}function Nc(t){const e=t._sentryMetrics;if(!e)return;const n={};for(const[,[t,r]]of e)(n[t]||(n[t]=[])).push(Js(r));return n}function Ac(t){const{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=Rc(t);return Js({parent_span_id:r,span_id:e,trace_id:n})}function Pc(t){return"number"==typeof t?Lc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Lc(t.getTime()):sa()}function Lc(t){return t>9999999999?t/1e3:t}function Rc(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,parentSpanId:a,status:c}=t;return Js({span_id:e,trace_id:n,data:r,description:o,parent_span_id:a,start_timestamp:Pc(i),timestamp:Pc(s)||void 0,status:kc(c),op:r["sentry.op"],origin:r["sentry.origin"],_metrics_summary:Nc(t)})}return{span_id:e,trace_id:n}}catch(t){return{}}}function kc(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"unknown_error"}function Uc(t){return t._sentryRootSpan||t}function Mc(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i=Js({environment:n.environment||Ec,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",i),i}function Bc(t){const e=Aa();if(!e)return{};const n=Mc(Rc(t).trace_id||"",e),r=Uc(t),i=r._frozenDsc;if(i)return i;const o=r.spanContext().traceState,s=o&&o.get("sentry.dsc"),a=s&&function(t){const e=function(t){if(t&&(ws(t)||Array.isArray(t)))return Array.isArray(t)?t.reduce(((t,e)=>{const n=xc(e);return Object.entries(n).forEach((([e,n])=>{t[e]=n})),t}),{}):xc(t)}(t);if(!e)return;const n=Object.entries(e).reduce(((t,[e,n])=>(e.match(Oc)&&(t[e.slice(7)]=n),t)),{});return Object.keys(n).length>0?n:void 0}(s);if(a)return a;const c=Rc(r),u=c.data||{},l=u["sentry.sample_rate"];null!=l&&(n.sample_rate=`${l}`);const h=u["sentry.source"],p=c.description;return"url"!==h&&p&&(n.transaction=p),n.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return 1===e}(r)),e.emit("createDsc",n,r),n}function jc(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:h,propagationContext:p,transactionName:d,span:f}=e;Fc(t,"extra",n),Fc(t,"tags",r),Fc(t,"user",i),Fc(t,"contexts",o),Fc(t,"sdkProcessingMetadata",a),s&&(t.level=s),d&&(t.transactionName=d),f&&(t.span=f),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),l.length&&(t.eventProcessors=[...t.eventProcessors,...l]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...p}}function Fc(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function $c(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||Qs(),timestamp:e.timestamp||oa()},u=n.integrations||t.integrations.map((t=>t.name));!function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;"environment"in t||(t.environment="environment"in e?n:Ec),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=Fs(t.message,o));const s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=Fs(s.value,o));const a=t.request;a&&a.url&&(a.url=Fs(a.url,o))}(c,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(c,u),i&&i.emit("applyFrameMetadata",e),void 0===e.type&&function(t,e){const n=Ns._sentryDebugIds;if(!n)return;let r;const i=Hc.get(e);i?r=i:(r=new Map,Hc.set(e,r));const o=Object.entries(n).reduce(((t,[n,i])=>{let o;const s=r.get(n);s?o=s:(o=e(n),r.set(n,o));for(let e=o.length-1;e>=0;e--){const n=o[e];if(n.filename){t[n.filename]=i;break}}return t}),{});try{t.exception.values.forEach((t=>{t.stacktrace.frames.forEach((t=>{t.filename&&(t.debug_id=o[t.filename])}))}))}catch(t){}}(c,t.stackParser);const l=function(t,e){if(!e)return t;const n=t?t.clone():new da;return n.update(e),n}(r,n.captureContext);n.mechanism&&na(c,n.mechanism);const h=i?i.getEventProcessors():[],p=As("globalScope",(()=>new da)).getScopeData();o&&jc(p,o.getScopeData()),l&&jc(p,l.getScopeData());const d=[...n.attachments||[],...p.attachments];return d.length&&(n.attachments=d),function(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;!function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e,c=Js(n);c&&Object.keys(c).length&&(t.extra={...c,...t.extra});const u=Js(r);u&&Object.keys(u).length&&(t.tags={...u,...t.tags});const l=Js(i);l&&Object.keys(l).length&&(t.user={...l,...t.user});const h=Js(o);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts}),s&&(t.level=s),a&&"transaction"!==t.type&&(t.transaction=a)}(t,e),r&&function(t,e){t.contexts={trace:Ac(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Bc(e),...t.sdkProcessingMetadata};const n=Rc(Uc(e)).description;n&&!t.transaction&&"transaction"===t.type&&(t.transaction=n)}(t,r),function(t,e){var n;t.fingerprint=t.fingerprint?(n=t.fingerprint,Array.isArray(n)?n:[n]):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}(c,p),Dc([...h,...p.eventProcessors],c,n).then((t=>(t&&function(t){const e={};try{t.exception.values.forEach((t=>{t.stacktrace.frames.forEach((t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)}))}))}catch(t){}if(0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach((([t,e])=>{n.push({type:"sourcemap",code_file:t,debug_id:e})}))}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map((t=>({...t,...t.data&&{data:vc(t.data,e,n)}})))},...t.user&&{user:vc(t.user,e,n)},...t.contexts&&{contexts:vc(t.contexts,e,n)},...t.extra&&{extra:vc(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=vc(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map((t=>({...t,...t.data&&{data:vc(t.data,e,n)}})))),r}(t,s,a):t)))}const Hc=new WeakMap;const Vc=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Gc(t,e){return xa().captureEvent(t,e)}const Wc=Ns;let qc=0;function zc(){return qc>0}function Yc(t,e={},n){if("function"!=typeof t)return t;try{const e=t.__sentry_wrapped__;if(e)return e;if(qs(t))return t}catch(e){return t}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map((t=>Yc(t,e)));return t.apply(this,i)}catch(t){throw qc++,setTimeout((()=>{qc--})),function(...t){const e=Oa(wa());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}e.withScope(t[0])}((n=>{var i;n.addEventProcessor((t=>(e.mechanism&&(ea(t,void 0,void 0),na(t,e.mechanism)),t.extra={...t.extra,arguments:r},t))),i=t,xa().captureException(i,function(t){if(t)return function(t){return t instanceof da||"function"==typeof t}(t)||function(t){return Object.keys(t).some((t=>Vc.includes(t)))}(t)?{captureContext:t}:t}(undefined))})),t}};try{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])}catch(t){}Ws(r,t),Gs(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>t.name})}catch(t){}return r}const Kc=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(t){var n;e.console&&function(t){const e="console";Ya(e,t),Ka(e,lc)}(function(t){return function(e){if(Aa()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,"warn"===r?"warning":mc.includes(r)?r:"log"),message:$s(e.args," ")};var r;if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${$s(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}uc(n,{input:e.args,level:e.level})}}(t)),e.dom&&(n=function(t,e){return function(n){if(Aa()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>1024&&(_c&&js.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof o&&(o=[o]);try{const t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=Ls(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!Ps.HTMLElement)return null;let e=t;for(let t=0;t<5;t++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}(e)}catch(t){r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),uc(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom),Ya("dom",n),Ka("dom",ec)),e.xhr&&function(t){Ya("xhr",t),Ka("xhr",ic)}(function(t){return function(e){if(Aa()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[rc];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i;uc({category:"xhr",data:{method:o,url:s,status_code:a},type:"http"},{xhr:e.xhr,input:c,startTimestamp:n,endTimestamp:r})}}(t)),e.fetch&&function(t){const e="fetch";Ya(e,t),Ka(e,dc)}(function(t){return function(e){if(Aa()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error)uc({category:"fetch",data:e.fetchData,level:"error",type:"http"},{data:e.error,input:e.args,startTimestamp:n,endTimestamp:r});else{const t=e.response;uc({category:"fetch",data:{...e.fetchData,status_code:t&&t.status},type:"http"},{input:e.args,response:t,startTimestamp:n,endTimestamp:r})}}}(t)),e.history&&function(t){const e="history";Ya(e,t),Ka(e,ac)}(function(t){return function(e){if(Aa()!==t)return;let n=e.from,r=e.to;const i=yc(Wc.location.href);let o=n?yc(n):void 0;const s=yc(r);o&&o.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),uc({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on("beforeSendEvent",function(t){return function(e){Aa()===t&&uc({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:ta(e)},{event:e})}}(t))}}},Jc=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Xc=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&Vs(Wc,"setTimeout",Qc),e.setInterval&&Vs(Wc,"setInterval",Qc),e.requestAnimationFrame&&Vs(Wc,"requestAnimationFrame",Zc),e.XMLHttpRequest&&"XMLHttpRequest"in Wc&&Vs(XMLHttpRequest.prototype,"send",tu);const t=e.eventTarget;t&&(Array.isArray(t)?t:Jc).forEach(eu)}}};function Qc(t){return function(...e){const n=e[0];return e[0]=Yc(n,{mechanism:{data:{function:Fa(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Zc(t){return function(e){return t.apply(this,[Yc(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Fa(t)},handled:!1,type:"instrument"}})])}}function tu(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((t=>{t in n&&"function"==typeof n[t]&&Vs(n,t,(function(e){const n={mechanism:{data:{function:t,handler:Fa(e)},handled:!1,type:"instrument"}},r=qs(e);return r&&(n.mechanism.data.handler=Fa(r)),Yc(e,n)}))})),t.apply(this,e)}}function eu(t){const e=Wc,n=e[t]&&e[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(Vs(n,"addEventListener",(function(e){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=Yc(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Fa(r),target:t},handled:!1,type:"instrument"}}))}catch(t){}return e.apply(this,[n,Yc(r,{mechanism:{data:{function:"addEventListener",handler:Fa(r),target:t},handled:!1,type:"instrument"}}),i])}})),Vs(n,"removeEventListener",(function(t){return function(e,n,r){const i=n;try{const n=i&&i.__sentry_wrapped__;n&&t.call(this,e,n,r)}catch(t){}return t.call(this,e,i,r)}})))}let nu=null;function ru(){nu=Ns.onerror,Ns.onerror=function(t,e,n,r,i){return Ja("error",{column:r,error:i,line:n,msg:t,url:e}),!(!nu||nu.__SENTRY_LOADER__)&&nu.apply(this,arguments)},Ns.onerror.__SENTRY_INSTRUMENTED__=!0}let iu=null;function ou(){iu=Ns.onunhandledrejection,Ns.onunhandledrejection=function(t){return Ja("unhandledrejection",t),!(iu&&!iu.__SENTRY_LOADER__)||iu.apply(this,arguments)},Ns.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function su(t,e){const n=cu(t,e),r={type:e&&e.name,value:lu(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function au(t,e){return{exception:{values:[su(t,e)]}}}function cu(t,e){const n=e.stacktrace||e.stack||"",r=function(t){return t&&uu.test(t.message)?1:0}(e),i=function(t){return"number"==typeof t.framesToPop?t.framesToPop:0}(e);try{return t(n,r,i)}catch(t){}return[]}const uu=/Minified React error #\d+;/i;function lu(t){const e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function hu(t,e,n,r,i){let o;if(vs(e)&&e.error)return au(t,e.error);if(bs(e)||_s(e,"DOMException")){const i=e;if("stack"in e)o=au(t,e);else{const e=i.name||(bs(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=pu(t,s,n,r),ea(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return ys(e)?au(t,e):Is(e)||Ts(e)?(o=function(t,e,n,r){const i=Aa(),o=i&&i.getOptions().normalizeDepth,s=function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}(e),a={__serialized__:bc(e,o)};if(s)return{exception:{values:[su(t,s)]},extra:a};const c={exception:{values:[{type:Ts(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:du(e,{isUnhandledRejection:r})}]},extra:a};if(n){const e=cu(t,n);e.length&&(c.exception.values[0].stacktrace={frames:e})}return c}(t,e,n,i),na(o,{synthetic:!0}),o):(o=pu(t,e,n,r),ea(o,`${e}`,void 0),na(o,{synthetic:!0}),o)}function pu(t,e,n,r){const i={};if(r&&n){const r=cu(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]})}if(Es(e)){const{__sentry_template_string__:t,__sentry_template_values__:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function du(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(zs(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Fs(r,e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:Fs(r,e)}return""}(t),r=e?"promise rejection":"exception";return vs(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Ts(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}const fu=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(){const e="error";Ya(e,(e=>{const{stackParser:n,attachStacktrace:r}=mu();if(Aa()!==t||zc())return;const{msg:i,url:o,line:s,column:a,error:c}=e,u=function(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],u=isNaN(parseInt(r,10))?void 0:r,l=isNaN(parseInt(n,10))?void 0:n,h=ws(e)&&e.length>0?e:function(){try{return Ps.document.location.href}catch(t){return""}}();return 0===c.length&&c.push({colno:u,filename:h,function:ka,in_app:!0,lineno:l}),t}(hu(n,c||i,void 0,r,!1),o,s,a);u.level="error",Gc(u,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})),Ka(e,ru)}()}(t),gu("onerror")),e.onunhandledrejection&&(function(t){!function(){const e="unhandledrejection";Ya(e,(e=>{const{stackParser:n,attachStacktrace:r}=mu();if(Aa()!==t||zc())return;const i=function(t){if(Ss(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}(e),o=Ss(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:hu(n,i,void 0,r,!0);o.level="error",Gc(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})),Ka(e,ou)}()}(t),gu("onunhandledrejection"))}}};function gu(t){_c&&js.log(`Global Handler attached: ${t}`)}function mu(){const t=Aa();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function yu(t,e,n=250,r,i,o,s){if(!(o.exception&&o.exception.values&&s&&Ds(s.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var c,u;a&&(o.exception.values=(c=_u(t,e,i,s.originalException,r,o.exception.values,a,0),u=n,c.map((t=>(t.value&&(t.value=Fs(t.value,u)),t)))))}function _u(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Ds(r[i],Error)){vu(s,a);const o=t(e,r[i]),u=c.length;bu(o,i,u,a),c=_u(t,e,n,r[i],i,[o,...c],o,u)}return Array.isArray(r.errors)&&r.errors.forEach(((r,o)=>{if(Ds(r,Error)){vu(s,a);const u=t(e,r),l=c.length;bu(u,`errors[${o}]`,l,a),c=_u(t,e,n,r,i,[u,...c],u,l)}})),c}function vu(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function bu(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}const wu=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(t,r,i){const o=i.getOptions();yu(su,o.stackParser,o.maxValueLength,n,e,t,r)}}};const Eu=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Su(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Iu(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Tu(t,e=[]){return[t,e]}function Cu(t,e){const[n,r]=t;return[n,[...r,e]]}function Du(t,e){const n=t[1];for(const t of n)if(e(t,t[0].type))return!0;return!1}function Ou(t){return Ns.__SENTRY__&&Ns.__SENTRY__.encodePolyfill?Ns.__SENTRY__.encodePolyfill(t):(new TextEncoder).encode(t)}function xu(t){const[e,n]=t;let r=JSON.stringify(e);function i(t){"string"==typeof r?r="string"==typeof t?r+t:[Ou(r),t]:r.push("string"==typeof t?Ou(t):t)}for(const t of n){const[e,n]=t;if(i(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let t;try{t=JSON.stringify(n)}catch(e){t=JSON.stringify(vc(n))}i(t)}}return"string"==typeof r?r:function(t){const e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}function Nu(t){const e="string"==typeof t.data?Ou(t.data):t.data;return[Js({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const Au={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Pu(t){return Au[t]}function Lu(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}class Ru extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}}function ku(t,e,n){return e||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(t)}?${function(t,e){return n={sentry_key:t.publicKey,sentry_version:"7",...e&&{sentry_client:`${e.name}/${e.version}`}},Object.keys(n).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(n[t])}`)).join("&");var n}(t,n)}`}const Uu="Not capturing exception because it's already been captured.";class Mu{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=function(t){const e="string"==typeof t?function(t){const e=Eu.exec(t);if(!e)return void Bs((()=>{console.error(`Invalid Sentry Dsn: ${t}`)}));const[n,r,i="",o="",s="",a=""]=e.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const t=u.match(/^\d+/);t&&(u=t[0])}return Iu({host:o,pass:i,path:c,projectId:u,port:s,protocol:n,publicKey:r})}(t):Iu(t);if(e&&function(t){if(!ks)return!0;const{port:e,projectId:n,protocol:r}=t;return!(["protocol","publicKey","host","projectId"].find((e=>!t[e]&&(js.error(`Invalid Sentry Dsn: ${e} missing`),!0)))||(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?e&&isNaN(parseInt(e,10))&&(js.error(`Invalid Sentry Dsn: Invalid port ${e}`),1):(js.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(js.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(e))return e}(t.dsn):fa&&js.warn("No DSN provided, client will not send events."),this._dsn){const e=ku(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:e})}}captureException(t,e,n){const r=Qs();if(ra(t))return fa&&js.log(Uu),r;const i={event_id:r,...e};return this._process(this.eventFromException(t,i).then((t=>this._captureEvent(t,i,n)))),i.event_id}captureMessage(t,e,n,r){const i={event_id:Qs(),...n},o=Es(t)?t:String(t),s=Ss(t)?this.eventFromMessage(o,e,i):this.eventFromException(t,i);return this._process(s.then((t=>this._captureEvent(t,i,r)))),i.event_id}captureEvent(t,e,n){const r=Qs();if(e&&e.originalException&&ra(e.originalException))return fa&&js.log(Uu),r;const i={event_id:r,...e},o=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,o||n)),i.event_id}captureSession(t){"string"!=typeof t.release?fa&&js.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),ca(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){const e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then((n=>e.flush(t).then((t=>n&&t))))):Ic(!0)}close(t){return this.flush(t).then((t=>(this.getOptions().enabled=!1,this.emit("close"),t)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const e=this._integrations[t.name];ya(this,t,this._integrations),e||ma(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=function(t,e,n,r){const i=Lu(n),o=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]])}(t,n&&n.sdk);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:Su(r)},...i&&{trace:Js({...i})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Tu(s,[[{type:o},t]])}(t,this._dsn,this._options._metadata,this._options.tunnel);for(const t of e.attachments||[])n=Cu(n,Nu(t));const r=this.sendEnvelope(n);r&&r.then((e=>this.emit("afterSendEvent",t,e)),null)}sendSession(t){const e=function(t,e,n,r){const i=Lu(n);return Tu({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:Su(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,n){if(this._options.sendClientReports){const n=`${t}:${e}`;fa&&js.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){const n=this._hooks[t]=this._hooks[t]||[];return n.push(e),()=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)}}emit(t,...e){const n=this._hooks[t];n&&n.forEach((t=>t(...e)))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,(t=>(fa&&js.error("Error while sending event:",t),t))):(fa&&js.error("Transport disabled"),Ic({}))}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=function(t,e){const n={};return e.forEach((e=>{e&&ya(t,e,n)})),n}(this,t),ma(this,t)}_updateSessionFromEvent(t,e){let n=!1,r=!1;const i=e.exception&&e.exception.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(e&&!1===e.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(ca(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}_isClientDoneProcessing(t){return new Cc((e=>{let n=0;const r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),e(!0)):(n+=1,t&&n>=t&&(clearInterval(r),e(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(t,e,n,r=Na()){const i=this.getOptions(),o=Object.keys(this._integrations);return!e.integrations&&o.length>0&&(e.integrations=o),this.emit("preprocessEvent",t,e),t.type||r.setLastEventId(t.event_id||e.event_id),$c(i,t,e,n,this,r).then((t=>{if(null===t)return t;const e={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if((!t.contexts||!t.contexts.trace)&&e){const{traceId:n,spanId:r,parentSpanId:i,dsc:o}=e;t.contexts={trace:Js({trace_id:n,span_id:r,parent_span_id:i}),...t.contexts};const s=o||Mc(n,this);t.sdkProcessingMetadata={dynamicSamplingContext:s,...t.sdkProcessingMetadata}}return t}))}_captureEvent(t,e={},n){return this._processEvent(t,e,n).then((t=>t.event_id),(t=>{if(fa){const e=t;"log"===e.logLevel?js.log(e.message):js.warn(e)}}))}_processEvent(t,e,n){const r=this.getOptions(),{sampleRate:i}=r,o=ju(t),s=Bu(t),a=t.type||"error",c=`before send for type \`${a}\``,u=void 0===i?void 0:function(t){if("boolean"==typeof t)return Number(t);const e="string"==typeof t?parseFloat(t):t;if(!("number"!=typeof e||isNaN(e)||e<0||e>1))return e;fa&&js.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`)}(i);if(s&&"number"==typeof u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error",t),Tc(new Ru(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const l="replay_event"===a?"replay":a,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,n,h).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",l,t),new Ru("An event processor returned `null`, will not send event.","log");if(e.data&&!0===e.data.__sentry__)return n;const i=function(t,e,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e;if(Bu(n)&&i)return i(n,r);if(ju(n)){if(n.spans&&s){const e=[];for(const r of n.spans){const n=s(r);n?e.push(n):t.recordDroppedEvent("before_send","span")}n.spans=e}if(o)return o(n,r)}return n}(this,r,n,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Cs(t))return t.then((t=>{if(!Is(t)&&null!==t)throw new Ru(n);return t}),(t=>{throw new Ru(`${e} rejected with ${t}`)}));if(!Is(t)&&null!==t)throw new Ru(n);return t}(i,c)})).then((r=>{if(null===r){if(this.recordDroppedEvent("before_send",l,t),ju(t)){const e=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+e}throw new Ru(`${c} returned \`null\`, will not send event.`,"log")}const i=n&&n.getSession();!o&&i&&this._updateSessionFromEvent(i,r);const s=r.transaction_info;if(o&&s&&r.transaction!==t.transaction){const t="custom";r.transaction_info={...s,source:t}}return this.sendEvent(r,e),r})).then(null,(t=>{if(t instanceof Ru)throw t;throw this.captureException(t,{data:{__sentry__:!0},originalException:t}),new Ru(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)}))}_process(t){this._numProcessing++,t.then((t=>(this._numProcessing--,t)),(t=>(this._numProcessing--,t)))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map((([t,e])=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e}}))}}function Bu(t){return void 0===t.type}function ju(t){return"transaction"===t.type}class Fu extends Mu{constructor(t){const e={parentSpanIsAlwaysRootSpan:!0,...t};!function(t,e,n=[e],r="npm"){const i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map((t=>({name:`${r}:@sentry/${t}`,version:xs}))),version:xs}),t._metadata=i}(e,"browser",["browser"],Wc.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&Wc.document&&Wc.document.addEventListener("visibilitychange",(()=>{"hidden"===Wc.document.visibilityState&&this._flushOutcomes()}))}eventFromException(t,e){return function(t,e,n,r){const i=hu(t,e,n&&n.syntheticException||void 0,r);return na(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),Ic(i)}(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=pu(t,e,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Ic(o)}(this._options.stackParser,t,e,n,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled())return void(_c&&js.warn("SDK not enabled, will not capture user feedback."));const e=function(t,{metadata:e,tunnel:n,dsn:r}){const i={event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:Su(r)}},o=function(t){return[{type:"user_report"},t]}(t);return Tu(i,[o])}(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,n)}_flushOutcomes(){const t=this._clearOutcomes();if(0===t.length)return void(_c&&js.log("No outcomes to send"));if(!this._dsn)return void(_c&&js.log("No dsn provided, will not send outcomes"));_c&&js.log("Sending outcomes:",t);const e=(n=t,Tu((r=this._options.tunnel&&Su(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:oa(),discarded_events:n}]]));var n,r;this.sendEnvelope(e)}}const $u="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Hu={};function Vu(t){Hu[t]=void 0}function Gu(t,e,n=function(t){const e=[];function n(t){return e.splice(e.indexOf(t),1)[0]||Promise.resolve(void 0)}return{$:e,add:function(r){if(!(void 0===t||e.length<t))return Tc(new Ru("Not adding Promise because buffer limit was reached."));const i=r();return-1===e.indexOf(i)&&e.push(i),i.then((()=>n(i))).then(null,(()=>n(i).then(null,(()=>{})))),i},drain:function(t){return new Cc(((n,r)=>{let i=e.length;if(!i)return n(!0);const o=setTimeout((()=>{t&&t>0&&n(!1)}),t);e.forEach((t=>{Ic(t).then((()=>{--i||(clearTimeout(o),n(!0))}),r)}))}))}}}(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Du(i,((e,n)=>{const i=Pu(n);if(function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)){const r=Wu(e,n);t.recordDroppedEvent("ratelimit_backoff",i,r)}else o.push(e)})),0===o.length)return Ic({});const s=Tu(i[0],o),a=e=>{Du(s,((n,r)=>{const i=Wu(n,r);t.recordDroppedEvent(e,Pu(r),i)}))};return n.add((()=>e({body:xu(s)}).then((t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&fa&&js.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=function(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n&&n["x-sentry-rate-limits"],s=n&&n["retry-after"];if(o)for(const t of o.trim().split(",")){const[e,n,,,o]=t.split(":",5),s=parseInt(e,10),a=1e3*(isNaN(s)?60:s);if(n)for(const t of n.split(";"))"metric_bucket"===t&&o&&!o.split(";").includes("custom")||(i[t]=r+a);else i.all=r+a}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}(r,t),t)),(t=>{throw a("network_error"),t})))).then((t=>t),(t=>{if(t instanceof Ru)return fa&&js.error("Skipped sending event because buffer is full."),a("queue_overflow"),Ic({});throw t}))},flush:t=>n.drain(t)}}function Wu(t,e){if("event"===e||"transaction"===e)return Array.isArray(t)?t[1]:void 0}function qu(t,e=function(t){const e=Hu[t];if(e)return e;let n=Xa[t];if(pc(n))return Hu[t]=n.bind(Xa);const r=Xa.document;if(r&&"function"==typeof r.createElement)try{const e=r.createElement("iframe");e.hidden=!0,r.head.appendChild(e);const i=e.contentWindow;i&&i[t]&&(n=i[t]),r.head.removeChild(e)}catch(e){$u&&js.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,e)}return n?Hu[t]=n.bind(Xa):n}("fetch")){let n=0,r=0;return Gu(t,(function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return Vu("fetch"),Tc("No fetch implementation available");try{return e(t.url,s).then((t=>(n-=o,r--,{statusCode:t.status,headers:{"x-sentry-rate-limits":t.headers.get("X-Sentry-Rate-Limits"),"retry-after":t.headers.get("Retry-After")}})))}catch(t){return Vu("fetch"),n-=o,r--,Tc(t)}}))}function zu(t,e,n,r){const i={filename:t,function:"<anonymous>"===e?ka:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Yu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ku=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ju=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Qu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zu=function(...t){const e=t.sort(((t,e)=>t[0]-e[0])).map((t=>t[1]));return(t,n=0,r=0)=>{const i=[],o=t.split("\n");for(let t=n;t<o.length;t++){const n=o[t];if(n.length>1024)continue;const s=Ua.test(n)?n.replace(Ua,"$1"):n;if(!s.match(/\S*Error: /)){for(const t of e){const e=t(s);if(e){i.push(e);break}}if(i.length>=50+r)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Ba(e).function||"")&&e.pop(),e.reverse(),Ma.test(Ba(e).function||"")&&(e.pop(),Ma.test(Ba(e).function||"")&&e.pop()),e.slice(0,50).map((t=>({...t,filename:t.filename||Ba(e).filename,function:t.function||ka})))}(i.slice(r))}}([30,t=>{const e=Yu.exec(t);if(e){const[,t,n,r]=e;return zu(t,ka,+n,+r)}const n=Ku.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=Ju.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,e]=tl(n[1]||ka,n[2]);return zu(e,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],[50,t=>{const e=Xu.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Qu.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||ka;return[n,t]=tl(n,t),zu(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),tl=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:ka,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};class el extends Error{cause;constructor(t,e){super(t),this.cause=e}}class nl{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new nl),this.INSTANCE}captureException(t,e,n){i.error(t),this.getNewScope(e,n).captureException(t)}captureMessage(t,e,n,r){this.getNewScope(n,r).captureMessage(t,e??"error")}captureError(t,e,n,r){i.error(t,e);const o=this.getNewScope(n,r),s=new el(t,e);o.captureException(s)}setGlobalContext(t,e){this.contexts[t]={context:e,...this.contexts[t]}}setUser(t){this.user=t}setTags(t){this.tags=t}getNewScope(t,e){const n=new da;if(n.setClient(this.client),n.setUser(this.user),t?.triggerContext){const e=t.triggerContext;n.setExtras(e.triggerData.sentryContext()),delete t.triggerContext}return t&&n.setExtras(t),this.tags&&n.setTags(this.tags),e&&n.setTags(e),Object.keys(this.contexts).forEach((t=>{n.setContext(t,this.contexts[t])})),n.setTag("language",navigator.language),n.setTag("timezone",Xe.getTimezone()),n}init(){const e=[va(),Ra(),Xc(),Kc(),fu(),wu(),Ha(),{name:"HttpContext",preprocessEvent(t){if(!Wc.navigator&&!Wc.location&&!Wc.document)return;const e=t.request&&t.request.url||Wc.location&&Wc.location.href,{referrer:n}=Wc.document||{},{userAgent:r}=Wc.navigator||{},i={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...t.request,...e&&{url:e},headers:i};t.request=o}}].filter((t=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(t.name)));this.client=new Fu({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:qu,stackParser:Zu,integrations:e,environment:"production",release:`web-sdk@${r.SDK_VERSION}`,debug:t}),this.client.init()}}class rl{static injectRawScript(t){if(!t)return;const e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;const n=document.createElement("style");n.textContent=t,e.appendChild(n)}static injectStylesheet(t,e=document.head){if(!t)return;const n=document.createElement("link");n.rel="stylesheet",n.href=t,e.appendChild(n)}}var il=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function ol(t){return _o(null==t?void 0:t.then)}function sl(t){return _o(t[qo])}function al(t){return Symbol.asyncIterator&&_o(null==t?void 0:t[Symbol.asyncIterator])}function cl(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var ul="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function ll(t){return _o(null==t?void 0:t[ul])}function hl(t){return function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(t){return function(e){return Promise.resolve(e).then(t,u)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(t,e){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||a(t,e)}))},e&&(r[t]=e(r[t])))}function a(t,e){try{(n=i[t](e)).value instanceof yo?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function c(t){a("next",t)}function u(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}(this,arguments,(function(){var e,n,r;return po(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,yo(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,yo(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,yo(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function pl(t){return _o(null==t?void 0:t.getReader)}function dl(t){if(t instanceof Yo)return t;if(null!=t){if(sl(t))return i=t,new Yo((function(t){var e=i[qo]();if(_o(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(il(t))return r=t,new Yo((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(ol(t))return n=t,new Yo((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,Po)}));if(al(t))return fl(t);if(ll(t))return e=t,new Yo((function(t){var n,r;try{for(var i=fo(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(pl(t))return fl(hl(t))}var e,n,r,i;throw cl(t)}function fl(t){return new Yo((function(e){(function(t,e){var n,r,i,o;return function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function(){var s,a;return po(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=fo(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){!function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)}(r,i,(e=t[n](e)).done,e.value)}))}}}(t),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function gl(t,e){return os((function(n,r){var i=0;n.subscribe(ss(r,(function(n){r.next(t.call(e,n,i++))})))}))}function ml(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule((function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()}),r);if(t.add(o),!i)return o}function yl(t,e,n){return void 0===n&&(n=1/0),_o(e)?yl((function(n,r){return gl((function(t,i){return e(n,t,r,i)}))(dl(t(n,r)))}),n):("number"==typeof e&&(n=e),os((function(e,r){return function(t,e,n,r){var i=[],o=0,s=0,a=!1,c=function(){!a||i.length||o||e.complete()},u=function(t){return o<r?l(t):i.push(t)},l=function(t){o++;var a=!1;dl(n(t,s++)).subscribe(ss(e,(function(t){e.next(t)}),(function(){a=!0}),void 0,(function(){if(a)try{o--;for(;i.length&&o<r;)t=void 0,t=i.shift(),l(t);c()}catch(t){e.error(t)}var t})))};return t.subscribe(ss(e,u,(function(){a=!0,c()}))),function(){}}(e,r,t,n)})))}var _l=Array.isArray;var vl=["addListener","removeListener"],bl=["addEventListener","removeEventListener"],wl=["on","off"];function El(t,e,n,r){if(_o(n)&&(r=n,n=void 0),r)return El(t,e,n).pipe(function(t){return gl((function(e){return function(t,e){return _l(e)?t.apply(void 0,mo([],go(e))):t(e)}(t,e)}))}(r));var i=go(function(t){return _o(t.addEventListener)&&_o(t.removeEventListener)}(t)?bl.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return _o(t.addListener)&&_o(t.removeListener)}(t)?vl.map(Sl(t,e)):function(t){return _o(t.on)&&_o(t.off)}(t)?wl.map(Sl(t,e)):[],2),o=i[0],s=i[1];if(!o&&il(t))return yl((function(t){return El(t,e,n)}))(dl(t));if(!o)throw new TypeError("Invalid event target");return new Yo((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return s(e)}}))}function Sl(t,e){return function(n){return function(r){return t[n](e,r)}}}var Il,Tl=/bot|crawl|http|lighthouse|scan|search|spider/i;var Cl=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=ns);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return ho(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(e),!o&&i.push(s.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},e}(Xo),Dl=__webpack_require__(110);class Ol{parser;result={};constructor(){this.parser=Ue.get().getUAParser()}async get(){const t=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},t.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},t.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},t.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},t.navigatorUA=navigator.userAgent,t.isHeadless=navigator.webdriver,t}getDeviceMemory(){const t=navigator;if(!t.deviceMemory)return;const e=t.deviceMemory;this.result.mem={tot:1024*e}}getNetworkType(){const t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){const t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){const t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);const e=window.devicePixelRatio||1,n=t.offsetWidth*e;return document.body.removeChild(t),n}async getLocation(){if(navigator.geolocation&&navigator.permissions)return"granted"==(await navigator.permissions.query({name:"geolocation"})).state?new Promise((t=>{navigator.geolocation.getCurrentPosition((e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()}),(()=>t()))})):void 0}async getBatteryInfo(){if("getBattery"in navigator)try{const t=await navigator.getBattery();this.result.bat={l:100*t.level,c:t.charging}}catch(t){}}}class xl{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;const e=Nn[t]?.toLowerCase();e&&(i.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&"function"==typeof window.clarity}}class Nl{static isOn=!1;static element;static watch(){const t=i.getDebugParam();"1"!==t&&"on"!==t||dh.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),"on"===t?sessionStorage.cooeeDebug="1":"off"===t&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;const e=document.createElement("div");e.innerHTML="• "+(new Date).toLocaleString()+" - "+t,this.element.prepend(e)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),document.body.appendChild(this.element)}static dragElement(){let t=0,e=0,n=0,r=0;const i=i=>{(i=i||window.event).preventDefault(),t=n-i.clientX,e=r-i.clientY,n=i.clientX,r=i.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=t=>{(t=t||window.event).preventDefault(),n=t.clientX,r=t.clientY,document.onmouseup=o,document.onmousemove=i}}static getDebugMillis(){return(new Date).getTime()+216e5}}class Al extends He{static storeName="app";static{this.storage=$e(this.storeName)}}class Pl{static processConfiguration(){const t=s.get();t.gaMeasurementID&&t.gaEnabled&&this.sendClientID()}static async sendClientID(){const t=await this.getClientID();t&&dh.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){const t=await Ge.get(Me.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Ge.set(Me.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){const t=s.get().gaMeasurementID;if(t&&window.gtag)return new Promise((e=>{window.gtag("get",t,"client_id",(t=>{e(t)}))}))}}class Ll{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ll),this.INSTANCE}init(){Al.get(Me.APP_CONFIG,{}).then((t=>this.updateGlobalConfig(t)))}async processAppConfigurations(t){i.log("Received app configuration",t),t.currencyCount=t.currencies?.length;const e=this.updateGlobalConfig(t);Al.set(Me.APP_CONFIG,e).catch((t=>i.error(t))),Pl.processConfiguration(),e.website&&(rl.injectRawScript(e.website.commonJS),rl.injectRawCSS(e.website.commonCSS)),fs.get().onToggle().subscribe((async({open:t})=>{i.info("Cart drawer is now",t?"open":"closed"),t&&(uo.get(tp).loadOrRenderCartWidgets(),await this.trackViewCartEvent())}))}updateGlobalConfig(t){const e=fp.globalRef.config.update(t);return fs.forceUpdate(),i.debug("App configurations",e),e}async trackViewCartEvent(){const t=await Ye.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},n={items:t.items,amount:e,drawer:!0};dh.getInstance().sendEvent(new co(r.EVENT_VIEW_CART,n))}}var Rl=__webpack_require__(318),kl=__webpack_require__.n(Rl);class Ul{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return qe.isShopify()}}const Ml=kl()(fetch),Bl={retryDelay:r.API_CALL_RETRY_DELAY,retryOn:(t,e,n)=>!(t>=r.API_CALL_MAX_ATTEMPTS||!(null!==e||n?.status&&n?.status>=500))};class jl{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new jl),this.INSTANCE}async validateSession(t){return this.post("/v1/event/validate-session",t)}updateUserData(t){this.put("/v1/user/update",t).then((async t=>{i.log("Updated user profile"),await $l.getInstance().storeAndPopulateAuthData(t)})).catch((t=>{i.error("Error saving user profile",t)}))}trackOrder(t){this.post("/v1/event/track-order",t).then((()=>{i.log("Sent Order")})).catch((t=>{i.error("Error sending track order",t)}))}generateDiscount(t){return this.post("/v1/event/generate-discount",t)}updateDeviceProps(t){this.put("/v1/device/update",t).then((()=>{i.log("Updated device property")})).catch((async t=>{i.error("Error saving device property",t)}))}logout(){this.get("/v1/user/logout").then((async t=>{i.log("User logged out"),await $l.getInstance().storeAndPopulateAuthData(t),uo.get(Hl).startNewSession()})).catch((t=>{i.error(t)}))}setAPIToken(t){this.apiToken=t??""}setFirstSeen(t){this.firstSeen=t?.toUTCString()??""}get(t){return this.requestBackend("GET",t)}post(t,e){return this.requestBackend("POST",t,e)}put(t,e){return this.requestBackend("PUT",t,e)}async requestBackend(t,e,n){if(!Ul.isECommerceApp()&&!Ul.getFlags().allowEvents)return i.log(`Rejecting ${t} ${e} as this is not e-commerce app`),Promise.reject();e.startsWith("http")||(e="https://api.sdk.letscooee.com"+e);const r=this.getDefaultHeaders(),o="keepalive"in new Request("");if(n&&!o&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(e,r,n)}catch(t){return nl.getInstance().captureException(t,{body:JSON.stringify(n)}),{}}const s={method:t,headers:r,keepalive:!0};return n&&(s.body=JSON.stringify(n)),this.request(e,s)}async request(t,e){const n={...Bl,...e},r=await Ml(t,n);if(!r.ok)throw r;return r.json()}performXMLHttpRequest(t,e,n){return new Promise(((r,i)=>{const o=new XMLHttpRequest;o.open("POST",t,!0),e.forEach(((t,e)=>{o.setRequestHeader(e,t)})),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{const t=o.getResponseHeader("Content-Type");t?.includes("application/json")?r(JSON.parse(o.responseText)):i(new Error("Content-Type of response header is not json"))}catch(t){i(t)}else i(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{i(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))}))}getDefaultHeaders(){const t=new Headers;return t.set("content-type","application/json"),t.set("cooee-sdk",r.SDK),t.set("cooee-sdk-code",r.SDK_VERSION_CODE.toString()),t.set("cooee-sdk-version",r.SDK_VERSION),t.set("cooee-first-seen",this.firstSeen),this.apiToken&&t.append("cooee-sdk-token",this.apiToken),t}}class Fl{static META_REQUIRED_FIELDS=["ad_id","campaign_id","fbclid"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(t){this.adID=t.adID,this.campaignID=t.campaignID,this.source=t.source}static getAdParams(){let t;try{t=new us.d(location.href)}catch(t){return{}}let e={};const n=this.META_REQUIRED_FIELDS.every((e=>Array.from(t.getParams().keys()).includes(e)));if(n)return e={source:"META",adID:t.getQueryParam("ad_id")?.trim(),campaignID:t.getQueryParam("campaign_id")?.trim()},new Fl(e);const r=this.GOOGLE_REQUIRED_FIELDS.every((e=>Array.from(t.getParams().keys()).includes(e)));return r?(e={source:"GOOGLE"},new Fl(e)):void 0}}class $l{static INSTANCE=new $l;httpAPIService=jl.getInstance();coreService=Ll.getInstance();sentryService=nl.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE}init(t){this.appID=t.appID,this.shopifyShop=t.shopifyShop}async storeAndPopulateAuthData(t){t&&(t.userID&&(this.userID=t.userID,await Ge.set(Me.ID,t.userID)),t.deviceID&&(this.deviceID=t.deviceID,await Ge.set(Me.DEVICE_ID,t.deviceID)),t.sdkToken&&(this.sdkToken=t.sdkToken,await Ge.set(Me.SDK_TOKEN,t.sdkToken)),this.updateAPIClient())}async validateSession(t){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),i.log("Validating session with server");const e=await this.getSessionValidateData(t);try{const t=await this.httpAPIService.validateSession(e);i.log("Validating session Response",t),await this.coreService.processAppConfigurations(t.appSettings),await this.storeAndPopulateAuthData(t)}catch(t){throw i.error(t),t}}async populateUserDataFromStorage(){this.sdkToken=await Ge.get(Me.SDK_TOKEN),this.sdkToken?(this.userID=await Ge.get(Me.ID),this.userID||i.warn("No user ID found in local storage"),this.deviceID=await Ge.get(Me.DEVICE_ID),this.deviceID||i.warn("No device ID found in local storage"),this.updateAPIClient()):i.warn("No SDK token found in local storage")}updateAPIClient(){i.log("SDK Token:",this.sdkToken),i.log("Device ID:",this.deviceID),i.log("User ID:",this.userID),xl.trackDeviceID(this.deviceID),Nl.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.httpAPIService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(t){const e=await(new Ol).get();e.host=location.origin;try{const t=await(0,Dl.A)();t?.isPrivate&&(e.private=!0)}catch(t){n().error("Unable to detect private/incognito window",t)}let i=await Ge.get(Me.DEVICE_ID);return i||(i=(new Wi).toHexString(),await Ge.set(Me.DEVICE_ID,i)),{deviceID:i,deviceProps:e,appID:this.appID,shopifyShop:this.shopifyShop,...t,sdk:r.SDK,page:hs.parseFromCurrent(),ad:Fl.getAdParams(),occurred:this.getSessionStartTime(We.get().jsLoadTime),currentItem:We.get().getCurrentItem(),cart:await Ye.getCurrent().getNormalisedCart(),properties:{}}}async populateFirstSeen(){const t=await Ge.get(Me.FIRST_SEEN),e=t?new Date(t):new Date;t||await Ge.set(Me.FIRST_SEEN,e.toISOString()),this.httpAPIService.setFirstSeen(e),this.sentryService.setGlobalContext("Visitor Info",{first_seen:e.toISOString()})}getSessionStartTime(t){return((new Date).getTime()-t.getTime())/1e3>r.IDLE_TIME_IN_SECONDS?new Date:t}}class Hl{static replaySubject=new Cl(1);static INSTANCE;sentryService=uo.get(nl);lock=new ze;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Hl),this.INSTANCE}init(t){var e;i.debug("Initialising SDK",t),e=navigator.userAgent,Boolean(e)&&function(){if(Il instanceof RegExp)return Il;try{Il=new RegExp(" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/5\\.0\\s[a-z\\.-]+$|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|trace|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab","i")}catch(t){Il=Tl}return Il}().test(e)?i.info("This seems to be a bot. Disabling SDK"):($l.getInstance().init(t),Hl.INSTANCE.checkForNewSession(!0).then((async()=>{Hl.replaySubject.next(!0),Hl.replaySubject.complete()})).catch((t=>i.error("Unable to perform device init",t))))}getCurrentSessionID(){return Ve.set(Me.SESSION_LAST_USED_TIME,(new Date).getTime()),Ve.get(Me.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){const t=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:t[0],number:t[1],landing_page:t[2]}),t}async checkForNewSession(t){await this.lock.acquire();let e=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),t=!0,e=!0):await this.notSynced()&&(e=!0),t){const t=await this.getContext();await $l.getInstance().validateSession({sessionID:t[0],sessionNumber:t[1],landingPage:t[2],newSession:e}),await Ve.set(Me.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){i.debug("Starting new session"),await Ve.clear(),i.debug("Cleared SessionStorage before starting new session");const t=new Date,e=(new Wi).toHexString();i.debug("New session ID to be used",e);const n=await Ge.get(Me.SESSION_NUMBER,0)+1;Nl.prepend(`New Session ID: <strong>${e}</strong> & number: ${n}`),await Promise.all([Ge.set(Me.SESSION_NUMBER,n),Ve.set(Me.ID,e),Ve.set(Me.SESSION_LAST_USED_TIME,t.getTime()),Ve.set(Me.SESSION_LANDING_PAGE,hs.parseFromCurrent())])}getLandingPage(){return Ve.get(Me.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ge.get(Me.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await Ve.get(Me.ID))return!0;const t=await Ve.get(Me.SESSION_LAST_USED_TIME,0);return!t||((new Date).getTime()-t)/1e3>r.IDLE_TIME_IN_SECONDS}async notSynced(){return!await Ve.get(Me.SESSION_SYNCED,!1)}}class Vl{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach((t=>{t instanceof qn&&this.loadFamily(t.typography?.fam)}))}async loadFamily(t){if(!t?.fonts)return;if(this.loadedFonts.indexOf(t.name)>-1)return;const e=[];t.fonts.forEach((n=>{if(n.url){const i=new FontFace(r.COOEE+t.name,n.getURL(),n.getFontDescriptor());e.push(i.load())}})),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach((t=>{document.fonts.add(t)}))}}class Gl{static updateIdentity(t){if(!this.isInstalled())return;const e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),i.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&"object"==typeof window.klaviyo}}var Wl,ql;!function(t){t[t.CAMERA=1]="CAMERA",t[t.LOCATION=2]="LOCATION",t[t.PUSH=3]="PUSH"}(Wl||(Wl={})),function(t){t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION"}(ql||(ql={}));class zl{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=dh.getInstance(),this.triggerContext=e}async execute(){const t=this.containsCTA()?r.EVENT_TRIGGER_CLICKED:r.EVENT_TRIGGER_CLOSED;switch(this.action.at!==ql.SUBMIT_FORM&&this.closeTriggerAndSendEvent(t),this.action.at){case ql.ACCEPT_POPUP:break;case ql.GO_TO_URL:this.gotoURLAction();break;case ql.SHARE:this.shareAction();break;case ql.SUBMIT_FORM:this.collectFormData();break;case void 0:break;default:return void i.error("Received an invalid ClickActionType: ",this.action.at)}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;Xe.isValidURL(t)||(t=`//${t}`),window.open(t,"_self")}}prompt(){const t=this.action.pmpt;t&&(t===Wl.LOCATION&&this.promptLocationPermission(),t===Wl.PUSH&&this.promptPushNotificationPermission(),t===Wl.CAMERA&&this.promptCameraPermission())}closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),this.dispatchEvent()}shareAction(){this.action.share&&(navigator.share?navigator.share({text:this.action.share.text,title:"Share"}).then((t=>console.log(t))).catch((t=>console.error(t))):i.warn("Navigator.share is not compatible with this browser"))}containsCTA(){return!(!this.action.at||this.action.at===ql.REJECT_POPUP)||!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return!t||0===Object.keys(t).length}promptLocationPermission(){navigator.geolocation&&navigator.permissions&&navigator.geolocation.getCurrentPosition((t=>{this.apiService.updateDeviceProps({coords:[t.coords.latitude,t.coords.longitude]}),this.sendPermissionData()}))}promptPushNotificationPermission(){"Notification"in window?"default"===Notification.permission?Notification.requestPermission().then((()=>{this.sendPermissionData()})):this.apiService.updateDeviceProps({pnPerm:Notification.permission}):i.warn("This browser does not support desktop notification")}promptCameraPermission(){navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally((()=>{this.sendPermissionData()}))}checkPermission(t){return navigator.permissions.query({name:t}).then((t=>t.state.toString()))}async checkAllPermission(){return{camera:await this.checkPermission("camera"),location:await this.checkPermission("geolocation"),notification:Notification.permission}}sendPermissionData(){this.checkAllPermission().then((t=>{this.apiService.updateDeviceProps({perm:t})}))}collectFormData(){const t={};for(const e of this.triggerContext.inputs){if(!e.isValid)return;const n=document.getElementById(e.id).value;e.type===vn.EMAIL_INPUT?t.email=n:e.type===vn.PHONE_INPUT&&(t.mobile=n)}this.closeTriggerAndSendEvent(r.EVENT_FORM_SUBMITTED,{form:t}),Xe.showSnackbar("Coupon applied on cart"),Gl.updateIdentity(t)}dispatchEvent(){const t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};document.dispatchEvent(new CustomEvent(r.CTA_EVENT,{detail:e}));const n={action:this.containsCTA()?r.CAMPAIGN_CLICKED_ACTIVITY:r.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(r.POPUP_ACTIVITY_EVENT,{detail:n}))}}class Yl{scalingFactor;constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};const e={display:t.disp};return t.of&&(e.objectFit=t.of),"absolute"===t.pos&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){const e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};const e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){const e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};const e={};if(t.glossy){const n="backdrop-filter",r="-webkit-"+n,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(r,i)&&!CSS.supports(n,i))return{background:t.glossy.fallback.rgba};if(e[r]=i,e[n]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};const n=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,n){if(n??={},"LINEAR"===t.type){let r=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(r+=`, ${t.c3}`),r+=")",n[e]=r}return n}getColourStyles(t,e="color",n){return n??={},t?t.grad?this.getGradientStyles(t.grad,e,n):(t.hex&&(n[e]=t.rgba),n):n}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}}class Kl{renderer=Ue.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,n){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=n,this.stylesConverter=new Yl(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();const t={...this.getDisplayStyles(),...this.getSpaceStyles(),...this.getBorderStyles(),...this.getBackgroundStyles(),boxSizing:"border-box",outline:"none"};this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){const t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){const t=this.inappElement.alpha;if(!isNaN(t)){const e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){const t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){const t=new jn(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){const t=this.inappElement.clc;t&&0!==Object.keys(t).length&&(this.inappHTMLEl.addEventListener("click",(e=>{e.stopPropagation(),new zl(t,this.triggerContext).execute()})),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}}class Jl extends Kl{constructor(t,e,n){super(t,e,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){const t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=r.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){const n=[];e.u&&n.push("underline"),e.st&&n.push("line-through"),n.length||n.push("normal"),this.renderer.setStyle(t,"font-weight",e.b?"bold":"normal"),this.renderer.setStyle(t,"font-style",e.i?"italic":"normal"),this.renderer.setStyle(t,"text-decoration",n.join(" ")),this.renderer.setStyle(t,"color",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){const t=this.inappElement.typography.ta;let e=t?bn[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}}class Xl extends Jl{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach((t=>{const e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)})),this.processCommonBlocks()}}class Ql extends Kl{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}}class Zl extends Kl{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}}class th extends Kl{parent;static MAX_Z_INDEX="2147483647";constructor(t,e,n){super(t,e,n),this.parent=t,this.inappHTMLEl=this.renderer.createElement("div")}render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(r.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",th.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){const t=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(this.renderer.setStyle(this.inappHTMLEl,"width","100%"),this.renderer.setStyle(this.inappHTMLEl,"height","100%")):(this.renderer.setStyle(this.inappHTMLEl,"width","100vw"),this.renderer.setStyle(this.inappHTMLEl,"height","100vh")),this.renderer.setStyle(this.inappHTMLEl,"top","0"),this.renderer.setStyle(this.inappHTMLEl,"left","0");else{const e=this.inappElement.spc,n=this.stylesConverter.getScaledSize(t.w)+e.getHorizontal(),r=this.stylesConverter.getScaledSize(t.h)+e.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",r+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return{display:"flex",...this.inappElement.getStylesForWrapper(),...this.inappElement.getFlexStylesForContainer()}}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded())return void this.renderer.setStyle(this.inappHTMLEl,"position","block");this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}}class eh extends Kl{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(r.IN_APP_CONTAINER_NAME),this}}class nh extends Jl{borderColor="";constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){const t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",(t=>{t.stopPropagation()})),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}}class rh extends nh{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(t,e,n){super(t,e,n)}setInputType(){const t=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",t),t}addListener(t,e){t.addEventListener("keydown",(n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),t.value.match(rh.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(e,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(e,!1)),n.stopPropagation()}))}}class ih extends nh{static MOBILE_REGEX=/^\d+$/;constructor(t,e,n){super(t,e,n)}setInputType(){const t=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",t),t}addListener(t,e){t.addEventListener("keydown",(n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),t.value.match(ih.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(e,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(e,!1)),n.stopPropagation()}))}}class oh extends Jl{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();const t={flex:"1 1 0",...this.stylesConverter.getBackgroundStyles(this.inappElement.bg),...this.stylesConverter.getBorderStyles(this.inappElement.br),...this.stylesConverter.getSpaceStyles(this.inappElement.spc),marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)};this.addStylesToTimer(t)}getBackgroundStyles(){return{}}processFontBlock(){const t=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.addStylesToTimer(t),t}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(t){this.elements.forEach((e=>this.renderer.setStyles(e,t)))}addTimerChildren(){const t=this.inappElement.show;this.elements=[],t.day&&this.elements.push(this.getChild(oh.DAYS)),t.hour&&this.elements.push(this.getChild(oh.HOURS)),t.minute&&this.elements.push(this.getChild(oh.MINUTES)),t.second&&this.elements.push(this.getChild(oh.SECONDS)),this.elements.forEach((t=>this.inappHTMLEl.appendChild(t)))}getChild(t){const e=this.renderer.createElement("div"),n=this.renderer.createElement("span"),r=this.renderer.createElement("span");return r.innerText=t,n.innerText="00",n.id=`lc-${t}`,this.renderer.setStyle(r,"font-size","0.5em"),this.renderer.setStyle(r,"text-align","center"),this.renderer.setStyle(r,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),"start"===this.inappElement.lblPos?(e.appendChild(r),e.appendChild(n)):(e.appendChild(n),e.appendChild(r)),this.renderer.setStyle(e,"display","flex"),this.renderer.setStyle(e,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(e,"justify-content","center"),this.renderer.setStyle(e,"align-items","center"),this.renderer.setStyle(e,"gap","5px"),this.spans.push(n),e}processAndStartTimer(){const t=this.inappElement.timer.start(this.inappElement.timerType,(t=>{this.spans.forEach((e=>{e.id===`lc-${oh.DAYS}`?e.innerText=String(t.days).padStart(2,"0"):e.id===`lc-${oh.HOURS}`?e.innerText=String(t.hours).padStart(2,"0"):e.id===`lc-${oh.MINUTES}`?e.innerText=String(t.minutes).padStart(2,"0"):e.id===`lc-${oh.SECONDS}`&&(e.innerText=String(t.seconds).padStart(2,"0"))}))}));this.triggerContext.intervals.push(t)}}class sh extends Jl{constructor(t,e,n){super(t,e,n),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",(t=>{t.stopPropagation()})),t.addEventListener("change",(()=>{const e=new rn(JSON.parse(t.value));this.updateItems(e)}))}updateItems(t){const e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];const n=this.parentHTMLEl.querySelector(`#coo-${vn.PRODUCT_IMAGE}`);if(!n)return;const r=t.imgs[0]??e.imgs?.at(0);r?.url&&n.setAttribute("src",r.url)}addOptions(){const t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length)return void e.add(this.createOption(this.inappElement.placeholderText));const n=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach((t=>{e.add(this.createOption(t.name??"Default",t,t.mID===n?.vID))}))}createOption(t,e,n){const r=this.renderer.createElement("option");return r.text=t,r.value=JSON.stringify(e),n&&(r.selected=!0),e||(r.disabled=!0),r}}class ah extends Zl{constructor(t,e,n){super(t,e,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}}class ch{static ACTIVE_TRIGGER_DATA;renderer=Ue.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(t){this.safeHTTP=dh.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(t)}setParentContainer(t){this.parent=t??document.body,this.renderer.setParentContainer(this.parent)}render(t){this.renderEngagement(new Rr(t))}async renderEngagement(t){if(t.previewType||!ch.ACTIVE_TRIGGER_DATA){if(ch.ACTIVE_TRIGGER_DATA=t,this.triggerContext=new gs(new Date,t),this.triggerContext.onClose((t=>{this.closeInApp(t)})),this.ian=t.ian,(this.renderer.isMobile()||"mobile"===t.previewType)&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){const t=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(t)}await this.preloadImages(t),t.shouldDelay()?window.setTimeout((()=>{this.withCartDrawerClosed()}),t.getDelaySeconds()):this.withCartDrawerClosed()}else{const e={triggerShown:new ao(ch.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(t,e)}}withCartDrawerClosed(){fs.get().isOpen()&&this.renderer.isMobile()?this.cartDrawerToggleSubscription=fs.get().onToggle().subscribe((({open:t})=>{!t&&this.startRenderingOnce()})):this.startRenderingOnce()}startRenderingOnce(){if(We.get().isGoKwikPopupOpen)this.skipTrigger(this.triggerContext.triggerData,{reason:"GoKwik popup is open"});else{try{this.startRendering()}catch(t){return void nl.getInstance().captureException(t,{triggerData:JSON.stringify(this.triggerContext.triggerData)})}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new th(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(t){throw i.error(t),t}}sendTriggerDisplayed(){const t={};this.triggerContext.triggerData.items?.length&&(t.promotedMIDs=this.triggerContext.triggerData.items?.map((t=>t.mID)));const e=new co(r.EVENT_TRIGGER_DISPLAYED,t,this.triggerContext.triggerData);this.safeHTTP.sendEvent(e);const n={action:r.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(r.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(t){const e=t.eventName;delete t.eventName;const n=new co(e,t,this.triggerContext.triggerData);n.name===r.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map((t=>t.toEmbed()))),this.safeHTTP.sendEvent(n)}addEnterAnimation(t){this.containerHTMLElement.animate(t.getEnterAnimation(),{duration:500})}renderElement(t,e,n){e instanceof tr?new rh(t,e,n).render():e instanceof er?new ih(t,e,n).render():e instanceof zn?new Xl(t,e,n).render():e instanceof nr?new ah(t,e,n).render():e instanceof Hn?new Zl(t,e,n).render():e instanceof $n?new Ql(t,e,n).render():e instanceof Jn?new oh(t,e,n).render():e instanceof Zn?new sh(t,e,n).render():i.error("Unsupported element type- "+e.type)}renderContainer(t){const e=this.ian?.cont;e&&(this.containerHTMLElement=new eh(this.rootContainer,e,t).render().getHTMLElement(),(new Vl).loadAllFonts(this.ian),this.ian.elems?.forEach((async e=>{await this.renderElement(this.containerHTMLElement,e,t)})),this.addEnterAnimation(this.ian.anim))}closeInApp(t){const e=this.ian.anim.getExitAnimation();this.sendTriggerClosed(t),ch.ACTIVE_TRIGGER_DATA=void 0,this.containerHTMLElement.animate(e,{duration:500,easing:"ease-in-out"}).onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){Ue.get().removeInApp(this.triggerContext)}skipTrigger(t,e){const n=new co(r.EVENT_CAMPAIGN_REJECTED,e,t);this.safeHTTP.sendEvent(n)}async preloadImages(t){const e=t.ian;if(!e)return;const n=[];e.elems.forEach((t=>{const e=t.bg?.img?.src;if(e&&n.push(this.getPromise(e)),t.t===vn.IMAGE){const e=t.src;if(!e)return;n.push(this.getPromise(e))}})),e.bg?.img?.src&&n.push(this.getPromise(e.bg.img.src)),e.cont.bg?.img?.src&&n.push(this.getPromise(e.cont.bg.img.src)),await Promise.all(n)}getPromise(t){return new Promise((e=>{const n=new Image;n.onload=e,n.src=t,n.style.display="none"}))}}class uh{triggerData;safeHttpService=dh.getInstance();render(t){t.contentSource===R.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if("klaviyoForms"!==t.type)return;const e=t.detail;if(e.formId===this.triggerData.klaviyoFormID)switch(e.type){case"open":this.safeHttpService.sendEvent(new co(r.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{const t=this.getFormDetails(e);this.safeHttpService.sendEvent(new co(r.EVENT_FORM_SUBMITTED,{form:t},this.triggerData)),this.safeHttpService.updateProfile(t);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new co(r.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData))}else i.warn("Received invalid trigger callback")}getFormDetails(t){const e={id:t.formId},n=t.metaData;if(Je.hasKeys(n)){const t=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach((r=>{t.includes(r)||(e[r]=n[r])})),e.email=n.$email??n.email,e.mobile=n.$phone_number??n.phone_number;const r=n.$first_name??n.first_name,i=n.$last_name??n.last_name;(r?.length||i?.length)&&(e.name=r+" "+i)}return e}}class lh{static trackIntent(t){if(!this.isInstalled())return void i.log("Facebook pixel not installed");if(!s.get().pixelPush)return void i.log("Facebook pixel push not enabled");const e=Nn[t.intent]?.toLowerCase(),n=t.segmentName;(e||n)&&(i.debug(`Sending ${e} intent and ${n} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&"function"==typeof window.fbq}}class hh{static sentryService=nl.getInstance();static httpApiService=jl.getInstance();static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){const e=(await Ye.getCurrent().getNormalisedCart()).items.map((t=>t.mID));t.items=t.items.filter((t=>!e.includes(t.mID)))}if(t.isCartRecovery()){const e=Ye.getCurrent().items,n=[];for(const r of t.items)for(const t of r.vars){const i=e.find((e=>e.variant_id.toString()===t.mID));if(!i)continue;const o=new on(r);o.name=i.title;const s=new rn(t);s.name=i.variant_title,s.price.d=i.discounted_price/100,o.variants=[s],n.push(o)}return n}if(s.get().currencyCount<=1)return t.items;const e=t.items.length,n=t.items.map((e=>this.updatedItem(e,t.engagementID))),i=(await Promise.all(n)).filter((t=>null!=t));if(e&&!i.length){const e="Failed to fetch any product from Ajax API",n=new co(r.EVENT_CAMPAIGN_FAILED,{reason:e,currency:t.currency},t);throw dh.getInstance().sendEvent(n),new Error(e)}return i}static async updatedItem(t,e){const n=t;let r;const o=qe.getRootPrefix()+`products/${n.slug}.js`;try{r=await this.httpApiService.request(o)}catch(t){return i.error(`Failed to fetch ${o}`,t),t instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${t.status}`,"error",{item:n,path:o},{"engagement.id":e}):this.sentryService.captureException(t,{item:n,path:o},{"engagement.id":e}),null}return r?(n.name=r.title,n.vars.map((t=>{const e=r.variants.find((e=>e.id===+t.mID));t.name=e.title,t.price.d=e.price?e.price/100:e.price,t.price.cmp=e.compare_at_price?e.compare_at_price/100:e.compare_at_price})),n):(i.error("Item not found after AJAX call for:",n),null)}}class ph{static INSTANCE;httpService=uo.get(jl);sentryService=uo.get(nl);sessionManager=uo.get(Hl);runtime=We.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new ph),this.INSTANCE}sendSilently(t){this.send(t).catch((e=>i.error(`Failed to send ${t.name}`,e)))}async send(t){i.debug(`Sending event ${t.name}`),Nl.prepend(`Sending event <strong>${t.name}</strong> with id ${t.id}`),this.shouldReject(t)?i.info(`Rejecting event ${t.name}`):(await Promise.all([this.addSessionContext(t),this.addShopifyContext(t)]),this.addShopifyAttributes(),t.name!==r.EVENT_APP_BACKGROUND&&this.runtime.setActive(),t.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",t).then((async e=>{i.log("Event tracked:",t.name),Nl.prepend(`Event <strong>${e.eventName}</strong> tracked`),this.processEventResponse(t,e)})).catch((e=>{i.error(`Error sending event ${t.name} to server`,e)})))}shouldReject(t){if("test"===t.trigger?.triggerID||"preview"===t.trigger?.triggerID)throw Error("Not sending event as this is a test trigger");return!1}async addSessionContext(t){const e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=hs.parseFromCurrent()}async addShopifyContext(t){if(qe.isShopify())try{t.cart=await Ye.getCurrent().getNormalisedCart()}catch(t){i.error("Error fetching Shopify cart before sending the event",t)}}processEventResponse(t,e){this.renderWidgetIfAny(t,e).catch((n=>{i.error("Failed to display a campaign",n,t,e),this.sentryService.captureException(n,{event:t,response:e})})),this.utiliseIntentIfCalculated(e),$l.getInstance().storeAndPopulateAuthData(e)}async renderWidgetIfAny(t,e){if(!e.triggerData)return void i.log(`Nothing to engage after ${t.name}`);i.log(`Campaign(id=${e.triggerData.shortID}) will be shown`,e.triggerData);const n=new Rr(e.triggerData);let r;n.occurred=t.occurred;try{r=await hh.refreshItems(n)}catch(t){return void i.error("Failed to refresh the products",t)}n.items=r,n.contentSource!==R.KLAVIYO?(new ch).renderEngagement(n).catch((e=>{i.error("Failed to render popup",e),this.sentryService.captureException(e,{event:t,triggerData:n})})):(new uh).render(n)}utiliseIntentIfCalculated(t){t.intent&&(xl.trackIntent(t.intent),lh.trackIntent(t),Nl.prepend(`Intent is <strong>${Nn[t.intent]}</strong>`))}addShopifyAttributes(){qe.isShopify()&&Ye.getCurrent().addCooeeAttributes().catch((t=>{i.error("Fail to add attributes in cart",t)}))}}class dh{static INSTANCE;httpApiService=jl.getInstance();eventAPIService=ph.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new dh),this.INSTANCE}sendEvent(t){i.debug(`Waiting for auth to send event ${t.name}`),Hl.replaySubject.subscribe((async()=>{this.eventAPIService.sendSilently(t)}))}updateProfile(t){Hl.replaySubject.subscribe((()=>{this.httpApiService.updateUserData(t??{})}))}trackOrder(t){Hl.replaySubject.subscribe((()=>{this.httpApiService.trackOrder(t)}))}updateDeviceProps(t){Hl.replaySubject.subscribe((()=>{this.httpApiService.updateDeviceProps({props:t})}))}logout(){Hl.replaySubject.subscribe((()=>{this.httpApiService.logout()}))}generateDiscount(t){return this.httpApiService.generateDiscount(t)}}var fh=0;function gh(t,e,n,r,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)"ref"==a?s=e[a]:c[a]=e[a];var u={type:t,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fh,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===c[a]&&(c[a]=s[a]);return $.vnode&&$.vnode(u),u}Array.isArray;class mh{static navigate(t,e,n){const o=`${location.origin}/discount/${t}`;switch(i.log(`Applying discount code ${t}`,e,n),e){case O.CART_PAGE:location.href=`${o}?redirect=/cart`;break;case O.CART_DRAWER:location.href=`${o}?redirect=${location.pathname}#${r.HASH_OPEN_CART_DRAWER}=1`;break;case O.SHOPIFY_CHECKOUT:location.href=`${o}?redirect=/checkout`;break;case O.THIRD_PARTY_CHECKOUT:location.href=`${o}?redirect=/cart#${r.HASH_INITIATE_CHECKOUT}=1`;break;default:location.href=`${o}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(t,e){switch(t){case O.CART_PAGE:location.href="/cart";break;case O.SHOPIFY_CHECKOUT:location.href="/checkout";break;case O.THIRD_PARTY_CHECKOUT:location.href=`/cart#${r.HASH_INITIATE_CHECKOUT}=1`;break;case O.CART_DRAWER:default:{const t=fs.get();!t.isOpen()&&t.open(),t.refreshUI(e)}}}static async applyWithStorefront(t){const e=s.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");const n=new Headers;n.append("Content-Type","application/json"),n.append("X-Shopify-Storefront-Access-Token",e);const i={method:"POST",headers:n,body:JSON.stringify({query:"\nmutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart {\n id\n }\n userErrors {\n field\n message\n }\n }\n}\n",variables:{cartId:`gid://shopify/Cart/${Ye.getCurrent().token}`,discountCodes:[t]}})};await jl.getInstance().request(r.GRAPHQL_API_PATH,i)}}class yh{listen(){document.addEventListener(r.CTA_EVENT,(async t=>{await this.processEvent(t)}),!1)}async performAddToCart(t,e){if(!t.length)return;const n=t.map((t=>{const{vID:n,quantity:r}=this.getVIDAndQuantity(t);return{id:n?+n:+t.mID,quantity:r,properties:e.getPrivateAttributesForLineItem()}})),r=qe.getCartURL("cart/add.js"),o={items:n},s=fs.get();s.isMiniCart()?o.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(o.sections=s.element.getSectionsToRender?.().map((t=>t.section??t.id)));const a=JSON.stringify(o);try{const e=await fetch(r,{body:a,method:"post",headers:{"Content-Type":"application/json"}});if(200===e.status||302===e.status)return i.log(`Added ${t.length} items to Cart`),Xe.showSnackbar("Product added to your cart"),e.json()}catch(t){i.error("Failed to add product in cart",t)}}async performUpdate(t,e){if(!Je.hasKeys(e))return void i.warn("No update fields provided");const n=qe.getCartURL("cart/change.js"),r={id:+t.vID,...e},o=JSON.stringify(r);try{const e=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});200!==e.status&&302!==e.status||(i.log(`Updated ${t}`),Ye.getCurrent().update(e.json()))}catch(e){i.error("Failed to update item in cart",e,t)}}async performCopyCoupon(t){if(t)try{await navigator.clipboard.writeText(t),i.log(`Code-${t} copied`),Xe.showSnackbar("Discount code copied")}catch(t){i.error("Failed to copy code",t)}}performGoToItem(t){if(!t?.link)return;const e=qe.getProductSlug(t.link);e&&(location.pathname=qe.getRootPrefix()+"products/"+e)}async upgradeToSubscription(t,e){if(!t)return void i.warn("Trying to upgrade to subscription with no item");const n=await Ye.getCurrent().getNormalisedCart(),r=t.selectedOrFirstVariant.value,o=n.items.findIndex((t=>t.vID===r.mID)),s=r.selectedSellingPlan.value,a=qe.getCartURL("cart/change.js"),c={line:o+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},u=JSON.stringify(c);try{const e=await fetch(a,{body:u,method:"post",headers:{"Content-Type":"application/json"}});200!==e.status&&302!==e.status||(i.log(`Upgraded ${t} selling plan`),Xe.showSnackbar("Line item updated"),Ye.getCurrent().update(e.json()))}catch(t){i.error("Failed to update subscription for item in cart",t)}}async processEvent(t){const e=t?.detail;if(!e)return;const n=e.clickAction,r=e.items,o=e.triggerData;if(n.at){const t=n;if(i.log(`Performing ${JSON.stringify(t)} action`),t.at===ql.GO_TO_PRODUCT)r?.length&&this.performGoToItem(r[0]);else if(t.at===ql.ADD_TO_CART)r?.length&&await this.performAddToCart(r,o);else if(t.at===ql.COPY_COUPON_CODE)await this.performCopyCoupon(o.discount.code);else if(t.at===ql.OPEN_CART)fs.get().open();else if(t.at===ql.GO_TO_COLLECTION){const t=e.collections;if(!t?.length)return;location.pathname=qe.getRootPrefix()+"collections/"+t[0].handle}}n.applyDiscount&&o.discount?.code&&mh.navigate(o.discount.code,o.redirectBehaviour)}getVIDAndQuantity(t){let e,n;if(t instanceof Ze)e=t.vID,n=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,n=1}return{vID:e,quantity:n}}}class _h{triggerContext;element;safeHTTP=dh.getInstance();constructor(t,e){this.triggerContext=t,this.element=e}async execute(t){const e=t.clickAction||this.element?.clc;if(!e)return;const r=t.item,o=this.triggerContext,s=new yh,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount.type&&!!e?.applyDiscount;let u,l={selectedVariants:o.triggerData.nonMutableItems.map((t=>({itemMID:t.mID,mID:t.selectedOrFirstVariant.value.mID}))),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},h="",p=[],d=r?[r.toEmbed()]:[];if(e.at===ql.ADD_BUNDLE){const e=o.selectedItems;if(d=t.embeddedItems??e.map((t=>t.toEmbed())),o.shouldGiveFBTDiscount||t.embeddedItems?.length){let n;n=t.embeddedItems?t.embeddedItems.map((t=>({itemMID:t.mID,mID:t.vID,quantity:t.quantity}))):e.map((t=>({itemMID:t.mID,mID:t.selectedOrFirstVariant.value.mID})));const r=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&r&&n.push({itemMID:r.mID,mID:r.selectedOrFirstVariant.value.mID}),l.selectedVariants=n}else l=void 0;p=t.embeddedItems??e}else if(e.at===ql.INITIATE_CHECKOUT){const t=await Ye.getCurrent().getNormalisedCart();d=t.items,l.selectedVariants=t.items.map((t=>({itemMID:t.mID,mID:t.vID})))}else if(e.at===ql.ADD_TO_CART)p=[r];else if(e.at===ql.GO_TO_PRODUCT)h=qe.getRootPrefix()+"products/"+r.slug;else if(e.at===ql.GO_TO_URL){const t=Xe.isValidURL(e.gu?.u);t&&(h=t.pathname+t.search+t.hash)}else e.at===ql.UPGRADE_TO_SUBSCRIPTION&&(await s.upgradeToSubscription(r,o.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(d,{from:"button"}),i.debug({redirectPath:h,redirectBehaviour:a,hasDiscount:c}),!c&&h)return void(location.href=h);let f,g=!1;try{u=await this.getOrGenerateDiscountCode(l),i.debug("Discount code (if any) to apply",u)}catch(t){if(!this.triggerContext.triggerData.isBYOB())return void n().error("Unable to get a discount code",t)}u&&e.at===ql.COPY_COUPON_CODE&&await(new yh).performCopyCoupon(u);try{u&&await mh.applyWithStorefront(u)}catch(t){i.error(t),g=!0}p?.length&&(f=await s.performAddToCart(p,o.triggerData)),g&&u?mh.navigate(u,a,h):h?location.href=h:mh.navigateWithoutDiscount(a,f)}sendTriggerClicked(t,e){const n=r.EVENT_TRIGGER_CLICKED,i=new co(n,e,this.triggerContext.triggerData);i.items=t,this.safeHTTP.sendEvent(i)}async getOrGenerateDiscountCode(t){if(!t?.selectedVariants?.length)return void i.warn("No variant selected for the discount");const e=this.triggerContext.triggerData.discount;if(!e?.type)return;let n="";if(e.type===M.STATIC){if(!e.code)throw nl.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(n=await this.generateDiscount(t),!n)throw i.error("No discount code found",t),new Error("Discount code not found or generated");return n}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw Xe.showSnackbar("Failed to generate a discount code"),i.error("Error generating discount code",e,t),nl.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}}class vh extends at{stylesConverter=new Yl(1);renderer=Ue.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new _h(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),{...this.stylesConverter.getFlexStyles(this.mediaStyle.flex),...this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg),...this.stylesConverter.getBorderStyles(this.mediaStyle.br),...this.stylesConverter.getSizeStyles(this.mediaStyle.size),...this.stylesConverter.getSpaceStyles(this.mediaStyle.spc),...this.stylesConverter.getLayoutStyles(this.mediaStyle.lout),boxSizing:"border-box",outline:"none",...this.getComponentStyles(),...this.props.style}}matchWhenCondition(t){if(!t?.op)return!0;const{lhs:e,rhs:n}=t;switch(t.op){case"eq":return e===n;case"gt":return+e>+n;case"gte":return+e>=+n;case"lt":return+e<+n;case"lte":return+e<=+n;case"ne":return e!==n;case"null":return null==e;case"empty":return""===e.trim();default:return i.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){const t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle={...this.mediaStyle,...t.style.sm})}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t){await this.clickExecutor.execute(t)}}class bh extends vh{componentDidMount(){this.setState((()=>({text:this.props.element.text}))),le(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){const t=this.getCompiledStyles();let e=this.state.text;return e||(t.display="none",e=""),gh("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:gh("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(null==this.props.element.text)return;const t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData},n=Le.render(JSON.stringify(this.props.element),e),r=new pr(JSON.parse(n));this.matchWhenCondition(r.when)?this.setState((()=>({text:r.text}))):this.setState((()=>({text:""})))}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Wn;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return{...this.getTypoStyles()}}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}}class wh extends bh{render(){return gh("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:gh("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.props.element.text}})})}getComponentStyles(){return{...super.getComponentStyles(),cursor:"pointer"}}}class Eh extends at{render(){if(this.props.element.show[this.props.label.toLowerCase()])return"end"===this.props.element.lblPos?gh("div",{style:{...this.getElementStyle(),...this.props.styles},children:[gh("span",{children:this.props.time}),gh("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):gh("div",{style:{...this.getElementStyle(),...this.props.styles},children:[gh("span",{style:this.getTimeLabelStyle(),children:this.props.label}),gh("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){const t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}}class Sh extends bh{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState((()=>({...this.labels}))),this.processAndStartTimer()}render(){return gh("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map((t=>gh(Eh,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element})))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return{...super.getComponentStyles(),...this.getDisplayStyles()}}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,(t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState((()=>({...this.labels})))}))}}class Ih extends vh{componentDidMount(){le((()=>{this.setState((()=>({checked:this.props.item.selected.value})))}))}render(){return gh("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:gh("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){const{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Wn;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return{...this.getTypoStyles(),display:"flex"}}}class Th extends vh{constructor(t,e){super(t,e)}render(){const t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return gh("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){const t=this.mediaStyle.lout;if(!t||"absolute"!==t.pos)return{};const e={zIndex:t.zIndex};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){const e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}}class Ch extends vh{render(){if(!this.props.element.hide&&this.matchWhenCondition(this.props.element.when))return gh("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:gh(Mh,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){const t=this.mediaStyle.flex??new sr,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return"nowrap"===t.wrap&&t.scroll&&("column"===t.dir?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}}class Dh extends Ch{render(){if(!this.props.element.hide&&this.matchWhenCondition(this.props.element.when))return gh("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:gh(Nh,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}}class Oh extends vh{render(){return gh("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){le((()=>{this.setState((()=>({disabled:!!this.props.triggerContext.triggerData.isBundle()&&!this.props.item.selected.value})))}))}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Wn;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){const t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),{...t,...this.getTypoStyles()}}createSelectItems(){const t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(gh("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(const n of e.sellingPlans??[])t.push(gh("option",{value:n.mID,selected:n.isSelected,children:n.name}));return t}onChange(t){const e=t.target.value;this.props.selectedVariant.selectedSellingPlan.value=e?this.props.selectedVariant.sellingPlans.find((t=>t.mID===e)):void 0}}class xh extends vh{render(){return gh("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){le((()=>{this.setState((()=>({disabled:!!this.props.triggerContext.triggerData.isBundle()&&!this.props.item.selected.value})))}))}getTypoStyles(){const t={},e=this.mediaStyle.typo??new Wn;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){const t={};return 1===this.props.item.vars?.length&&"Default Title"===this.props.item.vars[0].name&&(t.visibility="hidden"),{...t,...this.getTypoStyles()}}createSelectItems(){const t=[];for(const e of this.props.item.vars)t.push(gh("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){const e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find((t=>t.mID===e))}}class Nh extends vh{constructor(t,e){super(t,e),this.setState((()=>({decoration:"unset"})))}renderElement(t){if(!t.hide&&this.matchWhenCondition(t.when)){if(t.t===vn.FLEXBOX){const e=t;return gh(Dh,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===vn.CHECKBOX){if(!this.props.triggerContext.triggerData.isBundle())return;return gh(Ih,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}if(t.t===vn.PRODUCT_IMAGE){const e=t,n=this.props.item,r=n.variantImage??n.imageURL,i=n.variantSecondaryImage??n.secondaryImageURL;e.lg=e.sm={src:r,name:n.name,secondarySrc:i};const o=gh(Th,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?o:gh("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:o})}if(t.t===vn.PRODUCT_TITLE)return this.renderProductTitle(t);if(t.t===vn.PRODUCT_VARIATIONS){const e=t;if(this.props.triggerContext.triggerData.isCartEmbed()&&1===this.props.item.vars?.length&&"Default Title"===this.props.item.vars[0].name)return;return gh(xh,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===vn.PRODUCT_VARIATIONS_SELLING_PLANS?gh(Oh,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===vn.PRODUCT_BUTTON||t.t===vn.BUTTON?gh(wh,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):gh(Mh,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map((t=>this.renderElement(t)))}getComponentStyles(){return{}}renderProductTitle(t){const e=gh(bh,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:gh("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState((()=>({decoration:"underline"})))}onMouseLeave(){this.setState((()=>({decoration:"unset"})))}}class Ah extends vh{productElement;constructor(t,e){super(t,e),this.setState((()=>({decoration:"unset"})))}render(){const t=JSON.stringify(this.props.element),e=Le.render(t,this.getProductData());if(this.productElement=new Ir(JSON.parse(e)),!this.productElement.hide&&this.matchWhenCondition(this.productElement.when))return gh("div",{style:{...this.getCompiledStyles()},class:"lc-single-product",children:gh(Nh,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};const t=this.props.item.selectedOrFirstVariant.value,e=t.price,n=this.props.item.name,r=this.props.item.category,i=Xe.formatCurrency(e.d,!0),o=this.props.item.variantImage??this.props.item.imageURL,s=this.props.item.meta,a=e.cmp&&e.cmp>e.d,c={name:n,price:i,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,image_url:o,meta:s,effective_price:e.effective,category:r};if(a){c.compare_price=Xe.formatCurrency(e.cmp);const t=e.cmp-e.d;c.discount_percent=(t/e.cmp*100).toFixed(0),c.discount_price=Xe.formatCurrency(t)}return{product:c,variant:{name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity}}}}function Ph(){return new Promise((t=>{const e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";if(Array.from(document.scripts).some((t=>t.src.includes(e))))return void t();const n=document.createElement("script");n.src=e,n.onload=()=>{t()},document.body.appendChild(n)}))}function Lh(t,e){if(!t||!window.Swiper)return;const n=new window.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(t,n)=>`\n <span class="${n}"\n style="background-color: ${e.pagination.color?.rgba};"></span>\n `,renderProgressbar:t=>`\n <span class="${t}"\n style="background-color: ${e.pagination.color?.rgba};">\n </span>\n `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:!!e.autoplay?.enabled&&{delay:e.autoplay?.delay,disableOnInteraction:!1},autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function Rh(t,e,n){const r={color:t.navigation.color?.rgba};return t.pagination.enabled&&(r.transform="translateY(-25%)"),gh("div",{class:"swiper-container",ref:e,children:[gh("div",{class:"swiper-wrapper",children:n()}),t.navigation.enabled&&gh("div",{class:"swiper-button-next",style:r,children:gh("span",{})}),t.navigation.enabled&&gh("div",{class:"swiper-button-prev",style:r,children:gh("span",{})}),t.pagination.enabled&&gh("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}class kh extends vh{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===Rn.CAROUSAL&&Ph().then((()=>{this.swiperInstance=Lh(this.swiperRef,this.props.element.conf[this.deviceTypeKey])}))}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){const t=this.props.triggerContext.triggerData.items;let e;if(t.splice(this.configuration.maxItems??10),this.configuration.disp===Rn.CAROUSAL){const n=t=>{this.swiperRef=t},r=()=>t?.map((t=>gh("div",{class:"swiper-slide",children:this.getProductFragment(t)})));e=gh("div",{style:{...this.getCompiledStyles(),display:"block"},class:"lc-product-swiper-list",children:Rh(this.configuration,n,r)})}else e=gh("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map(((e,n)=>this.getProductFragment(e,n!==t.length-1)))});return e}getComponentStyles(){const t=[Rn.SIMPLE_SCROLL,Rn.CAROUSAL].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if("row"===e.flexDirection)if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===Rn.GRID){const t=this.props.triggerContext.triggerData,n=t.items.length;let r;r=t.isBundle()?!0!==this.props.element.prod.symbol?.hide?2*n-1:n:this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${r}, auto)`}return e}getProductFragment(t,e=!1){return gh(st,{children:[gh(Ah,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&gh("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:gh(bh,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}}class Uh extends vh{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){Ph().then((()=>{this.swiperInstance=Lh(this.swiperRef,this.props.element.conf)}))}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){const t=this.props.element;return Rh(t.conf,(t=>{this.swiperRef=t}),(()=>t.values?.map((t=>gh("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(t)}),children:this.renderElement(t)})))))}getComponentStyles(){return{}}renderElement(t){const e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case vn.IMAGE:return gh(Th,{element:e,triggerContext:this.props.triggerContext});case vn.FLEXBOX:return gh(Ch,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:i.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){const n=JSON.stringify(t),r=Le.render(n,{form:e});return Sr.getParsedElement(JSON.parse(r))}getClickAction(t){const e={...this.props.element.clc},n=JSON.stringify(e),r=Le.render(n,{form:t});return JSON.parse(r)}}class Mh extends vh{constructor(t,e){super(t,e),this.setState((()=>({decoration:"unset"}))),le((()=>{this.setState((()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length})))}))}renderElement(t){if(!t.hide){if(t.t===vn.FLEXBOX){const e=t;return gh(Ch,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===vn.COUNTDOWN_TIMER)return gh(Sh,{element:t,triggerContext:this.props.triggerContext});if(t.t===vn.BUTTON){if(!this.state.showButton)return;return gh(wh,{element:t,triggerContext:this.props.triggerContext})}return t.t===vn.TEXT?gh(bh,{element:t,triggerContext:this.props.triggerContext}):t.t===vn.IMAGE?gh(Th,{element:t,triggerContext:this.props.triggerContext}):t.t===vn.PRODUCTS?gh(kh,{element:t,triggerContext:this.props.triggerContext}):t.t===vn.PRODUCT?gh(Ah,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext}):t.t===vn.CAROUSEL?gh(Uh,{element:t,triggerContext:this.props.triggerContext}):void 0}}render(){return this.props.elements.map((t=>this.renderElement(t)))}getComponentStyles(){return{}}}class Bh extends vh{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===ql.GO_TO_URL&&this.clickAction.gu?.u}componentDidMount(){le((()=>{const t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)}))}render(){return gh(st,{children:[gh("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:gh(Mh,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),"preview"===this.props.triggerContext.triggerData.id&&gh("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){const t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t){if(this.isClickable)return super.onClick(t)}}class jh{engagementTrigger;static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=We.get();widgetAPIService=uo.get(tp);safeHTTPService=uo.get(dh);scrollSubscription;variation;isExclusionWithBVariation;constructor(t){this.engagementTrigger=t,this.triggerContext=new gs(new Date,this.engagementTrigger)}renderSilently(){this.render().catch((t=>nl.getInstance().captureException(t,{...this.engagementTrigger.sentryContext()})))}destroy(){i.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach((t=>{t?.disconnect&&t.disconnect()})),this.rootContainer?.remove(),jh.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){const t=await this.getVariation();if(!t)return void i.warn(`${this.engagementTrigger} no variation found for device`);this.handleVariationResponse(t)}this.rootContainer=await this.getWidgetContainer(!0),this.rootContainer?(this.widget=this.engagementTrigger.widget,await this.getWidgetData(),this.shouldStopRendering()||(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)):i.warn(`${this.engagementTrigger} no section found to render the widget`)}isSameTrigger(t){return this.engagementTrigger.shortID===t.shortID}update(t){n().log(`${this.engagementTrigger} will be updated`),this.updateItems(t.items,this.engagementTrigger.items)}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getWidgetData(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget)return void i.log(`${this.engagementTrigger} already has required data to render widget`);const t=await this.observeWidgetContainerInViewport();t?this.handleVariationResponse(t):i.warn(`No variation found for device in ${this.engagementTrigger}`)}handleVariationResponse(t){t.items?.length&&(this.engagementTrigger.items=t.items.map((t=>new on(t))),this.engagementTrigger.nonMutableItems=t.items.map((t=>new on(t)))),t.bundleFrom&&(this.engagementTrigger.bundleFrom=new on(t.bundleFrom)),t.discount&&(this.engagementTrigger.discount=t.discount),t.placement&&(this.triggerContext.triggerData.placement=t.placement),t.props&&Je.hasKeys(t.props)&&(this.engagementTrigger.props={...this.engagementTrigger.props,...t.props}),this.triggerContext.triggerData.widget=this.widget=new xr(t.widget),this.triggerContext.triggerData.contentID=t.contentID,this.triggerContext.triggerData.variation=this.variation=t.variation,this.triggerContext.triggerData.placement=t.placement,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&"b"===this.variation,this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px")}addToRendered(){jh.renderedEngagements.push(this)}getVariation(){return this.widgetAPIService.getTreatment({engagementID:this.engagementTrigger.engagementID,isPreview:"preview"===this.engagementTrigger.id})}async observeWidgetContainerInViewport(){if(!this.rootContainer)return void i.warn("No root container found to register Intersection observer",this.engagementTrigger.shortID);const t=.3*window.innerHeight,e={root:null,rootMargin:`-${t}px 0px ${t}px 0px`,threshold:0};return await this.isInViewport()?this.getVariation():new Promise((t=>{const n=new IntersectionObserver(((e,n)=>{e.forEach((async e=>{if(e.isIntersecting){i.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);const e=await this.getVariation();t(e),n.unobserve(this.rootContainer)}}))}),e);n.observe(this.rootContainer),this.observers.push(n)}))}attachScroll(){this.scrollSubscription=El(window,"scroll").pipe(cs(jh.DEBOUNCE_TIME)).subscribe((()=>{this.checkAndSendEvent()}))}async checkAndSendEvent(){const t=this.engagementTrigger.shortID;if(jh.engagementIDsWithTrackedDisplay.has(t))return;if(!await this.isInViewport())return;const e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.engagementTrigger.items?.map((t=>t.mID)));const n=this.isExclusionWithBVariation?r.EVENT_CAMPAIGN_HOLDOUT:r.EVENT_TRIGGER_DISPLAYED,i=new co(n,e,this.engagementTrigger);i.name===r.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),jh.engagementIDsWithTrackedDisplay.add(t),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}async isInViewport(){const t=(await this.getWidgetContainer())?.getBoundingClientRect();if(!t)return!1;const e=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(t.bottom,e)-Math.max(t.top,0))*t.width/(t.width*t.height)*100;return this.engagementTrigger.isAnySplit()?n>0:n>=30}async getWidgetContainer(t){if(this.rootContainer?.isConnected)return this.rootContainer;const e=await this.createParentElementWithPlacement(t);if(e)return e;const n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(t){const e=this.engagementTrigger.placement;if(!e?.selector)return i.warn(`${this.engagementTrigger} does not have a selector`),null;i.debug(`${this.engagementTrigger} attempt to render ${e.position}-${e.selector}`);const n=await Xe.retrySelector(e.selector);if(!n)return i.warn(`${this.engagementTrigger} no placement found with ${e.selector}`),null;const r=this.generateParentElementID(),o=this.getParentElement(r);if(!t)return o;switch(e.position){case D.BEFORE:n.parentElement?.insertBefore(o,n);break;case D.INSIDE_FIRST:n.insertBefore(o,n.firstChild);break;case D.INSIDE_LAST:n.appendChild(o);break;case D.AFTER:default:n.parentElement?.insertBefore(o,n.nextSibling)}return o}async startRendering(){let t;try{t=await hh.refreshItems(this.engagementTrigger)}catch(t){return void i.error(`${this.engagementTrigger} error refreshing the items`,t)}t?.length||!this.engagementTrigger.isProductPromoted()?(this.engagementTrigger.items=t,this.renderContainer()):i.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`)}getParentElement(t){let e=document.getElementById(t);if(e)return e;const n=this.engagementTrigger.shortID;return e=document.createElement("div"),e.id=t,e.className=`letscooee letscooee-engagement engagement-${n}`,e.dataset.engagementId=n,"preview"===this.engagementTrigger.id&&(e.className+=" letscooee-preview"),e.style.display="block",e.style.minHeight="0.5px",e}renderContainer(){if(!this.widget)return;let t=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){const e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=s.get().website.commonCSS;n&&rl.injectRawCSS(n,e),rl.injectStylesheet("https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@latest/dist/widget-sdk.min.css",e),rl.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",e),t=e}Tt(it(Bh,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),t),this.addToRendered()}updateItems(t,e){const n=this.getItemDiff(t,e),r=this.getItemDiff(e,t);e.push(...n);for(const t of r)j.remove(e,t)}getItemDiff(t,e){return t.filter((t=>!e.some((e=>e.selectedOrFirstVariant.value.mID===t.selectedOrFirstVariant.value.mID))))}}class Fh extends jh{static renderedEngagements=[];constructor(t){super(t)}addToRendered(){Fh.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let t=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(t+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),t}async checkAndSendEvent(){if(fs.get().isOpen()||"cart"===this.runtimeData.pageName)return super.checkAndSendEvent();i.log("Do not send display event as neither the cart drawer nor the cart page is open.")}}class $h{engagementTrigger;element;cartItems;constructor(t,e){this.engagementTrigger=t,this.element=e,this.cartItems=Ye.getCurrent().items}static renderCartUpsell(t){const e=t.placement;if(!e?.selector)return void i.warn(`No placement available for ${t.objective}`,t.shortID);const n=Array.from(document.querySelectorAll(e.selector));if(n?.length)for(const e of n)new $h(t,e).render();else i.warn(`No placement found for ${t.objective}`,t.shortID)}render(){const t=this.findCartItemFromHTMLElement();if(!t)return;if(this.engagementTrigger.skipSubscribedItems&&t.selling_plan_allocation)return;const e=this.engagementTrigger.items.find((e=>e.mID===t.product_id.toString()));if(!e)return;const n=e.vars.find((e=>e.mID===t.id.toString()));if(!n)return;const r=new rn(n),i=t.selling_plan_allocation?.selling_plan;if(i)for(const t of r.sellingPlans??[])t.mID===i.id.toString()&&(t.isSelected=!0,r.changeSellingPlan(t));const o=new on(e);o.vars=[r],o.selectedOrFirstVariant.value=r;const s=`lc-cart-item-${this.engagementTrigger.shortID}-${e.mID}`;this.element.classList.add(s);const a=new Rr(this.engagementTrigger);a.placement.selector=`.${s}`,a.items=[o];const c=new Fh(a);c.renderSilently(),this.watchForCartItemDeletion(c,s)}watchForCartItemDeletion(t,e){const n=new MutationObserver((r=>{r.forEach((r=>{r.removedNodes.forEach((r=>{r===this.element&&(i.debug(`${e} has been removed`),t.destroy(),n.disconnect())}))}))}));n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){const t=this.element.innerHTML;return this.cartItems.find((e=>{if(!t.includes(e.url)&&!t.includes(e.variant_id)){if(!t.includes(e.product_title))return!1;if(e.variant_title&&!t.includes(e.variant_title))return!1}const n=e.selling_plan_allocation?.selling_plan?.name;return!(n&&!t.includes(n))}))}}function Hh(t){return(n=(e=t)[e.length-1])&&_o(n.schedule)?t.pop():void 0;var e,n}function Vh(t,e){return void 0===e&&(e=0),os((function(n,r){n.subscribe(ss(r,(function(n){return ml(r,t,(function(){return r.next(n)}),e)}),(function(){return ml(r,t,(function(){return r.complete()}),e)}),(function(n){return ml(r,t,(function(){return r.error(n)}),e)})))}))}function Gh(t,e){return void 0===e&&(e=0),os((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Wh(t,e){if(!t)throw new Error("Iterable cannot be null");return new Yo((function(n){ml(n,e,(function(){var r=t[Symbol.asyncIterator]();ml(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function qh(){for(var t,e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(void 0===(i=1)&&(i=1/0),yl(zo,i))((t=n,(e=Hh(n))?function(t,e){if(null!=t){if(sl(t))return function(t,e){return dl(t).pipe(Gh(e),Vh(e))}(t,e);if(il(t))return function(t,e){return new Yo((function(n){var r=0;return e.schedule((function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())}))}))}(t,e);if(ol(t))return function(t,e){return dl(t).pipe(Gh(e),Vh(e))}(t,e);if(al(t))return Wh(t,e);if(ll(t))return function(t,e){return new Yo((function(n){var r;return ml(n,e,(function(){r=t[ul](),ml(n,e,(function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)}),0,!0)})),function(){return _o(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(pl(t))return function(t,e){return Wh(hl(t),e)}(t,e)}throw cl(t)}(t,e):dl(t)));var i}class zh extends Fh{ctaListener=new yh;constructor(t){super(t),ds.get().subscriber(r.CART_UPDATE_BROADCAST).pipe(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Hh(t);return os((function(e,r){(n?qh(t,e,n):qh(t,e)).subscribe(r)}))}(null)).subscribe(this.checkMilestone.bind(this))}update(t){super.update(t),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected)return void this.addToRendered();const t=this.widgetElement=document.createElement("cooee-progressbar");t.className="cooee-root",t.cart=Ye.getCurrent(),t.engagementTrigger=this.engagementTrigger,t.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered()}async checkMilestone(){const t=await Ye.getCurrent().getNormalisedCart(),e=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find((e=>e.minValue<t.amount));if(e){if(i.log("Current milestone",e),e.rewardType===U.FREE_AUTO_GIFT){const n=e.items[0];if(t.items.find((t=>t.vID===n.vID||t.mID===n.mID)))return i.log(`Item(vID:${n.vID}) already present in the cart. Updating item's properties`),void await this.ctaListener.performUpdate(n,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});{const t=await this.ctaListener.performAddToCart([n],this.engagementTrigger);fs.get().refreshUI(t,!1),await this.removeOtherFreeGifts(n)}}}else i.log("No milestone achieved yet")}async removeOtherFreeGifts(t){const e=(await Ye.getCurrent().getNormalisedCart()).items.filter((e=>e.vID!==t?.vID&&e.properties[r.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID));if(e.length)for(const t of e)await this.ctaListener.performUpdate(t,{quantity:0})}}const Yh=new Ir({t:12,style:{lg:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"100%",h:"auto"},br:{r:4,w:0,s:1,c:{h:"#94a3b8",a:100}}},sm:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"240px",h:"auto"},br:{r:0,w:0,s:1,c:{h:"#94a3b8",a:100}}}},elems:[{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}}},clc:{},elems:[{t:13,style:{lg:{spc:{mb:5},size:{w:"70px",h:"auto"},lout:{of:"cover"}},sm:{spc:{mb:5},size:{w:"80px",h:"auto"},lout:{of:"cover"}}},src:"{{{ product.image_url }}}"},{t:4,style:{lg:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:7,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}}},clc:{},elems:[{t:14,style:{lg:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#313131",a:100},ta:0,fw:600,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#575757",a:100},ta:0,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.name }}"},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:14,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:12,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.compare_price }}"},{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:14,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.price }}"},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"Save {{ product.discount_price }}",when:{lhs:"{{ product.discount_price }}",op:"gt",rhs:0}},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#0d8d00",a:100},ta:1,fw:400,ls:0,fam:{name:"DINNextRoundedLTPro-Medium"}}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"({{ product.discount_percent }}% off)",when:{lhs:"{{ product.discount_percent }}",op:"gt",rhs:0}}]},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:3,style:{lg:{spc:{p:7,pl:7,pr:7,pt:7,pb:7},size:{w:"100%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{p:7,pl:7,pr:7,pt:8,pb:8},size:{w:"70%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"Add",clc:{at:102},allowedTypes:[102]}]}]}]}]}),Kh=new pr({t:2,style:{lg:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}},sm:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}}},text:"WATCH & SHOP - NEW LAUNCHES"});class Jh extends vh{render(){return gh("div",{style:{marginTop:30},class:"lc-container",children:[gh(bh,{element:Kh,triggerContext:this.props.triggerContext}),gh("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map((t=>{if(t.portraitVideos?.length)return gh("div",{class:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[gh("a",{href:t.link,onClick:()=>{this.sendTriggerClicked([new Ze(t)],{from:"video"})},children:gh("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),gh(Ah,{element:Yh,item:t,triggerContext:this.props.triggerContext})]})}))})]})}getSources(t){const e=t.map((t=>gh("source",{src:t.url,type:t.mimeType,media:`(max-width:${t.width}px)`}))),n=t.filter((t=>"mp4"===t.format)).sort(((t,e)=>e.width-t.width))[0];n&&e.push(gh("source",{src:n.url,type:n.mimeType}));const r=t.filter((t=>"m3u8"===t.format)).sort(((t,e)=>e.width-t.width))[0];return r&&e.push(gh("source",{src:r.url,type:r.mimeType})),e}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}}class Xh extends jh{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){Tt(it(Jh,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}}class Qh extends jh{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){const t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(r.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){const e=this.engagementTrigger,n=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,r=t.detail;if(!Je.hasKeys(r))return void i.error(`No detail received for ${n}`);i.log("Detail received for BYOB",r);const o=r.campaignID??r.campaignId??r.campaign_id;if(o!==e.shortID&&o!==e.engagementID)return void i.warn(`Current ${n} is not BYOB. Received: ${o}`);const s=r.items;if(!s?.length)return;const a=s.map((t=>new Ze({mID:t.product_id,vID:t.variant_id,quantity:t.quantity||1})));await new _h(this.triggerContext).execute({embeddedItems:a,clickAction:{at:ql.ADD_BUNDLE,applyDiscount:!0}})}}class Zh{runtimeData=We.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;const e=[...Fh.renderedEngagements];Fh.renderedEngagements.length=0;for(const n of t)i.log(`${n} received as cart embed`),this.findAndUpdateCurrent(n,e)||(i.log(`${n} is new`),n.isProgressBar()?new zh(n).renderSilently():n.isSubscriptionUpsell()?$h.renderCartUpsell(n):new Fh(n).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){const e=[...jh.renderedEngagements];jh.renderedEngagements.length=0;for(const n of t)i.log(`${n} received as page embed`),this.findAndUpdateCurrent(n,e)||(i.log(`${n} is new`),n.isShoppableVideo()?new Xh(n).renderSilently():n.isBYOB()?new Qh(n).renderSilently():new jh(n).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){const n=e.findIndex((e=>e.isSameTrigger(t)));return!(n<0||t.isSubscriptionUpsell()||(e[n].update(t),e[n].renderSilently(),e.splice(n,1),0))}removeOldWidgets(t){for(const e of t)e.destroy()}}class tp{static INSTANCE;httpService=uo.get(jl);sessionManager=uo.get(Hl);runtimeData=We.get();loadWidgetsSubject=new Xo;constructor(){this.loadWidgetsSubject.pipe(cs(300)).subscribe((()=>{this.loadCartWidgets().catch((t=>i.error("Unable to initiate cart widgets",t))),this.loadPageWidgets().catch((t=>i.error("Unable to initiate page widgets",t)))})),ds.get().subscriber(r.CART_UPDATE_BROADCAST).subscribe((()=>this.loadWidgetsSubject.next()))}static getInstance(){return this.INSTANCE||(this.INSTANCE=new tp),this.INSTANCE}loadOrRenderCartWidgets(){this.runtimeData.isCartDirty?this.loadCartWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){Hl.replaySubject.subscribe((async()=>{this.loadPageWidgets().catch((t=>i.error("Unable to initiate load page widgets",t)))}))}loadCartWidgetsSilently(){Hl.replaySubject.subscribe((async()=>{this.loadWidgetsSubject.next()}))}async loadPageWidgets(){const t=await this.getWidgetProps();i.log("Load widgets",t),this.httpService.post("/v1/engagement/page-widgets",t).then((async t=>{const e=t.widgets.map((t=>new Rr(t)));(new Zh).processPageWidgetResponse(e)})).catch((t=>{i.error("Error sending widget getter",t)}))}async loadCartWidgets(){const t=await this.getWidgetProps();i.log("Load cart widgets",t),this.httpService.post("/v1/engagement/cart-widgets",t).then((async t=>{const e=t.widgets.map((t=>new Rr(t)));(new Zh).processCartWidgetResponse(e)})).catch((t=>{i.error("Error sending widget getter",t)}))}async getTreatment(t){i.log("Load widget data for ",t.engagementID);const e=await this.getWidgetProps();try{return this.httpService.post("/v1/engagement/get-variant",{...t,...e})}catch(t){i.error("Error getting widget data",t)}}renderCachedCartWidgets(){(new Zh).processCartWidgetResponse(this.runtimeData.cartEngagements)}async addSessionContext(t){const e=await this.sessionManager.checkSessionAndGetContext();t.sessionID=e[0],t.sessionNumber=e[1],t.landingPage=e[2],t.page=hs.parseFromCurrent()}addAvailableEngagementShortIDs(){const t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach((t=>{const n=t.dataset.engagementId;n&&+n&&e.push(n)})),e}async getWidgetProps(){const t={};t.engagementIDs=this.addAvailableEngagementShortIDs(),await this.addSessionContext(t),t.currentItem=this.runtimeData.getCurrentItem();try{t.cart=await Ye.getCurrent().getNormalisedCart()}catch(t){i.error("Error fetching Shopify cart before sending widget call",t)}const e=new URLSearchParams(location.search),n=e.get("cooee-preview");n?t.previewIDs=n.trim().split(",").filter((t=>Number.isInteger(+t))):this.runtimeData.previewIDs?.length&&(t.previewIDs=this.runtimeData.previewIDs);const r=e.get("cooee-variant");return r?t.previewVariant=r:this.runtimeData.previewVariant&&(t.previewVariant=this.runtimeData.previewVariant),t}}class ep{runtimeData=We.get();widgetAPIService=uo.get(tp);meddle(){const t=fp.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){const t=fp.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.previewWidget=fp.previewWidget.bind(fp),t.previewPopup=fp.previewPopup.bind(fp)}overwritePush(t,e){Qe(t,"push",e)}meddleAccount(){this.overwritePush(fp.globalRef.account,((...t)=>{this.processAccount(t[0])})),fp.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(fp.globalRef.events,((...t)=>{this.processEvent(t[0])})),fp.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(fp.globalRef.profile,((...t)=>{this.processProfile(t[0])})),fp.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(fp.globalRef.screen,((...t)=>{this.processPageName(t[0])})),fp.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&fp.authenticate(t),t.flags&&Ul.setFlags(t.flags))}processEvent(t){t&&(r.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?fp.sendEvent(t[0],t[1],this.runtimeData.jsLoadTime):fp.sendEvent(t[0],t[1]))}processProfile(t){t&&fp.updateProfile(t)}processPageName(t){t&&fp.setPageName(t)}meddlePage(){this.overwritePush(fp.globalRef.page,((...t)=>{this.processPage(t[0])})),fp.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.pageName&&fp.setPageName(t.pageName)}}class np{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=r.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}}class rp{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=uo.get(dh);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(t){this._lastScreenOrScroll=t}static getInstance(){return this.INSTANCE||(this.INSTANCE=new rp),this.INSTANCE}resetScrollID(t){np.remove(r.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=t??new Date}listen(){if(window.scrollY){const t=this.getPercentScrolledY();this.shouldSendScroll(t)&&this.sendScroll(t)}Xe.onDocumentLoaded((()=>{this.observeWindowScroll()}))}observeWindowScroll(){El(window,"scroll").pipe(cs(rp.DEBOUNCE_TIME),gl((()=>{const t=this.getPercentScrolledY();if(!(t>100))return this.shouldSendScroll(t)?t:void 0;i.warn("Received scroll percent is more than 100",t)}))).subscribe((t=>{this.sendScroll(t)}))}shouldSendScroll(t){return Math.abs(this.lastPercent-t)>=rp.THRESHOLD||this.lastPercent!==t&&100===t}sendScroll(t){if(null==t)return;const e={percent:t,timeMS:(new Date).getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=t;const n=np.getString(r.SESSION_STORAGE_SCROLL_ID,""),i=new co(r.EVENT_SCROLL,e,null,n);this.safeHttpService.sendEvent(i),np.setString(r.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){const t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}}class ip{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=uo.get(dh);runtimeData=We.get();listen(){document.onvisibilitychange=()=>{"visible"===document.visibilityState?this.onVisible():"hidden"===document.visibilityState&&this.onHidden()}}async onVisible(){}async onHidden(){const t=await this.runtimeData.setInactive();if(0===t)return void i.info("Not sending background event as user was inactive on website");i.info(`Sending background event with ${t} seconds`);const e={};e[ip.ACTIVE_DURATION]=t,this.apiService.sendEvent(new co(r.EVENT_APP_BACKGROUND,e))}}class op{compareCartItemSubject=new Xo;constructor(){this.compareCartItemSubject.pipe(cs(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){const t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",(function(){t.performEvent(this._url).catch((t=>i.error("Unable to process cart change in XMLHttpRequest",t)))})),e.apply(this,arguments)},i.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){const t=this,e=window.fetch;window.fetch=function(n){return e.apply(window,arguments).then((e=>(t.performEvent(n.toString()).catch((t=>i.error("Unable to process cart change in fetch",t))),e)))},i.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(We.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){const n=t?.items,o=e.items,s=[],a=[];if(i.debug(`Comparing cart change with old count ${n?.length} to new count ${o.length}`),o?.forEach((t=>{const e=n?.find((e=>e.vID===t.vID));if(e){if(e.quantity!==t.quantity){const n=e.quantity<t.quantity,r=Math.abs(e.quantity-t.quantity),i={...t,quantity:r};n?s.push(i):a.push(i)}n&&Xe.removeFromArray(n,e)}else s.push(t)})),n)for(const t of n)a.push(t);i.debug(`Cart delta: added: ${s.length}, removed: ${a.length}`),s.length&&this.sendEvent(r.EVENT_ADD_TO_CART,{items:s}),a.length&&t.token===e.token&&this.sendEvent(r.EVENT_REMOVE_FROM_CART,{items:a}),(a.length||s.length)&&ds.get().broadcast(r.CART_UPDATE_BROADCAST,{itemsAdded:s,itemsRemoved:a})}sendEvent(t,e){const n=new co(t,e);uo.get(dh).sendEvent(n)}async compareCartItems(){const t=await Ge.get(Me.CURRENT_CART,{}),e=await Ye.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}}class sp{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){const t=this,e=window.fetch;window.fetch=async function(n,r){try{await t.modifyRequest(n,r)}catch(t){nl.getInstance().captureError("Failed to modify graphql request",t,{body:JSON.stringify(r?.body)})}return e(n,r)},i.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){const n="string"==typeof t?t:t instanceof Request?t.url:"";if(!n.includes("graphql.json")||"POST"!==e?.method)return;if(!e.body)return;i.log("Intercepted fetch request of:",n);const r="string"==typeof e.body?JSON.parse(e.body):e.body;r.query.includes("cartCreate")&&(e.body=await this.updatedBody(r),this.sendBuyNowEvent())}async updatedBody(t){const e=await Ge.get(Me.DEVICE_ID),n=await uo.get(Hl).getCurrentSessionID(),r=t.variables.input.attributes??[],i=[{key:"letscooee_did",value:e},{key:"letscooee_sid",value:n},{key:"__letscooee_time",value:(new Date).toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}];return t.variables.input.attributes=[...r,...i],JSON.stringify(t)}sendBuyNowEvent(){const t=We.get().getCurrentItem();if(!t)return;const e=new co(r.EVENT_BUY_NOW_CLICKED,{items:[t]});dh.getInstance().sendEvent(e)}}class ap{selectors;eventName;static INSTANCE;elements;selectorString;constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}clickListenerCallback=t=>{const e=t.currentTarget,n=new co(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});dh.getInstance().sendEvent(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch((t=>i.error(t)))}async listen(){this.elements=await Xe.retrySelectorForElements(this.selectorString),this.elements.forEach((t=>{t.addEventListener("click",this.clickListenerCallback)}))}removeClickListener(t){this.elements?.forEach((e=>{e.removeEventListener("click",t)}))}}class cp extends ap{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(cp.selectors,r.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new cp),this.INSTANCE}}class up extends ap{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(up.selectors,r.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new up),this.INSTANCE}}class lp{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){Xe.onDocumentLoaded((()=>{i.debug("Execution order:","document ready"),this.useLocationHash()}))}useLocationHash(){const t=window.location.hash?.substring(1);if(t)if(t.includes(r.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(r.THIRD_PARTY_CHECKOUT_EVENT));const t=document.querySelector(this.selector);if(!t)return void i.debug("No clickable cart checkout button found");i.debug("Clickable cart checkout button found",t),t.click()}else t.includes(r.HASH_OPEN_CART_DRAWER)&&fs.get().open()}}class hp{trackSilently(){this.track().catch((t=>nl.getInstance().captureException(t)))}async track(){const t=window.Shopify?.checkout,e=window.Shopify?.Checkout;if(!t&&!e)return;const n={};this.processSmallCheckout(t,n),this.processBigCheckout(e,n);const r=this.getTokenFromCurrentURLPath();if(r&&(n.urlToken=r),!Object.keys(n).length)return void i.warn("No processable data found in",t,e);n.referrer=document.referrer,n.url=location.href;const o=await uo.get(Hl).checkSessionAndGetContext();n.sessionID=o[0],this.trackOrder(n)}processSmallCheckout(t,e){t&&(t.order_id&&(e.orderID=t.order_id.toString()),t.token&&(e.checkoutToken=t.token.toString()),t.customer_id&&(e.customerID=t.customer_id.toString()))}processBigCheckout(t,e){t&&(t.token&&!e.checkoutToken&&(e.checkoutToken=t.token.toString()),t.cartToken&&(e.cartToken=t.cartToken.toString()))}trackOrder(t){i.info("Found order to be send",t),dh.getInstance().trackOrder(t)}getTokenFromCurrentURLPath(){const t=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find((e=>e.length&&t.test(e)))}}class pp{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",(async()=>{const t=await Ye.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},n=new co(r.EVENT_CHECKOUT_STARTED,e);dh.getInstance().sendEvent(n)}))}}class dp{async migrate(){}}Le.escape=o.escapeHtml;class fp{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await(new dp).migrate(),this.autoAuthenticate(),(new ep).meddle(),(new ip).listen(),(new hp).trackSilently(),(new yh).listen(),(new op).listen(),(new sp).listen(),(new lp).listen(),uo.get(rp).listen(),uo.get(up).listenSilently(),uo.get(cp).listenSilently(),uo.get(tp).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Nl.watch())}static async initForAll(){}static initGlobalReference(){window.CooeeSDK||Qe(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Qe(this.globalRef,"config",new s),Qe(this.globalRef,"runtimeData",new We),i.debug("Global reference initialised")}static autoAuthenticate(){const t=qe.getShopName();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;const e=t.appID?.trim(),n=t.shopifyShop;!Xe.isNull(e)&&24===e.length||!Xe.isNull(n)?(this.authenticated=!0,uo.get(Hl).init(t)):i.warn("Cooee App ID or Shop name is not configured")}static sendEvent(t,e,n){for(const t in e)if(t.length>3&&t.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");const r=new co(t,e);r.occurred=n??new Date,uo.get(dh).sendEvent(r)}static updateProfile(t){for(const e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");uo.get(dh).updateProfile(t)}static setPageName(t){if(!t)return;const e=We.get(),n=e.pageName;if(t===n)return;if(e.pageName=t,"cart"===t&&uo.get(tp).loadOrRenderCartWidgets(),r.BLACKLISTED_PAGE_NAMES.some((e=>t.includes(e))))return void uo.get(rp).resetScrollID();const i={};n&&(i.ps=n);const o=new co(r.EVENT_SCREEN_VIEW,i);o.occurred=e.jsLoadTime,uo.get(dh).sendEvent(o),uo.get(rp).resetScrollID(o.occurred)}static previewPopup(t,e){new ch(e).render(t)}static previewWidget(t){new jh(new Rr(t)).render()}static logout(){uo.get(dh).logout()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){i.error(t)}window.addEventListener("message",(t=>{if(i.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;const e=t.data;"object"==typeof e&&("POPUP_PREVIEW"===e.action?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):"WIDGET_PREVIEW"===e.action&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))}))}}static attachGoKwikListeners(){const t=We.get();window.addEventListener("kp-modal:opened",(()=>{t.isGoKwikPopupOpen=!0})),window.addEventListener("user-loggedin",(t=>{const{token:e}=t.detail;e&&this.updateProfile({goKwikToken:e})})),window.gokwikSdk?pp.attachCheckoutListener():window.addEventListener("gokwikLoaded",pp.attachCheckoutListener)}static storePreviewParams(){const t=We.get(),e=new URLSearchParams(location.search),n=e.get("cooee-preview");n&&(t.previewIDs=n.trim().split(",").filter((t=>Number.isInteger(+t))));const r=e.get("cooee-variant");r&&(t.previewVariant=r)}}i.configure(),i.logBrand(),i.debug("Execution order:","top"),window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>{i.debug("Execution order:","IIFE start"),await fp.initForMerchantWebsiteOnly(),await fp.initForAll(),i.debug("Execution order:","IIFE end")})()),i.debug("Execution order:","bottom")})()})();
|