@letscooee/web-sdk 1.3.6 → 1.4.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.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see shopify-sdk.min.js.LICENSE.txt */
2
- (()=>{var t={716:(t,e)=>{"use strict";e.U=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.U=n},340:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(81),i=n.n(r),o=n(645),s=n.n(o)()(i());s.push([t.id,"#snackbar {\n visibility: hidden;\n color: #fff;\n background-color: #333;\n min-width: 250px;\n margin-left: -125px;\n border-radius: 2px;\n padding: 16px;\n text-align: center;\n left: 50%;\n bottom: 30px;\n z-index: 1;\n position: fixed;\n}\n\n#snackbar.show {\n visibility: visible;\n -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;\n animation: fadein 0.5s, fadeout 0.5s 2.5s;\n}\n\n/* Animations for fading in and out */\n@-webkit-keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: 30px;\n opacity: 1;\n }\n}\n\n@keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: 30px;\n opacity: 1;\n }\n}\n\n@-webkit-keyframes fadeout {\n from {\n bottom: 30px;\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n}\n\n@keyframes fadeout {\n from {\n bottom: 30px;\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n}",""]);const a=s},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var u=this[a][0];null!=u&&(s[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&s[l[0]]||(void 0!==o&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=o),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),i&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=i):l[4]="".concat(i)),e.push(l))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},145:(t,e)=>{"use strict";e.r=void 0,e.r=function(){return new Promise((function(t,e){var n,r,i="Unknown";function o(e){t({isPrivate:e,browserName:i})}function s(t){return t===eval.toString().length}void 0!==(r=navigator.vendor)&&0===r.indexOf("Apple")&&s(37)?(i="Safari",void 0!==navigator.maxTouchPoints?function(){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),o(!1)}catch(t){var s=t;return t instanceof Error&&(s=null!==(r=t.message)&&void 0!==r?r:t),o("string"==typeof s&&/BlobURLs are not yet supported/.test(s))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch(t){return o(!1)}}():function(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch(t){return o(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch(t){return o(!0)}o(!1)}()):function(){var t=navigator.vendor;return void 0!==t&&0===t.indexOf("Google")&&s(33)}()?(n=navigator.userAgent,i=n.match(/Chrome/)?void 0!==navigator.brave?"Brave":n.match(/Edg/)?"Edge":n.match(/OPR/)?"Opera":"Chrome":"Chromium",void 0!==self.Promise&&void 0!==self.Promise.allSettled?navigator.webkitTemporaryStorage.queryUsageAndQuota((function(t,e){var n;o(e<(void 0!==(n=window).performance&&void 0!==n.performance.memory&&void 0!==n.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824))}),(function(t){e(new Error("detectIncognito somehow failed to query storage quota: "+t.message))})):(0,window.webkitRequestFileSystem)(0,1,(function(){o(!1)}),(function(){o(!0)}))):void 0!==document.documentElement&&void 0!==document.documentElement.style.MozAppearance&&s(37)?(i="Firefox",o(void 0===navigator.serviceWorker)):void 0!==navigator.msSaveBlob&&s(39)?(i="Internet Explorer",o(void 0===window.indexedDB)):e(new Error("detectIncognito cannot determine the browser"))}))}},901:function(t,e,n){var r,i;!function(o){"use strict";var s,a={VERSION:"1.6.1"},u={},c=function(t,e){return function(){return e.apply(t,arguments)}},l=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},f=function(t,e){return{value:t,name:e}};a.TRACE=f(1,"TRACE"),a.DEBUG=f(2,"DEBUG"),a.INFO=f(3,"INFO"),a.TIME=f(4,"TIME"),a.WARN=f(5,"WARN"),a.ERROR=f(8,"ERROR"),a.OFF=f(99,"OFF");var p=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};p.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(a.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(a.TIME,[t,"end"])},invoke:function(t,e){s&&this.enabledFor(t)&&s(e,l({level:t},this.context))}};var h,d=new p({filterLevel:a.OFF});(h=a).enabledFor=c(d,d.enabledFor),h.trace=c(d,d.trace),h.debug=c(d,d.debug),h.time=c(d,d.time),h.timeEnd=c(d,d.timeEnd),h.info=c(d,d.info),h.warn=c(d,d.warn),h.error=c(d,d.error),h.log=h.info,a.setHandler=function(t){s=t},a.setLevel=function(t){for(var e in d.setLevel(t),u)u.hasOwnProperty(e)&&u[e].setLevel(t)},a.getLevel=function(){return d.getLevel()},a.get=function(t){return u[t]||(u[t]=new p(l({name:t},d.context)))},a.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,s=console.log;i.level===a.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(s,[o+": "+((new Date).getTime()-e[o])+"ms"])):(i.level===a.WARN&&console.warn?s=console.warn:i.level===a.ERROR&&console.error?s=console.error:i.level===a.INFO&&console.info?s=console.info:i.level===a.DEBUG&&console.debug?s=console.debug:i.level===a.TRACE&&console.trace&&(s=console.trace),t.formatter(r,i),n(s,r))}},a.useDefaults=function(t){a.setLevel(t&&t.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(t))},a.setDefaults=a.useDefaults,void 0===(i="function"==typeof(r=a)?r.call(e,n,e,t):r)||(t.exports=i)}()},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var o={},s=[],a=0;a<t.length;a++){var u=t[a],c=r.base?u[0]+r.base:u[0],l=o[c]||0,f="".concat(c," ").concat(l);o[c]=l+1;var p=n(f),h={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(h);else{var d=i(h,r);r.byIndex=a,e.splice(a,0,{identifier:f,updater:d,references:1})}s.push(f)}return s}function i(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var o=r(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var u=r(t,i),c=0;c<o.length;c++){var l=n(o[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}o=u}}},569:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},238:function(t,e,n){var r;!function(i,o){"use strict";var s="function",a="undefined",u="object",c="string",l="model",f="name",p="type",h="vendor",d="version",g="architecture",y="console",v="mobile",b="tablet",m="smarttv",w="wearable",S="embedded",E="Amazon",_="Apple",T="ASUS",O="BlackBerry",I="Google",A="Huawei",x="LG",N="Microsoft",D="Motorola",C="Samsung",L="Sharp",P="Sony",R="Xiaomi",k="Zebra",B="Facebook",U=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},M=function(t,e){return typeof t===c&&-1!==j(e).indexOf(j(t))},j=function(t){return t.toLowerCase()},H=function(t,e){if(typeof t===c)return t=t.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof e===a?t:t.substring(0,350)},G=function(t,e){for(var n,r,i,a,c,l,f=0;f<e.length&&!c;){var p=e[f],h=e[f+1];for(n=r=0;n<p.length&&!c;)if(c=p[n++].exec(t))for(i=0;i<h.length;i++)l=c[++r],typeof(a=h[i])===u&&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;f+=2}},F=function(t,e){for(var n in e)if(typeof e[n]===u&&e[n].length>0){for(var r=0;r<e[n].length;r++)if(M(e[n][r],t))return"?"===n?o:n}else if(M(e[n],t))return"?"===n?o:n;return t},V={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"},$={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[d,[f,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[d,[f,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[f,d],[/opios[\/ ]+([\w\.]+)/i],[d,[f,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[d,[f,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[f,d],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[d,[f,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[d,[f,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[d,[f,"WeChat"]],[/konqueror\/([\w\.]+)/i],[d,[f,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[d,[f,"IE"]],[/yabrowser\/([\w\.]+)/i],[d,[f,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[f,/(.+)/,"$1 Secure Browser"],d],[/\bfocus\/([\w\.]+)/i],[d,[f,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[d,[f,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[d,[f,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[d,[f,"Dolphin"]],[/coast\/([\w\.]+)/i],[d,[f,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[d,[f,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[d,[f,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[f,"360 Browser"]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[f,/(.+)/,"$1 Browser"],d],[/(comodo_dragon)\/([\w\.]+)/i],[[f,/_/g," "],d],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[f,d],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[f],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[f,B],d],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[f,d],[/\bgsa\/([\w\.]+) .*safari\//i],[d,[f,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[d,[f,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[f,"Chrome WebView"],d],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[d,[f,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[f,d],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[d,[f,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[d,f],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[f,[d,F,{"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],[f,d],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[f,"Netscape"],d],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[d,[f,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\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|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[f,d]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,j]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",j]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,j]]],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],[l,[h,C],[p,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[h,C],[p,v]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[h,_],[p,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[h,_],[p,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[h,A],[p,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[h,A],[p,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[h,R],[p,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[h,R],[p,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[h,"OPPO"],[p,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[h,"Vivo"],[p,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[h,"Realme"],[p,v]],[/\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],[l,[h,D],[p,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[h,D],[p,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[h,x],[p,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[h,x],[p,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[h,"Lenovo"],[p,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[h,"Nokia"],[p,v]],[/(pixel c)\b/i],[l,[h,I],[p,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[h,I],[p,v]],[/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],[l,[h,P],[p,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[h,P],[p,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[h,"OnePlus"],[p,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[h,E],[p,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[h,E],[p,v]],[/(playbook);[-\w\),; ]+(rim)/i],[l,h,[p,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[h,O],[p,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[h,T],[p,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[h,T],[p,v]],[/(nexus 9)/i],[l,[h,"HTC"],[p,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[l,/_/g," "],[p,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[h,"Acer"],[p,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[h,"Meizu"],[p,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[h,L],[p,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,l,[p,v]],[/(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],[h,l,[p,b]],[/(surface duo)/i],[l,[h,N],[p,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[h,"Fairphone"],[p,v]],[/(u304aa)/i],[l,[h,"AT&T"],[p,v]],[/\bsie-(\w*)/i],[l,[h,"Siemens"],[p,v]],[/\b(rct\w+) b/i],[l,[h,"RCA"],[p,b]],[/\b(venue[\d ]{2,7}) b/i],[l,[h,"Dell"],[p,b]],[/\b(q(?:mv|ta)\w+) b/i],[l,[h,"Verizon"],[p,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[h,"Barnes & Noble"],[p,b]],[/\b(tm\d{3}\w+) b/i],[l,[h,"NuVision"],[p,b]],[/\b(k88) b/i],[l,[h,"ZTE"],[p,b]],[/\b(nx\d{3}j) b/i],[l,[h,"ZTE"],[p,v]],[/\b(gen\d{3}) b.+49h/i],[l,[h,"Swiss"],[p,v]],[/\b(zur\d{3}) b/i],[l,[h,"Swiss"],[p,b]],[/\b((zeki)?tb.*\b) b/i],[l,[h,"Zeki"],[p,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],l,[p,b]],[/\b(ns-?\w{0,9}) b/i],[l,[h,"Insignia"],[p,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[h,"NextBook"],[p,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],l,[p,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],l,[p,v]],[/\b(ph-1) /i],[l,[h,"Essential"],[p,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[h,"Envizen"],[p,b]],[/\b(trio[-\w\. ]+) b/i],[l,[h,"MachSpeed"],[p,b]],[/\btu_(1491) b/i],[l,[h,"Rotor"],[p,b]],[/(shield[\w ]+) b/i],[l,[h,"Nvidia"],[p,b]],[/(sprint) (\w+)/i],[h,l,[p,v]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[h,N],[p,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[h,k],[p,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[h,k],[p,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,l,[p,y]],[/droid.+; (shield) bui/i],[l,[h,"Nvidia"],[p,y]],[/(playstation [345portablevi]+)/i],[l,[h,P],[p,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[h,N],[p,y]],[/smart-tv.+(samsung)/i],[h,[p,m]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[h,C],[p,m]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,x],[p,m]],[/(apple) ?tv/i],[h,[l,"Apple TV"],[p,m]],[/crkey/i],[[l,"Chromecast"],[h,I],[p,m]],[/droid.+aft(\w)( bui|\))/i],[l,[h,E],[p,m]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[h,L],[p,m]],[/(bravia[\w ]+)( bui|\))/i],[l,[h,P],[p,m]],[/(mitv-\w{5}) bui/i],[l,[h,R],[p,m]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[h,H],[l,H],[p,m]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[p,m]],[/((pebble))app/i],[h,l,[p,w]],[/droid.+; (glass) \d/i],[l,[h,I],[p,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[h,k],[p,w]],[/(quest( 2)?)/i],[l,[h,B],[p,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[p,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[p,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[p,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[p,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[p,v]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[d,[f,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[d,[f,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[f,d],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[d,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,d],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[f,[d,F,V]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,"Windows"],[d,F,V]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[d,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[f,"Mac OS"],[d,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[d,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[f,d],[/\(bb(10);/i],[d,[f,O]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[d,[f,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[d,[f,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[d,[f,"webOS"]],[/crkey\/([\d\.]+)/i],[d,[f,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[f,"Chromium OS"],d],[/(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],[f,d],[/(sunos) ?([\w\.\d]*)/i],[[f,"Solaris"],d],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[f,d]]},q=function(t,e){if(typeof t===u&&(e=t,t=o),!(this instanceof q))return new q(t,e).getResult();var n=t||(typeof i!==a&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=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}($,e):$;return this.getBrowser=function(){var t,e={};return e.name=o,e.version=o,G.call(e,n,r.browser),e.major=typeof(t=e.version)===c?t.replace(/[^\d\.]/g,"").split(".")[0]:o,e},this.getCPU=function(){var t={};return t.architecture=o,G.call(t,n,r.cpu),t},this.getDevice=function(){var t={};return t.vendor=o,t.model=o,t.type=o,G.call(t,n,r.device),t},this.getEngine=function(){var t={};return t.name=o,t.version=o,G.call(t,n,r.engine),t},this.getOS=function(){var t={};return t.name=o,t.version=o,G.call(t,n,r.os),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 n},this.setUA=function(t){return n=typeof t===c&&t.length>350?H(t,350):t,this},this.setUA(n),this};q.VERSION="1.0.32",q.BROWSER=U([f,d,"major"]),q.CPU=U([g]),q.DEVICE=U([l,h,p,y,v,m,b,w,S]),q.ENGINE=q.OS=U([f,d]),typeof e!==a?(t.exports&&(e=t.exports=q),e.UAParser=q):n.amdO?(r=function(){return q}.call(e,n,e,t))===o||(t.exports=r):typeof i!==a&&(i.UAParser=q);var K=typeof i!==a&&(i.jQuery||i.Zepto);if(K&&!K.ua){var W=new q;K.ua=W.getResult(),K.ua.get=function(){return W.getUA()},K.ua.set=function(t){W.setUA(t);var e=W.getResult();for(var n in e)K.ua[n]=e[n]}}}("object"==typeof window?window:this)},147:t=>{"use strict";t.exports={i8:"1.3.6"}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.amdO={},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nc=void 0,(()=>{"use strict";for(var t=function(){function t(){}var e,r;return e=t,t.API_URL="https://api.sdk.letscooee.com",t.SDK_VERSION=n(147).i8,t.SDK_DEBUG=!1,t.SDK="WEB",t.LOG_PREFIX="CooeeSDK",t.SHOPIFY_LOG_PREFIX="CooeeShopify",t.COOEE="cooee",t.CANVAS_WIDTH=1080,t.CANVAS_HEIGHT=1920,t.STORAGE_APP_ID="cooaid",t.STORAGE_USER_ID="uid",t.STORAGE_DEVICE_ID="coodid",t.STORAGE_SDK_TOKEN="st",t.STORAGE_DEVICE_UUID="uuid",t.STORAGE_SESSION_ID="sid",t.STORAGE_SESSION_NUMBER="sn",t.STORAGE_SESSION_START_TIME="sst",t.STORAGE_SESSION_START_EVENT_SENT="sses",t.STORAGE_FIRST_TIME_LAUNCH="ifl",t.STORAGE_LAST_ACTIVE="la",t.STORAGE_ACTIVE_TRIGGER="at",t.STORAGE_GA_ENABLED="gae",t.STORAGE_GA_CLIENT_ID="gacid",t.STORAGE_GA_MEASUREMENT_ID="gamid",t.STORAGE_SHOPIFY_CART_TOKEN="coosct",t.SESSION_STORAGE_TAB_OPENED="tabop",t.SESSION_STORAGE_SCROLL_ID="sleid",t.IDLE_TIME_IN_SECONDS=1800,t.IN_APP_WRAPPER_NAME="cooee-wrapper",t.IN_APP_CONTAINER_NAME="cooee-container",t.IN_APP_DEFAULT_PADDING=15,t.EVENT_SCREEN_VIEW="CE Screen View",t.EVENT_APP_INSTALLED="CE App Installed",t.EVENT_APP_LAUNCHED="CE App Launched",t.EVENT_SESSION_CONCLUDED="CE Session Concluded",t.EVENT_SESSION_STARTED="CE Session Started",t.EVENT_APP_FOREGROUND="CE App Foreground",t.EVENT_APP_BACKGROUND="CE App Background",t.EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed",t.EVENT_TRIGGER_CLOSED="CE Trigger Closed",t.EVENT_SCROLL="CE Scroll",t.EVENT_ADD_TO_CART="Add To Cart",t.EVENT_VIEW_ITEM="View Item",t.EVENT_VIEW_CART="View Cart",t.BOT_USER_AGENTS_PATTERN="(googlebot/|bot|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)",t.BOT_UA_REGEX=new RegExp(e.BOT_USER_AGENTS_PATTERN,"i"),r=t.SDK_VERSION.split(".").map((function(t){return t.padStart(2,"0")})).join(""),t.SDK_VERSION_CODE=parseInt(r,10),t}(),e=n(901),r=n.n(e),i=function(){function e(){}return e.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().info.apply(r(),t)},e.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().debug.apply(r(),t)},e.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().error.apply(r(),t)},e.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().warn.apply(r(),t)},e.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().info.apply(r(),t)},e.trace=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().trace.apply(r(),t)},e.configure=function(e){void 0===e&&(e=t.LOG_PREFIX),r().useDefaults({formatter:function(n){n.unshift("".concat(e," (v").concat(t.SDK_VERSION,"):"))}}),localStorage.cooeeLogLevel?r().setLevel(r()[localStorage.cooeeLogLevel]):r().setLevel(r().OFF)},e}(),o=function(){function t(){}return t.isShopify=function(){return!!window.Shopify},t.getShopName=function(){var t,e;if(this.isShopify())return null===(e=null===(t=window.Shopify.shop)||void 0===t?void 0:t.split("."))||void 0===e?void 0:e[0]},t.getScreenName=function(){if(this.isShopify()){var t=new URL(window.location.href).pathname.slice(1).split("/")[0];return""===t?"home":"collections"===t?"collection":"products"===t?"product":"cart"===t?"cart":void 0}},t}(),s=function(){function t(){this.existingSDKObject=window.CooeeSDK}return t.prototype.meddle=function(){var t,e,n,r;this.existingSDKObject||(this.existingSDKObject=window.CooeeSDK={events:[],profile:[],account:[],screen:[]}),this.existingSDKObject.account=null!==(t=this.existingSDKObject.account)&&void 0!==t?t:[],this.existingSDKObject.profile=null!==(e=this.existingSDKObject.profile)&&void 0!==e?e:[],this.existingSDKObject.events=null!==(n=this.existingSDKObject.events)&&void 0!==n?n:[],this.existingSDKObject.screen=null!==(r=this.existingSDKObject.screen)&&void 0!==r?r:[],this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.existingSDKObject.account.forEach(this.processAccount.bind(this)),this.existingSDKObject.events.forEach(this.processEvent.bind(this)),this.existingSDKObject.profile.forEach(this.processProfile.bind(this)),this.existingSDKObject.screen.forEach(this.processScreen.bind(this));var i=Rr.getAppIDFromScript(),s=o.getShopName();(i||s)&&Br.init({appID:i,shopifyShop:s});var a=o.getScreenName();a&&Br.setScreen(a)},t.prototype.overwritePush=function(t,e){Object.defineProperty(t,"push",{enumerable:!1,configurable:!1,writable:!1,value:e})},t.prototype.meddleAccount=function(){var t=this;this.overwritePush(this.existingSDKObject.account,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processAccount(e[0])}))},t.prototype.meddleEvents=function(){var t=this;this.overwritePush(this.existingSDKObject.events,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processEvent(e[0])}))},t.prototype.meddleProfile=function(){var t=this;this.overwritePush(this.existingSDKObject.profile,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processProfile(e[0])}))},t.prototype.meddleScreen=function(){var t=this;this.overwritePush(this.existingSDKObject.screen,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processScreen(e[0])}))},t.prototype.processAccount=function(t){if(t){var e=Object.keys(t);t.appID||t.shopifyShop?(this.appIDReceived=!0,Br.init(t)):e.includes("appVersion")?Br.setWebAppVersion(t.appVersion):e.includes("debug")&&Br.setDebug(t.debug)}},t.prototype.processEvent=function(t){t&&Br.sendEvent(t[0],t[1])},t.prototype.processProfile=function(t){t&&Br.updateProfile(t)},t.prototype.processScreen=function(t){t&&Br.setScreen(t)},t}(),a=function(){function t(t){this.triggerID=t.id,this.engagementID=t.engagementID,this.expireAt=t.expireAt,this.updateExpired()}return t.prototype.isExpired=function(){return this.expireAt<(new Date).getTime()},t.prototype.updateExpired=function(){this.isExpired()&&(this.expired=!0)},t}(),u=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,h=f.length;p<h;++p)u[p]=f[p],c[f.charCodeAt(p)]=p;function d(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 g(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(u[(i=r)>>18&63]+u[i>>12&63]+u[i>>6&63]+u[63&i]);return o.join("")}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63;var y,v,b=function(t){var e,n,r=d(t),i=r[0],o=r[1],s=new l(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)e=c[t.charCodeAt(n)]<<18|c[t.charCodeAt(n+1)]<<12|c[t.charCodeAt(n+2)]<<6|c[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=c[t.charCodeAt(n)]<<2|c[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=c[t.charCodeAt(n)]<<10|c[t.charCodeAt(n+1)]<<4|c[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},m=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(g(t,s,s+o>a?a:s+o));return 1===r?(e=t[n-1],i.push(u[e>>2]+u[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(u[e>>10]+u[e>>4&63]+u[e<<2&63]+"=")),i.join("")},w=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,p=n?-1:1,h=t[e+f];for(f+=p,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+t[e+f],f+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+f],f+=p,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},S=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,d=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+h]=255&a,h+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+h]=255&s,h+=d,s/=256,c-=8);t[n+h-d]|=128*g},E=(y=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 u(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(F(t,Uint8Array)){var e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(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(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(F(t,SharedArrayBuffer)||t&&F(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|f(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||V(t.length)?i(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(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 u(t){return a(t),i(t<0?0:0|f(t))}function c(t){for(var e=t.length<0?0:0|f(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 f(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)||F(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 j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function h(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 C(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return N(this,e,n);case"latin1":case"binary":return D(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function d(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),V(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:y(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):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o,s=1,a=t.length,u=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,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,p=0;p<u;p++)if(c(t,o+p)!==c(e,p)){f=!1;break}if(f)return o}return-1}function v(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(V(a))return s;t[n+s]=a}return s}function E(t,e,n,r){return G(j(e,t.length-n),t,n,r)}function _(t,e,n,r){return G(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function T(t,e,n,r){return G(H(e),t,n,r)}function O(t,e,n,r){return G(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 I(t,e,n){return 0===e&&n===t.length?m(t):m(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,c=t[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(t){var e=t.length;if(e<=x)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=x));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 u(t)},o.allocUnsafeSlow=function(t){return u(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(F(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),F(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(F(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)d(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)d(this,e,e+3),d(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)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):h.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(F(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),u=Math.min(s,a),c=this.slice(r,i),l=t.slice(e,n),f=0;f<u;++f)if(c[f]!==l[f]){s=c[f],a=l[f];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 v(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return _(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(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 x=4096;function N(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 D(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 C(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+=$[t[o]];return i}function L(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 P(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 R(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 k(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 B(t,e,n,r,i){return e=+e,n>>>=0,i||k(t,0,n,4),S(t,e,n,r,23,4),n+4}function U(t,e,n,r,i){return e=+e,n>>>=0,i||k(t,0,n,8),S(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||P(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||P(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||P(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(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||P(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||P(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||P(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||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||P(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||P(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||P(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||P(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||P(t,4,this.length),w(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),w(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),w(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),w(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||R(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||R(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||R(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||R(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||R(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||R(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||R(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);R(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);R(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||R(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||R(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||R(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||R(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||R(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 B(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return U(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),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var M=/[^+/0-9A-Za-z-_]/g;function j(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 H(t){return b(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(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 F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function V(t){return t!=t}var $=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}()},y(v={exports:{}},v.exports),v.exports),_=E.Buffer;E.SlowBuffer,E.INSPECT_MAX_BYTES,E.kMaxLength;var T=function(t,e){return T=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])},T(t,e)};function O(t,e){function n(){this.constructor=t}T(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var I=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return O(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),A=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return O(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function x(t){return t&&t.Math==Math&&t}function N(){return x("object"==typeof globalThis&&globalThis)||x("object"==typeof window&&window)||x("object"==typeof self&&self)||x("object"==typeof n.g&&n.g)||Function("return this")()}var D=function(t){var e,n="object"==typeof(e=N()).navigator&&"ReactNative"===e.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(n);for(var r=_.alloc(t),i=0;i<t;++i)r[i]=Math.floor(256*Math.random());return r},C=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(_.alloc(e))}}return void 0!==n.g&&n.g.crypto&&n.g.crypto.getRandomValues?function(t){return n.g.crypto.getRandomValues(_.alloc(t))}:D}();function L(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function P(t){return"object"==typeof t&&null!==t}function R(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 k(t){if(ArrayBuffer.isView(t))return _.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return _.from(t);var e;throw new A("Must use either Buffer or TypedArray")}var B=/^(?:[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,U=function(t){return"string"==typeof t&&B.test(t)},M=function(t){if(!U(t))throw new A('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 _.from(e,"hex")},j=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")},H=Symbol("id"),G=function(){function t(e){if(void 0===e)this.id=t.generate();else if(e instanceof t)this[H]=_.from(e.id),this.__id=e.__id;else if(ArrayBuffer.isView(e)&&16===e.byteLength)this.id=k(e);else{if("string"!=typeof e)throw new A("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).");this.id=M(e)}}return Object.defineProperty(t.prototype,"id",{get:function(){return this[H]},set:function(e){this[H]=e,t.cacheHexString&&(this.__id=j(e))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(e){if(void 0===e&&(e=!0),t.cacheHexString&&this.__id)return this.__id;var n=j(this.id,e);return t.cacheHexString&&(this.__id=n),n},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(!e)return!1;if(e instanceof t)return e.id.equals(this.id);try{return new t(e).id.equals(this.id)}catch(t){return!1}},t.prototype.toBinary=function(){return new F(this.id,F.SUBTYPE_UUID)},t.generate=function(){var t=C(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,_.from(t)},t.isValid=function(e){if(!e)return!1;if(e instanceof t)return!0;if("string"==typeof e)return U(e);if(L(e)){if(16!==e.length)return!1;try{return parseInt(e[6].toString(16)[0],10)===F.SUBTYPE_UUID}catch(t){return!1}}return!1},t.createFromHexString=function(e){return new t(M(e))},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t}();Object.defineProperty(G.prototype,"_bsontype",{value:"UUID"});var F=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 A("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=_.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=_.from(e,"binary"):Array.isArray(e)?this.buffer=_.from(e):this.buffer=k(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new A("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new A("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 A("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=_.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=_.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(k(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 G(this.buffer.slice(0,this.position));throw new I('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=_.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=_.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,r=M(e.$uuid)),!r)throw new A("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 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(F.prototype,"_bsontype",{value:"Binary"});var V=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(V.prototype,"_bsontype",{value:"Code"});var $=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($.prototype,"_bsontype",{value:"DBRef"});var q=void 0;try{q=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 K=4294967296,W=0x10000000000000000,z=W/2,J={},Y={},X=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=Y[e])?i:(r=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(Y[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=J[e])?i:(r=t.fromBits(e,e<0?-1:0,!1),o&&(J[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>=W)return t.MAX_UNSIGNED_VALUE}else{if(e<=-z)return t.MIN_VALUE;if(e+1>=z)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%K|0,e/K|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 u=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+u),r);if(u<8){var l=t.fromNumber(Math.pow(r,u));s=s.mul(l).add(t.fromNumber(c))}else s=(s=s.mul(o)).add(t.fromNumber(c))}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 P(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,u=e.low>>>16,c=0,l=0,f=0,p=0;return f+=(p+=o+(65535&e.low))>>>16,p&=65535,l+=(f+=i+u)>>>16,f&=65535,c+=(l+=r+a)>>>16,l&=65535,c+=n+s,c&=65535,t.fromBits(f<<16|p,c<<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(q){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?q.div_u:q.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,q.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),u=t.fromNumber(r),c=u.mul(e);c.isNegative()||c.gt(i);)r-=a,c=(u=t.fromNumber(r,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),o=o.add(u),i=i.sub(c)}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&&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 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(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)),q){var n=(this.unsigned?q.rem_u:q.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,q.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)),q){var n=q.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,q.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,u=65535&e.high,c=e.low>>>16,l=65535&e.low,f=0,p=0,h=0,d=0;return h+=(d+=s*l)>>>16,d&=65535,p+=(h+=o*l)>>>16,h&=65535,p+=(h+=s*c)>>>16,h&=65535,f+=(p+=i*l)>>>16,p&=65535,f+=(p+=o*c)>>>16,p&=65535,f+=(p+=s*u)>>>16,p&=65535,f+=r*l+i*c+o*u+s*a,f&=65535,t.fromBits(h<<16|d,f<<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)*K+(this.low>>>0):this.high*K+(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 u=s.div(o),c=(s.sub(u.mul(o)).toInt()>>>0).toString(e);if((s=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+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(X.prototype,"__isLong__",{value:!0}),Object.defineProperty(X.prototype,"_bsontype",{value:"Long"});var Z=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Q=/^(\+|-)?(Infinity|inf)$/i,tt=/^(\+|-)?NaN$/i,et=6111,nt=-6176,rt=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),it=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ot=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),st=/^([-+])?(\d+)?$/;function at(t){return!isNaN(parseInt(t,10))}function ut(t){var e=X.fromNumber(1e9),n=X.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 X(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function ct(t,e){throw new A('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var lt=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!L(e))throw new A("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new A("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,u=0,c=0,l=0,f=[0],p=0,h=0,d=0,g=0,y=0,v=0,b=new X(0,0),m=new X(0,0),w=0;if(e.length>=7e3)throw new A(e+" not a valid Decimal128 string");var S=e.match(Z),E=e.match(Q),T=e.match(tt);if(!S&&!E&&!T||0===e.length)throw new A(e+" not a valid Decimal128 string");if(S){var O=S[2],I=S[4],x=S[5],N=S[6];I&&void 0===N&&ct(e,"missing exponent power"),I&&void 0===O&&ct(e,"missing exponent base"),void 0===I&&(x||N)&&ct(e,"missing e before exponent")}if("+"!==e[w]&&"-"!==e[w]||(r="-"===e[w++]),!at(e[w])&&"."!==e[w]){if("i"===e[w]||"I"===e[w])return new t(_.from(r?it:ot));if("N"===e[w])return new t(_.from(rt))}for(;at(e[w])||"."===e[w];)"."!==e[w]?(p<34&&("0"!==e[w]||o)&&(o||(l=a),o=!0,f[h++]=parseInt(e[w],10),p+=1),o&&(u+=1),i&&(c+=1),a+=1,w+=1):(i&&ct(e,"contains multiple periods"),i=!0,w+=1);if(i&&!a)throw new A(e+" not a valid Decimal128 string");if("e"===e[w]||"E"===e[w]){var D=e.substr(++w).match(st);if(!D||!D[2])return new t(_.from(rt));y=parseInt(D[0],10),w+=D[0].length}if(e[w])return new t(_.from(rt));if(d=0,p){if(g=p-1,1!==(s=u))for(;0===f[l+s-1];)s-=1}else d=0,g=0,f[0]=0,u=1,p=1,s=0;for(y<=c&&c-y>16384?y=nt:y-=c;y>et;){if((g+=1)-d>34){if(f.join("").match(/^0+$/)){y=et;break}ct(e,"overflow")}y-=1}for(;y<nt||p<u;){if(0===g&&s<p){y=nt,s=0;break}if(p<u?u-=1:g-=1,y<et)y+=1;else{if(f.join("").match(/^0+$/)){y=et;break}ct(e,"overflow")}}if(g-d+1<s){var C=a;i&&(l+=1,C+=1),r&&(l+=1,C+=1);var L=parseInt(e[l+g+1],10),P=0;if(L>=5&&(P=1,5===L))for(P=f[g]%2==1?1:0,v=l+g+2;v<C;v++)if(parseInt(e[v],10)){P=1;break}if(P)for(var R=g;R>=0;R--)if(++f[R]>9&&(f[R]=0,0===R)){if(!(y<et))return new t(_.from(r?it:ot));y+=1,f[R]=1}}if(b=X.fromNumber(0),m=X.fromNumber(0),0===s)b=X.fromNumber(0),m=X.fromNumber(0);else if(g-d<17)for(R=d,m=X.fromNumber(f[R++]),b=new X(0,0);R<=g;R++)m=(m=m.multiply(X.fromNumber(10))).add(X.fromNumber(f[R]));else{for(R=d,b=X.fromNumber(f[R++]);R<=g-17;R++)b=(b=b.multiply(X.fromNumber(10))).add(X.fromNumber(f[R]));for(m=X.fromNumber(f[R++]);R<=g;R++)m=(m=m.multiply(X.fromNumber(10))).add(X.fromNumber(f[R]))}var k,B,U,M,j=function(t,e){if(!t&&!e)return{high:X.fromNumber(0),low:X.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new X(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new X(e.getLowBits(),0),s=n.multiply(i),a=n.multiply(o),u=r.multiply(i),c=r.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new X(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new X(c.getLowBits(),0))}}(b,X.fromString("100000000000000000"));j.low=j.low.add(m),B=m,((U=(k=j.low).high>>>0)<(M=B.high>>>0)||U===M&&k.low>>>0<B.low>>>0)&&(j.high=j.high.add(X.fromNumber(1))),n=y+6176;var H={low:X.fromNumber(0),high:X.fromNumber(0)};j.high.shiftRightUnsigned(49).and(X.fromNumber(1)).equals(X.fromNumber(1))?(H.high=H.high.or(X.fromNumber(3).shiftLeft(61)),H.high=H.high.or(X.fromNumber(n).and(X.fromNumber(16383).shiftLeft(47))),H.high=H.high.or(j.high.and(X.fromNumber(0x7fffffffffff)))):(H.high=H.high.or(X.fromNumber(16383&n).shiftLeft(49)),H.high=H.high.or(j.high.and(X.fromNumber(562949953421311)))),H.low=j.low,r&&(H.high=H.high.or(X.fromString("9223372036854775808")));var G=_.alloc(16);return w=0,G[w++]=255&H.low.low,G[w++]=H.low.low>>8&255,G[w++]=H.low.low>>16&255,G[w++]=H.low.low>>24&255,G[w++]=255&H.low.high,G[w++]=H.low.high>>8&255,G[w++]=H.low.high>>16&255,G[w++]=H.low.high>>24&255,G[w++]=255&H.high.low,G[w++]=H.high.low>>8&255,G[w++]=H.high.low>>16&255,G[w++]=H.high.low>>24&255,G[w++]=255&H.high.high,G[w++]=H.high.high>>8&255,G[w++]=H.high.high>>16&255,G[w++]=H.high.high>>24&255,new t(G)},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,u=!1,c={parts:[0,0,0,0]},l=[];a=0;var f=this.bytes,p=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,h=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,d=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,g=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24;a=0,(new X(p,h),new X(d,g)).lessThan(X.ZERO)&&l.push("-");var y=g>>26&31;if(y>>3==3){if(30===y)return l.join("")+"Infinity";if(31===y)return"NaN";t=g>>15&16383,i=8+(g>>14&1)}else i=g>>14&7,t=g>>17&16383;var v=t-6176;if(c.parts[0]=(16383&g)+((15&i)<<14),c.parts[1]=d,c.parts[2]=h,c.parts[3]=p,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])u=!0;else for(s=3;s>=0;s--){var b=0,m=ut(c);if(c=m.quotient,b=m.rem.low)for(o=8;o>=0;o--)n[9*s+o]=b%10,b=Math.floor(b/10)}if(u)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var w=e-1+v;if(w>=34||w<=-7||v>0){if(e>34)return l.push("".concat(0)),v>0?l.push("E+".concat(v)):v<0&&l.push("E".concat(v)),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"),w>0?l.push("+".concat(w)):l.push("".concat(w))}else if(v>=0)for(r=0;r<e;r++)l.push("".concat(n[a++]));else{var S=e+v;if(S>0)for(r=0;r<S;r++)l.push("".concat(n[a++]));else l.push("0");for(l.push(".");S++<0;)l.push("0");for(r=0;r<e-Math.max(S-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(lt.prototype,"_bsontype",{value:"Decimal128"});var ft=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))}:(Number.isInteger(this.value)?(e=this.value.toFixed(1)).length>=13&&(e=this.value.toExponential(13).toUpperCase()):e=this.value.toString(),{$numberDouble:e});var e},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(ft.prototype,"_bsontype",{value:"Double"});var pt=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(pt.prototype,"_bsontype",{value:"Int32"});var ht=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(ht.prototype,"_bsontype",{value:"MaxKey"});var dt=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(dt.prototype,"_bsontype",{value:"MinKey"});var gt=new RegExp("^[0-9a-fA-F]{24}$"),yt=null,vt=Symbol("id"),bt=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 A("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?_.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[vt]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[vt]=n instanceof _?n:k(n);else{if("string"!=typeof n)throw new A("Argument passed in does not match the accepted types");if(12===n.length){var r=_.from(n);if(12!==r.byteLength)throw new A("Argument passed in must be a string of 12 bytes");this[vt]=r}else{if(24!==n.length||!gt.test(n))throw new A("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[vt]=_.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[vt]},set:function(e){this[vt]=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=_.alloc(12);return r.writeUInt32BE(e,0),null===yt&&(yt=C(5)),r[4]=yt[0],r[5]=yt[1],r[6]=yt[2],r[7]=yt[3],r[8]=yt[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[vt][11]===e[vt][11]&&this[vt].equals(e[vt]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&L(this.id))return e===_.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 _.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=_.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 A("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(_.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(bt.prototype,"generate",{value:R((function(t){return bt.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(bt.prototype,"getInc",{value:R((function(){return bt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(bt.prototype,"get_inc",{value:R((function(){return bt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(bt,"get_inc",{value:R((function(){return bt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(bt.prototype,"_bsontype",{value:"ObjectID"});var mt=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 I("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new I("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 I("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 A("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(mt.prototype,"_bsontype",{value:"BSONRegExp"});var wt=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(wt.prototype,"_bsontype",{value:"Symbol"});var St=function(t){function e(n,r){var i=this;return i instanceof e?(i=X.isLong(n)?t.call(this,n.low,n.high,!0)||this:P(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 O(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(X.fromInt(t,!0))},e.fromNumber=function(t){return new e(X.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(X.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=X.MAX_UNSIGNED_VALUE,e}(X);var Et=2147483647,_t=-2147483648,Tt=0x8000000000000000,Ot=-0x8000000000000000,It={$oid:bt,$binary:F,$uuid:F,$symbol:wt,$numberInt:pt,$numberDecimal:lt,$numberDouble:ft,$numberLong:X,$minKey:dt,$maxKey:ht,$regex:mt,$regularExpression:mt,$timestamp:St};function At(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=_t&&t<=Et)return new pt(t);if(t>=Ot&&t<=Tt)return X.fromNumber(t)}return new ft(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=It[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)):X.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=At(t.$scope)),V.fromExtendedJSON(t)}if(function(t){return P(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof $)return u;var c=Object.keys(u).filter((function(t){return t.startsWith("$")})),l=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(l=!1)})),l)return $.fromExtendedJSON(u)}return t}function xt(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function Nt(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],u=" ".repeat(i.length+o.length/2),c="-".repeat(s.length+(o.length+a.length)/2-1);throw new A("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(u,"\\").concat(c,"/"))}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 Nt(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||P(p=t)&&"[object Date]"===Object.prototype.toString.call(p)){var l=t.getTime(),f=l>-1&&l<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:xt(t)}:e.relaxed&&f?{$date:xt(t)}:{$date:{$numberLong:t.getTime().toString()}}}var p;if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var h=t>=Ot&&t<=Tt;if(t>=_t&&t<=Et)return{$numberInt:t.toString()};if(h)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 g=t.toString().match(/[gimuy]*$/);g&&(d=g[0])}return new mt(t.source,d).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new I("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=Nt(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 P(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=Ct[t._bsontype];if(!a)throw new A("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new V(s.code,Nt(s.scope,e)):"DBRef"===n&&s.oid&&(s=new $(Nt(s.collection,e),Nt(s.oid,e),Nt(s.db,e),Nt(s.fields,e))),s.toExtendedJSON(e)}throw new I("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var Dt,Ct={Binary:function(t){return new F(t.value(),t.sub_type)},Code:function(t){return new V(t.code,t.scope)},DBRef:function(t){return new $(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new lt(t.bytes)},Double:function(t){return new ft(t.value)},Int32:function(t){return new pt(t.value)},Long:function(t){return X.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 ht},MinKey:function(){return new dt},ObjectID:function(t){return new bt(t)},ObjectId:function(t){return new bt(t)},BSONRegExp:function(t){return new mt(t.pattern,t.options)},Symbol:function(t){return new wt(t.value)},Timestamp:function(t){return St.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 I("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return At(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=Nt(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)}}(Dt||(Dt={}));var Lt=N();Lt.Map?Lt.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})}(),Math.pow(2,63),Math.pow(2,63);var Pt=Math.pow(2,53),Rt=-Math.pow(2,53);X.fromNumber(Pt),X.fromNumber(Rt),new Set(["$db","$ref","$id","$clusterTime"]);var kt=new Uint8Array(8);new DataView(kt.buffer,kt.byteOffset,kt.byteLength);_.alloc(17825792);var Bt=function(t,e,n,r){void 0===e&&(e={}),this.name=t,this.properties=e,this.sessionID=null,this.screenName=null,this.deviceProps=null,this.sessionNumber=0,this.activeTriggers=[],this.id=r?new bt(r):new bt,this.occurred=(new Date).toISOString(),n&&(this.trigger=new a(n)),this.newEvent=!r},Ut=function(t,e){return Ut=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])},Ut(t,e)};function Mt(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}Ut(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function jt(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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function Ht(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 Gt(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 Ft(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 Vt(t){return this instanceof Vt?(this.v=t,this):new Vt(t)}function $t(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=i[t](e)).value instanceof Vt?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function qt(t){return"function"==typeof t}function Kt(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;var Wt=Kt((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 zt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Jt=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=Ht(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 u=this.initialTeardown;if(qt(u))try{u()}catch(t){i=t instanceof Wt?t.errors:[t]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=Ht(c),f=l.next();!f.done;f=l.next()){var p=f.value;try{Zt(p)}catch(t){i=null!=i?i:[],t instanceof Wt?i=Ft(Ft([],Gt(i)),Gt(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new Wt(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Zt(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)&&zt(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&zt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),Yt=Jt.EMPTY;function Xt(t){return t instanceof Jt||t&&"closed"in t&&qt(t.remove)&&qt(t.add)&&qt(t.unsubscribe)}function Zt(t){qt(t)?t():t.unsubscribe()}var Qt=null,te=null,ee=void 0,ne=!1,re=!1,ie={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=ie.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,Ft([t,e],Gt(n))):setTimeout.apply(void 0,Ft([t,e],Gt(n)))},clearTimeout:function(t){var e=ie.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function oe(t){ie.setTimeout((function(){if(!Qt)throw t;Qt(t)}))}function se(){}var ae=ue("C",void 0,void 0);function ue(t,e,n){return{kind:t,value:e,error:n}}var ce=null;function le(t){if(ne){var e=!ce;if(e&&(ce={errorThrown:!1,error:null}),t(),e){var n=ce,r=n.errorThrown,i=n.error;if(ce=null,r)throw i}}else t()}var fe=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,Xt(e)&&e.add(n)):n.destination=be,n}return Mt(e,t),e.create=function(t,e,n){return new ge(t,e,n)},e.prototype.next=function(t){this.isStopped?ve(function(t){return ue("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ve(ue("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ve(ae,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}(Jt),pe=Function.prototype.bind;function he(t,e){return pe.call(t,e)}var de=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){ye(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){ye(t)}else ye(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){ye(t)}},t}(),ge=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;return qt(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&re?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&he(e.next,o),error:e.error&&he(e.error,o),complete:e.complete&&he(e.complete,o)}):i=e,s.destination=new de(i),s}return Mt(e,t),e}(fe);function ye(t){var e;ne?(e=t,ne&&ce&&(ce.errorThrown=!0,ce.error=e)):oe(t)}function ve(t,e){var n=te;n&&ie.setTimeout((function(){return n(t,e)}))}var be={closed:!0,next:se,error:function(t){throw t},complete:se},me="function"==typeof Symbol&&Symbol.observable||"@@observable";function we(t){return t}function Se(t){return 0===t.length?we:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var Ee=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 fe||function(t){return t&&qt(t.next)&&qt(t.error)&&qt(t.complete)}(r)&&Xt(r)?t:new ge(t,e,n);return le((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=_e(e))((function(e,r){var i=new ge({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[me]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Se(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=_e(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 _e(t){var e;return null!==(e=null!=t?t:ee)&&void 0!==e?e:Promise}var Te=Kt((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Oe=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 Mt(e,t),e.prototype.lift=function(t){var e=new Ie(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Te},e.prototype.next=function(t){var e=this;le((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=Ht(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;le((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;le((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?Yt:(this.currentObservers=null,o.push(t),new Jt((function(){e.currentObservers=null,zt(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 Ee;return t.source=this,t},e.create=function(t,e){return new Ie(t,e)},e}(Ee),Ie=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return Mt(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:Yt},e}(Oe),Ae={now:function(){return(Ae.delegate||Date).now()},delegate:void 0},xe=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Ae);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 Mt(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,u=1;u<r.length&&r[u]<=s;u+=2)a=u;a&&r.splice(0,a+1)}},e}(Oe),Ne=n(238),De=n.n(Ne),Ce=function(){function t(){this.scalingFactor=1,this.doc=document,this.parser=new(De())}return t.get=function(){return t._instance||(t._instance=new t),t._instance},t.prototype.getUAParser=function(){return this.parser},t.prototype.getWidth=function(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth},t.prototype.getHeight=function(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight},t.prototype.isMobile=function(){return"mobile"===this.parser.getDevice().type},t.prototype.calculateScalingFactor=function(e){var n=e.max,r=e.cont.w,i=e.cont.h,o=e.spc,s=t.get().getWidth(),a=t.get().getHeight();n&&(s=s?Math.min(s,n):n,a=a?Math.min(a,n):n),a&&(s-=o.getHorizontal(),a-=o.getVertical(),this.scalingFactor=s/a<r/i?s/r:a/i,this.scalingFactor=Math.min(this.scalingFactor,1))},t.prototype.getScalingFactor=function(){return this.scalingFactor},t.prototype.createElement=function(t){return this.doc.createElement(t)},t.prototype.appendChild=function(t,e){t.appendChild(e)},t.prototype.setStyle=function(t,e,n){e&&(n?t.style.setProperty(e,n,"important"):t.style.removeProperty(e))},t.prototype.setAttribute=function(t,e,n){t.setAttribute(e,n)},t.prototype.removeInApp=function(t){var e=document.querySelector(".".concat(t.rootClassName));e&&e.parentElement.removeChild(e)},t.prototype.setParentContainer=function(t){this.parentContainer=t,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")},t.prototype.isParentNotBody=function(){return this.parentContainer!==document.body},t.DOCUMENT_STANDARD_MODE="CSS1Compat",t}(),Le=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Pe=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Re=function(){function t(){this.result={},this.parser=Ce.get().getUAParser()}return t.prototype.get=function(){return Le(this,void 0,void 0,(function(){var t;return Pe(this,(function(e){switch(e.label){case 0:return t=this.result,this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),[4,this.getBatteryInfo()];case 1:return e.sent(),[4,this.getLocation()];case 2:return e.sent(),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},[2,t]}}))}))},t.prototype.getDeviceMemory=function(){var t=navigator;if(t.deviceMemory){var e=t.deviceMemory;this.result.mem={tot:1024*e}}},t.prototype.getNetworkType=function(){var t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;(null==e?void 0:e.effectiveType)&&(this.result.net={type:e.effectiveType})},t.prototype.getOrientation=function(){var t,e=null===(t=screen.orientation)||void 0===t?void 0:t.type;e&&(this.result.orientation=e)},t.prototype.getDPI=function(){var t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);var e=window.devicePixelRatio||1,n=t.offsetWidth*e;return document.body.removeChild(t),n},t.prototype.getLocation=function(){return Le(this,void 0,void 0,(function(){var t=this;return Pe(this,(function(e){switch(e.label){case 0:return navigator.geolocation&&navigator.permissions?[4,navigator.permissions.query({name:"geolocation"})]:[2];case 1:return"granted"!=e.sent().state?[2]:[2,new Promise((function(e){navigator.geolocation.getCurrentPosition((function(n){t.result.coords=[n.coords.latitude,n.coords.longitude],e()}),(function(){return e()}))}))]}}))}))},t.prototype.getBatteryInfo=function(){return Le(this,void 0,void 0,(function(){var t;return Pe(this,(function(e){switch(e.label){case 0:if(!("getBattery"in navigator))return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,navigator.getBattery()];case 2:return t=e.sent(),this.result.bat={l:100*t.level,c:t.charging},[3,4];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},t}(),ke=n(145),Be=function(){function t(){}return t.getString=function(e,n){return void 0===n&&(n=""),t.LOCAL_STORAGE.getItem(e)||n},t.setString=function(e,n){n||(n=""),t.LOCAL_STORAGE.setItem(e,n)},t.getNumber=function(e,n){return+t.getString(e,"")||n},t.setNumber=function(e,n){t.setString(e,n.toString())},t.getBoolean=function(t,e){var n=this.LOCAL_STORAGE.getItem(t);return n?JSON.parse(n):e},t.setBoolean=function(e,n){t.setString(e,JSON.stringify(n))},t.getObject=function(e){try{return JSON.parse(t.getString(e,""))}catch(t){return{}}},t.getArray=function(e,n){void 0===n&&(n=[]);try{return JSON.parse(t.getString(e,""))||n}catch(t){return n}},t.setObject=function(e,n){t.setString(e,JSON.stringify(n))},t.setArray=function(e,n){t.setString(e,JSON.stringify(n))},t.remove=function(e){t.LOCAL_STORAGE.removeItem(e)},t.LOCAL_STORAGE=window.localStorage,t}(),Ue=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Me=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},je=function(){function e(){}return e.processConfiguration=function(t){this.saveConfiguration(t).then((function(){i.log("Google Analytics configuration processed")})).catch((function(t){i.error(t)}))},e.saveConfiguration=function(e){return Ue(this,void 0,void 0,(function(){var n;return Me(this,(function(r){switch(r.label){case 0:return e.gaMeasurementID&&e.gaEnabled?(n=Be.getString(t.STORAGE_GA_MEASUREMENT_ID,""),Be.getBoolean(t.STORAGE_GA_ENABLED,!1)===e.gaEnabled&&n===e.gaMeasurementID?[3,2]:(Be.remove(t.STORAGE_GA_CLIENT_ID),Be.setString(t.STORAGE_GA_MEASUREMENT_ID,e.gaMeasurementID),Be.setBoolean(t.STORAGE_GA_ENABLED,e.gaEnabled),[4,this.sendClientID()])):[2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.sendClientID=function(){return Ue(this,void 0,void 0,(function(){var e;return Me(this,(function(n){switch(n.label){case 0:return Be.getBoolean(t.STORAGE_GA_ENABLED,!1)?[4,this.getClientID()]:[2];case 1:return(e=n.sent())?(cr.getInstance().updateDeviceProps({gaClientID:e}),[2]):[2]}}))}))},e.getClientID=function(){return Ue(this,void 0,void 0,(function(){var e;return Me(this,(function(n){switch(n.label){case 0:return(e=Be.getString(t.STORAGE_GA_CLIENT_ID))?[3,2]:[4,this.getClientIDViaGTag()];case 1:e=n.sent(),n.label=2;case 2:return e?(Be.setString(t.STORAGE_GA_CLIENT_ID,e),[2,e]):[2]}}))}))},e.getClientIDViaGTag=function(){var e=Be.getString(t.STORAGE_GA_MEASUREMENT_ID,"");if(Be.getString(t.STORAGE_GA_MEASUREMENT_ID,"")&&e&&window.gtag)return new Promise((function(t){window.gtag("get",e,"client_id",(function(e){t(e)}))}))},e}(),He=function(e,n,r,i){this.appID=e,this.shopifyShop=n,this.uuid=r,this.props=i,this.sdk=t.SDK},Ge=n(716),Fe=function(){function t(){}return t.addReferralData=function(t){Object.assign(t,this.getUTMParams()),t.referrer=this.getReferrer()},t.getReferrer=function(){if(document.referrer&&"".concat(location.origin,"/")!==document.referrer)return document.referrer.replace(location.origin,"")},t.getUTMParams=function(){var t;try{t=new Ge.U(location.href)}catch(t){return{}}var e={};return this.UTM_PARAMS.forEach((function(n){var r=t.getQueryParam(n);r&&(e[n]=r)})),Object.keys(e).length?(Be.setObject("utm_params",e),e):Be.getObject("utm_params")},t.UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],t}(),Ve=function(){function t(t){t.s&&(this.s=new We(t.s)),t.g&&(this.g=new tn(t.g)),this.i=t.i}return Object.defineProperty(t.prototype,"solid",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"glossy",{get:function(){return this.g},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"img",{get:function(){return this.i},enumerable:!1,configurable:!0}),t}();const $e=new RegExp("[^#a-f\\d]","gi"),qe=new RegExp("^#?[a-f\\d]{3}[a-f\\d]?$|^#?[a-f\\d]{6}([a-f\\d]{2})?$","i");var Ke,We=function(){function t(t){this.a=100,this.h=t.h,this.a=t.a,this.g=t.g}return Object.defineProperty(t.prototype,"hex",{get:function(){return this.h},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grad",{get:function(){return this.g},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgba",{get:function(){if(!this.hex)return"";try{return function(t,e={}){if("string"!=typeof t||$e.test(t)||!qe.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"}},enumerable:!1,configurable:!0}),t.prototype.getAlpha=function(){var t;return(null!==(t=this.a)&&void 0!==t?t:100)/100},t}(),ze=function(){function t(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new We(t.c))}return Object.defineProperty(t.prototype,"radius",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.w},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this.c},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){var t;return Ke[null!==(t=this.s)&&void 0!==t?t:Ke.SOLID]},enumerable:!1,configurable:!0}),t}();!function(t){t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED"}(Ke||(Ke={}));var Je,Ye=function(t){var e;t=null!=t?t:{},this.name=t.name,this.fonts=null===(e=t.fonts)||void 0===e?void 0:e.map((function(t){return new Xe(t)}))},Xe=function(){function t(t){t=null!=t?t:{},this.style=t.style,this.url=t.url}return t.prototype.getFontDescriptor=function(){return{style:this.style===Je.ITALICS||this.style===Je.BOLD_ITALICS?"italic":"normal",weight:this.style===Je.BOLD_ITALICS||this.style===Je.BOLD?"700":"400"}},t.prototype.getURL=function(){return"url('".concat(this.url,"') format('truetype')")},t}();!function(t){t[t.REGULAR=1]="REGULAR",t[t.ITALICS=2]="ITALICS",t[t.BOLD=3]="BOLD",t[t.BOLD_ITALICS=4]="BOLD_ITALICS"}(Je||(Je={}));var Ze,Qe=function(){function t(t){t=null!=t?t:{},this.s=t.s,this.lh=t.lh,t.fmly&&(this.fmly=new Ye(t.fmly))}return Object.defineProperty(t.prototype,"family",{get:function(){return this.fmly},enumerable:!1,configurable:!0}),t}(),tn=function(){function t(t){this.r=t.r,t.c&&(this.c=new We(t.c)),t.fb&&(this.fb=new We(t.fb))}return Object.defineProperty(t.prototype,"radius",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this.c},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fallback",{get:function(){var e;return null!==(e=this.fb)&&void 0!==e?e:t.DEFAULT_FALLBACK},enumerable:!1,configurable:!0}),t.DEFAULT_FALLBACK=new We({h:"#000000",a:50}),t}(),en=function(){function t(t){var e,n,r,i;t=null!=t?t:{},this.blur=null!==(e=t.blur)&&void 0!==e?e:0,this.spr=null!==(n=t.spr)&&void 0!==n?n:0,this.x=null!==(r=t.x)&&void 0!==r?r:0,this.y=null!==(i=t.y)&&void 0!==i?i:0,this.clr=new We(t.clr)}return t.prototype.getStyle=function(t){return"".concat(this.x*t,"px ").concat(this.y*t,"px ")+"".concat(this.blur*t,"px ").concat(this.spr*t,"px ").concat(this.clr.rgba)},t}(),nn=function(){function t(t){var e,n,r,i;t=null!=t?t:{},this.pl=null!==(e=t.pl)&&void 0!==e?e:0,this.pr=null!==(n=t.pr)&&void 0!==n?n:0,this.pt=null!==(r=t.pt)&&void 0!==r?r:0,this.pb=null!==(i=t.pb)&&void 0!==i?i:0}return t.prototype.getHorizontal=function(){return this.pl+this.pr},t.prototype.getVertical=function(){return this.pt+this.pb},t.prototype.getPaddingCSS=function(){return"".concat(this.pt,"px ").concat(this.pr,"px ").concat(this.pb,"px ").concat(this.pl,"px")},t}(),rn=function(){function t(t){(null==t?void 0:t.rot)&&(this.rot=t.rot)}return Object.defineProperty(t.prototype,"rotate",{get:function(){return this.rot},enumerable:!1,configurable:!0}),t}(),on=function(){function t(t){this.t=t.t,t.bg&&(this.bg=new Ve(t.bg)),t.br&&(this.br=new ze(t.br)),t.shd&&(this.shd=new en(t.shd)),t.spc&&(this.spc=new nn(t.spc)),this.trf=new rn(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}return Object.defineProperty(t.prototype,"alpha",{get:function(){var t;return null!==(t=this.a)&&void 0!==t?t:100},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeAsString",{get:function(){return Ze[this.t]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"click",{get:function(){return this.clc},enumerable:!1,configurable:!0}),t}();!function(t){t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.SHAPE=100]="SHAPE"}(Ze||(Ze={}));var sn,an,un=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cn=function(t){function e(e){return t.call(this,e)||this}return un(e,t),e}(on),ln=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),fn=function(t){function e(e){var n=t.call(this,e)||this;return n.src=e.src,n}return ln(e,t),e}(on),pn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),hn=function(t){function e(e){var n=t.call(this,e)||this;return n.alg=sn.START,n.prs=e.prs,n.alg=e.alg,e.f&&(n.f=new Qe(e.f)),e.c&&(n.c=new We(e.c)),n}return pn(e,t),Object.defineProperty(e.prototype,"parts",{get:function(){return this.prs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this.c},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this.f},enumerable:!1,configurable:!0}),e}(on);!function(t){t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY"}(sn||(sn={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SUPER=1]="SUPER",t[t.SUB=2]="SUB"}(an||(an={}));var dn,gn,yn=function(){function e(t,e){this._startTime=t,this._triggerData=e}return Object.defineProperty(e.prototype,"startTime",{get:function(){return this._startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"triggerData",{get:function(){return this._triggerData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootClassName",{get:function(){var e=this.triggerData.id.slice(-6);return"test"===e&&(e=this.startTime.getTime().toString()),t.IN_APP_WRAPPER_NAME+"-"+e},enumerable:!1,configurable:!0}),e.prototype.onClose=function(t){this.closeCallback=t},e.prototype.closeInApp=function(t){var e={closeBehaviour:t,duration:((new Date).getTime()-this.startTime.getTime())/1e3};this.closeCallback&&this.closeCallback(e)},e}(),vn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),bn=function(t){function e(e){var n,r,i,o=this;return(o=t.call(this,e)||this).o=null!==(n=e.o)&&void 0!==n?n:dn.C,o.desk=e.desk,o.w=null!==(r=o.w)&&void 0!==r?r:1080,o.h=null!==(i=o.h)&&void 0!==i?i:1920,o}return vn(e,t),e.prototype.getOrigin=function(){return this.o},e}(on);!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.ABOVE_PAGE=1]="ABOVE_PAGE",t[t.EMBEDDED=2]="EMBEDDED"}(gn||(gn={}));var mn,wn,Sn=function(){function t(t){t=null!=t?t:{},this.en=t.en,this.ex=t.ex}return t.prototype.getEnterAnimation=function(){switch(this.en){case mn.SLIDE_IN_TOP:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case mn.SLIDE_IN_DOWN:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case mn.SLIDE_IN_LEFT:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case mn.SLIDE_IN_RIGHT:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case mn.SLIDE_IN_TOP_LEFT:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case mn.SLIDE_IN_TOP_RIGHT:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case mn.SLIDE_IN_BOTTOM_LEFT:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case mn.SLIDE_IN_BOTTOM_RIGHT:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case mn.POP:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}},t.prototype.getExitAnimation=function(){switch(this.ex){case wn.SLIDE_OUT_TOP:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case wn.SLIDE_OUT_DOWN:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case wn.SLIDE_OUT_LEFT:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case wn.SLIDE_OUT_RIGHT:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case wn.SLIDE_OUT_TOP_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case wn.SLIDE_OUT_TOP_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case wn.SLIDE_OUT_BOTTOM_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case wn.SLIDE_OUT_BOTTOM_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case wn.POP:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}},t}();!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"}(mn||(mn={})),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"}(wn||(wn={}));var En,_n=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Tn=function(e){function n(n){var r,i,o,s=this;return n=null!=n?n:{},(s=e.call(this,n)||this).gvt=null!==(r=n.gvt)&&void 0!==r?r:En.C,s.max=n.max,s.cover=null===(i=n.cover)||void 0===i||i,s.anim=new Sn(n.anim),s.embedded=n.embedded,s.position=null!==(o=n.position)&&void 0!==o?o:gn.ABOVE_PAGE,s.spc||(s.spc=new nn({pl:t.IN_APP_DEFAULT_PADDING,pr:t.IN_APP_DEFAULT_PADDING,pt:t.IN_APP_DEFAULT_PADDING,pb:t.IN_APP_DEFAULT_PADDING})),s}return _n(n,e),n.prototype.isEmbedded=function(){return this.position===gn.EMBEDDED&&!!this.embedded},n.prototype.getEmbeddedSelector=function(){return".letscooee-engagement.container-".concat(this.embedded)},n}(on),On=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),In=function(t){function e(e){var n,r,i,o=this;return e=null!=e?e:{},(o=t.call(this,e)||this).elems=[],o.cont=new bn(e.cont),o.mob=new Tn(e.mob),o.max=null!==(n=o.max)&&void 0!==n?n:null===(i=null===(r=e.cont)||void 0===r?void 0:r.desk)||void 0===i?void 0:i.max,o.bg||(o.bg=o.cont.bg,delete o.cont.bg),e.elems.forEach((function(t){t.t===Ze.IMAGE?o.elems.push(new fn(t)):t.t===Ze.TEXT||t.t===Ze.BUTTON?o.elems.push(new hn(t)):t.t===Ze.SHAPE&&o.elems.push(new cn(t))})),o}return On(e,t),e.prototype.getStylesForWrapper=function(){return this.cover?{}:((t=this.gvt===En.NW?{top:0,left:0}:this.gvt===En.N?{top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===En.NE?{top:0,right:0}:this.gvt===En.E?{top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===En.SE?{bottom:0,right:0}:this.gvt===En.S?{bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===En.SW?{bottom:0,left:0}:this.gvt===En.W?{top:"50%",left:0,transform:"translateY(-50%)"}:{top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"}).overflow="visible",t);var t},e.prototype.getFlexStylesForContainer=function(){var t,e,n={display:"flex",flexDirection:"row"};return this.gvt===En.NW?(t="flex-start",e="flex-start"):this.gvt===En.N?(t="center",e="flex-start"):this.gvt===En.NE?(t="flex-end",e="flex-start"):this.gvt===En.W?(t="flex-start",e="center"):this.gvt===En.E?(t="flex-end",e="center"):this.gvt===En.SW?(t="flex-start",e="flex-end"):this.gvt===En.S?(t="center",e="flex-end"):this.gvt===En.SE?(t="flex-end",e="flex-end"):(t="center",e="center"),n.alignItems=e,n.justifyContent=t,n.overflow="visible",n},e.prototype.overrideForMobileView=function(){var t,e,n,r,i,o,s,a;this.max=null!==(t=this.mob.max)&&void 0!==t?t:this.max,this.cover=null!==(e=this.mob.cover)&&void 0!==e?e:this.cover,this.gvt=null!==(n=this.mob.gvt)&&void 0!==n?n:this.gvt,this.bg=null!==(r=this.mob.bg)&&void 0!==r?r:this.bg,this.spc=null!==(i=this.mob.spc)&&void 0!==i?i:this.spc,this.anim=null!==(o=this.mob.anim)&&void 0!==o?o:this.anim,this.position=null!==(s=this.mob.position)&&void 0!==s?s:this.position,this.embedded=null!==(a=this.mob.embedded)&&void 0!==a?a:this.embedded},e}(Tn);!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"}(En||(En={}));var An,xn,Nn=function(){function t(t){var e,n;this.expireAt=(new Date).getTime(),this.id=t.id,this.expireAt=t.expireAt,this.version=t.version,this.engagementID=t.engagementID,this.internal=t.internal,this.pn=t.pn,this.ian=t.ian?new In(t.ian):void 0,this.previewType=t.previewType,this.delay=null!==(e=t.delay)&&void 0!==e?e:0,this.occurred=null!==(n=t.occurred)&&void 0!==n?n:(new Date).toISOString()}return t.prototype.shouldDelay=function(){return this.delay>0},t.prototype.getDelaySeconds=function(){var t=new Date(this.occurred),e=(new Date).getTime()-t.getTime();return 1e3*this.delay-e},t}(),Dn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Cn=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Ln=function(){function t(){this.loadedFonts=[]}return t.prototype.loadAllFonts=function(t){var e;return Dn(this,void 0,void 0,(function(){var n=this;return Cn(this,(function(r){return null===(e=t.elems)||void 0===e||e.forEach((function(t){t instanceof hn&&n.loadFamily(t.font.family)})),[2]}))}))},t.prototype.loadFamily=function(t){return Dn(this,void 0,void 0,(function(){var e;return Cn(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.fonts)?this.loadedFonts.indexOf(t.name)>-1?[2]:(e=[],t.fonts.forEach((function(n){if(n.url){var r=new FontFace(t.name,n.getURL(),n.getFontDescriptor());e.push(r.load())}})),this.loadedFonts.push(t.name),[4,Promise.all(e)]):[2];case 1:return n.sent().forEach((function(t){document.fonts.add(t)})),[2]}}))}))},t}();!function(t){t[t.CAMERA=1]="CAMERA",t[t.LOCATION=2]="LOCATION",t[t.PUSH=3]="PUSH"}(An||(An={})),function(t){t[t.IAB=1]="IAB",t[t.EXTERNAL=2]="EXTERNAL",t[t.PROMPT=3]="PROMPT",t[t.SAME_TAB=4]="SAME_TAB",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.KV_VIEW_ITEM=101]="KV_VIEW_ITEM",t[t.KV_ADD_TO_CART=102]="KV_ADD_TO_CART",t[t.KV_COUPON_CODE=103]="KV_COUPON_CODE",t[t.KV_VIEW_CATEGORY=104]="KV_VIEW_CATEGORY"}(xn||(xn={}));var Pn=function(){function e(){}return e.storeActiveTrigger=function(e){if((null==e?void 0:e.id)&&"test"!==e.id){var n=new a(e);return Be.setObject(t.STORAGE_ACTIVE_TRIGGER,n),n}},e}(),Rn=function(){return Rn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Rn.apply(this,arguments)},kn=function(){function t(t,e){this.action=t,this.apiService=cr.getInstance(),this.triggerContext=e}return t.prototype.execute=function(){this.closeAction();var t=this.action.custKV;switch(this.action.at){case xn.EXTERNAL:this.externalAction();break;case xn.IAB:this.iabAction();break;case xn.SAME_TAB:this.gotoURLAction();break;case xn.SHARE:this.shareAction();break;case xn.PROMPT:this.prompt();break;case xn.KEY_VALUE:case xn.KV_ADD_TO_CART:case xn.KV_COUPON_CODE:case xn.KV_VIEW_CATEGORY:case xn.KV_VIEW_ITEM:t=Rn(Rn({},t),this.action.kv);break;case void 0:break;default:return void i.error("Received an invalid ClickActionType: ",this.action.at)}this.upAction(),this.kvAction(t)},t.prototype.externalAction=function(){var t,e;if(null===(t=this.action.ext)||void 0===t?void 0:t.u){var n=this.action.ext.u;this.isValidURL(n)||(n="//".concat(n)),null===(e=window.open(n,"_blank"))||void 0===e||e.focus()}},t.prototype.isValidURL=function(t){try{new URL(t)}catch(t){return!1}return!0},t.prototype.gotoURLAction=function(){var t;if(null===(t=this.action.gu)||void 0===t?void 0:t.u){var e=this.action.gu.u;this.isValidURL(e)||(e="//".concat(e)),window.open(e,"_self")}},t.prototype.iabAction=function(){var t;if(null===(t=this.action.iab)||void 0===t?void 0:t.u){var e=this.action.iab.u;this.isValidURL(e)||(e="//".concat(e)),(new Wn).render(e)}},t.prototype.upAction=function(){this.action.up&&this.apiService.updateProfile(this.action.up)},t.prototype.kvAction=function(t){document.dispatchEvent(new CustomEvent("onCooeeCTA",{detail:t}))},t.prototype.prompt=function(){var t=this.action.pmpt;t&&(t===An.LOCATION&&this.promptLocationPermission(),t===An.PUSH&&this.promptPushNotificationPermission(),t===An.CAMERA&&this.promptCameraPermission())},t.prototype.closeAction=function(){var t;this.containsCTA()?(t="CTA",Pn.storeActiveTrigger(this.triggerContext.triggerData)):t="Close",this.action.close&&this.triggerContext.closeInApp(t)},t.prototype.shareAction=function(){this.action.share&&(navigator.share?navigator.share({text:this.action.share.text,title:"Share"}).then((function(t){return console.log(t)})).catch((function(t){return console.error(t)})):i.warn("Navigator.share is not compatible with this browser"))},t.prototype.containsCTA=function(){return!!this.action.at||!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))},t.prototype.isEmpty=function(t){return!t||0===Object.keys(t).length},t.prototype.promptLocationPermission=function(){var t=this;navigator.geolocation&&navigator.permissions&&navigator.geolocation.getCurrentPosition((function(e){t.apiService.updateDeviceProps({coords:[e.coords.latitude,e.coords.longitude]}),t.sendPermissionData()}))},t.prototype.promptPushNotificationPermission=function(){var t=this;"Notification"in window?"default"===Notification.permission?Notification.requestPermission().then((function(){t.sendPermissionData()})):this.apiService.updateDeviceProps({pnPerm:Notification.permission}):i.warn("This browser does not support desktop notification")},t.prototype.promptCameraPermission=function(){var t=this;navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally((function(){t.sendPermissionData()}))},t.prototype.checkPermission=function(t){return navigator.permissions.query({name:t}).then((function(t){return t.state.toString()}))},t.prototype.checkAllPermission=function(){return t=this,e=void 0,r=function(){var t,e,n;return 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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(r){switch(r.label){case 0:return[4,this.checkPermission("camera")];case 1:return t=r.sent(),[4,this.checkPermission("geolocation")];case 2:return e=r.sent(),n=Notification.permission,[2,{camera:t,location:e,notification:n}]}}))},new((n=void 0)||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}));var t,e,n,r},t.prototype.sendPermissionData=function(){var t=this;this.checkAllPermission().then((function(e){t.apiService.updateDeviceProps({perm:e})}))},t}(),Bn=function(){function t(t,e,n){this.renderer=Ce.get(),this.screenWidth=0,this.screenHeight=0,this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=n,this.scalingFactor=this.renderer.getScalingFactor(),this.screenWidth=this.renderer.getWidth(),this.screenHeight=this.renderer.getHeight()}return t.prototype.getHTMLElement=function(){return this.inappHTMLEl},t.prototype.insertElement=function(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)},t.prototype.processCommonBlocks=function(){this.processDisplay(),this.processWidthAndHeight(),this.processPositionBlock(),this.processBorderBlock(),this.processBackgroundBlock(),this.processSpaceBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction(),this.renderer.setStyle(this.inappHTMLEl,"box-sizing","border-box"),this.renderer.setStyle(this.inappHTMLEl,"outline","none")},t.prototype.processDisplay=function(){this.renderer.setStyle(this.inappHTMLEl,"display","block")},t.prototype.processWidthAndHeight=function(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.getSizePx(this.inappElement.h))},t.prototype.getSizePx=function(t){return this.getScaledSize(t)+"px"},t.prototype.getScaledSize=function(t){return t*this.scalingFactor},t.prototype.processPositionBlock=function(){this.renderer.setStyle(this.inappHTMLEl,"position","absolute"),this.inappElement.x&&this.renderer.setStyle(this.inappHTMLEl,"left",this.getSizePx(this.inappElement.x)),this.inappElement.y&&this.renderer.setStyle(this.inappHTMLEl,"top",this.getSizePx(this.inappElement.y))},t.prototype.processBorderBlock=function(){var t,e=this.inappElement.br;e&&(e.radius&&e.radius>0&&this.renderer.setStyle(this.inappHTMLEl,"border-radius",this.getSizePx(e.radius)),e.width&&e.width>0&&(this.renderer.setStyle(this.inappHTMLEl,"border-width",this.getSizePx(e.width)),this.renderer.setStyle(this.inappHTMLEl,"border-style",null===(t=e.style)||void 0===t?void 0:t.toLowerCase()),e.color?this.processColourBlock(e.color,"border-color"):this.renderer.setStyle(this.inappHTMLEl,"border-color","black")))},t.prototype.processSpaceBlock=function(){var t=this.inappElement.spc;t&&(t.pt&&this.renderer.setStyle(this.inappHTMLEl,"padding-top",this.getSizePx(t.pt)),t.pb&&this.renderer.setStyle(this.inappHTMLEl,"padding-bottom",this.getSizePx(t.pb)),t.pl&&this.renderer.setStyle(this.inappHTMLEl,"padding-left",this.getSizePx(t.pl)),t.pr&&this.renderer.setStyle(this.inappHTMLEl,"padding-right",this.getSizePx(t.pr)),this.renderer.setStyle(this.inappHTMLEl,"margin","0 !important"))},t.prototype.processTransparency=function(){var t=this.inappElement.alpha;if(!isNaN(t)){var e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}},t.prototype.processShadow=function(){var t=this.inappElement.shd;t&&this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor))},t.prototype.processTransformBlock=function(){var t=new rn(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform","rotate(".concat(t.rotate,"deg)"))},t.prototype.registerAction=function(){var t=this,e=this.inappElement.clc;e&&0!==Object.keys(e).length&&(this.inappHTMLEl.addEventListener("click",(function(n){n.stopPropagation(),new kn(e,t.triggerContext).execute()})),this.inappElement instanceof bn&&1===Object.keys(e).length&&void 0!==e.close&&null!==e.close||this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))},t.prototype.processBackgroundBlock=function(){var t=this.inappElement.bg;if(t){var e=this.inappHTMLEl;if(t.glossy){var n="backdrop-filter",r="-webkit-"+n,i="blur(".concat(t.glossy.radius,"px)");if(!CSS.supports(r,i)&&!CSS.supports(n,i))return void this.renderer.setStyle(e,"background",t.glossy.fallback.rgba);this.renderer.setStyle(e,r,i),this.renderer.setStyle(e,n,i),t.glossy.color&&this.processColourBlock(t.glossy.color,"background",e)}else if(t.solid)t.solid.grad?this.processGradient(t.solid.grad,"background"):t.solid.hex&&this.renderer.setStyle(e,"background",t.solid.rgba);else if(t.img){if(!t.img.src)return;var o='url("'.concat(t.img.src,'") no-repeat center');this.renderer.setStyle(e,"background",o),this.renderer.setStyle(e,"background-size","cover"),t.img.a&&(this.renderer.setStyle(e,"-webkit-backdrop-filter","opacity(".concat(t.img.a,")")),this.renderer.setStyle(e,"backdrop-filter","opacity(".concat(t.img.a,")")))}}},t.prototype.processGradient=function(t,e){if("LINEAR"===t.type){var n="linear-gradient(".concat(t.ang,"deg, ").concat(t.c1,", ").concat(t.c2);t.c3&&(n+=", ".concat(t.c3)),n+=")",this.renderer.setStyle(this.inappHTMLEl,e,n)}},t.prototype.processColourBlock=function(t,e,n){void 0===e&&(e="color"),void 0===n&&(n=this.inappHTMLEl),t&&(t.grad?this.processGradient(t.grad,e):t.hex&&this.renderer.setStyle(n,e,t.rgba))},t}(),Un=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mn=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return Un(e,t),e.prototype.processCommonBlocks=function(){t.prototype.processCommonBlocks.call(this),this.processFontBlock(),this.processColourBlock(this.inappElement.color),this.processAlignment()},e.prototype.processFontBlock=function(){var t;this.renderer.setStyle(this.inappHTMLEl,"letter-spacing","normal");var e=this.inappElement.font;e&&(this.renderer.setStyle(this.inappHTMLEl,"font-size",this.getSizePx(e.s)),this.renderer.setStyle(this.inappHTMLEl,"font-family",null===(t=e.family)||void 0===t?void 0:t.name),this.renderer.setStyle(this.inappHTMLEl,"line-height",e.lh))},e.prototype.processPart=function(t,e){var n,r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.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",r.join(" ")),this.renderer.setStyle(t,"color",null!==(n=e.c)&&void 0!==n?n:"inherit"),this.renderer.setStyle(t,"font-family","inherit")},e.prototype.processAlignment=function(){var t,e=null===(t=sn[this.inappElement.alg])||void 0===t?void 0:t.toLowerCase();e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)},e}(Bn),jn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Hn=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("div"),i.insertElement(),i}return jn(e,t),e.prototype.render=function(){var t,e=this;null===(t=this.inappElement.parts)||void 0===t||t.forEach((function(t){var n,r,i=e.renderer.createElement("span");i.innerHTML=null===(r=null===(n=t.txt)||void 0===n?void 0:n.toString())||void 0===r?void 0:r.replace(/\n/g,"<br />"),e.processPart(i,t),e.renderer.appendChild(e.inappHTMLEl,i)})),this.processCommonBlocks()},e}(Mn),Gn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fn=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("div"),i.insertElement(),i}return Gn(e,t),e.prototype.render=function(){this.processCommonBlocks()},e}(Bn),Vn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$n=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("img"),i.insertElement(),i}return Vn(e,t),e.prototype.render=function(){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()},e}(Bn),qn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Kn=function(e){function n(t,n,r){var i=e.call(this,t,n,r)||this;return i.parent=t,i.inappHTMLEl=i.renderer.createElement("div"),i}return qn(n,e),n.prototype.render=function(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(t.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",n.MAX_Z_INDEX),this.inappHTMLEl},n.prototype.processBackgroundBlock=function(){this.inappElement.cover&&e.prototype.processBackgroundBlock.call(this)},n.prototype.processWidthAndHeight=function(){var 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{var e=this.inappElement.spc,n=this.getScaledSize(t.w)+e.getHorizontal(),r=this.getScaledSize(t.h)+e.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",r+"px")}},n.prototype.processSpaceBlock=function(){var t=this.inappElement.spc;this.renderer.setStyle(this.inappHTMLEl,"padding",t.getPaddingCSS())},n.prototype.processDisplay=function(){this.renderer.setStyle(this.inappHTMLEl,"display","flex"),Object.assign(this.inappHTMLEl.style,this.inappElement.getStylesForWrapper()),Object.assign(this.inappHTMLEl.style,this.inappElement.getFlexStylesForContainer())},n.prototype.processPositionBlock=function(){var t;if(this.renderer.isParentNotBody()){if(null===(t=this.triggerContext.triggerData.ian)||void 0===t?void 0:t.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")},n.prototype.processBorderBlock=function(){},n.prototype.processTransparency=function(){},n.prototype.processTransformBlock=function(){},n.prototype.processGradient=function(){},n.prototype.processShadow=function(){},n.prototype.registerAction=function(){var t=this;this.inappHTMLEl.addEventListener("click",(function(){new kn({close:!0},t.triggerContext).execute()}))},n.MAX_Z_INDEX="2147483647",n}(Bn),Wn=function(){function e(){this.renderer=Ce.get()}return e.prototype.render=function(e){var n=document.querySelector(".".concat(t.IN_APP_WRAPPER_NAME)),r=this.createIFrameContainer();return this.createIFrameElement(r,e),this.createAnchorElement(n,r),this.renderer.appendChild(n,r),r},e.prototype.createIFrameContainer=function(){var t=this.renderer.createElement("div");return this.renderer.setAttribute(t,"class","iframe-container"),this.renderer.setAttribute(t,"id","iframe-container"),this.renderer.setStyle(t,"width","100%"),this.renderer.setStyle(t,"height","100%"),this.renderer.setStyle(t,"position","absolute"),this.renderer.setStyle(t,"top","0px"),this.renderer.setStyle(t,"left","0px"),t},e.prototype.createIFrameElement=function(t,e){var n=this.renderer.createElement("iframe");return this.renderer.setStyle(n,"width","100%"),this.renderer.setStyle(n,"height","100%"),this.renderer.setAttribute(n,"src",e),this.renderer.setAttribute(n,"frameBorder","0"),this.renderer.appendChild(t,n),n},e.prototype.createAnchorElement=function(t,e){var n=this.renderer.createElement("a");return this.renderer.setStyle(n,"position","absolute"),this.renderer.setStyle(n,"top","0px"),this.renderer.setStyle(n,"right","0px"),n.href="#",n.innerHTML="Close",n.onclick=function(){t.removeChild(e)},this.renderer.appendChild(e,n),n},e}(),zn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Jn=function(e){function n(t,n,r){var i=e.call(this,t,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("div"),i.insertElement(),i}return zn(n,e),n.prototype.render=function(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(t.IN_APP_CONTAINER_NAME),this},n}(Bn),Yn=function(){function e(t){var e=this;this.renderer=Ce.get(),this.safeHTTP=cr.getInstance(),this.resizeListener=function(){return e.screenResized()},this.setParentContainer(t)}return e.prototype.setParentContainer=function(t){this.parent=null!=t?t:document.body,this.renderer.setParentContainer(this.parent)},e.prototype.render=function(t){var e=this,n=new Nn(t);if(this.triggerContext=new yn(new Date,n),this.triggerContext.onClose((function(t){e.closeInApp(t)})),this.ian=n.ian,(this.renderer.isMobile()||"mobile"===n.previewType)&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){var r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}n.shouldDelay()?window.setTimeout((function(){e.startRenderingOnce()}),n.getDelaySeconds()):this.startRenderingOnce()},e.prototype.startRenderingOnce=function(){try{this.startRendering()}catch(t){return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener)},e.prototype.startRendering=function(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Kn(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(t){throw i.error(t),t}},e.prototype.sendTriggerDisplayed=function(){var e=new Bt(t.EVENT_TRIGGER_DISPLAYED,{},this.triggerContext.triggerData);this.safeHTTP.sendEvent(e)},e.prototype.sendTriggerClosed=function(e){var n=new Bt(t.EVENT_TRIGGER_CLOSED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(n)},e.prototype.addEnterAnimation=function(t){this.containerHTMLElement.animate(t.getEnterAnimation(),{duration:500})},e.prototype.renderElement=function(t,e,n){e instanceof hn?new Hn(t,e,n).render():e instanceof fn?new $n(t,e,n).render():e instanceof cn?new Fn(t,e,n).render():i.error("Unsupported element type- "+e.type)},e.prototype.renderContainer=function(t){var e,n,r=this,i=null===(e=this.ian)||void 0===e?void 0:e.cont;i&&(this.containerHTMLElement=new Jn(this.rootContainer,i,t).render().getHTMLElement(),(new Ln).loadAllFonts(this.ian),null===(n=this.ian.elems)||void 0===n||n.forEach((function(e){return n=r,i=void 0,s=function(){return 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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(n){switch(n.label){case 0:return[4,this.renderElement(this.containerHTMLElement,e,t)];case 1:return n.sent(),[2]}}))},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{u(s.next(t))}catch(t){e(t)}}function a(t){try{u(s.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}u((s=s.apply(n,i||[])).next())}));var n,i,o,s})),this.addEnterAnimation(this.ian.anim))},e.prototype.closeInApp=function(t){var e=this,n=this.ian.anim.getExitAnimation();this.containerHTMLElement.animate(n,{duration:500,easing:"ease-in-out"}).onfinish=function(){e.removeInApp(),e.sendTriggerClosed(t),window.removeEventListener("resize",e.resizeListener)}},e.prototype.screenResized=function(){this.removeInApp(),this.startRendering()},e.prototype.removeInApp=function(){Ce.get().removeInApp(this.triggerContext)},e}(),Xn=function(){function e(){this.inInactive=!1,this.lastEnterActive=new Date,this.lastEnterInactive=null,this.isDebug=!1}return e.getInstance=function(){return this.INSTANCE},e.prototype.getWebAppVersion=function(){var t;return null!==(t=this.webAppVersion)&&void 0!==t?t:"0.0.1+1"},e.prototype.setWebAppVersion=function(t){this.webAppVersion=t},e.prototype.isDebugWebApp=function(){return this.isDebug},e.prototype.setDebugWebApp=function(t){this.isDebug=t},e.prototype.isInactive=function(){return this.inInactive},e.prototype.setInactive=function(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Be.setNumber(t.STORAGE_LAST_ACTIVE,this.lastEnterInactive.getTime()),Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))},e.prototype.setActive=function(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0},e.prototype.isFirstActive=function(){return null==this.lastEnterInactive},e.prototype.setScreen=function(t){this.screen=t},e.prototype.getScreen=function(){return this.screen},e.INSTANCE=new e,e}(),Zn=function(){function e(){}return e.getInstance=function(){return this.INSTANCE||(this.INSTANCE=new e),this.INSTANCE},e.prototype.getCurrentSessionID=function(){return this.currentSessionID||null},e.prototype.checkForNewSession=function(){this.isNewSessionRequired()?this.startNewSession():this.initializeSessionFromStorage()},e.prototype.startNewSession=function(){this.currentSessionID||(this.currentSessionStartTime=new Date,this.currentSessionID=(new bt).toHexString(),Be.setNumber(t.STORAGE_SESSION_START_TIME,this.currentSessionStartTime.getTime()),Be.setString(t.STORAGE_SESSION_ID,this.currentSessionID),this.bumpSessionNumber(),cr.getInstance().sendEvent(new Bt(t.EVENT_SESSION_STARTED)))},e.prototype.bumpSessionNumber=function(){this.currentSessionNumber=Be.getNumber(t.STORAGE_SESSION_NUMBER,0),this.currentSessionNumber+=1,Be.setNumber(t.STORAGE_SESSION_NUMBER,this.currentSessionNumber)},e.prototype.getCurrentSessionNumber=function(){return this.currentSessionNumber||0},e.prototype.conclude=function(){var e={sessionID:this.currentSessionID,occurred:new Date,duration:this.getTotalDurationInSeconds()};cr.getInstance().concludeSession(e),Be.remove(t.STORAGE_ACTIVE_TRIGGER),this.destroySession()},e.prototype.destroySession=function(){this.currentSessionID=void 0,this.currentSessionNumber=void 0,this.currentSessionStartTime=void 0,Be.remove(t.STORAGE_SESSION_ID),Be.remove(t.STORAGE_SESSION_START_TIME)},e.prototype.isNewSessionRequired=function(){if(!Be.getString(t.STORAGE_SESSION_ID,""))return!0;var e=Be.getNumber(t.STORAGE_SESSION_START_TIME,0);return((new Date).getTime()-e)/1e3>t.IDLE_TIME_IN_SECONDS},e.prototype.getTotalDurationInSeconds=function(){if(Xn.getInstance().isFirstActive())throw new Error("This is the first time in foreground after launch");return(this.getLastActive()-this.currentSessionStartTime.getTime())/1e3},e.prototype.initializeSessionFromStorage=function(){this.currentSessionStartTime=new Date(Be.getNumber(t.STORAGE_SESSION_START_TIME,0)),this.currentSessionID=Be.getString(t.STORAGE_SESSION_ID,""),this.currentSessionNumber=Be.getNumber(t.STORAGE_SESSION_NUMBER,1)},e.prototype.getLastActive=function(){return Be.getNumber(t.STORAGE_LAST_ACTIVE,0)},e}(),Qn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},tr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},er=function(){function e(){this.runtimeData=Xn.getInstance(),this.apiToken="",this.userID=""}return e.getInstance=function(){return this.INSTANCE},e.prototype.registerDevice=function(t){return Qn(this,void 0,void 0,(function(){return tr(this,(function(e){return[2,this.doHTTP("POST","/v1/device/validate",this.getDefaultHeaders(),t)]}))}))},e.prototype.sendEvent=function(e){var n=this,r=this.getDefaultHeaders(),o=new a(Be.getObject(t.STORAGE_ACTIVE_TRIGGER));!e.trigger&&o&&(o.updateExpired(),e.trigger=o,"test"===o.triggerID)||(e.name!==t.EVENT_APP_BACKGROUND&&Xn.getInstance().setActive(),this.doHTTP("POST","/v1/event/track",r,e).then((function(t){i.log("Sent",e.name),t.triggerData&&(t.triggerData.occurred=e.occurred,(new Yn).render(t.triggerData)),n.updateUserIDAndToken({userID:t.userID,deviceID:t.deviceID,sdkToken:t.sdkToken})})).catch((function(t){i.error("Error sending event",t)})))},e.prototype.updateUserData=function(t){var e=this,n=this.getDefaultHeaders();this.doHTTP("PUT","/v1/user/update",n,t).then((function(t){i.log("Updated user profile"),e.updateUserIDAndToken(t)})).catch((function(t){i.error("Error saving user profile",t)}))},e.prototype.updateUserIDAndToken=function(e){e&&Object.keys(e).length&&(e.userID&&Be.setString(t.STORAGE_USER_ID,e.userID),e.deviceID&&Be.setString(t.STORAGE_DEVICE_ID,e.deviceID),e.sdkToken&&(this.setAPIToken(e.sdkToken),Be.setString(t.STORAGE_SDK_TOKEN,e.sdkToken)))},e.prototype.updateDeviceProps=function(e){var n=this.getDefaultHeaders();this.doHTTP("PUT","/v1/device/update",n,e).then((function(){i.log("Updated device property")})).catch((function(n){var r;i.error("Error saving device property",n),(null===(r=null==e?void 0:e.cart)||void 0===r?void 0:r.token)&&Be.remove(t.STORAGE_SHOPIFY_CART_TOKEN)}))},e.prototype.concludeSession=function(t){var e=this.getDefaultHeaders();this.doHTTP("POST","/v1/session/conclude",e,t).then((function(t){i.log("Conclude Session",t)})).catch((function(t){i.error(t)}))},e.prototype.logout=function(){var t=this,e=this.getDefaultHeaders();this.doHTTP("GET","/v1/user/logout",e).then((function(e){i.log("User logged out"),t.updateUserIDAndToken(e),Zn.getInstance().startNewSession()})).catch((function(t){i.error(t)}))},e.prototype.getAppConfigurations=function(){var e=this.getDefaultHeaders(),n=Be.getString(t.STORAGE_APP_ID);this.doHTTP("GET","/v1/app/configuration/".concat(n),e).then((function(t){i.log("Received app configuration"),je.processConfiguration(t)})).catch((function(t){i.error(t)}))},e.prototype.setAPIToken=function(t){this.apiToken=null!=t?t:""},e.prototype.doHTTP=function(e,n,r,i){return Qn(this,void 0,void 0,(function(){var o,s,a;return tr(this,(function(u){switch(u.label){case 0:return n.startsWith("http")||(n=t.API_URL+n),o="keepalive"in new Request(""),i&&!o&&JSON.stringify(i).includes("CE App Background")?[2,this.performXMLHttpRequest(n,r,i)]:(s={method:e,headers:r,keepalive:!0},i&&(s.body=JSON.stringify(i)),[4,fetch(n,s)]);case 1:if(!(a=u.sent()).ok)throw a;return[2,a.json()]}}))}))},e.prototype.performXMLHttpRequest=function(t,e,n){var r=new XMLHttpRequest;return r.open("POST",t,!1),e.forEach((function(t,e){r.setRequestHeader(e,t)})),r.send(JSON.stringify(n)),r.response.json()},e.prototype.getDefaultHeaders=function(){var e=new Headers;return e.set("content-type","application/json"),e.set("sdk-version",t.SDK_VERSION),e.set("sdk-version-code",t.SDK_VERSION_CODE.toString()),e.set("app-version",this.runtimeData.getWebAppVersion()),this.apiToken&&e.append("x-sdk-token",this.apiToken),t.SDK_DEBUG&&e.set("sdk-debug",String(1)),this.runtimeData.isDebugWebApp()&&e.set("app-debug",String(1)),e},e.INSTANCE=new e,e}(),nr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},rr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ir=function(){function e(){this.apiService=er.getInstance(),this.sdkToken="",this.userID="",this.deviceID="",this.appID="",this.shopifyShop=""}return e.getInstance=function(){return this.INSTANCE},e.prototype.init=function(t){return this.appID=t.appID,this.shopifyShop=t.shopifyShop,this.acquireSDKToken()},e.prototype.hasToken=function(){return!!Be.getString(t.STORAGE_SDK_TOKEN,"")},e.prototype.getUserID=function(){return this.userID},e.prototype.getDeviceID=function(){return this.deviceID},e.prototype.acquireSDKToken=function(){return nr(this,void 0,void 0,(function(){return rr(this,(function(t){return this.hasToken()?[2,this.populateUserDataFromStorage()]:(i.log("Attempt to acquire SDK token"),[2,this.getSDKTokenFromServer()])}))}))},e.prototype.saveUserDataInStorage=function(e){this.sdkToken=e.sdkToken,this.userID=e.userID,this.deviceID=e.deviceID,this.updateAPIClient(),Be.setString(t.STORAGE_SDK_TOKEN,this.sdkToken),Be.setString(t.STORAGE_USER_ID,this.userID),Be.setString(t.STORAGE_DEVICE_ID,this.deviceID),e.appID&&Be.setString(t.STORAGE_APP_ID,e.appID)},e.prototype.populateUserDataFromStorage=function(){return nr(this,void 0,void 0,(function(){return rr(this,(function(e){return this.sdkToken=Be.getString(t.STORAGE_SDK_TOKEN,""),this.sdkToken||i.warn("No SDK token found in local storage"),this.userID=Be.getString(t.STORAGE_USER_ID,""),this.userID||i.warn("No user ID found in local storage"),this.deviceID=Be.getString(t.STORAGE_DEVICE_ID,""),this.deviceID||i.warn("No device ID found in local storage"),this.updateAPIClient(),[2]}))}))},e.prototype.updateAPIClient=function(){i.log("SDK Token:",this.sdkToken),i.log("Device ID:",this.deviceID),i.log("User ID:",this.userID),this.apiService.setAPIToken(this.sdkToken)},e.prototype.getSDKTokenFromServer=function(){return nr(this,void 0,void 0,(function(){var t,e,n,r;return rr(this,(function(o){switch(o.label){case 0:return[4,this.getDeviceAuthRequest()];case 1:t=o.sent(),e=this.apiService.registerDevice(t),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,e];case 3:return n=o.sent(),i.log("Register Device Response",n),this.saveUserDataInStorage(n),je.processConfiguration(n),[3,5];case 4:throw r=o.sent(),i.error(r),r;case 5:return[2]}}))}))},e.prototype.getDeviceAuthRequest=function(){return nr(this,void 0,void 0,(function(){var t,e;return rr(this,(function(n){switch(n.label){case 0:return[4,(new Re).get()];case 1:t=n.sent(),Fe.addReferralData(t),t.host=location.origin,n.label=2;case 2:return n.trys.push([2,4,,5]),[4,(0,ke.r)()];case 3:return(null==(e=n.sent())?void 0:e.isPrivate)&&(t.private=!0),[3,5];case 4:return n.sent(),[3,5];case 5:return[2,new He(this.appID,this.shopifyShop,this.getOrCreateUUID(),t)]}}))}))},e.prototype.getOrCreateUUID=function(){var e=Be.getString(t.STORAGE_DEVICE_UUID,"");return e||(e=(new bt).toHexString(),Be.setString(t.STORAGE_DEVICE_UUID,e)),e},e.INSTANCE=new e,e}(),or=function(){function e(){}var n;return e.getString=function(t,e){return this.getItem(t)||e},e.setString=function(t,e){this.setItem(t,e)},e.remove=function(t){this.removeItem(t)},e.getItem=function(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))},e.setItem=function(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)},e.removeItem=function(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))},e.getAppID=function(){return Be.getString(t.STORAGE_APP_ID)},n=e,e.SESSION_STORAGE=window.sessionStorage,e.SESSION_STORAGE_KEY_PREFIX=t.COOEE.concat("/",n.getAppID(),"/"),e}(),sr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},ar=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ur=function(){function e(){this.sessionManager=Zn.getInstance(),this.safeHttpCallService=cr.getInstance(),this.deviceAuthService=ir.getInstance()}return e.prototype.init=function(n){var r=this;t.BOT_UA_REGEX.test(navigator.userAgent)?i.log("This seems to be a bot. Disabling SDK"):(this.deviceAuthService.init(n).then((function(){e.replaySubject.next(!0),e.replaySubject.complete()})).catch((function(){setTimeout((function(){r.init(n)}),3e4)})),this.execute())},e.prototype.execute=function(){this.sessionManager.checkForNewSession(),this.isAppFirstTimeLaunch()?this.sendFirstLaunchEvent():(this.sendSuccessiveLaunchEvent(),this.safeHttpCallService.getAppConfigurations())},e.prototype.isAppFirstTimeLaunch=function(){return!!Be.getBoolean(t.STORAGE_FIRST_TIME_LAUNCH,!0)&&(Be.setBoolean(t.STORAGE_FIRST_TIME_LAUNCH,!1),!0)},e.prototype.sendFirstLaunchEvent=function(){return sr(this,void 0,void 0,(function(){var e,n;return ar(this,(function(r){switch(r.label){case 0:return e=new Bt(t.EVENT_APP_INSTALLED,{}),n=e,[4,(new Re).get()];case 1:return n.deviceProps=r.sent(),this.safeHttpCallService.sendEvent(e),[2]}}))}))},e.prototype.sendSuccessiveLaunchEvent=function(){return sr(this,void 0,void 0,(function(){var e,n;return ar(this,(function(r){switch(r.label){case 0:return this.isNewTabOpened()?(e=new Bt(t.EVENT_APP_LAUNCHED),n=e,[4,(new Re).get()]):[2];case 1:return n.deviceProps=r.sent(),this.safeHttpCallService.sendEvent(e),[2]}}))}))},e.prototype.isNewTabOpened=function(){return!or.getString(t.SESSION_STORAGE_TAB_OPENED,"")&&(or.setString(t.SESSION_STORAGE_TAB_OPENED,"1"),!0)},e.replaySubject=new xe(1),e}(),cr=function(){function t(){this.sessionManager=Zn.getInstance(),this.httpApiService=er.getInstance()}return t.getInstance=function(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE},t.prototype.sendEvent=function(t){var e=this;ur.replaySubject.subscribe((function(){e.addEventData(t),e.httpApiService.sendEvent(t)}))},t.prototype.updateProfile=function(t){var e=this;t=null!=t?t:{},Fe.addReferralData(t),ur.replaySubject.subscribe((function(){e.httpApiService.updateUserData(t)}))},t.prototype.updateDeviceProps=function(t,e){var n=this;ur.replaySubject.subscribe((function(){n.httpApiService.updateDeviceProps({props:t,cart:e})}))},t.prototype.concludeSession=function(t){var e=this;ur.replaySubject.subscribe((function(){e.httpApiService.concludeSession(t)}))},t.prototype.logout=function(){var t=this;ur.replaySubject.subscribe((function(){t.httpApiService.logout()}))},t.prototype.getAppConfigurations=function(){var t=this;ur.replaySubject.subscribe((function(){t.httpApiService.getAppConfigurations()}))},t.prototype.addEventData=function(t){t.screenName=Xn.getInstance().getScreen(),t.properties.path=location.pathname,t.sessionID=this.sessionManager.getCurrentSessionID(),t.sessionNumber=this.sessionManager.getCurrentSessionNumber(),Fe.addReferralData(t.properties)},t}(),lr=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t},fr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function pr(t){if(t instanceof Ee)return t;if(null!=t){if(function(t){return qt(t[me])}(t))return o=t,new Ee((function(t){var e=o[me]();if(qt(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(lr(t))return i=t,new Ee((function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()}));if(qt(null==(r=t)?void 0:r.then))return n=t,new Ee((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,oe)}));if(function(t){return Symbol.asyncIterator&&qt(null==t?void 0:t[Symbol.asyncIterator])}(t))return hr(t);if(function(t){return qt(null==t?void 0:t[fr])}(t))return e=t,new Ee((function(t){var n,r;try{for(var i=Ht(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 qt(null==t?void 0:t.getReader)}(t))return hr(function(t){return $t(this,arguments,(function(){var e,n,r;return jt(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,Vt(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,Vt(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Vt(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 hr(t){return new Ee((function(e){(function(t,e){var n,r,i,o,s,a,u,c;return s=this,a=void 0,c=function(){var s,a;return jt(this,(function(u){switch(u.label){case 0:u.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=Ht(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),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((u=void 0)||(u=Promise))((function(t,e){function n(t){try{i(c.next(t))}catch(t){e(t)}}function r(t){try{i(c.throw(t))}catch(t){e(t)}}function i(e){var i;e.done?t(e.value):(i=e.value,i instanceof u?i:new u((function(t){t(i)}))).then(n,r)}i((c=c.apply(s,a||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function dr(t){return function(e){if(function(t){return qt(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 gr(t,e,n,r,i){return new yr(t,e,n,r,i)}var yr=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 Mt(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}(fe);function vr(t,e){return dr((function(n,r){var i=0;n.subscribe(gr(r,(function(n){r.next(t.call(e,n,i++))})))}))}function br(t,e,n){return void 0===n&&(n=1/0),qt(e)?br((function(n,r){return vr((function(t,i){return e(n,t,r,i)}))(pr(t(n,r)))}),n):("number"==typeof e&&(n=e),dr((function(e,r){return function(t,e,n,r,i,o,s,a){var u=[],c=0,l=0,f=!1,p=function(){!f||u.length||c||e.complete()},h=function(t){return c<r?d(t):u.push(t)},d=function(t){c++;var i=!1;pr(n(t,l++)).subscribe(gr(e,(function(t){e.next(t)}),(function(){i=!0}),void 0,(function(){if(i)try{c--;for(var t=function(){var t=u.shift();d(t)};u.length&&c<r;)t();p()}catch(t){e.error(t)}})))};return t.subscribe(gr(e,h,(function(){f=!0,p()}))),function(){}}(e,r,t,n)})))}var mr=Array.isArray;var wr=["addListener","removeListener"],Sr=["addEventListener","removeEventListener"],Er=["on","off"];function _r(t,e,n,r){if(qt(n)&&(r=n,n=void 0),r)return _r(t,e,n).pipe(function(t){return vr((function(e){return function(t,e){return mr(e)?t.apply(void 0,Ft([],Gt(e))):t(e)}(t,e)}))}(r));var i=Gt(function(t){return qt(t.addEventListener)&&qt(t.removeEventListener)}(t)?Sr.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return qt(t.addListener)&&qt(t.removeListener)}(t)?wr.map(Tr(t,e)):function(t){return qt(t.on)&&qt(t.off)}(t)?Er.map(Tr(t,e)):[],2),o=i[0],s=i[1];if(!o&&lr(t))return br((function(t){return _r(t,e,n)}))(pr(t));if(!o)throw new TypeError("Invalid event target");return new Ee((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 Tr(t,e){return function(n){return function(r){return t[n](e,r)}}}var Or=function(t){function e(e,n){return t.call(this)||this}return Mt(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(Jt),Ir={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Ir.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,Ft([t,e],Gt(n))):setInterval.apply(void 0,Ft([t,e],Gt(n)))},clearInterval:function(t){var e=Ir.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},Ar=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 Mt(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),Ir.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;Ir.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,zt(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Or),xr=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=Ae.now,t}(),Nr=new(function(t){function e(e,n){void 0===n&&(n=xr.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return Mt(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}(xr))(Ar),Dr=function(){function e(){this.apiService=cr.getInstance(),this._lastScreenOrScroll=new Date,this.lastPercent=0}return Object.defineProperty(e.prototype,"lastScreenOrScroll",{set:function(t){this._lastScreenOrScroll=t},enumerable:!1,configurable:!0}),e.getInstance=function(){return this.INSTANCE||(this.INSTANCE=new e),this.INSTANCE},e.prototype.listen=function(){var t,n,r=this;_r(window,"scroll").pipe((t=e.DEBOUNCE_TIME,void 0===n&&(n=Nr),dr((function(e,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 u(){var e=s+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);a()}e.subscribe(gr(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(u,t),r.add(i))}),(function(){a(),r.complete()}),void 0,(function(){o=i=null})))}))),vr((function(){var t=r.getPercentScrolledY(window.scrollY);if(Math.abs(r.lastPercent-t)>=e.THRESHOLD||100===t)return t}))).subscribe((function(t){r.sendScroll(t)}))},e.prototype.sendScroll=function(e){if(null!=e){var n={percent:e,timeMS:(new Date).getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;var r=or.getString(t.SESSION_STORAGE_SCROLL_ID,""),i=new Bt(t.EVENT_SCROLL,n,null,r);this.apiService.sendEvent(i),or.setString(t.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}},e.prototype.getPercentScrolledY=function(t){var e=window.document.body.scrollHeight,n=window.innerHeight;return Math.ceil((t+n)/e*100)},e.DEBOUNCE_TIME=1e3,e.THRESHOLD=10,e}(),Cr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Lr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Pr=function(){function e(){this.apiService=cr.getInstance(),this.runtimeData=Xn.getInstance()}return e.prototype.listen=function(){var t=this;document.onvisibilitychange=function(){"visible"===document.visibilityState?t.onVisible():"hidden"===document.visibilityState&&t.onHidden()}},e.prototype.onVisible=function(){return Cr(this,void 0,void 0,(function(){return Lr(this,(function(t){return[2]}))}))},e.prototype.onHidden=function(){return Cr(this,void 0,void 0,(function(){var n,r;return Lr(this,(function(o){return 0===(n=this.runtimeData.setInactive())?(i.info("Not sending background event as user was inactive on website"),[2]):(i.info("Sending background event with ".concat(n," seconds")),(r={})[e.ACTIVE_DURATION]=n,this.apiService.sendEvent(new Bt(t.EVENT_APP_BACKGROUND,r)),[2])}))}))},e.ACTIVE_DURATION="aDur",e.INACTIVE_DURATION="iaDur",e}(),Rr=function(){function e(){}return e.getAppIDFromScript=function(){var t,e=null===(t=document.currentScript)||void 0===t?void 0:t.src;if(e)return new URL(e).searchParams.get("appID")},e.prototype.init=function(){i.configure(),this.logBrand(),(new Pr).listen(),Dr.getInstance().listen(),(new s).meddle()},e.prototype.logBrand=function(){var e="\n";e+="📣 Boost your conversions\n",e+="📈 Increase purchases & repeat purchases\n",e+="🤖 AI-powered creative automation via an easy to use Canva style editor\n",e+="\n\n",e+="Learn more: https://www.letscooee.com\nCooee SDK: v".concat(t.SDK_VERSION),console.group("%c 1-to-1 personalised engagement for ecommerce success powered by 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".concat(e),"font-size: 13px; line-height: 1.8;"),console.groupEnd()},e}(),kr=function(){function t(){}return t.isNull=function(t){return!t||"null"===t||"undefined"===t},t.removeFromArray=function(t,e){var n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)},t}();const Br=function(){function e(){this.runtimeData=Xn.getInstance(),this.safeHttpCallService=cr.getInstance(),this.newSessionExecutor=new ur}return e.init=function(e){if(!this.initialized){var n=e.appID,r=e.shopifyShop;n=null==n?void 0:n.trim(),!kr.isNull(n)&&24===n.length||!kr.isNull(r)?(this.INSTANCE.newSessionExecutor.init(e),this.initialized=!0,n&&Be.setString(t.STORAGE_APP_ID,n)):i.warn("Cooee App ID or Shop name is not configured")}},e.setWebAppVersion=function(t){this.INSTANCE.runtimeData.setWebAppVersion(t)},e.setDebug=function(t){this.INSTANCE.runtimeData.setDebugWebApp(t)},e.sendEvent=function(t,e){for(var n in e)if(n.length>3&&n.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");this.INSTANCE.safeHttpCallService.sendEvent(new Bt(t,e))},e.updateProfile=function(t){for(var e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");this.INSTANCE.safeHttpCallService.updateProfile(t)},e.setScreen=function(e){if(e){var n=Xn.getInstance(),r=n.getScreen();if(e!==r){n.setScreen(e);var i={};r&&(i.ps=r);var o=new Bt(t.EVENT_SCREEN_VIEW,i);this.INSTANCE.safeHttpCallService.sendEvent(o),or.remove(t.SESSION_STORAGE_SCROLL_ID),Dr.getInstance().lastScreenOrScroll=new Date(o.occurred)}}},e.logout=function(){this.INSTANCE.safeHttpCallService.logout()},e.INSTANCE=new e,e}();window.cooeeMainScriptLoaded||(window.cooeeMainScriptLoaded=!0,(new Rr).init());var Ur=function(){function e(){}return e.sendCartToken=function(e){var n;if(null==e?void 0:e.token)if(null===(n=e.items)||void 0===n?void 0:n.length){var r=Be.getString(t.STORAGE_SHOPIFY_CART_TOKEN);e.token!=r?(i.info("Sending cart token",e.token),cr.getInstance().updateDeviceProps({},{token:e.token,items:e.items}),Be.setString(t.STORAGE_SHOPIFY_CART_TOKEN,e.token)):i.info("Cart token [".concat(e.token,"] already sent"))}else i.debug("No cart items available");else i.warn("No cart token found",e)},e}(),Mr=function(){function t(){}return t.prototype.setCookie=function(t,e,n,r){void 0===r&&(r="day"),"hour"===r?n=60*n*60*1e3:"minute"===r?n=60*n*1e3:"second"===r?n*=1e3:n=24*n*60*60*1e3;var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();return document.cookie=t+"="+e+";"+o+";path=/",e},t.prototype.getCookie=function(t,e){void 0===e&&(e={});for(var n=t+"=",r=decodeURIComponent(document.cookie).split(";"),i=0;i<r.length;i++){var o=r[i].trim();if(0===o.indexOf(n)){var s=o.substring(n.length,o.length);try{return JSON.parse(s)||e}catch(t){return s||e}}}return e},t.prototype.deleteCookie=function(t){return document.cookie=t+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/",!0},t}(),jr=function(){return jr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},jr.apply(this,arguments)},Hr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Gr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Fr=function(){function t(){this.cartItems=[],this.cookieHelper=new Mr,this.COOKIE_NAME="cooeeAddToCartEvent"}return t.prototype.track=function(){return this.fetchExistingCartItems(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod(),this.addSubmitListener(),this},t.prototype.fetchCart=function(){var t;return Hr(this,void 0,void 0,(function(){var e;return Gr(this,(function(n){switch(n.label){case 0:return i.debug("Fetching cart"),[4,fetch("/cart.js")];case 1:return[4,n.sent().json()];case 2:return e=n.sent(),i.debug("Fetched cart",e),Ur.sendCartToken(e),this.cartItems=null!==(t=e.items)&&void 0!==t?t:[],[2]}}))}))},t.prototype.sendAddToCart=function(t){var e=this.normaliseItems(t);e.length?Br.sendEvent("Add To Cart",{items:e}):i.debug("No items found to send add to cart event")},t.prototype.sendRemoveFromCart=function(t){var e=this.normaliseItems(t);e.length?Br.sendEvent("Remove From Cart",{items:e}):i.debug("No items found to send remove from cart event")},t.prototype.normaliseItems=function(t){var e,n;if(!t)return i.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);for(var r=[],o=0,s=t;o<s.length;o++){var a=s[o];a.id&&a.title?r.push({name:a.title,quantity:+a.quantity||1,id:null===(e=a.product_id)||void 0===e?void 0:e.toString(),mID:null===(n=a.product_id)||void 0===n?void 0:n.toString(),vID:a.id.toString()}):i.warn("Invalid item received",a)}return r},t.prototype.fetchExistingCartItems=function(){return Hr(this,void 0,void 0,(function(){var t,e=this;return Gr(this,(function(n){switch(n.label){case 0:return[4,this.fetchCart()];case 1:return n.sent(),"/cart"!==window.location.pathname||(t=this.getSavedItemFromCookie())&&this.cartItems.forEach((function(n){n.quantity=t.quantity,n.id===t.id&&(e.sendAddToCart(n),e.cookieHelper.deleteCookie(e.COOKIE_NAME))})),[2]}}))}))},t.prototype.overwriteXMLHttpRequest=function(){var t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(n){return this.addEventListener("load",(function(){t.performEvent(this._url,n,"XMLHttpRequest:send").catch((function(t){return i.error("Unable to process cart change in XMLHttpRequest",t)}))})),e.apply(this,arguments)}},t.prototype.overwriteFetchMethod=function(){var t=this,e=window.fetch;window.fetch=function(n,r){return e.apply(window,arguments).then((function(e){return t.performEvent(n.toString(),null==r?void 0:r.body,"window:fetch").catch((function(t){return i.error("Unable to process cart change in fetch",t)})),e}))}},t.prototype.addSubmitListener=function(){var t=this;document.addEventListener("submit",(function(e){var n=e.target.action,r=new URL(n).pathname;if(t.isCartAddURL(r)){var i=t.normaliseFormData(e.target);if(!i)return;var o={id:i.id,quantity:i.quantity};t.cookieHelper.setCookie(t.COOKIE_NAME,JSON.stringify(o),2,"minute")}}))},t.prototype.normaliseFormData=function(t){if(!t)return i.warn("No form data received to process",t),null;var e={};if(t instanceof HTMLFormElement)i.debug("Received form as HTMLFormElement",t),new FormData(t).forEach((function(t,n){"utf8"!==n&&(e[n]=t)}));else if(t instanceof FormData)i.debug("Received form as FormData",t),t.forEach((function(t,n){"utf8"!==n&&(e[n]=t)}));else{if("string"!=typeof t)return i.warn("Unidentified type of form data",typeof t),null;i.debug("Received form as sting",t);try{return JSON.parse(t)}catch(r){i.error("Could not parse as JSON string. Trying as query parameters");var n=void 0;try{n=new URL("".concat(location.origin,"?").concat(t))}catch(t){return i.error("Could not parse as query parameters",t),null}n.searchParams.forEach((function(t,n){e[n]=t}))}}return i.debug("Returning parsed object",e),e},t.prototype.isNumeric=function(t){return!isNaN(parseFloat(null==t?void 0:t.toString()))&&isFinite(null==t?void 0:t.toString())},t.prototype.performEvent=function(t,e,n){return Hr(this,void 0,void 0,(function(){return Gr(this,(function(r){switch(r.label){case 0:return e?this.isCartAddURL(t)?[4,this.onCartAdd(e)]:[3,2]:[2];case 1:return r.sent(),[3,5];case 2:return this.isCartUpdateURL(t)?[4,this.onChangeCart()]:[3,4];case 3:return r.sent(),[3,5];case 4:i.warn("[".concat(n,"]"),"No matching cart URL found",t),r.label=5;case 5:return[2]}}))}))},t.prototype.isCartAddURL=function(t){var e,n;return!!t.includes("/cart/add")||(null===(n=null===(e=window.CooeeSDK.routes)||void 0===e?void 0:e.cart)||void 0===n?void 0:n.add)===t},t.prototype.isCartUpdateURL=function(t){var e,n,r,i;return!(!t.includes("/cart/change")&&!t.includes("/cart/update"))||(null===(n=null===(e=window.CooeeSDK.routes)||void 0===e?void 0:e.cart)||void 0===n?void 0:n.update)===t||(null===(i=null===(r=window.CooeeSDK.routes)||void 0===r?void 0:r.cart)||void 0===i?void 0:i.change)===t},t.prototype.onCartAdd=function(t){var e,n;return Hr(this,void 0,void 0,(function(){var r,i,o;return Gr(this,(function(s){switch(s.label){case 0:return(r=this.normaliseFormData(t))?(i=(null===(n=null===(e=r.items)||void 0===e?void 0:e[0])||void 0===n?void 0:n.id)||r.id)?(o=this.getSavedItemFromCookie(),i===(null==o?void 0:o.id)&&this.cookieHelper.deleteCookie(this.COOKIE_NAME),[4,this.onChangeCart()]):[3,2]:[2];case 1:s.sent(),s.label=2;case 2:return[2]}}))}))},t.prototype.getSavedItemFromCookie=function(){var t=this.cookieHelper.getCookie(this.COOKIE_NAME);return(null==t?void 0:t.id)?(t.id=parseInt(t.id),this.isNumeric(t.id)?t:null):null},t.prototype.handleChangesInCartItems=function(t){var e=this;this.cartItems.forEach((function(n){var r=t.find((function(t){return t.key===n.key}));if(r){if(r.quantity!==n.quantity){var i=r.quantity<n.quantity,o=Math.abs(r.quantity-n.quantity),s=jr(jr({},n),{quantity:o});i?e.sendAddToCart(s):e.sendRemoveFromCart(s)}kr.removeFromArray(t,r)}else e.sendAddToCart(n)}));for(var n=0,r=t;n<r.length;n++){var i=r[n];this.sendRemoveFromCart(i)}},t.prototype.onChangeCart=function(){var t;return Hr(this,void 0,void 0,(function(){var e;return Gr(this,(function(n){switch(n.label){case 0:return e=null!==(t=this.cartItems)&&void 0!==t?t:[],[4,this.fetchCart()];case 1:return n.sent(),this.handleChangesInCartItems(e),[2]}}))}))},t}(),Vr=n(379),$r=n.n(Vr),qr=n(795),Kr=n.n(qr),Wr=n(569),zr=n.n(Wr),Jr=n(565),Yr=n.n(Jr),Xr=n(216),Zr=n.n(Xr),Qr=n(589),ti=n.n(Qr),ei=n(340),ni={};ni.styleTagTransform=ti(),ni.setAttributes=Yr(),ni.insert=zr().bind(null,"head"),ni.domAPI=Kr(),ni.insertStyleElement=Zr(),$r()(ei.Z,ni),ei.Z&&ei.Z.locals&&ei.Z.locals;var ri,ii=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},oi=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};!function(t){t.VIEW_ITEM="VIEW_ITEM",t.ADD_TO_CART="ADD_TO_CART",t.APPLY_COUPON="APPLY_COUPON"}(ri||(ri={}));var si=function(){function t(){}return t.prototype.listen=function(){var t=this;document.addEventListener("onCooeeCTA",(function(e){return ii(t,void 0,void 0,(function(){return oi(this,(function(t){switch(t.label){case 0:return[4,this.processEvent(e)];case 1:return t.sent(),[2]}}))}))}),!1)},t.prototype.processEvent=function(t){return ii(this,void 0,void 0,(function(){var e,n;return oi(this,(function(r){switch(r.label){case 0:return(e=null==t?void 0:t.detail)&&(n=e.actionType)?(i.log("Performing ".concat(n," action")),n!==ri.VIEW_ITEM?[3,1]:(this.performViewItem(e.item),[3,5])):[2];case 1:return n!==ri.ADD_TO_CART?[3,3]:[4,this.performAddToCart(e.item)];case 2:return r.sent(),[3,5];case 3:return n!==ri.APPLY_COUPON?[3,5]:[4,this.performApplyCoupon(e.coupon)];case 4:r.sent(),r.label=5;case 5:return[2]}}))}))},t.prototype.performViewItem=function(t){(null==t?void 0:t.link)&&(location.href=t.link)},t.prototype.performAddToCart=function(t){var e,n,r;return ii(this,void 0,void 0,(function(){var o,s,a,u;return oi(this,(function(c){switch(c.label){case 0:if(!t)return[2];o=window.CooeeSDK.routes.cart.add||"/cart/add",s={items:[{id:null!==(n=null!==(e=+t.vID)&&void 0!==e?e:+t.mID)&&void 0!==n?n:+t.id,quantity:null!==(r=t.quantity)&&void 0!==r?r:1}]},a=JSON.stringify(s),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,fetch(o,{body:a,method:"post",headers:{"Content-Type":"application/json"}})];case 2:return 200===c.sent().status&&(i.log("Added ".concat(null==t?void 0:t.name," to Cart")),this.updateCartIconAndOpenCart(t)),[3,4];case 3:return u=c.sent(),i.error("Failed to add product in cart",u),[3,4];case 4:return[2]}}))}))},t.prototype.updateCartIconAndOpenCart=function(t){for(var e=0,n=["cart:refresh","product:added","cart:build","ajaxProduct:added"];e<n.length;e++){var r=n[e];document.documentElement.dispatchEvent(new CustomEvent(r,{bubbles:!0,detail:{variant:t.vID||t.mID||t.id,quantity:t.quantity||1}}))}},t.prototype.performApplyCoupon=function(t){return ii(this,void 0,void 0,(function(){var e,n;return oi(this,(function(r){switch(r.label){case 0:if(!(null==t?void 0:t.code))return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(t.code)];case 2:return r.sent(),i.log("Code-".concat(t.code," copied")),(e=document.createElement("span")).id="snackbar",e.innerText="Copied",document.body.appendChild(e),e.className="show",setTimeout((function(){e.classList.remove("show"),document.body.removeChild(e)}),3e3),[3,4];case 3:return n=r.sent(),i.error("Failed to copy code",n),[3,4];case 4:return[2]}}))}))},t}(),ai=function(){function t(){}return t.prototype.track=function(){var t,e=null===(t=window.Shopify)||void 0===t?void 0:t.checkout,n=null==e?void 0:e.order_id;n&&(i.info("Found ".concat(n," to be send"),e),Br.updateProfile({order:{id:n.toString(),customerID:e.customer_id,url:location.href}}))},t}();if(!window.cooeeShopifyScriptLoaded){window.cooeeShopifyScriptLoaded=!0,i.configure(t.SHOPIFY_LOG_PREFIX),(new ai).track(),(new si).listen();var ui=(new Fr).track();window.sendCooeeAddToCart=ui.sendAddToCart.bind(ui),window.sendCooeeRemoveFromCart=ui.sendRemoveFromCart.bind(ui)}})(),CooeeShopify={}.default})();
2
+ (()=>{var t={716:(t,e)=>{"use strict";e.U=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.U=n},340:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(81),i=n.n(r),o=n(645),s=n.n(o)()(i());s.push([t.id,"#cooee-debugger {\n position: fixed;\n bottom: 10px;\n left: 10px;\n right: 0;\n width: 600px;\n height: 60px;\n background: white;\n z-index: 111111111111;\n overflow-y: auto;\n font-size: 13px;\n line-height: 1.5;\n padding: 5px 10px;\n font-family: Arial, 'sans-serif';\n font-weight: 500;\n border: 2px solid rgb(245, 28, 143);\n border-radius: 4px;\n resize: both;\n}\n",""]);const a=s},680:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var r=n(81),i=n.n(r),o=n(645),s=n.n(o)()(i());s.push([t.id,"#snackbar {\n visibility: hidden;\n color: #fff;\n background-color: #333;\n min-width: 250px;\n margin-left: -125px;\n border-radius: 2px;\n padding: 16px;\n text-align: center;\n left: 50%;\n bottom: 30px;\n z-index: 1;\n position: fixed;\n}\n\n#snackbar.show {\n visibility: visible;\n -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;\n animation: fadein 0.5s, fadeout 0.5s 2.5s;\n}\n\n/* Animations for fading in and out */\n@-webkit-keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: 30px;\n opacity: 1;\n }\n}\n\n@keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: 30px;\n opacity: 1;\n }\n}\n\n@-webkit-keyframes fadeout {\n from {\n bottom: 30px;\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n}\n\n@keyframes fadeout {\n from {\n bottom: 30px;\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n}\n",""]);const a=s},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var u=this[a][0];null!=u&&(s[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&s[l[0]]||(void 0!==o&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=o),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),i&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=i):l[4]="".concat(i)),e.push(l))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},145:(t,e)=>{"use strict";e.r=void 0,e.r=function(){return new Promise((function(t,e){var n,r,i="Unknown";function o(e){t({isPrivate:e,browserName:i})}function s(t){return t===eval.toString().length}void 0!==(r=navigator.vendor)&&0===r.indexOf("Apple")&&s(37)?(i="Safari",void 0!==navigator.maxTouchPoints?function(){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),o(!1)}catch(t){var s=t;return t instanceof Error&&(s=null!==(r=t.message)&&void 0!==r?r:t),o("string"==typeof s&&/BlobURLs are not yet supported/.test(s))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch(t){return o(!1)}}():function(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch(t){return o(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch(t){return o(!0)}o(!1)}()):function(){var t=navigator.vendor;return void 0!==t&&0===t.indexOf("Google")&&s(33)}()?(n=navigator.userAgent,i=n.match(/Chrome/)?void 0!==navigator.brave?"Brave":n.match(/Edg/)?"Edge":n.match(/OPR/)?"Opera":"Chrome":"Chromium",void 0!==self.Promise&&void 0!==self.Promise.allSettled?navigator.webkitTemporaryStorage.queryUsageAndQuota((function(t,e){var n;o(e<(void 0!==(n=window).performance&&void 0!==n.performance.memory&&void 0!==n.performance.memory.jsHeapSizeLimit?performance.memory.jsHeapSizeLimit:1073741824))}),(function(t){e(new Error("detectIncognito somehow failed to query storage quota: "+t.message))})):(0,window.webkitRequestFileSystem)(0,1,(function(){o(!1)}),(function(){o(!0)}))):void 0!==document.documentElement&&void 0!==document.documentElement.style.MozAppearance&&s(37)?(i="Firefox",o(void 0===navigator.serviceWorker)):void 0!==navigator.msSaveBlob&&s(39)?(i="Internet Explorer",o(void 0===window.indexedDB)):e(new Error("detectIncognito cannot determine the browser"))}))}},901:function(t,e,n){var r,i;!function(o){"use strict";var s,a={VERSION:"1.6.1"},u={},c=function(t,e){return function(){return e.apply(t,arguments)}},l=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},f=function(t,e){return{value:t,name:e}};a.TRACE=f(1,"TRACE"),a.DEBUG=f(2,"DEBUG"),a.INFO=f(3,"INFO"),a.TIME=f(4,"TIME"),a.WARN=f(5,"WARN"),a.ERROR=f(8,"ERROR"),a.OFF=f(99,"OFF");var p=function(t){this.context=t,this.setLevel(t.filterLevel),this.log=this.info};p.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(t){"string"==typeof t&&t.length>0&&this.invoke(a.TIME,[t,"start"])},timeEnd:function(t){"string"==typeof t&&t.length>0&&this.invoke(a.TIME,[t,"end"])},invoke:function(t,e){s&&this.enabledFor(t)&&s(e,l({level:t},this.context))}};var h,d=new p({filterLevel:a.OFF});(h=a).enabledFor=c(d,d.enabledFor),h.trace=c(d,d.trace),h.debug=c(d,d.debug),h.time=c(d,d.time),h.timeEnd=c(d,d.timeEnd),h.info=c(d,d.info),h.warn=c(d,d.warn),h.error=c(d,d.error),h.log=h.info,a.setHandler=function(t){s=t},a.setLevel=function(t){for(var e in d.setLevel(t),u)u.hasOwnProperty(e)&&u[e].setLevel(t)},a.getLevel=function(){return d.getLevel()},a.get=function(t){return u[t]||(u[t]=new p(l({name:t},d.context)))},a.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,s=console.log;i.level===a.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(s,[o+": "+((new Date).getTime()-e[o])+"ms"])):(i.level===a.WARN&&console.warn?s=console.warn:i.level===a.ERROR&&console.error?s=console.error:i.level===a.INFO&&console.info?s=console.info:i.level===a.DEBUG&&console.debug?s=console.debug:i.level===a.TRACE&&console.trace&&(s=console.trace),t.formatter(r,i),n(s,r))}},a.useDefaults=function(t){a.setLevel(t&&t.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(t))},a.setDefaults=a.useDefaults,void 0===(i="function"==typeof(r=a)?r.call(e,n,e,t):r)||(t.exports=i)}()},379:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var o={},s=[],a=0;a<t.length;a++){var u=t[a],c=r.base?u[0]+r.base:u[0],l=o[c]||0,f="".concat(c," ").concat(l);o[c]=l+1;var p=n(f),h={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(h);else{var d=i(h,r);r.byIndex=a,e.splice(a,0,{identifier:f,updater:d,references:1})}s.push(f)}return s}function i(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var o=r(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var u=r(t,i),c=0;c<o.length;c++){var l=n(o[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}o=u}}},569:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},238:function(t,e,n){var r;!function(i,o){"use strict";var s="function",a="undefined",u="object",c="string",l="model",f="name",p="type",h="vendor",d="version",g="architecture",y="console",v="mobile",b="tablet",m="smarttv",w="wearable",S="embedded",E="Amazon",_="Apple",T="ASUS",O="BlackBerry",I="Google",x="Huawei",A="LG",N="Microsoft",D="Motorola",C="Samsung",L="Sharp",P="Sony",R="Xiaomi",k="Zebra",U="Facebook",B=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},M=function(t,e){return typeof t===c&&-1!==j(e).indexOf(j(t))},j=function(t){return t.toLowerCase()},H=function(t,e){if(typeof t===c)return t=t.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof e===a?t:t.substring(0,350)},G=function(t,e){for(var n,r,i,a,c,l,f=0;f<e.length&&!c;){var p=e[f],h=e[f+1];for(n=r=0;n<p.length&&!c;)if(c=p[n++].exec(t))for(i=0;i<h.length;i++)l=c[++r],typeof(a=h[i])===u&&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;f+=2}},F=function(t,e){for(var n in e)if(typeof e[n]===u&&e[n].length>0){for(var r=0;r<e[n].length;r++)if(M(e[n][r],t))return"?"===n?o:n}else if(M(e[n],t))return"?"===n?o:n;return t},V={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"},$={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[d,[f,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[d,[f,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[f,d],[/opios[\/ ]+([\w\.]+)/i],[d,[f,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[d,[f,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[f,d],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[d,[f,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[d,[f,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[d,[f,"WeChat"]],[/konqueror\/([\w\.]+)/i],[d,[f,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[d,[f,"IE"]],[/yabrowser\/([\w\.]+)/i],[d,[f,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[f,/(.+)/,"$1 Secure Browser"],d],[/\bfocus\/([\w\.]+)/i],[d,[f,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[d,[f,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[d,[f,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[d,[f,"Dolphin"]],[/coast\/([\w\.]+)/i],[d,[f,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[d,[f,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[d,[f,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[f,"360 Browser"]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[f,/(.+)/,"$1 Browser"],d],[/(comodo_dragon)\/([\w\.]+)/i],[[f,/_/g," "],d],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[f,d],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[f],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[f,U],d],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[f,d],[/\bgsa\/([\w\.]+) .*safari\//i],[d,[f,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[d,[f,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[f,"Chrome WebView"],d],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[d,[f,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[f,d],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[d,[f,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[d,f],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[f,[d,F,{"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],[f,d],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[f,"Netscape"],d],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[d,[f,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\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|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[f,d]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,j]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",j]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,j]]],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],[l,[h,C],[p,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[h,C],[p,v]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[h,_],[p,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[h,_],[p,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[h,x],[p,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[h,x],[p,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[h,R],[p,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[h,R],[p,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[h,"OPPO"],[p,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[h,"Vivo"],[p,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[h,"Realme"],[p,v]],[/\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],[l,[h,D],[p,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[h,D],[p,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[h,A],[p,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[h,A],[p,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[h,"Lenovo"],[p,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[h,"Nokia"],[p,v]],[/(pixel c)\b/i],[l,[h,I],[p,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[h,I],[p,v]],[/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],[l,[h,P],[p,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[h,P],[p,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[h,"OnePlus"],[p,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[h,E],[p,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[h,E],[p,v]],[/(playbook);[-\w\),; ]+(rim)/i],[l,h,[p,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[h,O],[p,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[h,T],[p,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[h,T],[p,v]],[/(nexus 9)/i],[l,[h,"HTC"],[p,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[l,/_/g," "],[p,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[h,"Acer"],[p,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[h,"Meizu"],[p,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[h,L],[p,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,l,[p,v]],[/(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],[h,l,[p,b]],[/(surface duo)/i],[l,[h,N],[p,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[h,"Fairphone"],[p,v]],[/(u304aa)/i],[l,[h,"AT&T"],[p,v]],[/\bsie-(\w*)/i],[l,[h,"Siemens"],[p,v]],[/\b(rct\w+) b/i],[l,[h,"RCA"],[p,b]],[/\b(venue[\d ]{2,7}) b/i],[l,[h,"Dell"],[p,b]],[/\b(q(?:mv|ta)\w+) b/i],[l,[h,"Verizon"],[p,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[h,"Barnes & Noble"],[p,b]],[/\b(tm\d{3}\w+) b/i],[l,[h,"NuVision"],[p,b]],[/\b(k88) b/i],[l,[h,"ZTE"],[p,b]],[/\b(nx\d{3}j) b/i],[l,[h,"ZTE"],[p,v]],[/\b(gen\d{3}) b.+49h/i],[l,[h,"Swiss"],[p,v]],[/\b(zur\d{3}) b/i],[l,[h,"Swiss"],[p,b]],[/\b((zeki)?tb.*\b) b/i],[l,[h,"Zeki"],[p,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],l,[p,b]],[/\b(ns-?\w{0,9}) b/i],[l,[h,"Insignia"],[p,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[h,"NextBook"],[p,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],l,[p,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],l,[p,v]],[/\b(ph-1) /i],[l,[h,"Essential"],[p,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[h,"Envizen"],[p,b]],[/\b(trio[-\w\. ]+) b/i],[l,[h,"MachSpeed"],[p,b]],[/\btu_(1491) b/i],[l,[h,"Rotor"],[p,b]],[/(shield[\w ]+) b/i],[l,[h,"Nvidia"],[p,b]],[/(sprint) (\w+)/i],[h,l,[p,v]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[h,N],[p,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[h,k],[p,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[h,k],[p,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,l,[p,y]],[/droid.+; (shield) bui/i],[l,[h,"Nvidia"],[p,y]],[/(playstation [345portablevi]+)/i],[l,[h,P],[p,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[h,N],[p,y]],[/smart-tv.+(samsung)/i],[h,[p,m]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[h,C],[p,m]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,A],[p,m]],[/(apple) ?tv/i],[h,[l,"Apple TV"],[p,m]],[/crkey/i],[[l,"Chromecast"],[h,I],[p,m]],[/droid.+aft(\w)( bui|\))/i],[l,[h,E],[p,m]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[h,L],[p,m]],[/(bravia[\w ]+)( bui|\))/i],[l,[h,P],[p,m]],[/(mitv-\w{5}) bui/i],[l,[h,R],[p,m]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[h,H],[l,H],[p,m]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[p,m]],[/((pebble))app/i],[h,l,[p,w]],[/droid.+; (glass) \d/i],[l,[h,I],[p,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[h,k],[p,w]],[/(quest( 2)?)/i],[l,[h,U],[p,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[p,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[p,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[p,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[p,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[p,v]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[d,[f,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[d,[f,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[f,d],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[d,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,d],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[f,[d,F,V]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,"Windows"],[d,F,V]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[d,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[f,"Mac OS"],[d,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[d,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[f,d],[/\(bb(10);/i],[d,[f,O]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[d,[f,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[d,[f,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[d,[f,"webOS"]],[/crkey\/([\d\.]+)/i],[d,[f,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[f,"Chromium OS"],d],[/(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],[f,d],[/(sunos) ?([\w\.\d]*)/i],[[f,"Solaris"],d],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[f,d]]},q=function(t,e){if(typeof t===u&&(e=t,t=o),!(this instanceof q))return new q(t,e).getResult();var n=t||(typeof i!==a&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=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}($,e):$;return this.getBrowser=function(){var t,e={};return e.name=o,e.version=o,G.call(e,n,r.browser),e.major=typeof(t=e.version)===c?t.replace(/[^\d\.]/g,"").split(".")[0]:o,e},this.getCPU=function(){var t={};return t.architecture=o,G.call(t,n,r.cpu),t},this.getDevice=function(){var t={};return t.vendor=o,t.model=o,t.type=o,G.call(t,n,r.device),t},this.getEngine=function(){var t={};return t.name=o,t.version=o,G.call(t,n,r.engine),t},this.getOS=function(){var t={};return t.name=o,t.version=o,G.call(t,n,r.os),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 n},this.setUA=function(t){return n=typeof t===c&&t.length>350?H(t,350):t,this},this.setUA(n),this};q.VERSION="1.0.32",q.BROWSER=B([f,d,"major"]),q.CPU=B([g]),q.DEVICE=B([l,h,p,y,v,m,b,w,S]),q.ENGINE=q.OS=B([f,d]),typeof e!==a?(t.exports&&(e=t.exports=q),e.UAParser=q):n.amdO?(r=function(){return q}.call(e,n,e,t))===o||(t.exports=r):typeof i!==a&&(i.UAParser=q);var K=typeof i!==a&&(i.jQuery||i.Zepto);if(K&&!K.ua){var W=new q;K.ua=W.getResult(),K.ua.get=function(){return W.getUA()},K.ua.set=function(t){W.setUA(t);var e=W.getResult();for(var n in e)K.ua[n]=e[n]}}}("object"==typeof window?window:this)},147:t=>{"use strict";t.exports={i8:"1.4.1"}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.amdO={},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.nc=void 0,(()=>{"use strict";var t=function(){function t(){}var e,r;return e=t,t.API_URL="https://api.sdk.letscooee.com",t.SDK_VERSION=n(147).i8,t.SDK_DEBUG=!1,t.SDK="WEB",t.LOG_PREFIX="CooeeSDK",t.SHOPIFY_LOG_PREFIX="CooeeShopify",t.COOEE="cooee",t.CANVAS_WIDTH=1080,t.CANVAS_HEIGHT=1920,t.STORAGE_APP_ID="cooaid",t.STORAGE_USER_ID="uid",t.STORAGE_DEVICE_ID="coodid",t.STORAGE_SDK_TOKEN="st",t.STORAGE_DEVICE_UUID="uuid",t.STORAGE_SESSION_ID="sid",t.STORAGE_SESSION_NUMBER="sn",t.STORAGE_SESSION_START_TIME="sst",t.STORAGE_SESSION_START_EVENT_SENT="sses",t.STORAGE_FIRST_TIME_LAUNCH="ifl",t.STORAGE_LAST_ACTIVE="la",t.STORAGE_ACTIVE_TRIGGER="at",t.STORAGE_GA_ENABLED="gae",t.STORAGE_GA_CLIENT_ID="gacid",t.STORAGE_GA_MEASUREMENT_ID="gamid",t.STORAGE_SHOPIFY_CART_TOKEN="coosct",t.SESSION_STORAGE_TAB_OPENED="tabop",t.SESSION_STORAGE_SCROLL_ID="sleid",t.IDLE_TIME_IN_SECONDS=1800,t.IN_APP_WRAPPER_NAME="cooee-wrapper",t.IN_APP_CONTAINER_NAME="cooee-container",t.IN_APP_DEFAULT_PADDING=15,t.EVENT_SCREEN_VIEW="CE Screen View",t.EVENT_APP_INSTALLED="CE App Installed",t.EVENT_APP_LAUNCHED="CE App Launched",t.EVENT_SESSION_CONCLUDED="CE Session Concluded",t.EVENT_SESSION_STARTED="CE Session Started",t.EVENT_APP_FOREGROUND="CE App Foreground",t.EVENT_APP_BACKGROUND="CE App Background",t.EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed",t.EVENT_TRIGGER_CLOSED="CE Trigger Closed",t.EVENT_SCROLL="CE Scroll",t.EVENT_TRIGGER_CLICKED="CE Trigger Clicked",t.EVENT_ADD_TO_CART="Add To Cart",t.EVENT_VIEW_ITEM="View Item",t.EVENT_VIEW_CART="View Cart",t.BOT_USER_AGENTS_PATTERN="(googlebot/|bot|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)",t.BOT_UA_REGEX=new RegExp(e.BOT_USER_AGENTS_PATTERN,"i"),r=t.SDK_VERSION.split(".").map((function(t){return t.padStart(2,"0")})).join(""),t.SDK_VERSION_CODE=parseInt(r,10),t}(),e=n(901),r=n.n(e),i=function(){function e(){}return e.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().info.apply(r(),t)},e.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().debug.apply(r(),t)},e.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().error.apply(r(),t)},e.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().warn.apply(r(),t)},e.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().info.apply(r(),t)},e.trace=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r().trace.apply(r(),t)},e.configure=function(e){void 0===e&&(e=t.LOG_PREFIX),r().useDefaults({formatter:function(n){n.unshift("".concat(e," (v").concat(t.SDK_VERSION,"):"))}}),localStorage.cooeeLogLevel?r().setLevel(r()[localStorage.cooeeLogLevel]):r().setLevel(r().OFF)},e}(),o=n(379),s=n.n(o),a=n(795),u=n.n(a),c=n(569),l=n.n(c),f=n(565),p=n.n(f),h=n(216),d=n.n(h),g=n(589),y=n.n(g),v=n(340),b={};b.styleTagTransform=y(),b.setAttributes=p(),b.insert=l().bind(null,"head"),b.domAPI=u(),b.insertStyleElement=d(),s()(v.Z,b),v.Z&&v.Z.locals&&v.Z.locals;for(var m=function(){function t(){}return t.isShopify=function(){return!!window.Shopify},t.getShopName=function(){var t,e;if(this.isShopify())return null===(e=null===(t=window.Shopify.shop)||void 0===t?void 0:t.split("."))||void 0===e?void 0:e[0]},t.getScreenName=function(){if(this.isShopify()){var t=new URL(window.location.href).pathname.slice(1).split("/")[0];return""===t?"home":"collections"===t?"collection":"products"===t?"product":"cart"===t?"cart":void 0}},t}(),w=function(){function t(){this.existingSDKObject=window.CooeeSDK}return t.prototype.meddle=function(){var t,e,n,r;this.existingSDKObject||(this.existingSDKObject=window.CooeeSDK={events:[],profile:[],account:[],screen:[]}),this.existingSDKObject.account=null!==(t=this.existingSDKObject.account)&&void 0!==t?t:[],this.existingSDKObject.profile=null!==(e=this.existingSDKObject.profile)&&void 0!==e?e:[],this.existingSDKObject.events=null!==(n=this.existingSDKObject.events)&&void 0!==n?n:[],this.existingSDKObject.screen=null!==(r=this.existingSDKObject.screen)&&void 0!==r?r:[],this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.existingSDKObject.account.forEach(this.processAccount.bind(this)),this.existingSDKObject.events.forEach(this.processEvent.bind(this)),this.existingSDKObject.profile.forEach(this.processProfile.bind(this)),this.existingSDKObject.screen.forEach(this.processScreen.bind(this));var i=Yr.getAppIDFromScript(),o=m.getShopName();(i||o)&&Zr.init({appID:i,shopifyShop:o});var s=m.getScreenName();s&&Zr.setScreen(s)},t.prototype.overwritePush=function(t,e){Object.defineProperty(t,"push",{enumerable:!1,configurable:!1,writable:!1,value:e})},t.prototype.meddleAccount=function(){var t=this;this.overwritePush(this.existingSDKObject.account,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processAccount(e[0])}))},t.prototype.meddleEvents=function(){var t=this;this.overwritePush(this.existingSDKObject.events,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processEvent(e[0])}))},t.prototype.meddleProfile=function(){var t=this;this.overwritePush(this.existingSDKObject.profile,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processProfile(e[0])}))},t.prototype.meddleScreen=function(){var t=this;this.overwritePush(this.existingSDKObject.screen,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.processScreen(e[0])}))},t.prototype.processAccount=function(t){if(t){var e=Object.keys(t);t.appID||t.shopifyShop?(this.appIDReceived=!0,Zr.init(t)):e.includes("appVersion")?Zr.setWebAppVersion(t.appVersion):e.includes("debug")&&Zr.setDebug(t.debug)}},t.prototype.processEvent=function(t){t&&Zr.sendEvent(t[0],t[1])},t.prototype.processProfile=function(t){t&&Zr.updateProfile(t)},t.prototype.processScreen=function(t){t&&Zr.setScreen(t)},t}(),S=function(){function t(t){this.triggerID=t.id,this.engagementID=t.engagementID,this.expireAt=t.expireAt,this.updateExpired()}return t.prototype.isExpired=function(){return this.expireAt<(new Date).getTime()},t.prototype.updateExpired=function(){this.isExpired()&&(this.expired=!0)},t}(),E=[],_=[],T="undefined"!=typeof Uint8Array?Uint8Array:Array,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I=0,x=O.length;I<x;++I)E[I]=O[I],_[O.charCodeAt(I)]=I;function A(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 N(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(E[(i=r)>>18&63]+E[i>>12&63]+E[i>>6&63]+E[63&i]);return o.join("")}_["-".charCodeAt(0)]=62,_["_".charCodeAt(0)]=63;var D,C,L=function(t){var e,n,r=A(t),i=r[0],o=r[1],s=new T(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)e=_[t.charCodeAt(n)]<<18|_[t.charCodeAt(n+1)]<<12|_[t.charCodeAt(n+2)]<<6|_[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=_[t.charCodeAt(n)]<<2|_[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=_[t.charCodeAt(n)]<<10|_[t.charCodeAt(n+1)]<<4|_[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},P=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(N(t,s,s+o>a?a:s+o));return 1===r?(e=t[n-1],i.push(E[e>>2]+E[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(E[e>>10]+E[e>>4&63]+E[e<<2&63]+"=")),i.join("")},R=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,p=n?-1:1,h=t[e+f];for(f+=p,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+t[e+f],f+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+f],f+=p,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},k=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,d=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+h]=255&a,h+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+h]=255&s,h+=d,s/=256,c-=8);t[n+h-d]|=128*g},U=(D=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 u(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(F(t,Uint8Array)){var e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(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(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(F(t,SharedArrayBuffer)||t&&F(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|f(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||V(t.length)?i(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(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 u(t){return a(t),i(t<0?0:0|f(t))}function c(t){for(var e=t.length<0?0:0|f(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 f(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)||F(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 j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return r?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function h(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 x(this,e,n);case"utf8":case"utf-8":return _(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return I(this,e,n);case"base64":return E(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function d(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),V(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:y(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):y(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o,s=1,a=t.length,u=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,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,p=0;p<u;p++)if(c(t,o+p)!==c(e,p)){f=!1;break}if(f)return o}return-1}function v(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(V(a))return s;t[n+s]=a}return s}function b(t,e,n,r){return G(j(e,t.length-n),t,n,r)}function m(t,e,n,r){return G(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function w(t,e,n,r){return G(H(e),t,n,r)}function S(t,e,n,r){return G(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?P(t):P(t.slice(e,n))}function _(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,c=t[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=T));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 u(t)},o.allocUnsafeSlow=function(t){return u(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(F(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),F(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(F(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)d(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)d(this,e,e+3),d(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)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):h.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(F(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),u=Math.min(s,a),c=this.slice(r,i),l=t.slice(e,n),f=0;f<u;++f)if(c[f]!==l[f]){s=c[f],a=l[f];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 v(this,t,e,n);case"utf8":case"utf-8":return b(this,t,e,n);case"ascii":case"latin1":case"binary":return m(this,t,e,n);case"base64":return w(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(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 T=4096;function O(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 I(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 x(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+=$[t[o]];return i}function A(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 N(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 D(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 C(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 U(t,e,n,r,i){return e=+e,n>>>=0,i||C(t,0,n,4),k(t,e,n,r,23,4),n+4}function B(t,e,n,r,i){return e=+e,n>>>=0,i||C(t,0,n,8),k(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||N(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||N(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||N(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(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||N(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||N(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||N(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||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||N(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||N(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||N(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||N(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||N(t,4,this.length),R(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),R(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),R(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),R(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||D(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||D(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||D(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||D(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||D(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||D(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||D(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);D(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);D(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||D(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||D(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||D(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||D(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||D(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 U(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return U(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return B(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),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var M=/[^+/0-9A-Za-z-_]/g;function j(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 H(t){return L(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(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 F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function V(t){return t!=t}var $=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}()},D(C={exports:{}},C.exports),C.exports),B=U.Buffer;U.SlowBuffer,U.INSPECT_MAX_BYTES,U.kMaxLength;var M=function(t,e){return M=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])},M(t,e)};function j(t,e){function n(){this.constructor=t}M(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var H=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return j(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),G=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return j(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function F(t){return t&&t.Math==Math&&t}function V(){return F("object"==typeof globalThis&&globalThis)||F("object"==typeof window&&window)||F("object"==typeof self&&self)||F("object"==typeof n.g&&n.g)||Function("return this")()}var $=function(t){var e,n="object"==typeof(e=V()).navigator&&"ReactNative"===e.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(n);for(var r=B.alloc(t),i=0;i<t;++i)r[i]=Math.floor(256*Math.random());return r},q=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(B.alloc(e))}}return void 0!==n.g&&n.g.crypto&&n.g.crypto.getRandomValues?function(t){return n.g.crypto.getRandomValues(B.alloc(t))}:$}();function K(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function W(t){return"object"==typeof t&&null!==t}function z(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 J(t){if(ArrayBuffer.isView(t))return B.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return B.from(t);var e;throw new G("Must use either Buffer or TypedArray")}var Y=/^(?:[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,X=function(t){return"string"==typeof t&&Y.test(t)},Z=function(t){if(!X(t))throw new G('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 B.from(e,"hex")},Q=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")},tt=Symbol("id"),et=function(){function t(e){if(void 0===e)this.id=t.generate();else if(e instanceof t)this[tt]=B.from(e.id),this.__id=e.__id;else if(ArrayBuffer.isView(e)&&16===e.byteLength)this.id=J(e);else{if("string"!=typeof e)throw new G("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).");this.id=Z(e)}}return Object.defineProperty(t.prototype,"id",{get:function(){return this[tt]},set:function(e){this[tt]=e,t.cacheHexString&&(this.__id=Q(e))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(e){if(void 0===e&&(e=!0),t.cacheHexString&&this.__id)return this.__id;var n=Q(this.id,e);return t.cacheHexString&&(this.__id=n),n},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(!e)return!1;if(e instanceof t)return e.id.equals(this.id);try{return new t(e).id.equals(this.id)}catch(t){return!1}},t.prototype.toBinary=function(){return new nt(this.id,nt.SUBTYPE_UUID)},t.generate=function(){var t=q(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,B.from(t)},t.isValid=function(e){if(!e)return!1;if(e instanceof t)return!0;if("string"==typeof e)return X(e);if(K(e)){if(16!==e.length)return!1;try{return parseInt(e[6].toString(16)[0],10)===nt.SUBTYPE_UUID}catch(t){return!1}}return!1},t.createFromHexString=function(e){return new t(Z(e))},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t}();Object.defineProperty(et.prototype,"_bsontype",{value:"UUID"});var nt=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 G("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=B.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=B.from(e,"binary"):Array.isArray(e)?this.buffer=B.from(e):this.buffer=J(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new G("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new G("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 G("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=B.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=B.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(J(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 et(this.buffer.slice(0,this.position));throw new H('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=B.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=B.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,r=Z(e.$uuid)),!r)throw new G("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 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(nt.prototype,"_bsontype",{value:"Binary"});var rt=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(rt.prototype,"_bsontype",{value:"Code"});var it=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(it.prototype,"_bsontype",{value:"DBRef"});var ot=void 0;try{ot=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 st=4294967296,at=0x10000000000000000,ut=at/2,ct={},lt={},ft=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=lt[e])?i:(r=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(lt[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=ct[e])?i:(r=t.fromBits(e,e<0?-1:0,!1),o&&(ct[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>=at)return t.MAX_UNSIGNED_VALUE}else{if(e<=-ut)return t.MIN_VALUE;if(e+1>=ut)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%st|0,e/st|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 u=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+u),r);if(u<8){var l=t.fromNumber(Math.pow(r,u));s=s.mul(l).add(t.fromNumber(c))}else s=(s=s.mul(o)).add(t.fromNumber(c))}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 W(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,u=e.low>>>16,c=0,l=0,f=0,p=0;return f+=(p+=o+(65535&e.low))>>>16,p&=65535,l+=(f+=i+u)>>>16,f&=65535,c+=(l+=r+a)>>>16,l&=65535,c+=n+s,c&=65535,t.fromBits(f<<16|p,c<<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(ot){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?ot.div_u:ot.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,ot.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),u=t.fromNumber(r),c=u.mul(e);c.isNegative()||c.gt(i);)r-=a,c=(u=t.fromNumber(r,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),o=o.add(u),i=i.sub(c)}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&&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 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(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)),ot){var n=(this.unsigned?ot.rem_u:ot.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,ot.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)),ot){var n=ot.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,ot.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,u=65535&e.high,c=e.low>>>16,l=65535&e.low,f=0,p=0,h=0,d=0;return h+=(d+=s*l)>>>16,d&=65535,p+=(h+=o*l)>>>16,h&=65535,p+=(h+=s*c)>>>16,h&=65535,f+=(p+=i*l)>>>16,p&=65535,f+=(p+=o*c)>>>16,p&=65535,f+=(p+=s*u)>>>16,p&=65535,f+=r*l+i*c+o*u+s*a,f&=65535,t.fromBits(h<<16|d,f<<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)*st+(this.low>>>0):this.high*st+(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 u=s.div(o),c=(s.sub(u.mul(o)).toInt()>>>0).toString(e);if((s=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+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(ft.prototype,"__isLong__",{value:!0}),Object.defineProperty(ft.prototype,"_bsontype",{value:"Long"});var pt=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,ht=/^(\+|-)?(Infinity|inf)$/i,dt=/^(\+|-)?NaN$/i,gt=6111,yt=-6176,vt=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),bt=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),mt=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),wt=/^([-+])?(\d+)?$/;function St(t){return!isNaN(parseInt(t,10))}function Et(t){var e=ft.fromNumber(1e9),n=ft.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 ft(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function _t(t,e){throw new G('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Tt=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!K(e))throw new G("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new G("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,u=0,c=0,l=0,f=[0],p=0,h=0,d=0,g=0,y=0,v=0,b=new ft(0,0),m=new ft(0,0),w=0;if(e.length>=7e3)throw new G(e+" not a valid Decimal128 string");var S=e.match(pt),E=e.match(ht),_=e.match(dt);if(!S&&!E&&!_||0===e.length)throw new G(e+" not a valid Decimal128 string");if(S){var T=S[2],O=S[4],I=S[5],x=S[6];O&&void 0===x&&_t(e,"missing exponent power"),O&&void 0===T&&_t(e,"missing exponent base"),void 0===O&&(I||x)&&_t(e,"missing e before exponent")}if("+"!==e[w]&&"-"!==e[w]||(r="-"===e[w++]),!St(e[w])&&"."!==e[w]){if("i"===e[w]||"I"===e[w])return new t(B.from(r?bt:mt));if("N"===e[w])return new t(B.from(vt))}for(;St(e[w])||"."===e[w];)"."!==e[w]?(p<34&&("0"!==e[w]||o)&&(o||(l=a),o=!0,f[h++]=parseInt(e[w],10),p+=1),o&&(u+=1),i&&(c+=1),a+=1,w+=1):(i&&_t(e,"contains multiple periods"),i=!0,w+=1);if(i&&!a)throw new G(e+" not a valid Decimal128 string");if("e"===e[w]||"E"===e[w]){var A=e.substr(++w).match(wt);if(!A||!A[2])return new t(B.from(vt));y=parseInt(A[0],10),w+=A[0].length}if(e[w])return new t(B.from(vt));if(d=0,p){if(g=p-1,1!==(s=u))for(;0===f[l+s-1];)s-=1}else d=0,g=0,f[0]=0,u=1,p=1,s=0;for(y<=c&&c-y>16384?y=yt:y-=c;y>gt;){if((g+=1)-d>34){if(f.join("").match(/^0+$/)){y=gt;break}_t(e,"overflow")}y-=1}for(;y<yt||p<u;){if(0===g&&s<p){y=yt,s=0;break}if(p<u?u-=1:g-=1,y<gt)y+=1;else{if(f.join("").match(/^0+$/)){y=gt;break}_t(e,"overflow")}}if(g-d+1<s){var N=a;i&&(l+=1,N+=1),r&&(l+=1,N+=1);var D=parseInt(e[l+g+1],10),C=0;if(D>=5&&(C=1,5===D))for(C=f[g]%2==1?1:0,v=l+g+2;v<N;v++)if(parseInt(e[v],10)){C=1;break}if(C)for(var L=g;L>=0;L--)if(++f[L]>9&&(f[L]=0,0===L)){if(!(y<gt))return new t(B.from(r?bt:mt));y+=1,f[L]=1}}if(b=ft.fromNumber(0),m=ft.fromNumber(0),0===s)b=ft.fromNumber(0),m=ft.fromNumber(0);else if(g-d<17)for(L=d,m=ft.fromNumber(f[L++]),b=new ft(0,0);L<=g;L++)m=(m=m.multiply(ft.fromNumber(10))).add(ft.fromNumber(f[L]));else{for(L=d,b=ft.fromNumber(f[L++]);L<=g-17;L++)b=(b=b.multiply(ft.fromNumber(10))).add(ft.fromNumber(f[L]));for(m=ft.fromNumber(f[L++]);L<=g;L++)m=(m=m.multiply(ft.fromNumber(10))).add(ft.fromNumber(f[L]))}var P,R,k,U,M=function(t,e){if(!t&&!e)return{high:ft.fromNumber(0),low:ft.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new ft(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new ft(e.getLowBits(),0),s=n.multiply(i),a=n.multiply(o),u=r.multiply(i),c=r.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new ft(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new ft(c.getLowBits(),0))}}(b,ft.fromString("100000000000000000"));M.low=M.low.add(m),R=m,((k=(P=M.low).high>>>0)<(U=R.high>>>0)||k===U&&P.low>>>0<R.low>>>0)&&(M.high=M.high.add(ft.fromNumber(1))),n=y+6176;var j={low:ft.fromNumber(0),high:ft.fromNumber(0)};M.high.shiftRightUnsigned(49).and(ft.fromNumber(1)).equals(ft.fromNumber(1))?(j.high=j.high.or(ft.fromNumber(3).shiftLeft(61)),j.high=j.high.or(ft.fromNumber(n).and(ft.fromNumber(16383).shiftLeft(47))),j.high=j.high.or(M.high.and(ft.fromNumber(0x7fffffffffff)))):(j.high=j.high.or(ft.fromNumber(16383&n).shiftLeft(49)),j.high=j.high.or(M.high.and(ft.fromNumber(562949953421311)))),j.low=M.low,r&&(j.high=j.high.or(ft.fromString("9223372036854775808")));var H=B.alloc(16);return w=0,H[w++]=255&j.low.low,H[w++]=j.low.low>>8&255,H[w++]=j.low.low>>16&255,H[w++]=j.low.low>>24&255,H[w++]=255&j.low.high,H[w++]=j.low.high>>8&255,H[w++]=j.low.high>>16&255,H[w++]=j.low.high>>24&255,H[w++]=255&j.high.low,H[w++]=j.high.low>>8&255,H[w++]=j.high.low>>16&255,H[w++]=j.high.low>>24&255,H[w++]=255&j.high.high,H[w++]=j.high.high>>8&255,H[w++]=j.high.high>>16&255,H[w++]=j.high.high>>24&255,new t(H)},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,u=!1,c={parts:[0,0,0,0]},l=[];a=0;var f=this.bytes,p=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,h=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,d=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,g=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24;a=0,(new ft(p,h),new ft(d,g)).lessThan(ft.ZERO)&&l.push("-");var y=g>>26&31;if(y>>3==3){if(30===y)return l.join("")+"Infinity";if(31===y)return"NaN";t=g>>15&16383,i=8+(g>>14&1)}else i=g>>14&7,t=g>>17&16383;var v=t-6176;if(c.parts[0]=(16383&g)+((15&i)<<14),c.parts[1]=d,c.parts[2]=h,c.parts[3]=p,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])u=!0;else for(s=3;s>=0;s--){var b=0,m=Et(c);if(c=m.quotient,b=m.rem.low)for(o=8;o>=0;o--)n[9*s+o]=b%10,b=Math.floor(b/10)}if(u)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var w=e-1+v;if(w>=34||w<=-7||v>0){if(e>34)return l.push("".concat(0)),v>0?l.push("E+".concat(v)):v<0&&l.push("E".concat(v)),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"),w>0?l.push("+".concat(w)):l.push("".concat(w))}else if(v>=0)for(r=0;r<e;r++)l.push("".concat(n[a++]));else{var S=e+v;if(S>0)for(r=0;r<S;r++)l.push("".concat(n[a++]));else l.push("0");for(l.push(".");S++<0;)l.push("0");for(r=0;r<e-Math.max(S-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(Tt.prototype,"_bsontype",{value:"Decimal128"});var Ot=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))}:(Number.isInteger(this.value)?(e=this.value.toFixed(1)).length>=13&&(e=this.value.toExponential(13).toUpperCase()):e=this.value.toString(),{$numberDouble:e});var e},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(Ot.prototype,"_bsontype",{value:"Double"});var It=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(It.prototype,"_bsontype",{value:"Int32"});var xt=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(xt.prototype,"_bsontype",{value:"MaxKey"});var At=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(At.prototype,"_bsontype",{value:"MinKey"});var Nt=new RegExp("^[0-9a-fA-F]{24}$"),Dt=null,Ct=Symbol("id"),Lt=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 G("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?B.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Ct]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Ct]=n instanceof B?n:J(n);else{if("string"!=typeof n)throw new G("Argument passed in does not match the accepted types");if(12===n.length){var r=B.from(n);if(12!==r.byteLength)throw new G("Argument passed in must be a string of 12 bytes");this[Ct]=r}else{if(24!==n.length||!Nt.test(n))throw new G("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Ct]=B.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ct]},set:function(e){this[Ct]=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=B.alloc(12);return r.writeUInt32BE(e,0),null===Dt&&(Dt=q(5)),r[4]=Dt[0],r[5]=Dt[1],r[6]=Dt[2],r[7]=Dt[3],r[8]=Dt[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[Ct][11]===e[Ct][11]&&this[Ct].equals(e[Ct]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&K(this.id))return e===B.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 B.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=B.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 G("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(B.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(Lt.prototype,"generate",{value:z((function(t){return Lt.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Lt.prototype,"getInc",{value:z((function(){return Lt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Lt.prototype,"get_inc",{value:z((function(){return Lt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Lt,"get_inc",{value:z((function(){return Lt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Lt.prototype,"_bsontype",{value:"ObjectID"});var Pt=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 H("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new H("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 H("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 G("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Pt.prototype,"_bsontype",{value:"BSONRegExp"});var Rt=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(Rt.prototype,"_bsontype",{value:"Symbol"});var kt=function(t){function e(n,r){var i=this;return i instanceof e?(i=ft.isLong(n)?t.call(this,n.low,n.high,!0)||this:W(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 j(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(ft.fromInt(t,!0))},e.fromNumber=function(t){return new e(ft.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(ft.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=ft.MAX_UNSIGNED_VALUE,e}(ft);var Ut=2147483647,Bt=-2147483648,Mt=0x8000000000000000,jt=-0x8000000000000000,Ht={$oid:Lt,$binary:nt,$uuid:nt,$symbol:Rt,$numberInt:It,$numberDecimal:Tt,$numberDouble:Ot,$numberLong:ft,$minKey:At,$maxKey:xt,$regex:Pt,$regularExpression:Pt,$timestamp:kt};function Gt(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Bt&&t<=Ut)return new It(t);if(t>=jt&&t<=Mt)return ft.fromNumber(t)}return new Ot(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=Ht[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)):ft.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=Gt(t.$scope)),rt.fromExtendedJSON(t)}if(function(t){return W(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof it)return u;var c=Object.keys(u).filter((function(t){return t.startsWith("$")})),l=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(l=!1)})),l)return it.fromExtendedJSON(u)}return t}function Ft(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function Vt(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],u=" ".repeat(i.length+o.length/2),c="-".repeat(s.length+(o.length+a.length)/2-1);throw new G("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(u,"\\").concat(c,"/"))}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 Vt(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||W(p=t)&&"[object Date]"===Object.prototype.toString.call(p)){var l=t.getTime(),f=l>-1&&l<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:Ft(t)}:e.relaxed&&f?{$date:Ft(t)}:{$date:{$numberLong:t.getTime().toString()}}}var p;if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var h=t>=jt&&t<=Mt;if(t>=Bt&&t<=Ut)return{$numberInt:t.toString()};if(h)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 g=t.toString().match(/[gimuy]*$/);g&&(d=g[0])}return new Pt(t.source,d).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new H("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=Vt(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 W(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=qt[t._bsontype];if(!a)throw new G("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new rt(s.code,Vt(s.scope,e)):"DBRef"===n&&s.oid&&(s=new it(Vt(s.collection,e),Vt(s.oid,e),Vt(s.db,e),Vt(s.fields,e))),s.toExtendedJSON(e)}throw new H("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var $t,qt={Binary:function(t){return new nt(t.value(),t.sub_type)},Code:function(t){return new rt(t.code,t.scope)},DBRef:function(t){return new it(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Tt(t.bytes)},Double:function(t){return new Ot(t.value)},Int32:function(t){return new It(t.value)},Long:function(t){return ft.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 xt},MinKey:function(){return new At},ObjectID:function(t){return new Lt(t)},ObjectId:function(t){return new Lt(t)},BSONRegExp:function(t){return new Pt(t.pattern,t.options)},Symbol:function(t){return new Rt(t.value)},Timestamp:function(t){return kt.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 H("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return Gt(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=Vt(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)}}($t||($t={}));var Kt=V();Kt.Map?Kt.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})}(),Math.pow(2,63),Math.pow(2,63);var Wt=Math.pow(2,53),zt=-Math.pow(2,53);ft.fromNumber(Wt),ft.fromNumber(zt),new Set(["$db","$ref","$id","$clusterTime"]);var Jt=new Uint8Array(8);new DataView(Jt.buffer,Jt.byteOffset,Jt.byteLength);B.alloc(17825792);var Yt=function(t,e,n,r){void 0===e&&(e={}),this.name=t,this.properties=e,this.sessionID=null,this.screenName=null,this.deviceProps=null,this.sessionNumber=0,this.activeTriggers=[],this.id=r?new Lt(r):new Lt,this.occurred=(new Date).toISOString(),n&&(this.trigger=new S(n)),this.newEvent=!r},Xt=function(t,e){return Xt=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])},Xt(t,e)};function Zt(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}Xt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function Qt(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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function te(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 ee(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 ne(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 re(t){return this instanceof re?(this.v=t,this):new re(t)}function ie(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=i[t](e)).value instanceof re?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){a("next",t)}function c(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function oe(t){return"function"==typeof t}function se(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;var ae=se((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 ue(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var ce=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=te(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 u=this.initialTeardown;if(oe(u))try{u()}catch(t){i=t instanceof ae?t.errors:[t]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=te(c),f=l.next();!f.done;f=l.next()){var p=f.value;try{pe(p)}catch(t){i=null!=i?i:[],t instanceof ae?i=ne(ne([],ee(i)),ee(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new ae(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)pe(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)&&ue(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&ue(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),le=ce.EMPTY;function fe(t){return t instanceof ce||t&&"closed"in t&&oe(t.remove)&&oe(t.add)&&oe(t.unsubscribe)}function pe(t){oe(t)?t():t.unsubscribe()}var he=null,de=null,ge=void 0,ye=!1,ve=!1,be={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=be.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,ne([t,e],ee(n))):setTimeout.apply(void 0,ne([t,e],ee(n)))},clearTimeout:function(t){var e=be.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function me(t){be.setTimeout((function(){if(!he)throw t;he(t)}))}function we(){}var Se=Ee("C",void 0,void 0);function Ee(t,e,n){return{kind:t,value:e,error:n}}var _e=null;function Te(t){if(ye){var e=!_e;if(e&&(_e={errorThrown:!1,error:null}),t(),e){var n=_e,r=n.errorThrown,i=n.error;if(_e=null,r)throw i}}else t()}var Oe=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,fe(e)&&e.add(n)):n.destination=Le,n}return Zt(e,t),e.create=function(t,e,n){return new Ne(t,e,n)},e.prototype.next=function(t){this.isStopped?Ce(function(t){return Ee("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Ce(Ee("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Ce(Se,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}(ce),Ie=Function.prototype.bind;function xe(t,e){return Ie.call(t,e)}var Ae=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){De(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){De(t)}else De(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){De(t)}},t}(),Ne=function(t){function e(e,n,r){var i,o,s=t.call(this)||this;return oe(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&ve?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&xe(e.next,o),error:e.error&&xe(e.error,o),complete:e.complete&&xe(e.complete,o)}):i=e,s.destination=new Ae(i),s}return Zt(e,t),e}(Oe);function De(t){var e;ye?(e=t,ye&&_e&&(_e.errorThrown=!0,_e.error=e)):me(t)}function Ce(t,e){var n=de;n&&be.setTimeout((function(){return n(t,e)}))}var Le={closed:!0,next:we,error:function(t){throw t},complete:we},Pe="function"==typeof Symbol&&Symbol.observable||"@@observable";function Re(t){return t}function ke(t){return 0===t.length?Re:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var Ue=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 Oe||function(t){return t&&oe(t.next)&&oe(t.error)&&oe(t.complete)}(r)&&fe(r)?t:new Ne(t,e,n);return Te((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=Be(e))((function(e,r){var i=new Ne({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[Pe]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ke(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=Be(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 Be(t){var e;return null!==(e=null!=t?t:ge)&&void 0!==e?e:Promise}var Me=se((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),je=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 Zt(e,t),e.prototype.lift=function(t){var e=new He(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new Me},e.prototype.next=function(t){var e=this;Te((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=te(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;Te((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;Te((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?le:(this.currentObservers=null,o.push(t),new ce((function(){e.currentObservers=null,ue(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 Ue;return t.source=this,t},e.create=function(t,e){return new He(t,e)},e}(Ue),He=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return Zt(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:le},e}(je),Ge={now:function(){return(Ge.delegate||Date).now()},delegate:void 0},Fe=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Ge);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 Zt(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,u=1;u<r.length&&r[u]<=s;u+=2)a=u;a&&r.splice(0,a+1)}},e}(je),Ve=n(238),$e=n.n(Ve),qe=function(){function t(){this.scalingFactor=1,this.doc=document,this.parser=new($e())}return t.get=function(){return t._instance||(t._instance=new t),t._instance},t.prototype.getUAParser=function(){return this.parser},t.prototype.getWidth=function(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth},t.prototype.getHeight=function(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight},t.prototype.isMobile=function(){return"mobile"===this.parser.getDevice().type},t.prototype.calculateScalingFactor=function(e){var n=e.max,r=e.cont.w,i=e.cont.h,o=e.spc,s=t.get().getWidth(),a=t.get().getHeight();n&&(s=s?Math.min(s,n):n,a=a?Math.min(a,n):n),a&&(s-=o.getHorizontal(),a-=o.getVertical(),this.scalingFactor=s/a<r/i?s/r:a/i,this.scalingFactor=Math.min(this.scalingFactor,1))},t.prototype.getScalingFactor=function(){return this.scalingFactor},t.prototype.createElement=function(t){return this.doc.createElement(t)},t.prototype.appendChild=function(t,e){t.appendChild(e)},t.prototype.setStyle=function(t,e,n){e&&(n?t.style.setProperty(e,n,"important"):t.style.removeProperty(e))},t.prototype.setAttribute=function(t,e,n){t.setAttribute(e,n)},t.prototype.removeInApp=function(t){var e=document.querySelector(".".concat(t.rootClassName));e&&e.parentElement.removeChild(e)},t.prototype.setParentContainer=function(t){this.parentContainer=t,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")},t.prototype.isParentNotBody=function(){return this.parentContainer!==document.body},t.DOCUMENT_STANDARD_MODE="CSS1Compat",t}(),Ke=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},We=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ze=function(){function t(){this.result={},this.parser=qe.get().getUAParser()}return t.prototype.get=function(){return Ke(this,void 0,void 0,(function(){var t;return We(this,(function(e){switch(e.label){case 0:return t=this.result,this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),[4,this.getBatteryInfo()];case 1:return e.sent(),[4,this.getLocation()];case 2:return e.sent(),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},[2,t]}}))}))},t.prototype.getDeviceMemory=function(){var t=navigator;if(t.deviceMemory){var e=t.deviceMemory;this.result.mem={tot:1024*e}}},t.prototype.getNetworkType=function(){var t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;(null==e?void 0:e.effectiveType)&&(this.result.net={type:e.effectiveType})},t.prototype.getOrientation=function(){var t,e=null===(t=screen.orientation)||void 0===t?void 0:t.type;e&&(this.result.orientation=e)},t.prototype.getDPI=function(){var t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);var e=window.devicePixelRatio||1,n=t.offsetWidth*e;return document.body.removeChild(t),n},t.prototype.getLocation=function(){return Ke(this,void 0,void 0,(function(){var t=this;return We(this,(function(e){switch(e.label){case 0:return navigator.geolocation&&navigator.permissions?[4,navigator.permissions.query({name:"geolocation"})]:[2];case 1:return"granted"!=e.sent().state?[2]:[2,new Promise((function(e){navigator.geolocation.getCurrentPosition((function(n){t.result.coords=[n.coords.latitude,n.coords.longitude],e()}),(function(){return e()}))}))]}}))}))},t.prototype.getBatteryInfo=function(){return Ke(this,void 0,void 0,(function(){var t;return We(this,(function(e){switch(e.label){case 0:if(!("getBattery"in navigator))return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,navigator.getBattery()];case 2:return t=e.sent(),this.result.bat={l:100*t.level,c:t.charging},[3,4];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},t}(),Je=n(145),Ye=function(){function t(){}return t.getString=function(e,n){return void 0===n&&(n=""),t.LOCAL_STORAGE.getItem(e)||n},t.setString=function(e,n){n||(n=""),t.LOCAL_STORAGE.setItem(e,n)},t.getNumber=function(e,n){return+t.getString(e,"")||n},t.setNumber=function(e,n){t.setString(e,n.toString())},t.getBoolean=function(t,e){var n=this.LOCAL_STORAGE.getItem(t);return n?JSON.parse(n):e},t.setBoolean=function(e,n){t.setString(e,JSON.stringify(n))},t.getObject=function(e){try{return JSON.parse(t.getString(e,""))}catch(t){return{}}},t.getArray=function(e,n){void 0===n&&(n=[]);try{return JSON.parse(t.getString(e,""))||n}catch(t){return n}},t.setObject=function(e,n){t.setString(e,JSON.stringify(n))},t.setArray=function(e,n){t.setString(e,JSON.stringify(n))},t.remove=function(e){t.LOCAL_STORAGE.removeItem(e)},t.LOCAL_STORAGE=window.localStorage,t}(),Xe=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Ze=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Qe=function(){function e(){}return e.processConfiguration=function(t){this.saveConfiguration(t).then((function(){i.log("Google Analytics configuration processed")})).catch((function(t){i.error(t)}))},e.saveConfiguration=function(e){return Xe(this,void 0,void 0,(function(){var n;return Ze(this,(function(r){switch(r.label){case 0:return e.gaMeasurementID&&e.gaEnabled?(n=Ye.getString(t.STORAGE_GA_MEASUREMENT_ID,""),Ye.getBoolean(t.STORAGE_GA_ENABLED,!1)===e.gaEnabled&&n===e.gaMeasurementID?[3,2]:(Ye.remove(t.STORAGE_GA_CLIENT_ID),Ye.setString(t.STORAGE_GA_MEASUREMENT_ID,e.gaMeasurementID),Ye.setBoolean(t.STORAGE_GA_ENABLED,e.gaEnabled),[4,this.sendClientID()])):[2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.sendClientID=function(){return Xe(this,void 0,void 0,(function(){var e;return Ze(this,(function(n){switch(n.label){case 0:return Ye.getBoolean(t.STORAGE_GA_ENABLED,!1)?[4,this.getClientID()]:[2];case 1:return(e=n.sent())?(Or.getInstance().updateDeviceProps({gaClientID:e}),[2]):[2]}}))}))},e.getClientID=function(){return Xe(this,void 0,void 0,(function(){var e;return Ze(this,(function(n){switch(n.label){case 0:return(e=Ye.getString(t.STORAGE_GA_CLIENT_ID))?[3,2]:[4,this.getClientIDViaGTag()];case 1:e=n.sent(),n.label=2;case 2:return e?(Ye.setString(t.STORAGE_GA_CLIENT_ID,e),[2,e]):[2]}}))}))},e.getClientIDViaGTag=function(){var e=Ye.getString(t.STORAGE_GA_MEASUREMENT_ID,"");if(Ye.getString(t.STORAGE_GA_MEASUREMENT_ID,"")&&e&&window.gtag)return new Promise((function(t){window.gtag("get",e,"client_id",(function(e){t(e)}))}))},e}(),tn=function(e,n,r,i){this.appID=e,this.shopifyShop=n,this.uuid=r,this.props=i,this.sdk=t.SDK},en=n(716),nn=function(){function t(){}return t.addReferralData=function(t){Object.assign(t,this.getUTMParams()),t.referrer=this.getReferrer()},t.getReferrer=function(){if(document.referrer&&"".concat(location.origin,"/")!==document.referrer)return document.referrer.replace(location.origin,"")},t.getUTMParams=function(){var t;try{t=new en.U(location.href)}catch(t){return{}}var e={};return this.UTM_PARAMS.forEach((function(n){var r=t.getQueryParam(n);r&&(e[n]=r)})),Object.keys(e).length?(Ye.setObject("utm_params",e),e):Ye.getObject("utm_params")},t.UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],t}(),rn=function(){function t(t){t.s&&(this.s=new un(t.s)),t.g&&(this.g=new gn(t.g)),this.i=t.i}return Object.defineProperty(t.prototype,"solid",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"glossy",{get:function(){return this.g},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"img",{get:function(){return this.i},enumerable:!1,configurable:!0}),t}();const on=new RegExp("[^#a-f\\d]","gi"),sn=new RegExp("^#?[a-f\\d]{3}[a-f\\d]?$|^#?[a-f\\d]{6}([a-f\\d]{2})?$","i");var an,un=function(){function t(t){this.a=100,this.h=t.h,this.a=t.a,this.g=t.g}return Object.defineProperty(t.prototype,"hex",{get:function(){return this.h},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grad",{get:function(){return this.g},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rgba",{get:function(){if(!this.hex)return"";try{return function(t,e={}){if("string"!=typeof t||on.test(t)||!sn.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"}},enumerable:!1,configurable:!0}),t.prototype.getAlpha=function(){var t;return(null!==(t=this.a)&&void 0!==t?t:100)/100},t}(),cn=function(){function t(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new un(t.c))}return Object.defineProperty(t.prototype,"radius",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.w},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this.c},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){var t;return an[null!==(t=this.s)&&void 0!==t?t:an.SOLID]},enumerable:!1,configurable:!0}),t}();!function(t){t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED"}(an||(an={}));var ln,fn=function(t){var e;t=null!=t?t:{},this.name=t.name,this.fonts=null===(e=t.fonts)||void 0===e?void 0:e.map((function(t){return new pn(t)}))},pn=function(){function t(t){t=null!=t?t:{},this.style=t.style,this.url=t.url}return t.prototype.getFontDescriptor=function(){return{style:this.style===ln.ITALICS||this.style===ln.BOLD_ITALICS?"italic":"normal",weight:this.style===ln.BOLD_ITALICS||this.style===ln.BOLD?"700":"400"}},t.prototype.getURL=function(){return"url('".concat(this.url,"') format('truetype')")},t}();!function(t){t[t.REGULAR=1]="REGULAR",t[t.ITALICS=2]="ITALICS",t[t.BOLD=3]="BOLD",t[t.BOLD_ITALICS=4]="BOLD_ITALICS"}(ln||(ln={}));var hn,dn=function(){function t(t){t=null!=t?t:{},this.s=t.s,this.lh=t.lh,t.fmly&&(this.fmly=new fn(t.fmly))}return Object.defineProperty(t.prototype,"family",{get:function(){return this.fmly},enumerable:!1,configurable:!0}),t}(),gn=function(){function t(t){this.r=t.r,t.c&&(this.c=new un(t.c)),t.fb&&(this.fb=new un(t.fb))}return Object.defineProperty(t.prototype,"radius",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this.c},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fallback",{get:function(){var e;return null!==(e=this.fb)&&void 0!==e?e:t.DEFAULT_FALLBACK},enumerable:!1,configurable:!0}),t.DEFAULT_FALLBACK=new un({h:"#000000",a:50}),t}(),yn=function(){function t(t){var e,n,r,i;t=null!=t?t:{},this.blur=null!==(e=t.blur)&&void 0!==e?e:0,this.spr=null!==(n=t.spr)&&void 0!==n?n:0,this.x=null!==(r=t.x)&&void 0!==r?r:0,this.y=null!==(i=t.y)&&void 0!==i?i:0,this.clr=new un(t.clr)}return t.prototype.getStyle=function(t){return"".concat(this.x*t,"px ").concat(this.y*t,"px ")+"".concat(this.blur*t,"px ").concat(this.spr*t,"px ").concat(this.clr.rgba)},t}(),vn=function(){function t(t){var e,n,r,i;t=null!=t?t:{},this.pl=null!==(e=t.pl)&&void 0!==e?e:0,this.pr=null!==(n=t.pr)&&void 0!==n?n:0,this.pt=null!==(r=t.pt)&&void 0!==r?r:0,this.pb=null!==(i=t.pb)&&void 0!==i?i:0}return t.prototype.getHorizontal=function(){return this.pl+this.pr},t.prototype.getVertical=function(){return this.pt+this.pb},t.prototype.getPaddingCSS=function(){return"".concat(this.pt,"px ").concat(this.pr,"px ").concat(this.pb,"px ").concat(this.pl,"px")},t}(),bn=function(){function t(t){(null==t?void 0:t.rot)&&(this.rot=t.rot)}return Object.defineProperty(t.prototype,"rotate",{get:function(){return this.rot},enumerable:!1,configurable:!0}),t}(),mn=function(){function t(t){this.t=t.t,t.bg&&(this.bg=new rn(t.bg)),t.br&&(this.br=new cn(t.br)),t.shd&&(this.shd=new yn(t.shd)),t.spc&&(this.spc=new vn(t.spc)),this.trf=new bn(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}return Object.defineProperty(t.prototype,"alpha",{get:function(){var t;return null!==(t=this.a)&&void 0!==t?t:100},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeAsString",{get:function(){return hn[this.t]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"click",{get:function(){return this.clc},enumerable:!1,configurable:!0}),t}();!function(t){t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.SHAPE=100]="SHAPE"}(hn||(hn={}));var wn,Sn,En=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_n=function(t){function e(e){return t.call(this,e)||this}return En(e,t),e}(mn),Tn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),On=function(t){function e(e){var n=t.call(this,e)||this;return n.src=e.src,n}return Tn(e,t),e}(mn),In=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xn=function(t){function e(e){var n=t.call(this,e)||this;return n.alg=wn.START,n.prs=e.prs,n.alg=e.alg,e.f&&(n.f=new dn(e.f)),e.c&&(n.c=new un(e.c)),n}return In(e,t),Object.defineProperty(e.prototype,"parts",{get:function(){return this.prs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this.c},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"font",{get:function(){return this.f},enumerable:!1,configurable:!0}),e}(mn);!function(t){t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY"}(wn||(wn={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.SUPER=1]="SUPER",t[t.SUB=2]="SUB"}(Sn||(Sn={}));var An,Nn,Dn,Cn=function(){function e(t,e){this._startTime=t,this._triggerData=e}return Object.defineProperty(e.prototype,"startTime",{get:function(){return this._startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"triggerData",{get:function(){return this._triggerData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootClassName",{get:function(){var e=this.triggerData.id.slice(-6);return"test"===e&&(e=this.startTime.getTime().toString()),t.IN_APP_WRAPPER_NAME+"-"+e},enumerable:!1,configurable:!0}),e.prototype.onClose=function(t){this.closeCallback=t},e.prototype.closeInApp=function(t){var e={eventName:t,duration:((new Date).getTime()-this.startTime.getTime())/1e3};this.closeCallback&&this.closeCallback(e)},e}(),Ln=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pn=function(t){function e(e){var n,r,i,o=this;return(o=t.call(this,e)||this).o=null!==(n=e.o)&&void 0!==n?n:An.C,o.desk=e.desk,o.w=null!==(r=o.w)&&void 0!==r?r:1080,o.h=null!==(i=o.h)&&void 0!==i?i:1920,o}return Ln(e,t),e.prototype.getOrigin=function(){return this.o},e}(mn);!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"}(An||(An={})),function(t){t[t.ABOVE_PAGE=1]="ABOVE_PAGE",t[t.EMBEDDED=2]="EMBEDDED"}(Nn||(Nn={})),function(t){t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH"}(Dn||(Dn={}));var Rn,kn,Un=function(){function t(t){t=null!=t?t:{},this.en=t.en,this.ex=t.ex}return t.prototype.getEnterAnimation=function(){switch(this.en){case Rn.SLIDE_IN_TOP:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case Rn.SLIDE_IN_DOWN:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case Rn.SLIDE_IN_LEFT:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case Rn.SLIDE_IN_RIGHT:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case Rn.SLIDE_IN_TOP_LEFT:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case Rn.SLIDE_IN_TOP_RIGHT:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case Rn.SLIDE_IN_BOTTOM_LEFT:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case Rn.SLIDE_IN_BOTTOM_RIGHT:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case Rn.POP:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}},t.prototype.getExitAnimation=function(){switch(this.ex){case kn.SLIDE_OUT_TOP:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case kn.SLIDE_OUT_DOWN:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case kn.SLIDE_OUT_LEFT:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case kn.SLIDE_OUT_RIGHT:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case kn.SLIDE_OUT_TOP_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case kn.SLIDE_OUT_TOP_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case kn.SLIDE_OUT_BOTTOM_LEFT:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case kn.SLIDE_OUT_BOTTOM_RIGHT:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case kn.POP:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}},t}();!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"}(Rn||(Rn={})),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"}(kn||(kn={}));var Bn,Mn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),jn=function(e){function n(n){var r,i,o,s=this;return n=null!=n?n:{},(s=e.call(this,n)||this).gvt=null!==(r=n.gvt)&&void 0!==r?r:Bn.C,s.max=n.max,s.cover=null===(i=n.cover)||void 0===i||i,s.anim=new Un(n.anim),s.embedded=n.embedded,s.position=null!==(o=n.position)&&void 0!==o?o:Nn.ABOVE_PAGE,s.spc||(s.spc=new vn({pl:t.IN_APP_DEFAULT_PADDING,pr:t.IN_APP_DEFAULT_PADDING,pt:t.IN_APP_DEFAULT_PADDING,pb:t.IN_APP_DEFAULT_PADDING})),s}return Mn(n,e),n.prototype.isEmbedded=function(){return this.position===Nn.EMBEDDED&&!!this.embedded},n.prototype.getEmbeddedSelector=function(){return".letscooee-engagement.container-".concat(this.embedded)},n}(mn),Hn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gn=function(t){function e(e){var n,r,i,o=this;return e=null!=e?e:{},(o=t.call(this,e)||this).elems=[],o.cont=new Pn(e.cont),o.mob=new jn(e.mob),o.max=null!==(n=o.max)&&void 0!==n?n:null===(i=null===(r=e.cont)||void 0===r?void 0:r.desk)||void 0===i?void 0:i.max,o.bg||(o.bg=o.cont.bg,delete o.cont.bg),e.elems.forEach((function(t){t.t===hn.IMAGE?o.elems.push(new On(t)):t.t===hn.TEXT||t.t===hn.BUTTON?o.elems.push(new xn(t)):t.t===hn.SHAPE&&o.elems.push(new _n(t))})),o}return Hn(e,t),e.prototype.getStylesForWrapper=function(){return this.cover?{}:((t=this.gvt===Bn.NW?{top:0,left:0}:this.gvt===Bn.N?{top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===Bn.NE?{top:0,right:0}:this.gvt===Bn.E?{top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===Bn.SE?{bottom:0,right:0}:this.gvt===Bn.S?{bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===Bn.SW?{bottom:0,left:0}:this.gvt===Bn.W?{top:"50%",left:0,transform:"translateY(-50%)"}:{top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"}).overflow="visible",t);var t},e.prototype.getFlexStylesForContainer=function(){var t,e,n={display:"flex",flexDirection:"row"};return this.gvt===Bn.NW?(t="flex-start",e="flex-start"):this.gvt===Bn.N?(t="center",e="flex-start"):this.gvt===Bn.NE?(t="flex-end",e="flex-start"):this.gvt===Bn.W?(t="flex-start",e="center"):this.gvt===Bn.E?(t="flex-end",e="center"):this.gvt===Bn.SW?(t="flex-start",e="flex-end"):this.gvt===Bn.S?(t="center",e="flex-end"):this.gvt===Bn.SE?(t="flex-end",e="flex-end"):(t="center",e="center"),n.alignItems=e,n.justifyContent=t,n.overflow="visible",n},e.prototype.overrideForMobileView=function(){var t,e,n,r,i,o,s,a;this.max=null!==(t=this.mob.max)&&void 0!==t?t:this.max,this.cover=null!==(e=this.mob.cover)&&void 0!==e?e:this.cover,this.gvt=null!==(n=this.mob.gvt)&&void 0!==n?n:this.gvt,this.bg=null!==(r=this.mob.bg)&&void 0!==r?r:this.bg,this.spc=null!==(i=this.mob.spc)&&void 0!==i?i:this.spc,this.anim=null!==(o=this.mob.anim)&&void 0!==o?o:this.anim,this.position=null!==(s=this.mob.position)&&void 0!==s?s:this.position,this.embedded=null!==(a=this.mob.embedded)&&void 0!==a?a:this.embedded},e}(jn);!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"}(Bn||(Bn={}));var Fn,Vn,$n=function(){function t(t){var e,n;this.expireAt=(new Date).getTime(),this.id=t.id,this.expireAt=t.expireAt,this.version=t.version,this.engagementID=t.engagementID,this.internal=t.internal,this.pn=t.pn,this.ian=t.ian?new Gn(t.ian):void 0,this.previewType=t.previewType,this.delay=null!==(e=t.delay)&&void 0!==e?e:0,this.occurred=null!==(n=t.occurred)&&void 0!==n?n:(new Date).toISOString()}return t.prototype.shouldDelay=function(){return this.delay>0},t.prototype.getDelaySeconds=function(){var t=new Date(this.occurred),e=(new Date).getTime()-t.getTime();return 1e3*this.delay-e},t}(),qn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Kn=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Wn=function(){function t(){this.loadedFonts=[]}return t.prototype.loadAllFonts=function(t){var e;return qn(this,void 0,void 0,(function(){var n=this;return Kn(this,(function(r){return null===(e=t.elems)||void 0===e||e.forEach((function(t){t instanceof xn&&n.loadFamily(t.font.family)})),[2]}))}))},t.prototype.loadFamily=function(t){return qn(this,void 0,void 0,(function(){var e;return Kn(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.fonts)?this.loadedFonts.indexOf(t.name)>-1?[2]:(e=[],t.fonts.forEach((function(n){if(n.url){var r=new FontFace(t.name,n.getURL(),n.getFontDescriptor());e.push(r.load())}})),this.loadedFonts.push(t.name),[4,Promise.all(e)]):[2];case 1:return n.sent().forEach((function(t){document.fonts.add(t)})),[2]}}))}))},t}();!function(t){t[t.CAMERA=1]="CAMERA",t[t.LOCATION=2]="LOCATION",t[t.PUSH=3]="PUSH"}(Fn||(Fn={})),function(t){t[t.IAB=1]="IAB",t[t.EXTERNAL=2]="EXTERNAL",t[t.PROMPT=3]="PROMPT",t[t.SAME_TAB=4]="SAME_TAB",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.KV_VIEW_ITEM=101]="KV_VIEW_ITEM",t[t.KV_ADD_TO_CART=102]="KV_ADD_TO_CART",t[t.KV_COUPON_CODE=103]="KV_COUPON_CODE",t[t.KV_VIEW_CATEGORY=104]="KV_VIEW_CATEGORY"}(Vn||(Vn={}));var zn=function(){function e(){}return e.storeActiveTrigger=function(e){if((null==e?void 0:e.id)&&"test"!==e.id){var n=new S(e);return Ye.setObject(t.STORAGE_ACTIVE_TRIGGER,n),n}},e}(),Jn=function(){return Jn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Jn.apply(this,arguments)},Yn=function(){function e(t,e){this.action=t,this.apiService=Or.getInstance(),this.triggerContext=e}return e.prototype.execute=function(){this.closeAction();var t=this.action.custKV;switch(this.action.at){case Vn.EXTERNAL:this.externalAction();break;case Vn.IAB:this.iabAction();break;case Vn.SAME_TAB:this.gotoURLAction();break;case Vn.SHARE:this.shareAction();break;case Vn.PROMPT:this.prompt();break;case Vn.KEY_VALUE:case Vn.KV_ADD_TO_CART:case Vn.KV_COUPON_CODE:case Vn.KV_VIEW_CATEGORY:case Vn.KV_VIEW_ITEM:t=Jn(Jn({},t),this.action.kv);break;case void 0:break;default:return void i.error("Received an invalid ClickActionType: ",this.action.at)}this.upAction(),this.kvAction(t)},e.prototype.externalAction=function(){var t,e;if(null===(t=this.action.ext)||void 0===t?void 0:t.u){var n=this.action.ext.u;this.isValidURL(n)||(n="//".concat(n)),null===(e=window.open(n,"_blank"))||void 0===e||e.focus()}},e.prototype.isValidURL=function(t){try{new URL(t)}catch(t){return!1}return!0},e.prototype.gotoURLAction=function(){var t;if(null===(t=this.action.gu)||void 0===t?void 0:t.u){var e=this.action.gu.u;this.isValidURL(e)||(e="//".concat(e)),window.open(e,"_self")}},e.prototype.iabAction=function(){var t;if(null===(t=this.action.iab)||void 0===t?void 0:t.u){var e=this.action.iab.u;this.isValidURL(e)||(e="//".concat(e)),(new ur).render(e)}},e.prototype.upAction=function(){this.action.up&&this.apiService.updateProfile(this.action.up)},e.prototype.kvAction=function(t){document.dispatchEvent(new CustomEvent("onCooeeCTA",{detail:t}))},e.prototype.prompt=function(){var t=this.action.pmpt;t&&(t===Fn.LOCATION&&this.promptLocationPermission(),t===Fn.PUSH&&this.promptPushNotificationPermission(),t===Fn.CAMERA&&this.promptCameraPermission())},e.prototype.closeAction=function(){var e;this.containsCTA()?(e=t.EVENT_TRIGGER_CLICKED,zn.storeActiveTrigger(this.triggerContext.triggerData)):e=t.EVENT_TRIGGER_CLOSED,this.action.close&&this.triggerContext.closeInApp(e)},e.prototype.shareAction=function(){this.action.share&&(navigator.share?navigator.share({text:this.action.share.text,title:"Share"}).then((function(t){return console.log(t)})).catch((function(t){return console.error(t)})):i.warn("Navigator.share is not compatible with this browser"))},e.prototype.containsCTA=function(){return!!this.action.at||!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))},e.prototype.isEmpty=function(t){return!t||0===Object.keys(t).length},e.prototype.promptLocationPermission=function(){var t=this;navigator.geolocation&&navigator.permissions&&navigator.geolocation.getCurrentPosition((function(e){t.apiService.updateDeviceProps({coords:[e.coords.latitude,e.coords.longitude]}),t.sendPermissionData()}))},e.prototype.promptPushNotificationPermission=function(){var t=this;"Notification"in window?"default"===Notification.permission?Notification.requestPermission().then((function(){t.sendPermissionData()})):this.apiService.updateDeviceProps({pnPerm:Notification.permission}):i.warn("This browser does not support desktop notification")},e.prototype.promptCameraPermission=function(){var t=this;navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally((function(){t.sendPermissionData()}))},e.prototype.checkPermission=function(t){return navigator.permissions.query({name:t}).then((function(t){return t.state.toString()}))},e.prototype.checkAllPermission=function(){return t=this,e=void 0,r=function(){var t,e,n;return 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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(r){switch(r.label){case 0:return[4,this.checkPermission("camera")];case 1:return t=r.sent(),[4,this.checkPermission("geolocation")];case 2:return e=r.sent(),n=Notification.permission,[2,{camera:t,location:e,notification:n}]}}))},new((n=void 0)||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}));var t,e,n,r},e.prototype.sendPermissionData=function(){var t=this;this.checkAllPermission().then((function(e){t.apiService.updateDeviceProps({perm:e})}))},e}(),Xn=function(){function t(t,e,n){this.renderer=qe.get(),this.screenWidth=0,this.screenHeight=0,this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=n,this.scalingFactor=this.renderer.getScalingFactor(),this.screenWidth=this.renderer.getWidth(),this.screenHeight=this.renderer.getHeight()}return t.prototype.getHTMLElement=function(){return this.inappHTMLEl},t.prototype.insertElement=function(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)},t.prototype.processCommonBlocks=function(){this.processDisplay(),this.processWidthAndHeight(),this.processPositionBlock(),this.processBorderBlock(),this.processBackgroundBlock(),this.processSpaceBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction(),this.renderer.setStyle(this.inappHTMLEl,"box-sizing","border-box"),this.renderer.setStyle(this.inappHTMLEl,"outline","none")},t.prototype.processDisplay=function(){this.renderer.setStyle(this.inappHTMLEl,"display","block")},t.prototype.processWidthAndHeight=function(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.getSizePx(this.inappElement.h))},t.prototype.getSizePx=function(t){return this.getScaledSize(t)+"px"},t.prototype.getScaledSize=function(t){return t*this.scalingFactor},t.prototype.processPositionBlock=function(){this.renderer.setStyle(this.inappHTMLEl,"position","absolute"),this.inappElement.x&&this.renderer.setStyle(this.inappHTMLEl,"left",this.getSizePx(this.inappElement.x)),this.inappElement.y&&this.renderer.setStyle(this.inappHTMLEl,"top",this.getSizePx(this.inappElement.y))},t.prototype.processBorderBlock=function(){var t,e=this.inappElement.br;e&&(e.radius&&e.radius>0&&this.renderer.setStyle(this.inappHTMLEl,"border-radius",this.getSizePx(e.radius)),e.width&&e.width>0&&(this.renderer.setStyle(this.inappHTMLEl,"border-width",this.getSizePx(e.width)),this.renderer.setStyle(this.inappHTMLEl,"border-style",null===(t=e.style)||void 0===t?void 0:t.toLowerCase()),e.color?this.processColourBlock(e.color,"border-color"):this.renderer.setStyle(this.inappHTMLEl,"border-color","black")))},t.prototype.processSpaceBlock=function(){var t=this.inappElement.spc;t&&(t.pt&&this.renderer.setStyle(this.inappHTMLEl,"padding-top",this.getSizePx(t.pt)),t.pb&&this.renderer.setStyle(this.inappHTMLEl,"padding-bottom",this.getSizePx(t.pb)),t.pl&&this.renderer.setStyle(this.inappHTMLEl,"padding-left",this.getSizePx(t.pl)),t.pr&&this.renderer.setStyle(this.inappHTMLEl,"padding-right",this.getSizePx(t.pr)),this.renderer.setStyle(this.inappHTMLEl,"margin","0 !important"))},t.prototype.processTransparency=function(){var t=this.inappElement.alpha;if(!isNaN(t)){var e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}},t.prototype.processShadow=function(){var t=this.inappElement.shd;t&&this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor))},t.prototype.processTransformBlock=function(){var t=new bn(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform","rotate(".concat(t.rotate,"deg)"))},t.prototype.registerAction=function(){var t=this,e=this.inappElement.clc;e&&0!==Object.keys(e).length&&(this.inappHTMLEl.addEventListener("click",(function(n){n.stopPropagation(),new Yn(e,t.triggerContext).execute()})),this.inappElement instanceof Pn&&1===Object.keys(e).length&&void 0!==e.close&&null!==e.close||this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))},t.prototype.processBackgroundBlock=function(){var t=this.inappElement.bg;if(t){var e=this.inappHTMLEl;if(t.glossy){var n="backdrop-filter",r="-webkit-"+n,i="blur(".concat(t.glossy.radius,"px)");if(!CSS.supports(r,i)&&!CSS.supports(n,i))return void this.renderer.setStyle(e,"background",t.glossy.fallback.rgba);this.renderer.setStyle(e,r,i),this.renderer.setStyle(e,n,i),t.glossy.color&&this.processColourBlock(t.glossy.color,"background",e)}else if(t.solid)t.solid.grad?this.processGradient(t.solid.grad,"background"):t.solid.hex&&this.renderer.setStyle(e,"background",t.solid.rgba);else if(t.img){if(!t.img.src)return;var o='url("'.concat(t.img.src,'") no-repeat center');this.renderer.setStyle(e,"background",o),this.renderer.setStyle(e,"background-size","cover"),t.img.a&&(this.renderer.setStyle(e,"-webkit-backdrop-filter","opacity(".concat(t.img.a,")")),this.renderer.setStyle(e,"backdrop-filter","opacity(".concat(t.img.a,")")))}}},t.prototype.processGradient=function(t,e){if("LINEAR"===t.type){var n="linear-gradient(".concat(t.ang,"deg, ").concat(t.c1,", ").concat(t.c2);t.c3&&(n+=", ".concat(t.c3)),n+=")",this.renderer.setStyle(this.inappHTMLEl,e,n)}},t.prototype.processColourBlock=function(t,e,n){void 0===e&&(e="color"),void 0===n&&(n=this.inappHTMLEl),t&&(t.grad?this.processGradient(t.grad,e):t.hex&&this.renderer.setStyle(n,e,t.rgba))},t}(),Zn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qn=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return Zn(e,t),e.prototype.processCommonBlocks=function(){t.prototype.processCommonBlocks.call(this),this.processFontBlock(),this.processColourBlock(this.inappElement.color),this.processAlignment()},e.prototype.processFontBlock=function(){var t;this.renderer.setStyle(this.inappHTMLEl,"letter-spacing","normal");var e=this.inappElement.font;e&&(this.renderer.setStyle(this.inappHTMLEl,"font-size",this.getSizePx(e.s)),this.renderer.setStyle(this.inappHTMLEl,"font-family",null===(t=e.family)||void 0===t?void 0:t.name),this.renderer.setStyle(this.inappHTMLEl,"line-height",e.lh))},e.prototype.processPart=function(t,e){var n,r=[];e.u&&r.push("underline"),e.st&&r.push("line-through"),r.length||r.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",r.join(" ")),this.renderer.setStyle(t,"color",null!==(n=e.c)&&void 0!==n?n:"inherit"),this.renderer.setStyle(t,"font-family","inherit")},e.prototype.processAlignment=function(){var t,e=null===(t=wn[this.inappElement.alg])||void 0===t?void 0:t.toLowerCase();e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)},e}(Xn),tr=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),er=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("div"),i.insertElement(),i}return tr(e,t),e.prototype.render=function(){var t,e=this;null===(t=this.inappElement.parts)||void 0===t||t.forEach((function(t){var n,r,i=e.renderer.createElement("span");i.innerHTML=null===(r=null===(n=t.txt)||void 0===n?void 0:n.toString())||void 0===r?void 0:r.replace(/\n/g,"<br />"),e.processPart(i,t),e.renderer.appendChild(e.inappHTMLEl,i)})),this.processCommonBlocks()},e}(Qn),nr=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),rr=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("div"),i.insertElement(),i}return nr(e,t),e.prototype.render=function(){this.processCommonBlocks()},e}(Xn),ir=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),or=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("img"),i.insertElement(),i}return ir(e,t),e.prototype.render=function(){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()},e}(Xn),sr=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ar=function(e){function n(t,n,r){var i=e.call(this,t,n,r)||this;return i.parent=t,i.inappHTMLEl=i.renderer.createElement("div"),i}return sr(n,e),n.prototype.render=function(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(t.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",n.MAX_Z_INDEX),this.inappHTMLEl},n.prototype.processBackgroundBlock=function(){this.inappElement.cover&&e.prototype.processBackgroundBlock.call(this)},n.prototype.processWidthAndHeight=function(){var 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{var e=this.inappElement.spc,n=this.getScaledSize(t.w)+e.getHorizontal(),r=this.getScaledSize(t.h)+e.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",r+"px")}},n.prototype.processSpaceBlock=function(){var t=this.inappElement.spc;this.renderer.setStyle(this.inappHTMLEl,"padding",t.getPaddingCSS())},n.prototype.processDisplay=function(){this.renderer.setStyle(this.inappHTMLEl,"display","flex"),Object.assign(this.inappHTMLEl.style,this.inappElement.getStylesForWrapper()),Object.assign(this.inappHTMLEl.style,this.inappElement.getFlexStylesForContainer())},n.prototype.processPositionBlock=function(){var t;if(this.renderer.isParentNotBody()){if(null===(t=this.triggerContext.triggerData.ian)||void 0===t?void 0:t.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")},n.prototype.processBorderBlock=function(){},n.prototype.processTransparency=function(){},n.prototype.processTransformBlock=function(){},n.prototype.processGradient=function(){},n.prototype.processShadow=function(){},n.prototype.registerAction=function(){var t=this;this.inappHTMLEl.addEventListener("click",(function(){new Yn({close:!0},t.triggerContext).execute()}))},n.MAX_Z_INDEX="2147483647",n}(Xn),ur=function(){function e(){this.renderer=qe.get()}return e.prototype.render=function(e){var n=document.querySelector(".".concat(t.IN_APP_WRAPPER_NAME)),r=this.createIFrameContainer();return this.createIFrameElement(r,e),this.createAnchorElement(n,r),this.renderer.appendChild(n,r),r},e.prototype.createIFrameContainer=function(){var t=this.renderer.createElement("div");return this.renderer.setAttribute(t,"class","iframe-container"),this.renderer.setAttribute(t,"id","iframe-container"),this.renderer.setStyle(t,"width","100%"),this.renderer.setStyle(t,"height","100%"),this.renderer.setStyle(t,"position","absolute"),this.renderer.setStyle(t,"top","0px"),this.renderer.setStyle(t,"left","0px"),t},e.prototype.createIFrameElement=function(t,e){var n=this.renderer.createElement("iframe");return this.renderer.setStyle(n,"width","100%"),this.renderer.setStyle(n,"height","100%"),this.renderer.setAttribute(n,"src",e),this.renderer.setAttribute(n,"frameBorder","0"),this.renderer.appendChild(t,n),n},e.prototype.createAnchorElement=function(t,e){var n=this.renderer.createElement("a");return this.renderer.setStyle(n,"position","absolute"),this.renderer.setStyle(n,"top","0px"),this.renderer.setStyle(n,"right","0px"),n.href="#",n.innerHTML="Close",n.onclick=function(){t.removeChild(e)},this.renderer.appendChild(e,n),n},e}(),cr=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),lr=function(e){function n(t,n,r){var i=e.call(this,t,n,r)||this;return i.inappHTMLEl=i.renderer.createElement("div"),i.insertElement(),i}return cr(n,e),n.prototype.render=function(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(t.IN_APP_CONTAINER_NAME),this},n}(Xn),fr=function(){function e(t){var e=this;this.renderer=qe.get(),this.safeHTTP=Or.getInstance(),this.resizeListener=function(){return e.screenResized()},this.setParentContainer(t)}return e.prototype.setParentContainer=function(t){this.parent=null!=t?t:document.body,this.renderer.setParentContainer(this.parent)},e.prototype.render=function(t){var e=this,n=new $n(t);if(this.triggerContext=new Cn(new Date,n),this.triggerContext.onClose((function(t){e.closeInApp(t)})),this.ian=n.ian,(this.renderer.isMobile()||"mobile"===n.previewType)&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){var r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}n.shouldDelay()?window.setTimeout((function(){e.startRenderingOnce()}),n.getDelaySeconds()):this.startRenderingOnce()},e.prototype.startRenderingOnce=function(){try{this.startRendering()}catch(t){return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener)},e.prototype.startRendering=function(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new ar(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(t){throw i.error(t),t}},e.prototype.sendTriggerDisplayed=function(){var e=new Yt(t.EVENT_TRIGGER_DISPLAYED,{},this.triggerContext.triggerData);this.safeHTTP.sendEvent(e)},e.prototype.sendTriggerClosed=function(t){var e=t.eventName;delete t.eventName;var n=new Yt(e,t,this.triggerContext.triggerData);this.safeHTTP.sendEvent(n)},e.prototype.addEnterAnimation=function(t){this.containerHTMLElement.animate(t.getEnterAnimation(),{duration:500})},e.prototype.renderElement=function(t,e,n){e instanceof xn?new er(t,e,n).render():e instanceof On?new or(t,e,n).render():e instanceof _n?new rr(t,e,n).render():i.error("Unsupported element type- "+e.type)},e.prototype.renderContainer=function(t){var e,n,r=this,i=null===(e=this.ian)||void 0===e?void 0:e.cont;i&&(this.containerHTMLElement=new lr(this.rootContainer,i,t).render().getHTMLElement(),(new Wn).loadAllFonts(this.ian),null===(n=this.ian.elems)||void 0===n||n.forEach((function(e){return n=r,i=void 0,s=function(){return 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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(n){switch(n.label){case 0:return[4,this.renderElement(this.containerHTMLElement,e,t)];case 1:return n.sent(),[2]}}))},new((o=void 0)||(o=Promise))((function(t,e){function r(t){try{u(s.next(t))}catch(t){e(t)}}function a(t){try{u(s.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(r,a)}u((s=s.apply(n,i||[])).next())}));var n,i,o,s})),this.addEnterAnimation(this.ian.anim))},e.prototype.closeInApp=function(t){var e=this,n=this.ian.anim.getExitAnimation();this.containerHTMLElement.animate(n,{duration:500,easing:"ease-in-out"}).onfinish=function(){e.removeInApp(),e.sendTriggerClosed(t),window.removeEventListener("resize",e.resizeListener)}},e.prototype.screenResized=function(){this.removeInApp(),this.startRendering()},e.prototype.removeInApp=function(){qe.get().removeInApp(this.triggerContext)},e}(),pr=function(){function e(){this.inInactive=!1,this.lastEnterActive=new Date,this.lastEnterInactive=null,this.isDebug=!1}return e.getInstance=function(){return this.INSTANCE},e.prototype.getWebAppVersion=function(){var t;return null!==(t=this.webAppVersion)&&void 0!==t?t:"0.0.1+1"},e.prototype.setWebAppVersion=function(t){this.webAppVersion=t},e.prototype.isDebugWebApp=function(){return this.isDebug},e.prototype.setDebugWebApp=function(t){this.isDebug=t},e.prototype.isInactive=function(){return this.inInactive},e.prototype.setInactive=function(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Ye.setNumber(t.STORAGE_LAST_ACTIVE,this.lastEnterInactive.getTime()),Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))},e.prototype.setActive=function(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0},e.prototype.isFirstActive=function(){return null==this.lastEnterInactive},e.prototype.setScreen=function(t){this.screen=t},e.prototype.getScreen=function(){return this.screen},e.INSTANCE=new e,e}(),hr=function(){function t(){}return t.watch=function(){var t=this.getDebugParam();"1"!==t&&"on"!==t||(localStorage.cooeeLogLevel="TRACE"),"on"===t?sessionStorage.cooeeDebug="1":"off"===t&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())},t.prepend=function(t){if(this.isOn){var e=document.createElement("div");e.innerHTML="&#x2022; "+(new Date).toLocaleString()+" - "+t,this.element.prepend(e)}},t.renderDebugBar=function(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),document.body.appendChild(this.element)},t.getDebugParam=function(){var t;return null===(t=new URL(location.href).searchParams)||void 0===t?void 0:t.get("cooee-debug")},t.dragElement=function(){var t=this,e=0,n=0,r=0,i=0,o=function(o){(o=o||window.event).preventDefault(),e=r-o.clientX,n=i-o.clientY,r=o.clientX,i=o.clientY,t.element.style.top=t.element.offsetTop-n+"px",t.element.style.left=t.element.offsetLeft-e+"px"},s=function(){document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=function(t){(t=t||window.event).preventDefault(),r=t.clientX,i=t.clientY,document.onmouseup=s,document.onmousemove=o}},t.isOn=!1,t}(),dr=function(){function e(){}return e.getInstance=function(){return this.INSTANCE||(this.INSTANCE=new e),this.INSTANCE},e.prototype.getCurrentSessionID=function(){return this.currentSessionID||null},e.prototype.checkForNewSession=function(){this.isNewSessionRequired()?this.startNewSession():this.initializeSessionFromStorage()},e.prototype.startNewSession=function(){this.currentSessionID||(this.currentSessionStartTime=new Date,this.currentSessionID=(new Lt).toHexString(),hr.prepend("Session ID: <strong>".concat(this.currentSessionID,"</strong>")),Ye.setNumber(t.STORAGE_SESSION_START_TIME,this.currentSessionStartTime.getTime()),Ye.setString(t.STORAGE_SESSION_ID,this.currentSessionID),this.bumpSessionNumber(),Or.getInstance().sendEvent(new Yt(t.EVENT_SESSION_STARTED)))},e.prototype.bumpSessionNumber=function(){this.currentSessionNumber=Ye.getNumber(t.STORAGE_SESSION_NUMBER,0),this.currentSessionNumber+=1,Ye.setNumber(t.STORAGE_SESSION_NUMBER,this.currentSessionNumber)},e.prototype.getCurrentSessionNumber=function(){return this.currentSessionNumber||0},e.prototype.conclude=function(){var e={sessionID:this.currentSessionID,occurred:new Date,duration:this.getTotalDurationInSeconds()};Or.getInstance().concludeSession(e),Ye.remove(t.STORAGE_ACTIVE_TRIGGER),this.destroySession()},e.prototype.destroySession=function(){this.currentSessionID=void 0,this.currentSessionNumber=void 0,this.currentSessionStartTime=void 0,Ye.remove(t.STORAGE_SESSION_ID),Ye.remove(t.STORAGE_SESSION_START_TIME)},e.prototype.isNewSessionRequired=function(){if(!Ye.getString(t.STORAGE_SESSION_ID,""))return!0;var e=Ye.getNumber(t.STORAGE_SESSION_START_TIME,0);return((new Date).getTime()-e)/1e3>t.IDLE_TIME_IN_SECONDS},e.prototype.getTotalDurationInSeconds=function(){if(pr.getInstance().isFirstActive())throw new Error("This is the first time in foreground after launch");return(this.getLastActive()-this.currentSessionStartTime.getTime())/1e3},e.prototype.initializeSessionFromStorage=function(){this.currentSessionStartTime=new Date(Ye.getNumber(t.STORAGE_SESSION_START_TIME,0)),this.currentSessionID=Ye.getString(t.STORAGE_SESSION_ID,""),this.currentSessionNumber=Ye.getNumber(t.STORAGE_SESSION_NUMBER,1),hr.prepend("Session ID: <strong>".concat(this.currentSessionID,"</strong>"))},e.prototype.getLastActive=function(){return Ye.getNumber(t.STORAGE_LAST_ACTIVE,0)},e}(),gr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},yr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},vr=function(){function e(){this.runtimeData=pr.getInstance(),this.apiToken="",this.userID=""}return e.getInstance=function(){return this.INSTANCE},e.prototype.registerDevice=function(t){return gr(this,void 0,void 0,(function(){return yr(this,(function(e){return[2,this.doHTTP("POST","/v1/device/validate",this.getDefaultHeaders(),t)]}))}))},e.prototype.sendEvent=function(e){var n=this;hr.prepend("Sending event <strong>".concat(e.name.replace("CE ",""),"</strong> with id ").concat(e.id));var r=this.getDefaultHeaders(),o=new S(Ye.getObject(t.STORAGE_ACTIVE_TRIGGER));!e.trigger&&o&&(o.updateExpired(),e.trigger=o,"test"===o.triggerID)||(e.name!==t.EVENT_APP_BACKGROUND&&pr.getInstance().setActive(),this.doHTTP("POST","/v1/event/track",r,e).then((function(t){i.log("Sent",e.name),t.triggerData&&(t.triggerData.occurred=e.occurred,(new fr).render(t.triggerData)),n.updateUserIDAndToken({userID:t.userID,deviceID:t.deviceID,sdkToken:t.sdkToken});var r="Event <strong>".concat(t.eventName,"</strong> tracked");t.intent&&(r+=" and <strong>".concat(Dn[t.intent],"</strong> intent calculated")),hr.prepend(r)})).catch((function(t){i.error("Error sending event",t)})))},e.prototype.updateUserData=function(t){var e=this,n=this.getDefaultHeaders();this.doHTTP("PUT","/v1/user/update",n,t).then((function(t){i.log("Updated user profile"),e.updateUserIDAndToken(t)})).catch((function(t){i.error("Error saving user profile",t)}))},e.prototype.updateUserIDAndToken=function(e){e&&Object.keys(e).length&&(e.userID&&Ye.setString(t.STORAGE_USER_ID,e.userID),e.deviceID&&Ye.setString(t.STORAGE_DEVICE_ID,e.deviceID),e.sdkToken&&(this.setAPIToken(e.sdkToken),Ye.setString(t.STORAGE_SDK_TOKEN,e.sdkToken)))},e.prototype.updateDeviceProps=function(e){var n=this.getDefaultHeaders();this.doHTTP("PUT","/v1/device/update",n,e).then((function(){i.log("Updated device property")})).catch((function(n){var r;i.error("Error saving device property",n),(null===(r=null==e?void 0:e.cart)||void 0===r?void 0:r.token)&&Ye.remove(t.STORAGE_SHOPIFY_CART_TOKEN)}))},e.prototype.concludeSession=function(t){var e=this.getDefaultHeaders();this.doHTTP("POST","/v1/session/conclude",e,t).then((function(t){i.log("Conclude Session",t)})).catch((function(t){i.error(t)}))},e.prototype.logout=function(){var t=this,e=this.getDefaultHeaders();this.doHTTP("GET","/v1/user/logout",e).then((function(e){i.log("User logged out"),t.updateUserIDAndToken(e),dr.getInstance().startNewSession()})).catch((function(t){i.error(t)}))},e.prototype.getAppConfigurations=function(){var e=this.getDefaultHeaders(),n=Ye.getString(t.STORAGE_APP_ID);this.doHTTP("GET","/v1/app/configuration/".concat(n),e).then((function(t){i.log("Received app configuration"),Qe.processConfiguration(t)})).catch((function(t){i.error(t)}))},e.prototype.setAPIToken=function(t){this.apiToken=null!=t?t:""},e.prototype.doHTTP=function(e,n,r,i){return gr(this,void 0,void 0,(function(){var o,s,a;return yr(this,(function(u){switch(u.label){case 0:return n.startsWith("http")||(n=t.API_URL+n),o="keepalive"in new Request(""),i&&!o&&JSON.stringify(i).includes("CE App Background")?[2,this.performXMLHttpRequest(n,r,i)]:(s={method:e,headers:r,keepalive:!0},i&&(s.body=JSON.stringify(i)),[4,fetch(n,s)]);case 1:if(!(a=u.sent()).ok)throw a;return[2,a.json()]}}))}))},e.prototype.performXMLHttpRequest=function(t,e,n){var r=new XMLHttpRequest;return r.open("POST",t,!1),e.forEach((function(t,e){r.setRequestHeader(e,t)})),r.send(JSON.stringify(n)),r.response.json()},e.prototype.getDefaultHeaders=function(){var e=new Headers;return e.set("content-type","application/json"),e.set("sdk-version",t.SDK_VERSION),e.set("sdk-version-code",t.SDK_VERSION_CODE.toString()),e.set("app-version",this.runtimeData.getWebAppVersion()),this.apiToken&&e.append("x-sdk-token",this.apiToken),t.SDK_DEBUG&&e.set("sdk-debug",String(1)),this.runtimeData.isDebugWebApp()&&e.set("app-debug",String(1)),e},e.INSTANCE=new e,e}(),br=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},mr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},wr=function(){function e(){this.apiService=vr.getInstance(),this.sdkToken="",this.userID="",this.deviceID="",this.appID="",this.shopifyShop=""}return e.getInstance=function(){return this.INSTANCE},e.prototype.init=function(t){return this.appID=t.appID,this.shopifyShop=t.shopifyShop,this.acquireSDKToken()},e.prototype.hasToken=function(){return!!Ye.getString(t.STORAGE_SDK_TOKEN,"")},e.prototype.getUserID=function(){return this.userID},e.prototype.getDeviceID=function(){return this.deviceID},e.prototype.acquireSDKToken=function(){return br(this,void 0,void 0,(function(){return mr(this,(function(t){return this.hasToken()?[2,this.populateUserDataFromStorage()]:(i.log("Attempt to acquire SDK token"),[2,this.getSDKTokenFromServer()])}))}))},e.prototype.saveUserDataInStorage=function(e){this.sdkToken=e.sdkToken,this.userID=e.userID,this.deviceID=e.deviceID,this.updateAPIClient(),Ye.setString(t.STORAGE_SDK_TOKEN,this.sdkToken),Ye.setString(t.STORAGE_USER_ID,this.userID),Ye.setString(t.STORAGE_DEVICE_ID,this.deviceID),e.appID&&Ye.setString(t.STORAGE_APP_ID,e.appID)},e.prototype.populateUserDataFromStorage=function(){return br(this,void 0,void 0,(function(){return mr(this,(function(e){return this.sdkToken=Ye.getString(t.STORAGE_SDK_TOKEN,""),this.sdkToken||i.warn("No SDK token found in local storage"),this.userID=Ye.getString(t.STORAGE_USER_ID,""),this.userID||i.warn("No user ID found in local storage"),this.deviceID=Ye.getString(t.STORAGE_DEVICE_ID,""),this.deviceID||i.warn("No device ID found in local storage"),this.updateAPIClient(),[2]}))}))},e.prototype.updateAPIClient=function(){i.log("SDK Token:",this.sdkToken),i.log("Device ID:",this.deviceID),i.log("User ID:",this.userID),hr.prepend("Device ID: <strong>".concat(this.deviceID,"</strong>")),this.apiService.setAPIToken(this.sdkToken)},e.prototype.getSDKTokenFromServer=function(){return br(this,void 0,void 0,(function(){var t,e,n,r;return mr(this,(function(o){switch(o.label){case 0:return[4,this.getDeviceAuthRequest()];case 1:t=o.sent(),e=this.apiService.registerDevice(t),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,e];case 3:return n=o.sent(),i.log("Register Device Response",n),this.saveUserDataInStorage(n),Qe.processConfiguration(n),[3,5];case 4:throw r=o.sent(),i.error(r),r;case 5:return[2]}}))}))},e.prototype.getDeviceAuthRequest=function(){return br(this,void 0,void 0,(function(){var t,e;return mr(this,(function(n){switch(n.label){case 0:return[4,(new ze).get()];case 1:t=n.sent(),nn.addReferralData(t),t.host=location.origin,n.label=2;case 2:return n.trys.push([2,4,,5]),[4,(0,Je.r)()];case 3:return(null==(e=n.sent())?void 0:e.isPrivate)&&(t.private=!0),[3,5];case 4:return n.sent(),[3,5];case 5:return[2,new tn(this.appID,this.shopifyShop,this.getOrCreateUUID(),t)]}}))}))},e.prototype.getOrCreateUUID=function(){var e=Ye.getString(t.STORAGE_DEVICE_UUID,"");return e||(e=(new Lt).toHexString(),Ye.setString(t.STORAGE_DEVICE_UUID,e)),e},e.INSTANCE=new e,e}(),Sr=function(){function e(){}var n;return e.getString=function(t,e){return this.getItem(t)||e},e.setString=function(t,e){this.setItem(t,e)},e.remove=function(t){this.removeItem(t)},e.getItem=function(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))},e.setItem=function(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)},e.removeItem=function(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))},e.getAppID=function(){return Ye.getString(t.STORAGE_APP_ID)},n=e,e.SESSION_STORAGE=window.sessionStorage,e.SESSION_STORAGE_KEY_PREFIX=t.COOEE.concat("/",n.getAppID(),"/"),e}(),Er=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},_r=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Tr=function(){function e(){this.sessionManager=dr.getInstance(),this.safeHttpCallService=Or.getInstance(),this.deviceAuthService=wr.getInstance()}return e.prototype.init=function(n){var r=this;t.BOT_UA_REGEX.test(navigator.userAgent)?i.log("This seems to be a bot. Disabling SDK"):(this.deviceAuthService.init(n).then((function(){e.replaySubject.next(!0),e.replaySubject.complete()})).catch((function(){setTimeout((function(){r.init(n)}),3e4)})),this.execute())},e.prototype.execute=function(){this.sessionManager.checkForNewSession(),this.isAppFirstTimeLaunch()?this.sendFirstLaunchEvent():(this.sendSuccessiveLaunchEvent(),this.safeHttpCallService.getAppConfigurations())},e.prototype.isAppFirstTimeLaunch=function(){return!!Ye.getBoolean(t.STORAGE_FIRST_TIME_LAUNCH,!0)&&(Ye.setBoolean(t.STORAGE_FIRST_TIME_LAUNCH,!1),!0)},e.prototype.sendFirstLaunchEvent=function(){return Er(this,void 0,void 0,(function(){var e,n;return _r(this,(function(r){switch(r.label){case 0:return e=new Yt(t.EVENT_APP_INSTALLED,{}),n=e,[4,(new ze).get()];case 1:return n.deviceProps=r.sent(),this.safeHttpCallService.sendEvent(e),[2]}}))}))},e.prototype.sendSuccessiveLaunchEvent=function(){return Er(this,void 0,void 0,(function(){var e,n;return _r(this,(function(r){switch(r.label){case 0:return this.isNewTabOpened()?(e=new Yt(t.EVENT_APP_LAUNCHED),n=e,[4,(new ze).get()]):[2];case 1:return n.deviceProps=r.sent(),this.safeHttpCallService.sendEvent(e),[2]}}))}))},e.prototype.isNewTabOpened=function(){return!Sr.getString(t.SESSION_STORAGE_TAB_OPENED,"")&&(Sr.setString(t.SESSION_STORAGE_TAB_OPENED,"1"),!0)},e.replaySubject=new Fe(1),e}(),Or=function(){function t(){this.sessionManager=dr.getInstance(),this.httpApiService=vr.getInstance()}return t.getInstance=function(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE},t.prototype.sendEvent=function(t){var e=this;Tr.replaySubject.subscribe((function(){e.addEventData(t),e.httpApiService.sendEvent(t)}))},t.prototype.updateProfile=function(t){var e=this;t=null!=t?t:{},nn.addReferralData(t),Tr.replaySubject.subscribe((function(){e.httpApiService.updateUserData(t)}))},t.prototype.updateDeviceProps=function(t,e){var n=this;Tr.replaySubject.subscribe((function(){n.httpApiService.updateDeviceProps({props:t,cart:e})}))},t.prototype.concludeSession=function(t){var e=this;Tr.replaySubject.subscribe((function(){e.httpApiService.concludeSession(t)}))},t.prototype.logout=function(){var t=this;Tr.replaySubject.subscribe((function(){t.httpApiService.logout()}))},t.prototype.getAppConfigurations=function(){var t=this;Tr.replaySubject.subscribe((function(){t.httpApiService.getAppConfigurations()}))},t.prototype.addEventData=function(t){t.screenName=pr.getInstance().getScreen(),t.properties.path=location.pathname,t.sessionID=this.sessionManager.getCurrentSessionID(),t.sessionNumber=this.sessionManager.getCurrentSessionNumber(),nn.addReferralData(t.properties)},t}(),Ir=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t},xr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Ar(t){if(t instanceof Ue)return t;if(null!=t){if(function(t){return oe(t[Pe])}(t))return o=t,new Ue((function(t){var e=o[Pe]();if(oe(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ir(t))return i=t,new Ue((function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()}));if(oe(null==(r=t)?void 0:r.then))return n=t,new Ue((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,me)}));if(function(t){return Symbol.asyncIterator&&oe(null==t?void 0:t[Symbol.asyncIterator])}(t))return Nr(t);if(function(t){return oe(null==t?void 0:t[xr])}(t))return e=t,new Ue((function(t){var n,r;try{for(var i=te(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 oe(null==t?void 0:t.getReader)}(t))return Nr(function(t){return ie(this,arguments,(function(){var e,n,r;return Qt(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,re(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,re(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,re(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 Nr(t){return new Ue((function(e){(function(t,e){var n,r,i,o,s,a,u,c;return s=this,a=void 0,c=function(){var s,a;return Qt(this,(function(u){switch(u.label){case 0:u.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=te(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),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))},new((u=void 0)||(u=Promise))((function(t,e){function n(t){try{i(c.next(t))}catch(t){e(t)}}function r(t){try{i(c.throw(t))}catch(t){e(t)}}function i(e){var i;e.done?t(e.value):(i=e.value,i instanceof u?i:new u((function(t){t(i)}))).then(n,r)}i((c=c.apply(s,a||[])).next())}))})(t,e).catch((function(t){return e.error(t)}))}))}function Dr(t){return function(e){if(function(t){return oe(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 Cr(t,e,n,r,i){return new Lr(t,e,n,r,i)}var Lr=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 Zt(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}(Oe);function Pr(t,e){return Dr((function(n,r){var i=0;n.subscribe(Cr(r,(function(n){r.next(t.call(e,n,i++))})))}))}function Rr(t,e,n){return void 0===n&&(n=1/0),oe(e)?Rr((function(n,r){return Pr((function(t,i){return e(n,t,r,i)}))(Ar(t(n,r)))}),n):("number"==typeof e&&(n=e),Dr((function(e,r){return function(t,e,n,r,i,o,s,a){var u=[],c=0,l=0,f=!1,p=function(){!f||u.length||c||e.complete()},h=function(t){return c<r?d(t):u.push(t)},d=function(t){c++;var i=!1;Ar(n(t,l++)).subscribe(Cr(e,(function(t){e.next(t)}),(function(){i=!0}),void 0,(function(){if(i)try{c--;for(var t=function(){var t=u.shift();d(t)};u.length&&c<r;)t();p()}catch(t){e.error(t)}})))};return t.subscribe(Cr(e,h,(function(){f=!0,p()}))),function(){}}(e,r,t,n)})))}var kr=Array.isArray;var Ur=["addListener","removeListener"],Br=["addEventListener","removeEventListener"],Mr=["on","off"];function jr(t,e,n,r){if(oe(n)&&(r=n,n=void 0),r)return jr(t,e,n).pipe(function(t){return Pr((function(e){return function(t,e){return kr(e)?t.apply(void 0,ne([],ee(e))):t(e)}(t,e)}))}(r));var i=ee(function(t){return oe(t.addEventListener)&&oe(t.removeEventListener)}(t)?Br.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return oe(t.addListener)&&oe(t.removeListener)}(t)?Ur.map(Hr(t,e)):function(t){return oe(t.on)&&oe(t.off)}(t)?Mr.map(Hr(t,e)):[],2),o=i[0],s=i[1];if(!o&&Ir(t))return Rr((function(t){return jr(t,e,n)}))(Ar(t));if(!o)throw new TypeError("Invalid event target");return new Ue((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 Hr(t,e){return function(n){return function(r){return t[n](e,r)}}}var Gr=function(t){function e(e,n){return t.call(this)||this}return Zt(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(ce),Fr={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Fr.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,ne([t,e],ee(n))):setInterval.apply(void 0,ne([t,e],ee(n)))},clearInterval:function(t){var e=Fr.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},Vr=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 Zt(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),Fr.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;Fr.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,ue(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Gr),$r=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=Ge.now,t}(),qr=new(function(t){function e(e,n){void 0===n&&(n=$r.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return Zt(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}($r))(Vr),Kr=function(){function e(){this.apiService=Or.getInstance(),this._lastScreenOrScroll=new Date,this.lastPercent=0}return Object.defineProperty(e.prototype,"lastScreenOrScroll",{set:function(t){this._lastScreenOrScroll=t},enumerable:!1,configurable:!0}),e.getInstance=function(){return this.INSTANCE||(this.INSTANCE=new e),this.INSTANCE},e.prototype.listen=function(){var t,n,r=this;jr(window,"scroll").pipe((t=e.DEBOUNCE_TIME,void 0===n&&(n=qr),Dr((function(e,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 u(){var e=s+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);a()}e.subscribe(Cr(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(u,t),r.add(i))}),(function(){a(),r.complete()}),void 0,(function(){o=i=null})))}))),Pr((function(){var t=r.getPercentScrolledY(window.scrollY);if(Math.abs(r.lastPercent-t)>=e.THRESHOLD||100===t)return t}))).subscribe((function(t){r.sendScroll(t)}))},e.prototype.sendScroll=function(e){if(null!=e){var n={percent:e,timeMS:(new Date).getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;var r=Sr.getString(t.SESSION_STORAGE_SCROLL_ID,""),i=new Yt(t.EVENT_SCROLL,n,null,r);this.apiService.sendEvent(i),Sr.setString(t.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}},e.prototype.getPercentScrolledY=function(t){var e=window.document.body.scrollHeight,n=window.innerHeight;return Math.ceil((t+n)/e*100)},e.DEBOUNCE_TIME=1e3,e.THRESHOLD=10,e}(),Wr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},zr=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Jr=function(){function e(){this.apiService=Or.getInstance(),this.runtimeData=pr.getInstance()}return e.prototype.listen=function(){var t=this;document.onvisibilitychange=function(){"visible"===document.visibilityState?t.onVisible():"hidden"===document.visibilityState&&t.onHidden()}},e.prototype.onVisible=function(){return Wr(this,void 0,void 0,(function(){return zr(this,(function(t){return[2]}))}))},e.prototype.onHidden=function(){return Wr(this,void 0,void 0,(function(){var n,r;return zr(this,(function(o){return 0===(n=this.runtimeData.setInactive())?(i.info("Not sending background event as user was inactive on website"),[2]):(i.info("Sending background event with ".concat(n," seconds")),(r={})[e.ACTIVE_DURATION]=n,this.apiService.sendEvent(new Yt(t.EVENT_APP_BACKGROUND,r)),[2])}))}))},e.ACTIVE_DURATION="aDur",e.INACTIVE_DURATION="iaDur",e}(),Yr=function(){function e(){}return e.getAppIDFromScript=function(){var t,e=null===(t=document.currentScript)||void 0===t?void 0:t.src;if(e)return new URL(e).searchParams.get("appID")},e.prototype.init=function(){hr.watch(),i.configure(),this.logBrand(),(new Jr).listen(),Kr.getInstance().listen(),(new w).meddle()},e.prototype.logBrand=function(){var e="\n";e+="📣 Boost your conversions\n",e+="📈 Increase purchases & repeat purchases\n",e+="🤖 AI-powered creative automation via an easy to use Canva style editor\n",e+="\n\n",e+="Learn more: https://www.letscooee.com\nCooee SDK: v".concat(t.SDK_VERSION),console.group("%c 1-to-1 personalised engagement for ecommerce success powered by 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".concat(e),"font-size: 13px; line-height: 1.8;"),console.groupEnd()},e}(),Xr=function(){function t(){}return t.isNull=function(t){return!t||"null"===t||"undefined"===t},t.removeFromArray=function(t,e){var n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)},t}();const Zr=function(){function e(){this.runtimeData=pr.getInstance(),this.safeHttpCallService=Or.getInstance(),this.newSessionExecutor=new Tr}return e.init=function(e){if(!this.initialized){var n=e.appID,r=e.shopifyShop;n=null==n?void 0:n.trim(),!Xr.isNull(n)&&24===n.length||!Xr.isNull(r)?(this.INSTANCE.newSessionExecutor.init(e),this.initialized=!0,n&&Ye.setString(t.STORAGE_APP_ID,n)):i.warn("Cooee App ID or Shop name is not configured")}},e.setWebAppVersion=function(t){this.INSTANCE.runtimeData.setWebAppVersion(t)},e.setDebug=function(t){this.INSTANCE.runtimeData.setDebugWebApp(t)},e.sendEvent=function(t,e){for(var n in e)if(n.length>3&&n.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");this.INSTANCE.safeHttpCallService.sendEvent(new Yt(t,e))},e.updateProfile=function(t){for(var e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");this.INSTANCE.safeHttpCallService.updateProfile(t)},e.setScreen=function(e){if(e){var n=pr.getInstance(),r=n.getScreen();if(e!==r){n.setScreen(e);var i={};r&&(i.ps=r);var o=new Yt(t.EVENT_SCREEN_VIEW,i);this.INSTANCE.safeHttpCallService.sendEvent(o),Sr.remove(t.SESSION_STORAGE_SCROLL_ID),Kr.getInstance().lastScreenOrScroll=new Date(o.occurred)}}},e.logout=function(){this.INSTANCE.safeHttpCallService.logout()},e.INSTANCE=new e,e}();window.cooeeMainScriptLoaded||(window.cooeeMainScriptLoaded=!0,(new Yr).init());var Qr=function(){function e(){}return e.sendCartToken=function(e){var n;if(null==e?void 0:e.token)if(null===(n=e.items)||void 0===n?void 0:n.length){var r=Ye.getString(t.STORAGE_SHOPIFY_CART_TOKEN);e.token!=r?(i.info("Sending cart token",e.token),Or.getInstance().updateDeviceProps({},{token:e.token,items:e.items}),Ye.setString(t.STORAGE_SHOPIFY_CART_TOKEN,e.token)):i.info("Cart token [".concat(e.token,"] already sent"))}else i.debug("No cart items available");else i.warn("No cart token found",e)},e}(),ti=function(){function t(){}return t.prototype.setCookie=function(t,e,n,r){void 0===r&&(r="day"),"hour"===r?n=60*n*60*1e3:"minute"===r?n=60*n*1e3:"second"===r?n*=1e3:n=24*n*60*60*1e3;var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString();return document.cookie=t+"="+e+";"+o+";path=/",e},t.prototype.getCookie=function(t,e){void 0===e&&(e={});for(var n=t+"=",r=decodeURIComponent(document.cookie).split(";"),i=0;i<r.length;i++){var o=r[i].trim();if(0===o.indexOf(n)){var s=o.substring(n.length,o.length);try{return JSON.parse(s)||e}catch(t){return s||e}}}return e},t.prototype.deleteCookie=function(t){return document.cookie=t+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/",!0},t}(),ei=function(){return ei=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ei.apply(this,arguments)},ni=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},ri=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ii=function(){function t(){this.cartItems=[],this.cookieHelper=new ti,this.COOKIE_NAME="cooeeAddToCartEvent"}return t.prototype.track=function(){return this.fetchExistingCartItems(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod(),this.addSubmitListener(),this},t.prototype.fetchCart=function(){var t;return ni(this,void 0,void 0,(function(){var e;return ri(this,(function(n){switch(n.label){case 0:return i.debug("Fetching cart"),[4,fetch("/cart.js")];case 1:return[4,n.sent().json()];case 2:return e=n.sent(),i.debug("Fetched cart",e),Qr.sendCartToken(e),this.cartItems=null!==(t=e.items)&&void 0!==t?t:[],[2]}}))}))},t.prototype.sendAddToCart=function(t){var e=this.normaliseItems(t);e.length?Zr.sendEvent("Add To Cart",{items:e}):i.debug("No items found to send add to cart event")},t.prototype.sendRemoveFromCart=function(t){var e=this.normaliseItems(t);e.length?Zr.sendEvent("Remove From Cart",{items:e}):i.debug("No items found to send remove from cart event")},t.prototype.normaliseItems=function(t){var e,n;if(!t)return i.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);for(var r=[],o=0,s=t;o<s.length;o++){var a=s[o];a.id&&a.title?r.push({name:a.title,quantity:+a.quantity||1,id:null===(e=a.product_id)||void 0===e?void 0:e.toString(),mID:null===(n=a.product_id)||void 0===n?void 0:n.toString(),vID:a.id.toString()}):i.warn("Invalid item received",a)}return r},t.prototype.fetchExistingCartItems=function(){return ni(this,void 0,void 0,(function(){var t,e=this;return ri(this,(function(n){switch(n.label){case 0:return[4,this.fetchCart()];case 1:return n.sent(),"/cart"!==window.location.pathname||(t=this.getSavedItemFromCookie())&&this.cartItems.forEach((function(n){n.quantity=t.quantity,n.id===t.id&&(e.sendAddToCart(n),e.cookieHelper.deleteCookie(e.COOKIE_NAME))})),[2]}}))}))},t.prototype.overwriteXMLHttpRequest=function(){var t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(n){return this.addEventListener("load",(function(){t.performEvent(this._url,n,"XMLHttpRequest:send").catch((function(t){return i.error("Unable to process cart change in XMLHttpRequest",t)}))})),e.apply(this,arguments)}},t.prototype.overwriteFetchMethod=function(){var t=this,e=window.fetch;window.fetch=function(n,r){return e.apply(window,arguments).then((function(e){return t.performEvent(n.toString(),null==r?void 0:r.body,"window:fetch").catch((function(t){return i.error("Unable to process cart change in fetch",t)})),e}))}},t.prototype.addSubmitListener=function(){var t=this;document.addEventListener("submit",(function(e){var n=e.target.action,r=new URL(n).pathname;if(t.isCartAddURL(r)){var i=t.normaliseFormData(e.target);if(!i)return;var o={id:i.id,quantity:i.quantity};t.cookieHelper.setCookie(t.COOKIE_NAME,JSON.stringify(o),2,"minute")}}))},t.prototype.normaliseFormData=function(t){if(!t)return i.warn("No form data received to process",t),null;var e={};if(t instanceof HTMLFormElement)i.debug("Received form as HTMLFormElement",t),new FormData(t).forEach((function(t,n){"utf8"!==n&&(e[n]=t)}));else if(t instanceof FormData)i.debug("Received form as FormData",t),t.forEach((function(t,n){"utf8"!==n&&(e[n]=t)}));else{if("string"!=typeof t)return i.warn("Unidentified type of form data",typeof t),null;i.debug("Received form as sting",t);try{return JSON.parse(t)}catch(r){i.error("Could not parse as JSON string. Trying as query parameters");var n=void 0;try{n=new URL("".concat(location.origin,"?").concat(t))}catch(t){return i.error("Could not parse as query parameters",t),null}n.searchParams.forEach((function(t,n){e[n]=t}))}}return i.debug("Returning parsed object",e),e},t.prototype.isNumeric=function(t){return!isNaN(parseFloat(null==t?void 0:t.toString()))&&isFinite(null==t?void 0:t.toString())},t.prototype.performEvent=function(t,e,n){return ni(this,void 0,void 0,(function(){return ri(this,(function(r){switch(r.label){case 0:return e?this.isCartAddURL(t)?[4,this.onCartAdd(e)]:[3,2]:[2];case 1:return r.sent(),[3,5];case 2:return this.isCartUpdateURL(t)?[4,this.onChangeCart()]:[3,4];case 3:return r.sent(),[3,5];case 4:i.warn("[".concat(n,"]"),"No matching cart URL found",t),r.label=5;case 5:return[2]}}))}))},t.prototype.isCartAddURL=function(t){var e,n;return!!t.includes("/cart/add")||(null===(n=null===(e=window.CooeeSDK.routes)||void 0===e?void 0:e.cart)||void 0===n?void 0:n.add)===t},t.prototype.isCartUpdateURL=function(t){var e,n,r,i;return!(!t.includes("/cart/change")&&!t.includes("/cart/update"))||(null===(n=null===(e=window.CooeeSDK.routes)||void 0===e?void 0:e.cart)||void 0===n?void 0:n.update)===t||(null===(i=null===(r=window.CooeeSDK.routes)||void 0===r?void 0:r.cart)||void 0===i?void 0:i.change)===t},t.prototype.onCartAdd=function(t){var e,n;return ni(this,void 0,void 0,(function(){var r,i,o;return ri(this,(function(s){switch(s.label){case 0:return(r=this.normaliseFormData(t))?(i=(null===(n=null===(e=r.items)||void 0===e?void 0:e[0])||void 0===n?void 0:n.id)||r.id)?(o=this.getSavedItemFromCookie(),i===(null==o?void 0:o.id)&&this.cookieHelper.deleteCookie(this.COOKIE_NAME),[4,this.onChangeCart()]):[3,2]:[2];case 1:s.sent(),s.label=2;case 2:return[2]}}))}))},t.prototype.getSavedItemFromCookie=function(){var t=this.cookieHelper.getCookie(this.COOKIE_NAME);return(null==t?void 0:t.id)?(t.id=parseInt(t.id),this.isNumeric(t.id)?t:null):null},t.prototype.handleChangesInCartItems=function(t){var e=this;this.cartItems.forEach((function(n){var r=t.find((function(t){return t.key===n.key}));if(r){if(r.quantity!==n.quantity){var i=r.quantity<n.quantity,o=Math.abs(r.quantity-n.quantity),s=ei(ei({},n),{quantity:o});i?e.sendAddToCart(s):e.sendRemoveFromCart(s)}Xr.removeFromArray(t,r)}else e.sendAddToCart(n)}));for(var n=0,r=t;n<r.length;n++){var i=r[n];this.sendRemoveFromCart(i)}},t.prototype.onChangeCart=function(){var t;return ni(this,void 0,void 0,(function(){var e;return ri(this,(function(n){switch(n.label){case 0:return e=null!==(t=this.cartItems)&&void 0!==t?t:[],[4,this.fetchCart()];case 1:return n.sent(),this.handleChangesInCartItems(e),[2]}}))}))},t}(),oi=n(680),si={};si.styleTagTransform=y(),si.setAttributes=p(),si.insert=l().bind(null,"head"),si.domAPI=u(),si.insertStyleElement=d(),s()(oi.Z,si),oi.Z&&oi.Z.locals&&oi.Z.locals;var ai,ui=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},ci=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(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};!function(t){t.VIEW_ITEM="VIEW_ITEM",t.ADD_TO_CART="ADD_TO_CART",t.APPLY_COUPON="APPLY_COUPON"}(ai||(ai={}));var li=function(){function t(){}return t.prototype.listen=function(){var t=this;document.addEventListener("onCooeeCTA",(function(e){return ui(t,void 0,void 0,(function(){return ci(this,(function(t){switch(t.label){case 0:return[4,this.processEvent(e)];case 1:return t.sent(),[2]}}))}))}),!1)},t.prototype.processEvent=function(t){return ui(this,void 0,void 0,(function(){var e,n;return ci(this,(function(r){switch(r.label){case 0:return(e=null==t?void 0:t.detail)&&(n=e.actionType)?(i.log("Performing ".concat(n," action")),n!==ai.VIEW_ITEM?[3,1]:(this.performViewItem(e.item),[3,5])):[2];case 1:return n!==ai.ADD_TO_CART?[3,3]:[4,this.performAddToCart(e.item)];case 2:return r.sent(),[3,5];case 3:return n!==ai.APPLY_COUPON?[3,5]:[4,this.performApplyCoupon(e.coupon)];case 4:r.sent(),r.label=5;case 5:return[2]}}))}))},t.prototype.performViewItem=function(t){(null==t?void 0:t.link)&&(location.href=t.link)},t.prototype.performAddToCart=function(t){var e,n,r;return ui(this,void 0,void 0,(function(){var o,s,a,u;return ci(this,(function(c){switch(c.label){case 0:if(!t)return[2];o=window.CooeeSDK.routes.cart.add||"/cart/add",s={items:[{id:null!==(n=null!==(e=+t.vID)&&void 0!==e?e:+t.mID)&&void 0!==n?n:+t.id,quantity:null!==(r=t.quantity)&&void 0!==r?r:1}]},a=JSON.stringify(s),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,fetch(o,{body:a,method:"post",headers:{"Content-Type":"application/json"}})];case 2:return 200===c.sent().status&&(i.log("Added ".concat(null==t?void 0:t.name," to Cart")),this.updateCartIconAndOpenCart(t)),[3,4];case 3:return u=c.sent(),i.error("Failed to add product in cart",u),[3,4];case 4:return[2]}}))}))},t.prototype.updateCartIconAndOpenCart=function(t){for(var e=0,n=["cart:refresh","product:added","cart:build","ajaxProduct:added"];e<n.length;e++){var r=n[e];document.documentElement.dispatchEvent(new CustomEvent(r,{bubbles:!0,detail:{variant:t.vID||t.mID||t.id,quantity:t.quantity||1}}))}},t.prototype.performApplyCoupon=function(t){return ui(this,void 0,void 0,(function(){var e,n;return ci(this,(function(r){switch(r.label){case 0:if(!(null==t?void 0:t.code))return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(t.code)];case 2:return r.sent(),i.log("Code-".concat(t.code," copied")),(e=document.createElement("span")).id="snackbar",e.innerText="Copied",document.body.appendChild(e),e.className="show",setTimeout((function(){e.classList.remove("show"),document.body.removeChild(e)}),3e3),[3,4];case 3:return n=r.sent(),i.error("Failed to copy code",n),[3,4];case 4:return[2]}}))}))},t}(),fi=function(){function t(){}return t.prototype.track=function(){var t,e=null===(t=window.Shopify)||void 0===t?void 0:t.checkout,n=null==e?void 0:e.order_id;n&&(i.info("Found ".concat(n," to be send"),e),Zr.updateProfile({order:{id:n.toString(),customerID:e.customer_id,url:location.href}}))},t}();if(!window.cooeeShopifyScriptLoaded){window.cooeeShopifyScriptLoaded=!0,i.configure(t.SHOPIFY_LOG_PREFIX),(new fi).track(),(new li).listen();var pi=(new ii).track();window.sendCooeeAddToCart=pi.sendAddToCart.bind(pi),window.sendCooeeRemoveFromCart=pi.sendRemoveFromCart.bind(pi)}})(),CooeeShopify={}.default})();