@letscooee/web-sdk 9.3.14 → 9.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-sdk.min.js +27 -14
- package/dist/widget-sdk.min.js +10 -10
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var sh=Object.create,xc=Object.defineProperty,ah=Object.defineProperties,ch=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertyNames,tp=Object.getOwnPropertySymbols,ph=Object.getPrototypeOf,np=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,rp=(t,e,r)=>e in t?xc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b=(t,e)=>{for(var r in e||={})np.call(e,r)&&rp(t,r,e[r]);if(tp)for(var r of tp(e))fh.call(e,r)&&rp(t,r,e[r]);return t},Z=(t,e)=>ah(t,lh(e)),Gi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),Vi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of uh(e))!np.call(t,i)&&i!==r&&xc(t,i,{get:()=>e[i],enumerable:!(n=ch(e,i))||n.enumerable});return t},Qt=(t,e,r)=>(r=t!=null?sh(ph(t)):{},mh(e||!t||!t.__esModule?xc(r,"default",{value:t,enumerable:!0}):r,t)),tn=Vi((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,v){return function(){return v.apply(h,arguments)}},c=function(){var h=arguments,v=h[0],_,g;for(g=1;g<h.length;g++)for(_ in h[g])!(_ in v)&&h[g].hasOwnProperty(_)&&(v[_]=h[g][_]);return v},u=function(h,v){return{value:h,name:v}};n.TRACE=u(1,"TRACE"),n.DEBUG=u(2,"DEBUG"),n.INFO=u(3,"INFO"),n.TIME=u(4,"TIME"),n.WARN=u(5,"WARN"),n.ERROR=u(8,"ERROR"),n.OFF=u(99,"OFF");var f=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};f.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var v=this.context.filterLevel;return h.value>=v.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,v){i&&this.enabledFor(h)&&i(v,c({level:h},this.context))}};var m=new f({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(m,m.enabledFor),h.trace=o(m,m.trace),h.debug=o(m,m.debug),h.time=o(m,m.time),h.timeEnd=o(m,m.timeEnd),h.info=o(m,m.info),h.warn=o(m,m.warn),h.error=o(m,m.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){m.setLevel(h);for(var v in s)s.hasOwnProperty(v)&&s[v].setLevel(h)},n.getLevel=function(){return m.getLevel()},n.get=function(h){return s[h]||(s[h]=new f(c({name:h},m.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(g,y){y.name&&g.unshift("["+y.name+"]")};var v={},_=function(g,y){Function.prototype.apply.call(g,console,y)};return typeof console>"u"?function(){}:function(g,y){g=Array.prototype.slice.call(g);var C=console.log,O;y.level===n.TIME?(O=(y.name?"["+y.name+"] ":"")+g[0],g[1]==="start"?console.time?console.time(O):v[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):_(C,[O+": "+(new Date().getTime()-v[O])+"ms"])):(y.level===n.WARN&&console.warn?C=console.warn:y.level===n.ERROR&&console.error?C=console.error:y.level===n.INFO&&console.info?C=console.info:y.level===n.DEBUG&&console.debug?C=console.debug:y.level===n.TRACE&&console.trace&&(C=console.trace),h.formatter(g,y),_(C,g))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),Mp=Vi((t,e)=>{"use strict";(function(r,n){"use strict";var i="1.0.40",s="",o="?",c="function",u="undefined",f="object",m="string",h="major",v="model",_="name",g="type",y="vendor",C="version",O="architecture",H="console",R="mobile",k="tablet",V="smarttv",Mt="wearable",de="embedded",B=500,at="Amazon",Y="Apple",st="ASUS",Jt="BlackBerry",me="Browser",pe="Chrome",xe="Edge",be="Firefox",Ut="Google",De="Huawei",dt="LG",Q="Microsoft",we="Motorola",cr="Opera",jr="Samsung",ke="Sharp",en="Sony",Hn="Xiaomi",kn="Zebra",Hi="Facebook",Wi="Chromium OS",ji="Mac OS",Mn=" Browser",Le=function(z,ft){var J={};for(var ie in z)ft[ie]&&ft[ie].length%2===0?J[ie]=ft[ie].concat(z[ie]):J[ie]=z[ie];return J},Wr=function(z){for(var ft={},J=0;J<z.length;J++)ft[z[J].toUpperCase()]=z[J];return ft},is=function(z,ft){return typeof z===m?a(ft).indexOf(a(z))!==-1:!1},a=function(z){return z.toLowerCase()},l=function(z){return typeof z===m?z.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(z,ft){if(typeof z===m)return z=z.replace(/^\s\s*/,s),typeof ft===u?z:z.substring(0,B)},I=function(z,ft){for(var J=0,ie,Fe,je,re,X,Ve;J<ft.length&&!X;){var Ls=ft[J],Yo=ft[J+1];for(ie=Fe=0;ie<Ls.length&&!X&&Ls[ie];)if(X=Ls[ie++].exec(z),X)for(je=0;je<Yo.length;je++)Ve=X[++Fe],re=Yo[je],typeof re===f&&re.length>0?re.length===2?typeof re[1]==c?this[re[0]]=re[1].call(this,Ve):this[re[0]]=re[1]:re.length===3?typeof re[1]===c&&!(re[1].exec&&re[1].test)?this[re[0]]=Ve?re[1].call(this,Ve,re[2]):n:this[re[0]]=Ve?Ve.replace(re[1],re[2]):n:re.length===4&&(this[re[0]]=Ve?re[3].call(this,Ve.replace(re[1],re[2])):n):this[re]=Ve||n;J+=2}},N=function(z,ft){for(var J in ft)if(typeof ft[J]===f&&ft[J].length>0){for(var ie=0;ie<ft[J].length;ie++)if(is(ft[J][ie],z))return J===o?n:J}else if(is(ft[J],z))return J===o?n:J;return ft.hasOwnProperty("*")?ft["*"]:z},L={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},W={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"},te={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[C,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[C,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,C],[/opios[\/ ]+([\w\.]+)/i],[C,[_,cr+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[C,[_,cr+" GX"]],[/\bopr\/([\w\.]+)/i],[C,[_,cr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[C,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[C,[_,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[_,C],[/quark(?:pc)?\/([-\w\.]+)/i],[C,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[C,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[C,[_,"UC"+me]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[C,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[C,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[C,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[C,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[C,[_,"Smart Lenovo "+me]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+me],C],[/\bfocus\/([\w\.]+)/i],[C,[_,be+" Focus"]],[/\bopt\/([\w\.]+)/i],[C,[_,cr+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[C,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[C,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[C,[_,cr+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[C,[_,"MIUI"+Mn]],[/fxios\/([\w\.-]+)/i],[C,[_,be]],[/\bqihoobrowser\/?([\w\.]*)/i],[C,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],C],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Mn],C],[/samsungbrowser\/([\w\.]+)/i],[C,[_,jr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[C,[_,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,"Sogou Mobile"],C],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,C],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[C,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Hi],C],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[_,C],[/\bgsa\/([\w\.]+) .*safari\//i],[C,[_,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[C,[_,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[C,[_,pe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,pe+" WebView"],C],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[C,[_,"Android "+me]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,C],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[C,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[C,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[C,N,L]],[/(webkit|khtml)\/([\w\.]+)/i],[_,C],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],C],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,C],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[C,[_,be+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[_,[C,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[C,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[O,"amd64"]],[/(ia32(?=;))/i],[[O,a]],[/((?:i[346]|x)86)[;\)]/i],[[O,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[O,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[O,"armhf"]],[/windows (ce|mobile); ppc;/i],[[O,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[O,/ower/,s,a]],[/(sun4\w)[;\)]/i],[[O,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[O,a]]],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],[v,[y,jr],[g,k]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[v,[y,jr],[g,R]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[y,Y],[g,R]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[y,Y],[g,k]],[/(macintosh);/i],[v,[y,Y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[y,ke],[g,R]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[y,"Honor"],[g,R]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[y,De],[g,k]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[y,De],[g,R]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[g,R]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[g,k]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[v,[y,"OPPO"],[g,R]],[/\b(opd2\d{3}a?) bui/i],[v,[y,"OPPO"],[g,k]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[y,"Vivo"],[g,R]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[y,"Realme"],[g,R]],[/\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],[v,[y,we],[g,R]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[y,we],[g,k]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[y,dt],[g,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[y,dt],[g,R]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[y,"Lenovo"],[g,k]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[y,"Nokia"],[g,R]],[/(pixel c)\b/i],[v,[y,Ut],[g,k]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[y,Ut],[g,R]],[/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],[v,[y,en],[g,R]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[y,en],[g,k]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[y,"OnePlus"],[g,R]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[y,at],[g,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[y,at],[g,R]],[/(playbook);[-\w\),; ]+(rim)/i],[v,y,[g,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[y,Jt],[g,R]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[y,st],[g,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[y,st],[g,R]],[/(nexus 9)/i],[v,[y,"HTC"],[g,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[v,/_/g," "],[g,R]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[v,[y,"TCL"],[g,k]],[/(itel) ((\w+))/i],[[y,a],v,[g,N,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[y,"Acer"],[g,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[y,"Meizu"],[g,R]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[y,"Ulefone"],[g,R]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[y,"Energizer"],[g,R]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[y,"Cat"],[g,R]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[y,"Smartfren"],[g,R]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[y,"Nothing"],[g,R]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[y,v,[g,R]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[y,v,[g,k]],[/(surface duo)/i],[v,[y,Q],[g,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[y,"Fairphone"],[g,R]],[/(u304aa)/i],[v,[y,"AT&T"],[g,R]],[/\bsie-(\w*)/i],[v,[y,"Siemens"],[g,R]],[/\b(rct\w+) b/i],[v,[y,"RCA"],[g,k]],[/\b(venue[\d ]{2,7}) b/i],[v,[y,"Dell"],[g,k]],[/\b(q(?:mv|ta)\w+) b/i],[v,[y,"Verizon"],[g,k]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[y,"Barnes & Noble"],[g,k]],[/\b(tm\d{3}\w+) b/i],[v,[y,"NuVision"],[g,k]],[/\b(k88) b/i],[v,[y,"ZTE"],[g,k]],[/\b(nx\d{3}j) b/i],[v,[y,"ZTE"],[g,R]],[/\b(gen\d{3}) b.+49h/i],[v,[y,"Swiss"],[g,R]],[/\b(zur\d{3}) b/i],[v,[y,"Swiss"],[g,k]],[/\b((zeki)?tb.*\b) b/i],[v,[y,"Zeki"],[g,k]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],v,[g,k]],[/\b(ns-?\w{0,9}) b/i],[v,[y,"Insignia"],[g,k]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[y,"NextBook"],[g,k]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],v,[g,R]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],v,[g,R]],[/\b(ph-1) /i],[v,[y,"Essential"],[g,R]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[y,"Envizen"],[g,k]],[/\b(trio[-\w\. ]+) b/i],[v,[y,"MachSpeed"],[g,k]],[/\btu_(1491) b/i],[v,[y,"Rotor"],[g,k]],[/(shield[\w ]+) b/i],[v,[y,"Nvidia"],[g,k]],[/(sprint) (\w+)/i],[y,v,[g,R]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[y,Q],[g,R]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[y,kn],[g,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[y,kn],[g,R]],[/smart-tv.+(samsung)/i],[y,[g,V]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[y,jr],[g,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,dt],[g,V]],[/(apple) ?tv/i],[y,[v,Y+" TV"],[g,V]],[/crkey/i],[[v,pe+"cast"],[y,Ut],[g,V]],[/droid.+aft(\w+)( bui|\))/i],[v,[y,at],[g,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[y,ke],[g,V]],[/(bravia[\w ]+)( bui|\))/i],[v,[y,en],[g,V]],[/(mitv-\w{5}) bui/i],[v,[y,Hn],[g,V]],[/Hbbtv.*(technisat) (.*);/i],[y,v,[g,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,p],[v,p],[g,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[g,V]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,v,[g,H]],[/droid.+; (shield) bui/i],[v,[y,"Nvidia"],[g,H]],[/(playstation [345portablevi]+)/i],[v,[y,en],[g,H]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[y,Q],[g,H]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[y,jr],[g,Mt]],[/((pebble))app/i],[y,v,[g,Mt]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[y,Y],[g,Mt]],[/droid.+; (glass) \d/i],[v,[y,Ut],[g,Mt]],[/droid.+; (wt63?0{2,3})\)/i],[v,[y,kn],[g,Mt]],[/droid.+; (glass) \d/i],[v,[y,Ut],[g,Mt]],[/(pico) (4|neo3(?: link|pro)?)/i],[y,v,[g,Mt]],[/; (quest( \d| pro)?)/i],[v,[y,Hi],[g,Mt]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[g,de]],[/(aeobc)\b/i],[v,[y,at],[g,de]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[g,R]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[g,k]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,R]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[C,[_,xe+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[_,C],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[C,[_,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[_,C],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[C,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,C],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[_,[C,N,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[C,N,W],[_,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[C,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,ji],[C,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[C,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,C],[/\(bb(10);/i],[C,[_,Jt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[C,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[C,[_,be+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[C,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[C,[_,"watchOS"]],[/crkey\/([\d\.]+)/i],[C,[_,pe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,Wi],C],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[_,C],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],C],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,C]]},wt=function(z,ft){if(typeof z===f&&(ft=z,z=n),!(this instanceof wt))return new wt(z,ft).getResult();var J=typeof r!==u&&r.navigator?r.navigator:n,ie=z||(J&&J.userAgent?J.userAgent:s),Fe=J&&J.userAgentData?J.userAgentData:n,je=ft?Le(te,ft):te,re=J&&J.userAgent==ie;return this.getBrowser=function(){var X={};return X[_]=n,X[C]=n,I.call(X,ie,je.browser),X[h]=l(X[C]),re&&J&&J.brave&&typeof J.brave.isBrave==c&&(X[_]="Brave"),X},this.getCPU=function(){var X={};return X[O]=n,I.call(X,ie,je.cpu),X},this.getDevice=function(){var X={};return X[y]=n,X[v]=n,X[g]=n,I.call(X,ie,je.device),re&&!X[g]&&Fe&&Fe.mobile&&(X[g]=R),re&&X[v]=="Macintosh"&&J&&typeof J.standalone!==u&&J.maxTouchPoints&&J.maxTouchPoints>2&&(X[v]="iPad",X[g]=k),X},this.getEngine=function(){var X={};return X[_]=n,X[C]=n,I.call(X,ie,je.engine),X},this.getOS=function(){var X={};return X[_]=n,X[C]=n,I.call(X,ie,je.os),re&&!X[_]&&Fe&&Fe.platform&&Fe.platform!="Unknown"&&(X[_]=Fe.platform.replace(/chrome os/i,Wi).replace(/macos/i,ji)),X},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 ie},this.setUA=function(X){return ie=typeof X===m&&X.length>B?p(X,B):X,this},this.setUA(ie),this};wt.VERSION=i,wt.BROWSER=Wr([_,C,h]),wt.CPU=Wr([O]),wt.DEVICE=Wr([v,y,g,H,R,V,k,Mt,de]),wt.ENGINE=wt.OS=Wr([_,C]),typeof t!==u?(typeof e!==u&&e.exports&&(t=e.exports=wt),t.UAParser=wt):typeof define===c&&define.amd?define(function(){return wt}):typeof r!==u&&(r.UAParser=wt);var Dt=typeof r!==u&&(r.jQuery||r.Zepto);if(Dt&&!Dt.ua){var le=new wt;Dt.ua=le.getResult(),Dt.ua.get=function(){return le.getUA()},Dt.ua.set=function(z){le.setUA(z);var ft=le.getResult();for(var J in ft)Dt.ua[J]=ft[J]}}})(typeof window=="object"?window:t)}),Hp=Vi((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,c,u){function f(v,_){if(!c[v]){if(!o[v]){var g=typeof Gi=="function"&&Gi;if(!_&&g)return g(v,!0);if(m)return m(v,!0);var y=new Error("Cannot find module '"+v+"'");throw y.code="MODULE_NOT_FOUND",y}var C=c[v]={exports:{}};o[v][0].call(C.exports,function(O){var H=o[v][1][O];return f(H||O)},C,C.exports,s,o,c,u)}return c[v].exports}for(var m=typeof Gi=="function"&&Gi,h=0;h<u.length;h++)f(u[h]);return f}({1:[function(s,o,c){(function(u){"use strict";var f=u.MutationObserver||u.WebKitMutationObserver,m;if(f){var h=0,v=new f(O),_=u.document.createTextNode("");v.observe(_,{characterData:!0}),m=function(){_.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var g=new u.MessageChannel;g.port1.onmessage=O,m=function(){g.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var R=u.document.createElement("script");R.onreadystatechange=function(){O(),R.onreadystatechange=null,R.parentNode.removeChild(R),R=null},u.document.documentElement.appendChild(R)}:m=function(){setTimeout(O,0)};var y,C=[];function O(){y=!0;for(var R,k,V=C.length;V;){for(k=C,C=[],R=-1;++R<V;)k[R]();V=C.length}y=!1}o.exports=H;function H(R){C.push(R)===1&&!y&&m()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,c){"use strict";var u=s(1);function f(){}var m={},h=["REJECTED"],v=["FULFILLED"],_=["PENDING"];o.exports=g;function g(B){if(typeof B!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,B!==f&&H(this,B)}g.prototype.catch=function(B){return this.then(null,B)},g.prototype.then=function(B,at){if(typeof B!="function"&&this.state===v||typeof at!="function"&&this.state===h)return this;var Y=new this.constructor(f);if(this.state!==_){var st=this.state===v?B:at;C(Y,st,this.outcome)}else this.queue.push(new y(Y,B,at));return Y};function y(B,at,Y){this.promise=B,typeof at=="function"&&(this.onFulfilled=at,this.callFulfilled=this.otherCallFulfilled),typeof Y=="function"&&(this.onRejected=Y,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(B){m.resolve(this.promise,B)},y.prototype.otherCallFulfilled=function(B){C(this.promise,this.onFulfilled,B)},y.prototype.callRejected=function(B){m.reject(this.promise,B)},y.prototype.otherCallRejected=function(B){C(this.promise,this.onRejected,B)};function C(B,at,Y){u(function(){var st;try{st=at(Y)}catch(Jt){return m.reject(B,Jt)}st===B?m.reject(B,new TypeError("Cannot resolve promise with itself")):m.resolve(B,st)})}m.resolve=function(B,at){var Y=R(O,at);if(Y.status==="error")return m.reject(B,Y.value);var st=Y.value;if(st)H(B,st);else{B.state=v,B.outcome=at;for(var Jt=-1,me=B.queue.length;++Jt<me;)B.queue[Jt].callFulfilled(at)}return B},m.reject=function(B,at){B.state=h,B.outcome=at;for(var Y=-1,st=B.queue.length;++Y<st;)B.queue[Y].callRejected(at);return B};function O(B){var at=B&&B.then;if(B&&(typeof B=="object"||typeof B=="function")&&typeof at=="function")return function(){at.apply(B,arguments)}}function H(B,at){var Y=!1;function st(xe){Y||(Y=!0,m.reject(B,xe))}function Jt(xe){Y||(Y=!0,m.resolve(B,xe))}function me(){at(Jt,st)}var pe=R(me);pe.status==="error"&&st(pe.value)}function R(B,at){var Y={};try{Y.value=B(at),Y.status="success"}catch(st){Y.status="error",Y.value=st}return Y}g.resolve=k;function k(B){return B instanceof this?B:m.resolve(new this(f),B)}g.reject=V;function V(B){var at=new this(f);return m.reject(at,B)}g.all=Mt;function Mt(B){var at=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=B.length,st=!1;if(!Y)return this.resolve([]);for(var Jt=new Array(Y),me=0,pe=-1,xe=new this(f);++pe<Y;)be(B[pe],pe);return xe;function be(Ut,De){at.resolve(Ut).then(dt,function(Q){st||(st=!0,m.reject(xe,Q))});function dt(Q){Jt[De]=Q,++me===Y&&!st&&(st=!0,m.resolve(xe,Jt))}}}g.race=de;function de(B){var at=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=B.length,st=!1;if(!Y)return this.resolve([]);for(var Jt=-1,me=new this(f);++Jt<Y;)pe(B[Jt]);return me;function pe(xe){at.resolve(xe).then(function(be){st||(st=!0,m.resolve(me,be))},function(be){st||(st=!0,m.reject(me,be))})}}},{1:1}],3:[function(s,o,c){(function(u){"use strict";typeof u.Promise!="function"&&(u.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,c){"use strict";var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function f(d,E){if(!(d instanceof E))throw new TypeError("Cannot call a class as a function")}function m(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=m();function v(){try{if(!h||!h.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),E=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||E)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function _(d,E){d=d||[],E=E||{};try{return new Blob(d,E)}catch(D){if(D.name!=="TypeError")throw D;for(var S=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new S,x=0;x<d.length;x+=1)T.append(d[x]);return T.getBlob(E.type)}}typeof Promise>"u"&&s(3);var g=Promise;function y(d,E){E&&d.then(function(S){E(null,S)},function(S){E(S)})}function C(d,E,S){typeof E=="function"&&d.then(E),typeof S=="function"&&d.catch(S)}function O(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}function H(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var R="local-forage-detect-blob-support",k=void 0,V={},Mt=Object.prototype.toString,de="readonly",B="readwrite";function at(d){for(var E=d.length,S=new ArrayBuffer(E),T=new Uint8Array(S),x=0;x<E;x++)T[x]=d.charCodeAt(x);return S}function Y(d){return new g(function(E){var S=d.transaction(R,B),T=_([""]);S.objectStore(R).put(T,"key"),S.onabort=function(x){x.preventDefault(),x.stopPropagation(),E(!1)},S.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\/(\d+)/),D=navigator.userAgent.match(/Edge\//);E(D||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function st(d){return typeof k=="boolean"?g.resolve(k):Y(d).then(function(E){return k=E,k})}function Jt(d){var E=V[d.name],S={};S.promise=new g(function(T,x){S.resolve=T,S.reject=x}),E.deferredOperations.push(S),E.dbReady?E.dbReady=E.dbReady.then(function(){return S.promise}):E.dbReady=S.promise}function me(d){var E=V[d.name],S=E.deferredOperations.pop();if(S)return S.resolve(),S.promise}function pe(d,E){var S=V[d.name],T=S.deferredOperations.pop();if(T)return T.reject(E),T.promise}function xe(d,E){return new g(function(S,T){if(V[d.name]=V[d.name]||en(),d.db)if(E)Jt(d),d.db.close();else return S(d.db);var x=[d.name];E&&x.push(d.version);var D=h.open.apply(h,x);E&&(D.onupgradeneeded=function(P){var U=D.result;try{U.createObjectStore(d.storeName),P.oldVersion<=1&&U.createObjectStore(R)}catch(F){if(F.name==="ConstraintError")console.warn('The database "'+d.name+'" has been upgraded from version '+P.oldVersion+" to version "+P.newVersion+', but the storage "'+d.storeName+'" already exists.');else throw F}}),D.onerror=function(P){P.preventDefault(),T(D.error)},D.onsuccess=function(){var P=D.result;P.onversionchange=function(U){U.target.close()},S(P),me(d)}})}function be(d){return xe(d,!1)}function Ut(d){return xe(d,!0)}function De(d,E){if(!d.db)return!0;var S=!d.db.objectStoreNames.contains(d.storeName),T=d.version<d.db.version,x=d.version>d.db.version;if(T&&(d.version!==E&&console.warn('The database "'+d.name+`" can't be downgraded from version `+d.db.version+" to version "+d.version+"."),d.version=d.db.version),x||S){if(S){var D=d.db.version+1;D>d.version&&(d.version=D)}return!0}return!1}function dt(d){return new g(function(E,S){var T=new FileReader;T.onerror=S,T.onloadend=function(x){var D=btoa(x.target.result||"");E({__local_forage_encoded_blob:!0,data:D,type:d.type})},T.readAsBinaryString(d)})}function Q(d){var E=at(atob(d.data));return _([E],{type:d.type})}function we(d){return d&&d.__local_forage_encoded_blob}function cr(d){var E=this,S=E._initReady().then(function(){var T=V[E._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(S,d,d),S}function jr(d){Jt(d);for(var E=V[d.name],S=E.forages,T=0;T<S.length;T++){var x=S[T];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return d.db=null,be(d).then(function(D){return d.db=D,De(d)?Ut(d):D}).then(function(D){d.db=E.db=D;for(var P=0;P<S.length;P++)S[P]._dbInfo.db=D}).catch(function(D){throw pe(d,D),D})}function ke(d,E,S,T){T===void 0&&(T=1);try{var x=d.db.transaction(d.storeName,E);S(null,x)}catch(D){if(T>0&&(!d.db||D.name==="InvalidStateError"||D.name==="NotFoundError"))return g.resolve().then(function(){if(!d.db||D.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Ut(d)}).then(function(){return jr(d).then(function(){ke(d,E,S,T-1)})}).catch(S);S(D)}}function en(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Hn(d){var E=this,S={db:null};if(d)for(var T in d)S[T]=d[T];var x=V[S.name];x||(x=en(),V[S.name]=x),x.forages.push(E),E._initReady||(E._initReady=E.ready,E.ready=cr);var D=[];function P(){return g.resolve()}for(var U=0;U<x.forages.length;U++){var F=x.forages[U];F!==E&&D.push(F._initReady().catch(P))}var $=x.forages.slice(0);return g.all(D).then(function(){return S.db=x.db,be(S)}).then(function(j){return S.db=j,De(S,E._defaultConfig.version)?Ut(S):j}).then(function(j){S.db=x.db=j,E._dbInfo=S;for(var G=0;G<$.length;G++){var mt=$[G];mt!==E&&(mt._dbInfo.db=S.db,mt._dbInfo.version=S.version)}})}function kn(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){ke(S._dbInfo,de,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=F.get(d);$.onsuccess=function(){var j=$.result;j===void 0&&(j=null),we(j)&&(j=Q(j)),x(j)},$.onerror=function(){D($.error)}}catch(j){D(j)}})}).catch(D)});return y(T,E),T}function Hi(d,E){var S=this,T=new g(function(x,D){S.ready().then(function(){ke(S._dbInfo,de,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=F.openCursor(),j=1;$.onsuccess=function(){var G=$.result;if(G){var mt=G.value;we(mt)&&(mt=Q(mt));var he=d(mt,G.key,j++);he!==void 0?x(he):G.continue()}else x()},$.onerror=function(){D($.error)}}catch(G){D(G)}})}).catch(D)});return y(T,E),T}function Wi(d,E,S){var T=this;d=O(d);var x=new g(function(D,P){var U;T.ready().then(function(){return U=T._dbInfo,Mt.call(E)==="[object Blob]"?st(U.db).then(function(F){return F?E:dt(E)}):E}).then(function(F){ke(T._dbInfo,B,function($,j){if($)return P($);try{var G=j.objectStore(T._dbInfo.storeName);F===null&&(F=void 0);var mt=G.put(F,d);j.oncomplete=function(){F===void 0&&(F=null),D(F)},j.onabort=j.onerror=function(){var he=mt.error?mt.error:mt.transaction.error;P(he)}}catch(he){P(he)}})}).catch(P)});return y(x,S),x}function ji(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){ke(S._dbInfo,B,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=F.delete(d);U.oncomplete=function(){x()},U.onerror=function(){D($.error)},U.onabort=function(){var j=$.error?$.error:$.transaction.error;D(j)}}catch(j){D(j)}})}).catch(D)});return y(T,E),T}function Mn(d){var E=this,S=new g(function(T,x){E.ready().then(function(){ke(E._dbInfo,B,function(D,P){if(D)return x(D);try{var U=P.objectStore(E._dbInfo.storeName),F=U.clear();P.oncomplete=function(){T()},P.onabort=P.onerror=function(){var $=F.error?F.error:F.transaction.error;x($)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function Le(d){var E=this,S=new g(function(T,x){E.ready().then(function(){ke(E._dbInfo,de,function(D,P){if(D)return x(D);try{var U=P.objectStore(E._dbInfo.storeName),F=U.count();F.onsuccess=function(){T(F.result)},F.onerror=function(){x(F.error)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function Wr(d,E){var S=this,T=new g(function(x,D){if(d<0){x(null);return}S.ready().then(function(){ke(S._dbInfo,de,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=!1,j=F.openKeyCursor();j.onsuccess=function(){var G=j.result;if(!G){x(null);return}d===0||$?x(G.key):($=!0,G.advance(d))},j.onerror=function(){D(j.error)}}catch(G){D(G)}})}).catch(D)});return y(T,E),T}function is(d){var E=this,S=new g(function(T,x){E.ready().then(function(){ke(E._dbInfo,de,function(D,P){if(D)return x(D);try{var U=P.objectStore(E._dbInfo.storeName),F=U.openKeyCursor(),$=[];F.onsuccess=function(){var j=F.result;if(!j){T($);return}$.push(j.key),j.continue()},F.onerror=function(){x(F.error)}}catch(j){x(j)}})}).catch(x)});return y(S,d),S}function a(d,E){E=H.apply(this,arguments);var S=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||S.name,d.storeName=d.storeName||S.storeName);var T=this,x;if(!d.name)x=g.reject("Invalid arguments");else{var D=d.name===S.name&&T._dbInfo.db,P=D?g.resolve(T._dbInfo.db):be(d).then(function(U){var F=V[d.name],$=F.forages;F.db=U;for(var j=0;j<$.length;j++)$[j]._dbInfo.db=U;return U});d.storeName?x=P.then(function(U){if(U.objectStoreNames.contains(d.storeName)){var F=U.version+1;Jt(d);var $=V[d.name],j=$.forages;U.close();for(var G=0;G<j.length;G++){var mt=j[G];mt._dbInfo.db=null,mt._dbInfo.version=F}var he=new g(function(oe,Ie){var ye=h.open(d.name,F);ye.onerror=function(We){var Ku=ye.result;Ku.close(),Ie(We)},ye.onupgradeneeded=function(){var We=ye.result;We.deleteObjectStore(d.storeName)},ye.onsuccess=function(){var We=ye.result;We.close(),oe(We)}});return he.then(function(oe){$.db=oe;for(var Ie=0;Ie<j.length;Ie++){var ye=j[Ie];ye._dbInfo.db=oe,me(ye._dbInfo)}}).catch(function(oe){throw(pe(d,oe)||g.resolve()).catch(function(){}),oe})}}):x=P.then(function(U){Jt(d);var F=V[d.name],$=F.forages;U.close();for(var j=0;j<$.length;j++){var G=$[j];G._dbInfo.db=null}var mt=new g(function(he,oe){var Ie=h.deleteDatabase(d.name);Ie.onerror=function(){var ye=Ie.result;ye&&ye.close(),oe(Ie.error)},Ie.onblocked=function(){console.warn('dropInstance blocked for database "'+d.name+'" until all open connections are closed')},Ie.onsuccess=function(){var ye=Ie.result;ye&&ye.close(),he(ye)}});return mt.then(function(he){F.db=he;for(var oe=0;oe<$.length;oe++){var Ie=$[oe];me(Ie._dbInfo)}}).catch(function(he){throw(pe(d,he)||g.resolve()).catch(function(){}),he})})}return y(x,E),x}var l={_driver:"asyncStorage",_initStorage:Hn,_support:v(),iterate:Hi,getItem:kn,setItem:Wi,removeItem:ji,clear:Mn,length:Le,key:Wr,keys:is,dropInstance:a};function p(){return typeof openDatabase=="function"}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="~~local_forage_type~",L=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",te=W.length,wt="arbf",Dt="blob",le="si08",z="ui08",ft="uic8",J="si16",ie="si32",Fe="ur16",je="ui32",re="fl32",X="fl64",Ve=te+wt.length,Ls=Object.prototype.toString;function Yo(d){var E=d.length*.75,S=d.length,T,x=0,D,P,U,F;d[d.length-1]==="="&&(E--,d[d.length-2]==="="&&E--);var $=new ArrayBuffer(E),j=new Uint8Array($);for(T=0;T<S;T+=4)D=I.indexOf(d[T]),P=I.indexOf(d[T+1]),U=I.indexOf(d[T+2]),F=I.indexOf(d[T+3]),j[x++]=D<<2|P>>4,j[x++]=(P&15)<<4|U>>2,j[x++]=(U&3)<<6|F&63;return $}function Ic(d){var E=new Uint8Array(d),S="",T;for(T=0;T<E.length;T+=3)S+=I[E[T]>>2],S+=I[(E[T]&3)<<4|E[T+1]>>4],S+=I[(E[T+1]&15)<<2|E[T+2]>>6],S+=I[E[T+2]&63];return E.length%3===2?S=S.substring(0,S.length-1)+"=":E.length%3===1&&(S=S.substring(0,S.length-2)+"=="),S}function $d(d,E){var S="";if(d&&(S=Ls.call(d)),d&&(S==="[object ArrayBuffer]"||d.buffer&&Ls.call(d.buffer)==="[object ArrayBuffer]")){var T,x=W;d instanceof ArrayBuffer?(T=d,x+=wt):(T=d.buffer,S==="[object Int8Array]"?x+=le:S==="[object Uint8Array]"?x+=z:S==="[object Uint8ClampedArray]"?x+=ft:S==="[object Int16Array]"?x+=J:S==="[object Uint16Array]"?x+=Fe:S==="[object Int32Array]"?x+=ie:S==="[object Uint32Array]"?x+=je:S==="[object Float32Array]"?x+=re:S==="[object Float64Array]"?x+=X:E(new Error("Failed to get type for BinaryArray"))),E(x+Ic(T))}else if(S==="[object Blob]"){var D=new FileReader;D.onload=function(){var P=N+d.type+"~"+Ic(this.result);E(W+Dt+P)},D.readAsArrayBuffer(d)}else try{E(JSON.stringify(d))}catch(P){console.error("Couldn't convert value into a JSON string: ",d),E(null,P)}}function Fd(d){if(d.substring(0,te)!==W)return JSON.parse(d);var E=d.substring(Ve),S=d.substring(te,Ve),T;if(S===Dt&&L.test(E)){var x=E.match(L);T=x[1],E=E.substring(x[0].length)}var D=Yo(E);switch(S){case wt:return D;case Dt:return _([D],{type:T});case le:return new Int8Array(D);case z:return new Uint8Array(D);case ft:return new Uint8ClampedArray(D);case J:return new Int16Array(D);case Fe:return new Uint16Array(D);case ie:return new Int32Array(D);case je:return new Uint32Array(D);case re:return new Float32Array(D);case X:return new Float64Array(D);default:throw new Error("Unkown type: "+S)}}var Tc={serialize:$d,deserialize:Fd,stringToBuffer:Yo,bufferToString:Ic};function eh(d,E,S,T){d.executeSql("CREATE TABLE IF NOT EXISTS "+E.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],S,T)}function Hd(d){var E=this,S={db:null};if(d)for(var T in d)S[T]=typeof d[T]!="string"?d[T].toString():d[T];var x=new g(function(D,P){try{S.db=openDatabase(S.name,String(S.version),S.description,S.size)}catch(U){return P(U)}S.db.transaction(function(U){eh(U,S,function(){E._dbInfo=S,D()},function(F,$){P($)})},P)});return S.serializer=Tc,x}function Fn(d,E,S,T,x,D){d.executeSql(S,T,x,function(P,U){U.code===U.SYNTAX_ERR?P.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[E.storeName],function(F,$){$.rows.length?D(F,U):eh(F,E,function(){F.executeSql(S,T,x,D)},D)},D):D(P,U)},D)}function Vd(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"SELECT * FROM "+P.storeName+" WHERE key = ? LIMIT 1",[d],function(F,$){var j=$.rows.length?$.rows.item(0).value:null;j&&(j=P.serializer.deserialize(j)),x(j)},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function qd(d,E){var S=this,T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"SELECT * FROM "+P.storeName,[],function(F,$){for(var j=$.rows,G=j.length,mt=0;mt<G;mt++){var he=j.item(mt),oe=he.value;if(oe&&(oe=P.serializer.deserialize(oe)),oe=d(oe,he.key,mt+1),oe!==void 0){x(oe);return}}x()},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function rh(d,E,S,T){var x=this;d=O(d);var D=new g(function(P,U){x.ready().then(function(){E===void 0&&(E=null);var F=E,$=x._dbInfo;$.serializer.serialize(E,function(j,G){G?U(G):$.db.transaction(function(mt){Fn(mt,$,"INSERT OR REPLACE INTO "+$.storeName+" (key, value) VALUES (?, ?)",[d,j],function(){P(F)},function(he,oe){U(oe)})},function(mt){if(mt.code===mt.QUOTA_ERR){if(T>0){P(rh.apply(x,[d,F,S,T-1]));return}U(mt)}})})}).catch(U)});return y(D,S),D}function Wd(d,E,S){return rh.apply(this,[d,E,S,1])}function zd(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"DELETE FROM "+P.storeName+" WHERE key = ?",[d],function(){x()},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function Gd(d){var E=this,S=new g(function(T,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"DELETE FROM "+D.storeName,[],function(){T()},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Kd(d){var E=this,S=new g(function(T,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"SELECT COUNT(key) as c FROM "+D.storeName,[],function(U,F){var $=F.rows.item(0).c;T($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Yd(d,E){var S=this,T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"SELECT key FROM "+P.storeName+" WHERE id = ? LIMIT 1",[d+1],function(F,$){var j=$.rows.length?$.rows.item(0).key:null;x(j)},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function Jd(d){var E=this,S=new g(function(T,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"SELECT key FROM "+D.storeName,[],function(U,F){for(var $=[],j=0;j<F.rows.length;j++)$.push(F.rows.item(j).key);T($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Zd(d){return new g(function(E,S){d.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(x,D){for(var P=[],U=0;U<D.rows.length;U++)P.push(D.rows.item(U).name);E({db:d,storeNames:P})},function(x,D){S(D)})},function(T){S(T)})})}function Xd(d,E){E=H.apply(this,arguments);var S=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||S.name,d.storeName=d.storeName||S.storeName);var T=this,x;return d.name?x=new g(function(D){var P;d.name===S.name?P=T._dbInfo.db:P=openDatabase(d.name,"","",0),d.storeName?D({db:P,storeNames:[d.storeName]}):D(Zd(P))}).then(function(D){return new g(function(P,U){D.db.transaction(function(F){function $(he){return new g(function(oe,Ie){F.executeSql("DROP TABLE IF EXISTS "+he,[],function(){oe()},function(ye,We){Ie(We)})})}for(var j=[],G=0,mt=D.storeNames.length;G<mt;G++)j.push($(D.storeNames[G]));g.all(j).then(function(){P()}).catch(function(he){U(he)})},function(F){U(F)})})}):x=g.reject("Invalid arguments"),y(x,E),x}var Qd={_driver:"webSQLStorage",_initStorage:Hd,_support:p(),iterate:qd,getItem:Vd,setItem:Wd,removeItem:zd,clear:Gd,length:Kd,key:Yd,keys:Jd,dropInstance:Xd};function Hg(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function nh(d,E){var S=d.name+"/";return d.storeName!==E.storeName&&(S+=d.storeName+"/"),S}function Lm(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function qm(){return!Lm()||localStorage.length>0}function zm(d){var E=this,S={};if(d)for(var T in d)S[T]=d[T];return S.keyPrefix=nh(d,E._defaultConfig),qm()?(E._dbInfo=S,S.serializer=Tc,g.resolve()):g.reject()}function Ym(d){var E=this,S=E.ready().then(function(){for(var T=E._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var D=localStorage.key(x);D.indexOf(T)===0&&localStorage.removeItem(D)}});return y(S,d),S}function kv(d,E){var S=this;d=O(d);var T=S.ready().then(function(){var x=S._dbInfo,D=localStorage.getItem(x.keyPrefix+d);return D&&(D=x.serializer.deserialize(D)),D});return y(T,E),T}function Mv(d,E){var S=this,T=S.ready().then(function(){for(var x=S._dbInfo,D=x.keyPrefix,P=D.length,U=localStorage.length,F=1,$=0;$<U;$++){var j=localStorage.key($);if(j.indexOf(D)===0){var G=localStorage.getItem(j);if(G&&(G=x.serializer.deserialize(G)),G=d(G,j.substring(P),F++),G!==void 0)return G}}});return y(T,E),T}function Uv(d,E){var S=this,T=S.ready().then(function(){var x=S._dbInfo,D;try{D=localStorage.key(d)}catch{D=null}return D&&(D=D.substring(x.keyPrefix.length)),D});return y(T,E),T}function Bv(d){var E=this,S=E.ready().then(function(){for(var T=E._dbInfo,x=localStorage.length,D=[],P=0;P<x;P++){var U=localStorage.key(P);U.indexOf(T.keyPrefix)===0&&D.push(U.substring(T.keyPrefix.length))}return D});return y(S,d),S}function jv(d){var E=this,S=E.keys().then(function(T){return T.length});return y(S,d),S}function $v(d,E){var S=this;d=O(d);var T=S.ready().then(function(){var x=S._dbInfo;localStorage.removeItem(x.keyPrefix+d)});return y(T,E),T}function Fv(d,E,S){var T=this;d=O(d);var x=T.ready().then(function(){E===void 0&&(E=null);var D=E;return new g(function(P,U){var F=T._dbInfo;F.serializer.serialize(E,function($,j){if(j)U(j);else try{localStorage.setItem(F.keyPrefix+d,$),P(D)}catch(G){(G.name==="QuotaExceededError"||G.name==="NS_ERROR_DOM_QUOTA_REACHED")&&U(G),U(G)}})})});return y(x,S),x}function Hv(d,E){if(E=H.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var S=this.config();d.name=d.name||S.name,d.storeName=d.storeName||S.storeName}var T=this,x;return d.name?x=new g(function(D){d.storeName?D(nh(d,T._defaultConfig)):D(d.name+"/")}).then(function(D){for(var P=localStorage.length-1;P>=0;P--){var U=localStorage.key(P);U.indexOf(D)===0&&localStorage.removeItem(U)}}):x=g.reject("Invalid arguments"),y(x,E),x}var Vv={_driver:"localStorageWrapper",_initStorage:zm,_support:Hg(),iterate:Mv,getItem:kv,setItem:Fv,removeItem:$v,clear:Ym,length:jv,key:Uv,keys:Bv,dropInstance:Hv},Wv=function(d,E){return d===E||typeof d=="number"&&typeof E=="number"&&isNaN(d)&&isNaN(E)},zv=function(d,E){for(var S=d.length,T=0;T<S;){if(Wv(d[T],E))return!0;T++}return!1},ih=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Ga={},oh={},to={INDEXEDDB:l,WEBSQL:Qd,LOCALSTORAGE:Vv},Gv=[to.INDEXEDDB._driver,to.WEBSQL._driver,to.LOCALSTORAGE._driver],Ec=["dropInstance"],Xc=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ec),Ly={description:"",driver:Gv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function By(d,E){d[E]=function(){var S=arguments;return d.ready().then(function(){return d[E].apply(d,S)})}}function zu(){for(var d=1;d<arguments.length;d++){var E=arguments[d];if(E)for(var S in E)E.hasOwnProperty(S)&&(ih(E[S])?arguments[0][S]=E[S].slice():arguments[0][S]=E[S])}return arguments[0]}var tb=function(){function d(E){f(this,d);for(var S in to)if(to.hasOwnProperty(S)){var T=to[S],x=T._driver;this[S]=x,Ga[x]||this.defineDriver(T)}this._defaultConfig=zu({},Ly),this._config=zu({},this._defaultConfig,E),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(E){if((typeof E>"u"?"undefined":u(E))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var S in E){if(S==="storeName"&&(E[S]=E[S].replace(/\W/g,"_")),S==="version"&&typeof E[S]!="number")return new Error("Database version must be a number.");this._config[S]=E[S]}return"driver"in E&&E.driver?this.setDriver(this._config.driver):!0}else return typeof E=="string"?this._config[E]:this._config},d.prototype.defineDriver=function(E,S,T){var x=new g(function(D,P){try{var U=E._driver,F=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!E._driver){P(F);return}for(var $=Xc.concat("_initStorage"),j=0,G=$.length;j<G;j++){var mt=$[j],he=!zv(Ec,mt);if((he||E[mt])&&typeof E[mt]!="function"){P(F);return}}var oe=function(){for(var ye=function(rb){return function(){var nb=new Error("Method "+rb+" is not implemented by the current driver"),dh=g.reject(nb);return y(dh,arguments[arguments.length-1]),dh}},We=0,Ku=Ec.length;We<Ku;We++){var Yu=Ec[We];E[Yu]||(E[Yu]=ye(Yu))}};oe();var Ie=function(ye){Ga[U]&&console.info("Redefining LocalForage driver: "+U),Ga[U]=E,oh[U]=ye,D()};"_support"in E?E._support&&typeof E._support=="function"?E._support().then(Ie,P):Ie(!!E._support):Ie(!0)}catch(ye){P(ye)}});return C(x,S,T),x},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(E,S,T){var x=Ga[E]?g.resolve(Ga[E]):g.reject(new Error("Driver not found."));return C(x,S,T),x},d.prototype.getSerializer=function(E){var S=g.resolve(Tc);return C(S,E),S},d.prototype.ready=function(E){var S=this,T=S._driverSet.then(function(){return S._ready===null&&(S._ready=S._initDriver()),S._ready});return C(T,E,E),T},d.prototype.setDriver=function(E,S,T){var x=this;ih(E)||(E=[E]);var D=this._getSupportedDrivers(E);function P(){x._config.driver=x.driver()}function U(j){return x._extend(j),P(),x._ready=x._initStorage(x._config),x._ready}function F(j){return function(){var G=0;function mt(){for(;G<j.length;){var he=j[G];return G++,x._dbInfo=null,x._ready=null,x.getDriver(he).then(U).catch(mt)}P();var oe=new Error("No available storage method found.");return x._driverSet=g.reject(oe),x._driverSet}return mt()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=$.then(function(){var j=D[0];return x._dbInfo=null,x._ready=null,x.getDriver(j).then(function(G){x._driver=G._driver,P(),x._wrapLibraryMethodsWithReady(),x._initDriver=F(D)})}).catch(function(){P();var j=new Error("No available storage method found.");return x._driverSet=g.reject(j),x._driverSet}),C(this._driverSet,S,T),this._driverSet},d.prototype.supports=function(E){return!!oh[E]},d.prototype._extend=function(E){zu(this,E)},d.prototype._getSupportedDrivers=function(E){for(var S=[],T=0,x=E.length;T<x;T++){var D=E[T];this.supports(D)&&S.push(D)}return S},d.prototype._wrapLibraryMethodsWithReady=function(){for(var E=0,S=Xc.length;E<S;E++)By(this,Xc[E])},d.prototype.createInstance=function(E){return new d(E)},d}(),eb=new tb;o.exports=eb},{3:3}]},{},[4])(4)})}),Sl=Vi(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),dd=Vi((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var c={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(c,o),function(u,f){var m=o.retries,h=o.retryDelay,v=o.retryOn;if(f&&f.retries!==void 0)if(n(f.retries))m=f.retries;else throw new i("retries must be a positive integer");if(f&&f.retryDelay!==void 0)if(n(f.retryDelay)||typeof f.retryDelay=="function")h=f.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(f&&f.retryOn)if(Array.isArray(f.retryOn)||typeof f.retryOn=="function")v=f.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(_,g){var y=function(O){var H=typeof Request<"u"&&u instanceof Request?u.clone():u;s(H,f).then(function(R){if(Array.isArray(v)&&v.indexOf(R.status)===-1)_(R);else if(typeof v=="function")try{return Promise.resolve(v(O,null,R)).then(function(k){k?C(O,null,R):_(R)}).catch(g)}catch(k){g(k)}else O<m?C(O,null,R):_(R)}).catch(function(R){if(typeof v=="function")try{Promise.resolve(v(O,R,null)).then(function(k){k?C(O,R,null):g(R)}).catch(function(k){g(k)})}catch(k){g(k)}else O<m?C(O,R,null):g(R)})};function C(O,H,R){var k=typeof h=="function"?h(O,H,R):h;setTimeout(function(){y(++O)},k)}y(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),ip="9.3.14",A=class Ju{static SDK_VERSION=ip;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static CTA_EVENT="letscooee:outbound:cta";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static{let e=Ju.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");Ju.SDK_VERSION_CODE=parseInt(e,10)}},Zt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}/dist/widget-sdk.min.css`},Rt=Qt(tn()),w=class{static log(...t){Rt.default.info(...t)}static debug(...t){Rt.default.debug(...t)}static error(...t){Rt.default.error(...t)}static warn(...t){Rt.default.warn(...t)}static info(...t){Rt.default.info(...t)}static trace(...t){Rt.default.trace(...t)}static configure(t=A.LOG_PREFIX){Rt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${A.SDK_VERSION}):`)}});let e=this.getDebugParam();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Rt.default.setLevel(Rt.default[localStorage.cooeeLogLevel]):Rt.default.setLevel(Zt.debug?Rt.default.TRACE:Rt.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let t=`
|
|
1
|
+
"use strict";(()=>{var sh=Object.create,xc=Object.defineProperty,ah=Object.defineProperties,ch=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertyNames,tp=Object.getOwnPropertySymbols,ph=Object.getPrototypeOf,np=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,rp=(t,e,r)=>e in t?xc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b=(t,e)=>{for(var r in e||={})np.call(e,r)&&rp(t,r,e[r]);if(tp)for(var r of tp(e))fh.call(e,r)&&rp(t,r,e[r]);return t},Z=(t,e)=>ah(t,lh(e)),Gi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),Vi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of uh(e))!np.call(t,i)&&i!==r&&xc(t,i,{get:()=>e[i],enumerable:!(n=ch(e,i))||n.enumerable});return t},Qt=(t,e,r)=>(r=t!=null?sh(ph(t)):{},mh(e||!t||!t.__esModule?xc(r,"default",{value:t,enumerable:!0}):r,t)),tn=Vi((t,e)=>{"use strict";(function(r){"use strict";var n={};n.VERSION="1.6.1";var i,s={},o=function(h,v){return function(){return v.apply(h,arguments)}},l=function(){var h=arguments,v=h[0],_,g;for(g=1;g<h.length;g++)for(_ in h[g])!(_ in v)&&h[g].hasOwnProperty(_)&&(v[_]=h[g][_]);return v},u=function(h,v){return{value:h,name:v}};n.TRACE=u(1,"TRACE"),n.DEBUG=u(2,"DEBUG"),n.INFO=u(3,"INFO"),n.TIME=u(4,"TIME"),n.WARN=u(5,"WARN"),n.ERROR=u(8,"ERROR"),n.OFF=u(99,"OFF");var f=function(h){this.context=h,this.setLevel(h.filterLevel),this.log=this.info};f.prototype={setLevel:function(h){h&&"value"in h&&(this.context.filterLevel=h)},getLevel:function(){return this.context.filterLevel},enabledFor:function(h){var v=this.context.filterLevel;return h.value>=v.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"start"])},timeEnd:function(h){typeof h=="string"&&h.length>0&&this.invoke(n.TIME,[h,"end"])},invoke:function(h,v){i&&this.enabledFor(h)&&i(v,l({level:h},this.context))}};var m=new f({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(m,m.enabledFor),h.trace=o(m,m.trace),h.debug=o(m,m.debug),h.time=o(m,m.time),h.timeEnd=o(m,m.timeEnd),h.info=o(m,m.info),h.warn=o(m,m.warn),h.error=o(m,m.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){m.setLevel(h);for(var v in s)s.hasOwnProperty(v)&&s[v].setLevel(h)},n.getLevel=function(){return m.getLevel()},n.get=function(h){return s[h]||(s[h]=new f(l({name:h},m.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(g,y){y.name&&g.unshift("["+y.name+"]")};var v={},_=function(g,y){Function.prototype.apply.call(g,console,y)};return typeof console>"u"?function(){}:function(g,y){g=Array.prototype.slice.call(g);var C=console.log,O;y.level===n.TIME?(O=(y.name?"["+y.name+"] ":"")+g[0],g[1]==="start"?console.time?console.time(O):v[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):_(C,[O+": "+(new Date().getTime()-v[O])+"ms"])):(y.level===n.WARN&&console.warn?C=console.warn:y.level===n.ERROR&&console.error?C=console.error:y.level===n.INFO&&console.info?C=console.info:y.level===n.DEBUG&&console.debug?C=console.debug:y.level===n.TRACE&&console.trace&&(C=console.trace),h.formatter(g,y),_(C,g))}},n.useDefaults=function(h){n.setLevel(h&&h.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(h))},n.setDefaults=n.useDefaults,typeof define=="function"&&define.amd?define(n):typeof e<"u"&&e.exports?e.exports=n:(n._prevLogger=r.Logger,n.noConflict=function(){return r.Logger=n._prevLogger,n},r.Logger=n)})(t)}),Mp=Vi((t,e)=>{"use strict";(function(r,n){"use strict";var i="1.0.40",s="",o="?",l="function",u="undefined",f="object",m="string",h="major",v="model",_="name",g="type",y="vendor",C="version",O="architecture",H="console",R="mobile",k="tablet",V="smarttv",Mt="wearable",fe="embedded",j=500,ct="Amazon",Y="Apple",at="ASUS",Xt="BlackBerry",me="Browser",de="Chrome",xe="Edge",be="Firefox",Ut="Google",De="Huawei",ht="LG",Q="Microsoft",we="Motorola",cr="Opera",jr="Samsung",je="Sharp",en="Sony",Hn="Xiaomi",kn="Zebra",Hi="Facebook",Wi="Chromium OS",ji="Mac OS",Mn=" Browser",Be=function(z,dt){var J={};for(var se in z)dt[se]&&dt[se].length%2===0?J[se]=dt[se].concat(z[se]):J[se]=z[se];return J},$r=function(z){for(var dt={},J=0;J<z.length;J++)dt[z[J].toUpperCase()]=z[J];return dt},is=function(z,dt){return typeof z===m?a(dt).indexOf(a(z))!==-1:!1},a=function(z){return z.toLowerCase()},c=function(z){return typeof z===m?z.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(z,dt){if(typeof z===m)return z=z.replace(/^\s\s*/,s),typeof dt===u?z:z.substring(0,j)},I=function(z,dt){for(var J=0,se,He,Fe,re,X,Ve;J<dt.length&&!X;){var Ls=dt[J],Yo=dt[J+1];for(se=He=0;se<Ls.length&&!X&&Ls[se];)if(X=Ls[se++].exec(z),X)for(Fe=0;Fe<Yo.length;Fe++)Ve=X[++He],re=Yo[Fe],typeof re===f&&re.length>0?re.length===2?typeof re[1]==l?this[re[0]]=re[1].call(this,Ve):this[re[0]]=re[1]:re.length===3?typeof re[1]===l&&!(re[1].exec&&re[1].test)?this[re[0]]=Ve?re[1].call(this,Ve,re[2]):n:this[re[0]]=Ve?Ve.replace(re[1],re[2]):n:re.length===4&&(this[re[0]]=Ve?re[3].call(this,Ve.replace(re[1],re[2])):n):this[re]=Ve||n;J+=2}},N=function(z,dt){for(var J in dt)if(typeof dt[J]===f&&dt[J].length>0){for(var se=0;se<dt[J].length;se++)if(is(dt[J][se],z))return J===o?n:J}else if(is(dt[J],z))return J===o?n:J;return dt.hasOwnProperty("*")?dt["*"]:z},L={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},W={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"},te={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[C,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[C,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,C],[/opios[\/ ]+([\w\.]+)/i],[C,[_,cr+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[C,[_,cr+" GX"]],[/\bopr\/([\w\.]+)/i],[C,[_,cr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[C,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[C,[_,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[_,C],[/quark(?:pc)?\/([-\w\.]+)/i],[C,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[C,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[C,[_,"UC"+me]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[C,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[C,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[C,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[C,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[C,[_,"Smart Lenovo "+me]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+me],C],[/\bfocus\/([\w\.]+)/i],[C,[_,be+" Focus"]],[/\bopt\/([\w\.]+)/i],[C,[_,cr+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[C,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[C,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[C,[_,cr+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[C,[_,"MIUI"+Mn]],[/fxios\/([\w\.-]+)/i],[C,[_,be]],[/\bqihoobrowser\/?([\w\.]*)/i],[C,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],C],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Mn],C],[/samsungbrowser\/([\w\.]+)/i],[C,[_,jr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[C,[_,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,"Sogou Mobile"],C],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,C],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[C,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Hi],C],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[_,C],[/\bgsa\/([\w\.]+) .*safari\//i],[C,[_,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[C,[_,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[C,[_,de+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,de+" WebView"],C],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[C,[_,"Android "+me]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,C],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[C,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[C,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[C,N,L]],[/(webkit|khtml)\/([\w\.]+)/i],[_,C],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],C],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,C],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[C,[_,be+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[_,[C,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[C,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[O,"amd64"]],[/(ia32(?=;))/i],[[O,a]],[/((?:i[346]|x)86)[;\)]/i],[[O,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[O,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[O,"armhf"]],[/windows (ce|mobile); ppc;/i],[[O,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[O,/ower/,s,a]],[/(sun4\w)[;\)]/i],[[O,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[O,a]]],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],[v,[y,jr],[g,k]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[v,[y,jr],[g,R]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[y,Y],[g,R]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[y,Y],[g,k]],[/(macintosh);/i],[v,[y,Y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[y,je],[g,R]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[y,"Honor"],[g,R]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[y,De],[g,k]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[y,De],[g,R]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[g,R]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[g,k]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[v,[y,"OPPO"],[g,R]],[/\b(opd2\d{3}a?) bui/i],[v,[y,"OPPO"],[g,k]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[y,"Vivo"],[g,R]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[y,"Realme"],[g,R]],[/\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],[v,[y,we],[g,R]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[y,we],[g,k]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[y,ht],[g,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[y,ht],[g,R]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[y,"Lenovo"],[g,k]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[y,"Nokia"],[g,R]],[/(pixel c)\b/i],[v,[y,Ut],[g,k]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[y,Ut],[g,R]],[/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],[v,[y,en],[g,R]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[y,en],[g,k]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[y,"OnePlus"],[g,R]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[y,ct],[g,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[y,ct],[g,R]],[/(playbook);[-\w\),; ]+(rim)/i],[v,y,[g,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[y,Xt],[g,R]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[y,at],[g,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[y,at],[g,R]],[/(nexus 9)/i],[v,[y,"HTC"],[g,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[v,/_/g," "],[g,R]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[v,[y,"TCL"],[g,k]],[/(itel) ((\w+))/i],[[y,a],v,[g,N,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[y,"Acer"],[g,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[y,"Meizu"],[g,R]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[y,"Ulefone"],[g,R]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[y,"Energizer"],[g,R]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[y,"Cat"],[g,R]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[y,"Smartfren"],[g,R]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[y,"Nothing"],[g,R]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[y,v,[g,R]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[y,v,[g,k]],[/(surface duo)/i],[v,[y,Q],[g,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[y,"Fairphone"],[g,R]],[/(u304aa)/i],[v,[y,"AT&T"],[g,R]],[/\bsie-(\w*)/i],[v,[y,"Siemens"],[g,R]],[/\b(rct\w+) b/i],[v,[y,"RCA"],[g,k]],[/\b(venue[\d ]{2,7}) b/i],[v,[y,"Dell"],[g,k]],[/\b(q(?:mv|ta)\w+) b/i],[v,[y,"Verizon"],[g,k]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[y,"Barnes & Noble"],[g,k]],[/\b(tm\d{3}\w+) b/i],[v,[y,"NuVision"],[g,k]],[/\b(k88) b/i],[v,[y,"ZTE"],[g,k]],[/\b(nx\d{3}j) b/i],[v,[y,"ZTE"],[g,R]],[/\b(gen\d{3}) b.+49h/i],[v,[y,"Swiss"],[g,R]],[/\b(zur\d{3}) b/i],[v,[y,"Swiss"],[g,k]],[/\b((zeki)?tb.*\b) b/i],[v,[y,"Zeki"],[g,k]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],v,[g,k]],[/\b(ns-?\w{0,9}) b/i],[v,[y,"Insignia"],[g,k]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[y,"NextBook"],[g,k]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],v,[g,R]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],v,[g,R]],[/\b(ph-1) /i],[v,[y,"Essential"],[g,R]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[y,"Envizen"],[g,k]],[/\b(trio[-\w\. ]+) b/i],[v,[y,"MachSpeed"],[g,k]],[/\btu_(1491) b/i],[v,[y,"Rotor"],[g,k]],[/(shield[\w ]+) b/i],[v,[y,"Nvidia"],[g,k]],[/(sprint) (\w+)/i],[y,v,[g,R]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[y,Q],[g,R]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[y,kn],[g,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[y,kn],[g,R]],[/smart-tv.+(samsung)/i],[y,[g,V]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[y,jr],[g,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,ht],[g,V]],[/(apple) ?tv/i],[y,[v,Y+" TV"],[g,V]],[/crkey/i],[[v,de+"cast"],[y,Ut],[g,V]],[/droid.+aft(\w+)( bui|\))/i],[v,[y,ct],[g,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[y,je],[g,V]],[/(bravia[\w ]+)( bui|\))/i],[v,[y,en],[g,V]],[/(mitv-\w{5}) bui/i],[v,[y,Hn],[g,V]],[/Hbbtv.*(technisat) (.*);/i],[y,v,[g,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,p],[v,p],[g,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[g,V]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,v,[g,H]],[/droid.+; (shield) bui/i],[v,[y,"Nvidia"],[g,H]],[/(playstation [345portablevi]+)/i],[v,[y,en],[g,H]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[y,Q],[g,H]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[y,jr],[g,Mt]],[/((pebble))app/i],[y,v,[g,Mt]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[y,Y],[g,Mt]],[/droid.+; (glass) \d/i],[v,[y,Ut],[g,Mt]],[/droid.+; (wt63?0{2,3})\)/i],[v,[y,kn],[g,Mt]],[/droid.+; (glass) \d/i],[v,[y,Ut],[g,Mt]],[/(pico) (4|neo3(?: link|pro)?)/i],[y,v,[g,Mt]],[/; (quest( \d| pro)?)/i],[v,[y,Hi],[g,Mt]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[g,fe]],[/(aeobc)\b/i],[v,[y,ct],[g,fe]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[g,R]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[g,k]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,R]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[C,[_,xe+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[_,C],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[C,[_,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[_,C],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[C,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,C],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[_,[C,N,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[C,N,W],[_,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[C,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,ji],[C,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[C,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,C],[/\(bb(10);/i],[C,[_,Xt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[C,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[C,[_,be+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[C,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[C,[_,"watchOS"]],[/crkey\/([\d\.]+)/i],[C,[_,de+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,Wi],C],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[_,C],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],C],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,C]]},Tt=function(z,dt){if(typeof z===f&&(dt=z,z=n),!(this instanceof Tt))return new Tt(z,dt).getResult();var J=typeof r!==u&&r.navigator?r.navigator:n,se=z||(J&&J.userAgent?J.userAgent:s),He=J&&J.userAgentData?J.userAgentData:n,Fe=dt?Be(te,dt):te,re=J&&J.userAgent==se;return this.getBrowser=function(){var X={};return X[_]=n,X[C]=n,I.call(X,se,Fe.browser),X[h]=c(X[C]),re&&J&&J.brave&&typeof J.brave.isBrave==l&&(X[_]="Brave"),X},this.getCPU=function(){var X={};return X[O]=n,I.call(X,se,Fe.cpu),X},this.getDevice=function(){var X={};return X[y]=n,X[v]=n,X[g]=n,I.call(X,se,Fe.device),re&&!X[g]&&He&&He.mobile&&(X[g]=R),re&&X[v]=="Macintosh"&&J&&typeof J.standalone!==u&&J.maxTouchPoints&&J.maxTouchPoints>2&&(X[v]="iPad",X[g]=k),X},this.getEngine=function(){var X={};return X[_]=n,X[C]=n,I.call(X,se,Fe.engine),X},this.getOS=function(){var X={};return X[_]=n,X[C]=n,I.call(X,se,Fe.os),re&&!X[_]&&He&&He.platform&&He.platform!="Unknown"&&(X[_]=He.platform.replace(/chrome os/i,Wi).replace(/macos/i,ji)),X},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 se},this.setUA=function(X){return se=typeof X===m&&X.length>j?p(X,j):X,this},this.setUA(se),this};Tt.VERSION=i,Tt.BROWSER=$r([_,C,h]),Tt.CPU=$r([O]),Tt.DEVICE=$r([v,y,g,H,R,V,k,Mt,fe]),Tt.ENGINE=Tt.OS=$r([_,C]),typeof t!==u?(typeof e!==u&&e.exports&&(t=e.exports=Tt),t.UAParser=Tt):typeof define===l&&define.amd?define(function(){return Tt}):typeof r!==u&&(r.UAParser=Tt);var Dt=typeof r!==u&&(r.jQuery||r.Zepto);if(Dt&&!Dt.ua){var ce=new Tt;Dt.ua=ce.getResult(),Dt.ua.get=function(){return ce.getUA()},Dt.ua.set=function(z){ce.setUA(z);var dt=ce.getResult();for(var J in dt)Dt.ua[J]=dt[J]}}})(typeof window=="object"?window:t)}),Hp=Vi((t,e)=>{"use strict";(function(r){if(typeof t=="object"&&typeof e<"u")e.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.localforage=r()}})(function(){var r,n,i;return function s(o,l,u){function f(v,_){if(!l[v]){if(!o[v]){var g=typeof Gi=="function"&&Gi;if(!_&&g)return g(v,!0);if(m)return m(v,!0);var y=new Error("Cannot find module '"+v+"'");throw y.code="MODULE_NOT_FOUND",y}var C=l[v]={exports:{}};o[v][0].call(C.exports,function(O){var H=o[v][1][O];return f(H||O)},C,C.exports,s,o,l,u)}return l[v].exports}for(var m=typeof Gi=="function"&&Gi,h=0;h<u.length;h++)f(u[h]);return f}({1:[function(s,o,l){(function(u){"use strict";var f=u.MutationObserver||u.WebKitMutationObserver,m;if(f){var h=0,v=new f(O),_=u.document.createTextNode("");v.observe(_,{characterData:!0}),m=function(){_.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var g=new u.MessageChannel;g.port1.onmessage=O,m=function(){g.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?m=function(){var R=u.document.createElement("script");R.onreadystatechange=function(){O(),R.onreadystatechange=null,R.parentNode.removeChild(R),R=null},u.document.documentElement.appendChild(R)}:m=function(){setTimeout(O,0)};var y,C=[];function O(){y=!0;for(var R,k,V=C.length;V;){for(k=C,C=[],R=-1;++R<V;)k[R]();V=C.length}y=!1}o.exports=H;function H(R){C.push(R)===1&&!y&&m()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(s,o,l){"use strict";var u=s(1);function f(){}var m={},h=["REJECTED"],v=["FULFILLED"],_=["PENDING"];o.exports=g;function g(j){if(typeof j!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,j!==f&&H(this,j)}g.prototype.catch=function(j){return this.then(null,j)},g.prototype.then=function(j,ct){if(typeof j!="function"&&this.state===v||typeof ct!="function"&&this.state===h)return this;var Y=new this.constructor(f);if(this.state!==_){var at=this.state===v?j:ct;C(Y,at,this.outcome)}else this.queue.push(new y(Y,j,ct));return Y};function y(j,ct,Y){this.promise=j,typeof ct=="function"&&(this.onFulfilled=ct,this.callFulfilled=this.otherCallFulfilled),typeof Y=="function"&&(this.onRejected=Y,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(j){m.resolve(this.promise,j)},y.prototype.otherCallFulfilled=function(j){C(this.promise,this.onFulfilled,j)},y.prototype.callRejected=function(j){m.reject(this.promise,j)},y.prototype.otherCallRejected=function(j){C(this.promise,this.onRejected,j)};function C(j,ct,Y){u(function(){var at;try{at=ct(Y)}catch(Xt){return m.reject(j,Xt)}at===j?m.reject(j,new TypeError("Cannot resolve promise with itself")):m.resolve(j,at)})}m.resolve=function(j,ct){var Y=R(O,ct);if(Y.status==="error")return m.reject(j,Y.value);var at=Y.value;if(at)H(j,at);else{j.state=v,j.outcome=ct;for(var Xt=-1,me=j.queue.length;++Xt<me;)j.queue[Xt].callFulfilled(ct)}return j},m.reject=function(j,ct){j.state=h,j.outcome=ct;for(var Y=-1,at=j.queue.length;++Y<at;)j.queue[Y].callRejected(ct);return j};function O(j){var ct=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof ct=="function")return function(){ct.apply(j,arguments)}}function H(j,ct){var Y=!1;function at(xe){Y||(Y=!0,m.reject(j,xe))}function Xt(xe){Y||(Y=!0,m.resolve(j,xe))}function me(){ct(Xt,at)}var de=R(me);de.status==="error"&&at(de.value)}function R(j,ct){var Y={};try{Y.value=j(ct),Y.status="success"}catch(at){Y.status="error",Y.value=at}return Y}g.resolve=k;function k(j){return j instanceof this?j:m.resolve(new this(f),j)}g.reject=V;function V(j){var ct=new this(f);return m.reject(ct,j)}g.all=Mt;function Mt(j){var ct=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,at=!1;if(!Y)return this.resolve([]);for(var Xt=new Array(Y),me=0,de=-1,xe=new this(f);++de<Y;)be(j[de],de);return xe;function be(Ut,De){ct.resolve(Ut).then(ht,function(Q){at||(at=!0,m.reject(xe,Q))});function ht(Q){Xt[De]=Q,++me===Y&&!at&&(at=!0,m.resolve(xe,Xt))}}}g.race=fe;function fe(j){var ct=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,at=!1;if(!Y)return this.resolve([]);for(var Xt=-1,me=new this(f);++Xt<Y;)de(j[Xt]);return me;function de(xe){ct.resolve(xe).then(function(be){at||(at=!0,m.resolve(me,be))},function(be){at||(at=!0,m.reject(me,be))})}}},{1:1}],3:[function(s,o,l){(function(u){"use strict";typeof u.Promise!="function"&&(u.Promise=s(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(s,o,l){"use strict";var u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function f(d,E){if(!(d instanceof E))throw new TypeError("Cannot call a class as a function")}function m(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=m();function v(){try{if(!h||!h.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),E=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||E)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function _(d,E){d=d||[],E=E||{};try{return new Blob(d,E)}catch(D){if(D.name!=="TypeError")throw D;for(var S=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new S,x=0;x<d.length;x+=1)T.append(d[x]);return T.getBlob(E.type)}}typeof Promise>"u"&&s(3);var g=Promise;function y(d,E){E&&d.then(function(S){E(null,S)},function(S){E(S)})}function C(d,E,S){typeof E=="function"&&d.then(E),typeof S=="function"&&d.catch(S)}function O(d){return typeof d!="string"&&(console.warn(d+" used as a key, but it is not a string."),d=String(d)),d}function H(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var R="local-forage-detect-blob-support",k=void 0,V={},Mt=Object.prototype.toString,fe="readonly",j="readwrite";function ct(d){for(var E=d.length,S=new ArrayBuffer(E),T=new Uint8Array(S),x=0;x<E;x++)T[x]=d.charCodeAt(x);return S}function Y(d){return new g(function(E){var S=d.transaction(R,j),T=_([""]);S.objectStore(R).put(T,"key"),S.onabort=function(x){x.preventDefault(),x.stopPropagation(),E(!1)},S.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\/(\d+)/),D=navigator.userAgent.match(/Edge\//);E(D||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function at(d){return typeof k=="boolean"?g.resolve(k):Y(d).then(function(E){return k=E,k})}function Xt(d){var E=V[d.name],S={};S.promise=new g(function(T,x){S.resolve=T,S.reject=x}),E.deferredOperations.push(S),E.dbReady?E.dbReady=E.dbReady.then(function(){return S.promise}):E.dbReady=S.promise}function me(d){var E=V[d.name],S=E.deferredOperations.pop();if(S)return S.resolve(),S.promise}function de(d,E){var S=V[d.name],T=S.deferredOperations.pop();if(T)return T.reject(E),T.promise}function xe(d,E){return new g(function(S,T){if(V[d.name]=V[d.name]||en(),d.db)if(E)Xt(d),d.db.close();else return S(d.db);var x=[d.name];E&&x.push(d.version);var D=h.open.apply(h,x);E&&(D.onupgradeneeded=function(P){var U=D.result;try{U.createObjectStore(d.storeName),P.oldVersion<=1&&U.createObjectStore(R)}catch(F){if(F.name==="ConstraintError")console.warn('The database "'+d.name+'" has been upgraded from version '+P.oldVersion+" to version "+P.newVersion+', but the storage "'+d.storeName+'" already exists.');else throw F}}),D.onerror=function(P){P.preventDefault(),T(D.error)},D.onsuccess=function(){var P=D.result;P.onversionchange=function(U){U.target.close()},S(P),me(d)}})}function be(d){return xe(d,!1)}function Ut(d){return xe(d,!0)}function De(d,E){if(!d.db)return!0;var S=!d.db.objectStoreNames.contains(d.storeName),T=d.version<d.db.version,x=d.version>d.db.version;if(T&&(d.version!==E&&console.warn('The database "'+d.name+`" can't be downgraded from version `+d.db.version+" to version "+d.version+"."),d.version=d.db.version),x||S){if(S){var D=d.db.version+1;D>d.version&&(d.version=D)}return!0}return!1}function ht(d){return new g(function(E,S){var T=new FileReader;T.onerror=S,T.onloadend=function(x){var D=btoa(x.target.result||"");E({__local_forage_encoded_blob:!0,data:D,type:d.type})},T.readAsBinaryString(d)})}function Q(d){var E=ct(atob(d.data));return _([E],{type:d.type})}function we(d){return d&&d.__local_forage_encoded_blob}function cr(d){var E=this,S=E._initReady().then(function(){var T=V[E._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(S,d,d),S}function jr(d){Xt(d);for(var E=V[d.name],S=E.forages,T=0;T<S.length;T++){var x=S[T];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return d.db=null,be(d).then(function(D){return d.db=D,De(d)?Ut(d):D}).then(function(D){d.db=E.db=D;for(var P=0;P<S.length;P++)S[P]._dbInfo.db=D}).catch(function(D){throw de(d,D),D})}function je(d,E,S,T){T===void 0&&(T=1);try{var x=d.db.transaction(d.storeName,E);S(null,x)}catch(D){if(T>0&&(!d.db||D.name==="InvalidStateError"||D.name==="NotFoundError"))return g.resolve().then(function(){if(!d.db||D.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Ut(d)}).then(function(){return jr(d).then(function(){je(d,E,S,T-1)})}).catch(S);S(D)}}function en(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Hn(d){var E=this,S={db:null};if(d)for(var T in d)S[T]=d[T];var x=V[S.name];x||(x=en(),V[S.name]=x),x.forages.push(E),E._initReady||(E._initReady=E.ready,E.ready=cr);var D=[];function P(){return g.resolve()}for(var U=0;U<x.forages.length;U++){var F=x.forages[U];F!==E&&D.push(F._initReady().catch(P))}var $=x.forages.slice(0);return g.all(D).then(function(){return S.db=x.db,be(S)}).then(function(B){return S.db=B,De(S,E._defaultConfig.version)?Ut(S):B}).then(function(B){S.db=x.db=B,E._dbInfo=S;for(var G=0;G<$.length;G++){var gt=$[G];gt!==E&&(gt._dbInfo.db=S.db,gt._dbInfo.version=S.version)}})}function kn(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){je(S._dbInfo,fe,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=F.get(d);$.onsuccess=function(){var B=$.result;B===void 0&&(B=null),we(B)&&(B=Q(B)),x(B)},$.onerror=function(){D($.error)}}catch(B){D(B)}})}).catch(D)});return y(T,E),T}function Hi(d,E){var S=this,T=new g(function(x,D){S.ready().then(function(){je(S._dbInfo,fe,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=F.openCursor(),B=1;$.onsuccess=function(){var G=$.result;if(G){var gt=G.value;we(gt)&&(gt=Q(gt));var he=d(gt,G.key,B++);he!==void 0?x(he):G.continue()}else x()},$.onerror=function(){D($.error)}}catch(G){D(G)}})}).catch(D)});return y(T,E),T}function Wi(d,E,S){var T=this;d=O(d);var x=new g(function(D,P){var U;T.ready().then(function(){return U=T._dbInfo,Mt.call(E)==="[object Blob]"?at(U.db).then(function(F){return F?E:ht(E)}):E}).then(function(F){je(T._dbInfo,j,function($,B){if($)return P($);try{var G=B.objectStore(T._dbInfo.storeName);F===null&&(F=void 0);var gt=G.put(F,d);B.oncomplete=function(){F===void 0&&(F=null),D(F)},B.onabort=B.onerror=function(){var he=gt.error?gt.error:gt.transaction.error;P(he)}}catch(he){P(he)}})}).catch(P)});return y(x,S),x}function ji(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){je(S._dbInfo,j,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=F.delete(d);U.oncomplete=function(){x()},U.onerror=function(){D($.error)},U.onabort=function(){var B=$.error?$.error:$.transaction.error;D(B)}}catch(B){D(B)}})}).catch(D)});return y(T,E),T}function Mn(d){var E=this,S=new g(function(T,x){E.ready().then(function(){je(E._dbInfo,j,function(D,P){if(D)return x(D);try{var U=P.objectStore(E._dbInfo.storeName),F=U.clear();P.oncomplete=function(){T()},P.onabort=P.onerror=function(){var $=F.error?F.error:F.transaction.error;x($)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function Be(d){var E=this,S=new g(function(T,x){E.ready().then(function(){je(E._dbInfo,fe,function(D,P){if(D)return x(D);try{var U=P.objectStore(E._dbInfo.storeName),F=U.count();F.onsuccess=function(){T(F.result)},F.onerror=function(){x(F.error)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function $r(d,E){var S=this,T=new g(function(x,D){if(d<0){x(null);return}S.ready().then(function(){je(S._dbInfo,fe,function(P,U){if(P)return D(P);try{var F=U.objectStore(S._dbInfo.storeName),$=!1,B=F.openKeyCursor();B.onsuccess=function(){var G=B.result;if(!G){x(null);return}d===0||$?x(G.key):($=!0,G.advance(d))},B.onerror=function(){D(B.error)}}catch(G){D(G)}})}).catch(D)});return y(T,E),T}function is(d){var E=this,S=new g(function(T,x){E.ready().then(function(){je(E._dbInfo,fe,function(D,P){if(D)return x(D);try{var U=P.objectStore(E._dbInfo.storeName),F=U.openKeyCursor(),$=[];F.onsuccess=function(){var B=F.result;if(!B){T($);return}$.push(B.key),B.continue()},F.onerror=function(){x(F.error)}}catch(B){x(B)}})}).catch(x)});return y(S,d),S}function a(d,E){E=H.apply(this,arguments);var S=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||S.name,d.storeName=d.storeName||S.storeName);var T=this,x;if(!d.name)x=g.reject("Invalid arguments");else{var D=d.name===S.name&&T._dbInfo.db,P=D?g.resolve(T._dbInfo.db):be(d).then(function(U){var F=V[d.name],$=F.forages;F.db=U;for(var B=0;B<$.length;B++)$[B]._dbInfo.db=U;return U});d.storeName?x=P.then(function(U){if(U.objectStoreNames.contains(d.storeName)){var F=U.version+1;Xt(d);var $=V[d.name],B=$.forages;U.close();for(var G=0;G<B.length;G++){var gt=B[G];gt._dbInfo.db=null,gt._dbInfo.version=F}var he=new g(function(oe,Ie){var ye=h.open(d.name,F);ye.onerror=function(We){var Ku=ye.result;Ku.close(),Ie(We)},ye.onupgradeneeded=function(){var We=ye.result;We.deleteObjectStore(d.storeName)},ye.onsuccess=function(){var We=ye.result;We.close(),oe(We)}});return he.then(function(oe){$.db=oe;for(var Ie=0;Ie<B.length;Ie++){var ye=B[Ie];ye._dbInfo.db=oe,me(ye._dbInfo)}}).catch(function(oe){throw(de(d,oe)||g.resolve()).catch(function(){}),oe})}}):x=P.then(function(U){Xt(d);var F=V[d.name],$=F.forages;U.close();for(var B=0;B<$.length;B++){var G=$[B];G._dbInfo.db=null}var gt=new g(function(he,oe){var Ie=h.deleteDatabase(d.name);Ie.onerror=function(){var ye=Ie.result;ye&&ye.close(),oe(Ie.error)},Ie.onblocked=function(){console.warn('dropInstance blocked for database "'+d.name+'" until all open connections are closed')},Ie.onsuccess=function(){var ye=Ie.result;ye&&ye.close(),he(ye)}});return gt.then(function(he){F.db=he;for(var oe=0;oe<$.length;oe++){var Ie=$[oe];me(Ie._dbInfo)}}).catch(function(he){throw(de(d,he)||g.resolve()).catch(function(){}),he})})}return y(x,E),x}var c={_driver:"asyncStorage",_initStorage:Hn,_support:v(),iterate:Hi,getItem:kn,setItem:Wi,removeItem:ji,clear:Mn,length:Be,key:$r,keys:is,dropInstance:a};function p(){return typeof openDatabase=="function"}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="~~local_forage_type~",L=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",te=W.length,Tt="arbf",Dt="blob",ce="si08",z="ui08",dt="uic8",J="si16",se="si32",He="ur16",Fe="ui32",re="fl32",X="fl64",Ve=te+Tt.length,Ls=Object.prototype.toString;function Yo(d){var E=d.length*.75,S=d.length,T,x=0,D,P,U,F;d[d.length-1]==="="&&(E--,d[d.length-2]==="="&&E--);var $=new ArrayBuffer(E),B=new Uint8Array($);for(T=0;T<S;T+=4)D=I.indexOf(d[T]),P=I.indexOf(d[T+1]),U=I.indexOf(d[T+2]),F=I.indexOf(d[T+3]),B[x++]=D<<2|P>>4,B[x++]=(P&15)<<4|U>>2,B[x++]=(U&3)<<6|F&63;return $}function Ic(d){var E=new Uint8Array(d),S="",T;for(T=0;T<E.length;T+=3)S+=I[E[T]>>2],S+=I[(E[T]&3)<<4|E[T+1]>>4],S+=I[(E[T+1]&15)<<2|E[T+2]>>6],S+=I[E[T+2]&63];return E.length%3===2?S=S.substring(0,S.length-1)+"=":E.length%3===1&&(S=S.substring(0,S.length-2)+"=="),S}function $d(d,E){var S="";if(d&&(S=Ls.call(d)),d&&(S==="[object ArrayBuffer]"||d.buffer&&Ls.call(d.buffer)==="[object ArrayBuffer]")){var T,x=W;d instanceof ArrayBuffer?(T=d,x+=Tt):(T=d.buffer,S==="[object Int8Array]"?x+=ce:S==="[object Uint8Array]"?x+=z:S==="[object Uint8ClampedArray]"?x+=dt:S==="[object Int16Array]"?x+=J:S==="[object Uint16Array]"?x+=He:S==="[object Int32Array]"?x+=se:S==="[object Uint32Array]"?x+=Fe:S==="[object Float32Array]"?x+=re:S==="[object Float64Array]"?x+=X:E(new Error("Failed to get type for BinaryArray"))),E(x+Ic(T))}else if(S==="[object Blob]"){var D=new FileReader;D.onload=function(){var P=N+d.type+"~"+Ic(this.result);E(W+Dt+P)},D.readAsArrayBuffer(d)}else try{E(JSON.stringify(d))}catch(P){console.error("Couldn't convert value into a JSON string: ",d),E(null,P)}}function Fd(d){if(d.substring(0,te)!==W)return JSON.parse(d);var E=d.substring(Ve),S=d.substring(te,Ve),T;if(S===Dt&&L.test(E)){var x=E.match(L);T=x[1],E=E.substring(x[0].length)}var D=Yo(E);switch(S){case Tt:return D;case Dt:return _([D],{type:T});case ce:return new Int8Array(D);case z:return new Uint8Array(D);case dt:return new Uint8ClampedArray(D);case J:return new Int16Array(D);case He:return new Uint16Array(D);case se:return new Int32Array(D);case Fe:return new Uint32Array(D);case re:return new Float32Array(D);case X:return new Float64Array(D);default:throw new Error("Unkown type: "+S)}}var Tc={serialize:$d,deserialize:Fd,stringToBuffer:Yo,bufferToString:Ic};function eh(d,E,S,T){d.executeSql("CREATE TABLE IF NOT EXISTS "+E.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],S,T)}function Hd(d){var E=this,S={db:null};if(d)for(var T in d)S[T]=typeof d[T]!="string"?d[T].toString():d[T];var x=new g(function(D,P){try{S.db=openDatabase(S.name,String(S.version),S.description,S.size)}catch(U){return P(U)}S.db.transaction(function(U){eh(U,S,function(){E._dbInfo=S,D()},function(F,$){P($)})},P)});return S.serializer=Tc,x}function Fn(d,E,S,T,x,D){d.executeSql(S,T,x,function(P,U){U.code===U.SYNTAX_ERR?P.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[E.storeName],function(F,$){$.rows.length?D(F,U):eh(F,E,function(){F.executeSql(S,T,x,D)},D)},D):D(P,U)},D)}function Vd(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"SELECT * FROM "+P.storeName+" WHERE key = ? LIMIT 1",[d],function(F,$){var B=$.rows.length?$.rows.item(0).value:null;B&&(B=P.serializer.deserialize(B)),x(B)},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function qd(d,E){var S=this,T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"SELECT * FROM "+P.storeName,[],function(F,$){for(var B=$.rows,G=B.length,gt=0;gt<G;gt++){var he=B.item(gt),oe=he.value;if(oe&&(oe=P.serializer.deserialize(oe)),oe=d(oe,he.key,gt+1),oe!==void 0){x(oe);return}}x()},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function rh(d,E,S,T){var x=this;d=O(d);var D=new g(function(P,U){x.ready().then(function(){E===void 0&&(E=null);var F=E,$=x._dbInfo;$.serializer.serialize(E,function(B,G){G?U(G):$.db.transaction(function(gt){Fn(gt,$,"INSERT OR REPLACE INTO "+$.storeName+" (key, value) VALUES (?, ?)",[d,B],function(){P(F)},function(he,oe){U(oe)})},function(gt){if(gt.code===gt.QUOTA_ERR){if(T>0){P(rh.apply(x,[d,F,S,T-1]));return}U(gt)}})})}).catch(U)});return y(D,S),D}function Wd(d,E,S){return rh.apply(this,[d,E,S,1])}function zd(d,E){var S=this;d=O(d);var T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"DELETE FROM "+P.storeName+" WHERE key = ?",[d],function(){x()},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function Gd(d){var E=this,S=new g(function(T,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"DELETE FROM "+D.storeName,[],function(){T()},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Kd(d){var E=this,S=new g(function(T,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"SELECT COUNT(key) as c FROM "+D.storeName,[],function(U,F){var $=F.rows.item(0).c;T($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Yd(d,E){var S=this,T=new g(function(x,D){S.ready().then(function(){var P=S._dbInfo;P.db.transaction(function(U){Fn(U,P,"SELECT key FROM "+P.storeName+" WHERE id = ? LIMIT 1",[d+1],function(F,$){var B=$.rows.length?$.rows.item(0).key:null;x(B)},function(F,$){D($)})})}).catch(D)});return y(T,E),T}function Jd(d){var E=this,S=new g(function(T,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"SELECT key FROM "+D.storeName,[],function(U,F){for(var $=[],B=0;B<F.rows.length;B++)$.push(F.rows.item(B).key);T($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Xd(d){return new g(function(E,S){d.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(x,D){for(var P=[],U=0;U<D.rows.length;U++)P.push(D.rows.item(U).name);E({db:d,storeNames:P})},function(x,D){S(D)})},function(T){S(T)})})}function Zd(d,E){E=H.apply(this,arguments);var S=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||S.name,d.storeName=d.storeName||S.storeName);var T=this,x;return d.name?x=new g(function(D){var P;d.name===S.name?P=T._dbInfo.db:P=openDatabase(d.name,"","",0),d.storeName?D({db:P,storeNames:[d.storeName]}):D(Xd(P))}).then(function(D){return new g(function(P,U){D.db.transaction(function(F){function $(he){return new g(function(oe,Ie){F.executeSql("DROP TABLE IF EXISTS "+he,[],function(){oe()},function(ye,We){Ie(We)})})}for(var B=[],G=0,gt=D.storeNames.length;G<gt;G++)B.push($(D.storeNames[G]));g.all(B).then(function(){P()}).catch(function(he){U(he)})},function(F){U(F)})})}):x=g.reject("Invalid arguments"),y(x,E),x}var Qd={_driver:"webSQLStorage",_initStorage:Hd,_support:p(),iterate:qd,getItem:Vd,setItem:Wd,removeItem:zd,clear:Gd,length:Kd,key:Yd,keys:Jd,dropInstance:Zd};function Hg(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function nh(d,E){var S=d.name+"/";return d.storeName!==E.storeName&&(S+=d.storeName+"/"),S}function Lm(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function qm(){return!Lm()||localStorage.length>0}function zm(d){var E=this,S={};if(d)for(var T in d)S[T]=d[T];return S.keyPrefix=nh(d,E._defaultConfig),qm()?(E._dbInfo=S,S.serializer=Tc,g.resolve()):g.reject()}function Ym(d){var E=this,S=E.ready().then(function(){for(var T=E._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var D=localStorage.key(x);D.indexOf(T)===0&&localStorage.removeItem(D)}});return y(S,d),S}function kv(d,E){var S=this;d=O(d);var T=S.ready().then(function(){var x=S._dbInfo,D=localStorage.getItem(x.keyPrefix+d);return D&&(D=x.serializer.deserialize(D)),D});return y(T,E),T}function Mv(d,E){var S=this,T=S.ready().then(function(){for(var x=S._dbInfo,D=x.keyPrefix,P=D.length,U=localStorage.length,F=1,$=0;$<U;$++){var B=localStorage.key($);if(B.indexOf(D)===0){var G=localStorage.getItem(B);if(G&&(G=x.serializer.deserialize(G)),G=d(G,B.substring(P),F++),G!==void 0)return G}}});return y(T,E),T}function Uv(d,E){var S=this,T=S.ready().then(function(){var x=S._dbInfo,D;try{D=localStorage.key(d)}catch{D=null}return D&&(D=D.substring(x.keyPrefix.length)),D});return y(T,E),T}function jv(d){var E=this,S=E.ready().then(function(){for(var T=E._dbInfo,x=localStorage.length,D=[],P=0;P<x;P++){var U=localStorage.key(P);U.indexOf(T.keyPrefix)===0&&D.push(U.substring(T.keyPrefix.length))}return D});return y(S,d),S}function Bv(d){var E=this,S=E.keys().then(function(T){return T.length});return y(S,d),S}function $v(d,E){var S=this;d=O(d);var T=S.ready().then(function(){var x=S._dbInfo;localStorage.removeItem(x.keyPrefix+d)});return y(T,E),T}function Fv(d,E,S){var T=this;d=O(d);var x=T.ready().then(function(){E===void 0&&(E=null);var D=E;return new g(function(P,U){var F=T._dbInfo;F.serializer.serialize(E,function($,B){if(B)U(B);else try{localStorage.setItem(F.keyPrefix+d,$),P(D)}catch(G){(G.name==="QuotaExceededError"||G.name==="NS_ERROR_DOM_QUOTA_REACHED")&&U(G),U(G)}})})});return y(x,S),x}function Hv(d,E){if(E=H.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var S=this.config();d.name=d.name||S.name,d.storeName=d.storeName||S.storeName}var T=this,x;return d.name?x=new g(function(D){d.storeName?D(nh(d,T._defaultConfig)):D(d.name+"/")}).then(function(D){for(var P=localStorage.length-1;P>=0;P--){var U=localStorage.key(P);U.indexOf(D)===0&&localStorage.removeItem(U)}}):x=g.reject("Invalid arguments"),y(x,E),x}var Vv={_driver:"localStorageWrapper",_initStorage:zm,_support:Hg(),iterate:Mv,getItem:kv,setItem:Fv,removeItem:$v,clear:Ym,length:Bv,key:Uv,keys:jv,dropInstance:Hv},Wv=function(d,E){return d===E||typeof d=="number"&&typeof E=="number"&&isNaN(d)&&isNaN(E)},zv=function(d,E){for(var S=d.length,T=0;T<S;){if(Wv(d[T],E))return!0;T++}return!1},ih=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Ga={},oh={},to={INDEXEDDB:c,WEBSQL:Qd,LOCALSTORAGE:Vv},Gv=[to.INDEXEDDB._driver,to.WEBSQL._driver,to.LOCALSTORAGE._driver],Ec=["dropInstance"],Jc=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ec),Ly={description:"",driver:Gv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function By(d,E){d[E]=function(){var S=arguments;return d.ready().then(function(){return d[E].apply(d,S)})}}function zu(){for(var d=1;d<arguments.length;d++){var E=arguments[d];if(E)for(var S in E)E.hasOwnProperty(S)&&(ih(E[S])?arguments[0][S]=E[S].slice():arguments[0][S]=E[S])}return arguments[0]}var tb=function(){function d(E){f(this,d);for(var S in to)if(to.hasOwnProperty(S)){var T=to[S],x=T._driver;this[S]=x,Ga[x]||this.defineDriver(T)}this._defaultConfig=zu({},Ly),this._config=zu({},this._defaultConfig,E),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(E){if((typeof E>"u"?"undefined":u(E))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var S in E){if(S==="storeName"&&(E[S]=E[S].replace(/\W/g,"_")),S==="version"&&typeof E[S]!="number")return new Error("Database version must be a number.");this._config[S]=E[S]}return"driver"in E&&E.driver?this.setDriver(this._config.driver):!0}else return typeof E=="string"?this._config[E]:this._config},d.prototype.defineDriver=function(E,S,T){var x=new g(function(D,P){try{var U=E._driver,F=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!E._driver){P(F);return}for(var $=Jc.concat("_initStorage"),B=0,G=$.length;B<G;B++){var gt=$[B],he=!zv(Ec,gt);if((he||E[gt])&&typeof E[gt]!="function"){P(F);return}}var oe=function(){for(var ye=function(rb){return function(){var nb=new Error("Method "+rb+" is not implemented by the current driver"),dh=g.reject(nb);return y(dh,arguments[arguments.length-1]),dh}},We=0,Ku=Ec.length;We<Ku;We++){var Yu=Ec[We];E[Yu]||(E[Yu]=ye(Yu))}};oe();var Ie=function(ye){Ga[U]&&console.info("Redefining LocalForage driver: "+U),Ga[U]=E,oh[U]=ye,D()};"_support"in E?E._support&&typeof E._support=="function"?E._support().then(Ie,P):Ie(!!E._support):Ie(!0)}catch(ye){P(ye)}});return C(x,S,T),x},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(E,S,T){var x=Ga[E]?g.resolve(Ga[E]):g.reject(new Error("Driver not found."));return C(x,S,T),x},d.prototype.getSerializer=function(E){var S=g.resolve(Tc);return C(S,E),S},d.prototype.ready=function(E){var S=this,T=S._driverSet.then(function(){return S._ready===null&&(S._ready=S._initDriver()),S._ready});return C(T,E,E),T},d.prototype.setDriver=function(E,S,T){var x=this;ih(E)||(E=[E]);var D=this._getSupportedDrivers(E);function P(){x._config.driver=x.driver()}function U(B){return x._extend(B),P(),x._ready=x._initStorage(x._config),x._ready}function F(B){return function(){var G=0;function gt(){for(;G<B.length;){var he=B[G];return G++,x._dbInfo=null,x._ready=null,x.getDriver(he).then(U).catch(gt)}P();var oe=new Error("No available storage method found.");return x._driverSet=g.reject(oe),x._driverSet}return gt()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=$.then(function(){var B=D[0];return x._dbInfo=null,x._ready=null,x.getDriver(B).then(function(G){x._driver=G._driver,P(),x._wrapLibraryMethodsWithReady(),x._initDriver=F(D)})}).catch(function(){P();var B=new Error("No available storage method found.");return x._driverSet=g.reject(B),x._driverSet}),C(this._driverSet,S,T),this._driverSet},d.prototype.supports=function(E){return!!oh[E]},d.prototype._extend=function(E){zu(this,E)},d.prototype._getSupportedDrivers=function(E){for(var S=[],T=0,x=E.length;T<x;T++){var D=E[T];this.supports(D)&&S.push(D)}return S},d.prototype._wrapLibraryMethodsWithReady=function(){for(var E=0,S=Jc.length;E<S;E++)By(this,Jc[E])},d.prototype.createInstance=function(E){return new d(E)},d}(),eb=new tb;o.exports=eb},{3:3}]},{},[4])(4)})}),Sl=Vi(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLBuilder=void 0;var e=function(){function r(n){try{this.base=new URL(n),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return r.prototype.appendQueryParam=function(n,i){this.params.append(n,i?i.toString():"")},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(n){this.params.delete(n)},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(n){if(!this.params)return"";var i=this.params.get(n);return!i||i==="undefined"||i==="null"?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(n){return this.base.pathname=n,this},r.prototype.setQueryParam=function(n,i){return this.params.set(n,i?i.toString():""),this},r.prototype.setQueryString=function(n){if(n)return n[0]==="?"&&(n=n.slice(1)),this.params=new URLSearchParams(n),this},r.prototype.toString=function(){var n=this.params.toString();return n===""?this.base.search="":this.base.search="?"+n,this.base.toString()},r}();t.URLBuilder=e}),dd=Vi((t,e)=>{"use strict";(function(r,n){typeof t=="object"&&typeof e<"u"?e.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.fetchRetry=n())})(t,function(){"use strict";var r=function(s,o){if(o=o||{},typeof s!="function")throw new i("fetch must be a function");if(typeof o!="object")throw new i("defaults must be an object");if(o.retries!==void 0&&!n(o.retries))throw new i("retries must be a positive integer");if(o.retryDelay!==void 0&&!n(o.retryDelay)&&typeof o.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(o.retryOn!==void 0&&!Array.isArray(o.retryOn)&&typeof o.retryOn!="function")throw new i("retryOn property expects an array or function");var l={retries:3,retryDelay:1e3,retryOn:[]};return o=Object.assign(l,o),function(u,f){var m=o.retries,h=o.retryDelay,v=o.retryOn;if(f&&f.retries!==void 0)if(n(f.retries))m=f.retries;else throw new i("retries must be a positive integer");if(f&&f.retryDelay!==void 0)if(n(f.retryDelay)||typeof f.retryDelay=="function")h=f.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(f&&f.retryOn)if(Array.isArray(f.retryOn)||typeof f.retryOn=="function")v=f.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(_,g){var y=function(O){var H=typeof Request<"u"&&u instanceof Request?u.clone():u;s(H,f).then(function(R){if(Array.isArray(v)&&v.indexOf(R.status)===-1)_(R);else if(typeof v=="function")try{return Promise.resolve(v(O,null,R)).then(function(k){k?C(O,null,R):_(R)}).catch(g)}catch(k){g(k)}else O<m?C(O,null,R):_(R)}).catch(function(R){if(typeof v=="function")try{Promise.resolve(v(O,R,null)).then(function(k){k?C(O,R,null):g(R)}).catch(function(k){g(k)})}catch(k){g(k)}else O<m?C(O,R,null):g(R)})};function C(O,H,R){var k=typeof h=="function"?h(O,H,R):h;setTimeout(function(){y(++O)},k)}y(0)})}};function n(s){return Number.isInteger(s)&&s>=0}function i(s){this.name="ArgumentError",this.message=s}return r})}),ip="9.3.16",A=class Ju{static SDK_VERSION=ip;static SDK_VERSION_CODE;static SDK="WEB";static LOG_PREFIX="CooeeSDK";static COOEE="cooee";static SESSION_STORAGE_SCROLL_ID="sleid";static IDLE_TIME_IN_SECONDS=30*60;static IN_APP_WRAPPER_NAME="cooee-wrapper";static IN_APP_CONTAINER_NAME="cooee-container";static IN_APP_DEFAULT_PADDING=15;static EVENT_SCREEN_VIEW="CE Screen View";static EVENT_APP_BACKGROUND="CE App Background";static EVENT_TRIGGER_DISPLAYED="CE Trigger Displayed";static EVENT_CAMPAIGN_HOLDOUT="CE Campaign Holdout";static EVENT_CAMPAIGN_REJECTED="CE Campaign Rejected";static EVENT_CAMPAIGN_FAILED="CE Campaign Failed";static EVENT_TRIGGER_CLOSED="CE Trigger Closed";static EVENT_SCROLL="CE Scroll";static EVENT_TRIGGER_CLICKED="CE Trigger Clicked";static EVENT_FORM_SUBMITTED="CE Form Submitted";static EVENT_ADD_TO_CART="Add To Cart";static EVENT_REMOVE_FROM_CART="Remove From Cart";static EVENT_VIEW_ITEM="View Item";static EVENT_VIEW_CART="View Cart";static EVENT_VIEW_COLLECTION="View Collection";static EVENT_BUY_NOW_CLICKED="Buy Now Clicked";static EVENT_CHECKOUT_STARTED="Checkout Started";static EVENT_REVIEW_CLICKED="Review Clicked";static EVENT_ITEM_THUMBNAIL_CLICKED="Item Thumbnail Clicked";static JS_LOAD_WHITELIST_EVENTS=[this.EVENT_VIEW_ITEM,this.EVENT_VIEW_CART,this.EVENT_VIEW_COLLECTION];static HASH_INITIATE_CHECKOUT="initiate-checkout";static HASH_OPEN_CART_DRAWER="open-cart-drawer";static CTA_EVENT="letscooee:outbound:cta";static ADD_BUNDLE_CTA_INBOUND_EVENT="letscooee:inbound:cta:add-bundle";static CTA_OPEN_CART_EVENT="letscooee:outbound:open-cart";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static{let e=Ju.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");Ju.SDK_VERSION_CODE=parseInt(e,10)}},Zt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}/dist/widget-sdk.min.css`},Rt=Qt(tn()),w=class{static log(...t){Rt.default.info(...t)}static debug(...t){Rt.default.debug(...t)}static error(...t){Rt.default.error(...t)}static warn(...t){Rt.default.warn(...t)}static info(...t){Rt.default.info(...t)}static trace(...t){Rt.default.trace(...t)}static configure(t=A.LOG_PREFIX){Rt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${A.SDK_VERSION}):`)}});let e=this.getDebugParam();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Rt.default.setLevel(Rt.default[localStorage.cooeeLogLevel]):Rt.default.setLevel(Zt.debug?Rt.default.TRACE:Rt.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let t=`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
font-size: 14px;
|
|
4
4
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
`,e+=`
|
|
14
14
|
|
|
15
15
|
`,e+=`Learn more: https://www.letscooee.com
|
|
16
|
-
Cooee SDK: v${A.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}},Ko=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),He=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},zi=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(zi||{}),$n=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}($n||{}),lr=function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t}(lr||{}),Yi=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Yi||{}),ur=function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t}(ur||{}),qi=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(qi||{}),Cc=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Cc||{}),Dc=function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t}(Dc||{}),pr=function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t}(pr||{}),jn=class Kh{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,Kh.swap(e,r,n)}}},Zo,_e,up,Oc,rn,sp,pp,Rc,fp,Pc,Nc,Ac,hh,Ki={},mp=[],gh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Lc=Array.isArray;function Vr(t,e){for(var r in e)t[r]=e[r];return t}function Bc(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Xi(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Zo.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Jo(t,o,n,i,null)}function Jo(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++up,__i:-1,__u:0};return i==null&&_e.vnode!=null&&_e.vnode(s),s}function mr(t){return t.children}function fr(t,e){this.props=t,this.context=e}function Wn(t,e){if(e==null)return t.__?Wn(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Wn(t):null}function dp(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return dp(t)}}function ap(t){(!t.__d&&(t.__d=!0)&&rn.push(t)&&!Qo.__r++||sp!==_e.debounceRendering)&&((sp=_e.debounceRendering)||pp)(Qo)}function Qo(){var t,e,r,n,i,s,o,c;for(rn.sort(Rc);t=rn.shift();)t.__d&&(e=rn.length,n=void 0,s=(i=(r=t).__v).__e,o=[],c=[],r.__P&&((n=Vr({},i)).__v=i.__v+1,_e.vnode&&_e.vnode(n),Uc(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Wn(i),!!(32&i.__u),c),n.__v=i.__v,n.__.__k[n.__i]=n,yp(o,n,c),n.__e!=s&&dp(n)),rn.length>e&&rn.sort(Rc));Qo.__r=0}function hp(t,e,r,n,i,s,o,c,u,f,m){var h,v,_,g,y,C,O=n&&n.__k||mp,H=e.length;for(u=yh(r,e,O,u,H),h=0;h<H;h++)(_=r.__k[h])!=null&&(v=_.__i===-1?Ki:O[_.__i]||Ki,_.__i=h,C=Uc(t,_,v,i,s,o,c,u,f,m),g=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&Mc(v.ref,null,_),m.push(_.ref,_.__c||g,_)),y==null&&g!=null&&(y=g),4&_.__u||v.__k===_.__k?u=gp(_,u,t):typeof _.type=="function"&&C!==void 0?u=C:g&&(u=g.nextSibling),_.__u&=-7);return r.__e=y,u}function yh(t,e,r,n,i){var s,o,c,u,f,m=r.length,h=m,v=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=s+v,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Jo(null,o,null,null,null):Lc(o)?Jo(mr,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Jo(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,c=null,(f=o.__i=vh(o,r,u,h))!==-1&&(h--,(c=r[f])&&(c.__u|=2)),c==null||c.__v===null?(f==-1&&v--,typeof o.type!="function"&&(o.__u|=4)):f!=u&&(f==u-1?v--:f==u+1?v++:(f>u?v--:v++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<m;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Wn(c)),vp(c,c));return n}function gp(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=gp(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Wn(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function vh(t,e,r,n){var i,s,o=t.key,c=t.type,u=e[r];if(u===null||u&&o==u.key&&c===u.type&&(2&u.__u)==0)return r;if(n>(u!=null&&(2&u.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((u=e[i])&&(2&u.__u)==0&&o==u.key&&c===u.type)return i;i--}if(s<e.length){if((u=e[s])&&(2&u.__u)==0&&o==u.key&&c===u.type)return s;s++}}return-1}function cp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||gh.test(e)?r:r+"px"}function Xo(t,e,r,n,i){var s;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||cp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||cp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(fp,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Pc,t.addEventListener(e,s?Ac:Nc,s)):t.removeEventListener(e,s?Ac:Nc,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function lp(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Pc++;else if(e.t<r.u)return;return r(_e.event?_e.event(e):e)}}}function Uc(t,e,r,n,i,s,o,c,u,f){var m,h,v,_,g,y,C,O,H,R,k,V,Mt,de,B,at,Y,st=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),s=[c=e.__e=r.__e]),(m=_e.__b)&&m(e);t:if(typeof st=="function")try{if(O=e.props,H="prototype"in st&&st.prototype.render,R=(m=st.contextType)&&n[m.__c],k=m?R?R.props.value:m.__:n,r.__c?C=(h=e.__c=r.__c).__=h.__E:(H?e.__c=h=new st(O,k):(e.__c=h=new fr(O,k),h.constructor=st,h.render=Eh),R&&R.sub(h),h.props=O,h.state||(h.state={}),h.context=k,h.__n=n,v=h.__d=!0,h.__h=[],h._sb=[]),H&&h.__s==null&&(h.__s=h.state),H&&st.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Vr({},h.__s)),Vr(h.__s,st.getDerivedStateFromProps(O,h.__s))),_=h.props,g=h.state,h.__v=e,v)H&&st.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),H&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(H&&st.getDerivedStateFromProps==null&&O!==_&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(O,k),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(O,h.__s,k)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(h.props=O,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Jt){Jt&&(Jt.__=e)}),V=0;V<h._sb.length;V++)h.__h.push(h._sb[V]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(O,h.__s,k),H&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(_,g,y)})}if(h.context=k,h.props=O,h.__P=t,h.__e=!1,Mt=_e.__r,de=0,H){for(h.state=h.__s,h.__d=!1,Mt&&Mt(e),m=h.render(h.props,h.state,h.context),B=0;B<h._sb.length;B++)h.__h.push(h._sb[B]);h._sb=[]}else do h.__d=!1,Mt&&Mt(e),m=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++de<25);h.state=h.__s,h.getChildContext!=null&&(n=Vr(Vr({},n),h.getChildContext())),H&&!v&&h.getSnapshotBeforeUpdate!=null&&(y=h.getSnapshotBeforeUpdate(_,g)),c=hp(t,Lc(at=m!=null&&m.type===mr&&m.key==null?m.props.children:m)?at:[at],e,r,n,i,s,o,c,u,f),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),C&&(h.__E=h.__=null)}catch(Jt){if(e.__v=null,u||s!=null)if(Jt.then){for(e.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.__e=c}else for(Y=s.length;Y--;)Bc(s[Y]);else e.__e=r.__e,e.__k=r.__k;_e.__e(Jt,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):c=e.__e=_h(r.__e,e,r,n,i,s,o,u,f);return(m=_e.diffed)&&m(e),128&e.__u?void 0:c}function yp(t,e,r){for(var n=0;n<r.length;n++)Mc(r[n],r[++n],r[++n]);_e.__c&&_e.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){_e.__e(s,i.__v)}})}function _h(t,e,r,n,i,s,o,c,u){var f,m,h,v,_,g,y,C=r.props,O=e.props,H=e.type;if(H=="svg"?i="http://www.w3.org/2000/svg":H=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(f=0;f<s.length;f++)if((_=s[f])&&"setAttribute"in _==!!H&&(H?_.localName==H:_.nodeType==3)){t=_,s[f]=null;break}}if(t==null){if(H==null)return document.createTextNode(O);t=document.createElementNS(i,H,O.is&&O),c&&(_e.__m&&_e.__m(e,s),c=!1),s=null}if(H===null)C===O||c&&t.data===O||(t.data=O);else{if(s=s&&Zo.call(t.childNodes),C=r.props||Ki,!c&&s!=null)for(C={},f=0;f<t.attributes.length;f++)C[(_=t.attributes[f]).name]=_.value;for(f in C)if(_=C[f],f!="children"){if(f=="dangerouslySetInnerHTML")h=_;else if(!(f in O)){if(f=="value"&&"defaultValue"in O||f=="checked"&&"defaultChecked"in O)continue;Xo(t,f,null,_,i)}}for(f in O)_=O[f],f=="children"?v=_:f=="dangerouslySetInnerHTML"?m=_:f=="value"?g=_:f=="checked"?y=_:c&&typeof _!="function"||C[f]===_||Xo(t,f,_,C[f],i);if(m)c||h&&(m.__html===h.__html||m.__html===t.innerHTML)||(t.innerHTML=m.__html),e.__k=[];else if(h&&(t.innerHTML=""),hp(t,Lc(v)?v:[v],e,r,n,H=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Wn(r,0),c,u),s!=null)for(f=s.length;f--;)Bc(s[f]);c||(f="value",H=="progress"&&g==null?t.removeAttribute("value"):g!==void 0&&(g!==t[f]||H=="progress"&&!g||H=="option"&&g!==C[f])&&Xo(t,f,g,C[f],i),f="checked",y!==void 0&&y!==t[f]&&Xo(t,f,y,C[f],i))}return t}function Mc(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){_e.__e(i,r)}}function vp(t,e,r){var n,i;if(_e.unmount&&_e.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Mc(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){_e.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&vp(n[i],e,r||typeof t.type!="function");r||Bc(t.__e),t.__c=t.__=t.__e=void 0}function Eh(t,e,r){return this.constructor(t,r)}function es(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),_e.__&&_e.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Uc(e,t=(!n&&r||e).__k=Xi(mr,null,[t]),i||Ki,Ki,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Zo.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),yp(s,t,o)}Zo=mp.slice,_e={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(c){t=c}throw t}},up=0,Oc=function(t){return t!=null&&t.constructor==null},fr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Vr({},this.state),typeof t=="function"&&(t=t(Vr({},r),this.props)),t&&Vr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ap(this))},fr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ap(this))},fr.prototype.render=mr,rn=[],pp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rc=function(t,e){return t.__v.__b-e.__v.__b},Qo.__r=0,fp=/(PointerCapture)$|Capture$/i,Pc=0,Nc=lp(!1),Ac=lp(!0),hh=0;var Fc,Nt,kc,_p,Ep=0,Dp=[],Ke=_e,Sp=Ke.__b,bp=Ke.__r,wp=Ke.diffed,Ip=Ke.__c,Tp=Ke.unmount,xp=Ke.__;function Sh(t,e){Ke.__h&&Ke.__h(Nt,t,Ep||e),Ep=0;var r=Nt.__H||(Nt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function $c(t,e){var r=Sh(Fc++,7);return Ih(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function bh(){for(var t;t=Dp.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ts),t.__H.__h.forEach(Hc),t.__H.__h=[]}catch(e){t.__H.__h=[],Ke.__e(e,t.__v)}}Ke.__b=function(t){Nt=null,Sp&&Sp(t)},Ke.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),xp&&xp(t,e)},Ke.__r=function(t){bp&&bp(t),Fc=0;var e=(Nt=t.__c).__H;e&&(kc===Nt?(e.__h=[],Nt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(ts),e.__h.forEach(Hc),e.__h=[],Fc=0)),kc=Nt},Ke.diffed=function(t){wp&&wp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Dp.push(e)!==1&&_p===Ke.requestAnimationFrame||((_p=Ke.requestAnimationFrame)||wh)(bh)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),kc=Nt=null},Ke.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ts),r.__h=r.__h.filter(function(n){return!n.__||Hc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ke.__e(n,r.__v)}}),Ip&&Ip(t,e)},Ke.unmount=function(t){Tp&&Tp(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ts(n)}catch(i){e=i}}),r.__H=void 0,e&&Ke.__e(e,r.__v))};var Cp=typeof requestAnimationFrame=="function";function wh(t){var e,r=function(){clearTimeout(n),Cp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Cp&&(e=requestAnimationFrame(r))}function ts(t){var e=Nt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Nt=e}function Hc(t){var e=Nt;t.__c=t.__(),Nt=e}function Ih(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Th=Symbol.for("preact-signals");function Wc(){if(Gn>1)Gn--;else{for(var t,e=!1;Ji!==void 0;){var r=Ji;for(Ji=void 0,jc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Np(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(jc=0,Gn--,e)throw t}}var Re=void 0,Ji=void 0,Gn=0,jc=0,rs=0;function Rp(t){if(Re!==void 0){var e=t.n;if(e===void 0||e.t!==Re)return e={i:0,S:t,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:e},Re.s!==void 0&&(Re.s.n=e),Re.s=e,t.n=e,32&Re.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Re.s,e.n=void 0,Re.s.n=e,Re.s=e),e}}function Xe(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Xe.prototype.brand=Th;Xe.prototype.h=function(){return!0};Xe.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Xe.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Xe.prototype.subscribe=function(t){var e=this;return it(function(){var r=e.value,n=Re;Re=void 0;try{t(r)}finally{Re=n}})};Xe.prototype.valueOf=function(){return this.value};Xe.prototype.toString=function(){return this.value+""};Xe.prototype.toJSON=function(){return this.value};Xe.prototype.peek=function(){var t=Re;Re=void 0;try{return this.value}finally{Re=t}};Object.defineProperty(Xe.prototype,"value",{get:function(){var t=Rp(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(jc>100)throw new Error("Cycle detected");this.v=t,this.i++,rs++,Gn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Wc()}}}});function er(t){return new Xe(t)}function Np(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Ap(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Op(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function Vn(t){Xe.call(this,void 0),this.x=t,this.s=void 0,this.g=rs-1,this.f=4}(Vn.prototype=new Xe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rs))return!0;if(this.g=rs,this.f|=1,this.i>0&&!Np(this))return this.f&=-2,!0;var t=Re;try{Ap(this),Re=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Re=t,Op(this),this.f&=-2,!0};Vn.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Xe.prototype.S.call(this,t)};Vn.prototype.U=function(t){if(this.t!==void 0&&(Xe.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Vn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Vn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Rp(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Gc(t){return new Vn(t)}function Pp(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Gn++;var r=Re;Re=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Vc(t),n}finally{Re=r,Wc()}}}function Vc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Pp(t)}function xh(t){if(Re!==this)throw new Error("Out-of-order effect");Op(this),Re=t,this.f&=-2,8&this.f&&Vc(this),Wc()}function Qi(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Qi.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Qi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Pp(this),Ap(this),Gn++;var t=Re;return Re=this,xh.bind(this,t)};Qi.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ji,Ji=this)};Qi.prototype.d=function(){this.f|=8,1&this.f||Vc(this)};function it(t){var e=new Qi(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Yc,zc;function zn(t,e){_e[t]=e.bind(null,_e[t]||function(){})}function ns(t){zc&&zc(),zc=t&&t.S()}function Lp(t){var e=this,r=t.data,n=Dh(r);n.value=r;var i=$c(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,c=e.__$u.S(),u=i.value;c(),Oc(u)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=u},Gc(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Lp.displayName="_st";Object.defineProperties(Xe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Lp},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});zn("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof Xe&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});zn("__r",function(t,e){ns();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return it(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Yc=n,ns(r),t(e)});zn("__e",function(t,e,r,n){ns(),Yc=void 0,t(e,r,n)});zn("diffed",function(t,e){ns(),Yc=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var c=s[o];c!==void 0&&!(o in n)&&(c.d(),s[o]=void 0)}else r.U=s={};for(var u in n){var f=s[u],m=n[u];f===void 0?(f=Ch(r,u,m,i),s[u]=f):f.o(m,i)}}}t(e)});function Ch(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=er(r);return{o:function(o,c){s.value=o,n=c},d:it(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}zn("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var c=o.__$u;c&&(o.__$u=void 0,c.d())}}t(e)});zn("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});fr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Dh(t){return $c(function(){return er(t)},[])}var Rh=Object.prototype.toString,qn=Array.isArray||function(t){return Rh.call(t)==="[object Array]"};function Kc(t){return typeof t=="function"}function Nh(t){return qn(t)?"array":typeof t}function qc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Bp(t,e){return t!=null&&typeof t=="object"&&e in t}function Ah(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Oh=RegExp.prototype.test;function Ph(t,e){return Oh.call(t,e)}var Lh=/\S/;function Bh(t){return!Ph(Lh,t)}var Uh={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Mh(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Uh[e]})}var kh=/\s*/,Fh=/\s+/,Up=/\s*=/,Hh=/\s*\}/,$h=/#|\^|\/|>|\{|&|=|!/;function jh(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,u="",f=0;function m(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,v,_;function g(B){if(typeof B=="string"&&(B=B.split(Fh,2)),!qn(B)||B.length!==2)throw new Error("Invalid tags: "+B);h=new RegExp(qc(B[0])+"\\s*"),v=new RegExp("\\s*"+qc(B[1])),_=new RegExp("\\s*"+qc("}"+B[1]))}g(e||kt.tags);for(var y=new eo(t),C,O,H,R,k,V;!y.eos();){if(C=y.pos,H=y.scanUntil(h),H)for(var Mt=0,de=H.length;Mt<de;++Mt)R=H.charAt(Mt),Bh(R)?(s.push(i.length),u+=R):(c=!0,r=!0,u+=" "),i.push(["text",R,C,C+1]),C+=1,R===`
|
|
17
|
-
`&&(m(),u="",f=0,r=!1);if(!y.scan(h))break;if(o=!0,O=y.scan($h)||"name",y.scan(kh),O==="="?(H=y.scanUntil(Up),y.scan(Up),y.scanUntil(v)):O==="{"?(H=y.scanUntil(_),y.scan(Hh),y.scanUntil(v),O="&"):H=y.scanUntil(v),!y.scan(v))throw new Error("Unclosed tag at "+y.pos);if(O==">"?k=[O,H,C,y.pos,u,f,r]:k=[O,H,C,y.pos],f++,i.push(k),O==="#"||O==="^")n.push(k);else if(O==="/"){if(V=n.pop(),!V)throw new Error('Unopened section "'+H+'" at '+C);if(V[1]!==H)throw new Error('Unclosed section "'+V[1]+'" at '+C)}else O==="name"||O==="{"||O==="&"?
|
|
16
|
+
Cooee SDK: v${A.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}},Ko=(()=>{class t{static entityMap={'"':"""};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),Oe=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}},zi=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(zi||{}),$n=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}($n||{}),lr=function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t}(lr||{}),Yi=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Yi||{}),ur=function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t}(ur||{}),qi=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(qi||{}),Cc=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Cc||{}),Dc=function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t}(Dc||{}),pr=function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t}(pr||{}),jn=class Kh{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,s)=>s.findIndex(o=>o[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,Kh.swap(e,r,n)}}},Zo,_e,up,Oc,rn,sp,pp,Rc,fp,Pc,Nc,Ac,hh,Ki={},mp=[],gh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Lc=Array.isArray;function Gr(t,e){for(var r in e)t[r]=e[r];return t}function Bc(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ji(t,e,r){var n,i,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Zo.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Xo(t,o,n,i,null)}function Xo(t,e,r,n,i){var s={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++up,__i:-1,__u:0};return i==null&&_e.vnode!=null&&_e.vnode(s),s}function mr(t){return t.children}function fr(t,e){this.props=t,this.context=e}function Wn(t,e){if(e==null)return t.__?Wn(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Wn(t):null}function dp(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return dp(t)}}function ap(t){(!t.__d&&(t.__d=!0)&&rn.push(t)&&!Qo.__r++||sp!==_e.debounceRendering)&&((sp=_e.debounceRendering)||pp)(Qo)}function Qo(){var t,e,r,n,i,s,o,l;for(rn.sort(Rc);t=rn.shift();)t.__d&&(e=rn.length,n=void 0,s=(i=(r=t).__v).__e,o=[],l=[],r.__P&&((n=Gr({},i)).__v=i.__v+1,_e.vnode&&_e.vnode(n),Uc(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[s]:null,o,s??Wn(i),!!(32&i.__u),l),n.__v=i.__v,n.__.__k[n.__i]=n,yp(o,n,l),n.__e!=s&&dp(n)),rn.length>e&&rn.sort(Rc));Qo.__r=0}function hp(t,e,r,n,i,s,o,l,u,f,m){var h,v,_,g,y,C,O=n&&n.__k||mp,H=e.length;for(u=yh(r,e,O,u,H),h=0;h<H;h++)(_=r.__k[h])!=null&&(v=_.__i===-1?Ki:O[_.__i]||Ki,_.__i=h,C=Uc(t,_,v,i,s,o,l,u,f,m),g=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&Mc(v.ref,null,_),m.push(_.ref,_.__c||g,_)),y==null&&g!=null&&(y=g),4&_.__u||v.__k===_.__k?u=gp(_,u,t):typeof _.type=="function"&&C!==void 0?u=C:g&&(u=g.nextSibling),_.__u&=-7);return r.__e=y,u}function yh(t,e,r,n,i){var s,o,l,u,f,m=r.length,h=m,v=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=s+v,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Xo(null,o,null,null,null):Lc(o)?Xo(mr,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Xo(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,l=null,(f=o.__i=vh(o,r,u,h))!==-1&&(h--,(l=r[f])&&(l.__u|=2)),l==null||l.__v===null?(f==-1&&v--,typeof o.type!="function"&&(o.__u|=4)):f!=u&&(f==u-1?v--:f==u+1?v++:(f>u?v--:v++,o.__u|=4))):t.__k[s]=null;if(h)for(s=0;s<m;s++)(l=r[s])!=null&&(2&l.__u)==0&&(l.__e==n&&(n=Wn(l)),vp(l,l));return n}function gp(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=gp(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Wn(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function vh(t,e,r,n){var i,s,o=t.key,l=t.type,u=e[r];if(u===null||u&&o==u.key&&l===u.type&&(2&u.__u)==0)return r;if(n>(u!=null&&(2&u.__u)==0?1:0))for(i=r-1,s=r+1;i>=0||s<e.length;){if(i>=0){if((u=e[i])&&(2&u.__u)==0&&o==u.key&&l===u.type)return i;i--}if(s<e.length){if((u=e[s])&&(2&u.__u)==0&&o==u.key&&l===u.type)return s;s++}}return-1}function cp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||gh.test(e)?r:r+"px"}function Jo(t,e,r,n,i){var s;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||cp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||cp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(fp,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=r,r?n?r.u=n.u:(r.u=Pc,t.addEventListener(e,s?Ac:Nc,s)):t.removeEventListener(e,s?Ac:Nc,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function lp(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Pc++;else if(e.t<r.u)return;return r(_e.event?_e.event(e):e)}}}function Uc(t,e,r,n,i,s,o,l,u,f){var m,h,v,_,g,y,C,O,H,R,k,V,Mt,fe,j,ct,Y,at=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),s=[l=e.__e=r.__e]),(m=_e.__b)&&m(e);t:if(typeof at=="function")try{if(O=e.props,H="prototype"in at&&at.prototype.render,R=(m=at.contextType)&&n[m.__c],k=m?R?R.props.value:m.__:n,r.__c?C=(h=e.__c=r.__c).__=h.__E:(H?e.__c=h=new at(O,k):(e.__c=h=new fr(O,k),h.constructor=at,h.render=Eh),R&&R.sub(h),h.props=O,h.state||(h.state={}),h.context=k,h.__n=n,v=h.__d=!0,h.__h=[],h._sb=[]),H&&h.__s==null&&(h.__s=h.state),H&&at.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Gr({},h.__s)),Gr(h.__s,at.getDerivedStateFromProps(O,h.__s))),_=h.props,g=h.state,h.__v=e,v)H&&at.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),H&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(H&&at.getDerivedStateFromProps==null&&O!==_&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(O,k),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(O,h.__s,k)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(h.props=O,h.state=h.__s,h.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Xt){Xt&&(Xt.__=e)}),V=0;V<h._sb.length;V++)h.__h.push(h._sb[V]);h._sb=[],h.__h.length&&o.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(O,h.__s,k),H&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(_,g,y)})}if(h.context=k,h.props=O,h.__P=t,h.__e=!1,Mt=_e.__r,fe=0,H){for(h.state=h.__s,h.__d=!1,Mt&&Mt(e),m=h.render(h.props,h.state,h.context),j=0;j<h._sb.length;j++)h.__h.push(h._sb[j]);h._sb=[]}else do h.__d=!1,Mt&&Mt(e),m=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++fe<25);h.state=h.__s,h.getChildContext!=null&&(n=Gr(Gr({},n),h.getChildContext())),H&&!v&&h.getSnapshotBeforeUpdate!=null&&(y=h.getSnapshotBeforeUpdate(_,g)),l=hp(t,Lc(ct=m!=null&&m.type===mr&&m.key==null?m.props.children:m)?ct:[ct],e,r,n,i,s,o,l,u,f),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),C&&(h.__E=h.__=null)}catch(Xt){if(e.__v=null,u||s!=null)if(Xt.then){for(e.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,e.__e=l}else for(Y=s.length;Y--;)Bc(s[Y]);else e.__e=r.__e,e.__k=r.__k;_e.__e(Xt,e,r)}else s==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):l=e.__e=_h(r.__e,e,r,n,i,s,o,u,f);return(m=_e.diffed)&&m(e),128&e.__u?void 0:l}function yp(t,e,r){for(var n=0;n<r.length;n++)Mc(r[n],r[++n],r[++n]);_e.__c&&_e.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){_e.__e(s,i.__v)}})}function _h(t,e,r,n,i,s,o,l,u){var f,m,h,v,_,g,y,C=r.props,O=e.props,H=e.type;if(H=="svg"?i="http://www.w3.org/2000/svg":H=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(f=0;f<s.length;f++)if((_=s[f])&&"setAttribute"in _==!!H&&(H?_.localName==H:_.nodeType==3)){t=_,s[f]=null;break}}if(t==null){if(H==null)return document.createTextNode(O);t=document.createElementNS(i,H,O.is&&O),l&&(_e.__m&&_e.__m(e,s),l=!1),s=null}if(H===null)C===O||l&&t.data===O||(t.data=O);else{if(s=s&&Zo.call(t.childNodes),C=r.props||Ki,!l&&s!=null)for(C={},f=0;f<t.attributes.length;f++)C[(_=t.attributes[f]).name]=_.value;for(f in C)if(_=C[f],f!="children"){if(f=="dangerouslySetInnerHTML")h=_;else if(!(f in O)){if(f=="value"&&"defaultValue"in O||f=="checked"&&"defaultChecked"in O)continue;Jo(t,f,null,_,i)}}for(f in O)_=O[f],f=="children"?v=_:f=="dangerouslySetInnerHTML"?m=_:f=="value"?g=_:f=="checked"?y=_:l&&typeof _!="function"||C[f]===_||Jo(t,f,_,C[f],i);if(m)l||h&&(m.__html===h.__html||m.__html===t.innerHTML)||(t.innerHTML=m.__html),e.__k=[];else if(h&&(t.innerHTML=""),hp(t,Lc(v)?v:[v],e,r,n,H=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:r.__k&&Wn(r,0),l,u),s!=null)for(f=s.length;f--;)Bc(s[f]);l||(f="value",H=="progress"&&g==null?t.removeAttribute("value"):g!==void 0&&(g!==t[f]||H=="progress"&&!g||H=="option"&&g!==C[f])&&Jo(t,f,g,C[f],i),f="checked",y!==void 0&&y!==t[f]&&Jo(t,f,y,C[f],i))}return t}function Mc(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){_e.__e(i,r)}}function vp(t,e,r){var n,i;if(_e.unmount&&_e.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Mc(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){_e.__e(s,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&vp(n[i],e,r||typeof t.type!="function");r||Bc(t.__e),t.__c=t.__=t.__e=void 0}function Eh(t,e,r){return this.constructor(t,r)}function es(t,e,r){var n,i,s,o;e==document&&(e=document.documentElement),_e.__&&_e.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,s=[],o=[],Uc(e,t=(!n&&r||e).__k=Ji(mr,null,[t]),i||Ki,Ki,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Zo.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),yp(s,t,o)}Zo=mp.slice,_e={__e:function(t,e,r,n){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),o=i.__d),o)return i.__E=i}catch(l){t=l}throw t}},up=0,Oc=function(t){return t!=null&&t.constructor==null},fr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Gr({},this.state),typeof t=="function"&&(t=t(Gr({},r),this.props)),t&&Gr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ap(this))},fr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ap(this))},fr.prototype.render=mr,rn=[],pp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rc=function(t,e){return t.__v.__b-e.__v.__b},Qo.__r=0,fp=/(PointerCapture)$|Capture$/i,Pc=0,Nc=lp(!1),Ac=lp(!0),hh=0;var Fc,Nt,kc,_p,Ep=0,Dp=[],qe=_e,Sp=qe.__b,bp=qe.__r,wp=qe.diffed,Ip=qe.__c,Tp=qe.unmount,xp=qe.__;function Sh(t,e){qe.__h&&qe.__h(Nt,t,Ep||e),Ep=0;var r=Nt.__H||(Nt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function $c(t,e){var r=Sh(Fc++,7);return Ih(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function bh(){for(var t;t=Dp.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ts),t.__H.__h.forEach(Hc),t.__H.__h=[]}catch(e){t.__H.__h=[],qe.__e(e,t.__v)}}qe.__b=function(t){Nt=null,Sp&&Sp(t)},qe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),xp&&xp(t,e)},qe.__r=function(t){bp&&bp(t),Fc=0;var e=(Nt=t.__c).__H;e&&(kc===Nt?(e.__h=[],Nt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(ts),e.__h.forEach(Hc),e.__h=[],Fc=0)),kc=Nt},qe.diffed=function(t){wp&&wp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Dp.push(e)!==1&&_p===qe.requestAnimationFrame||((_p=qe.requestAnimationFrame)||wh)(bh)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),kc=Nt=null},qe.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ts),r.__h=r.__h.filter(function(n){return!n.__||Hc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],qe.__e(n,r.__v)}}),Ip&&Ip(t,e)},qe.unmount=function(t){Tp&&Tp(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ts(n)}catch(i){e=i}}),r.__H=void 0,e&&qe.__e(e,r.__v))};var Cp=typeof requestAnimationFrame=="function";function wh(t){var e,r=function(){clearTimeout(n),Cp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Cp&&(e=requestAnimationFrame(r))}function ts(t){var e=Nt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Nt=e}function Hc(t){var e=Nt;t.__c=t.__(),Nt=e}function Ih(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Th=Symbol.for("preact-signals");function Wc(){if(Gn>1)Gn--;else{for(var t,e=!1;Xi!==void 0;){var r=Xi;for(Xi=void 0,jc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Np(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(jc=0,Gn--,e)throw t}}var Re=void 0,Xi=void 0,Gn=0,jc=0,rs=0;function Rp(t){if(Re!==void 0){var e=t.n;if(e===void 0||e.t!==Re)return e={i:0,S:t,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:e},Re.s!==void 0&&(Re.s.n=e),Re.s=e,t.n=e,32&Re.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Re.s,e.n=void 0,Re.s.n=e,Re.s=e),e}}function Ke(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Ke.prototype.brand=Th;Ke.prototype.h=function(){return!0};Ke.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Ke.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Ke.prototype.subscribe=function(t){var e=this;return ot(function(){var r=e.value,n=Re;Re=void 0;try{t(r)}finally{Re=n}})};Ke.prototype.valueOf=function(){return this.value};Ke.prototype.toString=function(){return this.value+""};Ke.prototype.toJSON=function(){return this.value};Ke.prototype.peek=function(){var t=Re;Re=void 0;try{return this.value}finally{Re=t}};Object.defineProperty(Ke.prototype,"value",{get:function(){var t=Rp(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(jc>100)throw new Error("Cycle detected");this.v=t,this.i++,rs++,Gn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Wc()}}}});function er(t){return new Ke(t)}function Np(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Ap(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Op(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function Vn(t){Ke.call(this,void 0),this.x=t,this.s=void 0,this.g=rs-1,this.f=4}(Vn.prototype=new Ke).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rs))return!0;if(this.g=rs,this.f|=1,this.i>0&&!Np(this))return this.f&=-2,!0;var t=Re;try{Ap(this),Re=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Re=t,Op(this),this.f&=-2,!0};Vn.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Ke.prototype.S.call(this,t)};Vn.prototype.U=function(t){if(this.t!==void 0&&(Ke.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Vn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Vn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Rp(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Gc(t){return new Vn(t)}function Pp(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Gn++;var r=Re;Re=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Vc(t),n}finally{Re=r,Wc()}}}function Vc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Pp(t)}function xh(t){if(Re!==this)throw new Error("Out-of-order effect");Op(this),Re=t,this.f&=-2,8&this.f&&Vc(this),Wc()}function Qi(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Qi.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};Qi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Pp(this),Ap(this),Gn++;var t=Re;return Re=this,xh.bind(this,t)};Qi.prototype.N=function(){2&this.f||(this.f|=2,this.o=Xi,Xi=this)};Qi.prototype.d=function(){this.f|=8,1&this.f||Vc(this)};function ot(t){var e=new Qi(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Yc,zc;function zn(t,e){_e[t]=e.bind(null,_e[t]||function(){})}function ns(t){zc&&zc(),zc=t&&t.S()}function Lp(t){var e=this,r=t.data,n=Dh(r);n.value=r;var i=$c(function(){for(var s=e.__v;s=s.__;)if(s.__c){s.__c.__$f|=4;break}return e.__$u.c=function(){var o,l=e.__$u.S(),u=i.value;l(),Oc(u)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=u},Gc(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Lp.displayName="_st";Object.defineProperties(Ke.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Lp},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});zn("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var s=n[i];s instanceof Ke&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});zn("__r",function(t,e){ns();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return ot(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Yc=n,ns(r),t(e)});zn("__e",function(t,e,r,n){ns(),Yc=void 0,t(e,r,n)});zn("diffed",function(t,e){ns(),Yc=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var s=r.U;if(s)for(var o in s){var l=s[o];l!==void 0&&!(o in n)&&(l.d(),s[o]=void 0)}else r.U=s={};for(var u in n){var f=s[u],m=n[u];f===void 0?(f=Ch(r,u,m,i),s[u]=f):f.o(m,i)}}}t(e)});function Ch(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=er(r);return{o:function(o,l){s.value=o,n=l},d:ot(function(){var o=s.value.value;n[e]!==o&&(n[e]=o,i?t[e]=o:o?t.setAttribute(e,o):t.removeAttribute(e))})}}zn("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var s=n[i];s&&s.d()}}}}else{var o=e.__c;if(o){var l=o.__$u;l&&(o.__$u=void 0,l.d())}}t(e)});zn("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});fr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var s in t)if(s!=="__source"&&t[s]!==this.props[s])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};function Dh(t){return $c(function(){return er(t)},[])}var Rh=Object.prototype.toString,qn=Array.isArray||function(t){return Rh.call(t)==="[object Array]"};function Kc(t){return typeof t=="function"}function Nh(t){return qn(t)?"array":typeof t}function qc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Bp(t,e){return t!=null&&typeof t=="object"&&e in t}function Ah(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Oh=RegExp.prototype.test;function Ph(t,e){return Oh.call(t,e)}var Lh=/\S/;function Bh(t){return!Ph(Lh,t)}var Uh={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Mh(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Uh[e]})}var kh=/\s*/,Fh=/\s+/,Up=/\s*=/,Hh=/\s*\}/,$h=/#|\^|\/|>|\{|&|=|!/;function jh(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,l=!1,u="",f=0;function m(){if(o&&!l)for(;s.length;)delete i[s.pop()];else s=[];o=!1,l=!1}var h,v,_;function g(j){if(typeof j=="string"&&(j=j.split(Fh,2)),!qn(j)||j.length!==2)throw new Error("Invalid tags: "+j);h=new RegExp(qc(j[0])+"\\s*"),v=new RegExp("\\s*"+qc(j[1])),_=new RegExp("\\s*"+qc("}"+j[1]))}g(e||kt.tags);for(var y=new eo(t),C,O,H,R,k,V;!y.eos();){if(C=y.pos,H=y.scanUntil(h),H)for(var Mt=0,fe=H.length;Mt<fe;++Mt)R=H.charAt(Mt),Bh(R)?(s.push(i.length),u+=R):(l=!0,r=!0,u+=" "),i.push(["text",R,C,C+1]),C+=1,R===`
|
|
17
|
+
`&&(m(),u="",f=0,r=!1);if(!y.scan(h))break;if(o=!0,O=y.scan($h)||"name",y.scan(kh),O==="="?(H=y.scanUntil(Up),y.scan(Up),y.scanUntil(v)):O==="{"?(H=y.scanUntil(_),y.scan(Hh),y.scanUntil(v),O="&"):H=y.scanUntil(v),!y.scan(v))throw new Error("Unclosed tag at "+y.pos);if(O==">"?k=[O,H,C,y.pos,u,f,r]:k=[O,H,C,y.pos],f++,i.push(k),O==="#"||O==="^")n.push(k);else if(O==="/"){if(V=n.pop(),!V)throw new Error('Unopened section "'+H+'" at '+C);if(V[1]!==H)throw new Error('Unclosed section "'+V[1]+'" at '+C)}else O==="name"||O==="{"||O==="&"?l=!0:O==="="&&g(H)}if(m(),V=n.pop(),V)throw new Error('Unclosed section "'+V[1]+'" at '+y.pos);return Gh(Wh(i))}function Wh(t){for(var e=[],r,n,i=0,s=t.length;i<s;++i)r=t[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function Gh(t){for(var e=[],r=e,n=[],i,s,o=0,l=t.length;o<l;++o)switch(i=t[o],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":s=n.pop(),s[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function eo(t){this.string=t,this.tail=t,this.pos=0}eo.prototype.eos=function(){return this.tail===""};eo.prototype.scan=function(t){var e=this.tail.match(t);if(!e||e.index!==0)return"";var r=e[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};eo.prototype.scanUntil=function(t){var e=this.tail.search(t),r;switch(e){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=r.length,r};function Yn(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Yn.prototype.push=function(t){return new Yn(t,this)};Yn.prototype.lookup=function(t){var e=this.cache,r;if(e.hasOwnProperty(t))r=e[t];else{for(var n=this,i,s,o,l=!1;n;){if(t.indexOf(".")>0)for(i=n.view,s=t.split("."),o=0;i!=null&&o<s.length;)o===s.length-1&&(l=Bp(i,s[o])||Ah(i,s[o])),i=i[s[o++]];else i=n.view[t],l=Bp(n.view,t);if(l){r=i;break}n=n.parent}e[t]=r}return Kc(r)&&(r=r.call(this.view)),r};function yt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}yt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};yt.prototype.parse=function(t,e){var r=this.templateCache,n=t+":"+(e||kt.tags).join(":"),i=typeof r<"u",s=i?r.get(n):void 0;return s==null&&(s=jh(t,e),i&&r.set(n,s)),s};yt.prototype.render=function(t,e,r,n){var i=this.getConfigTags(n),s=this.parse(t,i),o=e instanceof Yn?e:new Yn(e,void 0);return this.renderTokens(s,o,r,t,n)};yt.prototype.renderTokens=function(t,e,r,n,i){for(var s="",o,l,u,f=0,m=t.length;f<m;++f)u=void 0,o=t[f],l=o[0],l==="#"?u=this.renderSection(o,e,r,n,i):l==="^"?u=this.renderInverted(o,e,r,n,i):l===">"?u=this.renderPartial(o,e,r,i):l==="&"?u=this.unescapedValue(o,e):l==="name"?u=this.escapedValue(o,e,i):l==="text"&&(u=this.rawValue(o)),u!==void 0&&(s+=u);return s};yt.prototype.renderSection=function(t,e,r,n,i){var s=this,o="",l=e.lookup(t[1]);function u(h){return s.render(h,e,r,i)}if(l){if(qn(l))for(var f=0,m=l.length;f<m;++f)o+=this.renderTokens(t[4],e.push(l[f]),r,n,i);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")o+=this.renderTokens(t[4],e.push(l),r,n,i);else if(Kc(l)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(e.view,n.slice(t[3],t[5]),u),l!=null&&(o+=l)}else o+=this.renderTokens(t[4],e,r,n,i);return o}};yt.prototype.renderInverted=function(t,e,r,n,i){var s=e.lookup(t[1]);if(!s||qn(s)&&s.length===0)return this.renderTokens(t[4],e,r,n,i)};yt.prototype.indentPartial=function(t,e,r){for(var n=e.replace(/[^ \t]/g,""),i=t.split(`
|
|
18
18
|
`),s=0;s<i.length;s++)i[s].length&&(s>0||!r)&&(i[s]=n+i[s]);return i.join(`
|
|
19
|
-
`)};ht.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=Kc(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],c=t[5],u=t[4],f=s;c==0&&u&&(f=this.indentPartial(s,u,o));var m=this.parse(f,i);return this.renderTokens(m,e,r,f,n)}}};ht.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};ht.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||kt.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===kt.escape?String(i):n(i)};ht.prototype.rawValue=function(t){return t[1]};ht.prototype.getConfigTags=function(t){return qn(t)?t:t&&typeof t=="object"?t.tags:void 0};ht.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!qn(t))return t.escape};var kt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Zi.templateCache=t},get templateCache(){return Zi.templateCache}},Zi=new ht;kt.clearCache=function(){return Zi.clearCache()};kt.parse=function(t,e){return Zi.parse(t,e)};kt.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Nh(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Zi.render(t,e,r,n)};kt.escape=Mh;kt.Scanner=eo;kt.Context=Yn;kt.Writer=ht;var gt=kt,kp=Qt(Mp()),At=class Un{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new kp.default;constructor(){}static get(){return Un._instance||(Un._instance=new Un),Un._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Un.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Un.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return this.parser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=Un.get().getWidth(),c=Un.get().getHeight();r&&(o=o?Math.min(o,r):r,c=c?Math.min(c,r):r),c&&(o-=s.getHorizontal(),c-=s.getVertical(),o/c<n/i?this.scalingFactor=o/n:this.scalingFactor=c/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},ne=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart"},Jc=Qt(Hp());function Kn(t){return Jc.default.createInstance({name:"lc",storeName:t,driver:Jc.default.LOCALSTORAGE})}var zr=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},ct=class extends zr{static storeName="ses";static{this.storage=Kn(this.storeName)}},Ne=class extends zr{static storeName="usr";static{this.storage=Kn(this.storeName)}},fe=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=t}},Ae=class{static COOEE_URL_PREFIX="?from=cooee";static isShopify(){return!!window.Shopify}static getShopName(){if(this.isShopify())return window.Shopify.shop?.split(".")?.[0]}static getPageName(){if(!this.isShopify())return;let t=new URL(window.location.href).pathname.slice(1).split("/"),e=t[0];if(e==="")return"home";if(e==="collections")return t[2]==="products"?"product":"collection";if(e==="products")return"product";if(e==="cart")return"cart";if(location.href.includes("thank_you"))return"thank_you"}static getProductSlug(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(t){return this.getRootPrefix()+t+this.COOEE_URL_PREFIX}},Xn=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},ge=class ep{static CURRENT;token;items;total_price;original_total_price;currency;item_count;attributes;lock=new Xn;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new ep),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ne.set(ne.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await ct.get(ne.ID),r=await Ne.get(ne.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){w.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};w.debug("Updating Shopify cart with attributes:",n);let i=Ae.getCartURL("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();w.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,fe.get().currencyCode=this.currency,w.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return w.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){w.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,properties:n.properties},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){w.debug("Not fetching cart");return}w.debug("Fetching cart");let r=Ae.getCartURL("cart.js"),n=await(await fetch(r)).json();this.update(n)}},os=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ft=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},se=class{static tz;static isValidURL(t){try{return new URL(t)}catch{return}}static isNull(t){return!t||t==="null"||t==="undefined"}static removeFromArray(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}static formatCurrency(t,e){if(t==0&&e)return"Free";let r=fe.get(),n=He.get(),i=r.shopCurrencyCode??n.currency,s=r.currencyCode,o=n.money?.format??r.moneyFormat,c;return o&&i===s?c=os.format(t*100,o):(c=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(t),c=c.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))),c}static formatNumber(t){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(t)}static getLang(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}static getTimezone(){if(this.tz)return this.tz;try{return this.tz=Intl.DateTimeFormat().resolvedOptions().timeZone,this.tz}catch{return""}}static documentReady(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}static onDocumentLoaded(t){document.readyState==="complete"?t():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&t()})}static showSnackbar(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}static async retrySelectorForElements(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await Ft.sleep(s),i=r.querySelectorAll(t),i.length)return w.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;w.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return w.warn(`Max attempts reached. Element not found with ${t}.`),i}static async retrySelector(t,e=10,r=document){return(await this.retrySelectorForElements(t,e,r)).item(0)}};function Jn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var It=class{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price}},ss=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},as=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=t.d}},Qc=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},dr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new ss(e))??[],this.link=t.link,this.price=new as(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,t.sellingPlans?.length&&(this.selectedSellingPlan=er(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Qc(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}},Tt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;selectedOrFirstVariant;selected=er(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=er(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),t.vars&&(this.vars=t.vars.map(e=>new dr(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new It({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}},cs=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Zc=class{enabled;constructor(t){this.enabled=t.enabled}},el=class extends Zc{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},ls=class{productQuantity;constructor(t){t??={},this.productQuantity=new el(t.productQuantity)}},nn=class{s;g;i;constructor(t){t.s&&(this.s=new Be(t.s)),t.g&&(this.g=new ro(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},no="a-f\\d",Vh=`#?[${no}]{3}[${no}]?`,zh=`#?[${no}]{6}([${no}]{2})?`,Yh=new RegExp(`[^#${no}]`,"gi"),qh=new RegExp(`^${Vh}$|^${zh}$`,"i");function tl(t,e={}){if(typeof t!="string"||Yh.test(t)||!qh.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,s=n>>8&255,o=n&255,c=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,c];if(e.format==="css"){let u=c===1?"":` / ${Number((c*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${u})`}return{red:i,green:s,blue:o,alpha:c}}var Be=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return tl(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},on=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new Be(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return $p[this.s??1]}},$p=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))($p||{}),ro=class op{static DEFAULT_FALLBACK=new Be({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Be(e.c)),e.fb&&(this.fb=new Be(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??op.DEFAULT_FALLBACK}},io=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new Be(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},Ar=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}},sn=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},Ot=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new nn(t.bg)),t.br&&(this.br=new on(t.br)),t.shd&&(this.shd=new io(t.shd)),t.spc&&(this.spc=new Ar(t.spc)),this.trf=new sn(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Oe[this.t]}get click(){return this.clc}},Oe=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Oe||{}),an=class extends Ot{constructor(t){super(t)}},Or=class extends Ot{src;constructor(t){super(t),this.src=t.src}},Qn=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(Qn||{}),us=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new rl(e))}},rl=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}},ot=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return Qn[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new Be(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new Be(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new us(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},hr=class extends Ot{typo;constructor(t){super(t);let e=b(b({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new ot(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Yr=class extends hr{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},ps=class extends Ot{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},Zn=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),u=Math.floor(s%(1e3*60*60)/(1e3*60)),f=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:c,minutes:u,seconds:f})},1e3);return n}},ei=class extends hr{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Zn(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},fs=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new Be(t.c??{})}get text(){return this.txt}get color(){return this.c}},qr=class extends hr{ph;constructor(t){super(t),this.ph=new fs(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},ti=class extends qr{constructor(t){t??={},super(t)}},ri=class extends qr{},ni=class extends qr{},ii=class extends Or{},cn=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(cn||{}),ms=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}},oo=class extends Ot{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new ms(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new Ar({pl:A.IN_APP_DEFAULT_PADDING,pr:A.IN_APP_DEFAULT_PADDING,pt:A.IN_APP_DEFAULT_PADDING,pb:A.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},ds=class extends oo{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new ps(t.cont),this.mob=new oo(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Or(e)):e.t===2?this.elems.push(new Yr(e)):e.t===3?this.elems.push(new Yr(e)):e.t===100?this.elems.push(new an(e)):e.t===51?this.elems.push(new ri(e)):e.t===52?this.elems.push(new ni(e)):e.t===61?this.elems.push(new ei(e)):e.t===15||e.t===16?this.elems.push(new ti(e)):e.t===13&&this.elems.push(new ii(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}},oi=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},hs=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},gs=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},ys=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Ar(t.spc),t.size&&(this.size=new gs(t.size)),t.bg&&(this.bg=new nn(t.bg)),t.br&&(this.br=new on(t.br)),t.typo&&(this.typo=new ot(t.typo)),t.lout&&(this.lout=new hs(t.lout)),t.flex&&(this.flex=new oi(t.flex))}},si=class{sm;lg;constructor(t){t??={},this.sm=new ys(t.sm),this.lg=new ys(t.lg)}},tt=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new si(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Oe[this.t]}},ze=class extends tt{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},ln=class extends ze{constructor(t,e){super(t,e??3)}},ai=class extends tt{value;constructor(t){super(6,t),t??={},this.value=t.value}},ci=class extends ze{constructor(t=15,e){super(e,t)}},vs=class extends tt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new Be(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},jp=Qt(tn()),nl=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new Be(t.color)}},il=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new Be(t.color)}},so=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new il(t.navigation),this.pagination=new nl(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},_s=class extends tt{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Pt.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new so(t.conf),this.allowedTypes=t.allowedTypes}},Es=class extends ze{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new Zn(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},Kr=class extends tt{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Pt.getParsedElement(e);r&&this.elems.push(r)})}},un=class extends tt{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},Pt=class Fp{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=Fp.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new ze(e);case 3:return new ln(e);case 6:return new ai(e);case 11:return new Ss(e);case 12:return new gr(e);case 61:return new Es(e);case 4:return new Kr(e);case 1:return new un(e);case 13:return new un(e,13);case 14:return new ze(e,14);case 15:case 16:return new ci(e.t,e);case 18:return new ln(e,18);case 62:return new _s(e);case 19:return new vs(e);default:jp.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}},gr=class extends tt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=Pt.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new ai(t.cBox)),this.elems.push(new un(t.img,13));let e=new ze(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new ze(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new ze(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new si(r.style),n.style.lg.typo=new ot(Z(b({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new ot(Z(b({},n.style.sm.typo),{td:"line-through"})));let i=new Kr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Pt.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new ci(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new ln(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new ze(t.symbol))}},Ss=class extends tt{conf;prod;constructor(t){super(11,t),t??={},this.conf=new ol(t.conf),this.prod=new gr(t.prod)}},bs=class extends so{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},ol=class{lg;sm;constructor(t){t??={},this.lg=new bs(t.lg),this.sm=new bs(t.sm)}},ws=class extends Kr{constructor(t){super(t)}},li=class{cont;elems=[];constructor(t){t=t??{},this.cont=new ws(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Pt.getParsedElement(t);return e&&this.elems.push(e),e}},sl=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(t){this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new It(e))}},Is=class{layout;milestones;constructor(t){this.layout=t.layout??Cc.ICONS,this.milestones=t.milestones?.map(e=>new sl(e))??[]}},Ts=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},al=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===zi.EXCLUSION}isABTesting(){return this.contentType===zi.ABTESTING}isSingleContent(){return this.contentType===zi.SINGLE}},Lt=class bd extends al{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;bundleConfig;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;discountData=er({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=fe.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new li(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new It(r)),this.items=e.items?.map(r=>new Tt(r))??[],this.nonMutableItems=e.items?.map(r=>new Tt(r))??[],this.collections=e.collections?.map(r=>new cs(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new ls(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new Is(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Ts(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Tt(e.bundleFrom))}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===ur.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Yi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Yi.PAGE_EMBED}isProgressBar(){return this.objective===ur.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===ur.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===ur.CART_RECOVERY}isProductPromotion(){return this.objective===ur.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===ur.BYOB}isShoppableVideo(){return this.objective===ur.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let u=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:u.mID,image:n.variantImage,price:se.formatCurrency(u.price.d),comparePrice:se.formatCurrency(u.price.cmp),quantity:n.quantity},s={quantity:u.quantity}}let o={productCount:ge.getCurrent().item_count},c=gt.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(c=c.replace(new RegExp(A.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new ds(JSON.parse(c))}calculateDiscountData(e,r){let n=jn.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i={actualPrice:n,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(i);return}if([pr.UNIQUE_FLAT_ITEMS,pr.STATIC].includes(this.discount.type)&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100;else if(this.discount.type===pr.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)i.discountAmount=i.actualPrice-this.discount.values[0],i.discountPercentage=i.discountAmount/i.actualPrice*100;else if(this.discount.type===pr.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((o,c)=>c.selectedOrFirstVariant.value.price.d-o.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.price.effective=0,i.discountAmount=s.selectedOrFirstVariant.value.price.d,i.discountPercentage=i.discountAmount/i.actualPrice*100}i.discountedPrice=i.actualPrice-i.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(i)}getPrivateAttributesForLineItem(){return He.get().skipItemAttribute?{}:{_via:"Cooee",[A.CAMPAIGN_ATTRIBUTE]:this.shortID,_letscooee_content:this.contentID}}isBundleDiscount(){return[pr.UNIQUE_FIXED_ITEMS,pr.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===Yi.CART_EMBED&&this.objective===ur.BUNDLE_AND_UPSELL}hasSwiperElement(){let e=this.widget?.elems.find(n=>bd.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=At.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:se.formatNumber(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map(n=>{r[n]=se.formatCurrency(e[n])}),r}};function Xh(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Jh=tg,Qh=ng,Zh=sg,vr=[],$t=[],eg=typeof Uint8Array<"u"?Uint8Array:Array,cl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,Wp=cl.length;pn<Wp;++pn)vr[pn]=cl[pn],$t[cl.charCodeAt(pn)]=pn;var pn,Wp;$t[45]=62;$t[95]=63;function sf(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tg(t){var e=sf(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rg(t,e,r){return(e+r)*3/4-r}function ng(t){var e,r=sf(t),n=r[0],i=r[1],s=new eg(rg(t,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=$t[t.charCodeAt(u)]<<18|$t[t.charCodeAt(u+1)]<<12|$t[t.charCodeAt(u+2)]<<6|$t[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=$t[t.charCodeAt(u)]<<2|$t[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=$t[t.charCodeAt(u)]<<10|$t[t.charCodeAt(u+1)]<<4|$t[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function ig(t){return vr[t>>18&63]+vr[t>>12&63]+vr[t>>6&63]+vr[t&63]}function og(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(ig(n));return i.join("")}function sg(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(og(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(vr[e>>2]+vr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(vr[e>>10]+vr[e>>4&63]+vr[e<<2&63]+"=")),i.join("")}var ll={byteLength:Jh,toByteArray:Qh,fromByteArray:Zh},ag=function(t,e,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,f=u>>1,m=-7,h=r?i-1:0,v=r?-1:1,_=t[e+h];for(h+=v,s=_&(1<<-m)-1,_>>=-m,m+=c;m>0;s=s*256+t[e+h],h+=v,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+t[e+h],h+=v,m-=8);if(s===0)s=1-f;else{if(s===u)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-f}return(_?-1:1)*o*Math.pow(2,s-n)},cg=function(t,e,r,n,i,s){var o,c,u,f=s*8-i-1,m=(1<<f)-1,h=m>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,g=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?e+=v/u:e+=v*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=m?(c=0,o=m):o+h>=1?(c=(e*u-1)*Math.pow(2,i),o=o+h):(c=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+_]=c&255,_+=g,c/=256,i-=8);for(o=o<<i|c,f+=i;f>0;t[r+_]=o&255,_+=g,o/=256,f-=8);t[r+_-g]|=y*128},ui={read:ag,write:cg},Ds=Xh(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function i(){try{var a=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(a,l),a.foo()===42}catch{return!1}}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}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var l=new Uint8Array(a);return Object.setPrototypeOf(l,o.prototype),l}function o(a,l,p){if(typeof a=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(a)}return c(a,l,p)}o.poolSize=8192;function c(a,l,p){if(typeof a=="string")return h(a,l);if(ArrayBuffer.isView(a))return _(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(Le(a,ArrayBuffer)||a&&Le(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Le(a,SharedArrayBuffer)||a&&Le(a.buffer,SharedArrayBuffer)))return g(a,l,p);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var I=a.valueOf&&a.valueOf();if(I!=null&&I!==a)return o.from(I,l,p);var N=y(a);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),l,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,l,p){return c(a,l,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function f(a,l,p){return u(a),a<=0?s(a):l!==void 0?typeof p=="string"?s(a).fill(l,p):s(a).fill(l):s(a)}o.alloc=function(a,l,p){return f(a,l,p)};function m(a){return u(a),s(a<0?0:C(a)|0)}o.allocUnsafe=function(a){return m(a)},o.allocUnsafeSlow=function(a){return m(a)};function h(a,l){if((typeof l!="string"||l==="")&&(l="utf8"),!o.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var p=H(a,l)|0,I=s(p),N=I.write(a,l);return N!==p&&(I=I.slice(0,N)),I}function v(a){for(var l=a.length<0?0:C(a.length)|0,p=s(l),I=0;I<l;I+=1)p[I]=a[I]&255;return p}function _(a){if(Le(a,Uint8Array)){var l=new Uint8Array(a);return g(l.buffer,l.byteOffset,l.byteLength)}return v(a)}function g(a,l,p){if(l<0||a.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<l+(p||0))throw new RangeError('"length" is outside of buffer bounds');var I;return l===void 0&&p===void 0?I=new Uint8Array(a):p===void 0?I=new Uint8Array(a,l):I=new Uint8Array(a,l,p),Object.setPrototypeOf(I,o.prototype),I}function y(a){if(o.isBuffer(a)){var l=C(a.length)|0,p=s(l);return p.length===0||a.copy(p,0,0,l),p}if(a.length!==void 0)return typeof a.length!="number"||Wr(a.length)?s(0):v(a);if(a.type==="Buffer"&&Array.isArray(a.data))return v(a.data)}function C(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function O(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,l){if(Le(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),Le(l,Uint8Array)&&(l=o.from(l,l.offset,l.byteLength)),!o.isBuffer(a)||!o.isBuffer(l))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===l)return 0;for(var p=a.length,I=l.length,N=0,L=Math.min(p,I);N<L;++N)if(a[N]!==l[N]){p=a[N],I=l[N];break}return p<I?-1:I<p?1:0},o.isEncoding=function(a){switch(String(a).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(a,l){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var p;if(l===void 0)for(l=0,p=0;p<a.length;++p)l+=a[p].length;var I=o.allocUnsafe(l),N=0;for(p=0;p<a.length;++p){var L=a[p];if(Le(L,Uint8Array))N+L.length>I.length?o.from(L).copy(I,N):Uint8Array.prototype.set.call(I,L,N);else if(o.isBuffer(L))L.copy(I,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=L.length}return I};function H(a,l){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||Le(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var p=a.length,I=arguments.length>2&&arguments[2]===!0;if(!I&&p===0)return 0;for(var N=!1;;)switch(l){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return kn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ji(a).length;default:if(N)return I?-1:kn(a).length;l=(""+l).toLowerCase(),N=!0}}o.byteLength=H;function R(a,l,p){var I=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,l>>>=0,p<=l))return"";for(a||(a="utf8");;)switch(a){case"hex":return De(this,l,p);case"utf8":case"utf-8":return me(this,l,p);case"ascii":return be(this,l,p);case"latin1":case"binary":return Ut(this,l,p);case"base64":return Jt(this,l,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,l,p);default:if(I)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),I=!0}}o.prototype._isBuffer=!0;function k(a,l,p){var I=a[l];a[l]=a[p],a[p]=I}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var l=0;l<a;l+=2)k(this,l,l+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var l=0;l<a;l+=4)k(this,l,l+3),k(this,l+1,l+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var l=0;l<a;l+=8)k(this,l,l+7),k(this,l+1,l+6),k(this,l+2,l+5),k(this,l+3,l+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?me(this,0,a):R.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",l=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,l).replace(/(.{2})/g,"$1 ").trim(),this.length>l&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,l,p,I,N){if(Le(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(l===void 0&&(l=0),p===void 0&&(p=a?a.length:0),I===void 0&&(I=0),N===void 0&&(N=this.length),l<0||p>a.length||I<0||N>this.length)throw new RangeError("out of range index");if(I>=N&&l>=p)return 0;if(I>=N)return-1;if(l>=p)return 1;if(l>>>=0,p>>>=0,I>>>=0,N>>>=0,this===a)return 0;for(var L=N-I,W=p-l,te=Math.min(L,W),wt=this.slice(I,N),Dt=a.slice(l,p),le=0;le<te;++le)if(wt[le]!==Dt[le]){L=wt[le],W=Dt[le];break}return L<W?-1:W<L?1:0};function V(a,l,p,I,N){if(a.length===0)return-1;if(typeof p=="string"?(I=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Wr(p)&&(p=N?0:a.length-1),p<0&&(p=a.length+p),p>=a.length){if(N)return-1;p=a.length-1}else if(p<0)if(N)p=0;else return-1;if(typeof l=="string"&&(l=o.from(l,I)),o.isBuffer(l))return l.length===0?-1:Mt(a,l,p,I,N);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(a,l,p):Uint8Array.prototype.lastIndexOf.call(a,l,p):Mt(a,[l],p,I,N);throw new TypeError("val must be string, number or Buffer")}function Mt(a,l,p,I,N){var L=1,W=a.length,te=l.length;if(I!==void 0&&(I=String(I).toLowerCase(),I==="ucs2"||I==="ucs-2"||I==="utf16le"||I==="utf-16le")){if(a.length<2||l.length<2)return-1;L=2,W/=2,te/=2,p/=2}function wt(J,ie){return L===1?J[ie]:J.readUInt16BE(ie*L)}var Dt;if(N){var le=-1;for(Dt=p;Dt<W;Dt++)if(wt(a,Dt)===wt(l,le===-1?0:Dt-le)){if(le===-1&&(le=Dt),Dt-le+1===te)return le*L}else le!==-1&&(Dt-=Dt-le),le=-1}else for(p+te>W&&(p=W-te),Dt=p;Dt>=0;Dt--){for(var z=!0,ft=0;ft<te;ft++)if(wt(a,Dt+ft)!==wt(l,ft)){z=!1;break}if(z)return Dt}return-1}o.prototype.includes=function(a,l,p){return this.indexOf(a,l,p)!==-1},o.prototype.indexOf=function(a,l,p){return V(this,a,l,p,!0)},o.prototype.lastIndexOf=function(a,l,p){return V(this,a,l,p,!1)};function de(a,l,p,I){p=Number(p)||0;var N=a.length-p;I?(I=Number(I),I>N&&(I=N)):I=N;var L=l.length;I>L/2&&(I=L/2);for(var W=0;W<I;++W){var te=parseInt(l.substr(W*2,2),16);if(Wr(te))return W;a[p+W]=te}return W}function B(a,l,p,I){return Mn(kn(l,a.length-p),a,p,I)}function at(a,l,p,I){return Mn(Hi(l),a,p,I)}function Y(a,l,p,I){return Mn(ji(l),a,p,I)}function st(a,l,p,I){return Mn(Wi(l,a.length-p),a,p,I)}o.prototype.write=function(a,l,p,I){if(l===void 0)I="utf8",p=this.length,l=0;else if(p===void 0&&typeof l=="string")I=l,p=this.length,l=0;else if(isFinite(l))l=l>>>0,isFinite(p)?(p=p>>>0,I===void 0&&(I="utf8")):(I=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var N=this.length-l;if((p===void 0||p>N)&&(p=N),a.length>0&&(p<0||l<0)||l>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");for(var L=!1;;)switch(I){case"hex":return de(this,a,l,p);case"utf8":case"utf-8":return B(this,a,l,p);case"ascii":case"latin1":case"binary":return at(this,a,l,p);case"base64":return Y(this,a,l,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,a,l,p);default:if(L)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),L=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Jt(a,l,p){return l===0&&p===a.length?ll.fromByteArray(a):ll.fromByteArray(a.slice(l,p))}function me(a,l,p){p=Math.min(a.length,p);for(var I=[],N=l;N<p;){var L=a[N],W=null,te=L>239?4:L>223?3:L>191?2:1;if(N+te<=p){var wt,Dt,le,z;switch(te){case 1:L<128&&(W=L);break;case 2:wt=a[N+1],(wt&192)===128&&(z=(L&31)<<6|wt&63,z>127&&(W=z));break;case 3:wt=a[N+1],Dt=a[N+2],(wt&192)===128&&(Dt&192)===128&&(z=(L&15)<<12|(wt&63)<<6|Dt&63,z>2047&&(z<55296||z>57343)&&(W=z));break;case 4:wt=a[N+1],Dt=a[N+2],le=a[N+3],(wt&192)===128&&(Dt&192)===128&&(le&192)===128&&(z=(L&15)<<18|(wt&63)<<12|(Dt&63)<<6|le&63,z>65535&&z<1114112&&(W=z))}}W===null?(W=65533,te=1):W>65535&&(W-=65536,I.push(W>>>10&1023|55296),W=56320|W&1023),I.push(W),N+=te}return xe(I)}var pe=4096;function xe(a){var l=a.length;if(l<=pe)return String.fromCharCode.apply(String,a);for(var p="",I=0;I<l;)p+=String.fromCharCode.apply(String,a.slice(I,I+=pe));return p}function be(a,l,p){var I="";p=Math.min(a.length,p);for(var N=l;N<p;++N)I+=String.fromCharCode(a[N]&127);return I}function Ut(a,l,p){var I="";p=Math.min(a.length,p);for(var N=l;N<p;++N)I+=String.fromCharCode(a[N]);return I}function De(a,l,p){var I=a.length;(!l||l<0)&&(l=0),(!p||p<0||p>I)&&(p=I);for(var N="",L=l;L<p;++L)N+=is[a[L]];return N}function dt(a,l,p){for(var I=a.slice(l,p),N="",L=0;L<I.length-1;L+=2)N+=String.fromCharCode(I[L]+I[L+1]*256);return N}o.prototype.slice=function(a,l){var p=this.length;a=~~a,l=l===void 0?p:~~l,a<0?(a+=p,a<0&&(a=0)):a>p&&(a=p),l<0?(l+=p,l<0&&(l=0)):l>p&&(l=p),l<a&&(l=a);var I=this.subarray(a,l);return Object.setPrototypeOf(I,o.prototype),I};function Q(a,l,p){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+l>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=this[a],N=1,L=0;++L<l&&(N*=256);)I+=this[a+L]*N;return I},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=this[a+--l],N=1;l>0&&(N*=256);)I+=this[a+--l]*N;return I},o.prototype.readUint8=o.prototype.readUInt8=function(a,l){return a=a>>>0,l||Q(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,l){return a=a>>>0,l||Q(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,l){return a=a>>>0,l||Q(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=this[a],N=1,L=0;++L<l&&(N*=256);)I+=this[a+L]*N;return N*=128,I>=N&&(I-=Math.pow(2,8*l)),I},o.prototype.readIntBE=function(a,l,p){a=a>>>0,l=l>>>0,p||Q(a,l,this.length);for(var I=l,N=1,L=this[a+--I];I>0&&(N*=256);)L+=this[a+--I]*N;return N*=128,L>=N&&(L-=Math.pow(2,8*l)),L},o.prototype.readInt8=function(a,l){return a=a>>>0,l||Q(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,l){a=a>>>0,l||Q(a,2,this.length);var p=this[a]|this[a+1]<<8;return p&32768?p|4294901760:p},o.prototype.readInt16BE=function(a,l){a=a>>>0,l||Q(a,2,this.length);var p=this[a+1]|this[a]<<8;return p&32768?p|4294901760:p},o.prototype.readInt32LE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),ui.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,l){return a=a>>>0,l||Q(a,4,this.length),ui.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,l){return a=a>>>0,l||Q(a,8,this.length),ui.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,l){return a=a>>>0,l||Q(a,8,this.length),ui.read(this,a,!1,52,8)};function we(a,l,p,I,N,L){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>N||l<L)throw new RangeError('"value" argument is out of bounds');if(p+I>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,l,p,I){if(a=+a,l=l>>>0,p=p>>>0,!I){var N=Math.pow(2,8*p)-1;we(this,a,l,p,N,0)}var L=1,W=0;for(this[l]=a&255;++W<p&&(L*=256);)this[l+W]=a/L&255;return l+p},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,l,p,I){if(a=+a,l=l>>>0,p=p>>>0,!I){var N=Math.pow(2,8*p)-1;we(this,a,l,p,N,0)}var L=p-1,W=1;for(this[l+L]=a&255;--L>=0&&(W*=256);)this[l+L]=a/W&255;return l+p},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,1,255,0),this[l]=a&255,l+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,65535,0),this[l]=a&255,this[l+1]=a>>>8,l+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,65535,0),this[l]=a>>>8,this[l+1]=a&255,l+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,4294967295,0),this[l+3]=a>>>24,this[l+2]=a>>>16,this[l+1]=a>>>8,this[l]=a&255,l+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,4294967295,0),this[l]=a>>>24,this[l+1]=a>>>16,this[l+2]=a>>>8,this[l+3]=a&255,l+4},o.prototype.writeIntLE=function(a,l,p,I){if(a=+a,l=l>>>0,!I){var N=Math.pow(2,8*p-1);we(this,a,l,p,N-1,-N)}var L=0,W=1,te=0;for(this[l]=a&255;++L<p&&(W*=256);)a<0&&te===0&&this[l+L-1]!==0&&(te=1),this[l+L]=(a/W>>0)-te&255;return l+p},o.prototype.writeIntBE=function(a,l,p,I){if(a=+a,l=l>>>0,!I){var N=Math.pow(2,8*p-1);we(this,a,l,p,N-1,-N)}var L=p-1,W=1,te=0;for(this[l+L]=a&255;--L>=0&&(W*=256);)a<0&&te===0&&this[l+L+1]!==0&&(te=1),this[l+L]=(a/W>>0)-te&255;return l+p},o.prototype.writeInt8=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,1,127,-128),a<0&&(a=255+a+1),this[l]=a&255,l+1},o.prototype.writeInt16LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,32767,-32768),this[l]=a&255,this[l+1]=a>>>8,l+2},o.prototype.writeInt16BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,2,32767,-32768),this[l]=a>>>8,this[l+1]=a&255,l+2},o.prototype.writeInt32LE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,2147483647,-2147483648),this[l]=a&255,this[l+1]=a>>>8,this[l+2]=a>>>16,this[l+3]=a>>>24,l+4},o.prototype.writeInt32BE=function(a,l,p){return a=+a,l=l>>>0,p||we(this,a,l,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[l]=a>>>24,this[l+1]=a>>>16,this[l+2]=a>>>8,this[l+3]=a&255,l+4};function cr(a,l,p,I,N,L){if(p+I>a.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function jr(a,l,p,I,N){return l=+l,p=p>>>0,N||cr(a,l,p,4),ui.write(a,l,p,I,23,4),p+4}o.prototype.writeFloatLE=function(a,l,p){return jr(this,a,l,!0,p)},o.prototype.writeFloatBE=function(a,l,p){return jr(this,a,l,!1,p)};function ke(a,l,p,I,N){return l=+l,p=p>>>0,N||cr(a,l,p,8),ui.write(a,l,p,I,52,8),p+8}o.prototype.writeDoubleLE=function(a,l,p){return ke(this,a,l,!0,p)},o.prototype.writeDoubleBE=function(a,l,p){return ke(this,a,l,!1,p)},o.prototype.copy=function(a,l,p,I){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(p||(p=0),!I&&I!==0&&(I=this.length),l>=a.length&&(l=a.length),l||(l=0),I>0&&I<p&&(I=p),I===p||a.length===0||this.length===0)return 0;if(l<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),a.length-l<I-p&&(I=a.length-l+p);var N=I-p;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(l,p,I):Uint8Array.prototype.set.call(a,this.subarray(p,I),l),N},o.prototype.fill=function(a,l,p,I){if(typeof a=="string"){if(typeof l=="string"?(I=l,l=0,p=this.length):typeof p=="string"&&(I=p,p=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!o.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(a.length===1){var N=a.charCodeAt(0);(I==="utf8"&&N<128||I==="latin1")&&(a=N)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(l<0||this.length<l||this.length<p)throw new RangeError("Out of range index");if(p<=l)return this;l=l>>>0,p=p===void 0?this.length:p>>>0,a||(a=0);var L;if(typeof a=="number")for(L=l;L<p;++L)this[L]=a;else{var W=o.isBuffer(a)?a:o.from(a,I),te=W.length;if(te===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(L=0;L<p-l;++L)this[L+l]=W[L%te]}return this};var en=/[^+/0-9A-Za-z-_]/g;function Hn(a){if(a=a.split("=")[0],a=a.trim().replace(en,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function kn(a,l){l=l||1/0;for(var p,I=a.length,N=null,L=[],W=0;W<I;++W){if(p=a.charCodeAt(W),p>55295&&p<57344){if(!N){if(p>56319){(l-=3)>-1&&L.push(239,191,189);continue}else if(W+1===I){(l-=3)>-1&&L.push(239,191,189);continue}N=p;continue}if(p<56320){(l-=3)>-1&&L.push(239,191,189),N=p;continue}p=(N-55296<<10|p-56320)+65536}else N&&(l-=3)>-1&&L.push(239,191,189);if(N=null,p<128){if((l-=1)<0)break;L.push(p)}else if(p<2048){if((l-=2)<0)break;L.push(p>>6|192,p&63|128)}else if(p<65536){if((l-=3)<0)break;L.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((l-=4)<0)break;L.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return L}function Hi(a){for(var l=[],p=0;p<a.length;++p)l.push(a.charCodeAt(p)&255);return l}function Wi(a,l){for(var p,I,N,L=[],W=0;W<a.length&&!((l-=2)<0);++W)p=a.charCodeAt(W),I=p>>8,N=p%256,L.push(N),L.push(I);return L}function ji(a){return ll.toByteArray(Hn(a))}function Mn(a,l,p,I){for(var N=0;N<I&&!(N+p>=l.length||N>=a.length);++N)l[N+p]=a[N];return N}function Le(a,l){return a instanceof l||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===l.name}function Wr(a){return a!==a}var is=function(){for(var a="0123456789abcdef",l=new Array(256),p=0;p<16;++p)for(var I=p*16,N=0;N<16;++N)l[I+N]=a[p]+a[N];return l}()}),Ee=Ds.Buffer;Ds.SlowBuffer;Ds.INSPECT_MAX_BYTES;Ds.kMaxLength;var dl=function(t,e){return dl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},dl(t,e)};function Rs(t,e){dl(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var mn=function(t){Rs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),$e=function(t){Rs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function xs(t){return t&&t.Math==Math&&t}function af(){return xs(typeof globalThis=="object"&&globalThis)||xs(typeof window=="object"&&window)||xs(typeof self=="object"&&self)||xs(typeof global=="object"&&global)||Function("return this")()}function lg(){var t=af();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var ug=function(t){var e=lg()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var r=Ee.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},pg=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ee.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ee.alloc(e))}:ug}},cf=pg();function fg(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function gl(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function mg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function dg(t){return uo(t)&&Object.prototype.toString.call(t)==="[object Date]"}function uo(t){return typeof t=="object"&&t!==null}function Ns(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Cs(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(fg(t))return Ee.from(t);throw new $e("Must use either Buffer or TypedArray")}var hg=/^(?:[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,lf=function(t){return typeof t=="string"&&hg.test(t)},hl=function(t){if(!lf(t))throw new $e('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 Ee.from(e,"hex")},Gp=function(t,e){return e===void 0&&(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")},cI=Math.pow(2,63)-1,lI=-Math.pow(2,63),gg=Math.pow(2,53),yg=-Math.pow(2,53),uf=4,dn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new $e("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ee.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ee.from(e,"binary"):Array.isArray(e)?this.buffer=Ee.from(e):this.buffer=Cs(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new $e("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new $e("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new $e("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ee.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ee.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Cs(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?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(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Vp(this.buffer.slice(0,this.position));throw new mn('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,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ee.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ee.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=hl(e.$uuid)),!n)throw new $e("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===uf?new Vp(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.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(dn.prototype,"_bsontype",{value:"Binary"});var ul=16,Vp=function(t){Rs(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=Ee.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===ul)i=Cs(r);else if(typeof r=="string")i=hl(r);else throw new $e("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).");return n=t.call(this,i,uf)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Gp(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=Gp(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new dn(this.id,dn.SUBTYPE_UUID)},e.generate=function(){var r=cf(ul);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ee.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?lf(r):gl(r)?r.length!==ul?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=hl(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(dn),As=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}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 e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(As.prototype,"_bsontype",{value:"Code"});function vg(t){return uo(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var co=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(co.prototype,"_bsontype",{value:"DBRef"});var Ht=void 0;try{Ht=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{}var zp=65536,_g=1<<24,fi=zp*zp,pf=fi*fi,Yp=pf/2,qp={},Kp={},K=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=Kp[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Kp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=qp[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(qp[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=pf)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Yp)return t.MIN_VALUE;if(e+1>=Yp)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%fi|0,e/fi|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,c=0;c<e.length;c+=8){var u=Math.min(8,e.length-c),f=parseInt(e.substring(c,c+u),n);if(u<8){var m=t.fromNumber(Math.pow(n,u));o=o.mul(m).add(t.fromNumber(f))}else o=o.mul(s),o=o.add(t.fromNumber(f))}return o.unsigned=r,o},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){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,r)},t.fromBytesBE=function(e,r){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],r)},t.isLong=function(e){return uo(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,c=e.high&65535,u=e.low>>>16,f=e.low&65535,m=0,h=0,v=0,_=0;return _+=s+f,v+=_>>>16,_&=65535,v+=i+u,h+=v>>>16,v&=65535,h+=n+c,m+=h>>>16,h&=65535,m+=r+o,m&=65535,t.fromBits(v<<16|_,m<<16|h,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 r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?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(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Ht){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Ht.div_u:Ht.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ht.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else 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();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),u=c<=48?1:Math.pow(2,c-48),f=t.fromNumber(n),m=f.mul(e);m.isNegative()||m.gt(i);)n-=u,f=t.fromNumber(n,this.unsigned),m=f.mul(e);f.isZero()&&(f=t.ONE),s=s.add(f),i=i.sub(m)}return s},t.prototype.div=function(e){return this.divide(e)},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?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},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=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Ht){var r=(this.unsigned?Ht.rem_u:Ht.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ht.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Ht){var r=Ht.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Ht.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 n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,c=e.high>>>16,u=e.high&65535,f=e.low>>>16,m=e.low&65535,h=0,v=0,_=0,g=0;return g+=o*m,_+=g>>>16,g&=65535,_+=s*m,v+=_>>>16,_&=65535,_+=o*f,v+=_>>>16,_&=65535,v+=i*m,h+=v>>>16,v&=65535,v+=s*f,h+=v>>>16,v&=65535,v+=o*u,h+=v>>>16,v&=65535,h+=n*m+i*f+s*u+o*c,h&=65535,t.fromBits(_<<16|g,h<<16|v,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},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(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},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()),(e&=63)===0?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(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?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(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*fi+(this.low>>>0):this.high*fi+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,c="";;){var u=o.div(s),f=o.sub(u.mul(s)).toInt()>>>0,m=f.toString(e);if(o=u,o.isZero())return m+c;for(;m.length<6;)m="0"+m;c=""+m+c}},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(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},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(_g),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(K.prototype,"__isLong__",{value:!0});Object.defineProperty(K.prototype,"_bsontype",{value:"Long"});var Eg=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Sg=/^(\+|-)?(Infinity|inf)$/i,bg=/^(\+|-)?NaN$/i,ao=6111,pl=-6176,Xp=6176,wg=34,fl=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Jp=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Qp=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ig=/^([-+])?(\d+)?$/,Tg=31,Zp=16383,xg=30,Cg=31;function ef(t){return!isNaN(parseInt(t,10))}function Dg(t){var e=K.fromNumber(1e9),r=K.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new K(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Rg(t,e){if(!t&&!e)return{high:K.fromNumber(0),low:K.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new K(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new K(e.getLowBits(),0),o=r.multiply(i),c=r.multiply(s),u=n.multiply(i),f=n.multiply(s);return o=o.add(c.shiftRightUnsigned(32)),c=new K(c.getLowBits(),0).add(u).add(f.shiftRightUnsigned(32)),o=o.add(c.shiftRightUnsigned(32)),f=c.shiftLeft(32).add(new K(f.getLowBits(),0)),{high:o,low:f}}function Ng(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function pi(t,e){throw new $e('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var yl=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(gl(e)){if(e.byteLength!==16)throw new $e("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new $e("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,c=0,u=0,f=0,m=[0],h=0,v=0,_=0,g=0,y=0,C=0,O=new K(0,0),H=new K(0,0),R=0,k=0;if(e.length>=7e3)throw new $e(""+e+" not a valid Decimal128 string");var V=e.match(Eg),Mt=e.match(Sg),de=e.match(bg);if(!V&&!Mt&&!de||e.length===0)throw new $e(""+e+" not a valid Decimal128 string");if(V){var B=V[2],at=V[4],Y=V[5],st=V[6];at&&st===void 0&&pi(e,"missing exponent power"),at&&B===void 0&&pi(e,"missing exponent base"),at===void 0&&(Y||st)&&pi(e,"missing e before exponent")}if((e[k]==="+"||e[k]==="-")&&(r=e[k++]==="-"),!ef(e[k])&&e[k]!=="."){if(e[k]==="i"||e[k]==="I")return new t(Ee.from(r?Jp:Qp));if(e[k]==="N")return new t(Ee.from(fl))}for(;ef(e[k])||e[k]===".";){if(e[k]==="."){n&&pi(e,"contains multiple periods"),n=!0,k=k+1;continue}h<34&&(e[k]!=="0"||i)&&(i||(f=o),i=!0,m[v++]=parseInt(e[k],10),h=h+1),i&&(c=c+1),n&&(u=u+1),o=o+1,k=k+1}if(n&&!o)throw new $e(""+e+" not a valid Decimal128 string");if(e[k]==="e"||e[k]==="E"){var Jt=e.substr(++k).match(Ig);if(!Jt||!Jt[2])return new t(Ee.from(fl));y=parseInt(Jt[0],10),k=k+Jt[0].length}if(e[k])return new t(Ee.from(fl));if(_=0,!h)_=0,g=0,m[0]=0,c=1,h=1,s=0;else if(g=h-1,s=c,s!==1)for(;m[f+s-1]===0;)s=s-1;for(y<=u&&u-y>16384?y=pl:y=y-u;y>ao;){if(g=g+1,g-_>wg){var me=m.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}y=y-1}for(;y<pl||h<c;){if(g===0&&s<h){y=pl,s=0;break}if(h<c?c=c-1:g=g-1,y<ao)y=y+1;else{var me=m.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}}if(g-_+1<s){var pe=o;n&&(f=f+1,pe=pe+1),r&&(f=f+1,pe=pe+1);var xe=parseInt(e[f+g+1],10),be=0;if(xe>=5&&(be=1,xe===5)){for(be=m[g]%2===1?1:0,C=f+g+2;C<pe;C++)if(parseInt(e[C],10)){be=1;break}}if(be){for(var Ut=g;Ut>=0;Ut--)if(++m[Ut]>9&&(m[Ut]=0,Ut===0))if(y<ao)y=y+1,m[Ut]=1;else return new t(Ee.from(r?Jp:Qp))}}if(O=K.fromNumber(0),H=K.fromNumber(0),s===0)O=K.fromNumber(0),H=K.fromNumber(0);else if(g-_<17){var Ut=_;for(H=K.fromNumber(m[Ut++]),O=new K(0,0);Ut<=g;Ut++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(m[Ut]))}else{var Ut=_;for(O=K.fromNumber(m[Ut++]);Ut<=g-17;Ut++)O=O.multiply(K.fromNumber(10)),O=O.add(K.fromNumber(m[Ut]));for(H=K.fromNumber(m[Ut++]);Ut<=g;Ut++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(m[Ut]))}var De=Rg(O,K.fromString("100000000000000000"));De.low=De.low.add(H),Ng(De.low,H)&&(De.high=De.high.add(K.fromNumber(1))),R=y+Xp;var dt={low:K.fromNumber(0),high:K.fromNumber(0)};De.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(dt.high=dt.high.or(K.fromNumber(3).shiftLeft(61)),dt.high=dt.high.or(K.fromNumber(R).and(K.fromNumber(16383).shiftLeft(47))),dt.high=dt.high.or(De.high.and(K.fromNumber(0x7fffffffffff)))):(dt.high=dt.high.or(K.fromNumber(R&16383).shiftLeft(49)),dt.high=dt.high.or(De.high.and(K.fromNumber(562949953421311)))),dt.low=De.low,r&&(dt.high=dt.high.or(K.fromString("9223372036854775808")));var Q=Ee.alloc(16);return k=0,Q[k++]=dt.low.low&255,Q[k++]=dt.low.low>>8&255,Q[k++]=dt.low.low>>16&255,Q[k++]=dt.low.low>>24&255,Q[k++]=dt.low.high&255,Q[k++]=dt.low.high>>8&255,Q[k++]=dt.low.high>>16&255,Q[k++]=dt.low.high>>24&255,Q[k++]=dt.high.low&255,Q[k++]=dt.high.low>>8&255,Q[k++]=dt.high.low>>16&255,Q[k++]=dt.high.low>>24&255,Q[k++]=dt.high.high&255,Q[k++]=dt.high.high>>8&255,Q[k++]=dt.high.high>>16&255,Q[k++]=dt.high.high>>24&255,new t(Q)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,c,u={parts:[0,0,0,0]},f,m,h=[];s=0;var v=this.bytes,_=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,g=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,y=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,C=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24;s=0;var O={low:new K(_,g),high:new K(y,C)};O.high.lessThan(K.ZERO)&&h.push("-");var H=C>>26&Tg;if(H>>3===3){if(H===xg)return h.join("")+"Infinity";if(H===Cg)return"NaN";e=C>>15&Zp,c=8+(C>>14&1)}else c=C>>14&7,e=C>>17&Zp;var R=e-Xp;if(u.parts[0]=(C&16383)+((c&15)<<14),u.parts[1]=y,u.parts[2]=g,u.parts[3]=_,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)o=!0;else for(m=3;m>=0;m--){var k=0,V=Dg(u);if(u=V.quotient,k=V.rem.low,!!k)for(f=8;f>=0;f--)n[m*9+f]=k%10,k=Math.floor(k/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var Mt=r-1+R;if(Mt>=34||Mt<=-7||R>0){if(r>34)return h.push("".concat(0)),R>0?h.push("E+".concat(R)):R<0&&h.push("E".concat(R)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),Mt>0?h.push("+".concat(Mt)):h.push("".concat(Mt))}else if(R>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var de=r+R;if(de>0)for(var i=0;i<de;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");de++<0;)h.push("0");for(var i=0;i<r-Math.max(de-1,0);i++)h.push("".concat(n[s++]))}return h.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(yl.prototype,"_bsontype",{value:"Decimal128"});var Os=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(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(Os.prototype,"_bsontype",{value:"Double"});var Ps=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.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(Ps.prototype,"_bsontype",{value:"Int32"});var vl=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(vl.prototype,"_bsontype",{value:"MaxKey"});var _l=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(_l.prototype,"_bsontype",{value:"MinKey"});var Ag=new RegExp("^[0-9a-fA-F]{24}$"),fn=null,yr=Symbol("id"),Je=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new $e("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ee.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[yr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[yr]=r instanceof Ee?r:Cs(r);else if(typeof r=="string")if(r.length===12){var n=Ee.from(r);if(n.byteLength===12)this[yr]=n;else throw new $e("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Ag.test(r))this[yr]=Ee.from(r,"hex");else throw new $e("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new $e("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[yr]},set:function(e){this[yr]=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(e){this.id.writeUInt32BE(e,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){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ee.alloc(12);return n.writeUInt32BE(e,0),fn===null&&(fn=cf(5)),n[4]=fn[0],n[5]=fn[1],n[6]=fn[2],n[7]=fn[3],n[8]=fn[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[yr][11]===e[yr][11]&&this[yr].equals(e[yr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&gl(this.id))return e===Ee.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ee.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ee.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new $e("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ee.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{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(Math.random()*16777215),t}();Object.defineProperty(Je.prototype,"generate",{value:Ns(function(t){return Je.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Je.prototype,"getInc",{value:Ns(function(){return Je.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Je.prototype,"get_inc",{value:Ns(function(){return Je.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Je,"get_inc",{value:Ns(function(){return Je.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Je.prototype,"_bsontype",{value:"ObjectID"});function Og(t){return t.split("").sort().join("")}var lo=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Og(r??""),this.pattern.indexOf("\0")!==-1)throw new mn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new mn("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new mn("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new $e("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(lo.prototype,"_bsontype",{value:"BSONRegExp"});var El=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(El.prototype,"_bsontype",{value:"Symbol"});var Pg=K,ff=function(t){Rs(e,t);function e(r,n){var i=this;return i instanceof e?(K.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:uo(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(K.fromInt(r,!0))},e.fromNumber=function(r){return new e(K.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(K.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$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=K.MAX_UNSIGNED_VALUE,e}(Pg);function Lg(t){return uo(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var mf=2147483647,df=-2147483648,hf=9223372036854776e3,gf=-9223372036854776e3,Bg={$oid:Je,$binary:dn,$uuid:dn,$symbol:El,$numberInt:Ps,$numberDecimal:yl,$numberDouble:Os,$numberLong:K,$minKey:_l,$maxKey:vl,$regex:lo,$regularExpression:lo,$timestamp:ff};function yf(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=df&&t<=mf)return new Ps(t);if(t>=gf&&t<=hf)return K.fromNumber(t)}return new Os(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=Bg[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):K.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var c=Object.assign({},t);return t.$scope&&(c.$scope=yf(t.$scope)),As.fromExtendedJSON(t)}if(vg(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof co)return u;var f=Object.keys(u).filter(function(h){return h.startsWith("$")}),m=!0;if(f.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(m=!1)}),m)return co.fromExtendedJSON(u)}return t}function Ug(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Xr(r,e)}finally{e.seenObjects.pop()}})}function tf(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Xr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(O){return O.obj===t});if(r!==-1){var n=e.seenObjects.map(function(O){return O.propertyName}),i=n.slice(0,r).map(function(O){return"".concat(O," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(O){return"".concat(O," -> ")}).join(""),c=n[n.length-1],u=" ".repeat(i.length+s.length/2),f="-".repeat(o.length+(s.length+c.length)/2-1);throw new $e(`Converting circular structure to EJSON:
|
|
20
|
-
`+" ".concat(i).concat(s).concat(o).concat(
|
|
21
|
-
`)+" ".concat(u,"\\").concat(f,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Ug(t,e);if(t===void 0)return null;if(t instanceof Date||dg(t)){var m=t.getTime(),h=m>-1&&m<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:tf(t)}:e.relaxed&&h?{$date:tf(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var v=t>=df&&t<=mf,_=t>=gf&&t<=hf;if(v)return{$numberInt:t.toString()};if(_)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||mg(t)){var g=t.flags;if(g===void 0){var y=t.toString().match(/[gimuy]*$/);y&&(g=y[0])}var C=new lo(t.source,g);return C.toExtendedJSON(e)}return t!=null&&typeof t=="object"?kg(t,e):t}var Mg={Binary:function(t){return new dn(t.value(),t.sub_type)},Code:function(t){return new As(t.code,t.scope)},DBRef:function(t){return new co(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new yl(t.bytes)},Double:function(t){return new Os(t.value)},Int32:function(t){return new Ps(t.value)},Long:function(t){return K.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new vl},MinKey:function(){return new _l},ObjectID:function(t){return new Je(t)},ObjectId:function(t){return new Je(t)},BSONRegExp:function(t){return new lo(t.pattern,t.options)},Symbol:function(t){return new El(t.value)},Timestamp:function(t){return ff.fromBits(t.low,t.high)}};function kg(t,e){if(t==null||typeof t!="object")throw new mn("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var s=
|
|
19
|
+
`)};yt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=Kc(r)?r(t[1]):r[t[1]];if(s!=null){var o=t[6],l=t[5],u=t[4],f=s;l==0&&u&&(f=this.indentPartial(s,u,o));var m=this.parse(f,i);return this.renderTokens(m,e,r,f,n)}}};yt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};yt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||kt.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===kt.escape?String(i):n(i)};yt.prototype.rawValue=function(t){return t[1]};yt.prototype.getConfigTags=function(t){return qn(t)?t:t&&typeof t=="object"?t.tags:void 0};yt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!qn(t))return t.escape};var kt={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Zi.templateCache=t},get templateCache(){return Zi.templateCache}},Zi=new yt;kt.clearCache=function(){return Zi.clearCache()};kt.parse=function(t,e){return Zi.parse(t,e)};kt.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Nh(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Zi.render(t,e,r,n)};kt.escape=Mh;kt.Scanner=eo;kt.Context=Yn;kt.Writer=yt;var vt=kt,kp=Qt(Mp()),At=class Un{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new kp.default;constructor(){}static get(){return Un._instance||(Un._instance=new Un),Un._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===Un.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===Un.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}isMobile(){return this.parser.getDevice().type==="mobile"}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,s=e.spc,o=Un.get().getWidth(),l=Un.get().getHeight();r&&(o=o?Math.min(o,r):r,l=l?Math.min(l,r):r),l&&(o-=s.getHorizontal(),l-=s.getVertical(),o/l<n/i?this.scalingFactor=o/n:this.scalingFactor=l/i,this.scalingFactor=Math.min(this.scalingFactor,1))}getScalingFactor(){return this.scalingFactor}createElement(e){return this.doc.createElement(e)}appendChild(e,r){e.appendChild(r)}setStyles(e,r){Object.assign(e.style,r)}setStyle(e,r,n){if(r){if(!n){e.style.removeProperty(r);return}e.style.setProperty(r,n,"important")}}setAttribute(e,r,n){e.setAttribute(r,n)}removeInApp(e){let r=document.querySelector(`.${e.rootClassName}`);r&&r.parentElement.removeChild(r)}setParentContainer(e){this.parentContainer=e,this.parentContainer&&this.isParentNotBody()&&this.setStyle(this.parentContainer,"position","relative")}isParentNotBody(){return this.parentContainer!==document.body}},ie=class{static ID="id";static SESSION_LANDING_PAGE="landing";static SESSION_LAST_USED_TIME="lastUsedTime";static SESSION_SYNCED="synced";static APP_CONFIG="conf";static DEVICE_ID="did";static SDK_TOKEN="token";static FIRST_SEEN="firstSeen";static SESSION_NUMBER="sessionNumber";static GA_CLIENT_ID="gacid";static CURRENT_CART="cart"},Xc=Qt(Hp());function Kn(t){return Xc.default.createInstance({name:"lc",storeName:t,driver:Xc.default.LOCALSTORAGE})}var Vr=class{static storage;static async get(t,e){return await this.storage?.getItem(t)??e}static set(t,e){return this.storage?.setItem(t,e)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}},et=class extends Vr{static storeName="ses";static{this.storage=Kn(this.storeName)}},Ne=class extends Vr{static storeName="usr";static{this.storage=Kn(this.storeName)}},lt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price}},le=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(t){this._currencyCode=t}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(t){this.currentItem=new lt(t)}},Ae=class{static COOEE_URL_PREFIX="?from=cooee";static isShopify(){return!!window.Shopify}static getShopName(){if(this.isShopify())return window.Shopify.shop?.split(".")?.[0]}static getPageName(){if(!this.isShopify())return;let t=new URL(window.location.href).pathname.slice(1).split("/"),e=t[0];if(e==="")return"home";if(e==="collections")return t[2]==="products"?"product":"collection";if(e==="products")return"product";if(e==="cart")return"cart";if(location.href.includes("thank_you"))return"thank_you"}static getProductSlug(t){let e=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return e?e[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(t){return this.getRootPrefix()+t+this.COOEE_URL_PREFIX}},Jn=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},ge=class ep{static CURRENT;token;items;total_price;original_total_price;currency;item_count;attributes;lock=new Jn;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new ep),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ne.set(ie.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await et.get(ie.ID),r=await Ne.get(ie.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){w.debug("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}let n={letscooee_did:r,letscooee_sid:e,__letscooee_time:new Date().toLocaleString()};w.debug("Updating Shopify cart with attributes:",n);let i=Ae.getCartURL("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();w.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,le.get().currencyCode=this.currency,w.log("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return w.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){w.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,properties:n.properties},s=n.selling_plan_allocation?.selling_plan;if(!s){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:s.fixed_selling_plan,id:s.id,name:s.name,recurringDeliveries:s.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){w.debug("Not fetching cart");return}w.debug("Fetching cart");let r=Ae.getCartURL("cart.js"),n=await(await fetch(r)).json();this.update(n)}},os=class{static format(t,e){let r=/{{\s*(\w+)\s*}}/;return e.replace(r,(n,i)=>{switch(i){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return n}})}static formatWithDelimiters(t,e=2,r=",",n="."){if(isNaN(t)||t==null)return"0";let i=(t/100).toFixed(e).split("."),s=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r),o=i[1]?n+i[1]:"";return s+o}},Ft=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(e=>setTimeout(e,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&t[n]!=null&&r.push({[n]:t[n]}),r),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((e,r)=>(t[r]!==null&&t[r]!==void 0&&(e[r]=t[r]),e),{})}static stringify(t){return JSON.stringify(t,function(e,r){return r===void 0?null:r})}},ne=class{static tz;static isValidURL(t){try{return new URL(t)}catch{return}}static isNull(t){return!t||t==="null"||t==="undefined"}static removeFromArray(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}static formatCurrency(t,e){if(t==0&&e)return"Free";let r=le.get(),n=Oe.get(),i=r.shopCurrencyCode??n.currency,s=r.currencyCode,o=n.money?.format??r.moneyFormat,l;return o&&i===s?l=os.format(t*100,o):(l=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(t),l=l.replace("\u20B9","Rs. "),n.money?.showCurrency&&s!=="INR"&&(l=l.concat(` ${s}`))),l}static formatNumber(t){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(t)}static getLang(){return navigator.languages!==void 0?navigator.languages[0].split("-")[0]:navigator.language??"en"}static getTimezone(){if(this.tz)return this.tz;try{return this.tz=Intl.DateTimeFormat().resolvedOptions().timeZone,this.tz}catch{return""}}static documentReady(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}static onDocumentLoaded(t){document.readyState==="complete"?t():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&t()})}static showSnackbar(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},3e3)}static async retrySelectorForElements(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let s=Math.min(100*2**n,5e3);if(await Ft.sleep(s),i=r.querySelectorAll(t),i.length)return w.debug(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;w.debug(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${s}ms.`),n++}return w.warn(`Max attempts reached. Element not found with ${t}.`),i}static async retrySelector(t,e=10,r=document){return(await this.retrySelectorForElements(t,e,r)).item(0)}static async getCartAttributes(){let t=await Ne.get(ie.DEVICE_ID),e=await et.get(ie.ID,"");return[{key:"letscooee_did",value:t},{key:"letscooee_sid",value:e},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}};function Xn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var ss=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},as=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=t.d}},Qc=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},dr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new ss(e))??[],this.link=t.link,this.price=new as(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,t.sellingPlans?.length&&(this.selectedSellingPlan=er(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Qc(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}},xt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;selectedOrFirstVariant;selected=er(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=er(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.reviews=t.reviews,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),t.vars&&(this.vars=t.vars.map(e=>new dr(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new lt({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}},cs=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}},Zc=class{enabled;constructor(t){this.enabled=t.enabled}},el=class extends Zc{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},ls=class{productQuantity;constructor(t){t??={},this.productQuantity=new el(t.productQuantity)}},nn=class{s;g;i;constructor(t){t.s&&(this.s=new Ue(t.s)),t.g&&(this.g=new ro(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}},no="a-f\\d",Vh=`#?[${no}]{3}[${no}]?`,zh=`#?[${no}]{6}([${no}]{2})?`,Yh=new RegExp(`[^#${no}]`,"gi"),qh=new RegExp(`^${Vh}$|^${zh}$`,"i");function tl(t,e={}){if(typeof t!="string"||Yh.test(t)||!qh.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,s=n>>8&255,o=n&255,l=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,s,o,l];if(e.format==="css"){let u=l===1?"":` / ${Number((l*100).toFixed(2))}%`;return`rgb(${i} ${s} ${o}${u})`}return{red:i,green:s,blue:o,alpha:l}}var Ue=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return tl(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}},on=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new Ue(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return $p[this.s??1]}},$p=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))($p||{}),ro=class op{static DEFAULT_FALLBACK=new Ue({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Ue(e.c)),e.fb&&(this.fb=new Ue(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??op.DEFAULT_FALLBACK}},io=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new Ue(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},Ar=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}},sn=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}},Ot=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new nn(t.bg)),t.br&&(this.br=new on(t.br)),t.shd&&(this.shd=new io(t.shd)),t.spc&&(this.spc=new Ar(t.spc)),this.trf=new sn(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return Pe[this.t]}get click(){return this.clc}},Pe=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.PRODUCT_RATING=19]="PRODUCT_RATING",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Pe||{}),an=class extends Ot{constructor(t){super(t)}},Or=class extends Ot{src;constructor(t){super(t),this.src=t.src}},Qn=(t=>(t[t.START=0]="START",t[t.CENTER=1]="CENTER",t[t.END=2]="END",t[t.JUSTIFY=3]="JUSTIFY",t))(Qn||{}),us=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(e=>new rl(e))}},rl=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}},st=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return Qn[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new Ue(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new Ue(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new us(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},hr=class extends Ot{typo;constructor(t){super(t);let e=b(b({},t.f),t.typo);t.alg&&(e.ta=t.alg),t.c&&(e.tc=t.c),this.typo=new st(e)}get color(){return this.typography.tc}get typography(){return this.typo}},zr=class extends hr{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},ps=class extends Ot{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}},Zn=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,e){let r=new Date;t===2?(r.setSeconds(r.getSeconds()+this.ss),r.setMinutes(r.getMinutes()+this.mm),r.setHours(r.getHours()+this.hh),r.setDate(r.getDate()+this.dd)):r=this.date??new Date;let n=window.setInterval(()=>{let i=new Date().getTime(),s=r.getTime()-i;if(s<1){clearInterval(n);return}let o=Math.floor(s/(1e3*60*60*24)),l=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),u=Math.floor(s%(1e3*60*60)/(1e3*60)),f=Math.floor(s%(1e3*60)/1e3);e({days:o,hours:l,minutes:u,seconds:f})},1e3);return n}},ei=class extends hr{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Zn(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},fs=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new Ue(t.c??{})}get text(){return this.txt}get color(){return this.c}},Yr=class extends hr{ph;constructor(t){super(t),this.ph=new fs(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}},ti=class extends Yr{constructor(t){t??={},super(t)}},ri=class extends Yr{},ni=class extends Yr{},ii=class extends Or{},cn=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(cn||{}),ms=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}},oo=class extends Ot{gvt;max;cover;anim;embedded;position;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new ms(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new Ar({pl:A.IN_APP_DEFAULT_PADDING,pr:A.IN_APP_DEFAULT_PADDING,pt:A.IN_APP_DEFAULT_PADDING,pb:A.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}},ds=class extends oo{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new ps(t.cont),this.mob=new oo(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(e=>{e.t===1?this.elems.push(new Or(e)):e.t===2?this.elems.push(new zr(e)):e.t===3?this.elems.push(new zr(e)):e.t===100?this.elems.push(new an(e)):e.t===51?this.elems.push(new ri(e)):e.t===52?this.elems.push(new ni(e)):e.t===61?this.elems.push(new ei(e)):e.t===15||e.t===16?this.elems.push(new ti(e)):e.t===13&&this.elems.push(new ii(e))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},e,r;return this.gvt===1?(e="flex-start",r="flex-start"):this.gvt===2?(e="center",r="flex-start"):this.gvt===3?(e="flex-end",r="flex-start"):this.gvt===4?(e="flex-start",r="center"):this.gvt===6?(e="flex-end",r="center"):this.gvt===7?(e="flex-start",r="flex-end"):this.gvt===8?(e="center",r="flex-end"):this.gvt===9?(e="flex-end",r="flex-end"):(e="center",r="center"),t.alignItems=r,t.justifyContent=e,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim,this.position=this.mob.position??this.position,this.embedded=this.mob.embedded??this.embedded}},oi=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}},hs=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}},gs=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}},ys=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Ar(t.spc),t.size&&(this.size=new gs(t.size)),t.bg&&(this.bg=new nn(t.bg)),t.br&&(this.br=new on(t.br)),t.typo&&(this.typo=new st(t.typo)),t.lout&&(this.lout=new hs(t.lout)),t.flex&&(this.flex=new oi(t.flex))}},si=class{sm;lg;constructor(t){t??={},this.sm=new ys(t.sm),this.lg=new ys(t.lg)}},tt=class{t;style;hide;when;clc;constructor(t,e){e??={},this.t=t,this.style=new si(e.style),this.hide=e.hide,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc)}get stringType(){return Pe[this.t]}},ze=class extends tt{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text}},ln=class extends ze{constructor(t,e){super(t,e??3)}},ai=class extends tt{value;constructor(t){super(6,t),t??={},this.value=t.value}},ci=class extends ze{constructor(t=15,e){super(e,t)}},vs=class extends tt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new Ue(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}},jp=Qt(tn()),nl=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new Ue(t.color)}},il=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new Ue(t.color)}},so=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new il(t.navigation),this.pagination=new nl(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},_s=class extends tt{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Pt.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new so(t.conf),this.allowedTypes=t.allowedTypes}},Es=class extends ze{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new Zn(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}},qr=class extends tt{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Pt.getParsedElement(e);r&&this.elems.push(r)})}},un=class extends tt{src;sm;lg;constructor(t,e){super(e??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}},Pt=class Fp{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=Fp.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new ze(e);case 3:return new ln(e);case 6:return new ai(e);case 11:return new Ss(e);case 12:return new gr(e);case 61:return new Es(e);case 4:return new qr(e);case 1:return new un(e);case 13:return new un(e,13);case 14:return new ze(e,14);case 15:case 16:return new ci(e.t,e);case 18:return new ln(e,18);case 62:return new _s(e);case 19:return new vs(e);default:jp.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}},gr=class extends tt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=Pt.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new ai(t.cBox)),this.elems.push(new un(t.img,13));let e=new ze(t.title,14);e.hide=!t.show?.title,e.text="{{ product.name }}",this.elems.push(e);let r=new ze(t.price);r.text="{{ product.price }}",r.hide=!t.show?.price;let n=new ze(t.compareAt);n.text="{{ product.compare_price }}",n.hide=!t.show?.price,t.compareAt||(n.style=new si(r.style),n.style.lg.typo=new st(Z(b({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new st(Z(b({},n.style.sm.typo),{td:"line-through"})));let i=new qr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Pt.parseAlignmentToJustifyContent(r.style.lg.typo?.ta)}}}});i.elems.push(n),i.elems.push(r),this.elems.push(i);let s=new ci(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let o=new ln(t.btn,18);o.hide=!t.show?.btn,this.elems.push(o)}}t.symbol&&(this.symbol=new ze(t.symbol))}},Ss=class extends tt{conf;prod;constructor(t){super(11,t),t??={},this.conf=new ol(t.conf),this.prod=new gr(t.prod)}},bs=class extends so{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},ol=class{lg;sm;constructor(t){t??={},this.lg=new bs(t.lg),this.sm=new bs(t.sm)}},ws=class extends qr{constructor(t){super(t)}},li=class{cont;elems=[];constructor(t){t=t??{},this.cont=new ws(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Pt.getParsedElement(t);return e&&this.elems.push(e),e}},sl=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(t){this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(e=>new lt(e))}},Is=class{layout;milestones;constructor(t){this.layout=t.layout??Cc.ICONS,this.milestones=t.milestones?.map(e=>new sl(e))??[]}},Ts=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},al=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===zi.EXCLUSION}isABTesting(){return this.contentType===zi.ABTESTING}isSingleContent(){return this.contentType===zi.SINGLE}},Lt=class bd extends al{static SWIPER_ELEMENTS=new Set([11,62]);nudgeID;contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;bundleConfig;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;discountData=er({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=le.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new li(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new lt(r)),this.items=e.items?.map(r=>new xt(r))??[],this.nonMutableItems=e.items?.map(r=>new xt(r))??[],this.collections=e.collections?.map(r=>new cs(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new ls(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new Is(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Ts(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new xt(e.bundleFrom))}shouldDelay(){return this.delay>0}sentryContext(){return{id:this.id,shortID:this.shortID,currency:this.currency,contentType:this.contentType,objective:this.objective,onsiteDeliveryType:this.onsiteDeliveryType,engagementID:this.engagementID,contentID:this.contentID,nudgeID:this.nudgeID,variation:this.variation}}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===ur.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Yi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Yi.PAGE_EMBED}isProgressBar(){return this.objective===ur.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===ur.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===ur.CART_RECOVERY}isProductPromotion(){return this.objective===ur.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===ur.BYOB}isShoppableVideo(){return this.objective===ur.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},s={};if(n){let u=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:u.mID,image:n.variantImage,price:ne.formatCurrency(u.price.d),comparePrice:ne.formatCurrency(u.price.cmp),quantity:n.quantity},s={quantity:u.quantity}}let o={productCount:ge.getCurrent().item_count},l=vt.render(r,{product:i,variant:s,cart:o,discount:this.discount,customer:this.customerData});return n&&(l=l.replace(new RegExp(A.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new ds(JSON.parse(l))}calculateDiscountData(e,r){let n=jn.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i={actualPrice:n,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(i);return}if([pr.UNIQUE_FLAT_ITEMS,pr.STATIC].includes(this.discount.type)&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100;else if(this.discount.type===pr.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)i.discountAmount=i.actualPrice-this.discount.values[0],i.discountPercentage=i.discountAmount/i.actualPrice*100;else if(this.discount.type===pr.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((o,l)=>l.selectedOrFirstVariant.value.price.d-o.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.price.effective=0,i.discountAmount=s.selectedOrFirstVariant.value.price.d,i.discountPercentage=i.discountAmount/i.actualPrice*100}i.discountedPrice=i.actualPrice-i.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(i)}getPrivateAttributesForLineItem(){return Oe.get().skipItemAttribute?{}:{[A.VIA]:"Cooee",[A.CAMPAIGN_ATTRIBUTE]:this.shortID,[A.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Oe.get().skipItemAttribute?[]:[{key:A.VIA,value:"Cooee"},{key:A.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:A.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[pr.UNIQUE_FIXED_ITEMS,pr.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===Yi.CART_EMBED&&this.objective===ur.BUNDLE_AND_UPSELL}hasSwiperElement(){let e=this.widget?.elems.find(n=>bd.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=At.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:ne.formatNumber(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map(n=>{r[n]=ne.formatCurrency(e[n])}),r}};function Jh(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Xh=tg,Qh=ng,Zh=sg,vr=[],$t=[],eg=typeof Uint8Array<"u"?Uint8Array:Array,cl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,Wp=cl.length;pn<Wp;++pn)vr[pn]=cl[pn],$t[cl.charCodeAt(pn)]=pn;var pn,Wp;$t[45]=62;$t[95]=63;function sf(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tg(t){var e=sf(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rg(t,e,r){return(e+r)*3/4-r}function ng(t){var e,r=sf(t),n=r[0],i=r[1],s=new eg(rg(t,n,i)),o=0,l=i>0?n-4:n,u;for(u=0;u<l;u+=4)e=$t[t.charCodeAt(u)]<<18|$t[t.charCodeAt(u+1)]<<12|$t[t.charCodeAt(u+2)]<<6|$t[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=$t[t.charCodeAt(u)]<<2|$t[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=$t[t.charCodeAt(u)]<<10|$t[t.charCodeAt(u+1)]<<4|$t[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function ig(t){return vr[t>>18&63]+vr[t>>12&63]+vr[t>>6&63]+vr[t&63]}function og(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(ig(n));return i.join("")}function sg(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,l=r-n;o<l;o+=s)i.push(og(t,o,o+s>l?l:o+s));return n===1?(e=t[r-1],i.push(vr[e>>2]+vr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(vr[e>>10]+vr[e>>4&63]+vr[e<<2&63]+"=")),i.join("")}var ll={byteLength:Xh,toByteArray:Qh,fromByteArray:Zh},ag=function(t,e,r,n,i){var s,o,l=i*8-n-1,u=(1<<l)-1,f=u>>1,m=-7,h=r?i-1:0,v=r?-1:1,_=t[e+h];for(h+=v,s=_&(1<<-m)-1,_>>=-m,m+=l;m>0;s=s*256+t[e+h],h+=v,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+t[e+h],h+=v,m-=8);if(s===0)s=1-f;else{if(s===u)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-f}return(_?-1:1)*o*Math.pow(2,s-n)},cg=function(t,e,r,n,i,s){var o,l,u,f=s*8-i-1,m=(1<<f)-1,h=m>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,g=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?e+=v/u:e+=v*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=m?(l=0,o=m):o+h>=1?(l=(e*u-1)*Math.pow(2,i),o=o+h):(l=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+_]=l&255,_+=g,l/=256,i-=8);for(o=o<<i|l,f+=i;f>0;t[r+_]=o&255,_+=g,o/=256,f-=8);t[r+_-g]|=y*128},ui={read:ag,write:cg},Ds=Jh(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function i(){try{var a=new Uint8Array(1),c={foo:function(){return 42}};return Object.setPrototypeOf(c,Uint8Array.prototype),Object.setPrototypeOf(a,c),a.foo()===42}catch{return!1}}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}});function s(a){if(a>n)throw new RangeError('The value "'+a+'" is invalid for option "size"');var c=new Uint8Array(a);return Object.setPrototypeOf(c,o.prototype),c}function o(a,c,p){if(typeof a=="number"){if(typeof c=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(a)}return l(a,c,p)}o.poolSize=8192;function l(a,c,p){if(typeof a=="string")return h(a,c);if(ArrayBuffer.isView(a))return _(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(Be(a,ArrayBuffer)||a&&Be(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Be(a,SharedArrayBuffer)||a&&Be(a.buffer,SharedArrayBuffer)))return g(a,c,p);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var I=a.valueOf&&a.valueOf();if(I!=null&&I!==a)return o.from(I,c,p);var N=y(a);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return o.from(a[Symbol.toPrimitive]("string"),c,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}o.from=function(a,c,p){return l(a,c,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function f(a,c,p){return u(a),a<=0?s(a):c!==void 0?typeof p=="string"?s(a).fill(c,p):s(a).fill(c):s(a)}o.alloc=function(a,c,p){return f(a,c,p)};function m(a){return u(a),s(a<0?0:C(a)|0)}o.allocUnsafe=function(a){return m(a)},o.allocUnsafeSlow=function(a){return m(a)};function h(a,c){if((typeof c!="string"||c==="")&&(c="utf8"),!o.isEncoding(c))throw new TypeError("Unknown encoding: "+c);var p=H(a,c)|0,I=s(p),N=I.write(a,c);return N!==p&&(I=I.slice(0,N)),I}function v(a){for(var c=a.length<0?0:C(a.length)|0,p=s(c),I=0;I<c;I+=1)p[I]=a[I]&255;return p}function _(a){if(Be(a,Uint8Array)){var c=new Uint8Array(a);return g(c.buffer,c.byteOffset,c.byteLength)}return v(a)}function g(a,c,p){if(c<0||a.byteLength<c)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<c+(p||0))throw new RangeError('"length" is outside of buffer bounds');var I;return c===void 0&&p===void 0?I=new Uint8Array(a):p===void 0?I=new Uint8Array(a,c):I=new Uint8Array(a,c,p),Object.setPrototypeOf(I,o.prototype),I}function y(a){if(o.isBuffer(a)){var c=C(a.length)|0,p=s(c);return p.length===0||a.copy(p,0,0,c),p}if(a.length!==void 0)return typeof a.length!="number"||$r(a.length)?s(0):v(a);if(a.type==="Buffer"&&Array.isArray(a.data))return v(a.data)}function C(a){if(a>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return a|0}function O(a){return+a!=a&&(a=0),o.alloc(+a)}o.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==o.prototype},o.compare=function(a,c){if(Be(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),Be(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),!o.isBuffer(a)||!o.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===c)return 0;for(var p=a.length,I=c.length,N=0,L=Math.min(p,I);N<L;++N)if(a[N]!==c[N]){p=a[N],I=c[N];break}return p<I?-1:I<p?1:0},o.isEncoding=function(a){switch(String(a).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(a,c){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return o.alloc(0);var p;if(c===void 0)for(c=0,p=0;p<a.length;++p)c+=a[p].length;var I=o.allocUnsafe(c),N=0;for(p=0;p<a.length;++p){var L=a[p];if(Be(L,Uint8Array))N+L.length>I.length?o.from(L).copy(I,N):Uint8Array.prototype.set.call(I,L,N);else if(o.isBuffer(L))L.copy(I,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=L.length}return I};function H(a,c){if(o.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||Be(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var p=a.length,I=arguments.length>2&&arguments[2]===!0;if(!I&&p===0)return 0;for(var N=!1;;)switch(c){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return kn(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ji(a).length;default:if(N)return I?-1:kn(a).length;c=(""+c).toLowerCase(),N=!0}}o.byteLength=H;function R(a,c,p){var I=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,c>>>=0,p<=c))return"";for(a||(a="utf8");;)switch(a){case"hex":return De(this,c,p);case"utf8":case"utf-8":return me(this,c,p);case"ascii":return be(this,c,p);case"latin1":case"binary":return Ut(this,c,p);case"base64":return Xt(this,c,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,c,p);default:if(I)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),I=!0}}o.prototype._isBuffer=!0;function k(a,c,p){var I=a[c];a[c]=a[p],a[p]=I}o.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<a;c+=2)k(this,c,c+1);return this},o.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<a;c+=4)k(this,c,c+3),k(this,c+1,c+2);return this},o.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<a;c+=8)k(this,c,c+7),k(this,c+1,c+6),k(this,c+2,c+5),k(this,c+3,c+4);return this},o.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?me(this,0,a):R.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(a){if(!o.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:o.compare(this,a)===0},o.prototype.inspect=function(){var a="",c=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(a+=" ... "),"<Buffer "+a+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(a,c,p,I,N){if(Be(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),!o.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(c===void 0&&(c=0),p===void 0&&(p=a?a.length:0),I===void 0&&(I=0),N===void 0&&(N=this.length),c<0||p>a.length||I<0||N>this.length)throw new RangeError("out of range index");if(I>=N&&c>=p)return 0;if(I>=N)return-1;if(c>=p)return 1;if(c>>>=0,p>>>=0,I>>>=0,N>>>=0,this===a)return 0;for(var L=N-I,W=p-c,te=Math.min(L,W),Tt=this.slice(I,N),Dt=a.slice(c,p),ce=0;ce<te;++ce)if(Tt[ce]!==Dt[ce]){L=Tt[ce],W=Dt[ce];break}return L<W?-1:W<L?1:0};function V(a,c,p,I,N){if(a.length===0)return-1;if(typeof p=="string"?(I=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,$r(p)&&(p=N?0:a.length-1),p<0&&(p=a.length+p),p>=a.length){if(N)return-1;p=a.length-1}else if(p<0)if(N)p=0;else return-1;if(typeof c=="string"&&(c=o.from(c,I)),o.isBuffer(c))return c.length===0?-1:Mt(a,c,p,I,N);if(typeof c=="number")return c=c&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(a,c,p):Uint8Array.prototype.lastIndexOf.call(a,c,p):Mt(a,[c],p,I,N);throw new TypeError("val must be string, number or Buffer")}function Mt(a,c,p,I,N){var L=1,W=a.length,te=c.length;if(I!==void 0&&(I=String(I).toLowerCase(),I==="ucs2"||I==="ucs-2"||I==="utf16le"||I==="utf-16le")){if(a.length<2||c.length<2)return-1;L=2,W/=2,te/=2,p/=2}function Tt(J,se){return L===1?J[se]:J.readUInt16BE(se*L)}var Dt;if(N){var ce=-1;for(Dt=p;Dt<W;Dt++)if(Tt(a,Dt)===Tt(c,ce===-1?0:Dt-ce)){if(ce===-1&&(ce=Dt),Dt-ce+1===te)return ce*L}else ce!==-1&&(Dt-=Dt-ce),ce=-1}else for(p+te>W&&(p=W-te),Dt=p;Dt>=0;Dt--){for(var z=!0,dt=0;dt<te;dt++)if(Tt(a,Dt+dt)!==Tt(c,dt)){z=!1;break}if(z)return Dt}return-1}o.prototype.includes=function(a,c,p){return this.indexOf(a,c,p)!==-1},o.prototype.indexOf=function(a,c,p){return V(this,a,c,p,!0)},o.prototype.lastIndexOf=function(a,c,p){return V(this,a,c,p,!1)};function fe(a,c,p,I){p=Number(p)||0;var N=a.length-p;I?(I=Number(I),I>N&&(I=N)):I=N;var L=c.length;I>L/2&&(I=L/2);for(var W=0;W<I;++W){var te=parseInt(c.substr(W*2,2),16);if($r(te))return W;a[p+W]=te}return W}function j(a,c,p,I){return Mn(kn(c,a.length-p),a,p,I)}function ct(a,c,p,I){return Mn(Hi(c),a,p,I)}function Y(a,c,p,I){return Mn(ji(c),a,p,I)}function at(a,c,p,I){return Mn(Wi(c,a.length-p),a,p,I)}o.prototype.write=function(a,c,p,I){if(c===void 0)I="utf8",p=this.length,c=0;else if(p===void 0&&typeof c=="string")I=c,p=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(p)?(p=p>>>0,I===void 0&&(I="utf8")):(I=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var N=this.length-c;if((p===void 0||p>N)&&(p=N),a.length>0&&(p<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");for(var L=!1;;)switch(I){case"hex":return fe(this,a,c,p);case"utf8":case"utf-8":return j(this,a,c,p);case"ascii":case"latin1":case"binary":return ct(this,a,c,p);case"base64":return Y(this,a,c,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,a,c,p);default:if(L)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),L=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xt(a,c,p){return c===0&&p===a.length?ll.fromByteArray(a):ll.fromByteArray(a.slice(c,p))}function me(a,c,p){p=Math.min(a.length,p);for(var I=[],N=c;N<p;){var L=a[N],W=null,te=L>239?4:L>223?3:L>191?2:1;if(N+te<=p){var Tt,Dt,ce,z;switch(te){case 1:L<128&&(W=L);break;case 2:Tt=a[N+1],(Tt&192)===128&&(z=(L&31)<<6|Tt&63,z>127&&(W=z));break;case 3:Tt=a[N+1],Dt=a[N+2],(Tt&192)===128&&(Dt&192)===128&&(z=(L&15)<<12|(Tt&63)<<6|Dt&63,z>2047&&(z<55296||z>57343)&&(W=z));break;case 4:Tt=a[N+1],Dt=a[N+2],ce=a[N+3],(Tt&192)===128&&(Dt&192)===128&&(ce&192)===128&&(z=(L&15)<<18|(Tt&63)<<12|(Dt&63)<<6|ce&63,z>65535&&z<1114112&&(W=z))}}W===null?(W=65533,te=1):W>65535&&(W-=65536,I.push(W>>>10&1023|55296),W=56320|W&1023),I.push(W),N+=te}return xe(I)}var de=4096;function xe(a){var c=a.length;if(c<=de)return String.fromCharCode.apply(String,a);for(var p="",I=0;I<c;)p+=String.fromCharCode.apply(String,a.slice(I,I+=de));return p}function be(a,c,p){var I="";p=Math.min(a.length,p);for(var N=c;N<p;++N)I+=String.fromCharCode(a[N]&127);return I}function Ut(a,c,p){var I="";p=Math.min(a.length,p);for(var N=c;N<p;++N)I+=String.fromCharCode(a[N]);return I}function De(a,c,p){var I=a.length;(!c||c<0)&&(c=0),(!p||p<0||p>I)&&(p=I);for(var N="",L=c;L<p;++L)N+=is[a[L]];return N}function ht(a,c,p){for(var I=a.slice(c,p),N="",L=0;L<I.length-1;L+=2)N+=String.fromCharCode(I[L]+I[L+1]*256);return N}o.prototype.slice=function(a,c){var p=this.length;a=~~a,c=c===void 0?p:~~c,a<0?(a+=p,a<0&&(a=0)):a>p&&(a=p),c<0?(c+=p,c<0&&(c=0)):c>p&&(c=p),c<a&&(c=a);var I=this.subarray(a,c);return Object.setPrototypeOf(I,o.prototype),I};function Q(a,c,p){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+c>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(a,c,p){a=a>>>0,c=c>>>0,p||Q(a,c,this.length);for(var I=this[a],N=1,L=0;++L<c&&(N*=256);)I+=this[a+L]*N;return I},o.prototype.readUintBE=o.prototype.readUIntBE=function(a,c,p){a=a>>>0,c=c>>>0,p||Q(a,c,this.length);for(var I=this[a+--c],N=1;c>0&&(N*=256);)I+=this[a+--c]*N;return I},o.prototype.readUint8=o.prototype.readUInt8=function(a,c){return a=a>>>0,c||Q(a,1,this.length),this[a]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(a,c){return a=a>>>0,c||Q(a,2,this.length),this[a]|this[a+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(a,c){return a=a>>>0,c||Q(a,2,this.length),this[a]<<8|this[a+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(a,c){return a=a>>>0,c||Q(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(a,c){return a=a>>>0,c||Q(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},o.prototype.readIntLE=function(a,c,p){a=a>>>0,c=c>>>0,p||Q(a,c,this.length);for(var I=this[a],N=1,L=0;++L<c&&(N*=256);)I+=this[a+L]*N;return N*=128,I>=N&&(I-=Math.pow(2,8*c)),I},o.prototype.readIntBE=function(a,c,p){a=a>>>0,c=c>>>0,p||Q(a,c,this.length);for(var I=c,N=1,L=this[a+--I];I>0&&(N*=256);)L+=this[a+--I]*N;return N*=128,L>=N&&(L-=Math.pow(2,8*c)),L},o.prototype.readInt8=function(a,c){return a=a>>>0,c||Q(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},o.prototype.readInt16LE=function(a,c){a=a>>>0,c||Q(a,2,this.length);var p=this[a]|this[a+1]<<8;return p&32768?p|4294901760:p},o.prototype.readInt16BE=function(a,c){a=a>>>0,c||Q(a,2,this.length);var p=this[a+1]|this[a]<<8;return p&32768?p|4294901760:p},o.prototype.readInt32LE=function(a,c){return a=a>>>0,c||Q(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},o.prototype.readInt32BE=function(a,c){return a=a>>>0,c||Q(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},o.prototype.readFloatLE=function(a,c){return a=a>>>0,c||Q(a,4,this.length),ui.read(this,a,!0,23,4)},o.prototype.readFloatBE=function(a,c){return a=a>>>0,c||Q(a,4,this.length),ui.read(this,a,!1,23,4)},o.prototype.readDoubleLE=function(a,c){return a=a>>>0,c||Q(a,8,this.length),ui.read(this,a,!0,52,8)},o.prototype.readDoubleBE=function(a,c){return a=a>>>0,c||Q(a,8,this.length),ui.read(this,a,!1,52,8)};function we(a,c,p,I,N,L){if(!o.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>N||c<L)throw new RangeError('"value" argument is out of bounds');if(p+I>a.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(a,c,p,I){if(a=+a,c=c>>>0,p=p>>>0,!I){var N=Math.pow(2,8*p)-1;we(this,a,c,p,N,0)}var L=1,W=0;for(this[c]=a&255;++W<p&&(L*=256);)this[c+W]=a/L&255;return c+p},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(a,c,p,I){if(a=+a,c=c>>>0,p=p>>>0,!I){var N=Math.pow(2,8*p)-1;we(this,a,c,p,N,0)}var L=p-1,W=1;for(this[c+L]=a&255;--L>=0&&(W*=256);)this[c+L]=a/W&255;return c+p},o.prototype.writeUint8=o.prototype.writeUInt8=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,1,255,0),this[c]=a&255,c+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,2,65535,0),this[c]=a&255,this[c+1]=a>>>8,c+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,2,65535,0),this[c]=a>>>8,this[c+1]=a&255,c+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,4,4294967295,0),this[c+3]=a>>>24,this[c+2]=a>>>16,this[c+1]=a>>>8,this[c]=a&255,c+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,4,4294967295,0),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4},o.prototype.writeIntLE=function(a,c,p,I){if(a=+a,c=c>>>0,!I){var N=Math.pow(2,8*p-1);we(this,a,c,p,N-1,-N)}var L=0,W=1,te=0;for(this[c]=a&255;++L<p&&(W*=256);)a<0&&te===0&&this[c+L-1]!==0&&(te=1),this[c+L]=(a/W>>0)-te&255;return c+p},o.prototype.writeIntBE=function(a,c,p,I){if(a=+a,c=c>>>0,!I){var N=Math.pow(2,8*p-1);we(this,a,c,p,N-1,-N)}var L=p-1,W=1,te=0;for(this[c+L]=a&255;--L>=0&&(W*=256);)a<0&&te===0&&this[c+L+1]!==0&&(te=1),this[c+L]=(a/W>>0)-te&255;return c+p},o.prototype.writeInt8=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,1,127,-128),a<0&&(a=255+a+1),this[c]=a&255,c+1},o.prototype.writeInt16LE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,2,32767,-32768),this[c]=a&255,this[c+1]=a>>>8,c+2},o.prototype.writeInt16BE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,2,32767,-32768),this[c]=a>>>8,this[c+1]=a&255,c+2},o.prototype.writeInt32LE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,4,2147483647,-2147483648),this[c]=a&255,this[c+1]=a>>>8,this[c+2]=a>>>16,this[c+3]=a>>>24,c+4},o.prototype.writeInt32BE=function(a,c,p){return a=+a,c=c>>>0,p||we(this,a,c,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4};function cr(a,c,p,I,N,L){if(p+I>a.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function jr(a,c,p,I,N){return c=+c,p=p>>>0,N||cr(a,c,p,4),ui.write(a,c,p,I,23,4),p+4}o.prototype.writeFloatLE=function(a,c,p){return jr(this,a,c,!0,p)},o.prototype.writeFloatBE=function(a,c,p){return jr(this,a,c,!1,p)};function je(a,c,p,I,N){return c=+c,p=p>>>0,N||cr(a,c,p,8),ui.write(a,c,p,I,52,8),p+8}o.prototype.writeDoubleLE=function(a,c,p){return je(this,a,c,!0,p)},o.prototype.writeDoubleBE=function(a,c,p){return je(this,a,c,!1,p)},o.prototype.copy=function(a,c,p,I){if(!o.isBuffer(a))throw new TypeError("argument should be a Buffer");if(p||(p=0),!I&&I!==0&&(I=this.length),c>=a.length&&(c=a.length),c||(c=0),I>0&&I<p&&(I=p),I===p||a.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),a.length-c<I-p&&(I=a.length-c+p);var N=I-p;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,p,I):Uint8Array.prototype.set.call(a,this.subarray(p,I),c),N},o.prototype.fill=function(a,c,p,I){if(typeof a=="string"){if(typeof c=="string"?(I=c,c=0,p=this.length):typeof p=="string"&&(I=p,p=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!o.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(a.length===1){var N=a.charCodeAt(0);(I==="utf8"&&N<128||I==="latin1")&&(a=N)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(c<0||this.length<c||this.length<p)throw new RangeError("Out of range index");if(p<=c)return this;c=c>>>0,p=p===void 0?this.length:p>>>0,a||(a=0);var L;if(typeof a=="number")for(L=c;L<p;++L)this[L]=a;else{var W=o.isBuffer(a)?a:o.from(a,I),te=W.length;if(te===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(L=0;L<p-c;++L)this[L+c]=W[L%te]}return this};var en=/[^+/0-9A-Za-z-_]/g;function Hn(a){if(a=a.split("=")[0],a=a.trim().replace(en,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function kn(a,c){c=c||1/0;for(var p,I=a.length,N=null,L=[],W=0;W<I;++W){if(p=a.charCodeAt(W),p>55295&&p<57344){if(!N){if(p>56319){(c-=3)>-1&&L.push(239,191,189);continue}else if(W+1===I){(c-=3)>-1&&L.push(239,191,189);continue}N=p;continue}if(p<56320){(c-=3)>-1&&L.push(239,191,189),N=p;continue}p=(N-55296<<10|p-56320)+65536}else N&&(c-=3)>-1&&L.push(239,191,189);if(N=null,p<128){if((c-=1)<0)break;L.push(p)}else if(p<2048){if((c-=2)<0)break;L.push(p>>6|192,p&63|128)}else if(p<65536){if((c-=3)<0)break;L.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((c-=4)<0)break;L.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return L}function Hi(a){for(var c=[],p=0;p<a.length;++p)c.push(a.charCodeAt(p)&255);return c}function Wi(a,c){for(var p,I,N,L=[],W=0;W<a.length&&!((c-=2)<0);++W)p=a.charCodeAt(W),I=p>>8,N=p%256,L.push(N),L.push(I);return L}function ji(a){return ll.toByteArray(Hn(a))}function Mn(a,c,p,I){for(var N=0;N<I&&!(N+p>=c.length||N>=a.length);++N)c[N+p]=a[N];return N}function Be(a,c){return a instanceof c||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===c.name}function $r(a){return a!==a}var is=function(){for(var a="0123456789abcdef",c=new Array(256),p=0;p<16;++p)for(var I=p*16,N=0;N<16;++N)c[I+N]=a[p]+a[N];return c}()}),Ee=Ds.Buffer;Ds.SlowBuffer;Ds.INSPECT_MAX_BYTES;Ds.kMaxLength;var dl=function(t,e){return dl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},dl(t,e)};function Rs(t,e){dl(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var mn=function(t){Rs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),$e=function(t){Rs(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function xs(t){return t&&t.Math==Math&&t}function af(){return xs(typeof globalThis=="object"&&globalThis)||xs(typeof window=="object"&&window)||xs(typeof self=="object"&&self)||xs(typeof global=="object"&&global)||Function("return this")()}function lg(){var t=af();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var ug=function(t){var e=lg()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(e);for(var r=Ee.alloc(t),n=0;n<t;++n)r[n]=Math.floor(Math.random()*256);return r},pg=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ee.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ee.alloc(e))}:ug}},cf=pg();function fg(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function gl(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function mg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function dg(t){return uo(t)&&Object.prototype.toString.call(t)==="[object Date]"}function uo(t){return typeof t=="object"&&t!==null}function Ns(t,e){var r=!1;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Cs(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(fg(t))return Ee.from(t);throw new $e("Must use either Buffer or TypedArray")}var hg=/^(?:[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,lf=function(t){return typeof t=="string"&&hg.test(t)},hl=function(t){if(!lf(t))throw new $e('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 Ee.from(e,"hex")},Gp=function(t,e){return e===void 0&&(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")},mI=Math.pow(2,63)-1,dI=-Math.pow(2,63),gg=Math.pow(2,53),yg=-Math.pow(2,53),uf=4,dn=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new $e("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ee.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ee.from(e,"binary"):Array.isArray(e)?this.buffer=Ee.from(e):this.buffer=Cs(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new $e("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new $e("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new $e("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ee.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ee.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Cs(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?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(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Vp(this.buffer.slice(0,this.position));throw new mn('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,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ee.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ee.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=hl(e.$uuid)),!n)throw new $e("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===uf?new Vp(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.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(dn.prototype,"_bsontype",{value:"Binary"});var ul=16,Vp=function(t){Rs(e,t);function e(r){var n=this,i,s;if(r==null)i=e.generate();else if(r instanceof e)i=Ee.from(r.buffer),s=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===ul)i=Cs(r);else if(typeof r=="string")i=hl(r);else throw new $e("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).");return n=t.call(this,i,uf)||this,n.__id=s,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Gp(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=Gp(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new dn(this.id,dn.SUBTYPE_UUID)},e.generate=function(){var r=cf(ul);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ee.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?lf(r):gl(r)?r.length!==ul?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=hl(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(dn),As=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}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 e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t}();Object.defineProperty(As.prototype,"_bsontype",{value:"Code"});function vg(t){return uo(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var co=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var s=e.split(".");s.length===2&&(n=s.shift(),e=s.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(co.prototype,"_bsontype",{value:"DBRef"});var Ht=void 0;try{Ht=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{}var zp=65536,_g=1<<24,fi=zp*zp,pf=fi*fi,Yp=pf/2,qp={},Kp={},K=function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,s;return r?(e>>>=0,(s=0<=e&&e<256)&&(i=Kp[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Kp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=qp[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(qp[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=pf)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Yp)return t.MIN_VALUE;if(e+1>=Yp)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%fi|0,e/fi|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var s=t.fromNumber(Math.pow(n,8)),o=t.ZERO,l=0;l<e.length;l+=8){var u=Math.min(8,e.length-l),f=parseInt(e.substring(l,l+u),n);if(u<8){var m=t.fromNumber(Math.pow(n,u));o=o.mul(m).add(t.fromNumber(f))}else o=o.mul(s),o=o.add(t.fromNumber(f))}return o.unsigned=r,o},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){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,r)},t.fromBytesBE=function(e,r){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],r)},t.isLong=function(e){return uo(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,s=this.low&65535,o=e.high>>>16,l=e.high&65535,u=e.low>>>16,f=e.low&65535,m=0,h=0,v=0,_=0;return _+=s+f,v+=_>>>16,_&=65535,v+=i+u,h+=v>>>16,v&=65535,h+=n+l,m+=h>>>16,h&=65535,m+=r+o,m&=65535,t.fromBits(v<<16|_,m<<16|h,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 r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?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(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Ht){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Ht.div_u:Ht.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ht.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;s=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),s=n.add(i.div(e)),s)}else 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();s=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var l=Math.ceil(Math.log(n)/Math.LN2),u=l<=48?1:Math.pow(2,l-48),f=t.fromNumber(n),m=f.mul(e);m.isNegative()||m.gt(i);)n-=u,f=t.fromNumber(n,this.unsigned),m=f.mul(e);f.isZero()&&(f=t.ONE),s=s.add(f),i=i.sub(m)}return s},t.prototype.div=function(e){return this.divide(e)},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?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},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=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Ht){var r=(this.unsigned?Ht.rem_u:Ht.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ht.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Ht){var r=Ht.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Ht.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 n=this.high>>>16,i=this.high&65535,s=this.low>>>16,o=this.low&65535,l=e.high>>>16,u=e.high&65535,f=e.low>>>16,m=e.low&65535,h=0,v=0,_=0,g=0;return g+=o*m,_+=g>>>16,g&=65535,_+=s*m,v+=_>>>16,_&=65535,_+=o*f,v+=_>>>16,_&=65535,v+=i*m,h+=v>>>16,v&=65535,v+=s*f,h+=v>>>16,v&=65535,v+=o*u,h+=v>>>16,v&=65535,h+=n*m+i*f+s*u+o*l,h&=65535,t.fromBits(_<<16|g,h<<16|v,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},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(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},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()),(e&=63)===0?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(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?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(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*fi+(this.low>>>0):this.high*fi+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=t.fromNumber(Math.pow(e,6),this.unsigned),o=this,l="";;){var u=o.div(s),f=o.sub(u.mul(s)).toInt()>>>0,m=f.toString(e);if(o=u,o.isZero())return m+l;for(;m.length<6;)m="0"+m;l=""+m+l}},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(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},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(_g),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(K.prototype,"__isLong__",{value:!0});Object.defineProperty(K.prototype,"_bsontype",{value:"Long"});var Eg=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Sg=/^(\+|-)?(Infinity|inf)$/i,bg=/^(\+|-)?NaN$/i,ao=6111,pl=-6176,Jp=6176,wg=34,fl=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Xp=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Qp=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ig=/^([-+])?(\d+)?$/,Tg=31,Zp=16383,xg=30,Cg=31;function ef(t){return!isNaN(parseInt(t,10))}function Dg(t){var e=K.fromNumber(1e9),r=K.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new K(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Rg(t,e){if(!t&&!e)return{high:K.fromNumber(0),low:K.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new K(t.getLowBits(),0),i=e.shiftRightUnsigned(32),s=new K(e.getLowBits(),0),o=r.multiply(i),l=r.multiply(s),u=n.multiply(i),f=n.multiply(s);return o=o.add(l.shiftRightUnsigned(32)),l=new K(l.getLowBits(),0).add(u).add(f.shiftRightUnsigned(32)),o=o.add(l.shiftRightUnsigned(32)),f=l.shiftLeft(32).add(new K(f.getLowBits(),0)),{high:o,low:f}}function Ng(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,s=e.low>>>0;if(i<s)return!0}return!1}function pi(t,e){throw new $e('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var yl=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(gl(e)){if(e.byteLength!==16)throw new $e("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new $e("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,s=0,o=0,l=0,u=0,f=0,m=[0],h=0,v=0,_=0,g=0,y=0,C=0,O=new K(0,0),H=new K(0,0),R=0,k=0;if(e.length>=7e3)throw new $e(""+e+" not a valid Decimal128 string");var V=e.match(Eg),Mt=e.match(Sg),fe=e.match(bg);if(!V&&!Mt&&!fe||e.length===0)throw new $e(""+e+" not a valid Decimal128 string");if(V){var j=V[2],ct=V[4],Y=V[5],at=V[6];ct&&at===void 0&&pi(e,"missing exponent power"),ct&&j===void 0&&pi(e,"missing exponent base"),ct===void 0&&(Y||at)&&pi(e,"missing e before exponent")}if((e[k]==="+"||e[k]==="-")&&(r=e[k++]==="-"),!ef(e[k])&&e[k]!=="."){if(e[k]==="i"||e[k]==="I")return new t(Ee.from(r?Xp:Qp));if(e[k]==="N")return new t(Ee.from(fl))}for(;ef(e[k])||e[k]===".";){if(e[k]==="."){n&&pi(e,"contains multiple periods"),n=!0,k=k+1;continue}h<34&&(e[k]!=="0"||i)&&(i||(f=o),i=!0,m[v++]=parseInt(e[k],10),h=h+1),i&&(l=l+1),n&&(u=u+1),o=o+1,k=k+1}if(n&&!o)throw new $e(""+e+" not a valid Decimal128 string");if(e[k]==="e"||e[k]==="E"){var Xt=e.substr(++k).match(Ig);if(!Xt||!Xt[2])return new t(Ee.from(fl));y=parseInt(Xt[0],10),k=k+Xt[0].length}if(e[k])return new t(Ee.from(fl));if(_=0,!h)_=0,g=0,m[0]=0,l=1,h=1,s=0;else if(g=h-1,s=l,s!==1)for(;m[f+s-1]===0;)s=s-1;for(y<=u&&u-y>16384?y=pl:y=y-u;y>ao;){if(g=g+1,g-_>wg){var me=m.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}y=y-1}for(;y<pl||h<l;){if(g===0&&s<h){y=pl,s=0;break}if(h<l?l=l-1:g=g-1,y<ao)y=y+1;else{var me=m.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}}if(g-_+1<s){var de=o;n&&(f=f+1,de=de+1),r&&(f=f+1,de=de+1);var xe=parseInt(e[f+g+1],10),be=0;if(xe>=5&&(be=1,xe===5)){for(be=m[g]%2===1?1:0,C=f+g+2;C<de;C++)if(parseInt(e[C],10)){be=1;break}}if(be){for(var Ut=g;Ut>=0;Ut--)if(++m[Ut]>9&&(m[Ut]=0,Ut===0))if(y<ao)y=y+1,m[Ut]=1;else return new t(Ee.from(r?Xp:Qp))}}if(O=K.fromNumber(0),H=K.fromNumber(0),s===0)O=K.fromNumber(0),H=K.fromNumber(0);else if(g-_<17){var Ut=_;for(H=K.fromNumber(m[Ut++]),O=new K(0,0);Ut<=g;Ut++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(m[Ut]))}else{var Ut=_;for(O=K.fromNumber(m[Ut++]);Ut<=g-17;Ut++)O=O.multiply(K.fromNumber(10)),O=O.add(K.fromNumber(m[Ut]));for(H=K.fromNumber(m[Ut++]);Ut<=g;Ut++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(m[Ut]))}var De=Rg(O,K.fromString("100000000000000000"));De.low=De.low.add(H),Ng(De.low,H)&&(De.high=De.high.add(K.fromNumber(1))),R=y+Jp;var ht={low:K.fromNumber(0),high:K.fromNumber(0)};De.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(ht.high=ht.high.or(K.fromNumber(3).shiftLeft(61)),ht.high=ht.high.or(K.fromNumber(R).and(K.fromNumber(16383).shiftLeft(47))),ht.high=ht.high.or(De.high.and(K.fromNumber(0x7fffffffffff)))):(ht.high=ht.high.or(K.fromNumber(R&16383).shiftLeft(49)),ht.high=ht.high.or(De.high.and(K.fromNumber(562949953421311)))),ht.low=De.low,r&&(ht.high=ht.high.or(K.fromString("9223372036854775808")));var Q=Ee.alloc(16);return k=0,Q[k++]=ht.low.low&255,Q[k++]=ht.low.low>>8&255,Q[k++]=ht.low.low>>16&255,Q[k++]=ht.low.low>>24&255,Q[k++]=ht.low.high&255,Q[k++]=ht.low.high>>8&255,Q[k++]=ht.low.high>>16&255,Q[k++]=ht.low.high>>24&255,Q[k++]=ht.high.low&255,Q[k++]=ht.high.low>>8&255,Q[k++]=ht.high.low>>16&255,Q[k++]=ht.high.low>>24&255,Q[k++]=ht.high.high&255,Q[k++]=ht.high.high>>8&255,Q[k++]=ht.high.high>>16&255,Q[k++]=ht.high.high>>24&255,new t(Q)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var s=0,o=!1,l,u={parts:[0,0,0,0]},f,m,h=[];s=0;var v=this.bytes,_=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,g=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,y=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,C=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24;s=0;var O={low:new K(_,g),high:new K(y,C)};O.high.lessThan(K.ZERO)&&h.push("-");var H=C>>26&Tg;if(H>>3===3){if(H===xg)return h.join("")+"Infinity";if(H===Cg)return"NaN";e=C>>15&Zp,l=8+(C>>14&1)}else l=C>>14&7,e=C>>17&Zp;var R=e-Jp;if(u.parts[0]=(C&16383)+((l&15)<<14),u.parts[1]=y,u.parts[2]=g,u.parts[3]=_,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)o=!0;else for(m=3;m>=0;m--){var k=0,V=Dg(u);if(u=V.quotient,k=V.rem.low,!!k)for(f=8;f>=0;f--)n[m*9+f]=k%10,k=Math.floor(k/10)}if(o)r=1,n[s]=0;else for(r=36;!n[s];)r=r-1,s=s+1;var Mt=r-1+R;if(Mt>=34||Mt<=-7||R>0){if(r>34)return h.push("".concat(0)),R>0?h.push("E+".concat(R)):R<0&&h.push("E".concat(R)),h.join("");h.push("".concat(n[s++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[s++]));h.push("E"),Mt>0?h.push("+".concat(Mt)):h.push("".concat(Mt))}else if(R>=0)for(var i=0;i<r;i++)h.push("".concat(n[s++]));else{var fe=r+R;if(fe>0)for(var i=0;i<fe;i++)h.push("".concat(n[s++]));else h.push("0");for(h.push(".");fe++<0;)h.push("0");for(var i=0;i<r-Math.max(fe-1,0);i++)h.push("".concat(n[s++]))}return h.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(yl.prototype,"_bsontype",{value:"Decimal128"});var Os=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(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t}();Object.defineProperty(Os.prototype,"_bsontype",{value:"Double"});var Ps=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.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(Ps.prototype,"_bsontype",{value:"Int32"});var vl=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(vl.prototype,"_bsontype",{value:"MaxKey"});var _l=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(_l.prototype,"_bsontype",{value:"MinKey"});var Ag=new RegExp("^[0-9a-fA-F]{24}$"),fn=null,yr=Symbol("id"),Je=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new $e("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ee.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[yr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[yr]=r instanceof Ee?r:Cs(r);else if(typeof r=="string")if(r.length===12){var n=Ee.from(r);if(n.byteLength===12)this[yr]=n;else throw new $e("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Ag.test(r))this[yr]=Ee.from(r,"hex");else throw new $e("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new $e("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[yr]},set:function(e){this[yr]=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(e){this.id.writeUInt32BE(e,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){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ee.alloc(12);return n.writeUInt32BE(e,0),fn===null&&(fn=cf(5)),n[4]=fn[0],n[5]=fn[1],n[6]=fn[2],n[7]=fn[3],n[8]=fn[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[yr][11]===e[yr][11]&&this[yr].equals(e[yr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&gl(this.id))return e===Ee.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ee.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ee.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new $e("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ee.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{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(Math.random()*16777215),t}();Object.defineProperty(Je.prototype,"generate",{value:Ns(function(t){return Je.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Je.prototype,"getInc",{value:Ns(function(){return Je.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Je.prototype,"get_inc",{value:Ns(function(){return Je.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Je,"get_inc",{value:Ns(function(){return Je.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Je.prototype,"_bsontype",{value:"ObjectID"});function Og(t){return t.split("").sort().join("")}var lo=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Og(r??""),this.pattern.indexOf("\0")!==-1)throw new mn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new mn("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new mn("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new $e("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(lo.prototype,"_bsontype",{value:"BSONRegExp"});var El=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(El.prototype,"_bsontype",{value:"Symbol"});var Pg=K,ff=function(t){Rs(e,t);function e(r,n){var i=this;return i instanceof e?(K.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:uo(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(K.fromInt(r,!0))},e.fromNumber=function(r){return new e(K.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(K.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$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=K.MAX_UNSIGNED_VALUE,e}(Pg);function Lg(t){return uo(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var mf=2147483647,df=-2147483648,hf=9223372036854776e3,gf=-9223372036854776e3,Bg={$oid:Je,$binary:dn,$uuid:dn,$symbol:El,$numberInt:Ps,$numberDecimal:yl,$numberDouble:Os,$numberLong:K,$minKey:_l,$maxKey:vl,$regex:lo,$regularExpression:lo,$timestamp:ff};function yf(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=df&&t<=mf)return new Ps(t);if(t>=gf&&t<=hf)return K.fromNumber(t)}return new Os(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(h){return h.startsWith("$")&&t[h]!=null}),n=0;n<r.length;n++){var i=Bg[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var s=t.$date,o=new Date;return e.legacy?typeof s=="number"?o.setTime(s):typeof s=="string"&&o.setTime(Date.parse(s)):typeof s=="string"?o.setTime(Date.parse(s)):K.isLong(s)?o.setTime(s.toNumber()):typeof s=="number"&&e.relaxed&&o.setTime(s),o}if(t.$code!=null){var l=Object.assign({},t);return t.$scope&&(l.$scope=yf(t.$scope)),As.fromExtendedJSON(t)}if(vg(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof co)return u;var f=Object.keys(u).filter(function(h){return h.startsWith("$")}),m=!0;if(f.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(m=!1)}),m)return co.fromExtendedJSON(u)}return t}function Ug(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Kr(r,e)}finally{e.seenObjects.pop()}})}function tf(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Kr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(O){return O.obj===t});if(r!==-1){var n=e.seenObjects.map(function(O){return O.propertyName}),i=n.slice(0,r).map(function(O){return"".concat(O," -> ")}).join(""),s=n[r],o=" -> "+n.slice(r+1,n.length-1).map(function(O){return"".concat(O," -> ")}).join(""),l=n[n.length-1],u=" ".repeat(i.length+s.length/2),f="-".repeat(o.length+(s.length+l.length)/2-1);throw new $e(`Converting circular structure to EJSON:
|
|
20
|
+
`+" ".concat(i).concat(s).concat(o).concat(l,`
|
|
21
|
+
`)+" ".concat(u,"\\").concat(f,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Ug(t,e);if(t===void 0)return null;if(t instanceof Date||dg(t)){var m=t.getTime(),h=m>-1&&m<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:tf(t)}:e.relaxed&&h?{$date:tf(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var v=t>=df&&t<=mf,_=t>=gf&&t<=hf;if(v)return{$numberInt:t.toString()};if(_)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||mg(t)){var g=t.flags;if(g===void 0){var y=t.toString().match(/[gimuy]*$/);y&&(g=y[0])}var C=new lo(t.source,g);return C.toExtendedJSON(e)}return t!=null&&typeof t=="object"?kg(t,e):t}var Mg={Binary:function(t){return new dn(t.value(),t.sub_type)},Code:function(t){return new As(t.code,t.scope)},DBRef:function(t){return new co(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new yl(t.bytes)},Double:function(t){return new Os(t.value)},Int32:function(t){return new Ps(t.value)},Long:function(t){return K.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new vl},MinKey:function(){return new _l},ObjectID:function(t){return new Je(t)},ObjectId:function(t){return new Je(t)},BSONRegExp:function(t){return new lo(t.pattern,t.options)},Symbol:function(t){return new El(t.value)},Timestamp:function(t){return ff.fromBits(t.low,t.high)}};function kg(t,e){if(t==null||typeof t!="object")throw new mn("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var s=Kr(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):n[i]=s}finally{e.seenObjects.pop()}}return n}else if(Lg(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var l=Mg[t._bsontype];if(!l)throw new $e("Unrecognized or invalid _bsontype: "+t._bsontype);o=l(o)}return r==="Code"&&o.scope?o=new As(o.code,Kr(o.scope,e)):r==="DBRef"&&o.oid&&(o=new co(Kr(o.collection,e),Kr(o.oid,e),Kr(o.db,e),Kr(o.fields,e))),o.toExtendedJSON(e)}else throw new mn("_bsontype must be a string, but was: "+typeof r)}var rf;(function(t){function e(s,o){var l=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof l.relaxed=="boolean"&&(l.strict=!l.relaxed),typeof l.strict=="boolean"&&(l.relaxed=!l.strict),JSON.parse(s,function(u,f){if(u.indexOf("\0")!==-1)throw new mn("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(u)));return yf(f,l)})}t.parse=e;function r(s,o,l,u){l!=null&&typeof l=="object"&&(u=l,l=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(u=o,o=void 0,l=0);var f=Object.assign({relaxed:!0,legacy:!1},u,{seenObjects:[{propertyName:"(root)",obj:null}]}),m=Kr(s,f);return JSON.stringify(m,o,l)}t.stringify=r;function n(s,o){return o=o||{},JSON.parse(r(s,o))}t.serialize=n;function i(s,o){return o=o||{},e(JSON.stringify(s),o)}t.deserialize=i})(rf||(rf={}));var nf,of=af();of.Map?nf=of.Map:nf=function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],s=n[1];this._keys.push(i),this._values[i]={v:s,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var hI=K.fromNumber(gg),gI=K.fromNumber(yg),ml=new Uint8Array(8),yI=new DataView(ml.buffer,ml.byteOffset,ml.byteLength),Fg=1024*1024*17,vI=Ee.alloc(Fg),mi=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}},ve=class{constructor(t,e={},r,n){this.name=t,this.properties=e,this.id=n?new Je(n):new Je,this.occurred=new Date,r&&(this.trigger=new mi(r)),this.newEvent=!n}trigger;items;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber},ut=class{static injectScriptURL(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.defer=!0,t.includes("localhost")&&(r.type="module"),document.head.appendChild(r)}static injectRawScript(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}static injectRawCSS(t,e=document.head){if(!t)return;let r=document.createElement("style");r.textContent=t,e.appendChild(r)}static injectStylesheet(t,e=document.head){if(!t)return;let r=document.createElement("link");r.rel="stylesheet",r.href=t,t==="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"&&(r.crossOrigin="anonymous",r.onload=n=>{let i=n.currentTarget?.sheet?.cssRules;if(i){for(let s of i)if(s.type==CSSRule.FONT_FACE_RULE){let o=t.split("/"),l=o.slice(0,o.length-1).join("/"),u=s.cssText;u=u.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${l}/$4")`);let f=document.createElement("style");f.appendChild(document.createTextNode(u)),document.head.appendChild(f)}}}),e.appendChild(r)}},ue=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}},vf=Qt(Sl()),po=class{static UTM_PARAMS=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"];static TW_PARAMS={utm_source:"tw_source",utm_campaign:"tw_campaign"};static getReferrer(){if(document.referrer)return document.referrer.replace(location.origin,"")}static getUTMParams(){let t;try{t=new vf.URLBuilder(location.href)}catch{return{}}let e={};this.UTM_PARAMS.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(this.TW_PARAMS).forEach(n=>{let i=t.getQueryParam(this.TW_PARAMS[n]);i&&(r[n]=i)}),b(b({},r),e)}},_r=class wd{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}static parseFromCurrent(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new wd(b({origin:location.origin,path:e,qs:location.search,referrer:po.getReferrer(),name:le.get().pageName},po.getUTMParams()))}};function ae(t){return typeof t=="function"}function Bs(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Us=Bs(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
|
|
22
22
|
${e.map((r,n)=>`${n+1}) ${r.toString()}`).join(`
|
|
23
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function hn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var jt=class Zu{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(ce(n))try{n()}catch(s){e=s instanceof Us?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{_f(s)}catch(o){e=e??[],o instanceof Us?e=[...e,...o.errors]:e.push(o)}}if(e)throw new Us(e)}}add(e){var r;if(e&&e!==this)if(this.closed)_f(e);else{if(e instanceof Zu){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&hn(r,e)}remove(e){let{_finalizers:r}=this;r&&hn(r,e),e instanceof Zu&&e._removeParent(this)}};jt.EMPTY=(()=>{let t=new jt;return t.closed=!0,t})();var bl=jt.EMPTY;function Ms(t){return t instanceof jt||t&&"closed"in t&&ce(t.remove)&&ce(t.add)&&ce(t.unsubscribe)}function _f(t){ce(t)?t():t.unsubscribe()}var tr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},di={setTimeout(t,e,...r){let{delegate:n}=di;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=di;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function ks(t){di.setTimeout(()=>{let{onUnhandledError:e}=tr;if(e)e(t);else throw t})}function wl(){}var Ef=Il("C",void 0,void 0);function Sf(t){return Il("E",void 0,t)}function bf(t){return Il("N",t,void 0)}function Il(t,e,r){return{kind:t,value:e,error:r}}var gn=null;function hi(t){if(tr.useDeprecatedSynchronousErrorHandling){let e=!gn;if(e&&(gn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=gn;if(gn=null,r)throw n}}else t()}function wf(t){tr.useDeprecatedSynchronousErrorHandling&&gn&&(gn.errorThrown=!0,gn.error=t)}var yn=class extends jt{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Ms(t)&&t.add(this)):this.destination=Wg}static create(t,e,r){return new gi(t,e,r)}next(t){this.isStopped?xl(bf(t),this):this._next(t)}error(t){this.isStopped?xl(Sf(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?xl(Ef,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},$g=Function.prototype.bind;function Tl(t,e){return $g.call(t,e)}var Cl=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Fs(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Fs(r)}else Fs(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Fs(e)}}},gi=class extends yn{constructor(t,e,r){super();let n;if(ce(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&tr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&Tl(t.next,i),error:t.error&&Tl(t.error,i),complete:t.complete&&Tl(t.complete,i)}):n=t}this.destination=new Cl(n)}};function Fs(t){tr.useDeprecatedSynchronousErrorHandling?wf(t):ks(t)}function jg(t){throw t}function xl(t,e){let{onStoppedNotification:r}=tr;r&&di.setTimeout(()=>r(t,e))}var Wg={closed:!0,next:wl,error:jg,complete:wl},yi=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Hs(t){return t}function If(t){return t.length===0?Hs:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var rt=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=Vg(r)?r:new gi(r,n,i);return hi(()=>{let{operator:o,source:c}=this;s.add(o?o.call(s,c):c?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Tf(n),new n((i,s)=>{let o=new gi({next:c=>{try{r(c)}catch(u){s(u),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[yi](){return this}pipe(...r){return If(r)(this)}toPromise(r){return r=Tf(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function Tf(t){var e;return(e=t??tr.Promise)!==null&&e!==void 0?e:Promise}function Gg(t){return t&&ce(t.next)&&ce(t.error)&&ce(t.complete)}function Vg(t){return t&&t instanceof yn||Gg(t)&&Ms(t)}function zg(t){return ce(t?.lift)}function Wt(t){return e=>{if(zg(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Pr(t,e,r,n,i){return new Dl(t,e,r,n,i)}var Dl=class extends yn{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(c){t.error(c)}}:super._next,this._error=n?function(o){try{n(o)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},xf=Bs(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),yt=(()=>{class t extends rt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new $s(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new xf}next(r){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:s}=this;return n||i?bl:(this.currentObservers=null,s.push(r),new jt(()=>{this.currentObservers=null,hn(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new rt;return r.source=this,r}}return t.create=(e,r)=>new $s(e,r),t})(),$s=class extends yt{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:bl}},fo=class extends yt{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},mo={now(){return(mo.delegate||Date).now()},delegate:void 0},ho=class extends yt{constructor(t=1/0,e=1/0,r=mo){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let c=1;c<r.length&&r[c]<=s;c+=2)o=c;o&&r.splice(0,o+1)}}},js=class extends jt{constructor(t,e){super()}schedule(t,e=0){return this}},go={setInterval(t,e,...r){let{delegate:n}=go;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=go;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},Ws=class extends js{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return go.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&go.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,hn(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},vi=class Id{constructor(e,r=Id.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};vi.now=mo.now;var Gs=class extends vi{constructor(t,e=vi.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},Cf=new Gs(Ws);function Df(t){return t&&ce(t.schedule)}function Yg(t){return t[t.length-1]}function Vs(t){return Df(Yg(t))?t.pop():void 0}function Nf(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function c(m){try{f(n.next(m))}catch(h){o(h)}}function u(m){try{f(n.throw(m))}catch(h){o(h)}}function f(m){m.done?s(m.value):i(m.value).then(c,u)}f((n=n.apply(t,e||[])).next())})}function Rf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(t){return this instanceof vn?(this.v=t,this):new vn(t)}function Af(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(_){return function(g){return Promise.resolve(g).then(_,h)}}function c(_,g){n[_]&&(i[_]=function(y){return new Promise(function(C,O){s.push([_,y,C,O])>1||u(_,y)})},g&&(i[_]=g(i[_])))}function u(_,g){try{f(n[_](g))}catch(y){v(s[0][3],y)}}function f(_){_.value instanceof vn?Promise.resolve(_.value.v).then(m,h):v(s[0][2],_)}function m(_){u("next",_)}function h(_){u("throw",_)}function v(_,g){_(g),s.shift(),s.length&&u(s[0][0],s[0][1])}}function Of(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Rf=="function"?Rf(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(c,u){o=t[s](o),i(c,u,o.done,o.value)})}}function i(s,o,c,u){Promise.resolve(u).then(function(f){s({value:f,done:c})},o)}}var _i=t=>t&&typeof t.length=="number"&&typeof t!="function";function zs(t){return ce(t?.then)}function Ys(t){return ce(t[yi])}function qs(t){return Symbol.asyncIterator&&ce(t?.[Symbol.asyncIterator])}function Ks(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function qg(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xs=qg();function Js(t){return ce(t?.[Xs])}function Qs(t){return Af(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield vn(e.read());if(n)return yield vn(void 0);yield yield vn(r)}}finally{e.releaseLock()}})}function Zs(t){return ce(t?.getReader)}function Gt(t){if(t instanceof rt)return t;if(t!=null){if(Ys(t))return Kg(t);if(_i(t))return Xg(t);if(zs(t))return Jg(t);if(qs(t))return Pf(t);if(Js(t))return Qg(t);if(Zs(t))return Zg(t)}throw Ks(t)}function Kg(t){return new rt(e=>{let r=t[yi]();if(ce(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Xg(t){return new rt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Jg(t){return new rt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,ks)})}function Qg(t){return new rt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Pf(t){return new rt(e=>{ey(t,e).catch(r=>e.error(r))})}function Zg(t){return Pf(Qs(t))}function ey(t,e){var r,n,i,s;return Nf(this,void 0,void 0,function*(){try{for(r=Of(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Vt(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function ea(t,e=0){return Wt((r,n)=>{r.subscribe(Pr(n,i=>Vt(n,t,()=>n.next(i),e),()=>Vt(n,t,()=>n.complete(),e),i=>Vt(n,t,()=>n.error(i),e)))})}function ta(t,e=0){return Wt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Lf(t,e){return Gt(t).pipe(ta(e),ea(e))}function Bf(t,e){return Gt(t).pipe(ta(e),ea(e))}function Uf(t,e){return new rt(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Mf(t,e){return new rt(r=>{let n;return Vt(r,e,()=>{n=t[Xs](),Vt(r,e,()=>{let i,s;try{({value:i,done:s}=n.next())}catch(o){r.error(o);return}s?r.complete():r.next(i)},0,!0)}),()=>ce(n?.return)&&n.return()})}function ra(t,e){if(!t)throw new Error("Iterable cannot be null");return new rt(r=>{Vt(r,e,()=>{let n=t[Symbol.asyncIterator]();Vt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function kf(t,e){return ra(Qs(t),e)}function Ff(t,e){if(t!=null){if(Ys(t))return Lf(t,e);if(_i(t))return Uf(t,e);if(zs(t))return Bf(t,e);if(qs(t))return ra(t,e);if(Js(t))return Mf(t,e);if(Zs(t))return kf(t,e)}throw Ks(t)}function Hf(t,e){return e?Ff(t,e):Gt(t)}function _n(t,e){return Wt((r,n)=>{let i=0;r.subscribe(Pr(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:ty}=Array;function ry(t,e){return ty(e)?t(...e):t(e)}function $f(t){return _n(e=>ry(t,e))}function jf(t,e,r,n,i,s,o,c){let u=[],f=0,m=0,h=!1,v=()=>{h&&!u.length&&!f&&e.complete()},_=y=>f<n?g(y):u.push(y),g=y=>{s&&e.next(y),f++;let C=!1;Gt(r(y,m++)).subscribe(Pr(e,O=>{i?.(O),s?_(O):e.next(O)},()=>{C=!0},void 0,()=>{if(C)try{for(f--;u.length&&f<n;){let O=u.shift();o?Vt(e,o,()=>g(O)):g(O)}v()}catch(O){e.error(O)}}))};return t.subscribe(Pr(e,_,()=>{h=!0,v()})),()=>{c?.()}}function yo(t,e,r=1/0){return ce(e)?yo((n,i)=>_n((s,o)=>e(n,s,i,o))(Gt(t(n,i))),r):(typeof e=="number"&&(r=e),Wt((n,i)=>jf(n,i,t,r)))}function Wf(t=1/0){return yo(Hs,t)}function Gf(){return Wf(1)}function Rl(...t){return Gf()(Hf(t,Vs(t)))}var ny=["addListener","removeListener"],iy=["addEventListener","removeEventListener"],oy=["on","off"];function En(t,e,r,n){if(ce(r)&&(n=r,r=void 0),n)return En(t,e,r).pipe($f(n));let[i,s]=cy(t)?iy.map(o=>c=>t[o](e,c,r)):sy(t)?ny.map(Vf(t,e)):ay(t)?oy.map(Vf(t,e)):[];if(!i&&_i(t))return yo(o=>En(o,e,r))(Gt(t));if(!i)throw new TypeError("Invalid event target");return new rt(o=>{let c=(...u)=>o.next(1<u.length?u:u[0]);return i(c),()=>s(c)})}function Vf(t,e){return r=>n=>t[r](e,n)}function sy(t){return ce(t.addListener)&&ce(t.removeListener)}function ay(t){return ce(t.on)&&ce(t.off)}function cy(t){return ce(t.addEventListener)&&ce(t.removeEventListener)}function rr(t,e=Cf){return Wt((r,n)=>{let i=null,s=null,o=null,c=()=>{if(i){i.unsubscribe(),i=null;let f=s;s=null,n.next(f)}};function u(){let f=o+t,m=e.now();if(m<f){i=this.schedule(void 0,f-m),n.add(i);return}c()}r.subscribe(Pr(n,f=>{s=f,o=e.now(),i||(i=e.schedule(u,t),n.add(i))},()=>{c(),n.complete()},void 0,()=>{s=i=null}))})}function Nl(...t){let e=Vs(t);return Wt((r,n)=>{(e?Rl(t,r,e):Rl(t,r)).subscribe(n)})}var ly=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/5\\.0\\s[a-z\\.-]+$|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|trace|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab",uy=/bot|crawl|http|lighthouse|scan|search|spider/i,vo;function py(){if(vo instanceof RegExp)return vo;try{vo=new RegExp(ly,"i")}catch{vo=uy}return vo}function zf(t){return!!t&&py().test(t)}var Yf=Object.prototype.toString;function Sn(t){switch(Yf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Er(t,Error)}}function Ei(t,e){return Yf.call(t)===`[object ${e}]`}function na(t){return Ei(t,"ErrorEvent")}function ia(t){return Ei(t,"DOMError")}function Al(t){return Ei(t,"DOMException")}function vt(t){return Ei(t,"String")}function Si(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function bn(t){return t===null||Si(t)||typeof t!="object"&&typeof t!="function"}function nr(t){return Ei(t,"Object")}function wn(t){return typeof Event<"u"&&Er(t,Event)}function Ol(t){return typeof Element<"u"&&Er(t,Element)}function Pl(t){return Ei(t,"RegExp")}function Lr(t){return!!(t&&t.then&&typeof t.then=="function")}function Ll(t){return nr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Er(t,e){try{return t instanceof e}catch{return!1}}function _o(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Sr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function oa(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{_o(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function qf(t,e,r=!1){return vt(t)?Pl(e)?e.test(t):vt(e)?r?t===e:t.includes(e):!1:!1}function bi(t,e=[],r=!1){return e.some(n=>qf(t,n,r))}function Ul(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!Er(o.originalException,Error))return;let c=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;c&&(s.exception.values=fy(Bl(t,e,i,o.originalException,n,s.exception.values,c,0),r))}function Bl(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let u=[...s];if(Er(n[i],Error)){Kf(o,c);let f=t(e,n[i]),m=u.length;Xf(f,i,m,c),u=Bl(t,e,r,n[i],i,[f,...u],f,m)}return Array.isArray(n.errors)&&n.errors.forEach((f,m)=>{if(Er(f,Error)){Kf(o,c);let h=t(e,f),v=u.length;Xf(h,`errors[${m}]`,v,c),u=Bl(t,e,r,f,i,[h,...u],h,v)}}),u}function Kf(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(b(b({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Xf(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(b({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function fy(t,e){return t.map(r=>(r.value&&(r.value=Sr(r.value,e)),r))}var zt="8.18.0",ee=globalThis;function wi(t,e,r){let n=r||ee,i=n.__SENTRY__=n.__SENTRY__||{},s=i[zt]=i[zt]||{};return s[t]||(s[t]=e())}var Ml=ee,my=80;function Eo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,c=" > ",u=c.length,f,m=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||my;for(;r&&s++<n&&(f=dy(r,m),!(f==="html"||s>1&&o+i.length*u+f.length>=h));)i.push(f),o+=f.length,r=r.parentNode;return i.reverse().join(c)}catch{return"<unknown>"}}function dy(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(Ml.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e&&e.length?e.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&vt(o)){let c=o.split(/\s+/);for(let u of c)n.push(`.${u}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let c=r.getAttribute(o);c&&n.push(`[${o}="${c}"]`)}return n.join("")}function kl(){try{return Ml.document.location.href}catch{return""}}function Fl(t){if(!Ml.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}var br=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,hy="Sentry Logger ",So=["debug","info","warn","error","log","assert","trace"],Ii={};function Ti(t){if(!("console"in ee))return t();let e=ee.console,r={},n=Object.keys(Ii);n.forEach(i=>{let s=Ii[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function gy(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return br?So.forEach(r=>{e[r]=(...n)=>{t&&Ti(()=>{ee.console[r](`${hy}[${r}]:`,...n)})}}):So.forEach(r=>{e[r]=()=>{}}),e}var q=gy(),yy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function vy(t){return t==="http"||t==="https"}function wr(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:c,publicKey:u}=t;return`${c}://${u}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Jf(t){let e=yy.exec(t);if(!e){Ti(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",c=""]=e.slice(1),u="",f=c,m=f.split("/");if(m.length>1&&(u=m.slice(0,-1).join("/"),f=m.pop()),f){let h=f.match(/^\d+/);h&&(f=h[0])}return Qf({host:s,pass:i,path:u,projectId:f,port:o,protocol:r,publicKey:n})}function Qf(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function _y(t){if(!br)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(q.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?vy(n)?e&&isNaN(parseInt(e,10))?(q.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(q.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(q.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function sa(t){let e=typeof t=="string"?Jf(t):Qf(t);if(!(!e||!_y(e)))return e}var ut=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Pe(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&aa(i,n),t[e]=i}function _t(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{br&&q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function aa(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,_t(t,"__sentry_original__",e)}catch{}}function In(t){return t.__sentry_original__}function $l(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function ca(t){if(Sn(t))return b({message:t.message,name:t.name,stack:t.stack},em(t));if(wn(t)){let e=b({type:t.type,target:Zf(t.target),currentTarget:Zf(t.currentTarget)},em(t));return typeof CustomEvent<"u"&&Er(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Zf(t){try{return Ol(t)?Eo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function em(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function jl(t,e=40){let r=Object.keys(ca(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Sr(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:Sr(s,e)}return""}function Qe(t){return Hl(t,new Map)}function Hl(t,e){if(Ey(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=Hl(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(Hl(i,e))}),n}return t}function Ey(t){if(!nr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var Ir="?",tm=/\(error: (.*)\)/,rm=/captureMessage|captureException/;function Gl(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
24
|
-
`);for(let
|
|
23
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=e});function hn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var jt=class Xu{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let s of r)s.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(ae(n))try{n()}catch(s){e=s instanceof Us?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{_f(s)}catch(o){e=e??[],o instanceof Us?e=[...e,...o.errors]:e.push(o)}}if(e)throw new Us(e)}}add(e){var r;if(e&&e!==this)if(this.closed)_f(e);else{if(e instanceof Xu){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&hn(r,e)}remove(e){let{_finalizers:r}=this;r&&hn(r,e),e instanceof Xu&&e._removeParent(this)}};jt.EMPTY=(()=>{let t=new jt;return t.closed=!0,t})();var bl=jt.EMPTY;function Ms(t){return t instanceof jt||t&&"closed"in t&&ae(t.remove)&&ae(t.add)&&ae(t.unsubscribe)}function _f(t){ae(t)?t():t.unsubscribe()}var tr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},di={setTimeout(t,e,...r){let{delegate:n}=di;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=di;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function ks(t){di.setTimeout(()=>{let{onUnhandledError:e}=tr;if(e)e(t);else throw t})}function wl(){}var Ef=Il("C",void 0,void 0);function Sf(t){return Il("E",void 0,t)}function bf(t){return Il("N",t,void 0)}function Il(t,e,r){return{kind:t,value:e,error:r}}var gn=null;function hi(t){if(tr.useDeprecatedSynchronousErrorHandling){let e=!gn;if(e&&(gn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=gn;if(gn=null,r)throw n}}else t()}function wf(t){tr.useDeprecatedSynchronousErrorHandling&&gn&&(gn.errorThrown=!0,gn.error=t)}var yn=class extends jt{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Ms(t)&&t.add(this)):this.destination=Wg}static create(t,e,r){return new gi(t,e,r)}next(t){this.isStopped?xl(bf(t),this):this._next(t)}error(t){this.isStopped?xl(Sf(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?xl(Ef,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},$g=Function.prototype.bind;function Tl(t,e){return $g.call(t,e)}var Cl=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Fs(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Fs(r)}else Fs(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Fs(e)}}},gi=class extends yn{constructor(t,e,r){super();let n;if(ae(t)||!t)n={next:t??void 0,error:e??void 0,complete:r??void 0};else{let i;this&&tr.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&Tl(t.next,i),error:t.error&&Tl(t.error,i),complete:t.complete&&Tl(t.complete,i)}):n=t}this.destination=new Cl(n)}};function Fs(t){tr.useDeprecatedSynchronousErrorHandling?wf(t):ks(t)}function jg(t){throw t}function xl(t,e){let{onStoppedNotification:r}=tr;r&&di.setTimeout(()=>r(t,e))}var Wg={closed:!0,next:wl,error:jg,complete:wl},yi=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Hs(t){return t}function If(t){return t.length===0?Hs:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var rt=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let s=Vg(r)?r:new gi(r,n,i);return hi(()=>{let{operator:o,source:l}=this;s.add(o?o.call(s,l):l?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Tf(n),new n((i,s)=>{let o=new gi({next:l=>{try{r(l)}catch(u){s(u),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[yi](){return this}pipe(...r){return If(r)(this)}toPromise(r){return r=Tf(r),new r((n,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>n(s))})}}return t.create=e=>new t(e),t})();function Tf(t){var e;return(e=t??tr.Promise)!==null&&e!==void 0?e:Promise}function Gg(t){return t&&ae(t.next)&&ae(t.error)&&ae(t.complete)}function Vg(t){return t&&t instanceof yn||Gg(t)&&Ms(t)}function zg(t){return ae(t?.lift)}function Wt(t){return e=>{if(zg(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Pr(t,e,r,n,i){return new Dl(t,e,r,n,i)}var Dl=class extends yn{constructor(t,e,r,n,i,s){super(t),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=e?function(o){try{e(o)}catch(l){t.error(l)}}:super._next,this._error=n?function(o){try{n(o)}catch(l){t.error(l)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(o){t.error(o)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}},xf=Bs(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),_t=(()=>{class t extends rt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new $s(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new xf}next(r){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){hi(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:s}=this;return n||i?bl:(this.currentObservers=null,s.push(r),new jt(()=>{this.currentObservers=null,hn(s,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:s}=this;n?r.error(i):s&&r.complete()}asObservable(){let r=new rt;return r.source=this,r}}return t.create=(e,r)=>new $s(e,r),t})(),$s=class extends _t{constructor(t,e){super(),this.destination=t,this.source=e}next(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,t)}error(t){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,t)}complete(){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||e===void 0||e.call(t)}_subscribe(t){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(t))!==null&&r!==void 0?r:bl}},fo=class extends _t{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let e=super._subscribe(t);return!e.closed&&t.next(this._value),e}getValue(){let{hasError:t,thrownError:e,_value:r}=this;if(t)throw e;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}},mo={now(){return(mo.delegate||Date).now()},delegate:void 0},ho=class extends _t{constructor(t=1/0,e=1/0,r=mo){super(),this._bufferSize=t,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,e)}next(t){let{isStopped:e,_buffer:r,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;e||(r.push(t),!n&&r.push(i.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!t.closed;s+=r?1:2)t.next(i[s]);return this._checkFinalizedStatuses(t),e}_trimBuffer(){let{_bufferSize:t,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:n}=this,i=(n?1:2)*t;if(t<1/0&&i<r.length&&r.splice(0,r.length-i),!n){let s=e.now(),o=0;for(let l=1;l<r.length&&r[l]<=s;l+=2)o=l;o&&r.splice(0,o+1)}}},js=class extends jt{constructor(t,e){super()}schedule(t,e=0){return this}},go={setInterval(t,e,...r){let{delegate:n}=go;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=go;return(e?.clearInterval||clearInterval)(t)},delegate:void 0},Ws=class extends js{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){var r;if(this.closed)return this;this.state=t;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(i,this.id,e),this}requestAsyncId(t,e,r=0){return go.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&go.clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(t,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let r=!1,n;try{this.work(t)}catch(i){r=!0,n=i||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:t,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,hn(r,this),t!=null&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null,super.unsubscribe()}}},vi=class Id{constructor(e,r=Id.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};vi.now=mo.now;var Gs=class extends vi{constructor(t,e=vi.now){super(t,e),this.actions=[],this._active=!1}flush(t){let{actions:e}=this;if(this._active){e.push(t);return}let r;this._active=!0;do if(r=t.execute(t.state,t.delay))break;while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},Cf=new Gs(Ws);function Df(t){return t&&ae(t.schedule)}function Yg(t){return t[t.length-1]}function Vs(t){return Df(Yg(t))?t.pop():void 0}function Nf(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function l(m){try{f(n.next(m))}catch(h){o(h)}}function u(m){try{f(n.throw(m))}catch(h){o(h)}}function f(m){m.done?s(m.value):i(m.value).then(l,u)}f((n=n.apply(t,e||[])).next())})}function Rf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(t){return this instanceof vn?(this.v=t,this):new vn(t)}function Af(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(_){return function(g){return Promise.resolve(g).then(_,h)}}function l(_,g){n[_]&&(i[_]=function(y){return new Promise(function(C,O){s.push([_,y,C,O])>1||u(_,y)})},g&&(i[_]=g(i[_])))}function u(_,g){try{f(n[_](g))}catch(y){v(s[0][3],y)}}function f(_){_.value instanceof vn?Promise.resolve(_.value.v).then(m,h):v(s[0][2],_)}function m(_){u("next",_)}function h(_){u("throw",_)}function v(_,g){_(g),s.shift(),s.length&&u(s[0][0],s[0][1])}}function Of(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Rf=="function"?Rf(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(l,u){o=t[s](o),i(l,u,o.done,o.value)})}}function i(s,o,l,u){Promise.resolve(u).then(function(f){s({value:f,done:l})},o)}}var _i=t=>t&&typeof t.length=="number"&&typeof t!="function";function zs(t){return ae(t?.then)}function Ys(t){return ae(t[yi])}function qs(t){return Symbol.asyncIterator&&ae(t?.[Symbol.asyncIterator])}function Ks(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function qg(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Js=qg();function Xs(t){return ae(t?.[Js])}function Qs(t){return Af(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:n}=yield vn(e.read());if(n)return yield vn(void 0);yield yield vn(r)}}finally{e.releaseLock()}})}function Zs(t){return ae(t?.getReader)}function Gt(t){if(t instanceof rt)return t;if(t!=null){if(Ys(t))return Kg(t);if(_i(t))return Jg(t);if(zs(t))return Xg(t);if(qs(t))return Pf(t);if(Xs(t))return Qg(t);if(Zs(t))return Zg(t)}throw Ks(t)}function Kg(t){return new rt(e=>{let r=t[yi]();if(ae(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Jg(t){return new rt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Xg(t){return new rt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,ks)})}function Qg(t){return new rt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Pf(t){return new rt(e=>{ey(t,e).catch(r=>e.error(r))})}function Zg(t){return Pf(Qs(t))}function ey(t,e){var r,n,i,s;return Nf(this,void 0,void 0,function*(){try{for(r=Of(t);n=yield r.next(),!n.done;){let o=n.value;if(e.next(o),e.closed)return}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=r.return)&&(yield s.call(r))}finally{if(i)throw i.error}}e.complete()})}function Vt(t,e,r,n=0,i=!1){let s=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!i)return s}function ea(t,e=0){return Wt((r,n)=>{r.subscribe(Pr(n,i=>Vt(n,t,()=>n.next(i),e),()=>Vt(n,t,()=>n.complete(),e),i=>Vt(n,t,()=>n.error(i),e)))})}function ta(t,e=0){return Wt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Lf(t,e){return Gt(t).pipe(ta(e),ea(e))}function Bf(t,e){return Gt(t).pipe(ta(e),ea(e))}function Uf(t,e){return new rt(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Mf(t,e){return new rt(r=>{let n;return Vt(r,e,()=>{n=t[Js](),Vt(r,e,()=>{let i,s;try{({value:i,done:s}=n.next())}catch(o){r.error(o);return}s?r.complete():r.next(i)},0,!0)}),()=>ae(n?.return)&&n.return()})}function ra(t,e){if(!t)throw new Error("Iterable cannot be null");return new rt(r=>{Vt(r,e,()=>{let n=t[Symbol.asyncIterator]();Vt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function kf(t,e){return ra(Qs(t),e)}function Ff(t,e){if(t!=null){if(Ys(t))return Lf(t,e);if(_i(t))return Uf(t,e);if(zs(t))return Bf(t,e);if(qs(t))return ra(t,e);if(Xs(t))return Mf(t,e);if(Zs(t))return kf(t,e)}throw Ks(t)}function Hf(t,e){return e?Ff(t,e):Gt(t)}function _n(t,e){return Wt((r,n)=>{let i=0;r.subscribe(Pr(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:ty}=Array;function ry(t,e){return ty(e)?t(...e):t(e)}function $f(t){return _n(e=>ry(t,e))}function jf(t,e,r,n,i,s,o,l){let u=[],f=0,m=0,h=!1,v=()=>{h&&!u.length&&!f&&e.complete()},_=y=>f<n?g(y):u.push(y),g=y=>{s&&e.next(y),f++;let C=!1;Gt(r(y,m++)).subscribe(Pr(e,O=>{i?.(O),s?_(O):e.next(O)},()=>{C=!0},void 0,()=>{if(C)try{for(f--;u.length&&f<n;){let O=u.shift();o?Vt(e,o,()=>g(O)):g(O)}v()}catch(O){e.error(O)}}))};return t.subscribe(Pr(e,_,()=>{h=!0,v()})),()=>{l?.()}}function yo(t,e,r=1/0){return ae(e)?yo((n,i)=>_n((s,o)=>e(n,s,i,o))(Gt(t(n,i))),r):(typeof e=="number"&&(r=e),Wt((n,i)=>jf(n,i,t,r)))}function Wf(t=1/0){return yo(Hs,t)}function Gf(){return Wf(1)}function Rl(...t){return Gf()(Hf(t,Vs(t)))}var ny=["addListener","removeListener"],iy=["addEventListener","removeEventListener"],oy=["on","off"];function En(t,e,r,n){if(ae(r)&&(n=r,r=void 0),n)return En(t,e,r).pipe($f(n));let[i,s]=cy(t)?iy.map(o=>l=>t[o](e,l,r)):sy(t)?ny.map(Vf(t,e)):ay(t)?oy.map(Vf(t,e)):[];if(!i&&_i(t))return yo(o=>En(o,e,r))(Gt(t));if(!i)throw new TypeError("Invalid event target");return new rt(o=>{let l=(...u)=>o.next(1<u.length?u:u[0]);return i(l),()=>s(l)})}function Vf(t,e){return r=>n=>t[r](e,n)}function sy(t){return ae(t.addListener)&&ae(t.removeListener)}function ay(t){return ae(t.on)&&ae(t.off)}function cy(t){return ae(t.addEventListener)&&ae(t.removeEventListener)}function rr(t,e=Cf){return Wt((r,n)=>{let i=null,s=null,o=null,l=()=>{if(i){i.unsubscribe(),i=null;let f=s;s=null,n.next(f)}};function u(){let f=o+t,m=e.now();if(m<f){i=this.schedule(void 0,f-m),n.add(i);return}l()}r.subscribe(Pr(n,f=>{s=f,o=e.now(),i||(i=e.schedule(u,t),n.add(i))},()=>{l(),n.complete()},void 0,()=>{s=i=null}))})}function Nl(...t){let e=Vs(t);return Wt((r,n)=>{(e?Rl(t,r,e):Rl(t,r)).subscribe(n)})}var ly=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/5\\.0\\s[a-z\\.-]+$|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|adscanner/|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|cookiehubscan|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|firephp|functionize|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|trace|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab",uy=/bot|crawl|http|lighthouse|scan|search|spider/i,vo;function py(){if(vo instanceof RegExp)return vo;try{vo=new RegExp(ly,"i")}catch{vo=uy}return vo}function zf(t){return!!t&&py().test(t)}var Yf=Object.prototype.toString;function Sn(t){switch(Yf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Er(t,Error)}}function Ei(t,e){return Yf.call(t)===`[object ${e}]`}function na(t){return Ei(t,"ErrorEvent")}function ia(t){return Ei(t,"DOMError")}function Al(t){return Ei(t,"DOMException")}function Et(t){return Ei(t,"String")}function Si(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function bn(t){return t===null||Si(t)||typeof t!="object"&&typeof t!="function"}function nr(t){return Ei(t,"Object")}function wn(t){return typeof Event<"u"&&Er(t,Event)}function Ol(t){return typeof Element<"u"&&Er(t,Element)}function Pl(t){return Ei(t,"RegExp")}function Lr(t){return!!(t&&t.then&&typeof t.then=="function")}function Ll(t){return nr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Er(t,e){try{return t instanceof e}catch{return!1}}function _o(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Sr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function oa(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{_o(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function qf(t,e,r=!1){return Et(t)?Pl(e)?e.test(t):Et(e)?r?t===e:t.includes(e):!1:!1}function bi(t,e=[],r=!1){return e.some(n=>qf(t,n,r))}function Ul(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!Er(o.originalException,Error))return;let l=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;l&&(s.exception.values=fy(Bl(t,e,i,o.originalException,n,s.exception.values,l,0),r))}function Bl(t,e,r,n,i,s,o,l){if(s.length>=r+1)return s;let u=[...s];if(Er(n[i],Error)){Kf(o,l);let f=t(e,n[i]),m=u.length;Jf(f,i,m,l),u=Bl(t,e,r,n[i],i,[f,...u],f,m)}return Array.isArray(n.errors)&&n.errors.forEach((f,m)=>{if(Er(f,Error)){Kf(o,l);let h=t(e,f),v=u.length;Jf(h,`errors[${m}]`,v,l),u=Bl(t,e,r,f,i,[h,...u],h,v)}}),u}function Kf(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(b(b({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Jf(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(b({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function fy(t,e){return t.map(r=>(r.value&&(r.value=Sr(r.value,e)),r))}var zt="8.18.0",ee=globalThis;function wi(t,e,r){let n=r||ee,i=n.__SENTRY__=n.__SENTRY__||{},s=i[zt]=i[zt]||{};return s[t]||(s[t]=e())}var Ml=ee,my=80;function Eo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],s=0,o=0,l=" > ",u=l.length,f,m=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||my;for(;r&&s++<n&&(f=dy(r,m),!(f==="html"||s>1&&o+i.length*u+f.length>=h));)i.push(f),o+=f.length,r=r.parentNode;return i.reverse().join(l)}catch{return"<unknown>"}}function dy(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(Ml.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e&&e.length?e.filter(o=>r.getAttribute(o)).map(o=>[o,r.getAttribute(o)]):null;if(i&&i.length)i.forEach(o=>{n.push(`[${o[0]}="${o[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let o=r.className;if(o&&Et(o)){let l=o.split(/\s+/);for(let u of l)n.push(`.${u}`)}}let s=["aria-label","type","name","title","alt"];for(let o of s){let l=r.getAttribute(o);l&&n.push(`[${o}="${l}"]`)}return n.join("")}function kl(){try{return Ml.document.location.href}catch{return""}}function Fl(t){if(!Ml.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}var br=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,hy="Sentry Logger ",So=["debug","info","warn","error","log","assert","trace"],Ii={};function Ti(t){if(!("console"in ee))return t();let e=ee.console,r={},n=Object.keys(Ii);n.forEach(i=>{let s=Ii[i];r[i]=e[i],e[i]=s});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function gy(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return br?So.forEach(r=>{e[r]=(...n)=>{t&&Ti(()=>{ee.console[r](`${hy}[${r}]:`,...n)})}}):So.forEach(r=>{e[r]=()=>{}}),e}var q=gy(),yy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function vy(t){return t==="http"||t==="https"}function wr(t,e=!1){let{host:r,path:n,pass:i,port:s,projectId:o,protocol:l,publicKey:u}=t;return`${l}://${u}${e&&i?`:${i}`:""}@${r}${s?`:${s}`:""}/${n&&`${n}/`}${o}`}function Xf(t){let e=yy.exec(t);if(!e){Ti(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",s="",o="",l=""]=e.slice(1),u="",f=l,m=f.split("/");if(m.length>1&&(u=m.slice(0,-1).join("/"),f=m.pop()),f){let h=f.match(/^\d+/);h&&(f=h[0])}return Qf({host:s,pass:i,path:u,projectId:f,port:o,protocol:r,publicKey:n})}function Qf(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function _y(t){if(!br)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(q.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:r.match(/^\d+$/)?vy(n)?e&&isNaN(parseInt(e,10))?(q.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(q.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(q.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function sa(t){let e=typeof t=="string"?Xf(t):Qf(t);if(!(!e||!_y(e)))return e}var pt=class extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}};function Le(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&aa(i,n),t[e]=i}function St(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{br&&q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function aa(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,St(t,"__sentry_original__",e)}catch{}}function In(t){return t.__sentry_original__}function $l(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function ca(t){if(Sn(t))return b({message:t.message,name:t.name,stack:t.stack},em(t));if(wn(t)){let e=b({type:t.type,target:Zf(t.target),currentTarget:Zf(t.currentTarget)},em(t));return typeof CustomEvent<"u"&&Er(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Zf(t){try{return Ol(t)?Eo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function em(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function jl(t,e=40){let r=Object.keys(ca(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Sr(n,e);for(let i=r.length;i>0;i--){let s=r.slice(0,i).join(", ");if(!(s.length>e))return i===r.length?s:Sr(s,e)}return""}function Xe(t){return Hl(t,new Map)}function Hl(t,e){if(Ey(t)){let r=e.get(t);if(r!==void 0)return r;let n={};e.set(t,n);for(let i of Object.keys(t))typeof t[i]<"u"&&(n[i]=Hl(t[i],e));return n}if(Array.isArray(t)){let r=e.get(t);if(r!==void 0)return r;let n=[];return e.set(t,n),t.forEach(i=>{n.push(Hl(i,e))}),n}return t}function Ey(t){if(!nr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var Ir="?",tm=/\(error: (.*)\)/,rm=/captureMessage|captureException/;function Gl(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let s=[],o=r.split(`
|
|
24
|
+
`);for(let l=n;l<o.length;l++){let u=o[l];if(u.length>1024)continue;let f=tm.test(u)?u.replace(tm,"$1"):u;if(!f.match(/\S*Error: /)){for(let m of e){let h=m(f);if(h){s.push(h);break}}if(s.length>=50+i)break}}return nm(s.slice(i))}}function nm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(la(e).function||"")&&e.pop(),e.reverse(),rm.test(la(e).function||"")&&(e.pop(),rm.test(la(e).function||"")&&e.pop()),e.slice(0,50).map(r=>Z(b({},r),{filename:r.filename||la(e).filename,function:r.function||Ir}))}function la(t){return t[t.length-1]||{}}var Wl="<anonymous>";function Yt(t){try{return!t||typeof t!="function"?Wl:t.name||Wl}catch{return Wl}}function ua(t){let e=t.exception;if(e){let r=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var pa={},im={};function bt(t,e){pa[t]=pa[t]||[],pa[t].push(e)}function wt(t,e){im[t]||(e(),im[t]=!0)}function Qe(t,e){let r=t&&pa[t];if(r)for(let n of r)try{n(e)}catch(i){br&&q.error(`Error while triggering instrumentation handler.
|
|
25
25
|
Type: ${t}
|
|
26
26
|
Name: ${Yt(n)}
|
|
27
|
-
Error:`,i)}}function Vl(t){let e="console";
|
|
27
|
+
Error:`,i)}}function Vl(t){let e="console";bt(e,t),wt(e,Sy)}function Sy(){"console"in ee&&So.forEach(function(t){t in ee.console&&Le(ee.console,t,function(e){return Ii[t]=e,function(...r){Qe("console",{args:r,level:t});let n=Ii[t];n&&n.apply(ee.console,r)}})})}var zl=ee;function om(){if(!("fetch"in zl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function bo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Yl(){if(typeof EdgeRuntime=="string")return!0;if(!om())return!1;if(bo(zl.fetch))return!0;let t=!1,e=zl.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(t=bo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){br&&q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}var sm=1e3;function Tr(){return Date.now()/sm}function by(){let{performance:t}=ee;if(!t||!t.now)return Tr;let e=Date.now()-t.now(),r=t.timeOrigin==null?e:t.timeOrigin;return()=>(r+t.now())/sm}var Bt=by(),wo,wy=(()=>{let{performance:t}=ee;if(!t||!t.now){wo="none";return}let e=3600*1e3,r=t.now(),n=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+r-n):e,s=i<e,o=t.timing&&t.timing.navigationStart,l=typeof o=="number"?Math.abs(o+r-n):e,u=l<e;return s||u?i<=l?(wo="timeOrigin",t.timeOrigin):(wo="navigationStart",o):(wo="dateNow",n)})();function Kl(t){let e="fetch";bt(e,t),wt(e,Iy)}function Iy(){Yl()&&Le(ee,"fetch",function(t){return function(...e){let{method:r,url:n}=Ty(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:Bt()*1e3};Qe("fetch",b({},i));let s=new Error().stack;return t.apply(ee,e).then(o=>{let l=Z(b({},i),{endTimestamp:Bt()*1e3,response:o});return Qe("fetch",l),o},o=>{let l=Z(b({},i),{endTimestamp:Bt()*1e3,error:o});throw Qe("fetch",l),Sn(o)&&o.stack===void 0&&(o.stack=s,St(o,"framesToPop",1)),o})}})}function ql(t,e){return!!t&&typeof t=="object"&&!!t[e]}function am(t){return typeof t=="string"?t:t?ql(t,"url")?t.url:t.toString?t.toString():"":""}function Ty(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:am(r),method:ql(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:am(e),method:ql(e,"method")?String(e.method).toUpperCase():"GET"}}var fa=null;function Jl(t){let e="error";bt(e,t),wt(e,xy)}function xy(){fa=ee.onerror,ee.onerror=function(t,e,r,n,i){return Qe("error",{column:n,error:i,line:r,msg:t,url:e}),fa&&!fa.__SENTRY_LOADER__?fa.apply(this,arguments):!1},ee.onerror.__SENTRY_INSTRUMENTED__=!0}var ma=null;function Xl(t){let e="unhandledrejection";bt(e,t),wt(e,Cy)}function Cy(){ma=ee.onunhandledrejection,ee.onunhandledrejection=function(t){return Qe("unhandledrejection",t),ma&&!ma.__SENTRY_LOADER__?ma.apply(this,arguments):!0},ee.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Ql(){return"npm"}function cm(){let t=typeof WeakSet=="function",e=t?new WeakSet:[];function r(i){if(t)return e.has(i)?!0:(e.add(i),!1);for(let s=0;s<e.length;s++)if(e[s]===i)return!0;return e.push(i),!1}function n(i){if(t)e.delete(i);else for(let s=0;s<e.length;s++)if(e[s]===i){e.splice(s,1);break}}return[r,n]}function nt(){let t=ee,e=t.crypto||t.msCrypto,r=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(r=()=>{let n=new Uint8Array(1);return e.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function lm(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function ir(t){let{message:e,event_id:r}=t;if(e)return e;let n=lm(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function xi(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type=r||"Error")}function Br(t,e){let r=lm(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=b(b(b({},n),i),e),e&&"data"in e){let s=b(b({},i&&i.data),e.data);r.mechanism.data=s}}function da(t){if(t&&t.__sentry_captured__)return!0;try{St(t,"__sentry_captured__",!0)}catch{}return!1}function ha(t){return Array.isArray(t)?t:[t]}function or(t,e=100,r=1/0){try{return Zl("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function ga(t,e=3,r=100*1024){let n=or(t,e);return Ay(n)>r?ga(t,e-1,r):n}function Zl(t,e,r=1/0,n=1/0,i=cm()){let[s,o]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let l=Dy(t,e);if(!l.startsWith("[object "))return l;if(e.__sentry_skip_normalization__)return e;let u=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(u===0)return l.replace("object ","");if(s(e))return"[Circular ~]";let f=e;if(f&&typeof f.toJSON=="function")try{let _=f.toJSON();return Zl("",_,u-1,n,i)}catch{}let m=Array.isArray(e)?[]:{},h=0,v=ca(e);for(let _ in v){if(!Object.prototype.hasOwnProperty.call(v,_))continue;if(h>=n){m[_]="[MaxProperties ~]";break}let g=v[_];m[_]=Zl(_,g,u-1,n,i),h++}return o(e),m}function Dy(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(_o(e))return"[VueViewModel]";if(Ll(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${Yt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Ry(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Ry(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Ny(t){return~-encodeURI(t).split(/%..|./).length}function Ay(t){return Ny(JSON.stringify(t))}var Ur;(function(t){t[t.PENDING=0]="PENDING";let e=1;t[t.RESOLVED=e]="RESOLVED";let r=2;t[t.REJECTED=r]="REJECTED"})(Ur||(Ur={}));function qt(t){return new sr(e=>{e(t)})}function Jr(t){return new sr((e,r)=>{r(t)})}var sr=class $i{constructor(e){$i.prototype.__init.call(this),$i.prototype.__init2.call(this),$i.prototype.__init3.call(this),$i.prototype.__init4.call(this),this._state=Ur.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(r){this._reject(r)}}then(e,r){return new $i((n,i)=>{this._handlers.push([!1,s=>{if(!e)n(s);else try{n(e(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new $i((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){n(i);return}r(i)})})}__init(){this._resolve=e=>{this._setResult(Ur.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Ur.REJECTED,e)}}__init3(){this._setResult=(e,r)=>{if(this._state===Ur.PENDING){if(Lr(r)){r.then(this._resolve,this._reject);return}this._state=e,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Ur.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Ur.RESOLVED&&r[1](this._value),this._state===Ur.REJECTED&&r[2](this._value),r[0]=!0)})}}};function eu(t){let e=[];function r(){return t===void 0||e.length<t}function n(o){return e.splice(e.indexOf(o),1)[0]||Promise.resolve(void 0)}function i(o){if(!r())return Jr(new pt("Not adding Promise because buffer limit was reached."));let l=o();return e.indexOf(l)===-1&&e.push(l),l.then(()=>n(l)).then(null,()=>n(l).then(null,()=>{})),l}function s(o){return new sr((l,u)=>{let f=e.length;if(!f)return l(!0);let m=setTimeout(()=>{o&&o>0&&l(!1)},o);e.forEach(h=>{qt(h).then(()=>{--f||(clearTimeout(m),l(!0))},u)})})}return{$:e,add:i,drain:s}}function Io(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}var um=["fatal","error","warning","log","info","debug"];function tu(t){return t==="warn"?"warning":um.includes(t)?t:"log"}var fm="sentry-",mm=/^sentry-/;function ru(t){let e=dm(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(mm)){let o=i.slice(fm.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function dm(t){if(!(!t||!Et(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=pm(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):pm(t)}function pm(t){return t.split(",").map(e=>e.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function xr(t,e=[]){return[t,e]}function iu(t,e){let[r,n]=t;return[r,[...n,e]]}function ya(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function nu(t){return ee.__SENTRY__&&ee.__SENTRY__.encodePolyfill?ee.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function ou(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[nu(n),s]:n.push(typeof s=="string"?nu(s):s)}for(let s of r){let[o,l]=s;if(i(`
|
|
28
28
|
${JSON.stringify(o)}
|
|
29
|
-
`),typeof c=="string"||c instanceof Uint8Array)i(c);else{let u;try{u=JSON.stringify(c)}catch{u=JSON.stringify(or(c))}i(u)}}return typeof n=="string"?n:Oy(n)}function Oy(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function su(t){let e=typeof t.data=="string"?nu(t.data):t.data;return[Qe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Py={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function va(t){return Py[t]}function Ea(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function au(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return b(b(b({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:wr(n)}),i&&{trace:Qe(b({},i))})}function cu(t,e,r){let n=[{type:"client_report"},{timestamp:r||Tr(),discarded_events:t}];return xr(e?{dsn:e}:{},[n])}function hm(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function gm(t,e){return t[e]||t.all||0}function lu(t,e,r=Date.now()){return gm(t,e)>r}function uu(t,{statusCode:e,headers:r},n=Date.now()){let i=b({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let c of s.trim().split(",")){let[u,f,,,m]=c.split(":",5),h=parseInt(u,10),v=(isNaN(h)?60:h)*1e3;if(!f)i.all=n+v;else for(let _ of f.split(";"))_==="metric_bucket"?(!m||m.split(";").includes("custom"))&&(i[_]=n+v):i[_]=n+v}else o?i.all=n+hm(o,n):e===429&&(i.all=n+60*1e3);return i}function Sa(){return{traceId:nt(),spanId:nt().substring(16)}}var ba=ee;function pu(){let t=ba.chrome,e=t&&t.app&&t.app.runtime,r="history"in ba&&!!ba.history.pushState&&!!ba.history.replaceState;return!e&&r}var Ce=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Tn(){return To(ee),ee}function To(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||zt,e[zt]=e[zt]||{}}function xo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Bt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:nt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}var fu="_sentrySpan";function mu(t,e){e?_t(t,fu,e):delete t[fu]}function du(t){return t[fu]}var Uy=100,hu=class xd{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Sa()}clone(){let e=new xd;return e._breadcrumbs=[...this._breadcrumbs],e._tags=b({},this._tags),e._extra=b({},this._extra),e._contexts=b({},this._contexts),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=b({},this._sdkProcessingMetadata),e._propagationContext=b({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,mu(e,du(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&xo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=b(b({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(b({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=b(b({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(b({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,[n,i]=r instanceof pt?[r.getScopeData(),r.getRequestSession()]:nr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:c,contexts:u,level:f,fingerprint:m=[],propagationContext:h}=n||{};return this._tags=b(b({},this._tags),s),this._extra=b(b({},this._extra),o),this._contexts=b(b({},this._contexts),u),c&&Object.keys(c).length&&(this._user=c),f&&(this._level=f),m.length&&(this._fingerprint=m),h&&(this._propagationContext=h),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,mu(this,void 0),this._attachments=[],this._propagationContext=Sa(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Uy;if(n<=0)return this;let i=b({timestamp:Tr()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:du(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=b(b({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:nt();if(!this._client)return q.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(b({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:nt();if(!this._client)return q.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,Z(b({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:nt();return this._client?(this._client.captureEvent(e,Z(b({},r),{event_id:n}),this),n):(q.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},pt=hu;function ym(){return wi("defaultCurrentScope",()=>new pt)}function vm(){return wi("defaultIsolationScope",()=>new pt)}var gu=class{constructor(t,e){let r;t?r=t:r=new pt;let n;e?n=e:n=new pt,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return Lr(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ci(){let t=Tn(),e=To(t);return e.stack=e.stack||new gu(ym(),vm())}function My(t){return Ci().withScope(t)}function ky(t,e){let r=Ci();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function _m(t){return Ci().withScope(()=>t(Ci().getIsolationScope()))}function Em(){return{withIsolationScope:_m,withScope:My,withSetScope:ky,withSetIsolationScope:(t,e)=>_m(e),getCurrentScope:()=>Ci().getScope(),getIsolationScope:()=>Ci().getIsolationScope()}}function wa(t){let e=To(t);return e.acs?e.acs:Em()}function xn(){let t=Tn();return wa(t).getCurrentScope()}function Cn(){let t=Tn();return wa(t).getIsolationScope()}function Ia(){return wi("globalScope",()=>new pt)}function Ta(...t){let e=Tn(),r=wa(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Ue(){return xn().getClient()}var Fy="_sentryMetrics";function Sm(t){let e=t[Fy];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Qe(i));return r}var yu="sentry.source",vu="sentry.sample_rate",_u="sentry.op",Eu="sentry.origin",Hy=1;function Im(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=Dn(t);return Qe({parent_span_id:n,span_id:e,trace_id:r})}function bm(t){return typeof t=="number"?wm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?wm(t.getTime()):Bt()}function wm(t){return t>9999999999?t/1e3:t}function Dn(t){if(jy(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if($y(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:c,status:u}=t;return Qe({span_id:e,trace_id:r,data:n,description:s,parent_span_id:c,start_timestamp:bm(i),timestamp:bm(o)||void 0,status:Wy(u),op:n[_u],origin:n[Eu],_metrics_summary:Sm(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function $y(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function jy(t){return typeof t.getSpanJSON=="function"}function Tm(t){let{traceFlags:e}=t.spanContext();return e===Hy}function Wy(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Gy="_sentryRootSpan";function Co(t){return t[Gy]||t}var xa="production",Vy="_frozenDsc";function Su(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Qe({environment:r.environment||xa,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function xm(t){let e=Ue();if(!e)return{};let r=Su(Dn(t).trace_id||"",e),n=Co(t),i=n[Vy];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&ru(o);if(c)return c;let u=Dn(n),f=u.data||{},m=f[vu];m!=null&&(r.sample_rate=`${m}`);let h=f[yu],v=u.description;return h!=="url"&&v&&(r.transaction=v),r.sampled=String(Tm(n)),e.emit("createDsc",r,n),r}function Cm(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){Ce&&q.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function zy(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Dm(t,e,r,n){let i=Ea(r),s=b(b({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:wr(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return xr(s,[o])}function Rm(t,e,r,n){let i=Ea(r),s=t.type&&t.type!=="replay_event"?t.type:"event";zy(t,r&&r.sdk);let o=au(t,i,n,e);return delete t.sdkProcessingMetadata,xr(o,[[{type:s},t]])}function Ca(t,e,r,n=0){return new sr((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(b({},e),r);Ce&&o.id&&c===null&&q.log(`Event processor "${o.id}" dropped event`),Lr(c)?c.then(u=>Ca(t,u,r,n+1).then(i)).then(null,s):Ca(t,c,r,n+1).then(i).then(null,s)}})}function Nm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;Yy(t,e),n&&Xy(t,n),Jy(t,r),qy(t,i),Ky(t,s)}function bu(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:f,eventProcessors:m,attachments:h,propagationContext:v,transactionName:_,span:g}=e;Do(t,"extra",r),Do(t,"tags",n),Do(t,"user",i),Do(t,"contexts",s),Do(t,"sdkProcessingMetadata",c),o&&(t.level=o),_&&(t.transactionName=_),g&&(t.span=g),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),f.length&&(t.fingerprint=[...t.fingerprint,...f]),m.length&&(t.eventProcessors=[...t.eventProcessors,...m]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=b(b({},t.propagationContext),v)}function Do(t,e,r){if(r&&Object.keys(r).length){t[e]=b({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function Yy(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:c}=e,u=Qe(r);u&&Object.keys(u).length&&(t.extra=b(b({},u),t.extra));let f=Qe(n);f&&Object.keys(f).length&&(t.tags=b(b({},f),t.tags));let m=Qe(i);m&&Object.keys(m).length&&(t.user=b(b({},m),t.user));let h=Qe(s);h&&Object.keys(h).length&&(t.contexts=b(b({},h),t.contexts)),o&&(t.level=o),c&&t.type!=="transaction"&&(t.transaction=c)}function qy(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Ky(t,e){t.sdkProcessingMetadata=b(b({},t.sdkProcessingMetadata),e)}function Xy(t,e){t.contexts=b({trace:Im(e)},t.contexts),t.sdkProcessingMetadata=b({dynamicSamplingContext:xm(e)},t.sdkProcessingMetadata);let r=Co(e),n=Dn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Jy(t,e){t.fingerprint=t.fingerprint?ha(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Om(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:c=1e3}=t,u=Z(b({},e),{event_id:e.event_id||r.event_id||nt(),timestamp:e.timestamp||Tr()}),f=r.integrations||t.integrations.map(y=>y.name);Qy(u,t),tv(u,f),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Zy(u,t.stackParser);let m=nv(n,r.captureContext);r.mechanism&&Br(u,r.mechanism);let h=i?i.getEventProcessors():[],v=Ia().getScopeData();if(s){let y=s.getScopeData();bu(v,y)}if(m){let y=m.getScopeData();bu(v,y)}let _=[...r.attachments||[],...v.attachments];_.length&&(r.attachments=_),Nm(u,v);let g=[...h,...v.eventProcessors];return Ca(g,u,r).then(y=>(y&&ev(y),typeof o=="number"&&o>0?rv(y,o,c):y))}function Qy(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:xa),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=Sr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=Sr(o.value,s));let c=t.request;c&&c.url&&(c.url=Sr(c.url,s))}var Am=new WeakMap;function Zy(t,e){let r=ee._sentryDebugIds;if(!r)return;let n,i=Am.get(e);i?n=i:(n=new Map,Am.set(e,n));let s=Object.entries(r).reduce((o,[c,u])=>{let f,m=n.get(c);m?f=m:(f=e(c),n.set(c,f));for(let h=f.length-1;h>=0;h--){let v=f[h];if(v.filename){o[v.filename]=u;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function ev(t){let e={};try{t.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function tv(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function rv(t,e,r){if(!t)return null;let n=b(b(b(b(b({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>b(b({},i),i.data&&{data:or(i.data,e,r)}))}),t.user&&{user:or(t.user,e,r)}),t.contexts&&{contexts:or(t.contexts,e,r)}),t.extra&&{extra:or(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=or(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>b(b({},i),i.data&&{data:or(i.data,e,r)}))),n}function nv(t,e){if(!e)return t;let r=t?t.clone():new pt;return r.update(e),r}function Pm(t){if(t)return iv(t)?{captureContext:t}:sv(t)?{captureContext:t}:t}function iv(t){return t instanceof pt||typeof t=="function"}var ov=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function sv(t){return Object.keys(t).some(e=>ov.includes(e))}function Da(t,e){return xn().captureException(t,Pm(e))}function Ro(t,e){return xn().captureEvent(t,e)}var av="7";function cv(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function lv(t){return`${cv(t)}${t.projectId}/envelope/`}function uv(t,e){return $l(b({sentry_key:t.publicKey,sentry_version:av},e&&{sentry_client:`${e.name}/${e.version}`}))}function Bm(t,e,r){return e||`${lv(t)}?${uv(t,r)}`}var Um=[];function Mm(t,e){let r={};return e.forEach(n=>{n&&Iu(t,n,r)}),r}function wu(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Iu(t,e,r){if(r[e.name]){Ce&&q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Um.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Um.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Ce&&q.log(`Integration installed: ${e.name}`)}var km="Not capturing exception because it's already been captured.",No=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=sa(t.dsn):Ce&&q.warn("No DSN provided, client will not send events."),this._dsn){let e=Bm(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(Z(b({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=nt();if(da(t))return Ce&&q.log(km),n;let i=b({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=b({event_id:nt()},r),s=Si(t)?t:String(t),o=bn(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(c=>this._captureEvent(c,i,n))),i.event_id}captureEvent(t,e,r){let n=nt();if(e&&e.originalException&&da(e.originalException))return Ce&&q.log(km),n;let i=b({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Ce&&q.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),xo(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):qt(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];Iu(this,t,this._integrations),e||wu(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=Rm(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=iu(r,su(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=Dm(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Ce&&q.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Ce&&q.error("Error while sending event:",e),e)):(Ce&&q.error("Transport disabled"),qt({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Mm(this,t),wu(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let c=o.mechanism;if(c&&c.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(xo(t,Z(b({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new sr(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=Cn()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),Om(i,t,e,r,this,n).then(o=>{if(o===null)return o;let c=b(b({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&c){let{traceId:u,spanId:f,parentSpanId:m,dsc:h}=c;o.contexts=b({trace:Qe({trace_id:u,span_id:f,parent_span_id:m})},o.contexts);let v=h||Su(u,this);o.sdkProcessingMetadata=b({dynamicSamplingContext:v},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Ce){let i=n;i.logLevel==="log"?q.log(i.message):q.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=Tu(t),o=Fm(t),c=t.type||"error",u=`before send for type \`${c}\``,f=typeof i>"u"?void 0:Cm(i);if(o&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",t),Jr(new ut(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let m=c==="replay_event"?"replay":c,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,h).then(v=>{if(v===null)throw this.recordDroppedEvent("event_processor",m,t),new ut("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return v;let _=fv(this,n,v,e);return pv(_,u)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",m,t),Tu(t)){let y=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+y}throw new ut(`${u} returned \`null\`, will not send event.`,"log")}let _=r&&r.getSession();!s&&_&&this._updateSessionFromEvent(_,v);let g=v.transaction_info;if(s&&g&&v.transaction!==t.transaction){let y="custom";v.transaction_info=Z(b({},g),{source:y})}return this.sendEvent(v,e),v}).then(null,v=>{throw v instanceof ut?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new ut(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
30
|
-
Reason: ${v}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}};function pv(t,e){let r=`${e} must return \`null\` or a valid event.`;if(Lr(t))return t.then(n=>{if(!nr(n)&&n!==null)throw new
|
|
29
|
+
`),typeof l=="string"||l instanceof Uint8Array)i(l);else{let u;try{u=JSON.stringify(l)}catch{u=JSON.stringify(or(l))}i(u)}}return typeof n=="string"?n:Oy(n)}function Oy(t){let e=t.reduce((i,s)=>i+s.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function su(t){let e=typeof t.data=="string"?nu(t.data):t.data;return[Xe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Py={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function va(t){return Py[t]}function Ea(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function au(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return b(b(b({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:wr(n)}),i&&{trace:Xe(b({},i))})}function cu(t,e,r){let n=[{type:"client_report"},{timestamp:r||Tr(),discarded_events:t}];return xr(e?{dsn:e}:{},[n])}function hm(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function gm(t,e){return t[e]||t.all||0}function lu(t,e,r=Date.now()){return gm(t,e)>r}function uu(t,{statusCode:e,headers:r},n=Date.now()){let i=b({},t),s=r&&r["x-sentry-rate-limits"],o=r&&r["retry-after"];if(s)for(let l of s.trim().split(",")){let[u,f,,,m]=l.split(":",5),h=parseInt(u,10),v=(isNaN(h)?60:h)*1e3;if(!f)i.all=n+v;else for(let _ of f.split(";"))_==="metric_bucket"?(!m||m.split(";").includes("custom"))&&(i[_]=n+v):i[_]=n+v}else o?i.all=n+hm(o,n):e===429&&(i.all=n+60*1e3);return i}function Sa(){return{traceId:nt(),spanId:nt().substring(16)}}var ba=ee;function pu(){let t=ba.chrome,e=t&&t.app&&t.app.runtime,r="history"in ba&&!!ba.history.pushState&&!!ba.history.replaceState;return!e&&r}var Ce=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Tn(){return To(ee),ee}function To(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||zt,e[zt]=e[zt]||{}}function xo(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Bt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:nt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}var fu="_sentrySpan";function mu(t,e){e?St(t,fu,e):delete t[fu]}function du(t){return t[fu]}var Uy=100,hu=class xd{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Sa()}clone(){let e=new xd;return e._breadcrumbs=[...this._breadcrumbs],e._tags=b({},this._tags),e._extra=b({},this._extra),e._contexts=b({},this._contexts),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata=b({},this._sdkProcessingMetadata),e._propagationContext=b({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,mu(e,du(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&xo(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=b(b({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(b({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=b(b({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(b({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,[n,i]=r instanceof ft?[r.getScopeData(),r.getRequestSession()]:nr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:l,contexts:u,level:f,fingerprint:m=[],propagationContext:h}=n||{};return this._tags=b(b({},this._tags),s),this._extra=b(b({},this._extra),o),this._contexts=b(b({},this._contexts),u),l&&Object.keys(l).length&&(this._user=l),f&&(this._level=f),m.length&&(this._fingerprint=m),h&&(this._propagationContext=h),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,mu(this,void 0),this._attachments=[],this._propagationContext=Sa(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Uy;if(n<=0)return this;let i=b({timestamp:Tr()},e),s=this._breadcrumbs;return s.push(i),this._breadcrumbs=s.length>n?s.slice(-n):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:du(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=b(b({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r&&r.event_id?r.event_id:nt();if(!this._client)return q.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(b({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n&&n.event_id?n.event_id:nt();if(!this._client)return q.warn("No client configured on scope - will not capture message!"),i;let s=new Error(e);return this._client.captureMessage(e,r,Z(b({originalException:e,syntheticException:s},n),{event_id:i}),this),i}captureEvent(e,r){let n=r&&r.event_id?r.event_id:nt();return this._client?(this._client.captureEvent(e,Z(b({},r),{event_id:n}),this),n):(q.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},ft=hu;function ym(){return wi("defaultCurrentScope",()=>new ft)}function vm(){return wi("defaultIsolationScope",()=>new ft)}var gu=class{constructor(t,e){let r;t?r=t:r=new ft;let n;e?n=e:n=new ft,this._stack=[{scope:r}],this._isolationScope=n}withScope(t){let e=this._pushScope(),r;try{r=t(e)}catch(n){throw this._popScope(),n}return Lr(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Ci(){let t=Tn(),e=To(t);return e.stack=e.stack||new gu(ym(),vm())}function My(t){return Ci().withScope(t)}function ky(t,e){let r=Ci();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function _m(t){return Ci().withScope(()=>t(Ci().getIsolationScope()))}function Em(){return{withIsolationScope:_m,withScope:My,withSetScope:ky,withSetIsolationScope:(t,e)=>_m(e),getCurrentScope:()=>Ci().getScope(),getIsolationScope:()=>Ci().getIsolationScope()}}function wa(t){let e=To(t);return e.acs?e.acs:Em()}function xn(){let t=Tn();return wa(t).getCurrentScope()}function Cn(){let t=Tn();return wa(t).getIsolationScope()}function Ia(){return wi("globalScope",()=>new ft)}function Ta(...t){let e=Tn(),r=wa(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Me(){return xn().getClient()}var Fy="_sentryMetrics";function Sm(t){let e=t[Fy];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Xe(i));return r}var yu="sentry.source",vu="sentry.sample_rate",_u="sentry.op",Eu="sentry.origin",Hy=1;function Im(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=Dn(t);return Xe({parent_span_id:n,span_id:e,trace_id:r})}function bm(t){return typeof t=="number"?wm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?wm(t.getTime()):Bt()}function wm(t){return t>9999999999?t/1e3:t}function Dn(t){if(jy(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if($y(t)){let{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:l,status:u}=t;return Xe({span_id:e,trace_id:r,data:n,description:s,parent_span_id:l,start_timestamp:bm(i),timestamp:bm(o)||void 0,status:Wy(u),op:n[_u],origin:n[Eu],_metrics_summary:Sm(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function $y(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function jy(t){return typeof t.getSpanJSON=="function"}function Tm(t){let{traceFlags:e}=t.spanContext();return e===Hy}function Wy(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Gy="_sentryRootSpan";function Co(t){return t[Gy]||t}var xa="production",Vy="_frozenDsc";function Su(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Xe({environment:r.environment||xa,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function xm(t){let e=Me();if(!e)return{};let r=Su(Dn(t).trace_id||"",e),n=Co(t),i=n[Vy];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),l=o&&ru(o);if(l)return l;let u=Dn(n),f=u.data||{},m=f[vu];m!=null&&(r.sample_rate=`${m}`);let h=f[yu],v=u.description;return h!=="url"&&v&&(r.transaction=v),r.sampled=String(Tm(n)),e.emit("createDsc",r,n),r}function Cm(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){Ce&&q.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function zy(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Dm(t,e,r,n){let i=Ea(r),s=b(b({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:wr(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return xr(s,[o])}function Rm(t,e,r,n){let i=Ea(r),s=t.type&&t.type!=="replay_event"?t.type:"event";zy(t,r&&r.sdk);let o=au(t,i,n,e);return delete t.sdkProcessingMetadata,xr(o,[[{type:s},t]])}function Ca(t,e,r,n=0){return new sr((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let l=o(b({},e),r);Ce&&o.id&&l===null&&q.log(`Event processor "${o.id}" dropped event`),Lr(l)?l.then(u=>Ca(t,u,r,n+1).then(i)).then(null,s):Ca(t,l,r,n+1).then(i).then(null,s)}})}function Nm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;Yy(t,e),n&&Jy(t,n),Xy(t,r),qy(t,i),Ky(t,s)}function bu(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:l,breadcrumbs:u,fingerprint:f,eventProcessors:m,attachments:h,propagationContext:v,transactionName:_,span:g}=e;Do(t,"extra",r),Do(t,"tags",n),Do(t,"user",i),Do(t,"contexts",s),Do(t,"sdkProcessingMetadata",l),o&&(t.level=o),_&&(t.transactionName=_),g&&(t.span=g),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),f.length&&(t.fingerprint=[...t.fingerprint,...f]),m.length&&(t.eventProcessors=[...t.eventProcessors,...m]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=b(b({},t.propagationContext),v)}function Do(t,e,r){if(r&&Object.keys(r).length){t[e]=b({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function Yy(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:l}=e,u=Xe(r);u&&Object.keys(u).length&&(t.extra=b(b({},u),t.extra));let f=Xe(n);f&&Object.keys(f).length&&(t.tags=b(b({},f),t.tags));let m=Xe(i);m&&Object.keys(m).length&&(t.user=b(b({},m),t.user));let h=Xe(s);h&&Object.keys(h).length&&(t.contexts=b(b({},h),t.contexts)),o&&(t.level=o),l&&t.type!=="transaction"&&(t.transaction=l)}function qy(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Ky(t,e){t.sdkProcessingMetadata=b(b({},t.sdkProcessingMetadata),e)}function Jy(t,e){t.contexts=b({trace:Im(e)},t.contexts),t.sdkProcessingMetadata=b({dynamicSamplingContext:xm(e)},t.sdkProcessingMetadata);let r=Co(e),n=Dn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Xy(t,e){t.fingerprint=t.fingerprint?ha(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Om(t,e,r,n,i,s){let{normalizeDepth:o=3,normalizeMaxBreadth:l=1e3}=t,u=Z(b({},e),{event_id:e.event_id||r.event_id||nt(),timestamp:e.timestamp||Tr()}),f=r.integrations||t.integrations.map(y=>y.name);Qy(u,t),tv(u,f),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Zy(u,t.stackParser);let m=nv(n,r.captureContext);r.mechanism&&Br(u,r.mechanism);let h=i?i.getEventProcessors():[],v=Ia().getScopeData();if(s){let y=s.getScopeData();bu(v,y)}if(m){let y=m.getScopeData();bu(v,y)}let _=[...r.attachments||[],...v.attachments];_.length&&(r.attachments=_),Nm(u,v);let g=[...h,...v.eventProcessors];return Ca(g,u,r).then(y=>(y&&ev(y),typeof o=="number"&&o>0?rv(y,o,l):y))}function Qy(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:xa),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=Sr(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=Sr(o.value,s));let l=t.request;l&&l.url&&(l.url=Sr(l.url,s))}var Am=new WeakMap;function Zy(t,e){let r=ee._sentryDebugIds;if(!r)return;let n,i=Am.get(e);i?n=i:(n=new Map,Am.set(e,n));let s=Object.entries(r).reduce((o,[l,u])=>{let f,m=n.get(l);m?f=m:(f=e(l),n.set(l,f));for(let h=f.length-1;h>=0;h--){let v=f[h];if(v.filename){o[v.filename]=u;break}}return o},{});try{t.exception.values.forEach(o=>{o.stacktrace.frames.forEach(l=>{l.filename&&(l.debug_id=s[l.filename])})})}catch{}}function ev(t){let e={};try{t.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function tv(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function rv(t,e,r){if(!t)return null;let n=b(b(b(b(b({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>b(b({},i),i.data&&{data:or(i.data,e,r)}))}),t.user&&{user:or(t.user,e,r)}),t.contexts&&{contexts:or(t.contexts,e,r)}),t.extra&&{extra:or(t.extra,e,r)});return t.contexts&&t.contexts.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=or(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>b(b({},i),i.data&&{data:or(i.data,e,r)}))),n}function nv(t,e){if(!e)return t;let r=t?t.clone():new ft;return r.update(e),r}function Pm(t){if(t)return iv(t)?{captureContext:t}:sv(t)?{captureContext:t}:t}function iv(t){return t instanceof ft||typeof t=="function"}var ov=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function sv(t){return Object.keys(t).some(e=>ov.includes(e))}function Da(t,e){return xn().captureException(t,Pm(e))}function Ro(t,e){return xn().captureEvent(t,e)}var av="7";function cv(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function lv(t){return`${cv(t)}${t.projectId}/envelope/`}function uv(t,e){return $l(b({sentry_key:t.publicKey,sentry_version:av},e&&{sentry_client:`${e.name}/${e.version}`}))}function Bm(t,e,r){return e||`${lv(t)}?${uv(t,r)}`}var Um=[];function Mm(t,e){let r={};return e.forEach(n=>{n&&Iu(t,n,r)}),r}function wu(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Iu(t,e,r){if(r[e.name]){Ce&&q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Um.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Um.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>n(i,s,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((s,o)=>n(s,o,t),{id:e.name});t.addEventProcessor(i)}Ce&&q.log(`Integration installed: ${e.name}`)}var km="Not capturing exception because it's already been captured.",No=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],t.dsn?this._dsn=sa(t.dsn):Ce&&q.warn("No DSN provided, client will not send events."),this._dsn){let e=Bm(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport(Z(b({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},t.transportOptions),{url:e}))}}captureException(t,e,r){let n=nt();if(da(t))return Ce&&q.log(km),n;let i=b({event_id:n},e);return this._process(this.eventFromException(t,i).then(s=>this._captureEvent(s,i,r))),i.event_id}captureMessage(t,e,r,n){let i=b({event_id:nt()},r),s=Si(t)?t:String(t),o=bn(t)?this.eventFromMessage(s,e,i):this.eventFromException(t,i);return this._process(o.then(l=>this._captureEvent(l,i,n))),i.event_id}captureEvent(t,e,r){let n=nt();if(e&&e.originalException&&da(e.originalException))return Ce&&q.log(km),n;let i=b({event_id:n},e),s=(t.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(t,i,s||r)),i.event_id}captureSession(t){typeof t.release!="string"?Ce&&q.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),xo(t,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(t){let e=this._transport;return e?(this.emit("flush"),this._isClientDoneProcessing(t).then(r=>e.flush(t).then(n=>r&&n))):qt(!0)}close(t){return this.flush(t).then(e=>(this.getOptions().enabled=!1,this.emit("close"),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let e=this._integrations[t.name];Iu(this,t,this._integrations),e||wu(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=Rm(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=iu(r,su(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=Dm(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;Ce&&q.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(t,e){let r=this._hooks[t]=this._hooks[t]||[];return r.push(e),()=>{let n=r.indexOf(e);n>-1&&r.splice(n,1)}}emit(t,...e){let r=this._hooks[t];r&&r.forEach(n=>n(...e))}sendEnvelope(t){return this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport?this._transport.send(t).then(null,e=>(Ce&&q.error("Error while sending event:",e),e)):(Ce&&q.error("Transport disabled"),qt({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Mm(this,t),wu(this,t)}_updateSessionFromEvent(t,e){let r=!1,n=!1,i=e.exception&&e.exception.values;if(i){n=!0;for(let o of i){let l=o.mechanism;if(l&&l.handled===!1){r=!0;break}}}let s=t.status==="ok";(s&&t.errors===0||s&&r)&&(xo(t,Z(b({},r&&{status:"crashed"}),{errors:t.errors||Number(n||r)})),this.captureSession(t))}_isClientDoneProcessing(t){return new sr(e=>{let r=0,n=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),e(!0)):(r+=n,t&&r>=t&&(clearInterval(i),e(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,e,r,n=Cn()){let i=this.getOptions(),s=Object.keys(this._integrations);return!e.integrations&&s.length>0&&(e.integrations=s),this.emit("preprocessEvent",t,e),t.type||n.setLastEventId(t.event_id||e.event_id),Om(i,t,e,r,this,n).then(o=>{if(o===null)return o;let l=b(b({},n.getPropagationContext()),r?r.getPropagationContext():void 0);if(!(o.contexts&&o.contexts.trace)&&l){let{traceId:u,spanId:f,parentSpanId:m,dsc:h}=l;o.contexts=b({trace:Xe({trace_id:u,span_id:f,parent_span_id:m})},o.contexts);let v=h||Su(u,this);o.sdkProcessingMetadata=b({dynamicSamplingContext:v},o.sdkProcessingMetadata)}return o})}_captureEvent(t,e={},r){return this._processEvent(t,e,r).then(n=>n.event_id,n=>{if(Ce){let i=n;i.logLevel==="log"?q.log(i.message):q.warn(i)}})}_processEvent(t,e,r){let n=this.getOptions(),{sampleRate:i}=n,s=Tu(t),o=Fm(t),l=t.type||"error",u=`before send for type \`${l}\``,f=typeof i>"u"?void 0:Cm(i);if(o&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",t),Jr(new pt(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let m=l==="replay_event"?"replay":l,h=(t.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(t,e,r,h).then(v=>{if(v===null)throw this.recordDroppedEvent("event_processor",m,t),new pt("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return v;let _=fv(this,n,v,e);return pv(_,u)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",m,t),Tu(t)){let y=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+y}throw new pt(`${u} returned \`null\`, will not send event.`,"log")}let _=r&&r.getSession();!s&&_&&this._updateSessionFromEvent(_,v);let g=v.transaction_info;if(s&&g&&v.transaction!==t.transaction){let y="custom";v.transaction_info=Z(b({},g),{source:y})}return this.sendEvent(v,e),v}).then(null,v=>{throw v instanceof pt?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new pt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
30
|
+
Reason: ${v}`))})}_process(t){this._numProcessing++,t.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([e,r])=>{let[n,i]=e.split(":");return{reason:n,category:i,quantity:r}})}};function pv(t,e){let r=`${e} must return \`null\` or a valid event.`;if(Lr(t))return t.then(n=>{if(!nr(n)&&n!==null)throw new pt(r);return n},n=>{throw new pt(`${e} rejected with ${n}`)});if(!nr(t)&&t!==null)throw new pt(r);return t}function fv(t,e,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e;if(Fm(r)&&i)return i(r,n);if(Tu(r)){if(r.spans&&o){let l=[];for(let u of r.spans){let f=o(u);f?l.push(f):t.recordDroppedEvent("before_send","span")}r.spans=l}if(s)return s(r,n)}return r}function Fm(t){return t.type===void 0}function Tu(t){return t.type==="transaction"}var mv=64;function Ra(t,e,r=eu(t.bufferSize||mv)){let n={},i=o=>r.drain(o);function s(o){let l=[];if(ya(o,(h,v)=>{let _=va(v);if(lu(n,_)){let g=Hm(h,v);t.recordDroppedEvent("ratelimit_backoff",_,g)}else l.push(h)}),l.length===0)return qt({});let u=xr(o[0],l),f=h=>{ya(u,(v,_)=>{let g=Hm(v,_);t.recordDroppedEvent(h,va(_),g)})},m=()=>e({body:ou(u)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&Ce&&q.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=uu(n,h),h),h=>{throw f("network_error"),h});return r.add(m).then(h=>h,h=>{if(h instanceof pt)return Ce&&q.error("Skipped sending event because buffer is full."),f("queue_overflow"),qt({});throw h})}return{send:s,flush:i}}function Hm(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function xu(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(s=>({name:`${n}:@sentry/${s}`,version:zt})),version:zt}),t._metadata=i}var dv=100;function Cr(t,e){let r=Me(),n=Cn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=dv}=r.getOptions();if(s<=0)return;let o=Tr(),l=b({timestamp:o},t),u=i?Ti(()=>i(l,e)):l;u!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",u,e),n.addBreadcrumb(u,s))}var $m,hv="FunctionToString",jm=new WeakMap,gv=()=>({name:hv,setupOnce(){$m=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=In(this),r=jm.has(Me())&&e!==void 0?e:this;return $m.apply(r,t)}}catch{}},setup(t){jm.set(t,!0)}}),Na=gv,yv=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler"],vv="InboundFilters",_v=(t={})=>({name:vv,processEvent(e,r,n){let i=n.getOptions(),s=Ev(t,i);return Sv(e,s)?null:e}}),Oa=_v;function Ev(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:yv],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function Sv(t,e){return e.ignoreInternal&&Cv(t)?(Ce&&q.warn(`Event dropped due to being internal Sentry Error.
|
|
31
31
|
Event: ${ir(t)}`),!0):bv(t,e.ignoreErrors)?(Ce&&q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
32
32
|
Event: ${ir(t)}`),!0):Rv(t)?(Ce&&q.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
33
33
|
Event: ${ir(t)}`),!0):wv(t,e.ignoreTransactions)?(Ce&&q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
@@ -35,7 +35,7 @@ Event: ${ir(t)}`),!0):Iv(t,e.denyUrls)?(Ce&&q.warn(`Event dropped due to being m
|
|
|
35
35
|
Event: ${ir(t)}.
|
|
36
36
|
Url: ${Aa(t)}`),!0):Tv(t,e.allowUrls)?!1:(Ce&&q.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
37
37
|
Event: ${ir(t)}.
|
|
38
|
-
Url: ${Aa(t)}`),!0)}function bv(t,e){return t.type||!e||!e.length?!1:xv(t).some(r=>bi(r,e))}function wv(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?bi(r,e):!1}function Iv(t,e){if(!e||!e.length)return!1;let r=Aa(t);return r?bi(r,e):!1}function Tv(t,e){if(!e||!e.length)return!0;let r=Aa(t);return r?bi(r,e):!0}function xv(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function Cv(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function Dv(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Aa(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?Dv(e):null}catch{return Ce&&q.error(`Cannot extract url for event ${ir(t)}`),null}}function Rv(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var Nv="Dedupe",Av=()=>{let t;return{name:Nv,processEvent(e){if(e.type)return e;try{if(Ov(e,t))return Ce&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Pa=Av;function Ov(t,e){return e?!!(Pv(t,e)||Lv(t,e)):!1}function Pv(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Vm(t,e)||!Gm(t,e))}function Lv(t,e){let r=Wm(e),n=Wm(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Vm(t,e)||!Gm(t,e))}function Gm(t,e){let r=ua(t),n=ua(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function Vm(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function Wm(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ge=ee,Cu=0;function Du(){return Cu>0}function Yv(){Cu++,setTimeout(()=>{Cu--})}function Rn(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(In(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>Rn(o,e));return t.apply(this,s)}catch(s){throw Yv(),Ta(o=>{o.addEventProcessor(c=>(e.mechanism&&(xi(c,void 0,void 0),Br(c,e.mechanism)),c.extra=Z(b({},c.extra),{arguments:i}),c)),Da(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}aa(n,t),_t(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Mr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function La(t,e){let r=Au(t,e),n={type:e&&e.name,value:Qv(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function qv(t,e,r,n){let i=Ue(),s=i&&i.getOptions().normalizeDepth,o=t_(e),c={__serialized__:ga(e,s)};if(o)return{exception:{values:[La(t,o)]},extra:c};let u={exception:{values:[{type:wn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Zv(e,{isUnhandledRejection:n})}]},extra:c};if(r){let f=Au(t,r);f.length&&(u.exception.values[0].stacktrace={frames:f})}return u}function Ru(t,e){return{exception:{values:[La(t,e)]}}}function Au(t,e){let r=e.stacktrace||e.stack||"",n=Xv(e),i=Jv(e);try{return t(r,n,i)}catch{}return[]}var Kv=/Minified React error #\d+;/i;function Xv(t){return t&&Kv.test(t.message)?1:0}function Jv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Qv(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Km(t,e,r,n){let i=r&&r.syntheticException||void 0,s=Ba(t,e,i,n);return Br(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),qt(s)}function Xm(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Nu(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),qt(o)}function Ba(t,e,r,n,i){let s;if(na(e)&&e.error)return Ru(t,e.error);if(ia(e)||Al(e)){let o=e;if("stack"in e)s=Ru(t,e);else{let c=o.name||(ia(o)?"DOMError":"DOMException"),u=o.message?`${c}: ${o.message}`:c;s=Nu(t,u,r,n),xi(s,u)}return"code"in o&&(s.tags=Z(b({},s.tags),{"DOMException.code":`${o.code}`})),s}return Sn(e)?Ru(t,e):nr(e)||wn(e)?(s=qv(t,e,r,i),Br(s,{synthetic:!0}),s):(s=Nu(t,e,r,n),xi(s,`${e}`,void 0),Br(s,{synthetic:!0}),s)}function Nu(t,e,r,n){let i={};if(n&&r){let s=Au(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(Si(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function Zv(t,{isUnhandledRejection:e}){let r=jl(t),n=e?"promise rejection":"exception";return na(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:wn(t)?`Event \`${e_(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function e_(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function t_(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Jm(t,{metadata:e,tunnel:r,dsn:n}){let i=b(b({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:wr(n)}),s=r_(t);return xr(i,[s])}function r_(t){return[{type:"user_report"},t]}var Ao=class extends No{constructor(t){let e=b({parentSpanIsAlwaysRootSpan:!0},t),r=Ge.SENTRY_SDK_SOURCE||Ql();xu(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ge.document&&Ge.document.addEventListener("visibilitychange",()=>{Ge.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return Km(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return Xm(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Mr&&q.warn("SDK not enabled, will not capture user feedback.");return}let e=Jm(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Mr&&q.log("No outcomes to send");return}if(!this._dsn){Mr&&q.log("No dsn provided, will not send outcomes");return}Mr&&q.log("Sending outcomes:",t);let e=cu(t,this._options.tunnel&&wr(this._dsn));this.sendEnvelope(e)}},Qm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ye=ee,n_=1e3,Zm,Ou,Pu;function Lu(t){let e="dom";Et(e,t),St(e,i_)}function i_(){if(!Ye.document)return;let t=Ze.bind(null,"dom"),e=ed(t,!0);Ye.document.addEventListener("click",e,!1),Ye.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Ye[r]&&Ye[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Pe(n,"addEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},m=f[s]=f[s]||{refCount:0};if(!m.handler){let h=ed(t);m.handler=h,i.call(this,s,h,c)}m.refCount++}catch{}return i.call(this,s,o,c)}}),Pe(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__||{},m=f[s];m&&(m.refCount--,m.refCount<=0&&(i.call(this,s,m.handler,c),m.handler=void 0,delete f[s]),Object.keys(f).length===0&&delete u.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,c)}}))})}function o_(t){if(t.type!==Ou)return!1;try{if(!t.target||t.target._sentryId!==Pu)return!1}catch{}return!0}function s_(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function ed(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=a_(r);if(s_(r.type,n))return;_t(r,"_sentryCaptured",!0),n&&!n._sentryId&&_t(n,"_sentryId",nt());let i=r.type==="keypress"?"input":r.type;o_(r)||(t({event:r,name:i,global:e}),Ou=r.type,Pu=n?n._sentryId:void 0),clearTimeout(Zm),Zm=Ye.setTimeout(()=>{Pu=void 0,Ou=void 0},n_)}}function a_(t){try{return t.target}catch{return null}}var Ua;function Bu(t){let e="history";Et(e,t),St(e,c_)}function c_(){if(!pu())return;let t=Ye.onpopstate;Ye.onpopstate=function(...r){let n=Ye.location.href,i=Ua;if(Ua=n,Ze("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=Ua,o=String(i);Ua=o,Ze("history",{from:s,to:o})}return r.apply(this,n)}}Pe(Ye.history,"pushState",e),Pe(Ye.history,"replaceState",e)}var Ma={};function Uu(t){let e=Ma[t];if(e)return e;let r=Ye[t];if(bo(r))return Ma[t]=r.bind(Ye);let n=Ye.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){Qm&&q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ma[t]=r.bind(Ye))}function ka(t){Ma[t]=void 0}var Nn="__sentry_xhr_v3__";function Mu(t){let e="xhr";Et(e,t),St(e,l_)}function l_(){if(!Ye.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Pe(t,"open",function(e){return function(...r){let n=Bt()*1e3,i=vt(r[0])?r[0].toUpperCase():void 0,s=u_(r[1]);if(!i||!s)return e.apply(this,r);this[Nn]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let c=this[Nn];if(c&&this.readyState===4){try{c.status_code=this.status}catch{}let u={endTimestamp:Bt()*1e3,startTimestamp:n,xhr:this};Ze("xhr",u)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Pe(this,"onreadystatechange",function(c){return function(...u){return o(),c.apply(this,u)}}):this.addEventListener("readystatechange",o),Pe(this,"setRequestHeader",function(c){return function(...u){let[f,m]=u,h=this[Nn];return h&&vt(f)&&vt(m)&&(h.request_headers[f.toLowerCase()]=m),c.apply(this,u)}}),e.apply(this,r)}}),Pe(t,"send",function(e){return function(...r){let n=this[Nn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:Bt()*1e3,xhr:this};return Ze("xhr",i),e.apply(this,r)}})}function u_(t){if(vt(t))return t;try{return t.toString()}catch{}}function ku(t,e=Uu("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let c=b({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return ka("fetch"),Jr("No fetch implementation available");try{return e(t.url,c).then(u=>(r-=o,n--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return ka("fetch"),r-=o,n--,Jr(u)}}return Ra(t,i)}var p_=30,f_=50;function Fu(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?Ir:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var m_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,d_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,h_=/\((\S*)(?::(\d+))(?::(\d+))\)/,g_=t=>{let e=m_.exec(t);if(e){let[,n,i,s]=e;return Fu(n,Ir,+i,+s)}let r=d_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=h_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=id(r[1]||Ir,r[2]);return Fu(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},td=[p_,g_],y_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,v_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,__=t=>{let e=y_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=v_.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||Ir;return[n,r]=id(n,r),Fu(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},rd=[f_,__],nd=[td,rd],Hu=Gl(...nd),id=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Ir,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Fa=1024,S_="Breadcrumbs",b_=(t={})=>{let e=b({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:S_,setup(r){e.console&&Vl(T_(r)),e.dom&&Lu(I_(r,e.dom)),e.xhr&&Mu(x_(r)),e.fetch&&Kl(C_(r)),e.history&&Bu(D_(r)),e.sentry&&r.on("beforeSendEvent",w_(r))}}},od=b_;function w_(t){return function(e){Ue()===t&&Cr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:ir(e)},{event:e})}}function I_(t,e){return function(r){if(Ue()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>Fa&&(Mr&&q.warn(`\`dom.maxStringLength\` cannot exceed ${Fa}, but a value of ${o} was configured. Sentry will use ${Fa} instead.`),o=Fa),typeof s=="string"&&(s=[s]);try{let u=r.event,f=R_(u)?u.target:u;n=Eo(f,{keyAttrs:s,maxStringLength:o}),i=Fl(f)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),Cr(c,{event:r.event,name:r.name,global:r.global})}}function T_(t){return function(e){if(Ue()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:tu(e.level),message:oa(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${oa(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Cr(r,{input:e.args,level:e.level})}}function x_(t){return function(e){if(Ue()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[Nn];if(!r||!n||!i)return;let{method:s,url:o,status_code:c,body:u}=i,f={method:s,url:o,status_code:c},m={xhr:e.xhr,input:u,startTimestamp:r,endTimestamp:n};Cr({category:"xhr",data:f,type:"http"},m)}}function C_(t){return function(e){if(Ue()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};Cr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=Z(b({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};Cr({category:"fetch",data:s,type:"http"},o)}}}function D_(t){return function(e){if(Ue()!==t)return;let r=e.from,n=e.to,i=Io(Ge.location.href),s=r?Io(r):void 0,o=Io(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Cr({category:"navigation",data:{from:r,to:n}})}}function R_(t){return!!t&&!!t.target}var N_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],A_="BrowserApiErrors",O_=(t={})=>{let e=b({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:A_,setupOnce(){e.setTimeout&&Pe(Ge,"setTimeout",sd),e.setInterval&&Pe(Ge,"setInterval",sd),e.requestAnimationFrame&&Pe(Ge,"requestAnimationFrame",P_),e.XMLHttpRequest&&"XMLHttpRequest"in Ge&&Pe(XMLHttpRequest.prototype,"send",L_);let r=e.eventTarget;r&&(Array.isArray(r)?r:N_).forEach(B_)}}},ad=O_;function sd(t){return function(...e){let r=e[0];return e[0]=Rn(r,{mechanism:{data:{function:Yt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function P_(t){return function(e){return t.apply(this,[Rn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Yt(t)},handled:!1,type:"instrument"}})])}}function L_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Pe(r,n,function(i){let s={mechanism:{data:{function:n,handler:Yt(i)},handled:!1,type:"instrument"}},o=In(i);return o&&(s.mechanism.data.handler=Yt(o)),Rn(i,s)})}),t.apply(this,e)}}function B_(t){let e=Ge,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Pe(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=Rn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Yt(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Rn(s,{mechanism:{data:{function:"addEventListener",handler:Yt(s),target:t},handled:!1,type:"instrument"}}),o])}}),Pe(r,"removeEventListener",function(n){return function(i,s,o){let c=s;try{let u=c&&c.__sentry_wrapped__;u&&n.call(this,i,u,o)}catch{}return n.call(this,i,c,o)}}))}var U_="GlobalHandlers",M_=(t={})=>{let e=b({onerror:!0,onunhandledrejection:!0},t);return{name:U_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(k_(r),cd("onerror")),e.onunhandledrejection&&(F_(r),cd("onunhandledrejection"))}}},ld=M_;function k_(t){Xl(e=>{let{stackParser:r,attachStacktrace:n}=ud();if(Ue()!==t||Du())return;let{msg:i,url:s,line:o,column:c,error:u}=e,f=j_(Ba(r,u||i,void 0,n,!1),s,o,c);f.level="error",Ro(f,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function F_(t){Jl(e=>{let{stackParser:r,attachStacktrace:n}=ud();if(Ue()!==t||Du())return;let i=H_(e),s=bn(i)?$_(i):Ba(r,i,void 0,n,!0);s.level="error",Ro(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function H_(t){if(bn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function $_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function j_(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},c=o.stacktrace=o.stacktrace||{},u=c.frames=c.frames||[],f=isNaN(parseInt(n,10))?void 0:n,m=isNaN(parseInt(r,10))?void 0:r,h=vt(e)&&e.length>0?e:kl();return u.length===0&&u.push({colno:f,filename:h,function:Ir,in_app:!0,lineno:m}),t}function cd(t){Mr&&q.log(`Global Handler attached: ${t}`)}function ud(){let t=Ue();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var pd=()=>({name:"HttpContext",preprocessEvent(t){if(!Ge.navigator&&!Ge.location&&!Ge.document)return;let e=t.request&&t.request.url||Ge.location&&Ge.location.href,{referrer:r}=Ge.document||{},{userAgent:n}=Ge.navigator||{},i=b(b(b({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=Z(b(b({},t.request),e&&{url:e}),{headers:i});t.request=s}}),W_="cause",G_=5,V_="LinkedErrors",z_=(t={})=>{let e=t.limit||G_,r=t.key||W_;return{name:V_,preprocessEvent(n,i,s){let o=s.getOptions();Ul(La,o.stackParser,o.maxValueLength,r,e,n,i)}}},fd=z_;function $u(t){return[Oa(),Na(),ad(),od(),ld(),fd(),Pa(),pd()]}var ju=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},Me=class Td{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Td),this.INSTANCE}captureException(e,r,n){w.error(e),this.getNewScope(r,n).captureException(e)}captureMessage(e,r,n,i){this.getNewScope(n,i).captureMessage(e,r??"error")}captureError(e,r,n,i){w.error(e,r);let s=this.getNewScope(n,i),o=new ju(e,r);s.captureException(o)}setGlobalContext(e,r){this.contexts[e]=b({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new pt;if(n.setClient(this.client),n.setUser(this.user),e?.triggerContext){let i=e.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete e.triggerContext}return e&&n.setExtras(e),this.tags&&n.setTags(this.tags),r&&n.setTags(r),Object.keys(this.contexts).forEach(i=>{n.setContext(i,this.contexts[i])}),n.setTag("language",navigator.language),n.setTag("timezone",se.getTimezone()),n}init(){let e=$u({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Ao({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:ku,stackParser:Hu,integrations:e,environment:Zt.mode,release:`web-sdk@${A.SDK_VERSION}`,debug:Zt.debug}),this.client.init()}},Wu={d:(t,e)=>{for(var r in e)Wu.o(e,r)&&!Wu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Gu={};Wu.d(Gu,{A:()=>K_,k:()=>Vu});var Y_=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(f){try{u(n.next(f))}catch(m){s(m)}}function c(f){try{u(n.throw(f))}catch(m){s(m)}}function u(f){var m;f.done?i(f.value):(m=f.value,m instanceof r?m:new r(function(h){h(m)})).then(o,c)}u((n=n.apply(t,e||[])).next())})},q_=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(u){return function(f){return function(m){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,m[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&m[0]?n.return:m[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,m[1])).done)return i;switch(n=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,n=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=e.call(t,o)}catch(h){m=[6,h],n=0}finally{r=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([u,f])}}};function Vu(){return Y_(this,void 0,Promise,function(){return q_(this,function(_a){switch(_a.label){case 0:return[4,new Promise(function(resolve,reject){var browserName="Unknown";function __callback(t){resolve({isPrivate:t,browserName})}function identifyChromium(){var t=navigator.userAgent;return t.match(/Chrome/)?navigator.brave!==void 0?"Brave":t.match(/Edg/)?"Edge":t.match(/OPR/)?"Opera":"Chrome":"Chromium"}function assertEvalToString(t){return t===eval.toString().length}function feid(){var toFixedEngineID=0;try{eval("(-1).toFixed(-1);")}catch(t){toFixedEngineID=t.message.length}return toFixedEngineID}function isSafari(){return feid()===44}function isChrome(){return feid()===51}function isFirefox(){return feid()===25}function isMSIE(){return navigator.msSaveBlob!==void 0&&assertEvalToString(39)}function newSafariTest(){var t=String(Math.random());try{window.indexedDB.open(t,1).onupgradeneeded=function(e){var r,n,i=(r=e.target)===null||r===void 0?void 0:r.result;try{i.createObjectStore("test",{autoIncrement:!0}).put(new Blob),__callback(!1)}catch(o){var s=o;return o instanceof Error&&(s=(n=o.message)!==null&&n!==void 0?n:o),typeof s!="string"?void __callback(!1):void __callback(s.includes("BlobURLs are not yet supported"))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch{__callback(!1)}}function oldSafariTest(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch{return void __callback(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch{return void __callback(!0)}__callback(!1)}function safariPrivateTest(){navigator.maxTouchPoints!==void 0?newSafariTest():oldSafariTest()}function getQuotaLimit(){var t=window;return t.performance!==void 0&&t.performance.memory!==void 0&&t.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824}function storageQuotaChromePrivateTest(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(t,e){__callback(Math.round(e/1048576)<2*Math.round(getQuotaLimit()/1048576))},function(t){reject(new Error("detectIncognito somehow failed to query storage quota: "+t.message))})}function oldChromePrivateTest(){(0,window.webkitRequestFileSystem)(0,1,function(){__callback(!1)},function(){__callback(!0)})}function chromePrivateTest(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?storageQuotaChromePrivateTest():oldChromePrivateTest()}function firefoxPrivateTest(){__callback(navigator.serviceWorker===void 0)}function msiePrivateTest(){__callback(window.indexedDB===void 0)}function main(){isSafari()?(browserName="Safari",safariPrivateTest()):isChrome()?(browserName=identifyChromium(),chromePrivateTest()):isFirefox()?(browserName="Firefox",firefoxPrivateTest()):isMSIE()?(browserName="Internet Explorer",msiePrivateTest()):reject(new Error("detectIncognito cannot determine the browser"))}main()})];case 1:return[2,_a.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Vu);var K_=Vu,md=Gu.A,HL=Gu.k,yd=Qt(tn()),Ha=class{parser;result={};constructor(){this.parser=At.get().getUAParser()}async get(){let t=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},t.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},t.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},t.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},t.navigatorUA=navigator.userAgent,t.isHeadless=navigator.webdriver,t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}},Di=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=cn[t]?.toLowerCase();e&&(w.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},Ri=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),A.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=b({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return w.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},$a=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof hr&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(A.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},ja=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),w.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},Wa=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=ue.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?A.EVENT_TRIGGER_CLICKED:A.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&this.closeTriggerAndSendEvent(t),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:this.collectFormData();break;case void 0:case 105:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;se.isValidURL(t)||(t=`//${t}`),window.open(t,"_self")}}prompt(){let t=this.action.pmpt;t&&(t===2&&this.promptLocationPermission(),t===3&&this.promptPushNotificationPermission(),t===1&&this.promptCameraPermission())}closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){w.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}promptLocationPermission(){!navigator.geolocation||!navigator.permissions||navigator.geolocation.getCurrentPosition(t=>{this.apiService.updateDeviceProps({coords:[t.coords.latitude,t.coords.longitude]}),this.sendPermissionData()})}promptPushNotificationPermission(){if(!("Notification"in window)){w.warn("This browser does not support desktop notification");return}if(Notification.permission!=="default"){this.apiService.updateDeviceProps({pnPerm:Notification.permission});return}Notification.requestPermission().then(()=>{this.sendPermissionData()})}promptCameraPermission(){navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally(()=>{this.sendPermissionData()})}checkPermission(t){return navigator.permissions.query({name:t}).then(e=>e.state.toString())}async checkAllPermission(){let t=await this.checkPermission("camera"),e=await this.checkPermission("geolocation"),r=Notification.permission;return{camera:t,location:e,notification:r}}sendPermissionData(){this.checkAllPermission().then(t=>{this.apiService.updateDeviceProps({perm:t})})}collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}this.closeTriggerAndSendEvent(A.EVENT_FORM_SUBMITTED,{form:t}),se.showSnackbar("Coupon applied on cart"),ja.updateIdentity(t)}dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};document.dispatchEvent(new CustomEvent(A.CTA_EVENT,{detail:e}));let r={action:this.containsCTA()?A.CAMPAIGN_CLICKED_ACTIVITY:A.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(A.POPUP_ACTIVITY_EVENT,{detail:r}))}},Ni=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},Kt=class{renderer=At.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new Ni(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=Z(b(b(b(b({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new sn(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new Wa(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Dr=class extends Kt{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=A.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let 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",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?Qn[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},Oo=class extends Dr{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},Po=class extends Kt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},An=class extends Kt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},Lo=class Cd extends Kt{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(A.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",Cd.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=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{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return b(b({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){this.renderer.setStyle(this.inappHTMLEl,"position","block");return}this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}},Va=class extends Kt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(A.IN_APP_CONTAINER_NAME),this}},Ai=class extends Dr{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},za=class Dd extends Ai{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(Dd.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},Ya=class Ad extends Ai{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(Ad.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},qa=class Bn extends Dr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(b(b(b({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Bn.DAYS)),e.hour&&this.elements.push(this.getChild(Bn.HOURS)),e.minute&&this.elements.push(this.getChild(Bn.MINUTES)),e.second&&this.elements.push(this.getChild(Bn.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${Bn.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Bn.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Bn.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Bn.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},Ka=class extends Dr{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new dr(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},Xa=class extends An{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},Ja=Qt(tn()),Rr=class Nd{static INSTANCE=new Nd;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new yt),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new yt),this.topics[e].asObservable()}},et=class Gr{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=He.get().website??{};currentState=!1;drawerSubject=new fo({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count"].join(",");cartSelector=[Gr.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize()}get element(){return this.cartDrawerElement}static get(){return Gr._instance||(Gr._instance=new Gr),Gr._instance}static forceUpdate(){Gr._instance=new Gr}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return Ja.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){w.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(A.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){w.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===Gr.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(this.isShopifyDefaultDrawer())this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e));else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer?.init)new window.theme.CartDrawer().init();else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else w.info("No method found to update the cart without refreshing");r&&Rr.get().broadcast(A.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(A.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!Ae.isShopify())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await se.retrySelector(e),!this.cartDrawerElement){Ja.default.warn("Max attempts exhausted to find cart drawer");return}Ja.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObserver()}async findCartDrawerWithShadow(){if(!Ae.isShopify()||!this.shadowParentElementSelector)return;let e=(await se.retrySelector(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObserver())}isVisible(){if(!this.cartDrawerElement)return!1;let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,c=this.cartDrawerElement.tagName.toLowerCase()===Gr.DEFAULT_SELECTOR&&this.cartDrawerElement.open,u=getComputedStyle(this.cartDrawerElement),f=u.display!=="none"&&u.visibility!=="hidden"&&parseFloat(u.opacity)>0,m=!this.cartDrawerElement.hidden,h=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,v=u.transform.match(/matrix\(([^)]+)\)/),_=0,g=0;if(v){let V=v[1].split(", ").map(parseFloat);_=V[4],g=V[5]}let y=_+e.left>n||_+e.right<0||g+e.top>r||g+e.bottom<0,C=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),O=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),H=C*O,R=e.width*e.height,k=R>0&&H/R>=.1;return(o||c||!y)&&f&&m&&h&&k}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new yt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(rr(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}},Oi=class bc{static ACTIVE_TRIGGER_DATA;renderer=At.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=ue.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Lt(e))}async renderEngagement(e){if(!e.previewType&&bc.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mi(bc.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(e,r);return}if(bc.ACTIVE_TRIGGER_DATA=e,this.triggerContext=new Ri(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!et.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=et.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(fe.get().isGoKwikPopupOpen){this.skipTrigger(this.triggerContext.triggerData,{reason:"GoKwik popup is open"});return}try{this.startRendering()}catch(e){Me.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Lo(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new ve(A.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:A.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(A.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new ve(r,e,this.triggerContext.triggerData);n.name===A.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof ri?new za(e,r,n).render():r instanceof ni?new Ya(e,r,n).render():r instanceof Yr?new Oo(e,r,n).render():r instanceof ii?new Xa(e,r,n).render():r instanceof Or?new An(e,r,n).render():r instanceof an?new Po(e,r,n).render():r instanceof ei?new qa(e,r,n).render():r instanceof ti?new Ka(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Va(this.rootContainer,r,e).render().getHTMLElement(),new $a().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),bc.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){At.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new ve(A.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}},Qa=class{triggerData;safeHttpService=ue.getInstance();render(t){t.contentSource===qi.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){w.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new ve(A.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new ve(A.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new ve(A.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(Ft.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},Za=class{static trackIntent(t){if(!this.isInstalled()){w.log("Facebook pixel not installed");return}if(!He.get().pixelPush){w.log("Facebook pixel push not enabled");return}let e=cn[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(w.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},hd=Qt(dd()),On=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ae.isShopify()}},X_=(0,hd.default)(fetch),J_={retryDelay:A.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=A.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},xt=class Od{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Od),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{w.log("Updated user profile"),await Pn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{w.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{w.log("Sent Order")}).catch(r=>{w.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{w.log("Updated device property")}).catch(async r=>{w.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!On.isECommerceApp()&&!On.getFlags().allowEvents)return w.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Zt.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){return Me.getInstance().captureException(c,{body:JSON.stringify(n)}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=b(b({},J_),r),i=await X_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((c,u)=>{o.setRequestHeader(u,c)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(c){s(c)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",A.SDK),e.set("cooee-sdk-code",A.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",A.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),Zt.debug&&e.set("cooee-sdk-debug",String(1)),e}},Pi=class{static sentryService=Me.getInstance();static httpApiService=xt.getInstance();static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await ge.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(t.isCartRecovery()){let i=ge.getCurrent().items,s=[];for(let o of t.items)for(let c of o.vars){let u=i.find(h=>h.variant_id.toString()===c.mID);if(!u)continue;let f=new Tt(o);f.name=u.title;let m=new dr(c);m.name=u.variant_title,m.price.d=u.discounted_price/100,f.variants=[m],s.push(f)}return s}if(He.get().currencyCount<=1)return t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t.engagementID)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new ve(A.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw ue.getInstance().sendEvent(s),new Error(i)}return n}static async updatedItem(t,e){let r=t,n,i=Ae.getRootPrefix()+`products/${r.slug}.js`;try{n=await this.httpApiService.request(i)}catch(s){return w.error(`Failed to fetch ${i}`,s),s instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${s.status}`,"error",{item:r,path:i},{"engagement.id":e}):this.sentryService.captureException(s,{item:r,path:i},{"engagement.id":e}),null}return n?(r.name=n.title,r.vars.map(s=>{let o=n.variants.find(c=>c.id===+s.mID);s.name=o.title,s.price.d=o.price?o.price/100:o.price,s.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price}),r):(w.error("Item not found after AJAX call for:",r),null)}},ec=class kd{static INSTANCE;httpService=ae.get(xt);sentryService=ae.get(Me);sessionManager=ae.get(qe);runtime=fe.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new kd),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>w.error(`Failed to send ${e.name}`,r))}async send(e){if(w.debug(`Sending event ${e.name}`),Xt.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){w.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==A.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",e).then(async r=>{w.log("\u2705 Event tracked:",e.name),Xt.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{w.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=_r.parseFromCurrent()}async addShopifyContext(e){if(Ae.isShopify())try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(r){w.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{w.error("Failed to display a campaign",n,e,r),this.sentryService.captureException(n,{event:e,response:r})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){w.log(`Nothing to engage after ${e.name}`);return}w.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Lt(r.triggerData);n.occurred=e.occurred;let i;try{i=await Pi.refreshItems(n)}catch(s){w.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===qi.KLAVIYO){new Qa().render(n);return}new Oi().renderEngagement(n).catch(s=>{w.error("Failed to render popup",s),this.sentryService.captureException(s,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(Di.trackIntent(e.intent),Za.trackIntent(e),Xt.prepend(`Intent is <strong>${cn[e.intent]}</strong>`))}addShopifyAttributes(){Ae.isShopify()&&ge.getCurrent().addCooeeAttributes().catch(e=>{w.error("Fail to add attributes in cart",e)})}},ue=class Pd{static INSTANCE;httpApiService=xt.getInstance();eventAPIService=ec.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Pd),this.INSTANCE}sendEvent(e){w.debug(`Waiting for auth to send event ${e.name}`),qe.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){qe.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){qe.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){qe.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Xt=class{static isOn=!1;static element;static watch(){let t=w.getDebugParam();(t==="1"||t==="on")&&ue.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;let e=document.createElement("div");e.innerHTML="• "+new Date().toLocaleString()+" - "+t,this.element.prepend(e)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),document.body.appendChild(this.element)}static dragElement(){let t=0,e=0,r=0,n=0,i=c=>{c=c||window.event,c.preventDefault(),r=c.clientX,n=c.clientY,document.onmouseup=o,document.onmousemove=s},s=c=>{c=c||window.event,c.preventDefault(),t=r-c.clientX,e=n-c.clientY,r=c.clientX,n=c.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=i}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},Bo=class extends zr{static storeName="app";static{this.storage=Kn(this.storeName)}},tc=class{static processConfiguration(){let t=He.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&ue.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Ne.get(ne.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Ne.set(ne.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=He.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},rc=class Rd{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Rd),this.INSTANCE}init(){Bo.get(ne.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){w.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Bo.set(ne.APP_CONFIG,r).catch(n=>w.error(n)),tc.processConfiguration(),r.website&&(lt.injectRawScript(r.website.commonJS),lt.injectRawCSS(r.website.commonCSS)),et.get().onToggle().subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(ae.get(ar).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Se.globalRef.config.update(e);return et.forceUpdate(),w.debug("App configurations",r),r}async trackViewCartEvent(){let e=await ge.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};ue.getInstance().sendEvent(new ve(A.EVENT_VIEW_CART,n))}},gd=Qt(Sl()),nc=class Xu{static META_REQUIRED_FIELDS=["ad_id","campaign_id","fbclid"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new gd.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Xu(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Xu(r)}},Pn=class Ld{static INSTANCE=new Ld;httpAPIService=xt.getInstance();coreService=rc.getInstance();sentryService=Me.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ne.set(ne.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ne.set(ne.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Ne.set(ne.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),w.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);w.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw w.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Ne.get(ne.SDK_TOKEN),!this.sdkToken){w.warn("No SDK token found in local storage");return}this.userID=await Ne.get(ne.ID),this.deviceID=await Ne.get(ne.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){w.debug("SDK Token:",this.sdkToken),w.log("Device ID:",this.deviceID),w.log("User ID:",this.userID),Di.trackDeviceID(this.deviceID),Xt.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.httpAPIService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new Ha().get();r.host=location.origin;try{(await md())?.isPrivate&&(r.private=!0)}catch(i){yd.default.error("Unable to detect private/incognito window",i)}let n=await Ne.get(ne.DEVICE_ID);return n||(n=new Je().toHexString(),await Ne.set(ne.DEVICE_ID,n)),Z(b({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:A.SDK,page:_r.parseFromCurrent(),ad:nc.getAdParams(),occurred:this.getSessionStartTime(fe.get().jsLoadTime),currentItem:fe.get().getCurrentItem(),cart:await ge.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Ne.get(ne.FIRST_SEEN),r=e?new Date(e):new Date;e||await Ne.set(ne.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>A.IDLE_TIME_IN_SECONDS?new Date:e}},qe=class wc{static replaySubject=new ho(1);static INSTANCE;sentryService=ae.get(Me);lock=new Xn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new wc),this.INSTANCE}init(e){if(w.debug("Initialising SDK",e),zf(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}Pn.getInstance().init(e),wc.INSTANCE.checkForNewSession(!0).then(async()=>{wc.replaySubject.next(!0),wc.replaySubject.complete()}).catch(r=>w.error("Unable to perform device init",r))}getCurrentSessionID(){return ct.set(ne.SESSION_LAST_USED_TIME,new Date().getTime()),ct.get(ne.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){await this.lock.acquire();let r=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();await Pn.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await ct.set(ne.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){w.debug("Starting new session"),await ct.clear(),w.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Je().toHexString();w.debug("New session ID to be used",r);let n=await Ne.get(ne.SESSION_NUMBER,0)+1;Xt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ne.set(ne.SESSION_NUMBER,n),ct.set(ne.ID,r),ct.set(ne.SESSION_LAST_USED_TIME,e.getTime()),ct.set(ne.SESSION_LANDING_PAGE,_r.parseFromCurrent())])}getLandingPage(){return ct.get(ne.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ne.get(ne.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await ct.get(ne.ID))return!0;let e=await ct.get(ne.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>A.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await ct.get(ne.SESSION_SYNCED,!1)}},_d=Qt(tn()),vd=Qt(tn()),Q_=`
|
|
38
|
+
Url: ${Aa(t)}`),!0)}function bv(t,e){return t.type||!e||!e.length?!1:xv(t).some(r=>bi(r,e))}function wv(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?bi(r,e):!1}function Iv(t,e){if(!e||!e.length)return!1;let r=Aa(t);return r?bi(r,e):!1}function Tv(t,e){if(!e||!e.length)return!0;let r=Aa(t);return r?bi(r,e):!0}function xv(t){let e=[];t.message&&e.push(t.message);let r;try{r=t.exception.values[t.exception.values.length-1]}catch{}return r&&r.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`)),e}function Cv(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function Dv(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Aa(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?Dv(e):null}catch{return Ce&&q.error(`Cannot extract url for event ${ir(t)}`),null}}function Rv(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}var Nv="Dedupe",Av=()=>{let t;return{name:Nv,processEvent(e){if(e.type)return e;try{if(Ov(e,t))return Ce&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Pa=Av;function Ov(t,e){return e?!!(Pv(t,e)||Lv(t,e)):!1}function Pv(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Vm(t,e)||!Gm(t,e))}function Lv(t,e){let r=Wm(e),n=Wm(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Vm(t,e)||!Gm(t,e))}function Gm(t,e){let r=ua(t),n=ua(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let s=n[i],o=r[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function Vm(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function Wm(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ge=ee,Cu=0;function Du(){return Cu>0}function Yv(){Cu++,setTimeout(()=>{Cu--})}function Rn(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(In(t))return t}catch{return t}let n=function(){let i=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let s=i.map(o=>Rn(o,e));return t.apply(this,s)}catch(s){throw Yv(),Ta(o=>{o.addEventProcessor(l=>(e.mechanism&&(xi(l,void 0,void 0),Br(l,e.mechanism)),l.extra=Z(b({},l.extra),{arguments:i}),l)),Da(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}aa(n,t),St(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Mr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function La(t,e){let r=Au(t,e),n={type:e&&e.name,value:Qv(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function qv(t,e,r,n){let i=Me(),s=i&&i.getOptions().normalizeDepth,o=t_(e),l={__serialized__:ga(e,s)};if(o)return{exception:{values:[La(t,o)]},extra:l};let u={exception:{values:[{type:wn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Zv(e,{isUnhandledRejection:n})}]},extra:l};if(r){let f=Au(t,r);f.length&&(u.exception.values[0].stacktrace={frames:f})}return u}function Ru(t,e){return{exception:{values:[La(t,e)]}}}function Au(t,e){let r=e.stacktrace||e.stack||"",n=Jv(e),i=Xv(e);try{return t(r,n,i)}catch{}return[]}var Kv=/Minified React error #\d+;/i;function Jv(t){return t&&Kv.test(t.message)?1:0}function Xv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Qv(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Km(t,e,r,n){let i=r&&r.syntheticException||void 0,s=Ba(t,e,i,n);return Br(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),qt(s)}function Jm(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Nu(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),qt(o)}function Ba(t,e,r,n,i){let s;if(na(e)&&e.error)return Ru(t,e.error);if(ia(e)||Al(e)){let o=e;if("stack"in e)s=Ru(t,e);else{let l=o.name||(ia(o)?"DOMError":"DOMException"),u=o.message?`${l}: ${o.message}`:l;s=Nu(t,u,r,n),xi(s,u)}return"code"in o&&(s.tags=Z(b({},s.tags),{"DOMException.code":`${o.code}`})),s}return Sn(e)?Ru(t,e):nr(e)||wn(e)?(s=qv(t,e,r,i),Br(s,{synthetic:!0}),s):(s=Nu(t,e,r,n),xi(s,`${e}`,void 0),Br(s,{synthetic:!0}),s)}function Nu(t,e,r,n){let i={};if(n&&r){let s=Au(t,r);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]})}if(Si(e)){let{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function Zv(t,{isUnhandledRejection:e}){let r=jl(t),n=e?"promise rejection":"exception";return na(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:wn(t)?`Event \`${e_(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function e_(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function t_(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Xm(t,{metadata:e,tunnel:r,dsn:n}){let i=b(b({event_id:t.event_id,sent_at:new Date().toISOString()},e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}}),!!r&&!!n&&{dsn:wr(n)}),s=r_(t);return xr(i,[s])}function r_(t){return[{type:"user_report"},t]}var Ao=class extends No{constructor(t){let e=b({parentSpanIsAlwaysRootSpan:!0},t),r=Ge.SENTRY_SDK_SOURCE||Ql();xu(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ge.document&&Ge.document.addEventListener("visibilitychange",()=>{Ge.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return Km(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return Jm(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Mr&&q.warn("SDK not enabled, will not capture user feedback.");return}let e=Xm(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(e)}_prepareEvent(t,e,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,r)}_flushOutcomes(){let t=this._clearOutcomes();if(t.length===0){Mr&&q.log("No outcomes to send");return}if(!this._dsn){Mr&&q.log("No dsn provided, will not send outcomes");return}Mr&&q.log("Sending outcomes:",t);let e=cu(t,this._options.tunnel&&wr(this._dsn));this.sendEnvelope(e)}},Qm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ye=ee,n_=1e3,Zm,Ou,Pu;function Lu(t){let e="dom";bt(e,t),wt(e,i_)}function i_(){if(!Ye.document)return;let t=Qe.bind(null,"dom"),e=ed(t,!0);Ye.document.addEventListener("click",e,!1),Ye.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Ye[r]&&Ye[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Le(n,"addEventListener",function(i){return function(s,o,l){if(s==="click"||s=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},m=f[s]=f[s]||{refCount:0};if(!m.handler){let h=ed(t);m.handler=h,i.call(this,s,h,l)}m.refCount++}catch{}return i.call(this,s,o,l)}}),Le(n,"removeEventListener",function(i){return function(s,o,l){if(s==="click"||s=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__||{},m=f[s];m&&(m.refCount--,m.refCount<=0&&(i.call(this,s,m.handler,l),m.handler=void 0,delete f[s]),Object.keys(f).length===0&&delete u.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,o,l)}}))})}function o_(t){if(t.type!==Ou)return!1;try{if(!t.target||t.target._sentryId!==Pu)return!1}catch{}return!0}function s_(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function ed(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=a_(r);if(s_(r.type,n))return;St(r,"_sentryCaptured",!0),n&&!n._sentryId&&St(n,"_sentryId",nt());let i=r.type==="keypress"?"input":r.type;o_(r)||(t({event:r,name:i,global:e}),Ou=r.type,Pu=n?n._sentryId:void 0),clearTimeout(Zm),Zm=Ye.setTimeout(()=>{Pu=void 0,Ou=void 0},n_)}}function a_(t){try{return t.target}catch{return null}}var Ua;function Bu(t){let e="history";bt(e,t),wt(e,c_)}function c_(){if(!pu())return;let t=Ye.onpopstate;Ye.onpopstate=function(...r){let n=Ye.location.href,i=Ua;if(Ua=n,Qe("history",{from:i,to:n}),t)try{return t.apply(this,r)}catch{}};function e(r){return function(...n){let i=n.length>2?n[2]:void 0;if(i){let s=Ua,o=String(i);Ua=o,Qe("history",{from:s,to:o})}return r.apply(this,n)}}Le(Ye.history,"pushState",e),Le(Ye.history,"replaceState",e)}var Ma={};function Uu(t){let e=Ma[t];if(e)return e;let r=Ye[t];if(bo(r))return Ma[t]=r.bind(Ye);let n=Ye.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch(i){Qm&&q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Ma[t]=r.bind(Ye))}function ka(t){Ma[t]=void 0}var Nn="__sentry_xhr_v3__";function Mu(t){let e="xhr";bt(e,t),wt(e,l_)}function l_(){if(!Ye.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Le(t,"open",function(e){return function(...r){let n=Bt()*1e3,i=Et(r[0])?r[0].toUpperCase():void 0,s=u_(r[1]);if(!i||!s)return e.apply(this,r);this[Nn]={method:i,url:s,request_headers:{}},i==="POST"&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let o=()=>{let l=this[Nn];if(l&&this.readyState===4){try{l.status_code=this.status}catch{}let u={endTimestamp:Bt()*1e3,startTimestamp:n,xhr:this};Qe("xhr",u)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Le(this,"onreadystatechange",function(l){return function(...u){return o(),l.apply(this,u)}}):this.addEventListener("readystatechange",o),Le(this,"setRequestHeader",function(l){return function(...u){let[f,m]=u,h=this[Nn];return h&&Et(f)&&Et(m)&&(h.request_headers[f.toLowerCase()]=m),l.apply(this,u)}}),e.apply(this,r)}}),Le(t,"send",function(e){return function(...r){let n=this[Nn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:Bt()*1e3,xhr:this};return Qe("xhr",i),e.apply(this,r)}})}function u_(t){if(Et(t))return t;try{return t.toString()}catch{}}function ku(t,e=Uu("fetch")){let r=0,n=0;function i(s){let o=s.body.length;r+=o,n++;let l=b({body:s.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return ka("fetch"),Jr("No fetch implementation available");try{return e(t.url,l).then(u=>(r-=o,n--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return ka("fetch"),r-=o,n--,Jr(u)}}return Ra(t,i)}var p_=30,f_=50;function Fu(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?Ir:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var m_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,d_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,h_=/\((\S*)(?::(\d+))(?::(\d+))\)/,g_=t=>{let e=m_.exec(t);if(e){let[,n,i,s]=e;return Fu(n,Ir,+i,+s)}let r=d_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=h_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=id(r[1]||Ir,r[2]);return Fu(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},td=[p_,g_],y_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,v_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,__=t=>{let e=y_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=v_.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],n=e[1]||Ir;return[n,r]=id(n,r),Fu(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},rd=[f_,__],nd=[td,rd],Hu=Gl(...nd),id=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:Ir,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Fa=1024,S_="Breadcrumbs",b_=(t={})=>{let e=b({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:S_,setup(r){e.console&&Vl(T_(r)),e.dom&&Lu(I_(r,e.dom)),e.xhr&&Mu(x_(r)),e.fetch&&Kl(C_(r)),e.history&&Bu(D_(r)),e.sentry&&r.on("beforeSendEvent",w_(r))}}},od=b_;function w_(t){return function(e){Me()===t&&Cr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:ir(e)},{event:e})}}function I_(t,e){return function(r){if(Me()!==t)return;let n,i,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>Fa&&(Mr&&q.warn(`\`dom.maxStringLength\` cannot exceed ${Fa}, but a value of ${o} was configured. Sentry will use ${Fa} instead.`),o=Fa),typeof s=="string"&&(s=[s]);try{let u=r.event,f=R_(u)?u.target:u;n=Eo(f,{keyAttrs:s,maxStringLength:o}),i=Fl(f)}catch{n="<unknown>"}if(n.length===0)return;let l={category:`ui.${r.name}`,message:n};i&&(l.data={"ui.component_name":i}),Cr(l,{event:r.event,name:r.name,global:r.global})}}function T_(t){return function(e){if(Me()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:tu(e.level),message:oa(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${oa(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Cr(r,{input:e.args,level:e.level})}}function x_(t){return function(e){if(Me()!==t)return;let{startTimestamp:r,endTimestamp:n}=e,i=e.xhr[Nn];if(!r||!n||!i)return;let{method:s,url:o,status_code:l,body:u}=i,f={method:s,url:o,status_code:l},m={xhr:e.xhr,input:u,startTimestamp:r,endTimestamp:n};Cr({category:"xhr",data:f,type:"http"},m)}}function C_(t){return function(e){if(Me()!==t)return;let{startTimestamp:r,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let i=e.fetchData,s={data:e.error,input:e.args,startTimestamp:r,endTimestamp:n};Cr({category:"fetch",data:i,level:"error",type:"http"},s)}else{let i=e.response,s=Z(b({},e.fetchData),{status_code:i&&i.status}),o={input:e.args,response:i,startTimestamp:r,endTimestamp:n};Cr({category:"fetch",data:s,type:"http"},o)}}}function D_(t){return function(e){if(Me()!==t)return;let r=e.from,n=e.to,i=Io(Ge.location.href),s=r?Io(r):void 0,o=Io(n);(!s||!s.path)&&(s=i),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),Cr({category:"navigation",data:{from:r,to:n}})}}function R_(t){return!!t&&!!t.target}var N_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],A_="BrowserApiErrors",O_=(t={})=>{let e=b({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:A_,setupOnce(){e.setTimeout&&Le(Ge,"setTimeout",sd),e.setInterval&&Le(Ge,"setInterval",sd),e.requestAnimationFrame&&Le(Ge,"requestAnimationFrame",P_),e.XMLHttpRequest&&"XMLHttpRequest"in Ge&&Le(XMLHttpRequest.prototype,"send",L_);let r=e.eventTarget;r&&(Array.isArray(r)?r:N_).forEach(B_)}}},ad=O_;function sd(t){return function(...e){let r=e[0];return e[0]=Rn(r,{mechanism:{data:{function:Yt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function P_(t){return function(e){return t.apply(this,[Rn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Yt(t)},handled:!1,type:"instrument"}})])}}function L_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Le(r,n,function(i){let s={mechanism:{data:{function:n,handler:Yt(i)},handled:!1,type:"instrument"}},o=In(i);return o&&(s.mechanism.data.handler=Yt(o)),Rn(i,s)})}),t.apply(this,e)}}function B_(t){let e=Ge,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Le(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=Rn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Yt(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Rn(s,{mechanism:{data:{function:"addEventListener",handler:Yt(s),target:t},handled:!1,type:"instrument"}}),o])}}),Le(r,"removeEventListener",function(n){return function(i,s,o){let l=s;try{let u=l&&l.__sentry_wrapped__;u&&n.call(this,i,u,o)}catch{}return n.call(this,i,l,o)}}))}var U_="GlobalHandlers",M_=(t={})=>{let e=b({onerror:!0,onunhandledrejection:!0},t);return{name:U_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(k_(r),cd("onerror")),e.onunhandledrejection&&(F_(r),cd("onunhandledrejection"))}}},ld=M_;function k_(t){Jl(e=>{let{stackParser:r,attachStacktrace:n}=ud();if(Me()!==t||Du())return;let{msg:i,url:s,line:o,column:l,error:u}=e,f=j_(Ba(r,u||i,void 0,n,!1),s,o,l);f.level="error",Ro(f,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function F_(t){Xl(e=>{let{stackParser:r,attachStacktrace:n}=ud();if(Me()!==t||Du())return;let i=H_(e),s=bn(i)?$_(i):Ba(r,i,void 0,n,!0);s.level="error",Ro(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function H_(t){if(bn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function $_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function j_(t,e,r,n){let i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},l=o.stacktrace=o.stacktrace||{},u=l.frames=l.frames||[],f=isNaN(parseInt(n,10))?void 0:n,m=isNaN(parseInt(r,10))?void 0:r,h=Et(e)&&e.length>0?e:kl();return u.length===0&&u.push({colno:f,filename:h,function:Ir,in_app:!0,lineno:m}),t}function cd(t){Mr&&q.log(`Global Handler attached: ${t}`)}function ud(){let t=Me();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var pd=()=>({name:"HttpContext",preprocessEvent(t){if(!Ge.navigator&&!Ge.location&&!Ge.document)return;let e=t.request&&t.request.url||Ge.location&&Ge.location.href,{referrer:r}=Ge.document||{},{userAgent:n}=Ge.navigator||{},i=b(b(b({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),s=Z(b(b({},t.request),e&&{url:e}),{headers:i});t.request=s}}),W_="cause",G_=5,V_="LinkedErrors",z_=(t={})=>{let e=t.limit||G_,r=t.key||W_;return{name:V_,preprocessEvent(n,i,s){let o=s.getOptions();Ul(La,o.stackParser,o.maxValueLength,r,e,n,i)}}},fd=z_;function $u(t){return[Oa(),Na(),ad(),od(),ld(),fd(),Pa(),pd()]}var ju=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},ke=class Td{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Td),this.INSTANCE}captureException(e,r,n){w.error(e),this.getNewScope(r,n).captureException(e)}captureMessage(e,r,n,i){this.getNewScope(n,i).captureMessage(e,r??"error")}captureError(e,r,n,i){w.error(e,r);let s=this.getNewScope(n,i),o=new ju(e,r);s.captureException(o)}setGlobalContext(e,r){this.contexts[e]=b({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new ft;if(n.setClient(this.client),n.setUser(this.user),e?.triggerContext){let i=e.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete e.triggerContext}return e&&n.setExtras(e),this.tags&&n.setTags(this.tags),r&&n.setTags(r),Object.keys(this.contexts).forEach(i=>{n.setContext(i,this.contexts[i])}),n.setTag("language",navigator.language),n.setTag("timezone",ne.getTimezone()),n}init(){let e=$u({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Ao({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:ku,stackParser:Hu,integrations:e,environment:Zt.mode,release:`web-sdk@${A.SDK_VERSION}`,debug:Zt.debug}),this.client.init()}},Wu={d:(t,e)=>{for(var r in e)Wu.o(e,r)&&!Wu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Gu={};Wu.d(Gu,{A:()=>K_,k:()=>Vu});var Y_=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(f){try{u(n.next(f))}catch(m){s(m)}}function l(f){try{u(n.throw(f))}catch(m){s(m)}}function u(f){var m;f.done?i(f.value):(m=f.value,m instanceof r?m:new r(function(h){h(m)})).then(o,l)}u((n=n.apply(t,e||[])).next())})},q_=function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(u){return function(f){return function(m){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,m[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&m[0]?n.return:m[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,m[1])).done)return i;switch(n=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,n=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=e.call(t,o)}catch(h){m=[6,h],n=0}finally{r=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([u,f])}}};function Vu(){return Y_(this,void 0,Promise,function(){return q_(this,function(_a){switch(_a.label){case 0:return[4,new Promise(function(resolve,reject){var browserName="Unknown";function __callback(t){resolve({isPrivate:t,browserName})}function identifyChromium(){var t=navigator.userAgent;return t.match(/Chrome/)?navigator.brave!==void 0?"Brave":t.match(/Edg/)?"Edge":t.match(/OPR/)?"Opera":"Chrome":"Chromium"}function assertEvalToString(t){return t===eval.toString().length}function feid(){var toFixedEngineID=0;try{eval("(-1).toFixed(-1);")}catch(t){toFixedEngineID=t.message.length}return toFixedEngineID}function isSafari(){return feid()===44}function isChrome(){return feid()===51}function isFirefox(){return feid()===25}function isMSIE(){return navigator.msSaveBlob!==void 0&&assertEvalToString(39)}function newSafariTest(){var t=String(Math.random());try{window.indexedDB.open(t,1).onupgradeneeded=function(e){var r,n,i=(r=e.target)===null||r===void 0?void 0:r.result;try{i.createObjectStore("test",{autoIncrement:!0}).put(new Blob),__callback(!1)}catch(o){var s=o;return o instanceof Error&&(s=(n=o.message)!==null&&n!==void 0?n:o),typeof s!="string"?void __callback(!1):void __callback(s.includes("BlobURLs are not yet supported"))}finally{i.close(),window.indexedDB.deleteDatabase(t)}}}catch{__callback(!1)}}function oldSafariTest(){var t=window.openDatabase,e=window.localStorage;try{t(null,null,null,null)}catch{return void __callback(!0)}try{e.setItem("test","1"),e.removeItem("test")}catch{return void __callback(!0)}__callback(!1)}function safariPrivateTest(){navigator.maxTouchPoints!==void 0?newSafariTest():oldSafariTest()}function getQuotaLimit(){var t=window;return t.performance!==void 0&&t.performance.memory!==void 0&&t.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824}function storageQuotaChromePrivateTest(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(t,e){__callback(Math.round(e/1048576)<2*Math.round(getQuotaLimit()/1048576))},function(t){reject(new Error("detectIncognito somehow failed to query storage quota: "+t.message))})}function oldChromePrivateTest(){(0,window.webkitRequestFileSystem)(0,1,function(){__callback(!1)},function(){__callback(!0)})}function chromePrivateTest(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?storageQuotaChromePrivateTest():oldChromePrivateTest()}function firefoxPrivateTest(){__callback(navigator.serviceWorker===void 0)}function msiePrivateTest(){__callback(window.indexedDB===void 0)}function main(){isSafari()?(browserName="Safari",safariPrivateTest()):isChrome()?(browserName=identifyChromium(),chromePrivateTest()):isFirefox()?(browserName="Firefox",firefoxPrivateTest()):isMSIE()?(browserName="Internet Explorer",msiePrivateTest()):reject(new Error("detectIncognito cannot determine the browser"))}main()})];case 1:return[2,_a.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Vu);var K_=Vu,md=Gu.A,VL=Gu.k,yd=Qt(tn()),Ha=class{parser;result={};constructor(){this.parser=At.get().getUAParser()}async get(){let t=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},t.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},t.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},t.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},t.navigatorUA=navigator.userAgent,t.isHeadless=navigator.webdriver,t}getDeviceMemory(){let t=navigator;if(!t.deviceMemory)return;let e=t.deviceMemory;this.result.mem={tot:e*1024}}getNetworkType(){let t=navigator,e=t.connection||t.mozConnection||t.webkitConnection;e?.effectiveType&&(this.result.net={type:e.effectiveType})}getOrientation(){let t=screen.orientation?.type;t&&(this.result.orientation=t)}getDPI(){let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(t=>{navigator.geolocation.getCurrentPosition(e=>{this.result.coords=[e.coords.latitude,e.coords.longitude],t()},()=>t())})}async getBatteryInfo(){if("getBattery"in navigator)try{let t=await navigator.getBattery();this.result.bat={l:t.level*100,c:t.charging}}catch{}}},Di=class{static trackDeviceID(t){this.isInstalled()}static trackIntent(t){if(!this.isInstalled())return;let e=cn[t]?.toLowerCase();e&&(w.debug(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}},Ri=class{constructor(t,e){this._startTime=t,this._triggerData=e}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),A.IN_APP_WRAPPER_NAME+"-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,e){e??={};let r=(new Date().getTime()-this.startTime.getTime())/1e3,n=b({eventName:t,duration:r},e);this.stopIntervals(),this.closeCallback&&this.closeCallback(n)}addInputField(t,e){this.inputFields.push({id:t,type:e,isValid:!1})}updateValidation(t,e){this.inputFields.forEach(r=>{if(r.id===t){r.isValid=e;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:e=1,max:r=100}=this.triggerData.manipulation.productQuantity;if(e>r)return w.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%100;return n<e?e:n>r?r:n}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}},$a=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof hr&&this.loadFamily(e.typography?.fam)})}async loadFamily(t){if(!t?.fonts||this.loadedFonts.indexOf(t.name)>-1)return;let e=[];t.fonts.forEach(r=>{if(r.url){let n=new FontFace(A.COOEE+t.name,r.getURL(),r.getFontDescriptor());e.push(n.load())}}),this.loadedFonts.push(t.name),(await Promise.all(e)).forEach(r=>{document.fonts.add(r)})}},ja=class{static updateIdentity(t){if(!this.isInstalled())return;let e={};t.email&&(e.email=t.email),t.mobile&&(e.phone_number=t.mobile),w.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",e])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}},Wa=class{apiService;action;triggerContext;constructor(t,e){this.action=t,this.apiService=pe.getInstance(),this.triggerContext=e}async execute(){let t=this.containsCTA()?A.EVENT_TRIGGER_CLICKED:A.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&this.closeTriggerAndSendEvent(t),this.action.at){case 2:break;case 4:this.gotoURLAction();break;case 5:this.shareAction();break;case 106:this.collectFormData();break;case void 0:case 105:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let t=this.action.gu.u;ne.isValidURL(t)||(t=`//${t}`),window.open(t,"_self")}}prompt(){let t=this.action.pmpt;t&&(t===2&&this.promptLocationPermission(),t===3&&this.promptPushNotificationPermission(),t===1&&this.promptCameraPermission())}closeTriggerAndSendEvent(t,e){this.triggerContext.closeInApp(t,e),this.dispatchEvent()}shareAction(){if(this.action.share){if(!navigator.share){w.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(t=>console.log(t)).catch(t=>console.error(t))}}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(t){return t?Object.keys(t).length===0:!0}promptLocationPermission(){!navigator.geolocation||!navigator.permissions||navigator.geolocation.getCurrentPosition(t=>{this.apiService.updateDeviceProps({coords:[t.coords.latitude,t.coords.longitude]}),this.sendPermissionData()})}promptPushNotificationPermission(){if(!("Notification"in window)){w.warn("This browser does not support desktop notification");return}if(Notification.permission!=="default"){this.apiService.updateDeviceProps({pnPerm:Notification.permission});return}Notification.requestPermission().then(()=>{this.sendPermissionData()})}promptCameraPermission(){navigator.mediaDevices&&navigator.mediaDevices.getUserMedia({video:!0}).finally(()=>{this.sendPermissionData()})}checkPermission(t){return navigator.permissions.query({name:t}).then(e=>e.state.toString())}async checkAllPermission(){let t=await this.checkPermission("camera"),e=await this.checkPermission("geolocation"),r=Notification.permission;return{camera:t,location:e,notification:r}}sendPermissionData(){this.checkAllPermission().then(t=>{this.apiService.updateDeviceProps({perm:t})})}collectFormData(){let t={};for(let e of this.triggerContext.inputs){if(!e.isValid)return;let r=document.getElementById(e.id).value;e.type===51?t.email=r:e.type===52&&(t.mobile=r)}this.closeTriggerAndSendEvent(A.EVENT_FORM_SUBMITTED,{form:t}),ne.showSnackbar("Coupon applied on cart"),ja.updateIdentity(t)}dispatchEvent(){let t=this.triggerContext.triggerData,e={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??t.embeddedItems??t.items,collections:t.collections,triggerData:t};document.dispatchEvent(new CustomEvent(A.CTA_EVENT,{detail:e}));let r={action:this.containsCTA()?A.CAMPAIGN_CLICKED_ACTIVITY:A.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(A.POPUP_ACTIVITY_EVENT,{detail:r}))}},Ni=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let e={display:t.disp};return t.of&&(e.objectFit=t.of),t.pos==="absolute"&&(e.width="auto !important",e.position="absolute",e.right=t.right+"px",e.left=t.left+"px",e.top=t.top+"px",e.bottom=t.bottom+"px"),e}getSizeStyles(t){let e={};return t?.w&&(e.width=t.w),t?.h&&(e.height=t.h),t?.maxW&&(e.maxWidth=t.maxW),t?.maxH&&(e.maxHeight=t.maxH),t?.minW&&(e.minWidth=t.minW),t?.minH&&(e.minHeight=t.minH),e}getBorderStyles(t){if(!t)return{};let e={};return t.radius&&t.radius>0&&(e.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(e.borderWidth=this.getSizePx(t.width),e.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",e):e.borderColor="black"),e}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let e={};return t?(e.paddingTop=this.getSizePx(t.pt),e.paddingBottom=this.getSizePx(t.pb),e.paddingLeft=this.getSizePx(t.pl),e.paddingRight=this.getSizePx(t.pr),e.marginTop=this.getSizePx(t.mt),e.marginBottom=this.getSizePx(t.mb),e.marginLeft=t.cent?"auto":this.getSizePx(t.ml),e.marginRight=t.cent?"auto":this.getSizePx(t.mr),e):(e.margin="0 !important",e.padding="unset",e)}getBackgroundStyles(t){if(!t)return{};let e={};if(t.glossy){let r="backdrop-filter",n="-webkit-"+r,i=`blur(${t.glossy.radius}px)`;if(!CSS.supports(n,i)&&!CSS.supports(r,i))return{background:t.glossy.fallback.rgba};if(e[n]=i,e[r]=i,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",e)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",e);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let r=(t.img.a??0)/100;e.background=`linear-gradient(rgba(0, 0, 0, ${r}), rgba(0, 0, 0, ${r})),url("${t.img.src}") no-repeat center`,e.backgroundSize="cover",t.img.a&&(e["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,e.backdropFilter=`opacity(${t.img.a})`)}return e}getGradientStyles(t,e,r){if(r??={},t.type==="LINEAR"){let n=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(n+=`, ${t.c3}`),n+=")",r[e]=n}return r}getColourStyles(t,e="color",r){return r??={},t?t.grad?this.getGradientStyles(t.grad,e,r):(t.hex&&(r[e]=t.rgba),r):r}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}},Kt=class{renderer=At.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(t,e,r){this.parentHTMLEl=t,this.inappElement=e,this.triggerContext=r,this.stylesConverter=new Ni(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.renderer.appendChild(this.parentHTMLEl,this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let t=Z(b(b(b(b({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,t)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&this.renderer.setStyle(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&this.renderer.setStyle(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let t={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,t)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let t=this.inappElement.alpha;if(!isNaN(t)){let e=(t/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",e)}}processShadow(){let t=this.inappElement.shd;t?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",t.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let t=new sn(this.inappElement.trf);t&&t.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${t.rotate}deg)`)}registerAction(){let t=this.inappElement.clc;!t||Object.keys(t).length===0||(this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation(),new Wa(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Dr=class extends Kt{constructor(t,e,r){super(t,e,r)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let t={},e=this.inappElement.typography;return e&&(t.fontSize=this.stylesConverter.getSizePx(e.fs),t.fontFamily=A.COOEE+e.fam?.name,t.lineHeight=`${e.lh}`,t.letterSpacing=e.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",t),this.renderer.setStyles(this.inappHTMLEl,t),t}processPart(t,e){let 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",e.c??"inherit"),this.renderer.setStyle(t,"font-family","inherit")}processAlignment(){let t=this.inappElement.typography.ta,e=t?Qn[t]?.toLowerCase():this.inappElement.typography.alignment;e||(e="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",e)}},Oo=class extends Dr{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(t=>{let e=this.renderer.createElement("span");e.innerHTML=t.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(e,t),this.renderer.appendChild(this.inappHTMLEl,e)}),this.processCommonBlocks()}},Po=class extends Kt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},An=class extends Kt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}},Lo=class Cd extends Kt{constructor(e,r,n){super(e,r,n),this.parent=e,this.inappHTMLEl=this.renderer.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(this.triggerContext),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(A.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",Cd.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let e=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{let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(e.w)+r.getHorizontal(),i=this.stylesConverter.getScaledSize(e.h)+r.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",n+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return b(b({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){if(this.renderer.isParentNotBody()){if(this.triggerContext.triggerData.ian?.isEmbedded()){this.renderer.setStyle(this.inappHTMLEl,"position","block");return}this.renderer.setStyle(this.inappHTMLEl,"position","absolute")}else this.renderer.setStyle(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}},Va=class extends Kt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(A.IN_APP_CONTAINER_NAME),this}},Ai=class extends Dr{borderColor="";constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let t=this.setInputType();this.renderer.setAttribute(this.inappHTMLEl,"placeholder",this.inappElement.placeholderText),this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",e=>{e.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,t),this.triggerContext.addInputField(t,this.inappElement.t)}},za=class Dd extends Ai{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","email"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(Dd.EMAIL_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},Ya=class Ad extends Ai{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.renderer.setAttribute(this.inappHTMLEl,"type","tel"),this.renderer.setAttribute(this.inappHTMLEl,"id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(Ad.MOBILE_REGEX)?(this.renderer.setStyle(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(this.renderer.setStyle(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}},qa=class Bn extends Dr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(b(b(b({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>this.renderer.setStyles(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(Bn.DAYS)),e.hour&&this.elements.push(this.getChild(Bn.HOURS)),e.minute&&this.elements.push(this.getChild(Bn.MINUTES)),e.second&&this.elements.push(this.getChild(Bn.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=this.renderer.createElement("div"),n=this.renderer.createElement("span"),i=this.renderer.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,this.renderer.setStyle(i,"font-size","0.5em"),this.renderer.setStyle(i,"text-align","center"),this.renderer.setStyle(i,"font-family","inherit"),this.renderer.setStyle(n,"text-align","center"),this.renderer.setStyle(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),this.renderer.setStyle(r,"display","flex"),this.renderer.setStyle(r,"flex-direction",this.inappElement.horizontal?"":"column"),this.renderer.setStyle(r,"justify-content","center"),this.renderer.setStyle(r,"align-items","center"),this.renderer.setStyle(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${Bn.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${Bn.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${Bn.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${Bn.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}},Ka=class extends Dr{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(t){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),t.addEventListener("click",e=>{e.stopPropagation()}),t.addEventListener("change",()=>{let e=new dr(JSON.parse(t.value));this.updateItems(e)})}updateItems(t){let e=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[e.toEmbed(t)];let r=this.parentHTMLEl.querySelector("#coo-13");if(!r)return;let n=t.imgs[0]??e.imgs?.at(0);n?.url&&r.setAttribute("src",n.url)}addOptions(){let t=this.triggerContext.triggerData.items,e=this.inappHTMLEl;if(!t?.length){e.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);t[0].vars.forEach(n=>{e.add(this.createOption(n.name??"Default",n,n.mID===r?.vID))})}createOption(t,e,r){let n=this.renderer.createElement("option");return n.text=t,n.value=JSON.stringify(e),r&&(n.selected=!0),e||(n.disabled=!0),n}},Ja=class extends An{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},Xa=Qt(tn()),Rr=class Nd{static INSTANCE=new Nd;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new _t),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new _t),this.topics[e].asObservable()}},Ze=class Wr{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Oe.get().website??{};currentState=!1;drawerSubject=new fo({open:!1,firstOpen:!1});mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count"].join(",");cartSelector=[Wr.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize()}get element(){return this.cartDrawerElement}static get(){return Wr._instance||(Wr._instance=new Wr),Wr._instance}static forceUpdate(){Wr._instance=new Wr}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return Xa.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){w.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(A.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){w.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===Wr.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(this.isShopifyDefaultDrawer())this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e));else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,s=e.items[0].price;window.cartGiftUpdate(n,s,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer?.init)new window.theme.CartDrawer().init();else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else w.info("No method found to update the cart without refreshing");r&&Rr.get().broadcast(A.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(A.SHADOW_SPLITTER);r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!Ae.isShopify())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await ne.retrySelector(e),!this.cartDrawerElement){Xa.default.warn("Max attempts exhausted to find cart drawer");return}Xa.default.log("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObserver()}async findCartDrawerWithShadow(){if(!Ae.isShopify()||!this.shadowParentElementSelector)return;let e=(await ne.retrySelector(this.shadowParentElementSelector))?.shadowRoot;e?.mode==="open"&&(this.cartDrawerShadowElement=e,this.createMutationObserver())}isVisible(){if(!this.cartDrawerElement)return!1;let e=this.cartDrawerElement.getBoundingClientRect(),r=(window.innerHeight||document.documentElement.clientHeight)+.5,n=(window.innerWidth||document.documentElement.clientWidth)+.5,i=e.top<=r&&e.bottom>=0,s=e.left<=n&&e.right>=0,o=i&&s,l=this.cartDrawerElement.tagName.toLowerCase()===Wr.DEFAULT_SELECTOR&&this.cartDrawerElement.open,u=getComputedStyle(this.cartDrawerElement),f=u.display!=="none"&&u.visibility!=="hidden"&&parseFloat(u.opacity)>0,m=!this.cartDrawerElement.hidden,h=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,v=u.transform.match(/matrix\(([^)]+)\)/),_=0,g=0;if(v){let V=v[1].split(", ").map(parseFloat);_=V[4],g=V[5]}let y=_+e.left>n||_+e.right<0||g+e.top>r||g+e.bottom<0,C=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),O=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),H=C*O,R=e.width*e.height,k=R>0&&H/R>=.1;return(o||l||!y)&&f&&m&&h&&k}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new _t;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(rr(500)).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,this.drawerSubject.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){return!this.selector||!this.cartDrawerShadowElement?!1:!!this.cartDrawerShadowElement.querySelector(this.selector)}},Oi=class bc{static ACTIVE_TRIGGER_DATA;renderer=At.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=pe.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}setParentContainer(e){this.parent=e??document.body,this.renderer.setParentContainer(this.parent)}render(e){this.renderEngagement(new Lt(e))}async renderEngagement(e){if(!e.previewType&&bc.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mi(bc.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(e,r);return}if(bc.ACTIVE_TRIGGER_DATA=e,this.triggerContext=new Ri(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Ze.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=Ze.get().onToggle().subscribe(({open:e})=>{!e&&this.startRenderingOnce()})}startRenderingOnce(){if(le.get().isGoKwikPopupOpen){this.skipTrigger(this.triggerContext.triggerData,{reason:"GoKwik popup is open"});return}try{this.startRendering()}catch(e){ke.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Lo(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new ve(A.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:A.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(A.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new ve(r,e,this.triggerContext.triggerData);n.name===A.EVENT_TRIGGER_CLICKED&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.safeHTTP.sendEvent(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof ri?new za(e,r,n).render():r instanceof ni?new Ya(e,r,n).render():r instanceof zr?new Oo(e,r,n).render():r instanceof ii?new Ja(e,r,n).render():r instanceof Or?new An(e,r,n).render():r instanceof an?new Po(e,r,n).render():r instanceof ei?new qa(e,r,n).render():r instanceof ti?new Ka(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Va(this.rootContainer,r,e).render().getHTMLElement(),new $a().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),bc.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){At.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new ve(A.EVENT_CAMPAIGN_REJECTED,r,e);this.safeHTTP.sendEvent(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let s=i.bg?.img?.src;if(s&&n.push(this.getPromise(s)),i.t===1){let o=i.src;if(!o)return;n.push(this.getPromise(o))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}},Qa=class{triggerData;safeHttpService=pe.getInstance();render(t){t.contentSource===qi.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let e=t.detail;if(e.formId!==this.triggerData.klaviyoFormID){w.warn("Received invalid trigger callback");return}switch(e.type){case"open":this.safeHttpService.sendEvent(new ve(A.EVENT_TRIGGER_DISPLAYED,{form:{id:e.formId}},this.triggerData));break;case"stepSubmit":{let r=this.getFormDetails(e);this.safeHttpService.sendEvent(new ve(A.EVENT_FORM_SUBMITTED,{form:r},this.triggerData)),this.safeHttpService.updateProfile(r);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new ve(A.EVENT_TRIGGER_CLOSED,{form:{id:e.formId}},this.triggerData));break}}getFormDetails(t){let e={id:t.formId},r=t.metaData;if(Ft.hasKeys(r)){let n=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(r).forEach(o=>{n.includes(o)||(e[o]=r[o])}),e.email=r.$email??r.email,e.mobile=r.$phone_number??r.phone_number;let i=r.$first_name??r.first_name,s=r.$last_name??r.last_name;(i?.length||s?.length)&&(e.name=i+" "+s)}return e}},Za=class{static trackIntent(t){if(!this.isInstalled()){w.log("Facebook pixel not installed");return}if(!Oe.get().pixelPush){w.log("Facebook pixel push not enabled");return}let e=cn[t.intent]?.toLowerCase(),r=t.segmentName;!e&&!r||(w.debug(`Sending ${e} intent and ${r} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:e,segment_value:t.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}},hd=Qt(dd()),On=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ae.isShopify()}},J_=(0,hd.default)(fetch),X_={retryDelay:A.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=A.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},mt=class Od{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Od),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{w.log("Updated user profile"),await Pn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{w.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{w.log("Sent Order")}).catch(r=>{w.error("Error sending track order",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{w.log("Updated device property")}).catch(async r=>{w.error("Error saving device property",r)})}setAPIToken(e){this.apiToken=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!On.isECommerceApp()&&!On.getFlags().allowEvents)return w.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Zt.apiURL+r);let i=this.getDefaultHeaders(),s="keepalive"in new Request("");if(n&&!s&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(l){return ke.getInstance().captureException(l,{body:JSON.stringify(n)}),{}}let o={method:e,headers:i,keepalive:!0};return n&&(o.body=JSON.stringify(n)),this.request(r,o)}async request(e,r){let n=b(b({},X_),r),i=await J_(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,s)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),r.forEach((l,u)=>{o.setRequestHeader(u,l)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{o.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(o.responseText)):s(new Error("Content-Type of response header is not json"))}catch(l){s(l)}else s(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{s(new Error("Network error occurred during the request."))},o.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",A.SDK),e.set("cooee-sdk-code",A.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",A.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),Zt.debug&&e.set("cooee-sdk-debug",String(1)),e}},Pi=class{static sentryService=ke.getInstance();static httpApiService=mt.getInstance();static async refreshItems(t){if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let i=(await ge.getCurrent().getNormalisedCart()).items.map(s=>s.mID);t.items=t.items.filter(s=>!i.includes(s.mID))}if(t.isCartRecovery()){let i=ge.getCurrent().items,s=[];for(let o of t.items)for(let l of o.vars){let u=i.find(h=>h.variant_id.toString()===l.mID);if(!u)continue;let f=new xt(o);f.name=u.title;let m=new dr(l);m.name=u.variant_title,m.price.d=u.discounted_price/100,f.variants=[m],s.push(f)}return s}if(Oe.get().currencyCount<=1)return t.items;let e=t.items.length,r=t.items.map(i=>this.updatedItem(i,t.engagementID)),n=(await Promise.all(r)).filter(i=>i!=null);if(e&&!n.length){let i="Failed to fetch any product from Ajax API",s=new ve(A.EVENT_CAMPAIGN_FAILED,{reason:i,currency:t.currency},t);throw pe.getInstance().sendEvent(s),new Error(i)}return n}static async updatedItem(t,e){let r=t,n,i=Ae.getRootPrefix()+`products/${r.slug}.js`;try{n=await this.httpApiService.request(i)}catch(s){return w.error(`Failed to fetch ${i}`,s),s instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${s.status}`,"error",{item:r,path:i},{"engagement.id":e}):this.sentryService.captureException(s,{item:r,path:i},{"engagement.id":e}),null}return n?(r.name=n.title,r.vars.map(s=>{let o=n.variants.find(l=>l.id===+s.mID);s.name=o.title,s.price.d=o.price?o.price/100:o.price,s.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price}),r):(w.error("Item not found after AJAX call for:",r),null)}},ec=class kd{static INSTANCE;httpService=ue.get(mt);sentryService=ue.get(ke);sessionManager=ue.get(it);runtime=le.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new kd),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>w.error(`Failed to send ${e.name}`,r))}async send(e){if(w.debug(`Sending event ${e.name}`),Jt.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){w.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==A.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),this.httpService.post("/v1/event/track",e).then(async r=>{w.log("\u2705 Event tracked:",e.name),Jt.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{w.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=_r.parseFromCurrent()}async addShopifyContext(e){if(Ae.isShopify())try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(r){w.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{w.error("Failed to display a campaign",n,e,r),this.sentryService.captureException(n,{event:e,response:r})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData){w.log(`Nothing to engage after ${e.name}`);return}w.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Lt(r.triggerData);n.occurred=e.occurred;let i;try{i=await Pi.refreshItems(n)}catch(s){w.error("Failed to refresh the products",s);return}if(n.items=i,n.contentSource===qi.KLAVIYO){new Qa().render(n);return}new Oi().renderEngagement(n).catch(s=>{w.error("Failed to render popup",s),this.sentryService.captureException(s,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(Di.trackIntent(e.intent),Za.trackIntent(e),Jt.prepend(`Intent is <strong>${cn[e.intent]}</strong>`))}addShopifyAttributes(){Ae.isShopify()&&ge.getCurrent().addCooeeAttributes().catch(e=>{w.error("Fail to add attributes in cart",e)})}},pe=class Pd{static INSTANCE;httpApiService=mt.getInstance();eventAPIService=ec.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Pd),this.INSTANCE}sendEvent(e){w.debug(`Waiting for auth to send event ${e.name}`),it.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){it.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){it.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){it.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}},Jt=class{static isOn=!1;static element;static watch(){let t=w.getDebugParam();(t==="1"||t==="on")&&pe.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),t==="on"?sessionStorage.cooeeDebug="1":t==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(t){if(!this.isOn)return;let e=document.createElement("div");e.innerHTML="• "+new Date().toLocaleString()+" - "+t,this.element.prepend(e)}static renderDebugBar(){this.element=document.createElement("div"),this.element.id="cooee-debugger",this.element.setAttribute("draggable","true"),document.body.appendChild(this.element)}static dragElement(){let t=0,e=0,r=0,n=0,i=l=>{l=l||window.event,l.preventDefault(),r=l.clientX,n=l.clientY,document.onmouseup=o,document.onmousemove=s},s=l=>{l=l||window.event,l.preventDefault(),t=r-l.clientX,e=n-l.clientY,r=l.clientX,n=l.clientY,this.element.style.top=this.element.offsetTop-e+"px",this.element.style.left=this.element.offsetLeft-t+"px"},o=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=i}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}},Bo=class extends Vr{static storeName="app";static{this.storage=Kn(this.storeName)}},tc=class{static processConfiguration(){let t=Oe.get();!t.gaMeasurementID||!t.gaEnabled||this.sendClientID()}static async sendClientID(){let t=await this.getClientID();t&&pe.getInstance().updateDeviceProps({gaClientID:t})}static async getClientID(){let t=await Ne.get(ie.GA_CLIENT_ID),e=await this.getClientIDViaGTag();if(t!==e)return await Ne.set(ie.GA_CLIENT_ID,e),e}static async getClientIDViaGTag(){let t=Oe.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},rc=class Rd{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Rd),this.INSTANCE}init(){Bo.get(ie.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){w.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Bo.set(ie.APP_CONFIG,r).catch(n=>w.error(n)),tc.processConfiguration(),r.website&&(ut.injectRawScript(r.website.commonJS),ut.injectRawCSS(r.website.commonCSS)),Ze.get().onToggle().subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(ue.get(ar).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Se.globalRef.config.update(e);return Ze.forceUpdate(),w.debug("App configurations",r),r}async trackViewCartEvent(){let e=await ge.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};pe.getInstance().sendEvent(new ve(A.EVENT_VIEW_CART,n))}},gd=Qt(Sl()),nc=class Zu{static META_REQUIRED_FIELDS=["ad_id","campaign_id","fbclid"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new gd.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new Zu(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Zu(r)}},Pn=class Ld{static INSTANCE=new Ld;httpAPIService=mt.getInstance();coreService=rc.getInstance();sentryService=ke.getInstance();sdkToken="";userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE}init(e){this.appID=e.appID,this.shopifyShop=e.shopifyShop}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ne.set(ie.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ne.set(ie.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Ne.set(ie.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),w.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);w.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw w.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Ne.get(ie.SDK_TOKEN),!this.sdkToken){w.warn("No SDK token found in local storage");return}this.userID=await Ne.get(ie.ID),this.deviceID=await Ne.get(ie.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){w.debug("SDK Token:",this.sdkToken),w.log("Device ID:",this.deviceID),w.log("User ID:",this.userID),Di.trackDeviceID(this.deviceID),Jt.prepend(`Device ID: <strong>${this.deviceID}</strong>`),this.httpAPIService.setAPIToken(this.sdkToken),this.sentryService.setGlobalContext("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),this.sentryService.setUser({id:this.deviceID})}async getSessionValidateData(e){let r=await new Ha().get();r.host=location.origin;try{(await md())?.isPrivate&&(r.private=!0)}catch(i){yd.default.error("Unable to detect private/incognito window",i)}let n=await Ne.get(ie.DEVICE_ID);return n||(n=new Je().toHexString(),await Ne.set(ie.DEVICE_ID,n)),Z(b({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:A.SDK,page:_r.parseFromCurrent(),ad:nc.getAdParams(),occurred:this.getSessionStartTime(le.get().jsLoadTime),currentItem:le.get().getCurrentItem(),cart:await ge.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Ne.get(ie.FIRST_SEEN),r=e?new Date(e):new Date;e||await Ne.set(ie.FIRST_SEEN,r.toISOString()),this.httpAPIService.setFirstSeen(r),this.sentryService.setGlobalContext("Visitor Info",{first_seen:r.toISOString()})}getSessionStartTime(e){return(new Date().getTime()-e.getTime())/1e3>A.IDLE_TIME_IN_SECONDS?new Date:e}},it=class wc{static replaySubject=new ho(1);static INSTANCE;sentryService=ue.get(ke);lock=new Jn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new wc),this.INSTANCE}init(e){if(w.debug("Initialising SDK",e),zf(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}Pn.getInstance().init(e),wc.INSTANCE.checkForNewSession(!0).then(async()=>{wc.replaySubject.next(!0),wc.replaySubject.complete()}).catch(r=>w.error("Unable to perform device init",r))}getCurrentSessionID(){return et.set(ie.SESSION_LAST_USED_TIME,new Date().getTime()),et.get(ie.ID,"")}async checkSessionAndGetContext(){return await this.checkForNewSession(),this.getContext()}async getContext(){let e=await Promise.all([this.getCurrentSessionID(),this.getCurrentSessionNumber(),this.getLandingPage()]);return this.sentryService.setGlobalContext("Visitor Session",{id:e[0],number:e[1],landing_page:e[2]}),e}async checkForNewSession(e){await this.lock.acquire();let r=!1;if(await this.isNewSessionRequired()?(await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();await Pn.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await et.set(ie.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){w.debug("Starting new session"),await et.clear(),w.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Je().toHexString();w.debug("New session ID to be used",r);let n=await Ne.get(ie.SESSION_NUMBER,0)+1;Jt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ne.set(ie.SESSION_NUMBER,n),et.set(ie.ID,r),et.set(ie.SESSION_LAST_USED_TIME,e.getTime()),et.set(ie.SESSION_LANDING_PAGE,_r.parseFromCurrent())])}getLandingPage(){return et.get(ie.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ne.get(ie.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await et.get(ie.ID))return!0;let e=await et.get(ie.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>A.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await et.get(ie.SESSION_SYNCED,!1)}},_d=Qt(tn()),vd=Qt(tn()),Q_=`
|
|
39
39
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
40
40
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
41
41
|
cart {
|
|
@@ -47,11 +47,24 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
`,Qr=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(w.log(`Applying discount code ${t}`,e,r),e){case lr.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case lr.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${A.HASH_OPEN_CART_DRAWER}=1`;break;case lr.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case lr.THIRD_PARTY_CHECKOUT:location.href=`${n}?redirect=/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){switch(t){case lr.CART_PAGE:location.href="/cart";break;case lr.SHOPIFY_CHECKOUT:location.href="/checkout";break;case lr.THIRD_PARTY_CHECKOUT:location.href=`/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;case lr.CART_DRAWER:default:{let r=et.get();r.open(),r.refreshUI(e)}}}static async applyWithStorefront(t){let e=He.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:Q_,variables:{cartId:`gid://shopify/Cart/${ge.getCurrent().token}`,discountCodes:[t]}}),i={method:"POST",headers:r,body:n};await xt.getInstance().request(A.GRAPHQL_API_PATH,i)}},kr=class{listen(){document.addEventListener(A.CTA_EVENT,async t=>{await this.processEvent(t)},!1)}async performAddToCart(t,e){if(!t.length)return;let r=t.map(c=>{let{vID:u,quantity:f}=this.getVIDAndQuantity(c);return{id:u?+u:+c.mID,quantity:f,properties:e.getPrivateAttributesForLineItem()}}),n=Ae.getCartURL("cart/add.js"),i={items:r},s=et.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let o=JSON.stringify(i);try{let c=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return w.log(`Added ${t.length} items to Cart`),se.showSnackbar("Product added to your cart"),c.json()}catch(c){w.error("Failed to add product in cart",c)}}async performUpdate(t,e){if(!Ft.hasKeys(e)){w.warn("No update fields provided");return}let r=Ae.getCartURL("cart/change.js"),n=b({id:+t.vID},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});(s.status===200||s.status===302)&&(w.log(`Updated ${t}`),ge.getCurrent().update(s.json()))}catch(s){w.error("Failed to update item in cart",s,t)}}async performCopyCoupon(t){if(t)try{await navigator.clipboard.writeText(t),w.log(`Code-${t} copied`),se.showSnackbar("Discount code copied")}catch(e){w.error("Failed to copy code",e)}}performGoToItem(t){if(!t?.link)return;let e=Ae.getProductSlug(t.link);e&&(location.pathname=Ae.getRootPrefix()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){w.warn("Trying to upgrade to subscription with no item");return}let r=await ge.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(f=>f.vID===n.mID),s=n.selectedSellingPlan.value,o=Ae.getCartURL("cart/change.js"),c={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},u=JSON.stringify(c);try{let f=await fetch(o,{body:u,method:"post",headers:{"Content-Type":"application/json"}});(f.status===200||f.status===302)&&(w.log(`Upgraded ${t} selling plan`),se.showSnackbar("Line item updated"),ge.getCurrent().update(f.json()))}catch(f){w.error("Failed to update subscription for item in cart",f)}}async processEvent(t){let e=t?.detail;if(!e)return;let r=e.clickAction,n=e.items,i=e.triggerData;if(r.at){let s=r;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===101)n?.length&&this.performGoToItem(n[0]);else if(s.at===102)n?.length&&await this.performAddToCart(n,i);else if(s.at===103)await this.performCopyCoupon(i.discount.code);else if(s.at===105)et.get().open();else if(s.at===104){let o=e.collections;if(!o?.length)return;location.pathname=Ae.getRootPrefix()+"collections/"+o[0].handle}}r.applyDiscount&&i.discount?.code&&Qr.navigate(i.discount.code,i.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof It)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},Li=class{constructor(t,e){this.triggerContext=t,this.element=e}safeHTTP=ue.getInstance();async execute(t){let e=t.clickAction||this.element?.clc;if(!e)return;let r=t.item,n=this.triggerContext,i=new kr,s=n.triggerData.redirectBehaviour,o=!!n.triggerData.discount.type&&!!e?.applyDiscount,c={selectedVariants:n.triggerData.nonMutableItems.map(g=>({itemMID:g.mID,mID:g.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},u="",f=[],m=r?[r.toEmbed()]:[];if(e.at===108){let g=n.selectedItems;if(m=t.embeddedItems??g.map(y=>y.toEmbed()),n.shouldGiveFBTDiscount||t.embeddedItems?.length){let y;t.embeddedItems?y=t.embeddedItems.map(O=>({itemMID:O.mID,mID:O.vID,quantity:O.quantity})):y=g.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID}));let C=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&C&&y.push({itemMID:C.mID,mID:C.selectedOrFirstVariant.value.mID}),c.selectedVariants=y}else c=void 0;f=t.embeddedItems??g}else if(e.at===107){let g=await ge.getCurrent().getNormalisedCart();m=g.items,c.selectedVariants=g.items.map(y=>({itemMID:y.mID,mID:y.vID}))}else if(e.at===102)f=[r];else if(e.at===101)u=Ae.getRootPrefix()+"products/"+r.slug;else if(e.at===4){let g=se.isValidURL(e.gu?.u);g&&(u=g.pathname+g.search+g.hash)}else e.at===109&&(await i.upgradeToSubscription(r,n.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(m,{from:"button"}),w.debug({redirectPath:u,redirectBehaviour:s,hasDiscount:o}),!o&&u){location.href=u;return}let h,v=!1;try{h=await this.getOrGenerateDiscountCode(c),w.debug("Discount code (if any) to apply",h)}catch(g){if(!this.triggerContext.triggerData.isBYOB()){vd.default.error("Unable to get a discount code",g);return}}h&&e.at===103&&await new kr().performCopyCoupon(h);try{h&&await Qr.applyWithStorefront(h)}catch(g){w.error(g),v=!0}let _;if(f?.length&&(_=await i.performAddToCart(f,n.triggerData)),v&&h){Qr.navigate(h,s,u);return}if(u){location.href=u;return}Qr.navigateWithoutDiscount(s,_)}sendTriggerClicked(t,e){let r=A.EVENT_TRIGGER_CLICKED,n=new ve(r,e,this.triggerContext.triggerData);n.items=t,this.safeHTTP.sendEvent(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===pr.STATIC){if(!e.code)throw Me.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw w.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw se.showSnackbar("Failed to generate a discount code"),w.error("Error generating discount code",e,t),Me.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},Te=class extends fr{stylesConverter=new Ni(1);renderer=At.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new Li(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),b(b(Z(b(b(b(b(b(b({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";default:return w.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=b(b({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t){await this.clickExecutor.execute(t)}},Z_=0,FF=Array.isArray;function M(t,e,r,n,i,s){e||(e={});var o,c,u=e;if("ref"in u)for(c in u={},e)c=="ref"?o=e[c]:u[c]=e[c];var f={type:t,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Z_,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(c in o)u[c]===void 0&&(u[c]=o[c]);return _e.vnode&&_e.vnode(f),f}var bt=class extends Te{componentDidMount(){this.setState(()=>({text:this.props.element.text})),it(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),M("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:M("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData},r=gt.render(JSON.stringify(this.props.element),e),n=new ze(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ot;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return b({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Ln=class extends bt{render(){return M("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:M("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.props.element.text}})})}getComponentStyles(){return Z(b({},super.getComponentStyles()),{cursor:"pointer"})}},qu=class extends fr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?M("div",{style:b(b({},this.getElementStyle()),this.props.styles),children:[M("span",{children:this.props.time}),M("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):M("div",{style:b(b({},this.getElementStyle()),this.props.styles),children:[M("span",{style:this.getTimeLabelStyle(),children:this.props.label}),M("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},Uo=class extends bt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>b({},this.labels)),this.processAndStartTimer()}render(){return M("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>M(qu,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return b(b({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>b({},this.labels))})}},Mo=class extends Te{componentDidMount(){it(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return M("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:M("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ot;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return Z(b({},this.getTypoStyles()),{display:"flex"})}},Fr=class extends Te{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return M("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},Hr=class extends Te{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return M("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:M(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new oi,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},ko=class extends Hr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return M("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:M(Bi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Fo=class extends Te{render(){return M("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){it(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ot;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),b(b({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(M("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(M("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},Ho=class extends Te{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),gt.escape=Ko.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),M("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=gt.render(t,{svg:r}),e=gt.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let c=0;c<+o[0];c++)i+=t,s--;o[1]&&(i+=e,s--);for(let c=0;c<s;c++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},$o=class extends Te{render(){return M("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){it(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new ot;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),b(b({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(M("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(r=>r.mID===e)}},Bi=class extends Te{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return M(ko,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?M(Mo,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=M(Fr,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:M("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:M($o,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?M(Fo,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?M(Ho,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?M(Ln,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):M(Zr,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=M(bt,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:M("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},$r=class extends Te{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=gt.render(t,this.getProductData());if(this.productElement=new gr(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return M("div",{style:b({},this.getCompiledStyles()),class:"lc-single-product",children:M(Bi,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let t=this.props.item.selectedOrFirstVariant.value,e=t.price,r=this.props.item.name,n=this.props.item.category,i=se.formatCurrency(e.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,o=this.props.item.meta,c=this.props.item.reviews?.rating,u=this.props.item.reviews?.totalReviews,f=e.cmp&&e.cmp>e.d,m=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,h=e.effective,v={name:r,price:i,quantity:m,image_url:s,meta:o,effective_price:h,category:n,rating:c,reviews:u};if(f){v.compare_price=se.formatCurrency(e.cmp);let g=e.cmp-e.d;v.discount_percent=(g/e.cmp*100).toFixed(0),v.discount_price=se.formatCurrency(g)}let _={name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity};return{product:v,variant:_,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function ic(){return new Promise(t=>{let e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";if(Array.from(document.scripts).some(n=>n.src.includes(e))){t();return}let r=document.createElement("script");r.src=e,r.onload=()=>{t()},document.body.appendChild(r)})}function oc(t,e){if(!t||!window.Swiper)return;let r=new window.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
50
|
+
`,Xr=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(w.log(`Applying discount code ${t}`,e,r),e){case lr.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case lr.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${A.HASH_OPEN_CART_DRAWER}=1`;break;case lr.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case lr.THIRD_PARTY_CHECKOUT:location.href=`${n}?redirect=/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;default:location.href=`${n}?redirect=${r||location.pathname}`}}static navigateWithoutDiscount(t,e){switch(t){case lr.CART_PAGE:location.href="/cart";break;case lr.SHOPIFY_CHECKOUT:location.href="/checkout";break;case lr.THIRD_PARTY_CHECKOUT:location.href=`/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;case lr.CART_DRAWER:default:{let r=Ze.get();r.open(),r.refreshUI(e)}}}static async applyWithStorefront(t){let e=Oe.get().storefrontToken;if(!e)throw new Error("Storefront token not set for the store");let r=new Headers;r.append("Content-Type","application/json"),r.append("X-Shopify-Storefront-Access-Token",e);let n=JSON.stringify({query:Q_,variables:{cartId:`gid://shopify/Cart/${ge.getCurrent().token}`,discountCodes:[t]}}),i={method:"POST",headers:r,body:n};await mt.getInstance().request(A.GRAPHQL_API_PATH,i)}},Z_=`
|
|
51
|
+
mutation cartCreate($input: CartInput) {
|
|
52
|
+
cartCreate(input: $input) {
|
|
53
|
+
cart {
|
|
54
|
+
id
|
|
55
|
+
checkoutUrl
|
|
56
|
+
}
|
|
57
|
+
userErrors {
|
|
58
|
+
field
|
|
59
|
+
message
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`,Qr=class{listen(){document.addEventListener(A.CTA_EVENT,async t=>{await this.processEvent(t)},!1)}async performAddToCart(t,e){if(!t.length)return;let r=t.map(l=>{let{vID:u,quantity:f}=this.getVIDAndQuantity(l);return{id:u?+u:+l.mID,quantity:f,properties:e.getPrivateAttributesForLineItem()}}),n=Ae.getCartURL("cart/add.js"),i={items:r},s=Ze.get();s.isMiniCart()?i.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(i.sections=s.element.getSectionsToRender?.().map(l=>l.section??l.id));let o=JSON.stringify(i);try{let l=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});if(l.status===200||l.status===302)return w.log(`Added ${t.length} items to Cart`),ne.showSnackbar("Product added to your cart"),l.json()}catch(l){w.error("Failed to add product in cart",l)}}async performUpdate(t,e){if(!Ft.hasKeys(e)){w.warn("No update fields provided");return}let r=Ae.getCartURL("cart/change.js"),n=b({id:+t.vID},e),i=JSON.stringify(n);try{let s=await fetch(r,{body:i,method:"post",headers:{"Content-Type":"application/json"}});(s.status===200||s.status===302)&&(w.log(`Updated ${t}`),ge.getCurrent().update(s.json()))}catch(s){w.error("Failed to update item in cart",s,t)}}async performCopyCoupon(t){if(t)try{await navigator.clipboard.writeText(t),w.log(`Code-${t} copied`),ne.showSnackbar("Discount code copied")}catch(e){w.error("Failed to copy code",e)}}performGoToItem(t){if(!t?.link)return;let e=Ae.getProductSlug(t.link);e&&(location.pathname=Ae.getRootPrefix()+"products/"+e)}async upgradeToSubscription(t,e){if(!t){w.warn("Trying to upgrade to subscription with no item");return}let r=await ge.getCurrent().getNormalisedCart(),n=t.selectedOrFirstVariant.value,i=r.items.findIndex(f=>f.vID===n.mID),s=n.selectedSellingPlan.value,o=Ae.getCartURL("cart/change.js"),l={line:i+1,selling_plan:s?.mID||null,properties:e.getPrivateAttributesForLineItem()},u=JSON.stringify(l);try{let f=await fetch(o,{body:u,method:"post",headers:{"Content-Type":"application/json"}});(f.status===200||f.status===302)&&(w.log(`Upgraded ${t} selling plan`),ne.showSnackbar("Line item updated"),ge.getCurrent().update(f.json()))}catch(f){w.error("Failed to update subscription for item in cart",f)}}async performCartCreate(t,e,r){let n=Oe.get().storefrontToken;if(!n)throw new Error("Storefront token not set for the store");if(!t?.vID){w.error("No variant ID found to perform Buy now",t);return}let i=e?[e]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:r.getKVFormatPrivateAttributesForLineItem()}],o=await ne.getCartAttributes(),l=new Headers;l.append("Content-Type","application/json"),l.append("X-Shopify-Storefront-Access-Token",n);let u=JSON.stringify({query:Z_,variables:{input:{lines:s,discountCodes:i,attributes:o}}});return(await mt.getInstance().request(A.GRAPHQL_API_PATH,{method:"POST",headers:l,body:u})).data?.cartCreate?.cart?.checkoutUrl}async processEvent(t){let e=t?.detail;if(!e)return;let r=e.clickAction,n=e.items,i=e.triggerData;if(r.at){let s=r;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===101)n?.length&&this.performGoToItem(n[0]);else if(s.at===102)n?.length&&await this.performAddToCart(n,i);else if(s.at===103)await this.performCopyCoupon(i.discount.code);else if(s.at===105)Ze.get().open();else if(s.at===104){let o=e.collections;if(!o?.length)return;location.pathname=Ae.getRootPrefix()+"collections/"+o[0].handle}}r.applyDiscount&&i.discount?.code&&Xr.navigate(i.discount.code,i.redirectBehaviour)}getVIDAndQuantity(t){let e,r;if(t instanceof lt)e=t.vID,r=t.quantity??1;else{if(!t.vars?.length)return{};e=t.selectedOrFirstVariant.value.mID,r=1}return{vID:e,quantity:r}}},Li=class{constructor(t,e){this.triggerContext=t,this.element=e}safeHTTP=pe.getInstance();async execute(t){let e=t.clickAction||this.element?.clc;if(!e)return;let r=t.item,n=this.triggerContext,i=new Qr,s=n.triggerData.redirectBehaviour,o=!!n.triggerData.discount.type&&!!e?.applyDiscount,l={selectedVariants:n.triggerData.nonMutableItems.map(g=>({itemMID:g.mID,mID:g.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},u="",f=[],m=r?[r.toEmbed()]:[];if(e.at===108){let g=n.selectedItems;if(m=t.embeddedItems??g.map(y=>y.toEmbed()),n.shouldGiveFBTDiscount||t.embeddedItems?.length){let y;t.embeddedItems?y=t.embeddedItems.map(O=>({itemMID:O.mID,mID:O.vID,quantity:O.quantity})):y=g.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID}));let C=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&C&&y.push({itemMID:C.mID,mID:C.selectedOrFirstVariant.value.mID}),l.selectedVariants=y}else l=void 0;f=t.embeddedItems??g}else if(e.at===107){let g=await ge.getCurrent().getNormalisedCart();m=g.items,l.selectedVariants=g.items.map(y=>({itemMID:y.mID,mID:y.vID}))}else if(e.at===102)f=[r];else if(e.at===101)u=Ae.getRootPrefix()+"products/"+r.slug;else if(e.at===4){let g=ne.isValidURL(e.gu?.u);g&&(u=g.pathname+g.search+g.hash)}else e.at===109&&(await i.upgradeToSubscription(r,n.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(m,{from:"button"}),w.debug({redirectPath:u,redirectBehaviour:s,hasDiscount:o}),!o&&u){location.href=u;return}let h,v=!1;try{h=await this.getOrGenerateDiscountCode(l),w.debug("Discount code (if any) to apply",h)}catch(g){if(!this.triggerContext.triggerData.isBYOB()){vd.default.error("Unable to get a discount code",g);return}}if(h&&e.at===103)await i.performCopyCoupon(h);else if(e.at===110){let g=le.get().getCurrentItem(),y=await i.performCartCreate(g,h,n.triggerData);y&&(location.href=y);return}try{h&&await Xr.applyWithStorefront(h)}catch(g){w.error(g),v=!0}let _;if(f?.length&&(_=await i.performAddToCart(f,n.triggerData)),v&&h){Xr.navigate(h,s,u);return}if(u){location.href=u;return}Xr.navigateWithoutDiscount(s,_)}sendTriggerClicked(t,e){let r=A.EVENT_TRIGGER_CLICKED,n=new ve(r,e,this.triggerContext.triggerData);n.items=t,this.safeHTTP.sendEvent(n)}async getOrGenerateDiscountCode(t){let e=this.triggerContext.triggerData.discount;if(!e?.type)return;let r="";if(e.type===pr.STATIC){if(!e.code)throw ke.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return e.code}if(t){if(r=await this.generateDiscount(t),!r)throw w.error("No discount code found",t),new Error("Discount code not found or generated");return r}}async generateDiscount(t){try{return(await this.safeHTTP.generateDiscount(t))?.code}catch(e){throw ne.showSnackbar("Failed to generate a discount code"),w.error("Error generating discount code",e,t),ke.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},Te=class extends fr{stylesConverter=new Ni(1);renderer=At.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new Li(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),b(b(Z(b(b(b(b(b(b({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(t){if(!t?.op)return!0;let{lhs:e,rhs:r}=t;switch(t.op){case"eq":return e===r;case"gt":return+e>+r;case"gte":return+e>=+r;case"lt":return+e<+r;case"lte":return+e<=+r;case"ne":return e!==r;case"null":return e==null;case"empty":return e.trim()==="";default:return w.error(`Invalid operator found for when condition - ${t.op}`),!1}}putStyleAccordingToDevice(){let t=this.props.element;this.mediaStyle=t.style.lg,this.renderer.isMobile()&&t.style.sm&&Object.keys(t.style.sm).length&&(this.mediaStyle=b(b({},this.mediaStyle),t.style.sm))}sendTriggerClicked(t,e){this.clickExecutor.sendTriggerClicked(t,e)}async onClick(t){await this.clickExecutor.execute(t)}},eE=0,YF=Array.isArray;function M(t,e,r,n,i,s){e||(e={});var o,l,u=e;if("ref"in u)for(l in u={},e)l=="ref"?o=e[l]:u[l]=e[l];var f={type:t,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eE,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(l in o)u[l]===void 0&&(u[l]=o[l]);return _e.vnode&&_e.vnode(f),f}var It=class extends Te{componentDidMount(){this.setState(()=>({text:this.props.element.text})),ot(this.onChange.bind(this))}componentWillReceiveProps(t){this.props.element=t.element,this.onChange()}render(){let t=this.getCompiledStyles(),e=this.state.text;return e||(t.display="none",e=""),M("div",{style:t,onClick:this.customOnClick.bind(this),className:"lc-text",children:M("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:e}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let t=this.props.triggerContext.triggerData,e={bundle:t.discountData.value,customer:t.customerData},r=vt.render(JSON.stringify(this.props.element),e),n=new ze(JSON.parse(r));if(!this.matchWhenCondition(n.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:n.text}))}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily=e.fam.name||"inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,t.textDecoration=e.td??"none",this.stylesConverter.getColourStyles(e.tc,"color",t),t}getComponentStyles(){return b({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}},Ln=class extends It{render(){return M("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:M("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.props.element.text}})})}getComponentStyles(){return Z(b({},super.getComponentStyles()),{cursor:"pointer"})}},qu=class extends fr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?M("div",{style:b(b({},this.getElementStyle()),this.props.styles),children:[M("span",{children:this.props.time}),M("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):M("div",{style:b(b({},this.getElementStyle()),this.props.styles),children:[M("span",{style:this.getTimeLabelStyle(),children:this.props.label}),M("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let t={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(t.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),t}},Uo=class extends It{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>b({},this.labels)),this.processAndStartTimer()}render(){return M("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(t=>M(qu,{styles:this.getCompiledStyles(),label:t,time:this.state[t],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return b(b({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,t=>{this.labels.Days=String(t.days).padStart(2,"0"),this.labels.Hours=String(t.hours).padStart(2,"0"),this.labels.Minutes=String(t.minutes).padStart(2,"0"),this.labels.Seconds=String(t.seconds).padStart(2,"0"),this.setState(()=>b({},this.labels))})}},Mo=class extends Te{componentDidMount(){ot(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return M("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:M("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(t){let{checked:e}=t.target;this.props.item.selected.value=e}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return Z(b({},this.getTypoStyles()),{display:"flex"})}},kr=class extends Te{constructor(t,e){super(t,e)}render(){let t=this.props.element[this.deviceTypeKey],e=t?.src||this.props.element.src||this.props.element.lg?.src;return M("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:t?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:e,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let t=this.mediaStyle.lout;if(!t||t.pos!=="absolute")return{};let e={zIndex:t.zIndex};return this.mediaStyle.size?.w&&(e.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(e.height=this.mediaStyle.size.h),e}handleMouseEnter(t){let e=this.props.element[this.deviceTypeKey]?.secondarySrc;e&&(t.currentTarget.src=e)}handleMouseLeave(t){t.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}},Fr=class extends Te{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return M("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:M(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let t=this.mediaStyle.flex??new oi,e={display:"flex",gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai};return t.wrap==="nowrap"&&t.scroll&&(t.dir==="column"?e["overflow-y"]="auto":e["overflow-x"]="auto"),e}},ko=class extends Fr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return M("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:M(Bi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}},Fo=class extends Te{render(){return M("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){ot(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.selectedVariant.sellingPlans?.length||(t.visibility="hidden"),b(b({},t),this.getTypoStyles())}createSelectItems(){let t=[],e=this.props.selectedVariant;if(!e.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?e.selectedSellingPlan.value||(e.sellingPlans[0].isSelected=!0,e.changeSellingPlan(e.sellingPlans[0])):t.push(M("option",{value:"",selected:!e.selectedSellingPlan,children:"One time purchase"}));for(let r of e.sellingPlans??[])t.push(M("option",{value:r.mID,selected:r.isSelected,children:r.name}));return t}onChange(t){let e=t.target.value;e?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(r=>r.mID===e):this.props.selectedVariant.selectedSellingPlan.value=void 0}},Ho=class extends Te{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),vt.escape=Ko.escapeHtml}render(){let t=this.getCompiledStyles(),e=this.getRating();return e||(t.display="none",e=""),M("div",{style:t,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:e}})}getRating(){let t=this.props.element.fullStar,e=this.props.element.halfStart,r={size:this.props.element.iconSize,color:this.props.element.c.hex};t=vt.render(t,{svg:r}),e=vt.render(e,{svg:r});let n=this.props.review;if(!n?.rating)return"";let i="";if(this.props.element.showSingleStar)i=t;else{let s=5,o=`${n.rating}`.split(".");for(let l=0;l<+o[0];l++)i+=t,s--;o[1]&&(i+=e,s--);for(let l=0;l<s;l++)i+=t.replace(this.colorRegex,'fill="#f1f1f1')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}},$o=class extends Te{render(){return M("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){ot(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new st;return t.letterSpacing=e.letterSpacing,t.fontSize=e.fs+"px",t.lineHeight=e.lh,t.fontFamily="inherit",t.textAlign=e.alignment,t.fontWeight=e.fw,this.stylesConverter.getColourStyles(e.tc,"color",t),t.boxShadow="none",t}getComponentStyles(){let t={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(t.visibility="hidden"),b(b({},t),this.getTypoStyles())}createSelectItems(){let t=[];for(let e of this.props.item.vars)t.push(M("option",{value:e.mID,disabled:!e.isAvailable,children:e.name}));return t}onChange(t){let e=t.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(r=>r.mID===e)}},Bi=class extends Te{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}renderElement(t){if(!(t.hide||!this.matchWhenCondition(t.when))){if(t.t===4){let e=t;return M(ko,{element:e,triggerContext:this.props.triggerContext,elements:e.elems,item:this.props.item,noLinks:this.props.noLinks})}if(t.t===6)return this.props.triggerContext.triggerData.isBundle()?M(Mo,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(t.t===13){let e=t,r=this.props.item,n=r.variantImage??r.imageURL,i=r.variantSecondaryImage??r.secondaryImageURL;e.lg=e.sm={src:n,name:r.name,secondarySrc:i};let s=M(kr,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:M("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(t.t===14)return this.renderProductTitle(t);if(t.t===15){let e=t;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:M($o,{element:e,item:this.props.item,triggerContext:this.props.triggerContext})}return t.t===16?M(Fo,{element:t,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):t.t===19?M(Ho,{element:t,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):t.t===18||t.t===3?M(Ln,{element:t,item:this.props.item,triggerContext:this.props.triggerContext}):M(Zr,{elements:[t],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}renderProductTitle(t){let e=M(It,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?e:M("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:e})}customOnClick(t){this.sendTriggerClicked([this.props.item.toEmbed()],{from:t})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}},Hr=class extends Te{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=vt.render(t,this.getProductData());if(this.productElement=new gr(JSON.parse(e)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return M("div",{style:b({},this.getCompiledStyles()),class:"lc-single-product",children:M(Bi,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let t=this.props.item.selectedOrFirstVariant.value,e=t.price,r=this.props.item.name,n=this.props.item.category,i=ne.formatCurrency(e.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,o=this.props.item.meta,l=this.props.item.reviews?.rating,u=this.props.item.reviews?.totalReviews,f=e.cmp&&e.cmp>e.d,m=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,h=e.effective,v={name:r,price:i,quantity:m,image_url:s,meta:o,effective_price:h,category:n,rating:l,reviews:u};if(f){v.compare_price=ne.formatCurrency(e.cmp);let g=e.cmp-e.d;v.discount_percent=(g/e.cmp*100).toFixed(0),v.discount_price=ne.formatCurrency(g)}let _={name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity};return{product:v,variant:_,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function ic(){return new Promise(t=>{let e="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js";if(Array.from(document.scripts).some(n=>n.src.includes(e))){t();return}let r=document.createElement("script");r.src=e,r.onload=()=>{t()},document.body.appendChild(r)})}function oc(t,e){if(!t||!window.Swiper)return;let r=new window.Swiper(t,{loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(n,i)=>`
|
|
51
64
|
<span class="${i}"
|
|
52
65
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
53
66
|
`,renderProgressbar:n=>`
|
|
54
67
|
<span class="${n}"
|
|
55
68
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
56
69
|
</span>
|
|
57
|
-
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function sc(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),M("div",{class:"swiper-container",ref:e,children:[M("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&M("div",{class:"swiper-button-next",style:n,children:M("span",{})}),t.navigation.enabled&&M("div",{class:"swiper-button-prev",style:n,children:M("span",{})}),t.pagination.enabled&&M("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var jo=class extends Te{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&ic().then(()=>{this.swiperInstance=oc(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>M("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=M("div",{style:Z(b({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:sc(this.configuration,r,n)})}else e=M("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return M(mr,{children:[M($r,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&M("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:M(bt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},Wo=class extends Te{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ic().then(()=>{this.swiperInstance=oc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>M("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return sc(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return M(Fr,{element:e,triggerContext:this.props.triggerContext});case 4:return M(Hr,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=gt.render(r,{form:e});return Pt.getParsedElement(JSON.parse(n))}getClickAction(t){let e=b({},this.props.element.clc),r=JSON.stringify(e),n=gt.render(r,{form:t});return JSON.parse(n)}},Zr=class extends Te{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),it(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return M(Hr,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return M(Uo,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?M(Ln,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return M(bt,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return M(Fr,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return M(jo,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return M($r,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return M(Wo,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Go=class extends Te{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){it(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return M(mr,{children:[M("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:M(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&M("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t){if(this.isClickable)return super.onClick(t)}},Ct=class qo{constructor(e){this.engagementTrigger=e,this.triggerContext=new Ri(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=fe.get();widgetAPIService=ae.get(ar);safeHTTPService=ae.get(ue);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>Me.getInstance().captureException(e,b({},this.engagementTrigger.sentryContext())))}destroy(){w.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),qo.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){_d.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){w.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Tt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Tt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Tt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&Ft.hasKeys(e.props)&&(this.engagementTrigger.props=b(b({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new li(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){qo.renderedEngagements.push(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){w.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return await this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async c=>{if(c.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let u=await this.getVariation();n(u),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=En(window,"scroll").pipe(rr(qo.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(qo.engagementIDsWithTrackedDisplay.has(e)||!await this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?A.EVENT_CAMPAIGN_HOLDOUT:A.EVENT_TRIGGER_DISPLAYED,i=new ve(n,r,this.engagementTrigger);i.name===A.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),qo.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}async isInViewport(){let e=(await this.getWidgetContainer())?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(A.SHADOW_SPLITTER)){let u=n.split(A.SHADOW_SPLITTER);i=(await se.retrySelector(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&<.injectStylesheet(Zt.styleURL,i);let f=He.get().website.commonCSS;i&&f&<.injectRawCSS(f,i)}w.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await se.retrySelector(n,10,i??document);if(!s)return w.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),c=this.getParentElement(o);if(!e)return c;switch(r.position){case $n.BEFORE:{s.parentElement?.insertBefore(c,s);break}case $n.INSIDE_FIRST:{s.insertBefore(c,s.firstChild);break}case $n.INSIDE_LAST:{s.appendChild(c);break}case $n.AFTER:default:s.parentElement?.insertBefore(c,s.nextSibling)}return c}async startRendering(){let e;try{e=await Pi.refreshItems(this.engagementTrigger)}catch(r){w.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!e?.length&&this.engagementTrigger.isProductPromoted()){w.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i}`,n.dataset.engagementId=i,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=He.get().website.commonCSS;n&<.injectRawCSS(n,r),lt.injectStylesheet(Zt.styleURL,r),lt.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),e=r}es(Xi(Go,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let s of i)jn.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Nr=class Md extends Ct{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){Md.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!et.get().isOpen()&&this.runtimeData.pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},ac=class Ud{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=ge.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new Ud(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let i=new dr(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let m of i.sellingPlans??[])m.mID===s.id.toString()&&(m.isSelected=!0,i.changeSellingPlan(m));let o=new Tt(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(c);let u=new Lt(this.engagementTrigger);u.placement.selector=`.${c}`,u.items=[o];let f=new Nr(u);f.renderSilently(),this.watchForCartItemDeletion(f,c)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(w.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}},cc=class extends Nr{ctaListener=new kr;constructor(t){super(t),Rr.get().subscriber(A.CART_UPDATE_BROADCAST).pipe(Nl(null)).subscribe(this.checkMilestone.bind(this))}update(t){super.update(t),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let t=this.widgetElement=document.createElement("cooee-progressbar");t.className="cooee-root",t.cart=ge.getCurrent(),t.engagementTrigger=this.engagementTrigger,t.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered()}async checkMilestone(){let t=await ge.getCurrent().getNormalisedCart(),e=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find(r=>r.minValue<t.amount);if(!e){w.log("No milestone achieved yet");return}if(w.log("Current milestone",e),e.rewardType===Dc.FREE_AUTO_GIFT){let r=e.items[0];if(t.items.find(n=>n.vID===r.vID||n.mID===r.mID)){w.log(`Item(vID:${r.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(r,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});return}else{let n=await this.ctaListener.performAddToCart([r],this.engagementTrigger);et.get().refreshUI(n,!1),await this.removeOtherFreeGifts(r)}}}async removeOtherFreeGifts(t){let e=(await ge.getCurrent().getNormalisedCart()).items.filter(r=>r.vID!==t?.vID&&r.properties[A.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(e.length)for(let r of e)await this.ctaListener.performUpdate(r,{quantity:0})}},Ed=new gr({t:12,style:{lg:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"100%",h:"auto"},br:{r:4,w:0,s:1,c:{h:"#94a3b8",a:100}}},sm:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"240px",h:"auto"},br:{r:0,w:0,s:1,c:{h:"#94a3b8",a:100}}}},elems:[{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}}},clc:{},elems:[{t:13,style:{lg:{spc:{mb:5},size:{w:"70px",h:"auto"},lout:{of:"cover"}},sm:{spc:{mb:5},size:{w:"80px",h:"auto"},lout:{of:"cover"}}},src:"{{{ product.image_url }}}"},{t:4,style:{lg:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:7,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}}},clc:{},elems:[{t:14,style:{lg:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#313131",a:100},ta:0,fw:600,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#575757",a:100},ta:0,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.name }}"},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:14,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:12,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.compare_price }}"},{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:14,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.price }}"},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"Save {{ product.discount_price }}",when:{lhs:"{{ product.discount_price }}",op:"gt",rhs:0}},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#0d8d00",a:100},ta:1,fw:400,ls:0,fam:{name:"DINNextRoundedLTPro-Medium"}}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"({{ product.discount_percent }}% off)",when:{lhs:"{{ product.discount_percent }}",op:"gt",rhs:0}}]},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:3,style:{lg:{spc:{p:7,pl:7,pr:7,pt:7,pb:7},size:{w:"100%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{p:7,pl:7,pr:7,pt:8,pb:8},size:{w:"70%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"Add",clc:{at:102},allowedTypes:[102]}]}]}]}]}),Sd=new ze({t:2,style:{lg:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}},sm:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}}},text:"WATCH & SHOP - NEW LAUNCHES"}),Vo=class extends Te{render(){return M("div",{style:{marginTop:30},class:"lc-container",children:[M(bt,{element:Sd,triggerContext:this.props.triggerContext}),M("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map(t=>{if(t.portraitVideos?.length)return M("div",{class:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[M("a",{href:t.link,onClick:()=>{this.sendTriggerClicked([new It(t)],{from:"video"})},children:M("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),M($r,{element:Ed,item:t,triggerContext:this.props.triggerContext})]})})})]})}getSources(t){let e=t.map(i=>M("source",{src:i.url,type:i.mimeType,media:`(max-width:${i.width}px)`})),r=t.filter(i=>i.format==="mp4").sort((i,s)=>s.width-i.width)[0];r&&e.push(M("source",{src:r.url,type:r.mimeType}));let n=t.filter(i=>i.format==="m3u8").sort((i,s)=>s.width-i.width)[0];return n&&e.push(M("source",{src:n.url,type:n.mimeType})),e}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}},lc=class extends Ct{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){es(Xi(Vo,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}},uc=class extends Ct{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(A.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!Ft.hasKeys(n)){w.error(`No detail received for ${r}`);return}w.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){w.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(c=>new It({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new Li(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},Ui=class{runtimeData=fe.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...Nr.renderedEngagements];Nr.renderedEngagements.length=0;for(let r of t)w.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(w.log(`${r} is new`),r.isProgressBar()?new cc(r).renderSilently():r.isSubscriptionUpsell()?ac.renderCartUpsell(r):new Nr(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...Ct.renderedEngagements];Ct.renderedEngagements.length=0;for(let r of t)w.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(w.log(`${r} is new`),r.isShoppableVideo()?new lc(r).renderSilently():r.isBYOB()?new uc(r).renderSilently():new Ct(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},ar=class Bd{static INSTANCE;httpService=ae.get(xt);sessionManager=ae.get(qe);runtimeData=fe.get();loadWidgetsSubject=new yt;constructor(){this.loadWidgetsSubject.pipe(rr(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>w.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>w.error("Unable to initiate page widgets",e))}),Rr.get().subscriber(A.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Bd),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>w.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>w.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){qe.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();w.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Lt(i));new Ui().processPageWidgetResponse(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();w.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Lt(i));new Ui().processCartWidgetResponse(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",b(b({},e),r))}renderCachedCartWidgets(){new Ui().processCartWidgetResponse(this.runtimeData.cartEngagements)}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=_r.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),r=[];return e.forEach(n=>{let i=n.dataset.engagementId;i&&+i&&r.push(i)}),r}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(s){w.error("Error fetching Shopify cart before sending widget call",s)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(s=>Number.isInteger(+s)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let i=r.get("cooee-variant");return i?e.previewVariant=i:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}},pc=class{runtimeData=fe.get();widgetAPIService=ae.get(ar);meddle(){let t=Se.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=Se.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.previewWidget=Se.previewWidget.bind(Se),t.previewPopup=Se.previewPopup.bind(Se)}overwritePush(t,e){Jn(t,"push",e)}meddleAccount(){this.overwritePush(Se.globalRef.account,(...t)=>{this.processAccount(t[0])}),Se.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Se.globalRef.events,(...t)=>{this.processEvent(t[0])}),Se.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Se.globalRef.profile,(...t)=>{this.processProfile(t[0])}),Se.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(Se.globalRef.screen,(...t)=>{this.processPageName(t[0])}),Se.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&Se.authenticate(t),t.flags&&On.setFlags(t.flags))}processEvent(t){t&&(A.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?Se.sendEvent(t[0],t[1],this.runtimeData.jsLoadTime):Se.sendEvent(t[0],t[1]))}processProfile(t){t&&Se.updateProfile(t)}processPageName(t){t&&Se.setPageName(t)}meddlePage(){this.overwritePush(Se.globalRef.page,(...t)=>{this.processPage(t[0])}),Se.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.pageName&&Se.setPageName(t.pageName)}},Mi=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=A.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},ki=class Sc{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=ae.get(ue);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Sc),this.INSTANCE}resetScrollID(e){Mi.remove(A.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}se.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){En(window,"scroll").pipe(rr(Sc.DEBOUNCE_TIME),_n(()=>{let e=this.getPercentScrolledY();if(e>100){w.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=Sc.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=Mi.getString(A.SESSION_STORAGE_SCROLL_ID,""),i=new ve(A.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),Mi.setString(A.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}},fc=class jd{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=ae.get(ue);runtimeData=fe.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){w.info("Not sending background event as user was inactive on website");return}w.info(`Sending background event with ${e} seconds`);let r={};r[jd.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ve(A.EVENT_APP_BACKGROUND,r))}},mc=class{compareCartItemSubject=new yt;constructor(){this.compareCartItemSubject.pipe(rr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>w.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},w.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>w.error("Unable to process cart change in fetch",i)),n))},w.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(fe.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(w.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let c=r?.find(u=>u.vID===o.vID);if(c){if(c.quantity!==o.quantity){let u=c.quantity<o.quantity,f=Math.abs(c.quantity-o.quantity),m=Z(b({},o),{quantity:f});u?i.push(m):s.push(m)}r&&se.removeFromArray(r,c)}else i.push(o)}),r)for(let o of r)s.push(o);w.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(A.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(A.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&Rr.get().broadcast(A.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new ve(t,e);ae.get(ue).sendEvent(r)}async compareCartItems(){let t=await Ne.get(ne.CURRENT_CART,{}),e=await ge.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},dc=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){Me.getInstance().captureError("Failed to modify graphql request",i,{body:JSON.stringify(n?.body)})}return e(r,n)},w.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;w.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=await Ne.get(ne.DEVICE_ID),r=await ae.get(qe).getCurrentSessionID(),n=t.variables.input.attributes??[],i=[{key:"letscooee_did",value:e},{key:"letscooee_sid",value:r},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}];return t.variables.input.attributes=[...n,...i],JSON.stringify(t)}sendBuyNowEvent(){let t=fe.get().getCurrentItem();if(!t)return;let e=new ve(A.EVENT_BUY_NOW_CLICKED,{items:[t]});ue.getInstance().sendEvent(e)}},Fi=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new ve(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});ue.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>w.error(t))}async listen(){this.elements=await se.retrySelectorForElements(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},hc=class Qu extends Fi{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(Qu.selectors,A.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qu),this.INSTANCE}},gc=class th extends Fi{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(th.selectors,A.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new th),this.INSTANCE}},yc=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){se.onDocumentLoaded(()=>{w.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(A.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(A.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){w.debug("No clickable cart checkout button found");return}w.debug("Clickable cart checkout button found",e),e.click()}else t.includes(A.HASH_OPEN_CART_DRAWER)&&et.get().open()}},vc=class{trackSilently(){this.track().catch(t=>Me.getInstance().captureException(t))}async track(){let t=window.Shopify?.checkout,e=window.Shopify?.Checkout;if(!t&&!e)return;let r={};this.processSmallCheckout(t,r),this.processBigCheckout(e,r);let n=this.getTokenFromCurrentURLPath();if(n&&(r.urlToken=n),!Object.keys(r).length){w.warn("No processable data found in",t,e);return}r.referrer=document.referrer,r.url=location.href;let i=await ae.get(qe).checkSessionAndGetContext();r.sessionID=i[0],this.trackOrder(r)}processSmallCheckout(t,e){t&&(t.order_id&&(e.orderID=t.order_id.toString()),t.token&&(e.checkoutToken=t.token.toString()),t.customer_id&&(e.customerID=t.customer_id.toString()))}processBigCheckout(t,e){t&&(t.token&&!e.checkoutToken&&(e.checkoutToken=t.token.toString()),t.cartToken&&(e.cartToken=t.cartToken.toString()))}trackOrder(t){w.info("Found order to be send",t),ue.getInstance().trackOrder(t)}getTokenFromCurrentURLPath(){let t=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(e=>e.length&&t.test(e))}},zo=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await ge.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new ve(A.EVENT_CHECKOUT_STARTED,e);ue.getInstance().sendEvent(r)})}},_c=class{async migrate(){}};gt.escape=Ko.escapeHtml;var Se=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new _c().migrate(),this.autoAuthenticate(),new pc().meddle(),new fc().listen(),new vc().trackSilently(),new kr().listen(),new mc().listen(),new dc().listen(),new yc().listen(),ae.get(ki).listen(),ae.get(gc).listenSilently(),ae.get(hc).listenSilently(),ae.get(ar).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Xt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Jn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Jn(this.globalRef,"config",new He),Jn(this.globalRef,"runtimeData",new fe),w.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.includes("localhost")){let t="http://localhost:8002";lt.injectScriptURL(`${t}/main.js`),lt.injectStylesheet(`${t}/styles.css`)}else{let t=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}`;lt.injectScriptURL(`${t}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),lt.injectStylesheet(`${t}/dist/widget-sdk.min.css`)}}static autoAuthenticate(){let t=Ae.getShopName();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((se.isNull(e)||e.length!==24)&&se.isNull(r)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,ae.get(qe).init(t)}static sendEvent(t,e,r){for(let i in e)if(i.length>3&&i.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");let n=new ve(t,e);n.occurred=r??new Date,ae.get(ue).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");ae.get(ue).updateProfile(t)}static setPageName(t){if(!t)return;let e=fe.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&&ae.get(ar).loadOrRenderWidgetsAfterCartChange(),A.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){ae.get(ki).resetScrollID();return}let n={};r&&(n.ps=r);let i=new ve(A.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,ae.get(ue).sendEvent(i),ae.get(ki).resetScrollID(i.occurred)}static previewPopup(t,e){new Oi(e).render(t)}static previewWidget(t){new Ct(new Lt(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){w.error(t)}window.addEventListener("message",t=>{if(w.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=fe.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?zo.attachCheckoutListener():window.addEventListener("gokwikLoaded",zo.attachCheckoutListener)}static storePreviewParams(){let t=fe.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};w.configure();w.logBrand();w.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.debug("Execution order:","IIFE start"),await Se.initForMerchantWebsiteOnly(),await Se.initForAll(),w.debug("Execution order:","IIFE end")))());w.debug("Execution order:","bottom");})();
|
|
70
|
+
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function sc(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),M("div",{class:"swiper-container",ref:e,children:[M("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&M("div",{class:"swiper-button-next",style:n,children:M("span",{})}),t.navigation.enabled&&M("div",{class:"swiper-button-prev",style:n,children:M("span",{})}),t.pagination.enabled&&M("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var jo=class extends Te{swiperRef=null;swiperInstance=null;configuration;gap;constructor(t,e){super(t,e),this.configuration=this.renderer.isMobile()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&ic().then(()=>{this.swiperInstance=oc(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.triggerContext.triggerData.items;t.splice(this.configuration.maxItems??10);let e;if(this.configuration.disp===2){let r=i=>{this.swiperRef=i},n=()=>t?.map(i=>M("div",{class:"swiper-slide",children:this.getProductFragment(i)}));e=M("div",{style:Z(b({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:sc(this.configuration,r,n)})}else e=M("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:t?.map((r,n)=>this.getProductFragment(r,n!==t.length-1))});return e}getComponentStyles(){let t=[0,2].includes(this.configuration.disp),e={display:t?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(e.flexDirection==="row"){if(t)e.maxWidth="100%",e.overflowY="auto";else if(this.configuration.disp===1){let r=this.props.triggerContext.triggerData,n=r.items.length,i;r.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,e.gridTemplateColumns=`repeat(${i}, auto)`}}return e}getProductFragment(t,e=!1){return M(mr,{children:[M(Hr,{element:this.props.element.prod,item:t,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&e&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&M("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:M(It,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},Wo=class extends Te{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){ic().then(()=>{this.swiperInstance=oc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let t=this.props.element,e=n=>{this.swiperRef=n},r=()=>t.values?.map(n=>M("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(n)}),children:this.renderElement(n)}));return sc(t.conf,e,r)}getComponentStyles(){return{}}renderElement(t){let e=this.valueAddedSlide(this.props.element.slide,t);switch(e?.t){case 1:return M(kr,{element:e,triggerContext:this.props.triggerContext});case 4:return M(Fr,{elements:e.elems,element:e,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(t,e){let r=JSON.stringify(t),n=vt.render(r,{form:e});return Pt.getParsedElement(JSON.parse(n))}getClickAction(t){let e=b({},this.props.element.clc),r=JSON.stringify(e),n=vt.render(r,{form:t});return JSON.parse(n)}},Zr=class extends Te{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),ot(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(t){if(!t.hide){if(t.t===4){let e=t;return M(Fr,{element:e,triggerContext:this.props.triggerContext,elements:e.elems})}if(t.t===61)return M(Uo,{element:t,triggerContext:this.props.triggerContext});if(t.t===3)return this.state.showButton?M(Ln,{element:t,triggerContext:this.props.triggerContext}):void 0;if(t.t===2)return M(It,{element:t,triggerContext:this.props.triggerContext});if(t.t===1)return M(kr,{element:t,triggerContext:this.props.triggerContext});if(t.t===11)return M(jo,{element:t,triggerContext:this.props.triggerContext});if(t.t===12)return M(Hr,{element:t,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(t.t===62)return M(Wo,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Go=class extends Te{clickAction;isClickable;constructor(t,e){super(t,e),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){ot(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return M(mr,{children:[M("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:M(Zr,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&M("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let t={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(t.cursor="pointer"),t}async onClick(t){if(this.isClickable)return super.onClick(t)}},Ct=class qo{constructor(e){this.engagementTrigger=e,this.triggerContext=new Ri(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=le.get();widgetAPIService=ue.get(ar);safeHTTPService=ue.get(pe);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>ke.getInstance().captureException(e,b({},this.engagementTrigger.sentryContext())))}destroy(){w.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),qo.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID)}async render(){if(this.engagementTrigger.hasMultiplePlacement){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),!this.shouldStopRendering()&&(await this.startRendering(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}update(e){_d.default.log(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items)}shouldStopRendering(){return!this.widget&&!this.isExclusionWithBVariation}async getVariationIfRequired(){if(this.engagementTrigger.isSingleContent()||this.engagementTrigger.widget){w.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new xt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new xt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new xt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&Ft.hasKeys(e.props)&&(this.engagementTrigger.props=b(b({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new li(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){qo.renderedEngagements.push(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return await this.widgetAPIService.getVariation(e)}catch(r){w.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`-${e}px 0px ${e}px 0px`,threshold:0};return await this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((s,o)=>{s.forEach(async l=>{if(l.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let u=await this.getVariation();n(u),o.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=En(window,"scroll").pipe(rr(qo.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(qo.engagementIDsWithTrackedDisplay.has(e)||!await this.isInViewport())return;let r={};this.triggerContext.triggerData.items?.length&&(r.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=this.isExclusionWithBVariation?A.EVENT_CAMPAIGN_HOLDOUT:A.EVENT_TRIGGER_DISPLAYED,i=new ve(n,r,this.engagementTrigger);i.name===A.EVENT_CAMPAIGN_HOLDOUT&&(i.trigger.holdout=!0),this.safeHTTPService.sendEvent(i),qo.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}async isInViewport(){let e=(await this.getWidgetContainer())?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,n=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=n/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(A.SHADOW_SPLITTER)){let u=n.split(A.SHADOW_SPLITTER);i=(await ne.retrySelector(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&&ut.injectStylesheet(Zt.styleURL,i);let f=Oe.get().website.commonCSS;i&&f&&ut.injectRawCSS(f,i)}w.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let s=await ne.retrySelector(n,10,i??document);if(!s)return w.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let o=this.generateParentElementID(),l=this.getParentElement(o);if(!e)return l;switch(r.position){case $n.BEFORE:{s.parentElement?.insertBefore(l,s);break}case $n.INSIDE_FIRST:{s.insertBefore(l,s.firstChild);break}case $n.INSIDE_LAST:{s.appendChild(l);break}case $n.AFTER:default:s.parentElement?.insertBefore(l,s.nextSibling)}return l}async startRendering(){let e;try{e=await Pi.refreshItems(this.engagementTrigger)}catch(r){w.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!e?.length&&this.engagementTrigger.isProductPromoted()){w.warn(`${this.engagementTrigger} is of ${this.engagementTrigger.objective} but no product found`);return}this.engagementTrigger.items=e,this.renderContainer()}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i}`,n.dataset.engagementId=i,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let r=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),n=Oe.get().website.commonCSS;n&&ut.injectRawCSS(n,r),ut.injectStylesheet(Zt.styleURL,r),ut.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),e=r}es(Ji(Go,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let s of i)jn.remove(r,s)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}},Nr=class Md extends Ct{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){Md.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!Ze.get().isOpen()&&this.runtimeData.pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}},ac=class Ud{constructor(e,r){this.engagementTrigger=e,this.element=r,this.cartItems=ge.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new Ud(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let i=new dr(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let m of i.sellingPlans??[])m.mID===s.id.toString()&&(m.isSelected=!0,i.changeSellingPlan(m));let o=new xt(r);o.vars=[i],o.selectedOrFirstVariant.value=i;let l=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(l);let u=new Lt(this.engagementTrigger);u.placement.selector=`.${l}`,u.items=[o];let f=new Nr(u);f.renderSilently(),this.watchForCartItemDeletion(f,l)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(s=>{s.removedNodes.forEach(o=>{o===this.element&&(w.debug(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}},cc=class extends Nr{ctaListener=new Qr;constructor(t){super(t),Rr.get().subscriber(A.CART_UPDATE_BROADCAST).pipe(Nl(null)).subscribe(this.checkMilestone.bind(this))}update(t){super.update(t),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let t=this.widgetElement=document.createElement("cooee-progressbar");t.className="cooee-root",t.cart=ge.getCurrent(),t.engagementTrigger=this.engagementTrigger,t.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered()}async checkMilestone(){let t=await ge.getCurrent().getNormalisedCart(),e=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find(r=>r.minValue<t.amount);if(!e){w.log("No milestone achieved yet");return}if(w.log("Current milestone",e),e.rewardType===Dc.FREE_AUTO_GIFT){let r=e.items[0];if(t.items.find(n=>n.vID===r.vID||n.mID===r.mID)){w.log(`Item(vID:${r.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(r,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});return}else{let n=await this.ctaListener.performAddToCart([r],this.engagementTrigger);Ze.get().refreshUI(n,!1),await this.removeOtherFreeGifts(r)}}}async removeOtherFreeGifts(t){let e=(await ge.getCurrent().getNormalisedCart()).items.filter(r=>r.vID!==t?.vID&&r.properties[A.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(e.length)for(let r of e)await this.ctaListener.performUpdate(r,{quantity:0})}},Ed=new gr({t:12,style:{lg:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"100%",h:"auto"},br:{r:4,w:0,s:1,c:{h:"#94a3b8",a:100}}},sm:{spc:{p:5,pl:5,pr:5,pt:5,pb:5},size:{w:"240px",h:"auto"},br:{r:0,w:0,s:1,c:{h:"#94a3b8",a:100}}}},elems:[{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"center",ai:"center"}}},clc:{},elems:[{t:13,style:{lg:{spc:{mb:5},size:{w:"70px",h:"auto"},lout:{of:"cover"}},sm:{spc:{mb:5},size:{w:"80px",h:"auto"},lout:{of:"cover"}}},src:"{{{ product.image_url }}}"},{t:4,style:{lg:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{mb:10},lout:{of:"cover",disp:"flex"},flex:{gap:7,dir:"column",wrap:"nowrap",jc:"start",ai:"start"}}},clc:{},elems:[{t:14,style:{lg:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#313131",a:100},ta:0,fw:600,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},size:{w:"auto",h:"auto"},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#575757",a:100},ta:0,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.name }}"},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"start"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:10,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:14,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,td:"line-through",fs:12,tc:{h:"#64748b",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.compare_price }}"},{t:2,style:{lg:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:14,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{},typo:{italic:!1,bold:!1,lh:1.2,fs:13,tc:{h:"#000000",a:100},ta:1,fw:500,ls:0,fam:{name:"Arial",g:!0}}}},text:"{{ product.price }}"},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"Save {{ product.discount_price }}",when:{lhs:"{{ product.discount_price }}",op:"gt",rhs:0}},{t:2,style:{lg:{spc:{p:0,pl:0,pr:0,pt:0,pb:0,m:0,ml:0,mr:10,mt:0,mb:0},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#0d8d00",a:100},ta:1,fw:400,ls:0,fam:{name:"DINNextRoundedLTPro-Medium"}}},sm:{spc:{p:0,m:0,mr:10},typo:{italic:!1,bold:!1,lh:1.2,fs:18,tc:{h:"#64748b",a:100},ta:1,fw:600,ls:0}}},hide:!0,text:"({{ product.discount_percent }}% off)",when:{lhs:"{{ product.discount_percent }}",op:"gt",rhs:0}}]},{t:4,style:{lg:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}},sm:{spc:{},lout:{of:"cover",disp:"flex"},flex:{gap:5,dir:"row",wrap:"nowrap",jc:"start",ai:"center"}}},clc:{},elems:[{t:3,style:{lg:{spc:{p:7,pl:7,pr:7,pt:7,pb:7},size:{w:"100%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}},sm:{spc:{p:7,pl:7,pr:7,pt:8,pb:8},size:{w:"70%",h:"auto"},bg:{s:{h:"#000000",a:100}},br:{r:0,w:0,s:1,c:{a:100}},typo:{italic:!1,bold:!1,lh:1.2,fs:12,tc:{h:"#ffffff",a:100},ta:1,fw:400,ls:0,fam:{name:"Arial",g:!0}}}},text:"Add",clc:{at:102},allowedTypes:[102]}]}]}]}]}),Sd=new ze({t:2,style:{lg:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}},sm:{spc:{mb:15},typo:{italic:!1,bold:!1,lh:1.2,fs:16,tc:{h:"#333333",a:100},ta:1,fw:700,ls:.5,fam:{name:"Arial",g:!0}}}},text:"WATCH & SHOP - NEW LAUNCHES"}),Vo=class extends Te{render(){return M("div",{style:{marginTop:30},class:"lc-container",children:[M(It,{element:Sd,triggerContext:this.props.triggerContext}),M("div",{style:this.getComponentStyles(),children:this.props.triggerContext.triggerData.items.map(t=>{if(t.portraitVideos?.length)return M("div",{class:"lc-shoppable-video",style:{flex:"1 1 0",width:"260px"},children:[M("a",{href:t.link,onClick:()=>{this.sendTriggerClicked([new lt(t)],{from:"video"})},children:M("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),M(Hr,{element:Ed,item:t,triggerContext:this.props.triggerContext})]})})})]})}getSources(t){let e=t.map(i=>M("source",{src:i.url,type:i.mimeType,media:`(max-width:${i.width}px)`})),r=t.filter(i=>i.format==="mp4").sort((i,s)=>s.width-i.width)[0];r&&e.push(M("source",{src:r.url,type:r.mimeType}));let n=t.filter(i=>i.format==="m3u8").sort((i,s)=>s.width-i.width)[0];return n&&e.push(M("source",{src:n.url,type:n.mimeType})),e}getComponentStyles(){return{display:"flex",gap:10,overflowX:"auto",margin:10}}},lc=class extends Ct{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){es(Ji(Vo,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}},uc=class extends Ct{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){let t=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(t),document.addEventListener(A.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(t){let e=this.engagementTrigger,r=`Engagement(id: ${e.engagementID}, shortID: ${e.shortID})`,n=t.detail;if(!Ft.hasKeys(n)){w.error(`No detail received for ${r}`);return}w.log("Detail received for BYOB",n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==e.shortID&&i!==e.engagementID){w.warn(`Current ${r} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let o=s.map(l=>new lt({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new Li(this.triggerContext).execute({embeddedItems:o,clickAction:{at:108,applyDiscount:!0}})}},Ui=class{runtimeData=le.get();processCartWidgetResponse(t){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=t;let e=[...Nr.renderedEngagements];Nr.renderedEngagements.length=0;for(let r of t)w.log(`\u{1F4E3} ${r} received as cart embed`),!this.findAndUpdateCurrent(r,e)&&(w.log(`${r} is new`),r.isProgressBar()?new cc(r).renderSilently():r.isSubscriptionUpsell()?ac.renderCartUpsell(r):new Nr(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...Ct.renderedEngagements];Ct.renderedEngagements.length=0;for(let r of t)w.log(`\u{1F4E3} ${r} received as page embed`),!this.findAndUpdateCurrent(r,e)&&(w.log(`${r} is new`),r.isShoppableVideo()?new lc(r).renderSilently():r.isBYOB()?new uc(r).renderSilently():new Ct(r).renderSilently());this.removeOldWidgets(e)}findAndUpdateCurrent(t,e){let r=e.findIndex(n=>n.isSameTrigger(t));return r<0||t.isSubscriptionUpsell()?!1:(e[r].update(t),e[r].renderSilently(),e.splice(r,1),!0)}removeOldWidgets(t){for(let e of t)e.destroy()}},ar=class jd{static INSTANCE;httpService=ue.get(mt);sessionManager=ue.get(it);runtimeData=le.get();loadWidgetsSubject=new _t;constructor(){this.loadWidgetsSubject.pipe(rr(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>w.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>w.error("Unable to initiate page widgets",e))}),Rr.get().subscriber(A.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new jd),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){it.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>w.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){it.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>w.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){it.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();w.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Lt(i));new Ui().processPageWidgetResponse(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();w.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Lt(i));new Ui().processCartWidgetResponse(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",b(b({},e),r))}renderCachedCartWidgets(){new Ui().processCartWidgetResponse(this.runtimeData.cartEngagements)}async addSessionContext(e){let r=await this.sessionManager.checkSessionAndGetContext();e.sessionID=r[0],e.sessionNumber=r[1],e.landingPage=r[2],e.page=_r.parseFromCurrent()}addAvailableEngagementShortIDs(){let e=document.querySelectorAll(".letscooee-engagement"),r=[];return e.forEach(n=>{let i=n.dataset.engagementId;i&&+i&&r.push(i)}),r}async getWidgetProps(){let e={};e.engagementIDs=this.addAvailableEngagementShortIDs(),await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await ge.getCurrent().getNormalisedCart()}catch(s){w.error("Error fetching Shopify cart before sending widget call",s)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(s=>Number.isInteger(+s)):this.runtimeData.previewIDs?.length&&(e.previewIDs=this.runtimeData.previewIDs);let i=r.get("cooee-variant");return i?e.previewVariant=i:this.runtimeData.previewVariant&&(e.previewVariant=this.runtimeData.previewVariant),e}},pc=class{runtimeData=le.get();widgetAPIService=ue.get(ar);meddle(){let t=Se.globalRef;t.account=t.account??[],t.profile=t.profile??[],t.events=t.events??[],t.screen=t.screen??[],t.page=t.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let t=Se.globalRef;t.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},t.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},t.previewWidget=Se.previewWidget.bind(Se),t.previewPopup=Se.previewPopup.bind(Se)}overwritePush(t,e){Xn(t,"push",e)}meddleAccount(){this.overwritePush(Se.globalRef.account,(...t)=>{this.processAccount(t[0])}),Se.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Se.globalRef.events,(...t)=>{this.processEvent(t[0])}),Se.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Se.globalRef.profile,(...t)=>{this.processProfile(t[0])}),Se.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(Se.globalRef.screen,(...t)=>{this.processPageName(t[0])}),Se.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(t){t&&(t.appID&&Se.authenticate(t),t.flags&&On.setFlags(t.flags))}processEvent(t){t&&(A.JS_LOAD_WHITELIST_EVENTS.includes(t[0])?Se.sendEvent(t[0],t[1],this.runtimeData.jsLoadTime):Se.sendEvent(t[0],t[1]))}processProfile(t){t&&Se.updateProfile(t)}processPageName(t){t&&Se.setPageName(t)}meddlePage(){this.overwritePush(Se.globalRef.page,(...t)=>{this.processPage(t[0])}),Se.globalRef.page.forEach(this.processPage.bind(this))}processPage(t){t.currentItem&&this.runtimeData.setCurrentItem(t.currentItem),t.currency&&(this.runtimeData.currencyCode=t.currency),t.shopCurrency&&(this.runtimeData.shopCurrencyCode=t.shopCurrency),t.moneyFormat&&(this.runtimeData.moneyFormat=t.moneyFormat),t.jsLoad&&(this.runtimeData.jsLoadTime=t.jsLoad),t.pageName&&Se.setPageName(t.pageName)}},Mi=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=A.COOEE.concat("-");static getString(t,e){return this.getItem(t)||e}static setString(t,e){this.setItem(t,e)}static remove(t){this.removeItem(t)}static getItem(t){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}static setItem(t,e){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t),e)}static removeItem(t){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(t))}},ki=class Sc{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=ue.get(pe);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Sc),this.INSTANCE}resetScrollID(e){Mi.remove(A.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}ne.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){En(window,"scroll").pipe(rr(Sc.DEBOUNCE_TIME),_n(()=>{let e=this.getPercentScrolledY();if(e>100){w.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=Sc.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=Mi.getString(A.SESSION_STORAGE_SCROLL_ID,""),i=new ve(A.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),Mi.setString(A.SESSION_STORAGE_SCROLL_ID,i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}},fc=class Bd{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=ue.get(pe);runtimeData=le.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){w.info("Not sending background event as user was inactive on website");return}w.info(`Sending background event with ${e} seconds`);let r={};r[Bd.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ve(A.EVENT_APP_BACKGROUND,r))}},mc=class{compareCartItemSubject=new _t;constructor(){this.compareCartItemSubject.pipe(rr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let t=this,e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){t.performEvent(this._url).catch(r=>w.error("Unable to process cart change in XMLHttpRequest",r))}),e.apply(this,arguments)},w.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=function(r){return e.apply(window,arguments).then(n=>(t.performEvent(r.toString()).catch(i=>w.error("Unable to process cart change in fetch",i)),n))},w.debug("Securely overwritten window.fetch method")}async performEvent(t){this.isCartManipulationURL(t)&&(le.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(t){return/\/cart\/(add|change|update|clear)/.test(t)}sendChangesAsEvents(t,e){let r=t?.items,n=e.items,i=[],s=[];if(w.debug(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(o=>{let l=r?.find(u=>u.vID===o.vID);if(l){if(l.quantity!==o.quantity){let u=l.quantity<o.quantity,f=Math.abs(l.quantity-o.quantity),m=Z(b({},o),{quantity:f});u?i.push(m):s.push(m)}r&&ne.removeFromArray(r,l)}else i.push(o)}),r)for(let o of r)s.push(o);w.debug(`Cart delta: added: ${i.length}, removed: ${s.length}`),i.length&&this.sendEvent(A.EVENT_ADD_TO_CART,{items:i}),s.length&&t.token===e.token&&this.sendEvent(A.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||i.length)&&Rr.get().broadcast(A.CART_UPDATE_BROADCAST,{itemsAdded:i,itemsRemoved:s})}sendEvent(t,e){let r=new ve(t,e);ue.get(pe).sendEvent(r)}async compareCartItems(){let t=await Ne.get(ie.CURRENT_CART,{}),e=await ge.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(t,e)}},dc=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let t=this,e=window.fetch;window.fetch=async function(r,n){try{await t.modifyRequest(r,n)}catch(i){ke.getInstance().captureError("Failed to modify graphql request",i,{body:JSON.stringify(n?.body)})}return e(r,n)},w.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;w.debug("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await this.updatedBody(n),this.sendBuyNowEvent())}async updatedBody(t){let e=t.variables.input.attributes??[],r=await ne.getCartAttributes();return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}sendBuyNowEvent(){let t=le.get().getCurrentItem();if(!t)return;let e=new ve(A.EVENT_BUY_NOW_CLICKED,{items:[t]});pe.getInstance().sendEvent(e)}},Fi=class{constructor(t,e){this.selectors=t,this.eventName=e,this.selectorString=t.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=t=>{let e=t.currentTarget,r=new ve(this.eventName,{class:e.className||void 0,tagName:e.tagName||void 0,id:e.id||void 0});pe.getInstance().sendEvent(r),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(t=>w.error(t))}async listen(){this.elements=await ne.retrySelectorForElements(this.selectorString),this.elements.forEach(t=>{t.addEventListener("click",this.clickListenerCallback)})}removeClickListener(t){this.elements?.forEach(e=>{e.removeEventListener("click",t)})}},hc=class Qu extends Fi{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(Qu.selectors,A.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Qu),this.INSTANCE}},gc=class th extends Fi{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(th.selectors,A.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new th),this.INSTANCE}},yc=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){ne.onDocumentLoaded(()=>{w.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let t=window.location.hash?.substring(1);if(t)if(t.includes(A.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(A.THIRD_PARTY_CHECKOUT_EVENT));let e=document.querySelector(this.selector);if(!e){w.debug("No clickable cart checkout button found");return}w.debug("Clickable cart checkout button found",e),e.click()}else t.includes(A.HASH_OPEN_CART_DRAWER)&&Ze.get().open()}},vc=class{trackSilently(){this.track().catch(t=>ke.getInstance().captureException(t))}async track(){let t=window.Shopify?.checkout,e=window.Shopify?.Checkout;if(!t&&!e)return;let r={};this.processSmallCheckout(t,r),this.processBigCheckout(e,r);let n=this.getTokenFromCurrentURLPath();if(n&&(r.urlToken=n),!Object.keys(r).length){w.warn("No processable data found in",t,e);return}r.referrer=document.referrer,r.url=location.href;let i=await ue.get(it).checkSessionAndGetContext();r.sessionID=i[0],this.trackOrder(r)}processSmallCheckout(t,e){t&&(t.order_id&&(e.orderID=t.order_id.toString()),t.token&&(e.checkoutToken=t.token.toString()),t.customer_id&&(e.customerID=t.customer_id.toString()))}processBigCheckout(t,e){t&&(t.token&&!e.checkoutToken&&(e.checkoutToken=t.token.toString()),t.cartToken&&(e.cartToken=t.cartToken.toString()))}trackOrder(t){w.info("Found order to be send",t),pe.getInstance().trackOrder(t)}getTokenFromCurrentURLPath(){let t=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(e=>e.length&&t.test(e))}},zo=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await ge.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new ve(A.EVENT_CHECKOUT_STARTED,e);pe.getInstance().sendEvent(r)})}},_c=class{async migrate(){}};vt.escape=Ko.escapeHtml;var Se=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new _c().migrate(),this.autoAuthenticate(),new pc().meddle(),new fc().listen(),new vc().trackSilently(),new Qr().listen(),new mc().listen(),new dc().listen(),new yc().listen(),ue.get(ki).listen(),ue.get(gc).listenSilently(),ue.get(hc).listenSilently(),ue.get(ar).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Jt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Xn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Xn(this.globalRef,"config",new Oe),Xn(this.globalRef,"runtimeData",new le),w.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.includes("localhost")){let t="http://localhost:8002";ut.injectScriptURL(`${t}/main.js`),ut.injectStylesheet(`${t}/styles.css`)}else{let t=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}`;ut.injectScriptURL(`${t}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),ut.injectStylesheet(`${t}/dist/widget-sdk.min.css`)}}static autoAuthenticate(){let t=Ae.getShopName();t&&this.authenticate({shopifyShop:t})}static authenticate(t){if(this.authenticated)return;let e=t.appID?.trim(),r=t.shopifyShop;if((ne.isNull(e)||e.length!==24)&&ne.isNull(r)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,ue.get(it).init(t)}static sendEvent(t,e,r){for(let i in e)if(i.length>3&&i.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");let n=new ve(t,e);n.occurred=r??new Date,ue.get(pe).sendEvent(n)}static updateProfile(t){for(let e in t)if(e.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");ue.get(pe).updateProfile(t)}static setPageName(t){if(!t)return;let e=le.get(),r=e.pageName;if(t===r)return;if(e.pageName=t,t==="cart"&&ue.get(ar).loadOrRenderWidgetsAfterCartChange(),A.BLACKLISTED_PAGE_NAMES.some(s=>t.includes(s))){ue.get(ki).resetScrollID();return}let n={};r&&(n.ps=r);let i=new ve(A.EVENT_SCREEN_VIEW,n);i.occurred=e.jsLoadTime,ue.get(pe).sendEvent(i),ue.get(ki).resetScrollID(i.occurred)}static previewPopup(t,e){new Oi(e).render(t)}static previewWidget(t){new Ct(new Lt(t)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){w.error(t)}window.addEventListener("message",t=>{if(w.debug("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(this.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(this.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}static attachGoKwikListeners(){let t=le.get();window.addEventListener("kp-modal:opened",()=>{t.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",e=>{let{token:r}=e.detail;r&&this.updateProfile({goKwikToken:r})}),window.gokwikSdk?zo.attachCheckoutListener():window.addEventListener("gokwikLoaded",zo.attachCheckoutListener)}static storePreviewParams(){let t=le.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");r&&(t.previewIDs=r.trim().split(",").filter(i=>Number.isInteger(+i)));let n=e.get("cooee-variant");n&&(t.previewVariant=n)}};w.configure();w.logBrand();w.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.debug("Execution order:","IIFE start"),await Se.initForMerchantWebsiteOnly(),await Se.initForAll(),w.debug("Execution order:","IIFE end")))());w.debug("Execution order:","bottom");})();
|