@letscooee/web-sdk 9.3.5 → 9.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var ih=Object.create,wc=Object.defineProperty,oh=Object.defineProperties,sh=Object.getOwnPropertyDescriptor,ah=Object.getOwnPropertyDescriptors,ch=Object.getOwnPropertyNames,Qu=Object.getOwnPropertySymbols,lh=Object.getPrototypeOf,ep=Object.prototype.hasOwnProperty,uh=Object.prototype.propertyIsEnumerable,Zu=(t,e,r)=>e in t?wc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b=(t,e)=>{for(var r in e||={})ep.call(e,r)&&Zu(t,r,e[r]);if(Qu)for(var r of Qu(e))uh.call(e,r)&&Zu(t,r,e[r]);return t},Z=(t,e)=>oh(t,ah(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),ph=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ch(e))!ep.call(t,i)&&i!==r&&wc(t,i,{get:()=>e[i],enumerable:!(n=sh(e,i))||n.enumerable});return t},Xt=(t,e,r)=>(r=t!=null?ih(lh(t)):{},ph(e||!t||!t.__esModule?wc(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],_,m;for(m=1;m<h.length;m++)for(_ in h[m])!(_ in v)&&h[m].hasOwnProperty(_)&&(v[_]=h[m][_]);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 g=new f({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(g,g.enabledFor),h.trace=o(g,g.trace),h.debug=o(g,g.debug),h.time=o(g,g.time),h.timeEnd=o(g,g.timeEnd),h.info=o(g,g.info),h.warn=o(g,g.warn),h.error=o(g,g.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){g.setLevel(h);for(var v in s)s.hasOwnProperty(v)&&s[v].setLevel(h)},n.getLevel=function(){return g.getLevel()},n.get=function(h){return s[h]||(s[h]=new f(c({name:h},g.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(m,y){y.name&&m.unshift("["+y.name+"]")};var v={},_=function(m,y){Function.prototype.apply.call(m,console,y)};return typeof console>"u"?function(){}:function(m,y){m=Array.prototype.slice.call(m);var T=console.log,O;y.level===n.TIME?(O=(y.name?"["+y.name+"] ":"")+m[0],m[1]==="start"?console.time?console.time(O):v[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):_(T,[O+": "+(new Date().getTime()-v[O])+"ms"])):(y.level===n.WARN&&console.warn?T=console.warn:y.level===n.ERROR&&console.error?T=console.error:y.level===n.INFO&&console.info?T=console.info:y.level===n.DEBUG&&console.debug?T=console.debug:y.level===n.TRACE&&console.trace&&(T=console.trace),h.formatter(m,y),_(T,m))}},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)}),Bp=Vi((t,e)=>{"use strict";(function(r,n){"use strict";var i="1.0.40",s="",o="?",c="function",u="undefined",f="object",g="string",h="major",v="model",_="name",m="type",y="vendor",T="version",O="architecture",H="console",R="mobile",k="tablet",V="smarttv",Ut="wearable",de="embedded",j=500,ot="Amazon",Y="Apple",st="ASUS",Jt="BlackBerry",me="Browser",pe="Chrome",Ce="Edge",be="Firefox",Bt="Google",Te="Huawei",pt="LG",Q="Microsoft",we="Motorola",ar="Opera",jr="Samsung",ke="Sharp",en="Sony",Hn="Xiaomi",kn="Zebra",Hi="Facebook",Wi="Chromium OS",ji="Mac OS",Mn=" Browser",Pe=function(z,ft){var X={};for(var ie in z)ft[ie]&&ft[ie].length%2===0?X[ie]=ft[ie].concat(z[ie]):X[ie]=z[ie];return X},$r=function(z){for(var ft={},X=0;X<z.length;X++)ft[z[X].toUpperCase()]=z[X];return ft},rs=function(z,ft){return typeof z===g?a(ft).indexOf(a(z))!==-1:!1},a=function(z){return z.toLowerCase()},l=function(z){return typeof z===g?z.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(z,ft){if(typeof z===g)return z=z.replace(/^\s\s*/,s),typeof ft===u?z:z.substring(0,j)},I=function(z,ft){for(var X=0,ie,$e,Me,re,J,He;X<ft.length&&!J;){var As=ft[X],Yo=ft[X+1];for(ie=$e=0;ie<As.length&&!J&&As[ie];)if(J=As[ie++].exec(z),J)for(Me=0;Me<Yo.length;Me++)He=J[++$e],re=Yo[Me],typeof re===f&&re.length>0?re.length===2?typeof re[1]==c?this[re[0]]=re[1].call(this,He):this[re[0]]=re[1]:re.length===3?typeof re[1]===c&&!(re[1].exec&&re[1].test)?this[re[0]]=He?re[1].call(this,He,re[2]):n:this[re[0]]=He?He.replace(re[1],re[2]):n:re.length===4&&(this[re[0]]=He?re[3].call(this,He.replace(re[1],re[2])):n):this[re]=He||n;X+=2}},N=function(z,ft){for(var X in ft)if(typeof ft[X]===f&&ft[X].length>0){for(var ie=0;ie<ft[X].length;ie++)if(rs(ft[X][ie],z))return X===o?n:X}else if(rs(ft[X],z))return X===o?n:X;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],[T,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[T,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,T],[/opios[\/ ]+([\w\.]+)/i],[T,[_,ar+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[T,[_,ar+" GX"]],[/\bopr\/([\w\.]+)/i],[T,[_,ar]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[T,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[T,[_,"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],[_,T],[/quark(?:pc)?\/([-\w\.]+)/i],[T,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[T,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[T,[_,"UC"+me]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[T,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[T,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[T,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[T,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[T,[_,"Smart Lenovo "+me]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+me],T],[/\bfocus\/([\w\.]+)/i],[T,[_,be+" Focus"]],[/\bopt\/([\w\.]+)/i],[T,[_,ar+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[T,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[T,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[T,[_,ar+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[T,[_,"MIUI"+Mn]],[/fxios\/([\w\.-]+)/i],[T,[_,be]],[/\bqihoobrowser\/?([\w\.]*)/i],[T,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],T],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Mn],T],[/samsungbrowser\/([\w\.]+)/i],[T,[_,jr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[T,[_,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,"Sogou Mobile"],T],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,T],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[T,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Hi],T],[/(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],[_,T],[/\bgsa\/([\w\.]+) .*safari\//i],[T,[_,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[T,[_,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[_,pe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,pe+" WebView"],T],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[T,[_,"Android "+me]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,T],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[T,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[T,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[T,N,L]],[/(webkit|khtml)\/([\w\.]+)/i],[_,T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],T],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[_,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],[_,[T,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[T,/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],[m,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],[m,R]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[y,Y],[m,R]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[y,Y],[m,k]],[/(macintosh);/i],[v,[y,Y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[y,ke],[m,R]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[y,"Honor"],[m,R]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[y,Te],[m,k]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[y,Te],[m,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],[m,R]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[m,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"],[m,R]],[/\b(opd2\d{3}a?) bui/i],[v,[y,"OPPO"],[m,k]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[y,"Vivo"],[m,R]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[y,"Realme"],[m,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],[m,R]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[y,we],[m,k]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[y,pt],[m,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[y,pt],[m,R]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[y,"Lenovo"],[m,k]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[y,"Nokia"],[m,R]],[/(pixel c)\b/i],[v,[y,Bt],[m,k]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[y,Bt],[m,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],[m,R]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[y,en],[m,k]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[y,"OnePlus"],[m,R]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[y,ot],[m,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[y,ot],[m,R]],[/(playbook);[-\w\),; ]+(rim)/i],[v,y,[m,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[y,Jt],[m,R]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[y,st],[m,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[y,st],[m,R]],[/(nexus 9)/i],[v,[y,"HTC"],[m,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[v,/_/g," "],[m,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"],[m,k]],[/(itel) ((\w+))/i],[[y,a],v,[m,N,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[y,"Acer"],[m,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[y,"Meizu"],[m,R]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[y,"Ulefone"],[m,R]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[y,"Energizer"],[m,R]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[y,"Cat"],[m,R]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[y,"Smartfren"],[m,R]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[y,"Nothing"],[m,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,[m,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,[m,k]],[/(surface duo)/i],[v,[y,Q],[m,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[y,"Fairphone"],[m,R]],[/(u304aa)/i],[v,[y,"AT&T"],[m,R]],[/\bsie-(\w*)/i],[v,[y,"Siemens"],[m,R]],[/\b(rct\w+) b/i],[v,[y,"RCA"],[m,k]],[/\b(venue[\d ]{2,7}) b/i],[v,[y,"Dell"],[m,k]],[/\b(q(?:mv|ta)\w+) b/i],[v,[y,"Verizon"],[m,k]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[y,"Barnes & Noble"],[m,k]],[/\b(tm\d{3}\w+) b/i],[v,[y,"NuVision"],[m,k]],[/\b(k88) b/i],[v,[y,"ZTE"],[m,k]],[/\b(nx\d{3}j) b/i],[v,[y,"ZTE"],[m,R]],[/\b(gen\d{3}) b.+49h/i],[v,[y,"Swiss"],[m,R]],[/\b(zur\d{3}) b/i],[v,[y,"Swiss"],[m,k]],[/\b((zeki)?tb.*\b) b/i],[v,[y,"Zeki"],[m,k]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],v,[m,k]],[/\b(ns-?\w{0,9}) b/i],[v,[y,"Insignia"],[m,k]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[y,"NextBook"],[m,k]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],v,[m,R]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],v,[m,R]],[/\b(ph-1) /i],[v,[y,"Essential"],[m,R]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[y,"Envizen"],[m,k]],[/\b(trio[-\w\. ]+) b/i],[v,[y,"MachSpeed"],[m,k]],[/\btu_(1491) b/i],[v,[y,"Rotor"],[m,k]],[/(shield[\w ]+) b/i],[v,[y,"Nvidia"],[m,k]],[/(sprint) (\w+)/i],[y,v,[m,R]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[y,Q],[m,R]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[y,kn],[m,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[y,kn],[m,R]],[/smart-tv.+(samsung)/i],[y,[m,V]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[y,jr],[m,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,pt],[m,V]],[/(apple) ?tv/i],[y,[v,Y+" TV"],[m,V]],[/crkey/i],[[v,pe+"cast"],[y,Bt],[m,V]],[/droid.+aft(\w+)( bui|\))/i],[v,[y,ot],[m,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[y,ke],[m,V]],[/(bravia[\w ]+)( bui|\))/i],[v,[y,en],[m,V]],[/(mitv-\w{5}) bui/i],[v,[y,Hn],[m,V]],[/Hbbtv.*(technisat) (.*);/i],[y,v,[m,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,p],[v,p],[m,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,V]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,v,[m,H]],[/droid.+; (shield) bui/i],[v,[y,"Nvidia"],[m,H]],[/(playstation [345portablevi]+)/i],[v,[y,en],[m,H]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[y,Q],[m,H]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[y,jr],[m,Ut]],[/((pebble))app/i],[y,v,[m,Ut]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[y,Y],[m,Ut]],[/droid.+; (glass) \d/i],[v,[y,Bt],[m,Ut]],[/droid.+; (wt63?0{2,3})\)/i],[v,[y,kn],[m,Ut]],[/droid.+; (glass) \d/i],[v,[y,Bt],[m,Ut]],[/(pico) (4|neo3(?: link|pro)?)/i],[y,v,[m,Ut]],[/; (quest( \d| pro)?)/i],[v,[y,Hi],[m,Ut]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[m,de]],[/(aeobc)\b/i],[v,[y,ot],[m,de]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[m,R]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[m,k]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,R]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[T,[_,Ce+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[_,T],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[T,[_,"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],[_,T],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[T,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,T],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[_,[T,N,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[T,N,W],[_,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[T,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,ji],[T,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[T,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,T],[/\(bb(10);/i],[T,[_,Jt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[T,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[T,[_,be+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[T,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[T,[_,"watchOS"]],[/crkey\/([\d\.]+)/i],[T,[_,pe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,Wi],T],[/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],[_,T],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],T],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,T]]},St=function(z,ft){if(typeof z===f&&(ft=z,z=n),!(this instanceof St))return new St(z,ft).getResult();var X=typeof r!==u&&r.navigator?r.navigator:n,ie=z||(X&&X.userAgent?X.userAgent:s),$e=X&&X.userAgentData?X.userAgentData:n,Me=ft?Pe(te,ft):te,re=X&&X.userAgent==ie;return this.getBrowser=function(){var J={};return J[_]=n,J[T]=n,I.call(J,ie,Me.browser),J[h]=l(J[T]),re&&X&&X.brave&&typeof X.brave.isBrave==c&&(J[_]="Brave"),J},this.getCPU=function(){var J={};return J[O]=n,I.call(J,ie,Me.cpu),J},this.getDevice=function(){var J={};return J[y]=n,J[v]=n,J[m]=n,I.call(J,ie,Me.device),re&&!J[m]&&$e&&$e.mobile&&(J[m]=R),re&&J[v]=="Macintosh"&&X&&typeof X.standalone!==u&&X.maxTouchPoints&&X.maxTouchPoints>2&&(J[v]="iPad",J[m]=k),J},this.getEngine=function(){var J={};return J[_]=n,J[T]=n,I.call(J,ie,Me.engine),J},this.getOS=function(){var J={};return J[_]=n,J[T]=n,I.call(J,ie,Me.os),re&&!J[_]&&$e&&$e.platform&&$e.platform!="Unknown"&&(J[_]=$e.platform.replace(/chrome os/i,Wi).replace(/macos/i,ji)),J},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(J){return ie=typeof J===g&&J.length>j?p(J,j):J,this},this.setUA(ie),this};St.VERSION=i,St.BROWSER=$r([_,T,h]),St.CPU=$r([O]),St.DEVICE=$r([v,y,m,H,R,V,k,Ut,de]),St.ENGINE=St.OS=$r([_,T]),typeof t!==u?(typeof e!==u&&e.exports&&(t=e.exports=St),t.UAParser=St):typeof define===c&&define.amd?define(function(){return St}):typeof r!==u&&(r.UAParser=St);var Ct=typeof r!==u&&(r.jQuery||r.Zepto);if(Ct&&!Ct.ua){var le=new St;Ct.ua=le.getResult(),Ct.ua.get=function(){return le.getUA()},Ct.ua.set=function(z){le.setUA(z);var ft=le.getResult();for(var X in ft)Ct.ua[X]=ft[X]}}})(typeof window=="object"?window:t)}),kp=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 m=typeof Gi=="function"&&Gi;if(!_&&m)return m(v,!0);if(g)return g(v,!0);var y=new Error("Cannot find module '"+v+"'");throw y.code="MODULE_NOT_FOUND",y}var T=c[v]={exports:{}};o[v][0].call(T.exports,function(O){var H=o[v][1][O];return f(H||O)},T,T.exports,s,o,c,u)}return c[v].exports}for(var g=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,g;if(f){var h=0,v=new f(O),_=u.document.createTextNode("");v.observe(_,{characterData:!0}),g=function(){_.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var m=new u.MessageChannel;m.port1.onmessage=O,g=function(){m.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?g=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)}:g=function(){setTimeout(O,0)};var y,T=[];function O(){y=!0;for(var R,k,V=T.length;V;){for(k=T,T=[],R=-1;++R<V;)k[R]();V=T.length}y=!1}o.exports=H;function H(R){T.push(R)===1&&!y&&g()}}).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 g={},h=["REJECTED"],v=["FULFILLED"],_=["PENDING"];o.exports=m;function m(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)}m.prototype.catch=function(j){return this.then(null,j)},m.prototype.then=function(j,ot){if(typeof j!="function"&&this.state===v||typeof ot!="function"&&this.state===h)return this;var Y=new this.constructor(f);if(this.state!==_){var st=this.state===v?j:ot;T(Y,st,this.outcome)}else this.queue.push(new y(Y,j,ot));return Y};function y(j,ot,Y){this.promise=j,typeof ot=="function"&&(this.onFulfilled=ot,this.callFulfilled=this.otherCallFulfilled),typeof Y=="function"&&(this.onRejected=Y,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(j){g.resolve(this.promise,j)},y.prototype.otherCallFulfilled=function(j){T(this.promise,this.onFulfilled,j)},y.prototype.callRejected=function(j){g.reject(this.promise,j)},y.prototype.otherCallRejected=function(j){T(this.promise,this.onRejected,j)};function T(j,ot,Y){u(function(){var st;try{st=ot(Y)}catch(Jt){return g.reject(j,Jt)}st===j?g.reject(j,new TypeError("Cannot resolve promise with itself")):g.resolve(j,st)})}g.resolve=function(j,ot){var Y=R(O,ot);if(Y.status==="error")return g.reject(j,Y.value);var st=Y.value;if(st)H(j,st);else{j.state=v,j.outcome=ot;for(var Jt=-1,me=j.queue.length;++Jt<me;)j.queue[Jt].callFulfilled(ot)}return j},g.reject=function(j,ot){j.state=h,j.outcome=ot;for(var Y=-1,st=j.queue.length;++Y<st;)j.queue[Y].callRejected(ot);return j};function O(j){var ot=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof ot=="function")return function(){ot.apply(j,arguments)}}function H(j,ot){var Y=!1;function st(Ce){Y||(Y=!0,g.reject(j,Ce))}function Jt(Ce){Y||(Y=!0,g.resolve(j,Ce))}function me(){ot(Jt,st)}var pe=R(me);pe.status==="error"&&st(pe.value)}function R(j,ot){var Y={};try{Y.value=j(ot),Y.status="success"}catch(st){Y.status="error",Y.value=st}return Y}m.resolve=k;function k(j){return j instanceof this?j:g.resolve(new this(f),j)}m.reject=V;function V(j){var ot=new this(f);return g.reject(ot,j)}m.all=Ut;function Ut(j){var ot=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,st=!1;if(!Y)return this.resolve([]);for(var Jt=new Array(Y),me=0,pe=-1,Ce=new this(f);++pe<Y;)be(j[pe],pe);return Ce;function be(Bt,Te){ot.resolve(Bt).then(pt,function(Q){st||(st=!0,g.reject(Ce,Q))});function pt(Q){Jt[Te]=Q,++me===Y&&!st&&(st=!0,g.resolve(Ce,Jt))}}}m.race=de;function de(j){var ot=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,st=!1;if(!Y)return this.resolve([]);for(var Jt=-1,me=new this(f);++Jt<Y;)pe(j[Jt]);return me;function pe(Ce){ot.resolve(Ce).then(function(be){st||(st=!0,g.resolve(me,be))},function(be){st||(st=!0,g.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 g(){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=g();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,C=new S,x=0;x<d.length;x+=1)C.append(d[x]);return C.getBlob(E.type)}}typeof Promise>"u"&&s(3);var m=Promise;function y(d,E){E&&d.then(function(S){E(null,S)},function(S){E(S)})}function T(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={},Ut=Object.prototype.toString,de="readonly",j="readwrite";function ot(d){for(var E=d.length,S=new ArrayBuffer(E),C=new Uint8Array(S),x=0;x<E;x++)C[x]=d.charCodeAt(x);return S}function Y(d){return new m(function(E){var S=d.transaction(R,j),C=_([""]);S.objectStore(R).put(C,"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"?m.resolve(k):Y(d).then(function(E){return k=E,k})}function Jt(d){var E=V[d.name],S={};S.promise=new m(function(C,x){S.resolve=C,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],C=S.deferredOperations.pop();if(C)return C.reject(E),C.promise}function Ce(d,E){return new m(function(S,C){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(),C(D.error)},D.onsuccess=function(){var P=D.result;P.onversionchange=function(U){U.target.close()},S(P),me(d)}})}function be(d){return Ce(d,!1)}function Bt(d){return Ce(d,!0)}function Te(d,E){if(!d.db)return!0;var S=!d.db.objectStoreNames.contains(d.storeName),C=d.version<d.db.version,x=d.version>d.db.version;if(C&&(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 pt(d){return new m(function(E,S){var C=new FileReader;C.onerror=S,C.onloadend=function(x){var D=btoa(x.target.result||"");E({__local_forage_encoded_blob:!0,data:D,type:d.type})},C.readAsBinaryString(d)})}function Q(d){var E=ot(atob(d.data));return _([E],{type:d.type})}function we(d){return d&&d.__local_forage_encoded_blob}function ar(d){var E=this,S=E._initReady().then(function(){var C=V[E._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return T(S,d,d),S}function jr(d){Jt(d);for(var E=V[d.name],S=E.forages,C=0;C<S.length;C++){var x=S[C];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return d.db=null,be(d).then(function(D){return d.db=D,Te(d)?Bt(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,C){C===void 0&&(C=1);try{var x=d.db.transaction(d.storeName,E);S(null,x)}catch(D){if(C>0&&(!d.db||D.name==="InvalidStateError"||D.name==="NotFoundError"))return m.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),Bt(d)}).then(function(){return jr(d).then(function(){ke(d,E,S,C-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 C in d)S[C]=d[C];var x=V[S.name];x||(x=en(),V[S.name]=x),x.forages.push(E),E._initReady||(E._initReady=E.ready,E.ready=ar);var D=[];function P(){return m.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 m.all(D).then(function(){return S.db=x.db,be(S)}).then(function(B){return S.db=B,Te(S,E._defaultConfig.version)?Bt(S):B}).then(function(B){S.db=x.db=B,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 C=new m(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 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(C,E),C}function Hi(d,E){var S=this,C=new m(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(),B=1;$.onsuccess=function(){var G=$.result;if(G){var mt=G.value;we(mt)&&(mt=Q(mt));var he=d(mt,G.key,B++);he!==void 0?x(he):G.continue()}else x()},$.onerror=function(){D($.error)}}catch(G){D(G)}})}).catch(D)});return y(C,E),C}function Wi(d,E,S){var C=this;d=O(d);var x=new m(function(D,P){var U;C.ready().then(function(){return U=C._dbInfo,Ut.call(E)==="[object Blob]"?st(U.db).then(function(F){return F?E:pt(E)}):E}).then(function(F){ke(C._dbInfo,j,function($,B){if($)return P($);try{var G=B.objectStore(C._dbInfo.storeName);F===null&&(F=void 0);var mt=G.put(F,d);B.oncomplete=function(){F===void 0&&(F=null),D(F)},B.onabort=B.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 C=new m(function(x,D){S.ready().then(function(){ke(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(C,E),C}function Mn(d){var E=this,S=new m(function(C,x){E.ready().then(function(){ke(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(){C()},P.onabort=P.onerror=function(){var $=F.error?F.error:F.transaction.error;x($)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function Pe(d){var E=this,S=new m(function(C,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(){C(F.result)},F.onerror=function(){x(F.error)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function $r(d,E){var S=this,C=new m(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,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(C,E),C}function rs(d){var E=this,S=new m(function(C,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 B=F.result;if(!B){C($);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 C=this,x;if(!d.name)x=m.reject("Invalid arguments");else{var D=d.name===S.name&&C._dbInfo.db,P=D?m.resolve(C._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;Jt(d);var $=V[d.name],B=$.forages;U.close();for(var G=0;G<B.length;G++){var mt=B[G];mt._dbInfo.db=null,mt._dbInfo.version=F}var he=new m(function(oe,Ie){var ye=h.open(d.name,F);ye.onerror=function(Ve){var Wu=ye.result;Wu.close(),Ie(Ve)},ye.onupgradeneeded=function(){var Ve=ye.result;Ve.deleteObjectStore(d.storeName)},ye.onsuccess=function(){var Ve=ye.result;Ve.close(),oe(Ve)}});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(pe(d,oe)||m.resolve()).catch(function(){}),oe})}}):x=P.then(function(U){Jt(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 mt=new m(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)||m.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:Pe,key:$r,keys:rs,dropInstance:a};function p(){return typeof openDatabase=="function"}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="~~local_forage_type~",L=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",te=W.length,St="arbf",Ct="blob",le="si08",z="ui08",ft="uic8",X="si16",ie="si32",$e="ur16",Me="ui32",re="fl32",J="fl64",He=te+St.length,As=Object.prototype.toString;function Yo(d){var E=d.length*.75,S=d.length,C,x=0,D,P,U,F;d[d.length-1]==="="&&(E--,d[d.length-2]==="="&&E--);var $=new ArrayBuffer(E),B=new Uint8Array($);for(C=0;C<S;C+=4)D=I.indexOf(d[C]),P=I.indexOf(d[C+1]),U=I.indexOf(d[C+2]),F=I.indexOf(d[C+3]),B[x++]=D<<2|P>>4,B[x++]=(P&15)<<4|U>>2,B[x++]=(U&3)<<6|F&63;return $}function Ec(d){var E=new Uint8Array(d),S="",C;for(C=0;C<E.length;C+=3)S+=I[E[C]>>2],S+=I[(E[C]&3)<<4|E[C+1]>>4],S+=I[(E[C+1]&15)<<2|E[C+2]>>6],S+=I[E[C+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=As.call(d)),d&&(S==="[object ArrayBuffer]"||d.buffer&&As.call(d.buffer)==="[object ArrayBuffer]")){var C,x=W;d instanceof ArrayBuffer?(C=d,x+=St):(C=d.buffer,S==="[object Int8Array]"?x+=le:S==="[object Uint8Array]"?x+=z:S==="[object Uint8ClampedArray]"?x+=ft:S==="[object Int16Array]"?x+=X:S==="[object Uint16Array]"?x+=$e:S==="[object Int32Array]"?x+=ie:S==="[object Uint32Array]"?x+=Me:S==="[object Float32Array]"?x+=re:S==="[object Float64Array]"?x+=J:E(new Error("Failed to get type for BinaryArray"))),E(x+Ec(C))}else if(S==="[object Blob]"){var D=new FileReader;D.onload=function(){var P=N+d.type+"~"+Ec(this.result);E(W+Ct+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(He),S=d.substring(te,He),C;if(S===Ct&&L.test(E)){var x=E.match(L);C=x[1],E=E.substring(x[0].length)}var D=Yo(E);switch(S){case St:return D;case Ct:return _([D],{type:C});case le:return new Int8Array(D);case z:return new Uint8Array(D);case ft:return new Uint8ClampedArray(D);case X:return new Int16Array(D);case $e:return new Uint16Array(D);case ie:return new Int32Array(D);case Me:return new Uint32Array(D);case re:return new Float32Array(D);case J:return new Float64Array(D);default:throw new Error("Unkown type: "+S)}}var Sc={serialize:$d,deserialize:Fd,stringToBuffer:Yo,bufferToString:Ec};function th(d,E,S,C){d.executeSql("CREATE TABLE IF NOT EXISTS "+E.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],S,C)}function Hd(d){var E=this,S={db:null};if(d)for(var C in d)S[C]=typeof d[C]!="string"?d[C].toString():d[C];var x=new m(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){th(U,S,function(){E._dbInfo=S,D()},function(F,$){P($)})},P)});return S.serializer=Sc,x}function Fn(d,E,S,C,x,D){d.executeSql(S,C,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):th(F,E,function(){F.executeSql(S,C,x,D)},D)},D):D(P,U)},D)}function Vd(d,E){var S=this;d=O(d);var C=new m(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(C,E),C}function qd(d,E){var S=this,C=new m(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,mt=0;mt<G;mt++){var he=B.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(C,E),C}function eh(d,E,S,C){var x=this;d=O(d);var D=new m(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(mt){Fn(mt,$,"INSERT OR REPLACE INTO "+$.storeName+" (key, value) VALUES (?, ?)",[d,B],function(){P(F)},function(he,oe){U(oe)})},function(mt){if(mt.code===mt.QUOTA_ERR){if(C>0){P(eh.apply(x,[d,F,S,C-1]));return}U(mt)}})})}).catch(U)});return y(D,S),D}function Wd(d,E,S){return eh.apply(this,[d,E,S,1])}function zd(d,E){var S=this;d=O(d);var C=new m(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(C,E),C}function Kd(d){var E=this,S=new m(function(C,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"DELETE FROM "+D.storeName,[],function(){C()},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Gd(d){var E=this,S=new m(function(C,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;C($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Yd(d,E){var S=this,C=new m(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(C,E),C}function Xd(d){var E=this,S=new m(function(C,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);C($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Jd(d){return new m(function(E,S){d.transaction(function(C){C.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(C){S(C)})})}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 C=this,x;return d.name?x=new m(function(D){var P;d.name===S.name?P=C._dbInfo.db:P=openDatabase(d.name,"","",0),d.storeName?D({db:P,storeNames:[d.storeName]}):D(Jd(P))}).then(function(D){return new m(function(P,U){D.db.transaction(function(F){function $(he){return new m(function(oe,Ie){F.executeSql("DROP TABLE IF EXISTS "+he,[],function(){oe()},function(ye,Ve){Ie(Ve)})})}for(var B=[],G=0,mt=D.storeNames.length;G<mt;G++)B.push($(D.storeNames[G]));m.all(B).then(function(){P()}).catch(function(he){U(he)})},function(F){U(F)})})}):x=m.reject("Invalid arguments"),y(x,E),x}var Qd={_driver:"webSQLStorage",_initStorage:Hd,_support:p(),iterate:qd,getItem:Vd,setItem:Wd,removeItem:zd,clear:Kd,length:Gd,key:Yd,keys:Xd,dropInstance:Zd};function kg(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function rh(d,E){var S=d.name+"/";return d.storeName!==E.storeName&&(S+=d.storeName+"/"),S}function Om(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function Vm(){return!Om()||localStorage.length>0}function zm(d){var E=this,S={};if(d)for(var C in d)S[C]=d[C];return S.keyPrefix=rh(d,E._defaultConfig),Vm()?(E._dbInfo=S,S.serializer=Sc,m.resolve()):m.reject()}function Gm(d){var E=this,S=E.ready().then(function(){for(var C=E._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var D=localStorage.key(x);D.indexOf(C)===0&&localStorage.removeItem(D)}});return y(S,d),S}function kv(d,E){var S=this;d=O(d);var C=S.ready().then(function(){var x=S._dbInfo,D=localStorage.getItem(x.keyPrefix+d);return D&&(D=x.serializer.deserialize(D)),D});return y(C,E),C}function Pv(d,E){var S=this,C=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(C,E),C}function Lv(d,E){var S=this,C=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(C,E),C}function Mv(d){var E=this,S=E.ready().then(function(){for(var C=E._dbInfo,x=localStorage.length,D=[],P=0;P<x;P++){var U=localStorage.key(P);U.indexOf(C.keyPrefix)===0&&D.push(U.substring(C.keyPrefix.length))}return D});return y(S,d),S}function Uv(d){var E=this,S=E.keys().then(function(C){return C.length});return y(S,d),S}function jv(d,E){var S=this;d=O(d);var C=S.ready().then(function(){var x=S._dbInfo;localStorage.removeItem(x.keyPrefix+d)});return y(C,E),C}function Bv(d,E,S){var C=this;d=O(d);var x=C.ready().then(function(){E===void 0&&(E=null);var D=E;return new m(function(P,U){var F=C._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 $v(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 C=this,x;return d.name?x=new m(function(D){d.storeName?D(rh(d,C._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=m.reject("Invalid arguments"),y(x,E),x}var Fv={_driver:"localStorageWrapper",_initStorage:zm,_support:kg(),iterate:Pv,getItem:kv,setItem:Bv,removeItem:jv,clear:Gm,length:Uv,key:Lv,keys:Mv,dropInstance:$v},Hv=function(d,E){return d===E||typeof d=="number"&&typeof E=="number"&&isNaN(d)&&isNaN(E)},Wv=function(d,E){for(var S=d.length,C=0;C<S;){if(Hv(d[C],E))return!0;C++}return!1},nh=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},$a={},fh={},to={INDEXEDDB:l,WEBSQL:Qd,LOCALSTORAGE:Fv},Gv=[to.INDEXEDDB._driver,to.WEBSQL._driver,to.LOCALSTORAGE._driver],bc=["dropInstance"],Yc=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(bc),Oy={description:"",driver:Gv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Py(d,E){d[E]=function(){var S=arguments;return d.ready().then(function(){return d[E].apply(d,S)})}}function qu(){for(var d=1;d<arguments.length;d++){var E=arguments[d];if(E)for(var S in E)E.hasOwnProperty(S)&&(nh(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 C=to[S],x=C._driver;this[S]=x,$a[x]||this.defineDriver(C)}this._defaultConfig=qu({},Oy),this._config=qu({},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,C){var x=new m(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 $=Yc.concat("_initStorage"),B=0,G=$.length;B<G;B++){var mt=$[B],he=!Wv(bc,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"),Yh=m.reject(nb);return y(Yh,arguments[arguments.length-1]),Yh}},Ve=0,Wu=bc.length;Ve<Wu;Ve++){var zu=bc[Ve];E[zu]||(E[zu]=ye(zu))}};oe();var Ie=function(ye){$a[U]&&console.info("Redefining LocalForage driver: "+U),$a[U]=E,fh[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 T(x,S,C),x},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(E,S,C){var x=$a[E]?m.resolve($a[E]):m.reject(new Error("Driver not found."));return T(x,S,C),x},d.prototype.getSerializer=function(E){var S=m.resolve(Sc);return T(S,E),S},d.prototype.ready=function(E){var S=this,C=S._driverSet.then(function(){return S._ready===null&&(S._ready=S._initDriver()),S._ready});return T(C,E,E),C},d.prototype.setDriver=function(E,S,C){var x=this;nh(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 mt(){for(;G<B.length;){var he=B[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=m.reject(oe),x._driverSet}return mt()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.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=m.reject(B),x._driverSet}),T(this._driverSet,S,C),this._driverSet},d.prototype.supports=function(E){return!!fh[E]},d.prototype._extend=function(E){qu(this,E)},d.prototype._getSupportedDrivers=function(E){for(var S=[],C=0,x=E.length;C<x;C++){var D=E[C];this.supports(D)&&S.push(D)}return S},d.prototype._wrapLibraryMethodsWithReady=function(){for(var E=0,S=Yc.length;E<S;E++)Py(this,Yc[E])},d.prototype.createInstance=function(E){return new d(E)},d}(),eb=new tb;o.exports=eb},{3:3}]},{},[4])(4)})}),vl=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}),fd=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 g=o.retries,h=o.retryDelay,v=o.retryOn;if(f&&f.retries!==void 0)if(n(f.retries))g=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(_,m){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?T(O,null,R):_(R)}).catch(m)}catch(k){m(k)}else O<g?T(O,null,R):_(R)}).catch(function(R){if(typeof v=="function")try{Promise.resolve(v(O,R,null)).then(function(k){k?T(O,R,null):m(R)}).catch(function(k){m(k)})}catch(k){m(k)}else O<g?T(O,R,null):m(R)})};function T(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})}),Gr={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production"},Dt=Xt(tn()),rp="9.3.5",A=class Ku{static SDK_VERSION=rp;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=Ku.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");Ku.SDK_VERSION_CODE=parseInt(e,10)}},w=class{static log(...t){Dt.default.info(...t)}static debug(...t){Dt.default.debug(...t)}static error(...t){Dt.default.error(...t)}static warn(...t){Dt.default.warn(...t)}static info(...t){Dt.default.info(...t)}static trace(...t){Dt.default.trace(...t)}static configure(t=A.LOG_PREFIX){Dt.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?Dt.default.setLevel(Dt.default[localStorage.cooeeLogLevel]):Dt.default.setLevel(Gr.debug?Dt.default.TRACE:Dt.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let t=`
1
+ "use strict";(()=>{var ih=Object.create,wc=Object.defineProperty,oh=Object.defineProperties,sh=Object.getOwnPropertyDescriptor,ah=Object.getOwnPropertyDescriptors,ch=Object.getOwnPropertyNames,Qu=Object.getOwnPropertySymbols,lh=Object.getPrototypeOf,ep=Object.prototype.hasOwnProperty,uh=Object.prototype.propertyIsEnumerable,Zu=(t,e,r)=>e in t?wc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b=(t,e)=>{for(var r in e||={})ep.call(e,r)&&Zu(t,r,e[r]);if(Qu)for(var r of Qu(e))uh.call(e,r)&&Zu(t,r,e[r]);return t},Z=(t,e)=>oh(t,ah(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),ph=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ch(e))!ep.call(t,i)&&i!==r&&wc(t,i,{get:()=>e[i],enumerable:!(n=sh(e,i))||n.enumerable});return t},Xt=(t,e,r)=>(r=t!=null?ih(lh(t)):{},ph(e||!t||!t.__esModule?wc(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],_,m;for(m=1;m<h.length;m++)for(_ in h[m])!(_ in v)&&h[m].hasOwnProperty(_)&&(v[_]=h[m][_]);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 g=new f({filterLevel:n.OFF});(function(){var h=n;h.enabledFor=o(g,g.enabledFor),h.trace=o(g,g.trace),h.debug=o(g,g.debug),h.time=o(g,g.time),h.timeEnd=o(g,g.timeEnd),h.info=o(g,g.info),h.warn=o(g,g.warn),h.error=o(g,g.error),h.log=h.info})(),n.setHandler=function(h){i=h},n.setLevel=function(h){g.setLevel(h);for(var v in s)s.hasOwnProperty(v)&&s[v].setLevel(h)},n.getLevel=function(){return g.getLevel()},n.get=function(h){return s[h]||(s[h]=new f(c({name:h},g.context)))},n.createDefaultHandler=function(h){h=h||{},h.formatter=h.formatter||function(m,y){y.name&&m.unshift("["+y.name+"]")};var v={},_=function(m,y){Function.prototype.apply.call(m,console,y)};return typeof console>"u"?function(){}:function(m,y){m=Array.prototype.slice.call(m);var T=console.log,O;y.level===n.TIME?(O=(y.name?"["+y.name+"] ":"")+m[0],m[1]==="start"?console.time?console.time(O):v[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):_(T,[O+": "+(new Date().getTime()-v[O])+"ms"])):(y.level===n.WARN&&console.warn?T=console.warn:y.level===n.ERROR&&console.error?T=console.error:y.level===n.INFO&&console.info?T=console.info:y.level===n.DEBUG&&console.debug?T=console.debug:y.level===n.TRACE&&console.trace&&(T=console.trace),h.formatter(m,y),_(T,m))}},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)}),Bp=Vi((t,e)=>{"use strict";(function(r,n){"use strict";var i="1.0.40",s="",o="?",c="function",u="undefined",f="object",g="string",h="major",v="model",_="name",m="type",y="vendor",T="version",O="architecture",H="console",R="mobile",k="tablet",V="smarttv",Ut="wearable",de="embedded",j=500,ot="Amazon",Y="Apple",st="ASUS",Jt="BlackBerry",me="Browser",pe="Chrome",Ce="Edge",be="Firefox",Bt="Google",Te="Huawei",pt="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",Pe=function(z,ft){var X={};for(var ie in z)ft[ie]&&ft[ie].length%2===0?X[ie]=ft[ie].concat(z[ie]):X[ie]=z[ie];return X},Wr=function(z){for(var ft={},X=0;X<z.length;X++)ft[z[X].toUpperCase()]=z[X];return ft},rs=function(z,ft){return typeof z===g?a(ft).indexOf(a(z))!==-1:!1},a=function(z){return z.toLowerCase()},l=function(z){return typeof z===g?z.replace(/[^\d\.]/g,s).split(".")[0]:n},p=function(z,ft){if(typeof z===g)return z=z.replace(/^\s\s*/,s),typeof ft===u?z:z.substring(0,j)},I=function(z,ft){for(var X=0,ie,$e,Me,re,J,He;X<ft.length&&!J;){var As=ft[X],Yo=ft[X+1];for(ie=$e=0;ie<As.length&&!J&&As[ie];)if(J=As[ie++].exec(z),J)for(Me=0;Me<Yo.length;Me++)He=J[++$e],re=Yo[Me],typeof re===f&&re.length>0?re.length===2?typeof re[1]==c?this[re[0]]=re[1].call(this,He):this[re[0]]=re[1]:re.length===3?typeof re[1]===c&&!(re[1].exec&&re[1].test)?this[re[0]]=He?re[1].call(this,He,re[2]):n:this[re[0]]=He?He.replace(re[1],re[2]):n:re.length===4&&(this[re[0]]=He?re[3].call(this,He.replace(re[1],re[2])):n):this[re]=He||n;X+=2}},N=function(z,ft){for(var X in ft)if(typeof ft[X]===f&&ft[X].length>0){for(var ie=0;ie<ft[X].length;ie++)if(rs(ft[X][ie],z))return X===o?n:X}else if(rs(ft[X],z))return X===o?n:X;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],[T,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[T,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,T],[/opios[\/ ]+([\w\.]+)/i],[T,[_,cr+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[T,[_,cr+" GX"]],[/\bopr\/([\w\.]+)/i],[T,[_,cr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[T,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[T,[_,"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],[_,T],[/quark(?:pc)?\/([-\w\.]+)/i],[T,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[T,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[T,[_,"UC"+me]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[T,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[T,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[T,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[T,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[T,[_,"Smart Lenovo "+me]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+me],T],[/\bfocus\/([\w\.]+)/i],[T,[_,be+" Focus"]],[/\bopt\/([\w\.]+)/i],[T,[_,cr+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[T,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[T,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[T,[_,cr+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[T,[_,"MIUI"+Mn]],[/fxios\/([\w\.-]+)/i],[T,[_,be]],[/\bqihoobrowser\/?([\w\.]*)/i],[T,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],T],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Mn],T],[/samsungbrowser\/([\w\.]+)/i],[T,[_,jr+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[T,[_,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,"Sogou Mobile"],T],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,T],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[T,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Hi],T],[/(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],[_,T],[/\bgsa\/([\w\.]+) .*safari\//i],[T,[_,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[T,[_,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[_,pe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,pe+" WebView"],T],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[T,[_,"Android "+me]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,T],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[T,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[T,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[T,N,L]],[/(webkit|khtml)\/([\w\.]+)/i],[_,T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],T],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[_,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],[_,[T,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[T,/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],[m,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],[m,R]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[v,[y,Y],[m,R]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[v,[y,Y],[m,k]],[/(macintosh);/i],[v,[y,Y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[v,[y,ke],[m,R]],[/(?:honor)([-\w ]+)[;\)]/i],[v,[y,"Honor"],[m,R]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[v,[y,Te],[m,k]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[v,[y,Te],[m,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],[m,R]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[v,/_/g," "],[y,Hn],[m,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"],[m,R]],[/\b(opd2\d{3}a?) bui/i],[v,[y,"OPPO"],[m,k]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[v,[y,"Vivo"],[m,R]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[v,[y,"Realme"],[m,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],[m,R]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[v,[y,we],[m,k]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[v,[y,pt],[m,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[v,[y,pt],[m,R]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[v,[y,"Lenovo"],[m,k]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[v,/_/g," "],[y,"Nokia"],[m,R]],[/(pixel c)\b/i],[v,[y,Bt],[m,k]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[v,[y,Bt],[m,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],[m,R]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[v,"Xperia Tablet"],[y,en],[m,k]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[v,[y,"OnePlus"],[m,R]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[v,[y,ot],[m,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[v,/(.+)/g,"Fire Phone $1"],[y,ot],[m,R]],[/(playbook);[-\w\),; ]+(rim)/i],[v,y,[m,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[v,[y,Jt],[m,R]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[v,[y,st],[m,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[v,[y,st],[m,R]],[/(nexus 9)/i],[v,[y,"HTC"],[m,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[v,/_/g," "],[m,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"],[m,k]],[/(itel) ((\w+))/i],[[y,a],v,[m,N,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[v,[y,"Acer"],[m,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[v,[y,"Meizu"],[m,R]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[v,[y,"Ulefone"],[m,R]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[v,[y,"Energizer"],[m,R]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[v,[y,"Cat"],[m,R]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[v,[y,"Smartfren"],[m,R]],[/droid.+; (a(?:015|06[35]|142p?))/i],[v,[y,"Nothing"],[m,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,[m,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,[m,k]],[/(surface duo)/i],[v,[y,Q],[m,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[v,[y,"Fairphone"],[m,R]],[/(u304aa)/i],[v,[y,"AT&T"],[m,R]],[/\bsie-(\w*)/i],[v,[y,"Siemens"],[m,R]],[/\b(rct\w+) b/i],[v,[y,"RCA"],[m,k]],[/\b(venue[\d ]{2,7}) b/i],[v,[y,"Dell"],[m,k]],[/\b(q(?:mv|ta)\w+) b/i],[v,[y,"Verizon"],[m,k]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[v,[y,"Barnes & Noble"],[m,k]],[/\b(tm\d{3}\w+) b/i],[v,[y,"NuVision"],[m,k]],[/\b(k88) b/i],[v,[y,"ZTE"],[m,k]],[/\b(nx\d{3}j) b/i],[v,[y,"ZTE"],[m,R]],[/\b(gen\d{3}) b.+49h/i],[v,[y,"Swiss"],[m,R]],[/\b(zur\d{3}) b/i],[v,[y,"Swiss"],[m,k]],[/\b((zeki)?tb.*\b) b/i],[v,[y,"Zeki"],[m,k]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[y,"Dragon Touch"],v,[m,k]],[/\b(ns-?\w{0,9}) b/i],[v,[y,"Insignia"],[m,k]],[/\b((nxa|next)-?\w{0,9}) b/i],[v,[y,"NextBook"],[m,k]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[y,"Voice"],v,[m,R]],[/\b(lvtel\-)?(v1[12]) b/i],[[y,"LvTel"],v,[m,R]],[/\b(ph-1) /i],[v,[y,"Essential"],[m,R]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[v,[y,"Envizen"],[m,k]],[/\b(trio[-\w\. ]+) b/i],[v,[y,"MachSpeed"],[m,k]],[/\btu_(1491) b/i],[v,[y,"Rotor"],[m,k]],[/(shield[\w ]+) b/i],[v,[y,"Nvidia"],[m,k]],[/(sprint) (\w+)/i],[y,v,[m,R]],[/(kin\.[onetw]{3})/i],[[v,/\./g," "],[y,Q],[m,R]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[v,[y,kn],[m,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[v,[y,kn],[m,R]],[/smart-tv.+(samsung)/i],[y,[m,V]],[/hbbtv.+maple;(\d+)/i],[[v,/^/,"SmartTV"],[y,jr],[m,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,pt],[m,V]],[/(apple) ?tv/i],[y,[v,Y+" TV"],[m,V]],[/crkey/i],[[v,pe+"cast"],[y,Bt],[m,V]],[/droid.+aft(\w+)( bui|\))/i],[v,[y,ot],[m,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[v,[y,ke],[m,V]],[/(bravia[\w ]+)( bui|\))/i],[v,[y,en],[m,V]],[/(mitv-\w{5}) bui/i],[v,[y,Hn],[m,V]],[/Hbbtv.*(technisat) (.*);/i],[y,v,[m,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,p],[v,p],[m,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,V]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[y,v,[m,H]],[/droid.+; (shield) bui/i],[v,[y,"Nvidia"],[m,H]],[/(playstation [345portablevi]+)/i],[v,[y,en],[m,H]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[v,[y,Q],[m,H]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[v,[y,jr],[m,Ut]],[/((pebble))app/i],[y,v,[m,Ut]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[v,[y,Y],[m,Ut]],[/droid.+; (glass) \d/i],[v,[y,Bt],[m,Ut]],[/droid.+; (wt63?0{2,3})\)/i],[v,[y,kn],[m,Ut]],[/droid.+; (glass) \d/i],[v,[y,Bt],[m,Ut]],[/(pico) (4|neo3(?: link|pro)?)/i],[y,v,[m,Ut]],[/; (quest( \d| pro)?)/i],[v,[y,Hi],[m,Ut]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[m,de]],[/(aeobc)\b/i],[v,[y,ot],[m,de]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[v,[m,R]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[v,[m,k]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,R]],[/(android[-\w\. ]{0,9});.+buil/i],[v,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[T,[_,Ce+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[_,T],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[T,[_,"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],[_,T],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[T,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,T],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[_,[T,N,W]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[T,N,W],[_,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[T,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,ji],[T,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[T,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,T],[/\(bb(10);/i],[T,[_,Jt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[T,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[T,[_,be+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[T,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[T,[_,"watchOS"]],[/crkey\/([\d\.]+)/i],[T,[_,pe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,Wi],T],[/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],[_,T],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],T],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,T]]},bt=function(z,ft){if(typeof z===f&&(ft=z,z=n),!(this instanceof bt))return new bt(z,ft).getResult();var X=typeof r!==u&&r.navigator?r.navigator:n,ie=z||(X&&X.userAgent?X.userAgent:s),$e=X&&X.userAgentData?X.userAgentData:n,Me=ft?Pe(te,ft):te,re=X&&X.userAgent==ie;return this.getBrowser=function(){var J={};return J[_]=n,J[T]=n,I.call(J,ie,Me.browser),J[h]=l(J[T]),re&&X&&X.brave&&typeof X.brave.isBrave==c&&(J[_]="Brave"),J},this.getCPU=function(){var J={};return J[O]=n,I.call(J,ie,Me.cpu),J},this.getDevice=function(){var J={};return J[y]=n,J[v]=n,J[m]=n,I.call(J,ie,Me.device),re&&!J[m]&&$e&&$e.mobile&&(J[m]=R),re&&J[v]=="Macintosh"&&X&&typeof X.standalone!==u&&X.maxTouchPoints&&X.maxTouchPoints>2&&(J[v]="iPad",J[m]=k),J},this.getEngine=function(){var J={};return J[_]=n,J[T]=n,I.call(J,ie,Me.engine),J},this.getOS=function(){var J={};return J[_]=n,J[T]=n,I.call(J,ie,Me.os),re&&!J[_]&&$e&&$e.platform&&$e.platform!="Unknown"&&(J[_]=$e.platform.replace(/chrome os/i,Wi).replace(/macos/i,ji)),J},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(J){return ie=typeof J===g&&J.length>j?p(J,j):J,this},this.setUA(ie),this};bt.VERSION=i,bt.BROWSER=Wr([_,T,h]),bt.CPU=Wr([O]),bt.DEVICE=Wr([v,y,m,H,R,V,k,Ut,de]),bt.ENGINE=bt.OS=Wr([_,T]),typeof t!==u?(typeof e!==u&&e.exports&&(t=e.exports=bt),t.UAParser=bt):typeof define===c&&define.amd?define(function(){return bt}):typeof r!==u&&(r.UAParser=bt);var Ct=typeof r!==u&&(r.jQuery||r.Zepto);if(Ct&&!Ct.ua){var le=new bt;Ct.ua=le.getResult(),Ct.ua.get=function(){return le.getUA()},Ct.ua.set=function(z){le.setUA(z);var ft=le.getResult();for(var X in ft)Ct.ua[X]=ft[X]}}})(typeof window=="object"?window:t)}),kp=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 m=typeof Gi=="function"&&Gi;if(!_&&m)return m(v,!0);if(g)return g(v,!0);var y=new Error("Cannot find module '"+v+"'");throw y.code="MODULE_NOT_FOUND",y}var T=c[v]={exports:{}};o[v][0].call(T.exports,function(O){var H=o[v][1][O];return f(H||O)},T,T.exports,s,o,c,u)}return c[v].exports}for(var g=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,g;if(f){var h=0,v=new f(O),_=u.document.createTextNode("");v.observe(_,{characterData:!0}),g=function(){_.data=h=++h%2}}else if(!u.setImmediate&&typeof u.MessageChannel<"u"){var m=new u.MessageChannel;m.port1.onmessage=O,g=function(){m.port2.postMessage(0)}}else"document"in u&&"onreadystatechange"in u.document.createElement("script")?g=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)}:g=function(){setTimeout(O,0)};var y,T=[];function O(){y=!0;for(var R,k,V=T.length;V;){for(k=T,T=[],R=-1;++R<V;)k[R]();V=T.length}y=!1}o.exports=H;function H(R){T.push(R)===1&&!y&&g()}}).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 g={},h=["REJECTED"],v=["FULFILLED"],_=["PENDING"];o.exports=m;function m(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)}m.prototype.catch=function(j){return this.then(null,j)},m.prototype.then=function(j,ot){if(typeof j!="function"&&this.state===v||typeof ot!="function"&&this.state===h)return this;var Y=new this.constructor(f);if(this.state!==_){var st=this.state===v?j:ot;T(Y,st,this.outcome)}else this.queue.push(new y(Y,j,ot));return Y};function y(j,ot,Y){this.promise=j,typeof ot=="function"&&(this.onFulfilled=ot,this.callFulfilled=this.otherCallFulfilled),typeof Y=="function"&&(this.onRejected=Y,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(j){g.resolve(this.promise,j)},y.prototype.otherCallFulfilled=function(j){T(this.promise,this.onFulfilled,j)},y.prototype.callRejected=function(j){g.reject(this.promise,j)},y.prototype.otherCallRejected=function(j){T(this.promise,this.onRejected,j)};function T(j,ot,Y){u(function(){var st;try{st=ot(Y)}catch(Jt){return g.reject(j,Jt)}st===j?g.reject(j,new TypeError("Cannot resolve promise with itself")):g.resolve(j,st)})}g.resolve=function(j,ot){var Y=R(O,ot);if(Y.status==="error")return g.reject(j,Y.value);var st=Y.value;if(st)H(j,st);else{j.state=v,j.outcome=ot;for(var Jt=-1,me=j.queue.length;++Jt<me;)j.queue[Jt].callFulfilled(ot)}return j},g.reject=function(j,ot){j.state=h,j.outcome=ot;for(var Y=-1,st=j.queue.length;++Y<st;)j.queue[Y].callRejected(ot);return j};function O(j){var ot=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof ot=="function")return function(){ot.apply(j,arguments)}}function H(j,ot){var Y=!1;function st(Ce){Y||(Y=!0,g.reject(j,Ce))}function Jt(Ce){Y||(Y=!0,g.resolve(j,Ce))}function me(){ot(Jt,st)}var pe=R(me);pe.status==="error"&&st(pe.value)}function R(j,ot){var Y={};try{Y.value=j(ot),Y.status="success"}catch(st){Y.status="error",Y.value=st}return Y}m.resolve=k;function k(j){return j instanceof this?j:g.resolve(new this(f),j)}m.reject=V;function V(j){var ot=new this(f);return g.reject(ot,j)}m.all=Ut;function Ut(j){var ot=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,st=!1;if(!Y)return this.resolve([]);for(var Jt=new Array(Y),me=0,pe=-1,Ce=new this(f);++pe<Y;)be(j[pe],pe);return Ce;function be(Bt,Te){ot.resolve(Bt).then(pt,function(Q){st||(st=!0,g.reject(Ce,Q))});function pt(Q){Jt[Te]=Q,++me===Y&&!st&&(st=!0,g.resolve(Ce,Jt))}}}m.race=de;function de(j){var ot=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=j.length,st=!1;if(!Y)return this.resolve([]);for(var Jt=-1,me=new this(f);++Jt<Y;)pe(j[Jt]);return me;function pe(Ce){ot.resolve(Ce).then(function(be){st||(st=!0,g.resolve(me,be))},function(be){st||(st=!0,g.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 g(){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=g();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,C=new S,x=0;x<d.length;x+=1)C.append(d[x]);return C.getBlob(E.type)}}typeof Promise>"u"&&s(3);var m=Promise;function y(d,E){E&&d.then(function(S){E(null,S)},function(S){E(S)})}function T(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={},Ut=Object.prototype.toString,de="readonly",j="readwrite";function ot(d){for(var E=d.length,S=new ArrayBuffer(E),C=new Uint8Array(S),x=0;x<E;x++)C[x]=d.charCodeAt(x);return S}function Y(d){return new m(function(E){var S=d.transaction(R,j),C=_([""]);S.objectStore(R).put(C,"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"?m.resolve(k):Y(d).then(function(E){return k=E,k})}function Jt(d){var E=V[d.name],S={};S.promise=new m(function(C,x){S.resolve=C,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],C=S.deferredOperations.pop();if(C)return C.reject(E),C.promise}function Ce(d,E){return new m(function(S,C){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(),C(D.error)},D.onsuccess=function(){var P=D.result;P.onversionchange=function(U){U.target.close()},S(P),me(d)}})}function be(d){return Ce(d,!1)}function Bt(d){return Ce(d,!0)}function Te(d,E){if(!d.db)return!0;var S=!d.db.objectStoreNames.contains(d.storeName),C=d.version<d.db.version,x=d.version>d.db.version;if(C&&(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 pt(d){return new m(function(E,S){var C=new FileReader;C.onerror=S,C.onloadend=function(x){var D=btoa(x.target.result||"");E({__local_forage_encoded_blob:!0,data:D,type:d.type})},C.readAsBinaryString(d)})}function Q(d){var E=ot(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 C=V[E._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return T(S,d,d),S}function jr(d){Jt(d);for(var E=V[d.name],S=E.forages,C=0;C<S.length;C++){var x=S[C];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return d.db=null,be(d).then(function(D){return d.db=D,Te(d)?Bt(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,C){C===void 0&&(C=1);try{var x=d.db.transaction(d.storeName,E);S(null,x)}catch(D){if(C>0&&(!d.db||D.name==="InvalidStateError"||D.name==="NotFoundError"))return m.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),Bt(d)}).then(function(){return jr(d).then(function(){ke(d,E,S,C-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 C in d)S[C]=d[C];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 m.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 m.all(D).then(function(){return S.db=x.db,be(S)}).then(function(B){return S.db=B,Te(S,E._defaultConfig.version)?Bt(S):B}).then(function(B){S.db=x.db=B,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 C=new m(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 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(C,E),C}function Hi(d,E){var S=this,C=new m(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(),B=1;$.onsuccess=function(){var G=$.result;if(G){var mt=G.value;we(mt)&&(mt=Q(mt));var he=d(mt,G.key,B++);he!==void 0?x(he):G.continue()}else x()},$.onerror=function(){D($.error)}}catch(G){D(G)}})}).catch(D)});return y(C,E),C}function Wi(d,E,S){var C=this;d=O(d);var x=new m(function(D,P){var U;C.ready().then(function(){return U=C._dbInfo,Ut.call(E)==="[object Blob]"?st(U.db).then(function(F){return F?E:pt(E)}):E}).then(function(F){ke(C._dbInfo,j,function($,B){if($)return P($);try{var G=B.objectStore(C._dbInfo.storeName);F===null&&(F=void 0);var mt=G.put(F,d);B.oncomplete=function(){F===void 0&&(F=null),D(F)},B.onabort=B.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 C=new m(function(x,D){S.ready().then(function(){ke(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(C,E),C}function Mn(d){var E=this,S=new m(function(C,x){E.ready().then(function(){ke(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(){C()},P.onabort=P.onerror=function(){var $=F.error?F.error:F.transaction.error;x($)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function Pe(d){var E=this,S=new m(function(C,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(){C(F.result)},F.onerror=function(){x(F.error)}}catch($){x($)}})}).catch(x)});return y(S,d),S}function Wr(d,E){var S=this,C=new m(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,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(C,E),C}function rs(d){var E=this,S=new m(function(C,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 B=F.result;if(!B){C($);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 C=this,x;if(!d.name)x=m.reject("Invalid arguments");else{var D=d.name===S.name&&C._dbInfo.db,P=D?m.resolve(C._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;Jt(d);var $=V[d.name],B=$.forages;U.close();for(var G=0;G<B.length;G++){var mt=B[G];mt._dbInfo.db=null,mt._dbInfo.version=F}var he=new m(function(oe,Ie){var ye=h.open(d.name,F);ye.onerror=function(Ve){var Wu=ye.result;Wu.close(),Ie(Ve)},ye.onupgradeneeded=function(){var Ve=ye.result;Ve.deleteObjectStore(d.storeName)},ye.onsuccess=function(){var Ve=ye.result;Ve.close(),oe(Ve)}});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(pe(d,oe)||m.resolve()).catch(function(){}),oe})}}):x=P.then(function(U){Jt(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 mt=new m(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)||m.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:Pe,key:Wr,keys:rs,dropInstance:a};function p(){return typeof openDatabase=="function"}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="~~local_forage_type~",L=/^~~local_forage_type~([^~]+)~/,W="__lfsc__:",te=W.length,bt="arbf",Ct="blob",le="si08",z="ui08",ft="uic8",X="si16",ie="si32",$e="ur16",Me="ui32",re="fl32",J="fl64",He=te+bt.length,As=Object.prototype.toString;function Yo(d){var E=d.length*.75,S=d.length,C,x=0,D,P,U,F;d[d.length-1]==="="&&(E--,d[d.length-2]==="="&&E--);var $=new ArrayBuffer(E),B=new Uint8Array($);for(C=0;C<S;C+=4)D=I.indexOf(d[C]),P=I.indexOf(d[C+1]),U=I.indexOf(d[C+2]),F=I.indexOf(d[C+3]),B[x++]=D<<2|P>>4,B[x++]=(P&15)<<4|U>>2,B[x++]=(U&3)<<6|F&63;return $}function Ec(d){var E=new Uint8Array(d),S="",C;for(C=0;C<E.length;C+=3)S+=I[E[C]>>2],S+=I[(E[C]&3)<<4|E[C+1]>>4],S+=I[(E[C+1]&15)<<2|E[C+2]>>6],S+=I[E[C+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=As.call(d)),d&&(S==="[object ArrayBuffer]"||d.buffer&&As.call(d.buffer)==="[object ArrayBuffer]")){var C,x=W;d instanceof ArrayBuffer?(C=d,x+=bt):(C=d.buffer,S==="[object Int8Array]"?x+=le:S==="[object Uint8Array]"?x+=z:S==="[object Uint8ClampedArray]"?x+=ft:S==="[object Int16Array]"?x+=X:S==="[object Uint16Array]"?x+=$e:S==="[object Int32Array]"?x+=ie:S==="[object Uint32Array]"?x+=Me:S==="[object Float32Array]"?x+=re:S==="[object Float64Array]"?x+=J:E(new Error("Failed to get type for BinaryArray"))),E(x+Ec(C))}else if(S==="[object Blob]"){var D=new FileReader;D.onload=function(){var P=N+d.type+"~"+Ec(this.result);E(W+Ct+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(He),S=d.substring(te,He),C;if(S===Ct&&L.test(E)){var x=E.match(L);C=x[1],E=E.substring(x[0].length)}var D=Yo(E);switch(S){case bt:return D;case Ct:return _([D],{type:C});case le:return new Int8Array(D);case z:return new Uint8Array(D);case ft:return new Uint8ClampedArray(D);case X:return new Int16Array(D);case $e:return new Uint16Array(D);case ie:return new Int32Array(D);case Me:return new Uint32Array(D);case re:return new Float32Array(D);case J:return new Float64Array(D);default:throw new Error("Unkown type: "+S)}}var Sc={serialize:$d,deserialize:Fd,stringToBuffer:Yo,bufferToString:Ec};function th(d,E,S,C){d.executeSql("CREATE TABLE IF NOT EXISTS "+E.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],S,C)}function Hd(d){var E=this,S={db:null};if(d)for(var C in d)S[C]=typeof d[C]!="string"?d[C].toString():d[C];var x=new m(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){th(U,S,function(){E._dbInfo=S,D()},function(F,$){P($)})},P)});return S.serializer=Sc,x}function Fn(d,E,S,C,x,D){d.executeSql(S,C,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):th(F,E,function(){F.executeSql(S,C,x,D)},D)},D):D(P,U)},D)}function Vd(d,E){var S=this;d=O(d);var C=new m(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(C,E),C}function qd(d,E){var S=this,C=new m(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,mt=0;mt<G;mt++){var he=B.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(C,E),C}function eh(d,E,S,C){var x=this;d=O(d);var D=new m(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(mt){Fn(mt,$,"INSERT OR REPLACE INTO "+$.storeName+" (key, value) VALUES (?, ?)",[d,B],function(){P(F)},function(he,oe){U(oe)})},function(mt){if(mt.code===mt.QUOTA_ERR){if(C>0){P(eh.apply(x,[d,F,S,C-1]));return}U(mt)}})})}).catch(U)});return y(D,S),D}function Wd(d,E,S){return eh.apply(this,[d,E,S,1])}function zd(d,E){var S=this;d=O(d);var C=new m(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(C,E),C}function Kd(d){var E=this,S=new m(function(C,x){E.ready().then(function(){var D=E._dbInfo;D.db.transaction(function(P){Fn(P,D,"DELETE FROM "+D.storeName,[],function(){C()},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Gd(d){var E=this,S=new m(function(C,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;C($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Yd(d,E){var S=this,C=new m(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(C,E),C}function Xd(d){var E=this,S=new m(function(C,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);C($)},function(U,F){x(F)})})}).catch(x)});return y(S,d),S}function Jd(d){return new m(function(E,S){d.transaction(function(C){C.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(C){S(C)})})}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 C=this,x;return d.name?x=new m(function(D){var P;d.name===S.name?P=C._dbInfo.db:P=openDatabase(d.name,"","",0),d.storeName?D({db:P,storeNames:[d.storeName]}):D(Jd(P))}).then(function(D){return new m(function(P,U){D.db.transaction(function(F){function $(he){return new m(function(oe,Ie){F.executeSql("DROP TABLE IF EXISTS "+he,[],function(){oe()},function(ye,Ve){Ie(Ve)})})}for(var B=[],G=0,mt=D.storeNames.length;G<mt;G++)B.push($(D.storeNames[G]));m.all(B).then(function(){P()}).catch(function(he){U(he)})},function(F){U(F)})})}):x=m.reject("Invalid arguments"),y(x,E),x}var Qd={_driver:"webSQLStorage",_initStorage:Hd,_support:p(),iterate:qd,getItem:Vd,setItem:Wd,removeItem:zd,clear:Kd,length:Gd,key:Yd,keys:Xd,dropInstance:Zd};function kg(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function rh(d,E){var S=d.name+"/";return d.storeName!==E.storeName&&(S+=d.storeName+"/"),S}function Om(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function Vm(){return!Om()||localStorage.length>0}function zm(d){var E=this,S={};if(d)for(var C in d)S[C]=d[C];return S.keyPrefix=rh(d,E._defaultConfig),Vm()?(E._dbInfo=S,S.serializer=Sc,m.resolve()):m.reject()}function Gm(d){var E=this,S=E.ready().then(function(){for(var C=E._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var D=localStorage.key(x);D.indexOf(C)===0&&localStorage.removeItem(D)}});return y(S,d),S}function kv(d,E){var S=this;d=O(d);var C=S.ready().then(function(){var x=S._dbInfo,D=localStorage.getItem(x.keyPrefix+d);return D&&(D=x.serializer.deserialize(D)),D});return y(C,E),C}function Pv(d,E){var S=this,C=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(C,E),C}function Lv(d,E){var S=this,C=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(C,E),C}function Mv(d){var E=this,S=E.ready().then(function(){for(var C=E._dbInfo,x=localStorage.length,D=[],P=0;P<x;P++){var U=localStorage.key(P);U.indexOf(C.keyPrefix)===0&&D.push(U.substring(C.keyPrefix.length))}return D});return y(S,d),S}function Uv(d){var E=this,S=E.keys().then(function(C){return C.length});return y(S,d),S}function jv(d,E){var S=this;d=O(d);var C=S.ready().then(function(){var x=S._dbInfo;localStorage.removeItem(x.keyPrefix+d)});return y(C,E),C}function Bv(d,E,S){var C=this;d=O(d);var x=C.ready().then(function(){E===void 0&&(E=null);var D=E;return new m(function(P,U){var F=C._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 $v(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 C=this,x;return d.name?x=new m(function(D){d.storeName?D(rh(d,C._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=m.reject("Invalid arguments"),y(x,E),x}var Fv={_driver:"localStorageWrapper",_initStorage:zm,_support:kg(),iterate:Pv,getItem:kv,setItem:Bv,removeItem:jv,clear:Gm,length:Uv,key:Lv,keys:Mv,dropInstance:$v},Hv=function(d,E){return d===E||typeof d=="number"&&typeof E=="number"&&isNaN(d)&&isNaN(E)},Wv=function(d,E){for(var S=d.length,C=0;C<S;){if(Hv(d[C],E))return!0;C++}return!1},nh=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},$a={},fh={},to={INDEXEDDB:l,WEBSQL:Qd,LOCALSTORAGE:Fv},Gv=[to.INDEXEDDB._driver,to.WEBSQL._driver,to.LOCALSTORAGE._driver],bc=["dropInstance"],Yc=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(bc),Oy={description:"",driver:Gv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Py(d,E){d[E]=function(){var S=arguments;return d.ready().then(function(){return d[E].apply(d,S)})}}function qu(){for(var d=1;d<arguments.length;d++){var E=arguments[d];if(E)for(var S in E)E.hasOwnProperty(S)&&(nh(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 C=to[S],x=C._driver;this[S]=x,$a[x]||this.defineDriver(C)}this._defaultConfig=qu({},Oy),this._config=qu({},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,C){var x=new m(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 $=Yc.concat("_initStorage"),B=0,G=$.length;B<G;B++){var mt=$[B],he=!Wv(bc,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"),Yh=m.reject(nb);return y(Yh,arguments[arguments.length-1]),Yh}},Ve=0,Wu=bc.length;Ve<Wu;Ve++){var zu=bc[Ve];E[zu]||(E[zu]=ye(zu))}};oe();var Ie=function(ye){$a[U]&&console.info("Redefining LocalForage driver: "+U),$a[U]=E,fh[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 T(x,S,C),x},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(E,S,C){var x=$a[E]?m.resolve($a[E]):m.reject(new Error("Driver not found."));return T(x,S,C),x},d.prototype.getSerializer=function(E){var S=m.resolve(Sc);return T(S,E),S},d.prototype.ready=function(E){var S=this,C=S._driverSet.then(function(){return S._ready===null&&(S._ready=S._initDriver()),S._ready});return T(C,E,E),C},d.prototype.setDriver=function(E,S,C){var x=this;nh(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 mt(){for(;G<B.length;){var he=B[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=m.reject(oe),x._driverSet}return mt()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.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=m.reject(B),x._driverSet}),T(this._driverSet,S,C),this._driverSet},d.prototype.supports=function(E){return!!fh[E]},d.prototype._extend=function(E){qu(this,E)},d.prototype._getSupportedDrivers=function(E){for(var S=[],C=0,x=E.length;C<x;C++){var D=E[C];this.supports(D)&&S.push(D)}return S},d.prototype._wrapLibraryMethodsWithReady=function(){for(var E=0,S=Yc.length;E<S;E++)Py(this,Yc[E])},d.prototype.createInstance=function(E){return new d(E)},d}(),eb=new tb;o.exports=eb},{3:3}]},{},[4])(4)})}),vl=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}),fd=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 g=o.retries,h=o.retryDelay,v=o.retryOn;if(f&&f.retries!==void 0)if(n(f.retries))g=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(_,m){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?T(O,null,R):_(R)}).catch(m)}catch(k){m(k)}else O<g?T(O,null,R):_(R)}).catch(function(R){if(typeof v=="function")try{Promise.resolve(v(O,R,null)).then(function(k){k?T(O,R,null):m(R)}).catch(function(k){m(k)})}catch(k){m(k)}else O<g?T(O,R,null):m(R)})};function T(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})}),tp="9.3.7",A=class Ku{static SDK_VERSION=tp;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=Ku.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");Ku.SDK_VERSION_CODE=parseInt(e,10)}},Qt={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`},Dt=Xt(tn()),w=class{static log(...t){Dt.default.info(...t)}static debug(...t){Dt.default.debug(...t)}static error(...t){Dt.default.error(...t)}static warn(...t){Dt.default.warn(...t)}static info(...t){Dt.default.info(...t)}static trace(...t){Dt.default.trace(...t)}static configure(t=A.LOG_PREFIX){Dt.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?Dt.default.setLevel(Dt.default[localStorage.cooeeLogLevel]):Dt.default.setLevel(Qt.debug?Dt.default.TRACE:Dt.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,33 +13,33 @@
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()}},np=(()=>{class t{static entityMap={'"':"&quot;"};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),je=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||{}),cr=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}(cr||{}),Yi=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Yi||{}),lr=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}(lr||{}),qi=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(qi||{}),Ic=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Ic||{}),Tc=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}(Tc||{}),ur=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}(ur||{}),jn=class tp{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--,tp.swap(e,r,n)}}},Xo,_e,cp,Rc,rn,ip,lp,xc,up,Nc,Cc,Dc,mh,Ki={},pp=[],dh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ac=Array.isArray;function Vr(t,e){for(var r in e)t[r]=e[r];return t}function Oc(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?Xo.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 Ko(t,o,n,i,null)}function Ko(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??++cp,__i:-1,__u:0};return i==null&&_e.vnode!=null&&_e.vnode(s),s}function fr(t){return t.children}function pr(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 fp(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 fp(t)}}function op(t){(!t.__d&&(t.__d=!0)&&rn.push(t)&&!Jo.__r++||ip!==_e.debounceRendering)&&((ip=_e.debounceRendering)||lp)(Jo)}function Jo(){var t,e,r,n,i,s,o,c;for(rn.sort(xc);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),Pc(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,hp(o,n,c),n.__e!=s&&fp(n)),rn.length>e&&rn.sort(xc));Jo.__r=0}function mp(t,e,r,n,i,s,o,c,u,f,g){var h,v,_,m,y,T,O=n&&n.__k||pp,H=e.length;for(u=hh(r,e,O,u,H),h=0;h<H;h++)(_=r.__k[h])!=null&&(v=_.__i===-1?Ki:O[_.__i]||Ki,_.__i=h,T=Pc(t,_,v,i,s,o,c,u,f,g),m=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&Lc(v.ref,null,_),g.push(_.ref,_.__c||m,_)),y==null&&m!=null&&(y=m),4&_.__u||v.__k===_.__k?u=dp(_,u,t):typeof _.type=="function"&&T!==void 0?u=T:m&&(u=m.nextSibling),_.__u&=-7);return r.__e=y,u}function hh(t,e,r,n,i){var s,o,c,u,f,g=r.length,h=g,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?Ko(null,o,null,null,null):Ac(o)?Ko(fr,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Ko(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=gh(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<g;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Wn(c)),gp(c,c));return n}function dp(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=dp(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 gh(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 sp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||dh.test(e)?r:r+"px"}function qo(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||sp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||sp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(up,"$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=Nc,t.addEventListener(e,s?Dc:Cc,s)):t.removeEventListener(e,s?Dc:Cc,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 ap(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Nc++;else if(e.t<r.u)return;return r(_e.event?_e.event(e):e)}}}function Pc(t,e,r,n,i,s,o,c,u,f){var g,h,v,_,m,y,T,O,H,R,k,V,Ut,de,j,ot,Y,st=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),s=[c=e.__e=r.__e]),(g=_e.__b)&&g(e);t:if(typeof st=="function")try{if(O=e.props,H="prototype"in st&&st.prototype.render,R=(g=st.contextType)&&n[g.__c],k=g?R?R.props.value:g.__:n,r.__c?T=(h=e.__c=r.__c).__=h.__E:(H?e.__c=h=new st(O,k):(e.__c=h=new pr(O,k),h.constructor=st,h.render=vh),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,m=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(_,m,y)})}if(h.context=k,h.props=O,h.__P=t,h.__e=!1,Ut=_e.__r,de=0,H){for(h.state=h.__s,h.__d=!1,Ut&&Ut(e),g=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,Ut&&Ut(e),g=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(_,m)),c=mp(t,Ac(ot=g!=null&&g.type===fr&&g.key==null?g.props.children:g)?ot:[ot],e,r,n,i,s,o,c,u,f),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),T&&(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--;)Oc(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=yh(r.__e,e,r,n,i,s,o,u,f);return(g=_e.diffed)&&g(e),128&e.__u?void 0:c}function hp(t,e,r){for(var n=0;n<r.length;n++)Lc(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 yh(t,e,r,n,i,s,o,c,u){var f,g,h,v,_,m,y,T=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)T===O||c&&t.data===O||(t.data=O);else{if(s=s&&Xo.call(t.childNodes),T=r.props||Ki,!c&&s!=null)for(T={},f=0;f<t.attributes.length;f++)T[(_=t.attributes[f]).name]=_.value;for(f in T)if(_=T[f],f!="children"){if(f=="dangerouslySetInnerHTML")h=_;else if(!(f in O)){if(f=="value"&&"defaultValue"in O||f=="checked"&&"defaultChecked"in O)continue;qo(t,f,null,_,i)}}for(f in O)_=O[f],f=="children"?v=_:f=="dangerouslySetInnerHTML"?g=_:f=="value"?m=_:f=="checked"?y=_:c&&typeof _!="function"||T[f]===_||qo(t,f,_,T[f],i);if(g)c||h&&(g.__html===h.__html||g.__html===t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(h&&(t.innerHTML=""),mp(t,Ac(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--;)Oc(s[f]);c||(f="value",H=="progress"&&m==null?t.removeAttribute("value"):m!==void 0&&(m!==t[f]||H=="progress"&&!m||H=="option"&&m!==T[f])&&qo(t,f,m,T[f],i),f="checked",y!==void 0&&y!==t[f]&&qo(t,f,y,T[f],i))}return t}function Lc(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 gp(t,e,r){var n,i;if(_e.unmount&&_e.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Lc(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]&&gp(n[i],e,r||typeof t.type!="function");r||Oc(t.__e),t.__c=t.__=t.__e=void 0}function vh(t,e,r){return this.constructor(t,r)}function Qo(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=[],Pc(e,t=(!n&&r||e).__k=Ji(fr,null,[t]),i||Ki,Ki,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Xo.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),hp(s,t,o)}Xo=pp.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}},cp=0,Rc=function(t){return t!=null&&t.constructor==null},pr.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),op(this))},pr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),op(this))},pr.prototype.render=fr,rn=[],lp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xc=function(t,e){return t.__v.__b-e.__v.__b},Jo.__r=0,up=/(PointerCapture)$|Capture$/i,Nc=0,Cc=ap(!1),Dc=ap(!0),mh=0;var Uc,Rt,Bc,yp,vp=0,xp=[],Ke=_e,_p=Ke.__b,Ep=Ke.__r,Sp=Ke.diffed,bp=Ke.__c,wp=Ke.unmount,Ip=Ke.__;function _h(t,e){Ke.__h&&Ke.__h(Rt,t,vp||e),vp=0;var r=Rt.__H||(Rt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function kc(t,e){var r=_h(Uc++,7);return bh(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Eh(){for(var t;t=xp.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Zo),t.__H.__h.forEach(Mc),t.__H.__h=[]}catch(e){t.__H.__h=[],Ke.__e(e,t.__v)}}Ke.__b=function(t){Rt=null,_p&&_p(t)},Ke.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ip&&Ip(t,e)},Ke.__r=function(t){Ep&&Ep(t),Uc=0;var e=(Rt=t.__c).__H;e&&(Bc===Rt?(e.__h=[],Rt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(Zo),e.__h.forEach(Mc),e.__h=[],Uc=0)),Bc=Rt},Ke.diffed=function(t){Sp&&Sp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(xp.push(e)!==1&&yp===Ke.requestAnimationFrame||((yp=Ke.requestAnimationFrame)||Sh)(Eh)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Bc=Rt=null},Ke.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Zo),r.__h=r.__h.filter(function(n){return!n.__||Mc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ke.__e(n,r.__v)}}),bp&&bp(t,e)},Ke.unmount=function(t){wp&&wp(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Zo(n)}catch(i){e=i}}),r.__H=void 0,e&&Ke.__e(e,r.__v))};var Tp=typeof requestAnimationFrame=="function";function Sh(t){var e,r=function(){clearTimeout(n),Tp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Tp&&(e=requestAnimationFrame(r))}function Zo(t){var e=Rt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Rt=e}function Mc(t){var e=Rt;t.__c=t.__(),Rt=e}function bh(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var wh=Symbol.for("preact-signals");function Hc(){if(Gn>1)Gn--;else{for(var t,e=!1;Xi!==void 0;){var r=Xi;for(Xi=void 0,Fc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Dp(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Fc=0,Gn--,e)throw t}}var Re=void 0,Xi=void 0,Gn=0,Fc=0,es=0;function Cp(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 Je(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Je.prototype.brand=wh;Je.prototype.h=function(){return!0};Je.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)};Je.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)}};Je.prototype.subscribe=function(t){var e=this;return nt(function(){var r=e.value,n=Re;Re=void 0;try{t(r)}finally{Re=n}})};Je.prototype.valueOf=function(){return this.value};Je.prototype.toString=function(){return this.value+""};Je.prototype.toJSON=function(){return this.value};Je.prototype.peek=function(){var t=Re;Re=void 0;try{return this.value}finally{Re=t}};Object.defineProperty(Je.prototype,"value",{get:function(){var t=Cp(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Fc>100)throw new Error("Cycle detected");this.v=t,this.i++,es++,Gn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Hc()}}}});function Qt(t){return new Je(t)}function Dp(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 Rp(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 Np(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){Je.call(this,void 0),this.x=t,this.s=void 0,this.g=es-1,this.f=4}(Vn.prototype=new Je).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===es))return!0;if(this.g=es,this.f|=1,this.i>0&&!Dp(this))return this.f&=-2,!0;var t=Re;try{Rp(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,Np(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)}Je.prototype.S.call(this,t)};Vn.prototype.U=function(t){if(this.t!==void 0&&(Je.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=Cp(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function $c(t){return new Vn(t)}function Ap(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,jc(t),n}finally{Re=r,Hc()}}}function jc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Ap(t)}function Ih(t){if(Re!==this)throw new Error("Out-of-order effect");Np(this),Re=t,this.f&=-2,8&this.f&&jc(this),Hc()}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,Ap(this),Rp(this),Gn++;var t=Re;return Re=this,Ih.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||jc(this)};function nt(t){var e=new Qi(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Gc,Wc;function zn(t,e){_e[t]=e.bind(null,_e[t]||function(){})}function ts(t){Wc&&Wc(),Wc=t&&t.S()}function Op(t){var e=this,r=t.data,n=xh(r);n.value=r;var i=kc(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(),Rc(u)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=u},$c(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Op.displayName="_st";Object.defineProperties(Je.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Op},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 Je&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});zn("__r",function(t,e){ts();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return nt(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Gc=n,ts(r),t(e)});zn("__e",function(t,e,r,n){ts(),Gc=void 0,t(e,r,n)});zn("diffed",function(t,e){ts(),Gc=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],g=n[u];f===void 0?(f=Th(r,u,g,i),s[u]=f):f.o(g,i)}}}t(e)});function Th(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Qt(r);return{o:function(o,c){s.value=o,n=c},d:nt(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)});pr.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 xh(t){return kc(function(){return Qt(t)},[])}var Ch=Object.prototype.toString,qn=Array.isArray||function(t){return Ch.call(t)==="[object Array]"};function zc(t){return typeof t=="function"}function Dh(t){return qn(t)?"array":typeof t}function Vc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Pp(t,e){return t!=null&&typeof t=="object"&&e in t}function Rh(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Nh=RegExp.prototype.test;function Ah(t,e){return Nh.call(t,e)}var Oh=/\S/;function Ph(t){return!Ah(Oh,t)}var Lh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Bh(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Lh[e]})}var Uh=/\s*/,Mh=/\s+/,Lp=/\s*=/,kh=/\s*\}/,Fh=/#|\^|\/|>|\{|&|=|!/;function Hh(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,u="",f=0;function g(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,v,_;function m(j){if(typeof j=="string"&&(j=j.split(Mh,2)),!qn(j)||j.length!==2)throw new Error("Invalid tags: "+j);h=new RegExp(Vc(j[0])+"\\s*"),v=new RegExp("\\s*"+Vc(j[1])),_=new RegExp("\\s*"+Vc("}"+j[1]))}m(e||Mt.tags);for(var y=new eo(t),T,O,H,R,k,V;!y.eos();){if(T=y.pos,H=y.scanUntil(h),H)for(var Ut=0,de=H.length;Ut<de;++Ut)R=H.charAt(Ut),Ph(R)?(s.push(i.length),u+=R):(c=!0,r=!0,u+=" "),i.push(["text",R,T,T+1]),T+=1,R===`
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()}},np=(()=>{class t{static entityMap={'"':"&quot;"};static escapeHtml(r){return String(r).replace(/"/g,n=>t.entityMap[n])}}return t})(),je=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||{}),Ic=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Ic||{}),Tc=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}(Tc||{}),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 rp{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--,rp.swap(e,r,n)}}},Xo,_e,cp,Rc,rn,ip,lp,xc,up,Nc,Cc,Dc,mh,Ki={},pp=[],dh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ac=Array.isArray;function Vr(t,e){for(var r in e)t[r]=e[r];return t}function Oc(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?Xo.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 Ko(t,o,n,i,null)}function Ko(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??++cp,__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 fp(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 fp(t)}}function op(t){(!t.__d&&(t.__d=!0)&&rn.push(t)&&!Jo.__r++||ip!==_e.debounceRendering)&&((ip=_e.debounceRendering)||lp)(Jo)}function Jo(){var t,e,r,n,i,s,o,c;for(rn.sort(xc);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),Pc(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,hp(o,n,c),n.__e!=s&&fp(n)),rn.length>e&&rn.sort(xc));Jo.__r=0}function mp(t,e,r,n,i,s,o,c,u,f,g){var h,v,_,m,y,T,O=n&&n.__k||pp,H=e.length;for(u=hh(r,e,O,u,H),h=0;h<H;h++)(_=r.__k[h])!=null&&(v=_.__i===-1?Ki:O[_.__i]||Ki,_.__i=h,T=Pc(t,_,v,i,s,o,c,u,f,g),m=_.__e,_.ref&&v.ref!=_.ref&&(v.ref&&Lc(v.ref,null,_),g.push(_.ref,_.__c||m,_)),y==null&&m!=null&&(y=m),4&_.__u||v.__k===_.__k?u=dp(_,u,t):typeof _.type=="function"&&T!==void 0?u=T:m&&(u=m.nextSibling),_.__u&=-7);return r.__e=y,u}function hh(t,e,r,n,i){var s,o,c,u,f,g=r.length,h=g,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?Ko(null,o,null,null,null):Ac(o)?Ko(mr,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Ko(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=gh(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<g;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=Wn(c)),gp(c,c));return n}function dp(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=dp(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 gh(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 sp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||dh.test(e)?r:r+"px"}function qo(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||sp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||sp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(up,"$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=Nc,t.addEventListener(e,s?Dc:Cc,s)):t.removeEventListener(e,s?Dc:Cc,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 ap(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Nc++;else if(e.t<r.u)return;return r(_e.event?_e.event(e):e)}}}function Pc(t,e,r,n,i,s,o,c,u,f){var g,h,v,_,m,y,T,O,H,R,k,V,Ut,de,j,ot,Y,st=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),s=[c=e.__e=r.__e]),(g=_e.__b)&&g(e);t:if(typeof st=="function")try{if(O=e.props,H="prototype"in st&&st.prototype.render,R=(g=st.contextType)&&n[g.__c],k=g?R?R.props.value:g.__:n,r.__c?T=(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=vh),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,m=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(_,m,y)})}if(h.context=k,h.props=O,h.__P=t,h.__e=!1,Ut=_e.__r,de=0,H){for(h.state=h.__s,h.__d=!1,Ut&&Ut(e),g=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,Ut&&Ut(e),g=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(_,m)),c=mp(t,Ac(ot=g!=null&&g.type===mr&&g.key==null?g.props.children:g)?ot:[ot],e,r,n,i,s,o,c,u,f),h.base=e.__e,e.__u&=-161,h.__h.length&&o.push(h),T&&(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--;)Oc(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=yh(r.__e,e,r,n,i,s,o,u,f);return(g=_e.diffed)&&g(e),128&e.__u?void 0:c}function hp(t,e,r){for(var n=0;n<r.length;n++)Lc(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 yh(t,e,r,n,i,s,o,c,u){var f,g,h,v,_,m,y,T=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)T===O||c&&t.data===O||(t.data=O);else{if(s=s&&Xo.call(t.childNodes),T=r.props||Ki,!c&&s!=null)for(T={},f=0;f<t.attributes.length;f++)T[(_=t.attributes[f]).name]=_.value;for(f in T)if(_=T[f],f!="children"){if(f=="dangerouslySetInnerHTML")h=_;else if(!(f in O)){if(f=="value"&&"defaultValue"in O||f=="checked"&&"defaultChecked"in O)continue;qo(t,f,null,_,i)}}for(f in O)_=O[f],f=="children"?v=_:f=="dangerouslySetInnerHTML"?g=_:f=="value"?m=_:f=="checked"?y=_:c&&typeof _!="function"||T[f]===_||qo(t,f,_,T[f],i);if(g)c||h&&(g.__html===h.__html||g.__html===t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(h&&(t.innerHTML=""),mp(t,Ac(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--;)Oc(s[f]);c||(f="value",H=="progress"&&m==null?t.removeAttribute("value"):m!==void 0&&(m!==t[f]||H=="progress"&&!m||H=="option"&&m!==T[f])&&qo(t,f,m,T[f],i),f="checked",y!==void 0&&y!==t[f]&&qo(t,f,y,T[f],i))}return t}function Lc(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 gp(t,e,r){var n,i;if(_e.unmount&&_e.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Lc(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]&&gp(n[i],e,r||typeof t.type!="function");r||Oc(t.__e),t.__c=t.__=t.__e=void 0}function vh(t,e,r){return this.constructor(t,r)}function Qo(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=[],Pc(e,t=(!n&&r||e).__k=Ji(mr,null,[t]),i||Ki,Ki,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Xo.call(e.childNodes):null,s,!n&&r?r:i?i.__e:e.firstChild,n,o),hp(s,t,o)}Xo=pp.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}},cp=0,Rc=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),op(this))},fr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),op(this))},fr.prototype.render=mr,rn=[],lp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xc=function(t,e){return t.__v.__b-e.__v.__b},Jo.__r=0,up=/(PointerCapture)$|Capture$/i,Nc=0,Cc=ap(!1),Dc=ap(!0),mh=0;var Uc,Rt,Bc,yp,vp=0,xp=[],Ke=_e,_p=Ke.__b,Ep=Ke.__r,Sp=Ke.diffed,bp=Ke.__c,wp=Ke.unmount,Ip=Ke.__;function _h(t,e){Ke.__h&&Ke.__h(Rt,t,vp||e),vp=0;var r=Rt.__H||(Rt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function kc(t,e){var r=_h(Uc++,7);return bh(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Eh(){for(var t;t=xp.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Zo),t.__H.__h.forEach(Mc),t.__H.__h=[]}catch(e){t.__H.__h=[],Ke.__e(e,t.__v)}}Ke.__b=function(t){Rt=null,_p&&_p(t)},Ke.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ip&&Ip(t,e)},Ke.__r=function(t){Ep&&Ep(t),Uc=0;var e=(Rt=t.__c).__H;e&&(Bc===Rt?(e.__h=[],Rt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(Zo),e.__h.forEach(Mc),e.__h=[],Uc=0)),Bc=Rt},Ke.diffed=function(t){Sp&&Sp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(xp.push(e)!==1&&yp===Ke.requestAnimationFrame||((yp=Ke.requestAnimationFrame)||Sh)(Eh)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),Bc=Rt=null},Ke.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Zo),r.__h=r.__h.filter(function(n){return!n.__||Mc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ke.__e(n,r.__v)}}),bp&&bp(t,e)},Ke.unmount=function(t){wp&&wp(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Zo(n)}catch(i){e=i}}),r.__H=void 0,e&&Ke.__e(e,r.__v))};var Tp=typeof requestAnimationFrame=="function";function Sh(t){var e,r=function(){clearTimeout(n),Tp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);Tp&&(e=requestAnimationFrame(r))}function Zo(t){var e=Rt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Rt=e}function Mc(t){var e=Rt;t.__c=t.__(),Rt=e}function bh(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var wh=Symbol.for("preact-signals");function Hc(){if(Gn>1)Gn--;else{for(var t,e=!1;Xi!==void 0;){var r=Xi;for(Xi=void 0,Fc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Dp(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Fc=0,Gn--,e)throw t}}var Re=void 0,Xi=void 0,Gn=0,Fc=0,es=0;function Cp(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 Je(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Je.prototype.brand=wh;Je.prototype.h=function(){return!0};Je.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)};Je.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)}};Je.prototype.subscribe=function(t){var e=this;return nt(function(){var r=e.value,n=Re;Re=void 0;try{t(r)}finally{Re=n}})};Je.prototype.valueOf=function(){return this.value};Je.prototype.toString=function(){return this.value+""};Je.prototype.toJSON=function(){return this.value};Je.prototype.peek=function(){var t=Re;Re=void 0;try{return this.value}finally{Re=t}};Object.defineProperty(Je.prototype,"value",{get:function(){var t=Cp(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Fc>100)throw new Error("Cycle detected");this.v=t,this.i++,es++,Gn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Hc()}}}});function Zt(t){return new Je(t)}function Dp(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 Rp(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 Np(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){Je.call(this,void 0),this.x=t,this.s=void 0,this.g=es-1,this.f=4}(Vn.prototype=new Je).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===es))return!0;if(this.g=es,this.f|=1,this.i>0&&!Dp(this))return this.f&=-2,!0;var t=Re;try{Rp(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,Np(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)}Je.prototype.S.call(this,t)};Vn.prototype.U=function(t){if(this.t!==void 0&&(Je.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=Cp(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function $c(t){return new Vn(t)}function Ap(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,jc(t),n}finally{Re=r,Hc()}}}function jc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Ap(t)}function Ih(t){if(Re!==this)throw new Error("Out-of-order effect");Np(this),Re=t,this.f&=-2,8&this.f&&jc(this),Hc()}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,Ap(this),Rp(this),Gn++;var t=Re;return Re=this,Ih.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||jc(this)};function nt(t){var e=new Qi(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Gc,Wc;function zn(t,e){_e[t]=e.bind(null,_e[t]||function(){})}function ts(t){Wc&&Wc(),Wc=t&&t.S()}function Op(t){var e=this,r=t.data,n=xh(r);n.value=r;var i=kc(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(),Rc(u)||((o=e.base)==null?void 0:o.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=u},$c(function(){var o=n.value.value;return o===0?0:o===!0?"":o||""})},[]);return i.value}Op.displayName="_st";Object.defineProperties(Je.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Op},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 Je&&(r||(e.__np=r={}),r[i]=s,n[i]=s.peek())}}t(e)});zn("__r",function(t,e){ts();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var s;return nt(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Gc=n,ts(r),t(e)});zn("__e",function(t,e,r,n){ts(),Gc=void 0,t(e,r,n)});zn("diffed",function(t,e){ts(),Gc=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],g=n[u];f===void 0?(f=Th(r,u,g,i),s[u]=f):f.o(g,i)}}}t(e)});function Th(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,s=Zt(r);return{o:function(o,c){s.value=o,n=c},d:nt(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 xh(t){return kc(function(){return Zt(t)},[])}var Ch=Object.prototype.toString,qn=Array.isArray||function(t){return Ch.call(t)==="[object Array]"};function zc(t){return typeof t=="function"}function Dh(t){return qn(t)?"array":typeof t}function Vc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Pp(t,e){return t!=null&&typeof t=="object"&&e in t}function Rh(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Nh=RegExp.prototype.test;function Ah(t,e){return Nh.call(t,e)}var Oh=/\S/;function Ph(t){return!Ah(Oh,t)}var Lh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Bh(t){return String(t).replace(/[&<>"'`=\/]/g,function(e){return Lh[e]})}var Uh=/\s*/,Mh=/\s+/,Lp=/\s*=/,kh=/\s*\}/,Fh=/#|\^|\/|>|\{|&|=|!/;function Hh(t,e){if(!t)return[];var r=!1,n=[],i=[],s=[],o=!1,c=!1,u="",f=0;function g(){if(o&&!c)for(;s.length;)delete i[s.pop()];else s=[];o=!1,c=!1}var h,v,_;function m(j){if(typeof j=="string"&&(j=j.split(Mh,2)),!qn(j)||j.length!==2)throw new Error("Invalid tags: "+j);h=new RegExp(Vc(j[0])+"\\s*"),v=new RegExp("\\s*"+Vc(j[1])),_=new RegExp("\\s*"+Vc("}"+j[1]))}m(e||Mt.tags);for(var y=new eo(t),T,O,H,R,k,V;!y.eos();){if(T=y.pos,H=y.scanUntil(h),H)for(var Ut=0,de=H.length;Ut<de;++Ut)R=H.charAt(Ut),Ph(R)?(s.push(i.length),u+=R):(c=!0,r=!0,u+=" "),i.push(["text",R,T,T+1]),T+=1,R===`
17
17
  `&&(g(),u="",f=0,r=!1);if(!y.scan(h))break;if(o=!0,O=y.scan(Fh)||"name",y.scan(Uh),O==="="?(H=y.scanUntil(Lp),y.scan(Lp),y.scanUntil(v)):O==="{"?(H=y.scanUntil(_),y.scan(kh),y.scanUntil(v),O="&"):H=y.scanUntil(v),!y.scan(v))throw new Error("Unclosed tag at "+y.pos);if(O==">"?k=[O,H,T,y.pos,u,f,r]:k=[O,H,T,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 '+T);if(V[1]!==H)throw new Error('Unclosed section "'+V[1]+'" at '+T)}else O==="name"||O==="{"||O==="&"?c=!0:O==="="&&m(H)}if(g(),V=n.pop(),V)throw new Error('Unclosed section "'+V[1]+'" at '+y.pos);return jh($h(i))}function $h(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 jh(t){for(var e=[],r=e,n=[],i,s,o=0,c=t.length;o<c;++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,c=!1;n;){if(t.indexOf(".")>0)for(i=n.view,s=t.split("."),o=0;i!=null&&o<s.length;)o===s.length-1&&(c=Pp(i,s[o])||Rh(i,s[o])),i=i[s[o++]];else i=n.view[t],c=Pp(n.view,t);if(c){r=i;break}n=n.parent}e[t]=r}return zc(r)&&(r=r.call(this.view)),r};function dt(){this.templateCache={_cache:{},set:function(t,e){this._cache[t]=e},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}dt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};dt.prototype.parse=function(t,e){var r=this.templateCache,n=t+":"+(e||Mt.tags).join(":"),i=typeof r<"u",s=i?r.get(n):void 0;return s==null&&(s=Hh(t,e),i&&r.set(n,s)),s};dt.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)};dt.prototype.renderTokens=function(t,e,r,n,i){for(var s="",o,c,u,f=0,g=t.length;f<g;++f)u=void 0,o=t[f],c=o[0],c==="#"?u=this.renderSection(o,e,r,n,i):c==="^"?u=this.renderInverted(o,e,r,n,i):c===">"?u=this.renderPartial(o,e,r,i):c==="&"?u=this.unescapedValue(o,e):c==="name"?u=this.escapedValue(o,e,i):c==="text"&&(u=this.rawValue(o)),u!==void 0&&(s+=u);return s};dt.prototype.renderSection=function(t,e,r,n,i){var s=this,o="",c=e.lookup(t[1]);function u(h){return s.render(h,e,r,i)}if(c){if(qn(c))for(var f=0,g=c.length;f<g;++f)o+=this.renderTokens(t[4],e.push(c[f]),r,n,i);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(t[4],e.push(c),r,n,i);else if(zc(c)){if(typeof n!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,n.slice(t[3],t[5]),u),c!=null&&(o+=c)}else o+=this.renderTokens(t[4],e,r,n,i);return o}};dt.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)};dt.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
- `)};dt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=zc(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 g=this.parse(f,i);return this.renderTokens(g,e,r,f,n)}}};dt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};dt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||Mt.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===Mt.escape?String(i):n(i)};dt.prototype.rawValue=function(t){return t[1]};dt.prototype.getConfigTags=function(t){return qn(t)?t:t&&typeof t=="object"?t.tags:void 0};dt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!qn(t))return t.escape};var Mt={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 dt;Mt.clearCache=function(){return Zi.clearCache()};Mt.parse=function(t,e){return Zi.parse(t,e)};Mt.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Dh(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Zi.render(t,e,r,n)};Mt.escape=Bh;Mt.Scanner=eo;Mt.Context=Yn;Mt.Writer=dt;var Zt=Mt,Up=Xt(Bp()),Nt=class Un{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new Up.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"},qc=Xt(kp());function Kn(t){return qc.default.createInstance({name:"lc",storeName:t,driver:qc.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}},at=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}},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 Mp{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 Mp),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 at.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)}},ns=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}},kt=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=je.get(),i=r.shopCurrencyCode??n.currency,s=r.currencyCode,o=n.money?.format??r.moneyFormat,c;return o&&i===s?c=ns.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 kt.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 Xn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var bt=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}},is=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},os=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=t.d}},Kc=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}},mr=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 is(e))??[],this.link=t.link,this.price=new os(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,t.sellingPlans?.length&&(this.selectedSellingPlan=Qt(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Kc(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}},wt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;selectedOrFirstVariant;selected=Qt(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Qt(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.portraitVideos=t.videos?.filter(e=>e.orientation==="PORTRAIT"),t.vars&&(this.vars=t.vars.map(e=>new mr(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new bt({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})}},ss=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}},Jc=class{enabled;constructor(t){this.enabled=t.enabled}},Xc=class extends Jc{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},as=class{productQuantity;constructor(t){t??={},this.productQuantity=new Xc(t.productQuantity)}},nn=class{s;g;i;constructor(t){t.s&&(this.s=new We(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",Wh=`#?[${no}]{3}[${no}]?`,Gh=`#?[${no}]{6}([${no}]{2})?`,Vh=new RegExp(`[^#${no}]`,"gi"),zh=new RegExp(`^${Wh}$|^${Gh}$`,"i");function Qc(t,e={}){if(typeof t!="string"||Vh.test(t)||!zh.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 We=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 Qc(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 We(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Fp[this.s??1]}},Fp=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(Fp||{}),ro=class bd{static DEFAULT_FALLBACK=new We({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new We(e.c)),e.fb&&(this.fb=new We(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??bd.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 We(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}},Nr=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}},At=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 Nr(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 Le[this.t]}get click(){return this.clc}},Le=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Le||{}),an=class extends At{constructor(t){super(t)}},Ar=class extends At{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||{}),cs=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 Zc(e))}},Zc=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')`}},it=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 We(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new We(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new cs(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},dr=class extends At{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 it(e)}get color(){return this.typography.tc}get typography(){return this.typo}},Yr=class extends dr{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}},ls=class extends At{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 dr{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}},us=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new We(t.c??{})}get text(){return this.txt}get color(){return this.c}},qr=class extends dr{ph;constructor(t){super(t),this.ph=new us(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 Ar{},cn=(t=>(t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=3]="HIGH",t))(cn||{}),ps=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 At{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 ps(t.anim),this.embedded=t.embedded,this.position=t.position??1,this.spc||(this.spc=new Nr({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}`}},fs=class extends oo{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new ls(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 Ar(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}},ms=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}},ds=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}},hs=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Nr(t.spc),t.size&&(this.size=new ds(t.size)),t.bg&&(this.bg=new nn(t.bg)),t.br&&(this.br=new on(t.br)),t.typo&&(this.typo=new it(t.typo)),t.lout&&(this.lout=new ms(t.lout)),t.flex&&(this.flex=new oi(t.flex))}},si=class{sm;lg;constructor(t){t??={},this.sm=new hs(t.sm),this.lg=new hs(t.lg)}},ct=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 Le[this.t]}},ze=class extends ct{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 ct{value;constructor(t){super(6,t),t??={},this.value=t.value}},ci=class extends ze{constructor(t=15,e){super(e,t)}},Hp=Xt(tn()),el=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new We(t.color)}},tl=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new We(t.color)}},so=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new tl(t.navigation),this.pagination=new el(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},gs=class extends ct{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Ot.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new so(t.conf),this.allowedTypes=t.allowedTypes}},ys=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 ct{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Ot.getParsedElement(e);r&&this.elems.push(r)})}},un=class extends ct{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}},Ot=class wd{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=wd.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 vs(e);case 12:return new hr(e);case 61:return new ys(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 gs(e);default:Hp.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"}}},hr=class extends ct{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=Ot.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 it(Z(b({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new it(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:Ot.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))}},vs=class extends ct{conf;prod;constructor(t){super(11,t),t??={},this.conf=new rl(t.conf),this.prod=new hr(t.prod)}},_s=class extends so{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},rl=class{lg;sm;constructor(t){t??={},this.lg=new _s(t.lg),this.sm=new _s(t.sm)}},Es=class extends Kr{constructor(t){super(t)}},li=class{cont;elems=[];constructor(t){t=t??{},this.cont=new Es(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Ot.getParsedElement(t);return e&&this.elems.push(e),e}},nl=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 bt(e))}},Ss=class{layout;milestones;constructor(t){this.layout=t.layout??Ic.ICONS,this.milestones=t.milestones?.map(e=>new nl(e))??[]}},bs=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},il=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}},Pt=class Ed extends il{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=Qt({});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 bt(r)),this.items=e.items?.map(r=>new wt(r))??[],this.nonMutableItems=e.items?.map(r=>new wt(r))??[],this.collections=e.collections?.map(r=>new ss(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 as(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new Ss(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new bs(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new wt(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===lr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Yi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Yi.PAGE_EMBED}isProgressBar(){return this.objective===lr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===lr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===lr.CART_RECOVERY}isProductPromotion(){return this.objective===lr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===lr.BYOB}isShoppableVideo(){return this.objective===lr.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=Zt.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 fs(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([ur.UNIQUE_FLAT_ITEMS,ur.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===ur.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===ur.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 je.get().skipItemAttribute?{_via:"Cooee",[A.CAMPAIGN_ATTRIBUTE]:this.shortID,_letscooee_content:this.contentID}:{}}isBundleDiscount(){return[ur.UNIQUE_FIXED_ITEMS,ur.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.onsiteDeliveryType===Yi.CART_EMBED&&this.objective===lr.BUNDLE_AND_UPSELL}hasSwiperElement(){let e=this.widget?.elems.find(n=>Ed.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Nt.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 qh(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Kh=Zh,Jh=tg,Xh=ig,yr=[],Ht=[],Qh=typeof Uint8Array<"u"?Uint8Array:Array,ol="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,$p=ol.length;pn<$p;++pn)yr[pn]=ol[pn],Ht[ol.charCodeAt(pn)]=pn;var pn,$p;Ht[45]=62;Ht[95]=63;function nf(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 Zh(t){var e=nf(t),r=e[0],n=e[1];return(r+n)*3/4-n}function eg(t,e,r){return(e+r)*3/4-r}function tg(t){var e,r=nf(t),n=r[0],i=r[1],s=new Qh(eg(t,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=Ht[t.charCodeAt(u)]<<18|Ht[t.charCodeAt(u+1)]<<12|Ht[t.charCodeAt(u+2)]<<6|Ht[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Ht[t.charCodeAt(u)]<<2|Ht[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Ht[t.charCodeAt(u)]<<10|Ht[t.charCodeAt(u+1)]<<4|Ht[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function rg(t){return yr[t>>18&63]+yr[t>>12&63]+yr[t>>6&63]+yr[t&63]}function ng(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(rg(n));return i.join("")}function ig(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(ng(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],i.push(yr[e>>2]+yr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(yr[e>>10]+yr[e>>4&63]+yr[e<<2&63]+"=")),i.join("")}var sl={byteLength:Kh,toByteArray:Jh,fromByteArray:Xh},og=function(t,e,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,f=u>>1,g=-7,h=r?i-1:0,v=r?-1:1,_=t[e+h];for(h+=v,s=_&(1<<-g)-1,_>>=-g,g+=c;g>0;s=s*256+t[e+h],h+=v,g-=8);for(o=s&(1<<-g)-1,s>>=-g,g+=n;g>0;o=o*256+t[e+h],h+=v,g-=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)},sg=function(t,e,r,n,i,s){var o,c,u,f=s*8-i-1,g=(1<<f)-1,h=g>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,m=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=g):(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>=g?(c=0,o=g):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,_+=m,c/=256,i-=8);for(o=o<<i|c,f+=i;f>0;t[r+_]=o&255,_+=m,o/=256,f-=8);t[r+_-m]|=y*128},ui={read:og,write:sg},Ts=qh(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 g(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(Pe(a,ArrayBuffer)||a&&Pe(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pe(a,SharedArrayBuffer)||a&&Pe(a.buffer,SharedArrayBuffer)))return m(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 g(a){return u(a),s(a<0?0:T(a)|0)}o.allocUnsafe=function(a){return g(a)},o.allocUnsafeSlow=function(a){return g(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:T(a.length)|0,p=s(l),I=0;I<l;I+=1)p[I]=a[I]&255;return p}function _(a){if(Pe(a,Uint8Array)){var l=new Uint8Array(a);return m(l.buffer,l.byteOffset,l.byteLength)}return v(a)}function m(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=T(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"||$r(a.length)?s(0):v(a);if(a.type==="Buffer"&&Array.isArray(a.data))return v(a.data)}function T(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(Pe(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),Pe(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(Pe(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)||Pe(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 Te(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 Bt(this,l,p);case"base64":return Jt(this,l,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(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(Pe(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),St=this.slice(I,N),Ct=a.slice(l,p),le=0;le<te;++le)if(St[le]!==Ct[le]){L=St[le],W=Ct[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,$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 l=="string"&&(l=o.from(l,I)),o.isBuffer(l))return l.length===0?-1:Ut(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):Ut(a,[l],p,I,N);throw new TypeError("val must be string, number or Buffer")}function Ut(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 St(X,ie){return L===1?X[ie]:X.readUInt16BE(ie*L)}var Ct;if(N){var le=-1;for(Ct=p;Ct<W;Ct++)if(St(a,Ct)===St(l,le===-1?0:Ct-le)){if(le===-1&&(le=Ct),Ct-le+1===te)return le*L}else le!==-1&&(Ct-=Ct-le),le=-1}else for(p+te>W&&(p=W-te),Ct=p;Ct>=0;Ct--){for(var z=!0,ft=0;ft<te;ft++)if(St(a,Ct+ft)!==St(l,ft)){z=!1;break}if(z)return Ct}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($r(te))return W;a[p+W]=te}return W}function j(a,l,p,I){return Mn(kn(l,a.length-p),a,p,I)}function ot(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 j(this,a,l,p);case"ascii":case"latin1":case"binary":return ot(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?sl.fromByteArray(a):sl.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 St,Ct,le,z;switch(te){case 1:L<128&&(W=L);break;case 2:St=a[N+1],(St&192)===128&&(z=(L&31)<<6|St&63,z>127&&(W=z));break;case 3:St=a[N+1],Ct=a[N+2],(St&192)===128&&(Ct&192)===128&&(z=(L&15)<<12|(St&63)<<6|Ct&63,z>2047&&(z<55296||z>57343)&&(W=z));break;case 4:St=a[N+1],Ct=a[N+2],le=a[N+3],(St&192)===128&&(Ct&192)===128&&(le&192)===128&&(z=(L&15)<<18|(St&63)<<12|(Ct&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 Ce(I)}var pe=4096;function Ce(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 Bt(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 Te(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+=rs[a[L]];return N}function pt(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 ar(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||ar(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||ar(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 sl.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 Pe(a,l){return a instanceof l||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===l.name}function $r(a){return a!==a}var rs=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=Ts.Buffer;Ts.SlowBuffer;Ts.INSPECT_MAX_BYTES;Ts.kMaxLength;var pl=function(t,e){return pl=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])},pl(t,e)};function xs(t,e){pl(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var mn=function(t){xs(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),Fe=function(t){xs(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 ws(t){return t&&t.Math==Math&&t}function of(){return ws(typeof globalThis=="object"&&globalThis)||ws(typeof window=="object"&&window)||ws(typeof self=="object"&&self)||ws(typeof global=="object"&&global)||Function("return this")()}function ag(){var t=of();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var cg=function(t){var e=ag()?"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},lg=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))}:cg}},sf=lg();function ug(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function ml(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function pg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function fg(t){return uo(t)&&Object.prototype.toString.call(t)==="[object Date]"}function uo(t){return typeof t=="object"&&t!==null}function Cs(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 Is(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(ug(t))return Ee.from(t);throw new Fe("Must use either Buffer or TypedArray")}var mg=/^(?:[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,af=function(t){return typeof t=="string"&&mg.test(t)},fl=function(t){if(!af(t))throw new Fe('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")},jp=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")},eI=Math.pow(2,63)-1,tI=-Math.pow(2,63),dg=Math.pow(2,53),hg=-Math.pow(2,53),cf=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 Fe("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=Is(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Fe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Fe("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 Fe("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(Is(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 Wp(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=fl(e.$uuid)),!n)throw new Fe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===cf?new Wp(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 al=16,Wp=function(t){xs(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===al)i=Is(r);else if(typeof r=="string")i=fl(r);else throw new Fe("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,cf)||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=jp(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=jp(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=sf(al);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"?af(r):ml(r)?r.length!==al?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=fl(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),Ds=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(Ds.prototype,"_bsontype",{value:"Code"});function gg(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 Ft=void 0;try{Ft=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 Gp=65536,yg=1<<24,fi=Gp*Gp,lf=fi*fi,Vp=lf/2,zp={},Yp={},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=Yp[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Yp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=zp[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(zp[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>=lf)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Vp)return t.MIN_VALUE;if(e+1>=Vp)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 g=t.fromNumber(Math.pow(n,u));o=o.mul(g).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,g=0,h=0,v=0,_=0;return _+=s+f,v+=_>>>16,_&=65535,v+=i+u,h+=v>>>16,v&=65535,h+=n+c,g+=h>>>16,h&=65535,g+=r+o,g&=65535,t.fromBits(v<<16|_,g<<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(Ft){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Ft.div_u:Ft.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.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),g=f.mul(e);g.isNegative()||g.gt(i);)n-=u,f=t.fromNumber(n,this.unsigned),g=f.mul(e);f.isZero()&&(f=t.ONE),s=s.add(f),i=i.sub(g)}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)),Ft){var r=(this.unsigned?Ft.rem_u:Ft.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.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)),Ft){var r=Ft.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.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,g=e.low&65535,h=0,v=0,_=0,m=0;return m+=o*g,_+=m>>>16,m&=65535,_+=s*g,v+=_>>>16,_&=65535,_+=o*f,v+=_>>>16,_&=65535,v+=i*g,h+=v>>>16,v&=65535,v+=s*f,h+=v>>>16,v&=65535,v+=o*u,h+=v>>>16,v&=65535,h+=n*g+i*f+s*u+o*c,h&=65535,t.fromBits(_<<16|m,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,g=f.toString(e);if(o=u,o.isZero())return g+c;for(;g.length<6;)g="0"+g;c=""+g+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(yg),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 vg=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,_g=/^(\+|-)?(Infinity|inf)$/i,Eg=/^(\+|-)?NaN$/i,ao=6111,cl=-6176,qp=6176,Sg=34,ll=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Kp=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Jp=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),bg=/^([-+])?(\d+)?$/,wg=31,Xp=16383,Ig=30,Tg=31;function Qp(t){return!isNaN(parseInt(t,10))}function xg(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 Cg(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 Dg(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 Fe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var dl=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(ml(e)){if(e.byteLength!==16)throw new Fe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Fe("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,g=[0],h=0,v=0,_=0,m=0,y=0,T=0,O=new K(0,0),H=new K(0,0),R=0,k=0;if(e.length>=7e3)throw new Fe(""+e+" not a valid Decimal128 string");var V=e.match(vg),Ut=e.match(_g),de=e.match(Eg);if(!V&&!Ut&&!de||e.length===0)throw new Fe(""+e+" not a valid Decimal128 string");if(V){var j=V[2],ot=V[4],Y=V[5],st=V[6];ot&&st===void 0&&pi(e,"missing exponent power"),ot&&j===void 0&&pi(e,"missing exponent base"),ot===void 0&&(Y||st)&&pi(e,"missing e before exponent")}if((e[k]==="+"||e[k]==="-")&&(r=e[k++]==="-"),!Qp(e[k])&&e[k]!=="."){if(e[k]==="i"||e[k]==="I")return new t(Ee.from(r?Kp:Jp));if(e[k]==="N")return new t(Ee.from(ll))}for(;Qp(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,g[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 Fe(""+e+" not a valid Decimal128 string");if(e[k]==="e"||e[k]==="E"){var Jt=e.substr(++k).match(bg);if(!Jt||!Jt[2])return new t(Ee.from(ll));y=parseInt(Jt[0],10),k=k+Jt[0].length}if(e[k])return new t(Ee.from(ll));if(_=0,!h)_=0,m=0,g[0]=0,c=1,h=1,s=0;else if(m=h-1,s=c,s!==1)for(;g[f+s-1]===0;)s=s-1;for(y<=u&&u-y>16384?y=cl:y=y-u;y>ao;){if(m=m+1,m-_>Sg){var me=g.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}y=y-1}for(;y<cl||h<c;){if(m===0&&s<h){y=cl,s=0;break}if(h<c?c=c-1:m=m-1,y<ao)y=y+1;else{var me=g.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}}if(m-_+1<s){var pe=o;n&&(f=f+1,pe=pe+1),r&&(f=f+1,pe=pe+1);var Ce=parseInt(e[f+m+1],10),be=0;if(Ce>=5&&(be=1,Ce===5)){for(be=g[m]%2===1?1:0,T=f+m+2;T<pe;T++)if(parseInt(e[T],10)){be=1;break}}if(be){for(var Bt=m;Bt>=0;Bt--)if(++g[Bt]>9&&(g[Bt]=0,Bt===0))if(y<ao)y=y+1,g[Bt]=1;else return new t(Ee.from(r?Kp:Jp))}}if(O=K.fromNumber(0),H=K.fromNumber(0),s===0)O=K.fromNumber(0),H=K.fromNumber(0);else if(m-_<17){var Bt=_;for(H=K.fromNumber(g[Bt++]),O=new K(0,0);Bt<=m;Bt++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(g[Bt]))}else{var Bt=_;for(O=K.fromNumber(g[Bt++]);Bt<=m-17;Bt++)O=O.multiply(K.fromNumber(10)),O=O.add(K.fromNumber(g[Bt]));for(H=K.fromNumber(g[Bt++]);Bt<=m;Bt++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(g[Bt]))}var Te=Cg(O,K.fromString("100000000000000000"));Te.low=Te.low.add(H),Dg(Te.low,H)&&(Te.high=Te.high.add(K.fromNumber(1))),R=y+qp;var pt={low:K.fromNumber(0),high:K.fromNumber(0)};Te.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(pt.high=pt.high.or(K.fromNumber(3).shiftLeft(61)),pt.high=pt.high.or(K.fromNumber(R).and(K.fromNumber(16383).shiftLeft(47))),pt.high=pt.high.or(Te.high.and(K.fromNumber(0x7fffffffffff)))):(pt.high=pt.high.or(K.fromNumber(R&16383).shiftLeft(49)),pt.high=pt.high.or(Te.high.and(K.fromNumber(562949953421311)))),pt.low=Te.low,r&&(pt.high=pt.high.or(K.fromString("9223372036854775808")));var Q=Ee.alloc(16);return k=0,Q[k++]=pt.low.low&255,Q[k++]=pt.low.low>>8&255,Q[k++]=pt.low.low>>16&255,Q[k++]=pt.low.low>>24&255,Q[k++]=pt.low.high&255,Q[k++]=pt.low.high>>8&255,Q[k++]=pt.low.high>>16&255,Q[k++]=pt.low.high>>24&255,Q[k++]=pt.high.low&255,Q[k++]=pt.high.low>>8&255,Q[k++]=pt.high.low>>16&255,Q[k++]=pt.high.low>>24&255,Q[k++]=pt.high.high&255,Q[k++]=pt.high.high>>8&255,Q[k++]=pt.high.high>>16&255,Q[k++]=pt.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,g,h=[];s=0;var v=this.bytes,_=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,m=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,y=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,T=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24;s=0;var O={low:new K(_,m),high:new K(y,T)};O.high.lessThan(K.ZERO)&&h.push("-");var H=T>>26&wg;if(H>>3===3){if(H===Ig)return h.join("")+"Infinity";if(H===Tg)return"NaN";e=T>>15&Xp,c=8+(T>>14&1)}else c=T>>14&7,e=T>>17&Xp;var R=e-qp;if(u.parts[0]=(T&16383)+((c&15)<<14),u.parts[1]=y,u.parts[2]=m,u.parts[3]=_,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)o=!0;else for(g=3;g>=0;g--){var k=0,V=xg(u);if(u=V.quotient,k=V.rem.low,!!k)for(f=8;f>=0;f--)n[g*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 Ut=r-1+R;if(Ut>=34||Ut<=-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"),Ut>0?h.push("+".concat(Ut)):h.push("".concat(Ut))}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(dl.prototype,"_bsontype",{value:"Decimal128"});var Rs=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(Rs.prototype,"_bsontype",{value:"Double"});var Ns=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(Ns.prototype,"_bsontype",{value:"Int32"});var hl=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(hl.prototype,"_bsontype",{value:"MaxKey"});var gl=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(gl.prototype,"_bsontype",{value:"MinKey"});var Rg=new RegExp("^[0-9a-fA-F]{24}$"),fn=null,gr=Symbol("id"),Xe=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 Fe("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[gr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[gr]=r instanceof Ee?r:Is(r);else if(typeof r=="string")if(r.length===12){var n=Ee.from(r);if(n.byteLength===12)this[gr]=n;else throw new Fe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Rg.test(r))this[gr]=Ee.from(r,"hex");else throw new Fe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Fe("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[gr]},set:function(e){this[gr]=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=sf(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[gr][11]===e[gr][11]&&this[gr].equals(e[gr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&ml(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 Fe("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(Xe.prototype,"generate",{value:Cs(function(t){return Xe.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Xe.prototype,"getInc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe.prototype,"get_inc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe,"get_inc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe.prototype,"_bsontype",{value:"ObjectID"});function Ng(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=Ng(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 Fe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(lo.prototype,"_bsontype",{value:"BSONRegExp"});var yl=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(yl.prototype,"_bsontype",{value:"Symbol"});var Ag=K,uf=function(t){xs(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}(Ag);function Og(t){return uo(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var pf=2147483647,ff=-2147483648,mf=9223372036854776e3,df=-9223372036854776e3,Pg={$oid:Xe,$binary:dn,$uuid:dn,$symbol:yl,$numberInt:Ns,$numberDecimal:dl,$numberDouble:Rs,$numberLong:K,$minKey:gl,$maxKey:hl,$regex:lo,$regularExpression:lo,$timestamp:uf};function hf(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=ff&&t<=pf)return new Ns(t);if(t>=df&&t<=mf)return K.fromNumber(t)}return new Rs(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=Pg[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=hf(t.$scope)),Ds.fromExtendedJSON(t)}if(gg(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("$")}),g=!0;if(f.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(g=!1)}),g)return co.fromExtendedJSON(u)}return t}function Lg(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Jr(r,e)}finally{e.seenObjects.pop()}})}function Zp(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Jr(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 Fe(`Converting circular structure to EJSON:
19
+ `)};dt.prototype.renderPartial=function(t,e,r,n){if(r){var i=this.getConfigTags(n),s=zc(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 g=this.parse(f,i);return this.renderTokens(g,e,r,f,n)}}};dt.prototype.unescapedValue=function(t,e){var r=e.lookup(t[1]);if(r!=null)return r};dt.prototype.escapedValue=function(t,e,r){var n=this.getConfigEscape(r)||Mt.escape,i=e.lookup(t[1]);if(i!=null)return typeof i=="number"&&n===Mt.escape?String(i):n(i)};dt.prototype.rawValue=function(t){return t[1]};dt.prototype.getConfigTags=function(t){return qn(t)?t:t&&typeof t=="object"?t.tags:void 0};dt.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!qn(t))return t.escape};var Mt={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 dt;Mt.clearCache=function(){return Zi.clearCache()};Mt.parse=function(t,e){return Zi.parse(t,e)};Mt.render=function(t,e,r,n){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Dh(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Zi.render(t,e,r,n)};Mt.escape=Bh;Mt.Scanner=eo;Mt.Context=Yn;Mt.Writer=dt;var er=Mt,Up=Xt(Bp()),Nt=class Un{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new Up.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"},qc=Xt(kp());function Kn(t){return qc.default.createInstance({name:"lc",storeName:t,driver:qc.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}},at=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}},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 Mp{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 Mp),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 at.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)}},ns=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}},kt=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=je.get(),i=r.shopCurrencyCode??n.currency,s=r.currencyCode,o=n.money?.format??r.moneyFormat,c;return o&&i===s?c=ns.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 kt.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 Xn(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var wt=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}},is=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}},os=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=t.d}},Kc=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 is(e))??[],this.link=t.link,this.price=new os(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,t.sellingPlans?.length&&(this.selectedSellingPlan=Zt(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let r=new Kc(e);return r.isSelected&&(this.selectedSellingPlan.value=r),r})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}},It=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;selectedOrFirstVariant;selected=Zt(!0);constructor(t){this.update(t),this.selectedOrFirstVariant=Zt(this.selectedVariant)}get imageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}update(t){return this.id=t.id,this.mID=t.mID,this.name=t.name,this.status=t.status,this.ctg=t.ctg,this.imgs=t.imgs,this.desc=t.desc,this.sDesc=t.sDesc,this.link=t.link,this.slug=t.slug,this.quantity=t.quantity,this.meta=t.meta,this.category=t.category,this.videos=t.videos,this.portraitVideos=t.videos?.filter(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 wt({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})}},ss=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}},Jc=class{enabled;constructor(t){this.enabled=t.enabled}},Xc=class extends Jc{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},as=class{productQuantity;constructor(t){t??={},this.productQuantity=new Xc(t.productQuantity)}},nn=class{s;g;i;constructor(t){t.s&&(this.s=new We(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",Wh=`#?[${no}]{3}[${no}]?`,Gh=`#?[${no}]{6}([${no}]{2})?`,Vh=new RegExp(`[^#${no}]`,"gi"),zh=new RegExp(`^${Wh}$|^${Gh}$`,"i");function Qc(t,e={}){if(typeof t!="string"||Vh.test(t)||!zh.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 We=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 Qc(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 We(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Fp[this.s??1]}},Fp=(t=>(t[t.SOLID=1]="SOLID",t[t.DASHED=2]="DASHED",t))(Fp||{}),ro=class bd{static DEFAULT_FALLBACK=new We({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new We(e.c)),e.fb&&(this.fb=new We(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??bd.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 We(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}},At=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 Le[this.t]}get click(){return this.clc}},Le=(t=>(t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.BUTTON=3]="BUTTON",t[t.FLEXBOX=4]="FLEXBOX",t[t.MULTI_COLUMN=5]="MULTI_COLUMN",t[t.CHECKBOX=6]="CHECKBOX",t[t.PRODUCTS=11]="PRODUCTS",t[t.PRODUCT=12]="PRODUCT",t[t.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",t[t.PRODUCT_TITLE=14]="PRODUCT_TITLE",t[t.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",t[t.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",t[t.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",t[t.EMAIL_INPUT=51]="EMAIL_INPUT",t[t.PHONE_INPUT=52]="PHONE_INPUT",t[t.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",t[t.CAROUSEL=62]="CAROUSEL",t[t.SHAPE=100]="SHAPE",t))(Le||{}),an=class extends At{constructor(t){super(t)}},Or=class extends At{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||{}),cs=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 Zc(e))}},Zc=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')`}},it=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 We(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new We(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new cs(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}},hr=class extends At{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 it(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}},ls=class extends At{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}},us=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new We(t.c??{})}get text(){return this.txt}get color(){return this.c}},qr=class extends hr{ph;constructor(t){super(t),this.ph=new us(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||{}),ps=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 At{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 ps(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}`}},fs=class extends oo{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new ls(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}},ms=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}},ds=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}},hs=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Ar(t.spc),t.size&&(this.size=new ds(t.size)),t.bg&&(this.bg=new nn(t.bg)),t.br&&(this.br=new on(t.br)),t.typo&&(this.typo=new it(t.typo)),t.lout&&(this.lout=new ms(t.lout)),t.flex&&(this.flex=new oi(t.flex))}},si=class{sm;lg;constructor(t){t??={},this.sm=new hs(t.sm),this.lg=new hs(t.lg)}},ct=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 Le[this.t]}},ze=class extends ct{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 ct{value;constructor(t){super(6,t),t??={},this.value=t.value}},ci=class extends ze{constructor(t=15,e){super(e,t)}},Hp=Xt(tn()),el=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new We(t.color)}},tl=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new We(t.color)}},so=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(t){t??={},this.navigation=new tl(t.navigation),this.pagination=new el(t.pagination),this.autoplay=t.autoplay,this.slidesPerView=t.slidesPerView??1,this.maxInRow=t.maxInRow??t.slidesPerView??4,this.gap=t.gap??0}},gs=class extends ct{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Ot.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new so(t.conf),this.allowedTypes=t.allowedTypes}},ys=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 ct{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(e=>{let r=Ot.getParsedElement(e);r&&this.elems.push(r)})}},un=class extends ct{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}},Ot=class wd{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=wd.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 vs(e);case 12:return new gr(e);case 61:return new ys(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 gs(e);default:Hp.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 ct{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=Ot.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 it(Z(b({},n.style.lg.typo),{td:"line-through"})),n.style.sm.typo=new it(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:Ot.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))}},vs=class extends ct{conf;prod;constructor(t){super(11,t),t??={},this.conf=new rl(t.conf),this.prod=new gr(t.prod)}},_s=class extends so{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},rl=class{lg;sm;constructor(t){t??={},this.lg=new _s(t.lg),this.sm=new _s(t.sm)}},Es=class extends Kr{constructor(t){super(t)}},li=class{cont;elems=[];constructor(t){t=t??{},this.cont=new Es(t.cont),t.elems?.forEach(e=>{this.addRawElement(e)})}addRawElement(t){let e=Ot.getParsedElement(t);return e&&this.elems.push(e),e}},nl=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 wt(e))}},Ss=class{layout;milestones;constructor(t){this.layout=t.layout??Ic.ICONS,this.milestones=t.milestones?.map(e=>new nl(e))??[]}},bs=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}},il=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}},Pt=class Ed extends il{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=Zt({});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 wt(r)),this.items=e.items?.map(r=>new It(r))??[],this.nonMutableItems=e.items?.map(r=>new It(r))??[],this.collections=e.collections?.map(r=>new ss(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 as(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new Ss(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new bs(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new It(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=er.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 fs(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 je.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=>Ed.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Nt.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 qh(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Kh=Zh,Jh=tg,Xh=ig,vr=[],Ht=[],Qh=typeof Uint8Array<"u"?Uint8Array:Array,ol="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,$p=ol.length;pn<$p;++pn)vr[pn]=ol[pn],Ht[ol.charCodeAt(pn)]=pn;var pn,$p;Ht[45]=62;Ht[95]=63;function nf(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 Zh(t){var e=nf(t),r=e[0],n=e[1];return(r+n)*3/4-n}function eg(t,e,r){return(e+r)*3/4-r}function tg(t){var e,r=nf(t),n=r[0],i=r[1],s=new Qh(eg(t,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=Ht[t.charCodeAt(u)]<<18|Ht[t.charCodeAt(u+1)]<<12|Ht[t.charCodeAt(u+2)]<<6|Ht[t.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Ht[t.charCodeAt(u)]<<2|Ht[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Ht[t.charCodeAt(u)]<<10|Ht[t.charCodeAt(u+1)]<<4|Ht[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function rg(t){return vr[t>>18&63]+vr[t>>12&63]+vr[t>>6&63]+vr[t&63]}function ng(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(rg(n));return i.join("")}function ig(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(ng(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 sl={byteLength:Kh,toByteArray:Jh,fromByteArray:Xh},og=function(t,e,r,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,f=u>>1,g=-7,h=r?i-1:0,v=r?-1:1,_=t[e+h];for(h+=v,s=_&(1<<-g)-1,_>>=-g,g+=c;g>0;s=s*256+t[e+h],h+=v,g-=8);for(o=s&(1<<-g)-1,s>>=-g,g+=n;g>0;o=o*256+t[e+h],h+=v,g-=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)},sg=function(t,e,r,n,i,s){var o,c,u,f=s*8-i-1,g=(1<<f)-1,h=g>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,m=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=g):(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>=g?(c=0,o=g):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,_+=m,c/=256,i-=8);for(o=o<<i|c,f+=i;f>0;t[r+_]=o&255,_+=m,o/=256,f-=8);t[r+_-m]|=y*128},ui={read:og,write:sg},Ts=qh(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 g(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(Pe(a,ArrayBuffer)||a&&Pe(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pe(a,SharedArrayBuffer)||a&&Pe(a.buffer,SharedArrayBuffer)))return m(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 g(a){return u(a),s(a<0?0:T(a)|0)}o.allocUnsafe=function(a){return g(a)},o.allocUnsafeSlow=function(a){return g(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:T(a.length)|0,p=s(l),I=0;I<l;I+=1)p[I]=a[I]&255;return p}function _(a){if(Pe(a,Uint8Array)){var l=new Uint8Array(a);return m(l.buffer,l.byteOffset,l.byteLength)}return v(a)}function m(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=T(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 T(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(Pe(a,Uint8Array)&&(a=o.from(a,a.offset,a.byteLength)),Pe(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(Pe(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)||Pe(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 Te(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 Bt(this,l,p);case"base64":return Jt(this,l,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(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(Pe(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),bt=this.slice(I,N),Ct=a.slice(l,p),le=0;le<te;++le)if(bt[le]!==Ct[le]){L=bt[le],W=Ct[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:Ut(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):Ut(a,[l],p,I,N);throw new TypeError("val must be string, number or Buffer")}function Ut(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 bt(X,ie){return L===1?X[ie]:X.readUInt16BE(ie*L)}var Ct;if(N){var le=-1;for(Ct=p;Ct<W;Ct++)if(bt(a,Ct)===bt(l,le===-1?0:Ct-le)){if(le===-1&&(le=Ct),Ct-le+1===te)return le*L}else le!==-1&&(Ct-=Ct-le),le=-1}else for(p+te>W&&(p=W-te),Ct=p;Ct>=0;Ct--){for(var z=!0,ft=0;ft<te;ft++)if(bt(a,Ct+ft)!==bt(l,ft)){z=!1;break}if(z)return Ct}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 j(a,l,p,I){return Mn(kn(l,a.length-p),a,p,I)}function ot(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 j(this,a,l,p);case"ascii":case"latin1":case"binary":return ot(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?sl.fromByteArray(a):sl.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 bt,Ct,le,z;switch(te){case 1:L<128&&(W=L);break;case 2:bt=a[N+1],(bt&192)===128&&(z=(L&31)<<6|bt&63,z>127&&(W=z));break;case 3:bt=a[N+1],Ct=a[N+2],(bt&192)===128&&(Ct&192)===128&&(z=(L&15)<<12|(bt&63)<<6|Ct&63,z>2047&&(z<55296||z>57343)&&(W=z));break;case 4:bt=a[N+1],Ct=a[N+2],le=a[N+3],(bt&192)===128&&(Ct&192)===128&&(le&192)===128&&(z=(L&15)<<18|(bt&63)<<12|(Ct&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 Ce(I)}var pe=4096;function Ce(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 Bt(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 Te(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+=rs[a[L]];return N}function pt(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 sl.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 Pe(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 rs=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=Ts.Buffer;Ts.SlowBuffer;Ts.INSPECT_MAX_BYTES;Ts.kMaxLength;var pl=function(t,e){return pl=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])},pl(t,e)};function xs(t,e){pl(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var mn=function(t){xs(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),Fe=function(t){xs(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 ws(t){return t&&t.Math==Math&&t}function of(){return ws(typeof globalThis=="object"&&globalThis)||ws(typeof window=="object"&&window)||ws(typeof self=="object"&&self)||ws(typeof global=="object"&&global)||Function("return this")()}function ag(){var t=of();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var cg=function(t){var e=ag()?"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},lg=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))}:cg}},sf=lg();function ug(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function ml(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function pg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function fg(t){return uo(t)&&Object.prototype.toString.call(t)==="[object Date]"}function uo(t){return typeof t=="object"&&t!==null}function Cs(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 Is(t){if(ArrayBuffer.isView(t))return Ee.from(t.buffer,t.byteOffset,t.byteLength);if(ug(t))return Ee.from(t);throw new Fe("Must use either Buffer or TypedArray")}var mg=/^(?:[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,af=function(t){return typeof t=="string"&&mg.test(t)},fl=function(t){if(!af(t))throw new Fe('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")},jp=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")},tI=Math.pow(2,63)-1,rI=-Math.pow(2,63),dg=Math.pow(2,53),hg=-Math.pow(2,53),cf=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 Fe("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=Is(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Fe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Fe("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 Fe("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(Is(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 Wp(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=fl(e.$uuid)),!n)throw new Fe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===cf?new Wp(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 al=16,Wp=function(t){xs(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===al)i=Is(r);else if(typeof r=="string")i=fl(r);else throw new Fe("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,cf)||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=jp(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=jp(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=sf(al);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"?af(r):ml(r)?r.length!==al?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=fl(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),Ds=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(Ds.prototype,"_bsontype",{value:"Code"});function gg(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 Ft=void 0;try{Ft=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 Gp=65536,yg=1<<24,fi=Gp*Gp,lf=fi*fi,Vp=lf/2,zp={},Yp={},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=Yp[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),s&&(Yp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(i=zp[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),s&&(zp[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>=lf)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Vp)return t.MIN_VALUE;if(e+1>=Vp)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 g=t.fromNumber(Math.pow(n,u));o=o.mul(g).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,g=0,h=0,v=0,_=0;return _+=s+f,v+=_>>>16,_&=65535,v+=i+u,h+=v>>>16,v&=65535,h+=n+c,g+=h>>>16,h&=65535,g+=r+o,g&=65535,t.fromBits(v<<16|_,g<<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(Ft){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Ft.div_u:Ft.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.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),g=f.mul(e);g.isNegative()||g.gt(i);)n-=u,f=t.fromNumber(n,this.unsigned),g=f.mul(e);f.isZero()&&(f=t.ONE),s=s.add(f),i=i.sub(g)}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)),Ft){var r=(this.unsigned?Ft.rem_u:Ft.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.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)),Ft){var r=Ft.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Ft.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,g=e.low&65535,h=0,v=0,_=0,m=0;return m+=o*g,_+=m>>>16,m&=65535,_+=s*g,v+=_>>>16,_&=65535,_+=o*f,v+=_>>>16,_&=65535,v+=i*g,h+=v>>>16,v&=65535,v+=s*f,h+=v>>>16,v&=65535,v+=o*u,h+=v>>>16,v&=65535,h+=n*g+i*f+s*u+o*c,h&=65535,t.fromBits(_<<16|m,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,g=f.toString(e);if(o=u,o.isZero())return g+c;for(;g.length<6;)g="0"+g;c=""+g+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(yg),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 vg=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,_g=/^(\+|-)?(Infinity|inf)$/i,Eg=/^(\+|-)?NaN$/i,ao=6111,cl=-6176,qp=6176,Sg=34,ll=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Kp=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Jp=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),bg=/^([-+])?(\d+)?$/,wg=31,Xp=16383,Ig=30,Tg=31;function Qp(t){return!isNaN(parseInt(t,10))}function xg(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 Cg(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 Dg(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 Fe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var dl=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(ml(e)){if(e.byteLength!==16)throw new Fe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Fe("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,g=[0],h=0,v=0,_=0,m=0,y=0,T=0,O=new K(0,0),H=new K(0,0),R=0,k=0;if(e.length>=7e3)throw new Fe(""+e+" not a valid Decimal128 string");var V=e.match(vg),Ut=e.match(_g),de=e.match(Eg);if(!V&&!Ut&&!de||e.length===0)throw new Fe(""+e+" not a valid Decimal128 string");if(V){var j=V[2],ot=V[4],Y=V[5],st=V[6];ot&&st===void 0&&pi(e,"missing exponent power"),ot&&j===void 0&&pi(e,"missing exponent base"),ot===void 0&&(Y||st)&&pi(e,"missing e before exponent")}if((e[k]==="+"||e[k]==="-")&&(r=e[k++]==="-"),!Qp(e[k])&&e[k]!=="."){if(e[k]==="i"||e[k]==="I")return new t(Ee.from(r?Kp:Jp));if(e[k]==="N")return new t(Ee.from(ll))}for(;Qp(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,g[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 Fe(""+e+" not a valid Decimal128 string");if(e[k]==="e"||e[k]==="E"){var Jt=e.substr(++k).match(bg);if(!Jt||!Jt[2])return new t(Ee.from(ll));y=parseInt(Jt[0],10),k=k+Jt[0].length}if(e[k])return new t(Ee.from(ll));if(_=0,!h)_=0,m=0,g[0]=0,c=1,h=1,s=0;else if(m=h-1,s=c,s!==1)for(;g[f+s-1]===0;)s=s-1;for(y<=u&&u-y>16384?y=cl:y=y-u;y>ao;){if(m=m+1,m-_>Sg){var me=g.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}y=y-1}for(;y<cl||h<c;){if(m===0&&s<h){y=cl,s=0;break}if(h<c?c=c-1:m=m-1,y<ao)y=y+1;else{var me=g.join("");if(me.match(/^0+$/)){y=ao;break}pi(e,"overflow")}}if(m-_+1<s){var pe=o;n&&(f=f+1,pe=pe+1),r&&(f=f+1,pe=pe+1);var Ce=parseInt(e[f+m+1],10),be=0;if(Ce>=5&&(be=1,Ce===5)){for(be=g[m]%2===1?1:0,T=f+m+2;T<pe;T++)if(parseInt(e[T],10)){be=1;break}}if(be){for(var Bt=m;Bt>=0;Bt--)if(++g[Bt]>9&&(g[Bt]=0,Bt===0))if(y<ao)y=y+1,g[Bt]=1;else return new t(Ee.from(r?Kp:Jp))}}if(O=K.fromNumber(0),H=K.fromNumber(0),s===0)O=K.fromNumber(0),H=K.fromNumber(0);else if(m-_<17){var Bt=_;for(H=K.fromNumber(g[Bt++]),O=new K(0,0);Bt<=m;Bt++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(g[Bt]))}else{var Bt=_;for(O=K.fromNumber(g[Bt++]);Bt<=m-17;Bt++)O=O.multiply(K.fromNumber(10)),O=O.add(K.fromNumber(g[Bt]));for(H=K.fromNumber(g[Bt++]);Bt<=m;Bt++)H=H.multiply(K.fromNumber(10)),H=H.add(K.fromNumber(g[Bt]))}var Te=Cg(O,K.fromString("100000000000000000"));Te.low=Te.low.add(H),Dg(Te.low,H)&&(Te.high=Te.high.add(K.fromNumber(1))),R=y+qp;var pt={low:K.fromNumber(0),high:K.fromNumber(0)};Te.high.shiftRightUnsigned(49).and(K.fromNumber(1)).equals(K.fromNumber(1))?(pt.high=pt.high.or(K.fromNumber(3).shiftLeft(61)),pt.high=pt.high.or(K.fromNumber(R).and(K.fromNumber(16383).shiftLeft(47))),pt.high=pt.high.or(Te.high.and(K.fromNumber(0x7fffffffffff)))):(pt.high=pt.high.or(K.fromNumber(R&16383).shiftLeft(49)),pt.high=pt.high.or(Te.high.and(K.fromNumber(562949953421311)))),pt.low=Te.low,r&&(pt.high=pt.high.or(K.fromString("9223372036854775808")));var Q=Ee.alloc(16);return k=0,Q[k++]=pt.low.low&255,Q[k++]=pt.low.low>>8&255,Q[k++]=pt.low.low>>16&255,Q[k++]=pt.low.low>>24&255,Q[k++]=pt.low.high&255,Q[k++]=pt.low.high>>8&255,Q[k++]=pt.low.high>>16&255,Q[k++]=pt.low.high>>24&255,Q[k++]=pt.high.low&255,Q[k++]=pt.high.low>>8&255,Q[k++]=pt.high.low>>16&255,Q[k++]=pt.high.low>>24&255,Q[k++]=pt.high.high&255,Q[k++]=pt.high.high>>8&255,Q[k++]=pt.high.high>>16&255,Q[k++]=pt.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,g,h=[];s=0;var v=this.bytes,_=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,m=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,y=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24,T=v[s++]|v[s++]<<8|v[s++]<<16|v[s++]<<24;s=0;var O={low:new K(_,m),high:new K(y,T)};O.high.lessThan(K.ZERO)&&h.push("-");var H=T>>26&wg;if(H>>3===3){if(H===Ig)return h.join("")+"Infinity";if(H===Tg)return"NaN";e=T>>15&Xp,c=8+(T>>14&1)}else c=T>>14&7,e=T>>17&Xp;var R=e-qp;if(u.parts[0]=(T&16383)+((c&15)<<14),u.parts[1]=y,u.parts[2]=m,u.parts[3]=_,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)o=!0;else for(g=3;g>=0;g--){var k=0,V=xg(u);if(u=V.quotient,k=V.rem.low,!!k)for(f=8;f>=0;f--)n[g*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 Ut=r-1+R;if(Ut>=34||Ut<=-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"),Ut>0?h.push("+".concat(Ut)):h.push("".concat(Ut))}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(dl.prototype,"_bsontype",{value:"Decimal128"});var Rs=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(Rs.prototype,"_bsontype",{value:"Double"});var Ns=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(Ns.prototype,"_bsontype",{value:"Int32"});var hl=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(hl.prototype,"_bsontype",{value:"MaxKey"});var gl=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(gl.prototype,"_bsontype",{value:"MinKey"});var Rg=new RegExp("^[0-9a-fA-F]{24}$"),fn=null,yr=Symbol("id"),Xe=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 Fe("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:Is(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 Fe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Rg.test(r))this[yr]=Ee.from(r,"hex");else throw new Fe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Fe("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=sf(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&&ml(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 Fe("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(Xe.prototype,"generate",{value:Cs(function(t){return Xe.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Xe.prototype,"getInc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe.prototype,"get_inc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe,"get_inc",{value:Cs(function(){return Xe.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Xe.prototype,"_bsontype",{value:"ObjectID"});function Ng(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=Ng(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 Fe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(lo.prototype,"_bsontype",{value:"BSONRegExp"});var yl=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(yl.prototype,"_bsontype",{value:"Symbol"});var Ag=K,uf=function(t){xs(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}(Ag);function Og(t){return uo(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var pf=2147483647,ff=-2147483648,mf=9223372036854776e3,df=-9223372036854776e3,Pg={$oid:Xe,$binary:dn,$uuid:dn,$symbol:yl,$numberInt:Ns,$numberDecimal:dl,$numberDouble:Rs,$numberLong:K,$minKey:gl,$maxKey:hl,$regex:lo,$regularExpression:lo,$timestamp:uf};function hf(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=ff&&t<=pf)return new Ns(t);if(t>=df&&t<=mf)return K.fromNumber(t)}return new Rs(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=Pg[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=hf(t.$scope)),Ds.fromExtendedJSON(t)}if(gg(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("$")}),g=!0;if(f.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(g=!1)}),g)return co.fromExtendedJSON(u)}return t}function Lg(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Jr(r,e)}finally{e.seenObjects.pop()}})}function Zp(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Jr(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 Fe(`Converting circular structure to EJSON:
20
20
  `+" ".concat(i).concat(s).concat(o).concat(c,`
21
- `)+" ".concat(u,"\\").concat(f,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Lg(t,e);if(t===void 0)return null;if(t instanceof Date||fg(t)){var g=t.getTime(),h=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:Zp(t)}:e.relaxed&&h?{$date:Zp(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var v=t>=ff&&t<=pf,_=t>=df&&t<=mf;if(v)return{$numberInt:t.toString()};if(_)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||pg(t)){var m=t.flags;if(m===void 0){var y=t.toString().match(/[gimuy]*$/);y&&(m=y[0])}var T=new lo(t.source,m);return T.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Ug(t,e):t}var Bg={Binary:function(t){return new dn(t.value(),t.sub_type)},Code:function(t){return new Ds(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 dl(t.bytes)},Double:function(t){return new Rs(t.value)},Int32:function(t){return new Ns(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 hl},MinKey:function(){return new gl},ObjectID:function(t){return new Xe(t)},ObjectId:function(t){return new Xe(t)},BSONRegExp:function(t){return new lo(t.pattern,t.options)},Symbol:function(t){return new yl(t.value)},Timestamp:function(t){return uf.fromBits(t.low,t.high)}};function Ug(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=Jr(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(Og(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var c=Bg[t._bsontype];if(!c)throw new Fe("Unrecognized or invalid _bsontype: "+t._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new Ds(o.code,Jr(o.scope,e)):r==="DBRef"&&o.oid&&(o=new co(Jr(o.collection,e),Jr(o.oid,e),Jr(o.db,e),Jr(o.fields,e))),o.toExtendedJSON(e)}else throw new mn("_bsontype must be a string, but was: "+typeof r)}var ef;(function(t){function e(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.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 hf(f,c)})}t.parse=e;function r(s,o,c,u){c!=null&&typeof c=="object"&&(u=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(u=o,o=void 0,c=0);var f=Object.assign({relaxed:!0,legacy:!1},u,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=Jr(s,f);return JSON.stringify(g,o,c)}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})(ef||(ef={}));var tf,rf=of();rf.Map?tf=rf.Map:tf=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 rI=K.fromNumber(dg),nI=K.fromNumber(hg),ul=new Uint8Array(8),iI=new DataView(ul.buffer,ul.byteOffset,ul.byteLength),Mg=1024*1024*17,oI=Ee.alloc(Mg),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 Xe(n):new Xe,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},It=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,e.appendChild(r)}},ae=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}},gf=Xt(vl()),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 gf.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)}},vr=class Sd{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 Sd(b({origin:location.origin,path:e,qs:location.search,referrer:po.getReferrer(),name:fe.get().pageName},po.getUTMParams()))}};function ce(t){return typeof t=="function"}function Os(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 Ps=Os(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription:
21
+ `)+" ".concat(u,"\\").concat(f,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return Lg(t,e);if(t===void 0)return null;if(t instanceof Date||fg(t)){var g=t.getTime(),h=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&h?{$date:t.getTime()}:{$date:Zp(t)}:e.relaxed&&h?{$date:Zp(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var v=t>=ff&&t<=pf,_=t>=df&&t<=mf;if(v)return{$numberInt:t.toString()};if(_)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||pg(t)){var m=t.flags;if(m===void 0){var y=t.toString().match(/[gimuy]*$/);y&&(m=y[0])}var T=new lo(t.source,m);return T.toExtendedJSON(e)}return t!=null&&typeof t=="object"?Ug(t,e):t}var Bg={Binary:function(t){return new dn(t.value(),t.sub_type)},Code:function(t){return new Ds(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 dl(t.bytes)},Double:function(t){return new Rs(t.value)},Int32:function(t){return new Ns(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 hl},MinKey:function(){return new gl},ObjectID:function(t){return new Xe(t)},ObjectId:function(t){return new Xe(t)},BSONRegExp:function(t){return new lo(t.pattern,t.options)},Symbol:function(t){return new yl(t.value)},Timestamp:function(t){return uf.fromBits(t.low,t.high)}};function Ug(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=Jr(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(Og(t)){var o=t;if(typeof o.toExtendedJSON!="function"){var c=Bg[t._bsontype];if(!c)throw new Fe("Unrecognized or invalid _bsontype: "+t._bsontype);o=c(o)}return r==="Code"&&o.scope?o=new Ds(o.code,Jr(o.scope,e)):r==="DBRef"&&o.oid&&(o=new co(Jr(o.collection,e),Jr(o.oid,e),Jr(o.db,e),Jr(o.fields,e))),o.toExtendedJSON(e)}else throw new mn("_bsontype must be a string, but was: "+typeof r)}var ef;(function(t){function e(s,o){var c=Object.assign({},{relaxed:!0,legacy:!1},o);return typeof c.relaxed=="boolean"&&(c.strict=!c.relaxed),typeof c.strict=="boolean"&&(c.relaxed=!c.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 hf(f,c)})}t.parse=e;function r(s,o,c,u){c!=null&&typeof c=="object"&&(u=c,c=0),o!=null&&typeof o=="object"&&!Array.isArray(o)&&(u=o,o=void 0,c=0);var f=Object.assign({relaxed:!0,legacy:!1},u,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=Jr(s,f);return JSON.stringify(g,o,c)}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})(ef||(ef={}));var tf,rf=of();rf.Map?tf=rf.Map:tf=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 nI=K.fromNumber(dg),iI=K.fromNumber(hg),ul=new Uint8Array(8),oI=new DataView(ul.buffer,ul.byteOffset,ul.byteLength),Mg=1024*1024*17,sI=Ee.alloc(Mg),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 Xe(n):new Xe,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},ht=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,e.appendChild(r)}},ae=class{static storage=new Map;static get(t){return this.storage.has(t)||this.storage.set(t,t.getInstance()),this.storage.get(t)}},gf=Xt(vl()),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 gf.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 Sd{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 Sd(b({origin:location.origin,path:e,qs:location.search,referrer:po.getReferrer(),name:fe.get().pageName},po.getUTMParams()))}};function ce(t){return typeof t=="function"}function Os(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 Ps=Os(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 $t=class Gu{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 Ps?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{yf(s)}catch(o){e=e??[],o instanceof Ps?e=[...e,...o.errors]:e.push(o)}}if(e)throw new Ps(e)}}add(e){var r;if(e&&e!==this)if(this.closed)yf(e);else{if(e instanceof Gu){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 Gu&&e._removeParent(this)}};$t.EMPTY=(()=>{let t=new $t;return t.closed=!0,t})();var _l=$t.EMPTY;function Ls(t){return t instanceof $t||t&&"closed"in t&&ce(t.remove)&&ce(t.add)&&ce(t.unsubscribe)}function yf(t){ce(t)?t():t.unsubscribe()}var er={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 Bs(t){di.setTimeout(()=>{let{onUnhandledError:e}=er;if(e)e(t);else throw t})}function El(){}var vf=Sl("C",void 0,void 0);function _f(t){return Sl("E",void 0,t)}function Ef(t){return Sl("N",t,void 0)}function Sl(t,e,r){return{kind:t,value:e,error:r}}var gn=null;function hi(t){if(er.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 Sf(t){er.useDeprecatedSynchronousErrorHandling&&gn&&(gn.errorThrown=!0,gn.error=t)}var yn=class extends $t{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Ls(t)&&t.add(this)):this.destination=$g}static create(t,e,r){return new gi(t,e,r)}next(t){this.isStopped?wl(Ef(t),this):this._next(t)}error(t){this.isStopped?wl(_f(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?wl(vf,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()}}},Fg=Function.prototype.bind;function bl(t,e){return Fg.call(t,e)}var Il=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Us(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Us(r)}else Us(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Us(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&&er.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),n={next:t.next&&bl(t.next,i),error:t.error&&bl(t.error,i),complete:t.complete&&bl(t.complete,i)}):n=t}this.destination=new Il(n)}};function Us(t){er.useDeprecatedSynchronousErrorHandling?Sf(t):Bs(t)}function Hg(t){throw t}function wl(t,e){let{onStoppedNotification:r}=er;r&&di.setTimeout(()=>r(t,e))}var $g={closed:!0,next:El,error:Hg,complete:El},yi=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ms(t){return t}function bf(t){return t.length===0?Ms:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var tt=(()=>{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=Wg(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=wf(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 bf(r)(this)}toPromise(r){return r=wf(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 wf(t){var e;return(e=t??er.Promise)!==null&&e!==void 0?e:Promise}function jg(t){return t&&ce(t.next)&&ce(t.error)&&ce(t.complete)}function Wg(t){return t&&t instanceof yn||jg(t)&&Ls(t)}function Gg(t){return ce(t?.lift)}function jt(t){return e=>{if(Gg(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 Or(t,e,r,n,i){return new Tl(t,e,r,n,i)}var Tl=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))}}},If=Os(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),ht=(()=>{class t extends tt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ks(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new If}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?_l:(this.currentObservers=null,s.push(r),new $t(()=>{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 tt;return r.source=this,r}}return t.create=(e,r)=>new ks(e,r),t})(),ks=class extends ht{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:_l}},fo=class extends ht{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 ht{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)}}},Fs=class extends $t{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},Hs=class extends Fs{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 $s=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}}},Tf=new $s(Hs);function xf(t){return t&&ce(t.schedule)}function Vg(t){return t[t.length-1]}function js(t){return xf(Vg(t))?t.pop():void 0}function Df(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(g){try{f(n.next(g))}catch(h){o(h)}}function u(g){try{f(n.throw(g))}catch(h){o(h)}}function f(g){g.done?s(g.value):i(g.value).then(c,u)}f((n=n.apply(t,e||[])).next())})}function Cf(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 Rf(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(m){return Promise.resolve(m).then(_,h)}}function c(_,m){n[_]&&(i[_]=function(y){return new Promise(function(T,O){s.push([_,y,T,O])>1||u(_,y)})},m&&(i[_]=m(i[_])))}function u(_,m){try{f(n[_](m))}catch(y){v(s[0][3],y)}}function f(_){_.value instanceof vn?Promise.resolve(_.value.v).then(g,h):v(s[0][2],_)}function g(_){u("next",_)}function h(_){u("throw",_)}function v(_,m){_(m),s.shift(),s.length&&u(s[0][0],s[0][1])}}function Nf(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 Cf=="function"?Cf(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 Ws(t){return ce(t?.then)}function Gs(t){return ce(t[yi])}function Vs(t){return Symbol.asyncIterator&&ce(t?.[Symbol.asyncIterator])}function zs(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 zg(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ys=zg();function qs(t){return ce(t?.[Ys])}function Ks(t){return Rf(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 Js(t){return ce(t?.getReader)}function Wt(t){if(t instanceof tt)return t;if(t!=null){if(Gs(t))return Yg(t);if(_i(t))return qg(t);if(Ws(t))return Kg(t);if(Vs(t))return Af(t);if(qs(t))return Jg(t);if(Js(t))return Xg(t)}throw zs(t)}function Yg(t){return new tt(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 qg(t){return new tt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Kg(t){return new tt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Bs)})}function Jg(t){return new tt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Af(t){return new tt(e=>{Qg(t,e).catch(r=>e.error(r))})}function Xg(t){return Af(Ks(t))}function Qg(t,e){var r,n,i,s;return Df(this,void 0,void 0,function*(){try{for(r=Nf(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 Gt(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 Xs(t,e=0){return jt((r,n)=>{r.subscribe(Or(n,i=>Gt(n,t,()=>n.next(i),e),()=>Gt(n,t,()=>n.complete(),e),i=>Gt(n,t,()=>n.error(i),e)))})}function Qs(t,e=0){return jt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Of(t,e){return Wt(t).pipe(Qs(e),Xs(e))}function Pf(t,e){return Wt(t).pipe(Qs(e),Xs(e))}function Lf(t,e){return new tt(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Bf(t,e){return new tt(r=>{let n;return Gt(r,e,()=>{n=t[Ys](),Gt(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 Zs(t,e){if(!t)throw new Error("Iterable cannot be null");return new tt(r=>{Gt(r,e,()=>{let n=t[Symbol.asyncIterator]();Gt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Uf(t,e){return Zs(Ks(t),e)}function Mf(t,e){if(t!=null){if(Gs(t))return Of(t,e);if(_i(t))return Lf(t,e);if(Ws(t))return Pf(t,e);if(Vs(t))return Zs(t,e);if(qs(t))return Bf(t,e);if(Js(t))return Uf(t,e)}throw zs(t)}function kf(t,e){return e?Mf(t,e):Wt(t)}function _n(t,e){return jt((r,n)=>{let i=0;r.subscribe(Or(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Zg}=Array;function ey(t,e){return Zg(e)?t(...e):t(e)}function Ff(t){return _n(e=>ey(t,e))}function Hf(t,e,r,n,i,s,o,c){let u=[],f=0,g=0,h=!1,v=()=>{h&&!u.length&&!f&&e.complete()},_=y=>f<n?m(y):u.push(y),m=y=>{s&&e.next(y),f++;let T=!1;Wt(r(y,g++)).subscribe(Or(e,O=>{i?.(O),s?_(O):e.next(O)},()=>{T=!0},void 0,()=>{if(T)try{for(f--;u.length&&f<n;){let O=u.shift();o?Gt(e,o,()=>m(O)):m(O)}v()}catch(O){e.error(O)}}))};return t.subscribe(Or(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))(Wt(t(n,i))),r):(typeof e=="number"&&(r=e),jt((n,i)=>Hf(n,i,t,r)))}function $f(t=1/0){return yo(Ms,t)}function jf(){return $f(1)}function xl(...t){return jf()(kf(t,js(t)))}var ty=["addListener","removeListener"],ry=["addEventListener","removeEventListener"],ny=["on","off"];function En(t,e,r,n){if(ce(r)&&(n=r,r=void 0),n)return En(t,e,r).pipe(Ff(n));let[i,s]=sy(t)?ry.map(o=>c=>t[o](e,c,r)):iy(t)?ty.map(Wf(t,e)):oy(t)?ny.map(Wf(t,e)):[];if(!i&&_i(t))return yo(o=>En(o,e,r))(Wt(t));if(!i)throw new TypeError("Invalid event target");return new tt(o=>{let c=(...u)=>o.next(1<u.length?u:u[0]);return i(c),()=>s(c)})}function Wf(t,e){return r=>n=>t[r](e,n)}function iy(t){return ce(t.addListener)&&ce(t.removeListener)}function oy(t){return ce(t.on)&&ce(t.off)}function sy(t){return ce(t.addEventListener)&&ce(t.removeEventListener)}function tr(t,e=Tf){return jt((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,g=e.now();if(g<f){i=this.schedule(void 0,f-g),n.add(i);return}c()}r.subscribe(Or(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 Cl(...t){let e=js(t);return jt((r,n)=>{(e?xl(t,r,e):xl(t,r)).subscribe(n)})}var ay=" 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",cy=/bot|crawl|http|lighthouse|scan|search|spider/i,vo;function ly(){if(vo instanceof RegExp)return vo;try{vo=new RegExp(ay,"i")}catch{vo=cy}return vo}function Gf(t){return!!t&&ly().test(t)}var Vf=Object.prototype.toString;function Sn(t){switch(Vf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return _r(t,Error)}}function Ei(t,e){return Vf.call(t)===`[object ${e}]`}function ea(t){return Ei(t,"ErrorEvent")}function ta(t){return Ei(t,"DOMError")}function Dl(t){return Ei(t,"DOMException")}function gt(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 rr(t){return Ei(t,"Object")}function wn(t){return typeof Event<"u"&&_r(t,Event)}function Rl(t){return typeof Element<"u"&&_r(t,Element)}function Nl(t){return Ei(t,"RegExp")}function Pr(t){return!!(t&&t.then&&typeof t.then=="function")}function Al(t){return rr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function _r(t,e){try{return t instanceof e}catch{return!1}}function _o(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Er(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ra(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 zf(t,e,r=!1){return gt(t)?Nl(e)?e.test(t):gt(e)?r?t===e:t.includes(e):!1:!1}function bi(t,e=[],r=!1){return e.some(n=>zf(t,n,r))}function Pl(t,e,r=250,n,i,s,o){if(!s.exception||!s.exception.values||!o||!_r(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=uy(Ol(t,e,i,o.originalException,n,s.exception.values,c,0),r))}function Ol(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let u=[...s];if(_r(n[i],Error)){Yf(o,c);let f=t(e,n[i]),g=u.length;qf(f,i,g,c),u=Ol(t,e,r,n[i],i,[f,...u],f,g)}return Array.isArray(n.errors)&&n.errors.forEach((f,g)=>{if(_r(f,Error)){Yf(o,c);let h=t(e,f),v=u.length;qf(h,`errors[${g}]`,v,c),u=Ol(t,e,r,f,i,[h,...u],h,v)}}),u}function Yf(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 qf(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 uy(t,e){return t.map(r=>(r.value&&(r.value=Er(r.value,e)),r))}var Vt="8.18.0",ee=globalThis;function wi(t,e,r){let n=r||ee,i=n.__SENTRY__=n.__SENTRY__||{},s=i[Vt]=i[Vt]||{};return s[t]||(s[t]=e())}var Ll=ee,py=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,g=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||py;for(;r&&s++<n&&(f=fy(r,g),!(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 fy(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(Ll.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&&gt(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 Bl(){try{return Ll.document.location.href}catch{return""}}function Ul(t){if(!Ll.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 Sr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,my="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 dy(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Sr?So.forEach(r=>{e[r]=(...n)=>{t&&Ti(()=>{ee.console[r](`${my}[${r}]:`,...n)})}}):So.forEach(r=>{e[r]=()=>{}}),e}var q=dy(),hy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function gy(t){return t==="http"||t==="https"}function br(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 Kf(t){let e=hy.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,g=f.split("/");if(g.length>1&&(u=g.slice(0,-1).join("/"),f=g.pop()),f){let h=f.match(/^\d+/);h&&(f=h[0])}return Jf({host:s,pass:i,path:u,projectId:f,port:o,protocol:r,publicKey:n})}function Jf(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function yy(t){if(!Sr)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+$/)?gy(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 na(t){let e=typeof t=="string"?Kf(t):Jf(t);if(!(!e||!yy(e)))return e}var lt=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 Oe(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&ia(i,n),t[e]=i}function yt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{Sr&&q.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ia(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,yt(t,"__sentry_original__",e)}catch{}}function In(t){return t.__sentry_original__}function kl(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function oa(t){if(Sn(t))return b({message:t.message,name:t.name,stack:t.stack},Qf(t));if(wn(t)){let e=b({type:t.type,target:Xf(t.target),currentTarget:Xf(t.currentTarget)},Qf(t));return typeof CustomEvent<"u"&&_r(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Xf(t){try{return Rl(t)?Eo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Qf(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 Fl(t,e=40){let r=Object.keys(oa(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return Er(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:Er(s,e)}return""}function Qe(t){return Ml(t,new Map)}function Ml(t,e){if(vy(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]=Ml(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(Ml(i,e))}),n}return t}function vy(t){if(!rr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var wr="?",Zf=/\(error: (.*)\)/,em=/captureMessage|captureException/;function $l(...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 c=n;c<o.length;c++){let u=o[c];if(u.length>1024)continue;let f=Zf.test(u)?u.replace(Zf,"$1"):u;if(!f.match(/\S*Error: /)){for(let g of e){let h=g(f);if(h){s.push(h);break}}if(s.length>=50+i)break}}return tm(s.slice(i))}}function tm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(sa(e).function||"")&&e.pop(),e.reverse(),em.test(sa(e).function||"")&&(e.pop(),em.test(sa(e).function||"")&&e.pop()),e.slice(0,50).map(r=>Z(b({},r),{filename:r.filename||sa(e).filename,function:r.function||wr}))}function sa(t){return t[t.length-1]||{}}var Hl="<anonymous>";function zt(t){try{return!t||typeof t!="function"?Hl:t.name||Hl}catch{return Hl}}function aa(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 ca={},rm={};function vt(t,e){ca[t]=ca[t]||[],ca[t].push(e)}function _t(t,e){rm[t]||(e(),rm[t]=!0)}function Ze(t,e){let r=t&&ca[t];if(r)for(let n of r)try{n(e)}catch(i){Sr&&q.error(`Error while triggering instrumentation handler.
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 $t=class Gu{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 Ps?s.errors:[s]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let s of i)try{yf(s)}catch(o){e=e??[],o instanceof Ps?e=[...e,...o.errors]:e.push(o)}}if(e)throw new Ps(e)}}add(e){var r;if(e&&e!==this)if(this.closed)yf(e);else{if(e instanceof Gu){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 Gu&&e._removeParent(this)}};$t.EMPTY=(()=>{let t=new $t;return t.closed=!0,t})();var _l=$t.EMPTY;function Ls(t){return t instanceof $t||t&&"closed"in t&&ce(t.remove)&&ce(t.add)&&ce(t.unsubscribe)}function yf(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 Bs(t){di.setTimeout(()=>{let{onUnhandledError:e}=tr;if(e)e(t);else throw t})}function El(){}var vf=Sl("C",void 0,void 0);function _f(t){return Sl("E",void 0,t)}function Ef(t){return Sl("N",t,void 0)}function Sl(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 Sf(t){tr.useDeprecatedSynchronousErrorHandling&&gn&&(gn.errorThrown=!0,gn.error=t)}var yn=class extends $t{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Ls(t)&&t.add(this)):this.destination=$g}static create(t,e,r){return new gi(t,e,r)}next(t){this.isStopped?wl(Ef(t),this):this._next(t)}error(t){this.isStopped?wl(_f(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?wl(vf,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()}}},Fg=Function.prototype.bind;function bl(t,e){return Fg.call(t,e)}var Il=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:e}=this;if(e.next)try{e.next(t)}catch(r){Us(r)}}error(t){let{partialObserver:e}=this;if(e.error)try{e.error(t)}catch(r){Us(r)}else Us(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(e){Us(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&&bl(t.next,i),error:t.error&&bl(t.error,i),complete:t.complete&&bl(t.complete,i)}):n=t}this.destination=new Il(n)}};function Us(t){tr.useDeprecatedSynchronousErrorHandling?Sf(t):Bs(t)}function Hg(t){throw t}function wl(t,e){let{onStoppedNotification:r}=tr;r&&di.setTimeout(()=>r(t,e))}var $g={closed:!0,next:El,error:Hg,complete:El},yi=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ms(t){return t}function bf(t){return t.length===0?Ms:t.length===1?t[0]:function(e){return t.reduce((r,n)=>n(r),e)}}var tt=(()=>{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=Wg(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=wf(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 bf(r)(this)}toPromise(r){return r=wf(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 wf(t){var e;return(e=t??tr.Promise)!==null&&e!==void 0?e:Promise}function jg(t){return t&&ce(t.next)&&ce(t.error)&&ce(t.complete)}function Wg(t){return t&&t instanceof yn||jg(t)&&Ls(t)}function Gg(t){return ce(t?.lift)}function jt(t){return e=>{if(Gg(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 Tl(t,e,r,n,i)}var Tl=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))}}},If=Os(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}),gt=(()=>{class t extends tt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ks(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new If}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?_l:(this.currentObservers=null,s.push(r),new $t(()=>{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 tt;return r.source=this,r}}return t.create=(e,r)=>new ks(e,r),t})(),ks=class extends gt{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:_l}},fo=class extends gt{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 gt{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)}}},Fs=class extends $t{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},Hs=class extends Fs{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 $s=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}}},Tf=new $s(Hs);function xf(t){return t&&ce(t.schedule)}function Vg(t){return t[t.length-1]}function js(t){return xf(Vg(t))?t.pop():void 0}function Df(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(g){try{f(n.next(g))}catch(h){o(h)}}function u(g){try{f(n.throw(g))}catch(h){o(h)}}function f(g){g.done?s(g.value):i(g.value).then(c,u)}f((n=n.apply(t,e||[])).next())})}function Cf(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 Rf(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(m){return Promise.resolve(m).then(_,h)}}function c(_,m){n[_]&&(i[_]=function(y){return new Promise(function(T,O){s.push([_,y,T,O])>1||u(_,y)})},m&&(i[_]=m(i[_])))}function u(_,m){try{f(n[_](m))}catch(y){v(s[0][3],y)}}function f(_){_.value instanceof vn?Promise.resolve(_.value.v).then(g,h):v(s[0][2],_)}function g(_){u("next",_)}function h(_){u("throw",_)}function v(_,m){_(m),s.shift(),s.length&&u(s[0][0],s[0][1])}}function Nf(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 Cf=="function"?Cf(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 Ws(t){return ce(t?.then)}function Gs(t){return ce(t[yi])}function Vs(t){return Symbol.asyncIterator&&ce(t?.[Symbol.asyncIterator])}function zs(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 zg(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ys=zg();function qs(t){return ce(t?.[Ys])}function Ks(t){return Rf(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 Js(t){return ce(t?.getReader)}function Wt(t){if(t instanceof tt)return t;if(t!=null){if(Gs(t))return Yg(t);if(_i(t))return qg(t);if(Ws(t))return Kg(t);if(Vs(t))return Af(t);if(qs(t))return Jg(t);if(Js(t))return Xg(t)}throw zs(t)}function Yg(t){return new tt(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 qg(t){return new tt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Kg(t){return new tt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Bs)})}function Jg(t){return new tt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Af(t){return new tt(e=>{Qg(t,e).catch(r=>e.error(r))})}function Xg(t){return Af(Ks(t))}function Qg(t,e){var r,n,i,s;return Df(this,void 0,void 0,function*(){try{for(r=Nf(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 Gt(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 Xs(t,e=0){return jt((r,n)=>{r.subscribe(Pr(n,i=>Gt(n,t,()=>n.next(i),e),()=>Gt(n,t,()=>n.complete(),e),i=>Gt(n,t,()=>n.error(i),e)))})}function Qs(t,e=0){return jt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Of(t,e){return Wt(t).pipe(Qs(e),Xs(e))}function Pf(t,e){return Wt(t).pipe(Qs(e),Xs(e))}function Lf(t,e){return new tt(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Bf(t,e){return new tt(r=>{let n;return Gt(r,e,()=>{n=t[Ys](),Gt(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 Zs(t,e){if(!t)throw new Error("Iterable cannot be null");return new tt(r=>{Gt(r,e,()=>{let n=t[Symbol.asyncIterator]();Gt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Uf(t,e){return Zs(Ks(t),e)}function Mf(t,e){if(t!=null){if(Gs(t))return Of(t,e);if(_i(t))return Lf(t,e);if(Ws(t))return Pf(t,e);if(Vs(t))return Zs(t,e);if(qs(t))return Bf(t,e);if(Js(t))return Uf(t,e)}throw zs(t)}function kf(t,e){return e?Mf(t,e):Wt(t)}function _n(t,e){return jt((r,n)=>{let i=0;r.subscribe(Pr(n,s=>{n.next(t.call(e,s,i++))}))})}var{isArray:Zg}=Array;function ey(t,e){return Zg(e)?t(...e):t(e)}function Ff(t){return _n(e=>ey(t,e))}function Hf(t,e,r,n,i,s,o,c){let u=[],f=0,g=0,h=!1,v=()=>{h&&!u.length&&!f&&e.complete()},_=y=>f<n?m(y):u.push(y),m=y=>{s&&e.next(y),f++;let T=!1;Wt(r(y,g++)).subscribe(Pr(e,O=>{i?.(O),s?_(O):e.next(O)},()=>{T=!0},void 0,()=>{if(T)try{for(f--;u.length&&f<n;){let O=u.shift();o?Gt(e,o,()=>m(O)):m(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))(Wt(t(n,i))),r):(typeof e=="number"&&(r=e),jt((n,i)=>Hf(n,i,t,r)))}function $f(t=1/0){return yo(Ms,t)}function jf(){return $f(1)}function xl(...t){return jf()(kf(t,js(t)))}var ty=["addListener","removeListener"],ry=["addEventListener","removeEventListener"],ny=["on","off"];function En(t,e,r,n){if(ce(r)&&(n=r,r=void 0),n)return En(t,e,r).pipe(Ff(n));let[i,s]=sy(t)?ry.map(o=>c=>t[o](e,c,r)):iy(t)?ty.map(Wf(t,e)):oy(t)?ny.map(Wf(t,e)):[];if(!i&&_i(t))return yo(o=>En(o,e,r))(Wt(t));if(!i)throw new TypeError("Invalid event target");return new tt(o=>{let c=(...u)=>o.next(1<u.length?u:u[0]);return i(c),()=>s(c)})}function Wf(t,e){return r=>n=>t[r](e,n)}function iy(t){return ce(t.addListener)&&ce(t.removeListener)}function oy(t){return ce(t.on)&&ce(t.off)}function sy(t){return ce(t.addEventListener)&&ce(t.removeEventListener)}function rr(t,e=Tf){return jt((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,g=e.now();if(g<f){i=this.schedule(void 0,f-g),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 Cl(...t){let e=js(t);return jt((r,n)=>{(e?xl(t,r,e):xl(t,r)).subscribe(n)})}var ay=" 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",cy=/bot|crawl|http|lighthouse|scan|search|spider/i,vo;function ly(){if(vo instanceof RegExp)return vo;try{vo=new RegExp(ay,"i")}catch{vo=cy}return vo}function Gf(t){return!!t&&ly().test(t)}var Vf=Object.prototype.toString;function Sn(t){switch(Vf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Er(t,Error)}}function Ei(t,e){return Vf.call(t)===`[object ${e}]`}function ea(t){return Ei(t,"ErrorEvent")}function ta(t){return Ei(t,"DOMError")}function Dl(t){return Ei(t,"DOMException")}function yt(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 Rl(t){return typeof Element<"u"&&Er(t,Element)}function Nl(t){return Ei(t,"RegExp")}function Lr(t){return!!(t&&t.then&&typeof t.then=="function")}function Al(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 ra(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 zf(t,e,r=!1){return yt(t)?Nl(e)?e.test(t):yt(e)?r?t===e:t.includes(e):!1:!1}function bi(t,e=[],r=!1){return e.some(n=>zf(t,n,r))}function Pl(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=uy(Ol(t,e,i,o.originalException,n,s.exception.values,c,0),r))}function Ol(t,e,r,n,i,s,o,c){if(s.length>=r+1)return s;let u=[...s];if(Er(n[i],Error)){Yf(o,c);let f=t(e,n[i]),g=u.length;qf(f,i,g,c),u=Ol(t,e,r,n[i],i,[f,...u],f,g)}return Array.isArray(n.errors)&&n.errors.forEach((f,g)=>{if(Er(f,Error)){Yf(o,c);let h=t(e,f),v=u.length;qf(h,`errors[${g}]`,v,c),u=Ol(t,e,r,f,i,[h,...u],h,v)}}),u}function Yf(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 qf(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 uy(t,e){return t.map(r=>(r.value&&(r.value=Sr(r.value,e)),r))}var Vt="8.18.0",ee=globalThis;function wi(t,e,r){let n=r||ee,i=n.__SENTRY__=n.__SENTRY__||{},s=i[Vt]=i[Vt]||{};return s[t]||(s[t]=e())}var Ll=ee,py=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,g=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||py;for(;r&&s++<n&&(f=fy(r,g),!(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 fy(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(Ll.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&&yt(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 Bl(){try{return Ll.document.location.href}catch{return""}}function Ul(t){if(!Ll.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__,my="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 dy(){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](`${my}[${r}]:`,...n)})}}):So.forEach(r=>{e[r]=()=>{}}),e}var q=dy(),hy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function gy(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 Kf(t){let e=hy.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,g=f.split("/");if(g.length>1&&(u=g.slice(0,-1).join("/"),f=g.pop()),f){let h=f.match(/^\d+/);h&&(f=h[0])}return Jf({host:s,pass:i,path:u,projectId:f,port:o,protocol:r,publicKey:n})}function Jf(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function yy(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+$/)?gy(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 na(t){let e=typeof t=="string"?Kf(t):Jf(t);if(!(!e||!yy(e)))return e}var lt=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 Oe(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&ia(i,n),t[e]=i}function vt(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 ia(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,vt(t,"__sentry_original__",e)}catch{}}function In(t){return t.__sentry_original__}function kl(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function oa(t){if(Sn(t))return b({message:t.message,name:t.name,stack:t.stack},Qf(t));if(wn(t)){let e=b({type:t.type,target:Xf(t.target),currentTarget:Xf(t.currentTarget)},Qf(t));return typeof CustomEvent<"u"&&Er(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Xf(t){try{return Rl(t)?Eo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Qf(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 Fl(t,e=40){let r=Object.keys(oa(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 Ml(t,new Map)}function Ml(t,e){if(vy(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]=Ml(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(Ml(i,e))}),n}return t}function vy(t){if(!nr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var Ir="?",Zf=/\(error: (.*)\)/,em=/captureMessage|captureException/;function $l(...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 c=n;c<o.length;c++){let u=o[c];if(u.length>1024)continue;let f=Zf.test(u)?u.replace(Zf,"$1"):u;if(!f.match(/\S*Error: /)){for(let g of e){let h=g(f);if(h){s.push(h);break}}if(s.length>=50+i)break}}return tm(s.slice(i))}}function tm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(sa(e).function||"")&&e.pop(),e.reverse(),em.test(sa(e).function||"")&&(e.pop(),em.test(sa(e).function||"")&&e.pop()),e.slice(0,50).map(r=>Z(b({},r),{filename:r.filename||sa(e).filename,function:r.function||Ir}))}function sa(t){return t[t.length-1]||{}}var Hl="<anonymous>";function zt(t){try{return!t||typeof t!="function"?Hl:t.name||Hl}catch{return Hl}}function aa(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 ca={},rm={};function _t(t,e){ca[t]=ca[t]||[],ca[t].push(e)}function Et(t,e){rm[t]||(e(),rm[t]=!0)}function Ze(t,e){let r=t&&ca[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: ${zt(n)}
27
- Error:`,i)}}function jl(t){let e="console";vt(e,t),_t(e,_y)}function _y(){"console"in ee&&So.forEach(function(t){t in ee.console&&Oe(ee.console,t,function(e){return Ii[t]=e,function(...r){Ze("console",{args:r,level:t});let n=Ii[t];n&&n.apply(ee.console,r)}})})}var Wl=ee;function nm(){if(!("fetch"in Wl))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 Gl(){if(typeof EdgeRuntime=="string")return!0;if(!nm())return!1;if(bo(Wl.fetch))return!0;let t=!1,e=Wl.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){Sr&&q.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}var im=1e3;function Ir(){return Date.now()/im}function Ey(){let{performance:t}=ee;if(!t||!t.now)return Ir;let e=Date.now()-t.now(),r=t.timeOrigin==null?e:t.timeOrigin;return()=>(r+t.now())/im}var Lt=Ey(),wo,Sy=(()=>{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,c=typeof o=="number"?Math.abs(o+r-n):e,u=c<e;return s||u?i<=c?(wo="timeOrigin",t.timeOrigin):(wo="navigationStart",o):(wo="dateNow",n)})();function zl(t){let e="fetch";vt(e,t),_t(e,by)}function by(){Gl()&&Oe(ee,"fetch",function(t){return function(...e){let{method:r,url:n}=wy(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:Lt()*1e3};Ze("fetch",b({},i));let s=new Error().stack;return t.apply(ee,e).then(o=>{let c=Z(b({},i),{endTimestamp:Lt()*1e3,response:o});return Ze("fetch",c),o},o=>{let c=Z(b({},i),{endTimestamp:Lt()*1e3,error:o});throw Ze("fetch",c),Sn(o)&&o.stack===void 0&&(o.stack=s,yt(o,"framesToPop",1)),o})}})}function Vl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function om(t){return typeof t=="string"?t:t?Vl(t,"url")?t.url:t.toString?t.toString():"":""}function wy(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:om(r),method:Vl(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:om(e),method:Vl(e,"method")?String(e.method).toUpperCase():"GET"}}var la=null;function Yl(t){let e="error";vt(e,t),_t(e,Iy)}function Iy(){la=ee.onerror,ee.onerror=function(t,e,r,n,i){return Ze("error",{column:n,error:i,line:r,msg:t,url:e}),la&&!la.__SENTRY_LOADER__?la.apply(this,arguments):!1},ee.onerror.__SENTRY_INSTRUMENTED__=!0}var ua=null;function ql(t){let e="unhandledrejection";vt(e,t),_t(e,Ty)}function Ty(){ua=ee.onunhandledrejection,ee.onunhandledrejection=function(t){return Ze("unhandledrejection",t),ua&&!ua.__SENTRY_LOADER__?ua.apply(this,arguments):!0},ee.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Kl(){return"npm"}function sm(){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 rt(){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 am(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function nr(t){let{message:e,event_id:r}=t;if(e)return e;let n=am(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 Lr(t,e){let r=am(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 pa(t){if(t&&t.__sentry_captured__)return!0;try{yt(t,"__sentry_captured__",!0)}catch{}return!1}function fa(t){return Array.isArray(t)?t:[t]}function ir(t,e=100,r=1/0){try{return Jl("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function ma(t,e=3,r=100*1024){let n=ir(t,e);return Ry(n)>r?ma(t,e-1,r):n}function Jl(t,e,r=1/0,n=1/0,i=sm()){let[s,o]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let c=xy(t,e);if(!c.startsWith("[object "))return c;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 c.replace("object ","");if(s(e))return"[Circular ~]";let f=e;if(f&&typeof f.toJSON=="function")try{let _=f.toJSON();return Jl("",_,u-1,n,i)}catch{}let g=Array.isArray(e)?[]:{},h=0,v=oa(e);for(let _ in v){if(!Object.prototype.hasOwnProperty.call(v,_))continue;if(h>=n){g[_]="[MaxProperties ~]";break}let m=v[_];g[_]=Jl(_,m,u-1,n,i),h++}return o(e),g}function xy(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(Al(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${zt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Cy(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Cy(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Dy(t){return~-encodeURI(t).split(/%..|./).length}function Ry(t){return Dy(JSON.stringify(t))}var Br;(function(t){t[t.PENDING=0]="PENDING";let e=1;t[t.RESOLVED=e]="RESOLVED";let r=2;t[t.REJECTED=r]="REJECTED"})(Br||(Br={}));function Yt(t){return new or(e=>{e(t)})}function Xr(t){return new or((e,r)=>{r(t)})}var or=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=Br.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(Br.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Br.REJECTED,e)}}__init3(){this._setResult=(e,r)=>{if(this._state===Br.PENDING){if(Pr(r)){r.then(this._resolve,this._reject);return}this._state=e,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Br.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Br.RESOLVED&&r[1](this._value),this._state===Br.REJECTED&&r[2](this._value),r[0]=!0)})}}};function Xl(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 Xr(new lt("Not adding Promise because buffer limit was reached."));let c=o();return e.indexOf(c)===-1&&e.push(c),c.then(()=>n(c)).then(null,()=>n(c).then(null,()=>{})),c}function s(o){return new or((c,u)=>{let f=e.length;if(!f)return c(!0);let g=setTimeout(()=>{o&&o>0&&c(!1)},o);e.forEach(h=>{Yt(h).then(()=>{--f||(clearTimeout(g),c(!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 cm=["fatal","error","warning","log","info","debug"];function Ql(t){return t==="warn"?"warning":cm.includes(t)?t:"log"}var um="sentry-",pm=/^sentry-/;function Zl(t){let e=fm(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(pm)){let o=i.slice(um.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function fm(t){if(!(!t||!gt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=lm(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):lm(t)}function lm(t){return t.split(",").map(e=>e.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function Tr(t,e=[]){return[t,e]}function tu(t,e){let[r,n]=t;return[r,[...n,e]]}function da(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 eu(t){return ee.__SENTRY__&&ee.__SENTRY__.encodePolyfill?ee.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function ru(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[eu(n),s]:n.push(typeof s=="string"?eu(s):s)}for(let s of r){let[o,c]=s;if(i(`
27
+ Error:`,i)}}function jl(t){let e="console";_t(e,t),Et(e,_y)}function _y(){"console"in ee&&So.forEach(function(t){t in ee.console&&Oe(ee.console,t,function(e){return Ii[t]=e,function(...r){Ze("console",{args:r,level:t});let n=Ii[t];n&&n.apply(ee.console,r)}})})}var Wl=ee;function nm(){if(!("fetch"in Wl))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 Gl(){if(typeof EdgeRuntime=="string")return!0;if(!nm())return!1;if(bo(Wl.fetch))return!0;let t=!1,e=Wl.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 im=1e3;function Tr(){return Date.now()/im}function Ey(){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())/im}var Lt=Ey(),wo,Sy=(()=>{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,c=typeof o=="number"?Math.abs(o+r-n):e,u=c<e;return s||u?i<=c?(wo="timeOrigin",t.timeOrigin):(wo="navigationStart",o):(wo="dateNow",n)})();function zl(t){let e="fetch";_t(e,t),Et(e,by)}function by(){Gl()&&Oe(ee,"fetch",function(t){return function(...e){let{method:r,url:n}=wy(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:Lt()*1e3};Ze("fetch",b({},i));let s=new Error().stack;return t.apply(ee,e).then(o=>{let c=Z(b({},i),{endTimestamp:Lt()*1e3,response:o});return Ze("fetch",c),o},o=>{let c=Z(b({},i),{endTimestamp:Lt()*1e3,error:o});throw Ze("fetch",c),Sn(o)&&o.stack===void 0&&(o.stack=s,vt(o,"framesToPop",1)),o})}})}function Vl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function om(t){return typeof t=="string"?t:t?Vl(t,"url")?t.url:t.toString?t.toString():"":""}function wy(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:om(r),method:Vl(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:om(e),method:Vl(e,"method")?String(e.method).toUpperCase():"GET"}}var la=null;function Yl(t){let e="error";_t(e,t),Et(e,Iy)}function Iy(){la=ee.onerror,ee.onerror=function(t,e,r,n,i){return Ze("error",{column:n,error:i,line:r,msg:t,url:e}),la&&!la.__SENTRY_LOADER__?la.apply(this,arguments):!1},ee.onerror.__SENTRY_INSTRUMENTED__=!0}var ua=null;function ql(t){let e="unhandledrejection";_t(e,t),Et(e,Ty)}function Ty(){ua=ee.onunhandledrejection,ee.onunhandledrejection=function(t){return Ze("unhandledrejection",t),ua&&!ua.__SENTRY_LOADER__?ua.apply(this,arguments):!0},ee.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Kl(){return"npm"}function sm(){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 rt(){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 am(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=am(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=am(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 pa(t){if(t&&t.__sentry_captured__)return!0;try{vt(t,"__sentry_captured__",!0)}catch{}return!1}function fa(t){return Array.isArray(t)?t:[t]}function or(t,e=100,r=1/0){try{return Jl("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function ma(t,e=3,r=100*1024){let n=or(t,e);return Ry(n)>r?ma(t,e-1,r):n}function Jl(t,e,r=1/0,n=1/0,i=sm()){let[s,o]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let c=xy(t,e);if(!c.startsWith("[object "))return c;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 c.replace("object ","");if(s(e))return"[Circular ~]";let f=e;if(f&&typeof f.toJSON=="function")try{let _=f.toJSON();return Jl("",_,u-1,n,i)}catch{}let g=Array.isArray(e)?[]:{},h=0,v=oa(e);for(let _ in v){if(!Object.prototype.hasOwnProperty.call(v,_))continue;if(h>=n){g[_]="[MaxProperties ~]";break}let m=v[_];g[_]=Jl(_,m,u-1,n,i),h++}return o(e),g}function xy(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(Al(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${zt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=Cy(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Cy(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Dy(t){return~-encodeURI(t).split(/%..|./).length}function Ry(t){return Dy(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 Yt(t){return new sr(e=>{e(t)})}function Xr(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 Xl(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 Xr(new lt("Not adding Promise because buffer limit was reached."));let c=o();return e.indexOf(c)===-1&&e.push(c),c.then(()=>n(c)).then(null,()=>n(c).then(null,()=>{})),c}function s(o){return new sr((c,u)=>{let f=e.length;if(!f)return c(!0);let g=setTimeout(()=>{o&&o>0&&c(!1)},o);e.forEach(h=>{Yt(h).then(()=>{--f||(clearTimeout(g),c(!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 cm=["fatal","error","warning","log","info","debug"];function Ql(t){return t==="warn"?"warning":cm.includes(t)?t:"log"}var um="sentry-",pm=/^sentry-/;function Zl(t){let e=fm(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,s])=>{if(i.match(pm)){let o=i.slice(um.length);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function fm(t){if(!(!t||!yt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=lm(r);return Object.entries(n).forEach(([i,s])=>{e[i]=s}),e},{}):lm(t)}function lm(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 tu(t,e){let[r,n]=t;return[r,[...n,e]]}function da(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 eu(t){return ee.__SENTRY__&&ee.__SENTRY__.encodePolyfill?ee.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function ru(t){let[e,r]=t,n=JSON.stringify(e);function i(s){typeof n=="string"?n=typeof s=="string"?n+s:[eu(n),s]:n.push(typeof s=="string"?eu(s):s)}for(let s of r){let[o,c]=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(ir(c))}i(u)}}return typeof n=="string"?n:Ny(n)}function Ny(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 nu(t){let e=typeof t.data=="string"?eu(t.data):t.data;return[Qe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Ay={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 ha(t){return Ay[t]}function ga(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function iu(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:br(n)}),i&&{trace:Qe(b({},i))})}function ou(t,e,r){let n=[{type:"client_report"},{timestamp:r||Ir(),discarded_events:t}];return Tr(e?{dsn:e}:{},[n])}function mm(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 dm(t,e){return t[e]||t.all||0}function su(t,e,r=Date.now()){return dm(t,e)>r}function au(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,,,g]=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"?(!g||g.split(";").includes("custom"))&&(i[_]=n+v):i[_]=n+v}else o?i.all=n+mm(o,n):e===429&&(i.all=n+60*1e3);return i}function ya(){return{traceId:rt(),spanId:rt().substring(16)}}var va=ee;function cu(){let t=va.chrome,e=t&&t.app&&t.app.runtime,r="history"in va&&!!va.history.pushState&&!!va.history.replaceState;return!e&&r}var xe=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||Vt,e[Vt]=e[Vt]||{}}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||Lt(),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:rt()),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 lu="_sentrySpan";function uu(t,e){e?yt(t,lu,e):delete t[lu]}function pu(t){return t[lu]}var Ly=100,fu=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=ya()}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,uu(e,pu(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 ut?[r.getScopeData(),r.getRequestSession()]:rr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:c,contexts:u,level:f,fingerprint:g=[],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),g.length&&(this._fingerprint=g),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,uu(this,void 0),this._attachments=[],this._propagationContext=ya(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Ly;if(n<=0)return this;let i=b({timestamp:Ir()},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:pu(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:rt();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:rt();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:rt();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)}},ut=fu;function hm(){return wi("defaultCurrentScope",()=>new ut)}function gm(){return wi("defaultIsolationScope",()=>new ut)}var mu=class{constructor(t,e){let r;t?r=t:r=new ut;let n;e?n=e:n=new ut,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 Pr(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 mu(hm(),gm())}function By(t){return Ci().withScope(t)}function Uy(t,e){let r=Ci();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function ym(t){return Ci().withScope(()=>t(Ci().getIsolationScope()))}function vm(){return{withIsolationScope:ym,withScope:By,withSetScope:Uy,withSetIsolationScope:(t,e)=>ym(e),getCurrentScope:()=>Ci().getScope(),getIsolationScope:()=>Ci().getIsolationScope()}}function Ea(t){let e=To(t);return e.acs?e.acs:vm()}function xn(){let t=Tn();return Ea(t).getCurrentScope()}function Cn(){let t=Tn();return Ea(t).getIsolationScope()}function Sa(){return wi("globalScope",()=>new ut)}function ba(...t){let e=Tn(),r=Ea(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Be(){return xn().getClient()}var My="_sentryMetrics";function _m(t){let e=t[My];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Qe(i));return r}var du="sentry.source",hu="sentry.sample_rate",gu="sentry.op",yu="sentry.origin",ky=1;function bm(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 Em(t){return typeof t=="number"?Sm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Sm(t.getTime()):Lt()}function Sm(t){return t>9999999999?t/1e3:t}function Dn(t){if(Hy(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Fy(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:Em(i),timestamp:Em(o)||void 0,status:$y(u),op:n[gu],origin:n[yu],_metrics_summary:_m(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Fy(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Hy(t){return typeof t.getSpanJSON=="function"}function wm(t){let{traceFlags:e}=t.spanContext();return e===ky}function $y(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var jy="_sentryRootSpan";function Co(t){return t[jy]||t}var wa="production",Wy="_frozenDsc";function vu(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Qe({environment:r.environment||wa,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Im(t){let e=Be();if(!e)return{};let r=vu(Dn(t).trace_id||"",e),n=Co(t),i=n[Wy];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&Zl(o);if(c)return c;let u=Dn(n),f=u.data||{},g=f[hu];g!=null&&(r.sample_rate=`${g}`);let h=f[du],v=u.description;return h!=="url"&&v&&(r.transaction=v),r.sampled=String(wm(n)),e.emit("createDsc",r,n),r}function Tm(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){xe&&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 Gy(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 xm(t,e,r,n){let i=ga(r),s=b(b({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:br(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Tr(s,[o])}function Cm(t,e,r,n){let i=ga(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Gy(t,r&&r.sdk);let o=iu(t,i,n,e);return delete t.sdkProcessingMetadata,Tr(o,[[{type:s},t]])}function Ia(t,e,r,n=0){return new or((i,s)=>{let o=t[n];if(e===null||typeof o!="function")i(e);else{let c=o(b({},e),r);xe&&o.id&&c===null&&q.log(`Event processor "${o.id}" dropped event`),Pr(c)?c.then(u=>Ia(t,u,r,n+1).then(i)).then(null,s):Ia(t,c,r,n+1).then(i).then(null,s)}})}function Dm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;Vy(t,e),n&&qy(t,n),Ky(t,r),zy(t,i),Yy(t,s)}function _u(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:f,eventProcessors:g,attachments:h,propagationContext:v,transactionName:_,span:m}=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=_),m&&(t.span=m),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),f.length&&(t.fingerprint=[...t.fingerprint,...f]),g.length&&(t.eventProcessors=[...t.eventProcessors,...g]),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 Vy(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 g=Qe(i);g&&Object.keys(g).length&&(t.user=b(b({},g),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 zy(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Yy(t,e){t.sdkProcessingMetadata=b(b({},t.sdkProcessingMetadata),e)}function qy(t,e){t.contexts=b({trace:bm(e)},t.contexts),t.sdkProcessingMetadata=b({dynamicSamplingContext:Im(e)},t.sdkProcessingMetadata);let r=Co(e),n=Dn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Ky(t,e){t.fingerprint=t.fingerprint?fa(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Nm(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||rt(),timestamp:e.timestamp||Ir()}),f=r.integrations||t.integrations.map(y=>y.name);Jy(u,t),Zy(u,f),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Xy(u,t.stackParser);let g=tv(n,r.captureContext);r.mechanism&&Lr(u,r.mechanism);let h=i?i.getEventProcessors():[],v=Sa().getScopeData();if(s){let y=s.getScopeData();_u(v,y)}if(g){let y=g.getScopeData();_u(v,y)}let _=[...r.attachments||[],...v.attachments];_.length&&(r.attachments=_),Dm(u,v);let m=[...h,...v.eventProcessors];return Ia(m,u,r).then(y=>(y&&Qy(y),typeof o=="number"&&o>0?ev(y,o,c):y))}function Jy(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:wa),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=Er(t.message,s));let o=t.exception&&t.exception.values&&t.exception.values[0];o&&o.value&&(o.value=Er(o.value,s));let c=t.request;c&&c.url&&(c.url=Er(c.url,s))}var Rm=new WeakMap;function Xy(t,e){let r=ee._sentryDebugIds;if(!r)return;let n,i=Rm.get(e);i?n=i:(n=new Map,Rm.set(e,n));let s=Object.entries(r).reduce((o,[c,u])=>{let f,g=n.get(c);g?f=g:(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 Qy(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 Zy(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function ev(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:ir(i.data,e,r)}))}),t.user&&{user:ir(t.user,e,r)}),t.contexts&&{contexts:ir(t.contexts,e,r)}),t.extra&&{extra:ir(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=ir(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>b(b({},i),i.data&&{data:ir(i.data,e,r)}))),n}function tv(t,e){if(!e)return t;let r=t?t.clone():new ut;return r.update(e),r}function Am(t){if(t)return rv(t)?{captureContext:t}:iv(t)?{captureContext:t}:t}function rv(t){return t instanceof ut||typeof t=="function"}var nv=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function iv(t){return Object.keys(t).some(e=>nv.includes(e))}function Ta(t,e){return xn().captureException(t,Am(e))}function Ro(t,e){return xn().captureEvent(t,e)}var ov="7";function sv(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function av(t){return`${sv(t)}${t.projectId}/envelope/`}function cv(t,e){return kl(b({sentry_key:t.publicKey,sentry_version:ov},e&&{sentry_client:`${e.name}/${e.version}`}))}function Pm(t,e,r){return e||`${av(t)}?${cv(t,r)}`}var Lm=[];function Bm(t,e){let r={};return e.forEach(n=>{n&&Su(t,n,r)}),r}function Eu(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Su(t,e,r){if(r[e.name]){xe&&q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Lm.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Lm.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)}xe&&q.log(`Integration installed: ${e.name}`)}var Um="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=na(t.dsn):xe&&q.warn("No DSN provided, client will not send events."),this._dsn){let e=Pm(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=rt();if(pa(t))return xe&&q.log(Um),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:rt()},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=rt();if(e&&e.originalException&&pa(e.originalException))return xe&&q.log(Um),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"?xe&&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))):Yt(!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];Su(this,t,this._integrations),e||Eu(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=Cm(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=tu(r,nu(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=xm(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;xe&&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=>(xe&&q.error("Error while sending event:",e),e)):(xe&&q.error("Transport disabled"),Yt({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Bm(this,t),Eu(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 or(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),Nm(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:g,dsc:h}=c;o.contexts=b({trace:Qe({trace_id:u,span_id:f,parent_span_id:g})},o.contexts);let v=h||vu(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(xe){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=bu(t),o=Mm(t),c=t.type||"error",u=`before send for type \`${c}\``,f=typeof i>"u"?void 0:Tm(i);if(o&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",t),Xr(new lt(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let g=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",g,t),new lt("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return v;let _=uv(this,n,v,e);return lv(_,u)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",g,t),bu(t)){let y=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+y}throw new lt(`${u} returned \`null\`, will not send event.`,"log")}let _=r&&r.getSession();!s&&_&&this._updateSessionFromEvent(_,v);let m=v.transaction_info;if(s&&m&&v.transaction!==t.transaction){let y="custom";v.transaction_info=Z(b({},m),{source:y})}return this.sendEvent(v,e),v}).then(null,v=>{throw v instanceof lt?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new lt(`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 lv(t,e){let r=`${e} must return \`null\` or a valid event.`;if(Pr(t))return t.then(n=>{if(!rr(n)&&n!==null)throw new lt(r);return n},n=>{throw new lt(`${e} rejected with ${n}`)});if(!rr(t)&&t!==null)throw new lt(r);return t}function uv(t,e,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e;if(Mm(r)&&i)return i(r,n);if(bu(r)){if(r.spans&&o){let c=[];for(let u of r.spans){let f=o(u);f?c.push(f):t.recordDroppedEvent("before_send","span")}r.spans=c}if(s)return s(r,n)}return r}function Mm(t){return t.type===void 0}function bu(t){return t.type==="transaction"}var pv=64;function xa(t,e,r=Xl(t.bufferSize||pv)){let n={},i=o=>r.drain(o);function s(o){let c=[];if(da(o,(h,v)=>{let _=ha(v);if(su(n,_)){let m=km(h,v);t.recordDroppedEvent("ratelimit_backoff",_,m)}else c.push(h)}),c.length===0)return Yt({});let u=Tr(o[0],c),f=h=>{da(u,(v,_)=>{let m=km(v,_);t.recordDroppedEvent(h,ha(_),m)})},g=()=>e({body:ru(u)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&xe&&q.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=au(n,h),h),h=>{throw f("network_error"),h});return r.add(g).then(h=>h,h=>{if(h instanceof lt)return xe&&q.error("Skipped sending event because buffer is full."),f("queue_overflow"),Yt({});throw h})}return{send:s,flush:i}}function km(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function wu(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:Vt})),version:Vt}),t._metadata=i}var fv=100;function xr(t,e){let r=Be(),n=Cn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=fv}=r.getOptions();if(s<=0)return;let o=Ir(),c=b({timestamp:o},t),u=i?Ti(()=>i(c,e)):c;u!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",u,e),n.addBreadcrumb(u,s))}var Fm,mv="FunctionToString",Hm=new WeakMap,dv=()=>({name:mv,setupOnce(){Fm=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=In(this),r=Hm.has(Be())&&e!==void 0?e:this;return Fm.apply(r,t)}}catch{}},setup(t){Hm.set(t,!0)}}),Ca=dv,hv=[/^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"],gv="InboundFilters",yv=(t={})=>({name:gv,processEvent(e,r,n){let i=n.getOptions(),s=vv(t,i);return _v(e,s)?null:e}}),Ra=yv;function vv(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:hv],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function _v(t,e){return e.ignoreInternal&&Tv(t)?(xe&&q.warn(`Event dropped due to being internal Sentry Error.
31
- Event: ${nr(t)}`),!0):Ev(t,e.ignoreErrors)?(xe&&q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
32
- Event: ${nr(t)}`),!0):Cv(t)?(xe&&q.warn(`Event dropped due to not having an error message, error type or stacktrace.
33
- Event: ${nr(t)}`),!0):Sv(t,e.ignoreTransactions)?(xe&&q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
34
- Event: ${nr(t)}`),!0):bv(t,e.denyUrls)?(xe&&q.warn(`Event dropped due to being matched by \`denyUrls\` option.
35
- Event: ${nr(t)}.
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:Ny(n)}function Ny(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 nu(t){let e=typeof t.data=="string"?eu(t.data):t.data;return[Qe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Ay={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 ha(t){return Ay[t]}function ga(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function iu(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 ou(t,e,r){let n=[{type:"client_report"},{timestamp:r||Tr(),discarded_events:t}];return xr(e?{dsn:e}:{},[n])}function mm(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 dm(t,e){return t[e]||t.all||0}function su(t,e,r=Date.now()){return dm(t,e)>r}function au(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,,,g]=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"?(!g||g.split(";").includes("custom"))&&(i[_]=n+v):i[_]=n+v}else o?i.all=n+mm(o,n):e===429&&(i.all=n+60*1e3);return i}function ya(){return{traceId:rt(),spanId:rt().substring(16)}}var va=ee;function cu(){let t=va.chrome,e=t&&t.app&&t.app.runtime,r="history"in va&&!!va.history.pushState&&!!va.history.replaceState;return!e&&r}var xe=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||Vt,e[Vt]=e[Vt]||{}}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||Lt(),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:rt()),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 lu="_sentrySpan";function uu(t,e){e?vt(t,lu,e):delete t[lu]}function pu(t){return t[lu]}var Ly=100,fu=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=ya()}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,uu(e,pu(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 ut?[r.getScopeData(),r.getRequestSession()]:nr(r)?[e,e.requestSession]:[],{tags:s,extra:o,user:c,contexts:u,level:f,fingerprint:g=[],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),g.length&&(this._fingerprint=g),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,uu(this,void 0),this._attachments=[],this._propagationContext=ya(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:Ly;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:pu(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:rt();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:rt();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:rt();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)}},ut=fu;function hm(){return wi("defaultCurrentScope",()=>new ut)}function gm(){return wi("defaultIsolationScope",()=>new ut)}var mu=class{constructor(t,e){let r;t?r=t:r=new ut;let n;e?n=e:n=new ut,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 mu(hm(),gm())}function By(t){return Ci().withScope(t)}function Uy(t,e){let r=Ci();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function ym(t){return Ci().withScope(()=>t(Ci().getIsolationScope()))}function vm(){return{withIsolationScope:ym,withScope:By,withSetScope:Uy,withSetIsolationScope:(t,e)=>ym(e),getCurrentScope:()=>Ci().getScope(),getIsolationScope:()=>Ci().getIsolationScope()}}function Ea(t){let e=To(t);return e.acs?e.acs:vm()}function xn(){let t=Tn();return Ea(t).getCurrentScope()}function Cn(){let t=Tn();return Ea(t).getIsolationScope()}function Sa(){return wi("globalScope",()=>new ut)}function ba(...t){let e=Tn(),r=Ea(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Be(){return xn().getClient()}var My="_sentryMetrics";function _m(t){let e=t[My];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Qe(i));return r}var du="sentry.source",hu="sentry.sample_rate",gu="sentry.op",yu="sentry.origin",ky=1;function bm(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 Em(t){return typeof t=="number"?Sm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Sm(t.getTime()):Lt()}function Sm(t){return t>9999999999?t/1e3:t}function Dn(t){if(Hy(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(Fy(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:Em(i),timestamp:Em(o)||void 0,status:$y(u),op:n[gu],origin:n[yu],_metrics_summary:_m(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function Fy(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Hy(t){return typeof t.getSpanJSON=="function"}function wm(t){let{traceFlags:e}=t.spanContext();return e===ky}function $y(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var jy="_sentryRootSpan";function Co(t){return t[jy]||t}var wa="production",Wy="_frozenDsc";function vu(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Qe({environment:r.environment||wa,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function Im(t){let e=Be();if(!e)return{};let r=vu(Dn(t).trace_id||"",e),n=Co(t),i=n[Wy];if(i)return i;let s=n.spanContext().traceState,o=s&&s.get("sentry.dsc"),c=o&&Zl(o);if(c)return c;let u=Dn(n),f=u.data||{},g=f[hu];g!=null&&(r.sample_rate=`${g}`);let h=f[du],v=u.description;return h!=="url"&&v&&(r.transaction=v),r.sampled=String(wm(n)),e.emit("createDsc",r,n),r}function Tm(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){xe&&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 Gy(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 xm(t,e,r,n){let i=ga(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 Cm(t,e,r,n){let i=ga(r),s=t.type&&t.type!=="replay_event"?t.type:"event";Gy(t,r&&r.sdk);let o=iu(t,i,n,e);return delete t.sdkProcessingMetadata,xr(o,[[{type:s},t]])}function Ia(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);xe&&o.id&&c===null&&q.log(`Event processor "${o.id}" dropped event`),Lr(c)?c.then(u=>Ia(t,u,r,n+1).then(i)).then(null,s):Ia(t,c,r,n+1).then(i).then(null,s)}})}function Dm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=e;Vy(t,e),n&&qy(t,n),Ky(t,r),zy(t,i),Yy(t,s)}function _u(t,e){let{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:f,eventProcessors:g,attachments:h,propagationContext:v,transactionName:_,span:m}=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=_),m&&(t.span=m),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),f.length&&(t.fingerprint=[...t.fingerprint,...f]),g.length&&(t.eventProcessors=[...t.eventProcessors,...g]),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 Vy(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 g=Qe(i);g&&Object.keys(g).length&&(t.user=b(b({},g),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 zy(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Yy(t,e){t.sdkProcessingMetadata=b(b({},t.sdkProcessingMetadata),e)}function qy(t,e){t.contexts=b({trace:bm(e)},t.contexts),t.sdkProcessingMetadata=b({dynamicSamplingContext:Im(e)},t.sdkProcessingMetadata);let r=Co(e),n=Dn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function Ky(t,e){t.fingerprint=t.fingerprint?fa(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Nm(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||rt(),timestamp:e.timestamp||Tr()}),f=r.integrations||t.integrations.map(y=>y.name);Jy(u,t),Zy(u,f),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Xy(u,t.stackParser);let g=tv(n,r.captureContext);r.mechanism&&Br(u,r.mechanism);let h=i?i.getEventProcessors():[],v=Sa().getScopeData();if(s){let y=s.getScopeData();_u(v,y)}if(g){let y=g.getScopeData();_u(v,y)}let _=[...r.attachments||[],...v.attachments];_.length&&(r.attachments=_),Dm(u,v);let m=[...h,...v.eventProcessors];return Ia(m,u,r).then(y=>(y&&Qy(y),typeof o=="number"&&o>0?ev(y,o,c):y))}function Jy(t,e){let{environment:r,release:n,dist:i,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?r:wa),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 Rm=new WeakMap;function Xy(t,e){let r=ee._sentryDebugIds;if(!r)return;let n,i=Rm.get(e);i?n=i:(n=new Map,Rm.set(e,n));let s=Object.entries(r).reduce((o,[c,u])=>{let f,g=n.get(c);g?f=g:(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 Qy(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 Zy(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function ev(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 tv(t,e){if(!e)return t;let r=t?t.clone():new ut;return r.update(e),r}function Am(t){if(t)return rv(t)?{captureContext:t}:iv(t)?{captureContext:t}:t}function rv(t){return t instanceof ut||typeof t=="function"}var nv=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function iv(t){return Object.keys(t).some(e=>nv.includes(e))}function Ta(t,e){return xn().captureException(t,Am(e))}function Ro(t,e){return xn().captureEvent(t,e)}var ov="7";function sv(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function av(t){return`${sv(t)}${t.projectId}/envelope/`}function cv(t,e){return kl(b({sentry_key:t.publicKey,sentry_version:ov},e&&{sentry_client:`${e.name}/${e.version}`}))}function Pm(t,e,r){return e||`${av(t)}?${cv(t,r)}`}var Lm=[];function Bm(t,e){let r={};return e.forEach(n=>{n&&Su(t,n,r)}),r}function Eu(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function Su(t,e,r){if(r[e.name]){xe&&q.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Lm.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Lm.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)}xe&&q.log(`Integration installed: ${e.name}`)}var Um="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=na(t.dsn):xe&&q.warn("No DSN provided, client will not send events."),this._dsn){let e=Pm(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=rt();if(pa(t))return xe&&q.log(Um),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:rt()},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=rt();if(e&&e.originalException&&pa(e.originalException))return xe&&q.log(Um),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"?xe&&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))):Yt(!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];Su(this,t,this._integrations),e||Eu(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let r=Cm(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of e.attachments||[])r=tu(r,nu(i));let n=this.sendEnvelope(r);n&&n.then(i=>this.emit("afterSendEvent",t,i),null)}sendSession(t){let e=xm(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(e)}recordDroppedEvent(t,e,r){if(this._options.sendClientReports){let n=`${t}:${e}`;xe&&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=>(xe&&q.error("Error while sending event:",e),e)):(xe&&q.error("Transport disabled"),Yt({}))}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=Bm(this,t),Eu(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),Nm(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:g,dsc:h}=c;o.contexts=b({trace:Qe({trace_id:u,span_id:f,parent_span_id:g})},o.contexts);let v=h||vu(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(xe){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=bu(t),o=Mm(t),c=t.type||"error",u=`before send for type \`${c}\``,f=typeof i>"u"?void 0:Tm(i);if(o&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",t),Xr(new lt(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));let g=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",g,t),new lt("An event processor returned `null`, will not send event.","log");if(e.data&&e.data.__sentry__===!0)return v;let _=uv(this,n,v,e);return lv(_,u)}).then(v=>{if(v===null){if(this.recordDroppedEvent("before_send",g,t),bu(t)){let y=1+(t.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+y}throw new lt(`${u} returned \`null\`, will not send event.`,"log")}let _=r&&r.getSession();!s&&_&&this._updateSessionFromEvent(_,v);let m=v.transaction_info;if(s&&m&&v.transaction!==t.transaction){let y="custom";v.transaction_info=Z(b({},m),{source:y})}return this.sendEvent(v,e),v}).then(null,v=>{throw v instanceof lt?v:(this.captureException(v,{data:{__sentry__:!0},originalException:v}),new lt(`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 lv(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 lt(r);return n},n=>{throw new lt(`${e} rejected with ${n}`)});if(!nr(t)&&t!==null)throw new lt(r);return t}function uv(t,e,r,n){let{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e;if(Mm(r)&&i)return i(r,n);if(bu(r)){if(r.spans&&o){let c=[];for(let u of r.spans){let f=o(u);f?c.push(f):t.recordDroppedEvent("before_send","span")}r.spans=c}if(s)return s(r,n)}return r}function Mm(t){return t.type===void 0}function bu(t){return t.type==="transaction"}var pv=64;function xa(t,e,r=Xl(t.bufferSize||pv)){let n={},i=o=>r.drain(o);function s(o){let c=[];if(da(o,(h,v)=>{let _=ha(v);if(su(n,_)){let m=km(h,v);t.recordDroppedEvent("ratelimit_backoff",_,m)}else c.push(h)}),c.length===0)return Yt({});let u=xr(o[0],c),f=h=>{da(u,(v,_)=>{let m=km(v,_);t.recordDroppedEvent(h,ha(_),m)})},g=()=>e({body:ru(u)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&xe&&q.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),n=au(n,h),h),h=>{throw f("network_error"),h});return r.add(g).then(h=>h,h=>{if(h instanceof lt)return xe&&q.error("Skipped sending event because buffer is full."),f("queue_overflow"),Yt({});throw h})}return{send:s,flush:i}}function km(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function wu(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:Vt})),version:Vt}),t._metadata=i}var fv=100;function Cr(t,e){let r=Be(),n=Cn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:s=fv}=r.getOptions();if(s<=0)return;let o=Tr(),c=b({timestamp:o},t),u=i?Ti(()=>i(c,e)):c;u!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",u,e),n.addBreadcrumb(u,s))}var Fm,mv="FunctionToString",Hm=new WeakMap,dv=()=>({name:mv,setupOnce(){Fm=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=In(this),r=Hm.has(Be())&&e!==void 0?e:this;return Fm.apply(r,t)}}catch{}},setup(t){Hm.set(t,!0)}}),Ca=dv,hv=[/^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"],gv="InboundFilters",yv=(t={})=>({name:gv,processEvent(e,r,n){let i=n.getOptions(),s=vv(t,i);return _v(e,s)?null:e}}),Ra=yv;function vv(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:hv],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function _v(t,e){return e.ignoreInternal&&Tv(t)?(xe&&q.warn(`Event dropped due to being internal Sentry Error.
31
+ Event: ${ir(t)}`),!0):Ev(t,e.ignoreErrors)?(xe&&q.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
32
+ Event: ${ir(t)}`),!0):Cv(t)?(xe&&q.warn(`Event dropped due to not having an error message, error type or stacktrace.
33
+ Event: ${ir(t)}`),!0):Sv(t,e.ignoreTransactions)?(xe&&q.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
34
+ Event: ${ir(t)}`),!0):bv(t,e.denyUrls)?(xe&&q.warn(`Event dropped due to being matched by \`denyUrls\` option.
35
+ Event: ${ir(t)}.
36
36
  Url: ${Da(t)}`),!0):wv(t,e.allowUrls)?!1:(xe&&q.warn(`Event dropped due to not being matched by \`allowUrls\` option.
37
- Event: ${nr(t)}.
38
- Url: ${Da(t)}`),!0)}function Ev(t,e){return t.type||!e||!e.length?!1:Iv(t).some(r=>bi(r,e))}function Sv(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?bi(r,e):!1}function bv(t,e){if(!e||!e.length)return!1;let r=Da(t);return r?bi(r,e):!1}function wv(t,e){if(!e||!e.length)return!0;let r=Da(t);return r?bi(r,e):!0}function Iv(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 Tv(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function xv(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 Da(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?xv(e):null}catch{return xe&&q.error(`Cannot extract url for event ${nr(t)}`),null}}function Cv(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 Dv="Dedupe",Rv=()=>{let t;return{name:Dv,processEvent(e){if(e.type)return e;try{if(Nv(e,t))return xe&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Na=Rv;function Nv(t,e){return e?!!(Av(t,e)||Ov(t,e)):!1}function Av(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Wm(t,e)||!jm(t,e))}function Ov(t,e){let r=$m(e),n=$m(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Wm(t,e)||!jm(t,e))}function jm(t,e){let r=aa(t),n=aa(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 Wm(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 $m(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ge=ee,Iu=0;function Tu(){return Iu>0}function Vv(){Iu++,setTimeout(()=>{Iu--})}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 Vv(),ba(o=>{o.addEventProcessor(c=>(e.mechanism&&(xi(c,void 0,void 0),Lr(c,e.mechanism)),c.extra=Z(b({},c.extra),{arguments:i}),c)),Ta(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ia(n,t),yt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Ur=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Aa(t,e){let r=Du(t,e),n={type:e&&e.name,value:Jv(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function zv(t,e,r,n){let i=Be(),s=i&&i.getOptions().normalizeDepth,o=Zv(e),c={__serialized__:ma(e,s)};if(o)return{exception:{values:[Aa(t,o)]},extra:c};let u={exception:{values:[{type:wn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Xv(e,{isUnhandledRejection:n})}]},extra:c};if(r){let f=Du(t,r);f.length&&(u.exception.values[0].stacktrace={frames:f})}return u}function xu(t,e){return{exception:{values:[Aa(t,e)]}}}function Du(t,e){let r=e.stacktrace||e.stack||"",n=qv(e),i=Kv(e);try{return t(r,n,i)}catch{}return[]}var Yv=/Minified React error #\d+;/i;function qv(t){return t&&Yv.test(t.message)?1:0}function Kv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Jv(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Ym(t,e,r,n){let i=r&&r.syntheticException||void 0,s=Oa(t,e,i,n);return Lr(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Yt(s)}function qm(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Cu(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Yt(o)}function Oa(t,e,r,n,i){let s;if(ea(e)&&e.error)return xu(t,e.error);if(ta(e)||Dl(e)){let o=e;if("stack"in e)s=xu(t,e);else{let c=o.name||(ta(o)?"DOMError":"DOMException"),u=o.message?`${c}: ${o.message}`:c;s=Cu(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)?xu(t,e):rr(e)||wn(e)?(s=zv(t,e,r,i),Lr(s,{synthetic:!0}),s):(s=Cu(t,e,r,n),xi(s,`${e}`,void 0),Lr(s,{synthetic:!0}),s)}function Cu(t,e,r,n){let i={};if(n&&r){let s=Du(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 Xv(t,{isUnhandledRejection:e}){let r=Fl(t),n=e?"promise rejection":"exception";return ea(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:wn(t)?`Event \`${Qv(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Qv(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Zv(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Km(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:br(n)}),s=e_(t);return Tr(i,[s])}function e_(t){return[{type:"user_report"},t]}var Ao=class extends No{constructor(t){let e=b({parentSpanIsAlwaysRootSpan:!0},t),r=Ge.SENTRY_SDK_SOURCE||Kl();wu(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ge.document&&Ge.document.addEventListener("visibilitychange",()=>{Ge.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return Ym(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return qm(this._options.stackParser,t,e,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){Ur&&q.warn("SDK not enabled, will not capture user feedback.");return}let e=Km(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){Ur&&q.log("No outcomes to send");return}if(!this._dsn){Ur&&q.log("No dsn provided, will not send outcomes");return}Ur&&q.log("Sending outcomes:",t);let e=ou(t,this._options.tunnel&&br(this._dsn));this.sendEnvelope(e)}},Jm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ye=ee,t_=1e3,Xm,Ru,Nu;function Au(t){let e="dom";vt(e,t),_t(e,r_)}function r_(){if(!Ye.document)return;let t=Ze.bind(null,"dom"),e=Qm(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")||(Oe(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__||{},g=f[s]=f[s]||{refCount:0};if(!g.handler){let h=Qm(t);g.handler=h,i.call(this,s,h,c)}g.refCount++}catch{}return i.call(this,s,o,c)}}),Oe(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__||{},g=f[s];g&&(g.refCount--,g.refCount<=0&&(i.call(this,s,g.handler,c),g.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 n_(t){if(t.type!==Ru)return!1;try{if(!t.target||t.target._sentryId!==Nu)return!1}catch{}return!0}function i_(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Qm(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=o_(r);if(i_(r.type,n))return;yt(r,"_sentryCaptured",!0),n&&!n._sentryId&&yt(n,"_sentryId",rt());let i=r.type==="keypress"?"input":r.type;n_(r)||(t({event:r,name:i,global:e}),Ru=r.type,Nu=n?n._sentryId:void 0),clearTimeout(Xm),Xm=Ye.setTimeout(()=>{Nu=void 0,Ru=void 0},t_)}}function o_(t){try{return t.target}catch{return null}}var Pa;function Ou(t){let e="history";vt(e,t),_t(e,s_)}function s_(){if(!cu())return;let t=Ye.onpopstate;Ye.onpopstate=function(...r){let n=Ye.location.href,i=Pa;if(Pa=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=Pa,o=String(i);Pa=o,Ze("history",{from:s,to:o})}return r.apply(this,n)}}Oe(Ye.history,"pushState",e),Oe(Ye.history,"replaceState",e)}var La={};function Pu(t){let e=La[t];if(e)return e;let r=Ye[t];if(bo(r))return La[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){Jm&&q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(La[t]=r.bind(Ye))}function Ba(t){La[t]=void 0}var Nn="__sentry_xhr_v3__";function Lu(t){let e="xhr";vt(e,t),_t(e,a_)}function a_(){if(!Ye.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Oe(t,"open",function(e){return function(...r){let n=Lt()*1e3,i=gt(r[0])?r[0].toUpperCase():void 0,s=c_(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:Lt()*1e3,startTimestamp:n,xhr:this};Ze("xhr",u)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Oe(this,"onreadystatechange",function(c){return function(...u){return o(),c.apply(this,u)}}):this.addEventListener("readystatechange",o),Oe(this,"setRequestHeader",function(c){return function(...u){let[f,g]=u,h=this[Nn];return h&&gt(f)&&gt(g)&&(h.request_headers[f.toLowerCase()]=g),c.apply(this,u)}}),e.apply(this,r)}}),Oe(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:Lt()*1e3,xhr:this};return Ze("xhr",i),e.apply(this,r)}})}function c_(t){if(gt(t))return t;try{return t.toString()}catch{}}function Bu(t,e=Pu("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 Ba("fetch"),Xr("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 Ba("fetch"),r-=o,n--,Xr(u)}}return xa(t,i)}var l_=30,u_=50;function Uu(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?wr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var p_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,f_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,m_=/\((\S*)(?::(\d+))(?::(\d+))\)/,d_=t=>{let e=p_.exec(t);if(e){let[,n,i,s]=e;return Uu(n,wr,+i,+s)}let r=f_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=m_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=rd(r[1]||wr,r[2]);return Uu(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Zm=[l_,d_],h_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,g_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,y_=t=>{let e=h_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=g_.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]||wr;return[n,r]=rd(n,r),Uu(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ed=[u_,y_],td=[Zm,ed],Mu=$l(...td),rd=(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]:wr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ua=1024,__="Breadcrumbs",E_=(t={})=>{let e=b({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:__,setup(r){e.console&&jl(w_(r)),e.dom&&Au(b_(r,e.dom)),e.xhr&&Lu(I_(r)),e.fetch&&zl(T_(r)),e.history&&Ou(x_(r)),e.sentry&&r.on("beforeSendEvent",S_(r))}}},nd=E_;function S_(t){return function(e){Be()===t&&xr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:nr(e)},{event:e})}}function b_(t,e){return function(r){if(Be()!==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>Ua&&(Ur&&q.warn(`\`dom.maxStringLength\` cannot exceed ${Ua}, but a value of ${o} was configured. Sentry will use ${Ua} instead.`),o=Ua),typeof s=="string"&&(s=[s]);try{let u=r.event,f=C_(u)?u.target:u;n=Eo(f,{keyAttrs:s,maxStringLength:o}),i=Ul(f)}catch{n="<unknown>"}if(n.length===0)return;let c={category:`ui.${r.name}`,message:n};i&&(c.data={"ui.component_name":i}),xr(c,{event:r.event,name:r.name,global:r.global})}}function w_(t){return function(e){if(Be()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:Ql(e.level),message:ra(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${ra(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;xr(r,{input:e.args,level:e.level})}}function I_(t){return function(e){if(Be()!==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},g={xhr:e.xhr,input:u,startTimestamp:r,endTimestamp:n};xr({category:"xhr",data:f,type:"http"},g)}}function T_(t){return function(e){if(Be()!==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};xr({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};xr({category:"fetch",data:s,type:"http"},o)}}}function x_(t){return function(e){if(Be()!==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),xr({category:"navigation",data:{from:r,to:n}})}}function C_(t){return!!t&&!!t.target}var D_=["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"],R_="BrowserApiErrors",N_=(t={})=>{let e=b({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:R_,setupOnce(){e.setTimeout&&Oe(Ge,"setTimeout",id),e.setInterval&&Oe(Ge,"setInterval",id),e.requestAnimationFrame&&Oe(Ge,"requestAnimationFrame",A_),e.XMLHttpRequest&&"XMLHttpRequest"in Ge&&Oe(XMLHttpRequest.prototype,"send",O_);let r=e.eventTarget;r&&(Array.isArray(r)?r:D_).forEach(P_)}}},od=N_;function id(t){return function(...e){let r=e[0];return e[0]=Rn(r,{mechanism:{data:{function:zt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function A_(t){return function(e){return t.apply(this,[Rn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:zt(t)},handled:!1,type:"instrument"}})])}}function O_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Oe(r,n,function(i){let s={mechanism:{data:{function:n,handler:zt(i)},handled:!1,type:"instrument"}},o=In(i);return o&&(s.mechanism.data.handler=zt(o)),Rn(i,s)})}),t.apply(this,e)}}function P_(t){let e=Ge,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Oe(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=Rn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:zt(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Rn(s,{mechanism:{data:{function:"addEventListener",handler:zt(s),target:t},handled:!1,type:"instrument"}}),o])}}),Oe(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 L_="GlobalHandlers",B_=(t={})=>{let e=b({onerror:!0,onunhandledrejection:!0},t);return{name:L_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(U_(r),sd("onerror")),e.onunhandledrejection&&(M_(r),sd("onunhandledrejection"))}}},ad=B_;function U_(t){Yl(e=>{let{stackParser:r,attachStacktrace:n}=cd();if(Be()!==t||Tu())return;let{msg:i,url:s,line:o,column:c,error:u}=e,f=H_(Oa(r,u||i,void 0,n,!1),s,o,c);f.level="error",Ro(f,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function M_(t){ql(e=>{let{stackParser:r,attachStacktrace:n}=cd();if(Be()!==t||Tu())return;let i=k_(e),s=bn(i)?F_(i):Oa(r,i,void 0,n,!0);s.level="error",Ro(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function k_(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 F_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function H_(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,g=isNaN(parseInt(r,10))?void 0:r,h=gt(e)&&e.length>0?e:Bl();return u.length===0&&u.push({colno:f,filename:h,function:wr,in_app:!0,lineno:g}),t}function sd(t){Ur&&q.log(`Global Handler attached: ${t}`)}function cd(){let t=Be();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var ld=()=>({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}}),$_="cause",j_=5,W_="LinkedErrors",G_=(t={})=>{let e=t.limit||j_,r=t.key||$_;return{name:W_,preprocessEvent(n,i,s){let o=s.getOptions();Pl(Aa,o.stackParser,o.maxValueLength,r,e,n,i)}}},ud=G_;function ku(t){return[Ra(),Ca(),od(),nd(),ad(),ud(),Na(),ld()]}var Fu=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},Ue=class Cd{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Cd),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 Fu(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 ut;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=ku({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Ao({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Bu,stackParser:Mu,integrations:e,environment:Gr.mode,release:`web-sdk@${A.SDK_VERSION}`,debug:Gr.debug}),this.client.init()}},Hu={d:(t,e)=>{for(var r in e)Hu.o(e,r)&&!Hu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},$u={};Hu.d($u,{A:()=>Y_,k:()=>ju});var V_=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(f){try{u(n.next(f))}catch(g){s(g)}}function c(f){try{u(n.throw(f))}catch(g){s(g)}}function u(f){var g;f.done?i(f.value):(g=f.value,g instanceof r?g:new r(function(h){h(g)})).then(o,c)}u((n=n.apply(t,e||[])).next())})},z_=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(g){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,g[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,n=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=e.call(t,o)}catch(h){g=[6,h],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([u,f])}}};function ju(){return V_(this,void 0,Promise,function(){return z_(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=ju);var Y_=ju,pd=$u.A,OL=$u.k,hd=Xt(tn()),Ma=class{parser;result={};constructor(){this.parser=Nt.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))}},ka=class{loadedFonts=[];async loadAllFonts(t){t.elems?.forEach(e=>{e instanceof dr&&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)})}},Fa=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"}},Ha=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"),Fa.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}},qt=class{renderer=Nt.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 Ha(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Cr=class extends qt{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 Cr{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 qt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},An=class extends qt{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 Td extends qt{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",Td.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(){}},ja=class extends qt{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 Cr{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)}},Wa=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()})}},Ga=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()})}},Va=class Bn extends Cr{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)}},za=class extends Cr{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 mr(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}},Ya=class extends An{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},qa=Xt(tn()),Dr=class Nd{static INSTANCE=new Nd;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new ht),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new ht),this.topics[e].asObservable()}},et=class Wr{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=je.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 qa.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(console.log(`
37
+ Event: ${ir(t)}.
38
+ Url: ${Da(t)}`),!0)}function Ev(t,e){return t.type||!e||!e.length?!1:Iv(t).some(r=>bi(r,e))}function Sv(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?bi(r,e):!1}function bv(t,e){if(!e||!e.length)return!1;let r=Da(t);return r?bi(r,e):!1}function wv(t,e){if(!e||!e.length)return!0;let r=Da(t);return r?bi(r,e):!0}function Iv(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 Tv(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function xv(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 Da(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?xv(e):null}catch{return xe&&q.error(`Cannot extract url for event ${ir(t)}`),null}}function Cv(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 Dv="Dedupe",Rv=()=>{let t;return{name:Dv,processEvent(e){if(e.type)return e;try{if(Nv(e,t))return xe&&q.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Na=Rv;function Nv(t,e){return e?!!(Av(t,e)||Ov(t,e)):!1}function Av(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Wm(t,e)||!jm(t,e))}function Ov(t,e){let r=$m(e),n=$m(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!Wm(t,e)||!jm(t,e))}function jm(t,e){let r=aa(t),n=aa(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 Wm(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 $m(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ge=ee,Iu=0;function Tu(){return Iu>0}function Vv(){Iu++,setTimeout(()=>{Iu--})}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 Vv(),ba(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)),Ta(s)}),s}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ia(n,t),vt(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 Aa(t,e){let r=Du(t,e),n={type:e&&e.name,value:Jv(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function zv(t,e,r,n){let i=Be(),s=i&&i.getOptions().normalizeDepth,o=Zv(e),c={__serialized__:ma(e,s)};if(o)return{exception:{values:[Aa(t,o)]},extra:c};let u={exception:{values:[{type:wn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Xv(e,{isUnhandledRejection:n})}]},extra:c};if(r){let f=Du(t,r);f.length&&(u.exception.values[0].stacktrace={frames:f})}return u}function xu(t,e){return{exception:{values:[Aa(t,e)]}}}function Du(t,e){let r=e.stacktrace||e.stack||"",n=qv(e),i=Kv(e);try{return t(r,n,i)}catch{}return[]}var Yv=/Minified React error #\d+;/i;function qv(t){return t&&Yv.test(t.message)?1:0}function Kv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Jv(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function Ym(t,e,r,n){let i=r&&r.syntheticException||void 0,s=Oa(t,e,i,n);return Br(s),s.level="error",r&&r.event_id&&(s.event_id=r.event_id),Yt(s)}function qm(t,e,r="info",n,i){let s=n&&n.syntheticException||void 0,o=Cu(t,e,s,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),Yt(o)}function Oa(t,e,r,n,i){let s;if(ea(e)&&e.error)return xu(t,e.error);if(ta(e)||Dl(e)){let o=e;if("stack"in e)s=xu(t,e);else{let c=o.name||(ta(o)?"DOMError":"DOMException"),u=o.message?`${c}: ${o.message}`:c;s=Cu(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)?xu(t,e):nr(e)||wn(e)?(s=zv(t,e,r,i),Br(s,{synthetic:!0}),s):(s=Cu(t,e,r,n),xi(s,`${e}`,void 0),Br(s,{synthetic:!0}),s)}function Cu(t,e,r,n){let i={};if(n&&r){let s=Du(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 Xv(t,{isUnhandledRejection:e}){let r=Fl(t),n=e?"promise rejection":"exception";return ea(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:wn(t)?`Event \`${Qv(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Qv(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Zv(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Km(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=e_(t);return xr(i,[s])}function e_(t){return[{type:"user_report"},t]}var Ao=class extends No{constructor(t){let e=b({parentSpanIsAlwaysRootSpan:!0},t),r=Ge.SENTRY_SDK_SOURCE||Kl();wu(e,"browser",["browser"],r),super(e),e.sendClientReports&&Ge.document&&Ge.document.addEventListener("visibilitychange",()=>{Ge.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,e){return Ym(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",r){return qm(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=Km(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=ou(t,this._options.tunnel&&wr(this._dsn));this.sendEnvelope(e)}},Jm=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ye=ee,t_=1e3,Xm,Ru,Nu;function Au(t){let e="dom";_t(e,t),Et(e,r_)}function r_(){if(!Ye.document)return;let t=Ze.bind(null,"dom"),e=Qm(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")||(Oe(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__||{},g=f[s]=f[s]||{refCount:0};if(!g.handler){let h=Qm(t);g.handler=h,i.call(this,s,h,c)}g.refCount++}catch{}return i.call(this,s,o,c)}}),Oe(n,"removeEventListener",function(i){return function(s,o,c){if(s==="click"||s=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__||{},g=f[s];g&&(g.refCount--,g.refCount<=0&&(i.call(this,s,g.handler,c),g.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 n_(t){if(t.type!==Ru)return!1;try{if(!t.target||t.target._sentryId!==Nu)return!1}catch{}return!0}function i_(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Qm(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=o_(r);if(i_(r.type,n))return;vt(r,"_sentryCaptured",!0),n&&!n._sentryId&&vt(n,"_sentryId",rt());let i=r.type==="keypress"?"input":r.type;n_(r)||(t({event:r,name:i,global:e}),Ru=r.type,Nu=n?n._sentryId:void 0),clearTimeout(Xm),Xm=Ye.setTimeout(()=>{Nu=void 0,Ru=void 0},t_)}}function o_(t){try{return t.target}catch{return null}}var Pa;function Ou(t){let e="history";_t(e,t),Et(e,s_)}function s_(){if(!cu())return;let t=Ye.onpopstate;Ye.onpopstate=function(...r){let n=Ye.location.href,i=Pa;if(Pa=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=Pa,o=String(i);Pa=o,Ze("history",{from:s,to:o})}return r.apply(this,n)}}Oe(Ye.history,"pushState",e),Oe(Ye.history,"replaceState",e)}var La={};function Pu(t){let e=La[t];if(e)return e;let r=Ye[t];if(bo(r))return La[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){Jm&&q.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(La[t]=r.bind(Ye))}function Ba(t){La[t]=void 0}var Nn="__sentry_xhr_v3__";function Lu(t){let e="xhr";_t(e,t),Et(e,a_)}function a_(){if(!Ye.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Oe(t,"open",function(e){return function(...r){let n=Lt()*1e3,i=yt(r[0])?r[0].toUpperCase():void 0,s=c_(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:Lt()*1e3,startTimestamp:n,xhr:this};Ze("xhr",u)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Oe(this,"onreadystatechange",function(c){return function(...u){return o(),c.apply(this,u)}}):this.addEventListener("readystatechange",o),Oe(this,"setRequestHeader",function(c){return function(...u){let[f,g]=u,h=this[Nn];return h&&yt(f)&&yt(g)&&(h.request_headers[f.toLowerCase()]=g),c.apply(this,u)}}),e.apply(this,r)}}),Oe(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:Lt()*1e3,xhr:this};return Ze("xhr",i),e.apply(this,r)}})}function c_(t){if(yt(t))return t;try{return t.toString()}catch{}}function Bu(t,e=Pu("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 Ba("fetch"),Xr("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 Ba("fetch"),r-=o,n--,Xr(u)}}return xa(t,i)}var l_=30,u_=50;function Uu(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 p_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,f_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,m_=/\((\S*)(?::(\d+))(?::(\d+))\)/,d_=t=>{let e=p_.exec(t);if(e){let[,n,i,s]=e;return Uu(n,Ir,+i,+s)}let r=f_.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=m_.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[n,i]=rd(r[1]||Ir,r[2]);return Uu(i,n,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Zm=[l_,d_],h_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,g_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,y_=t=>{let e=h_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=g_.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]=rd(n,r),Uu(r,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ed=[u_,y_],td=[Zm,ed],Mu=$l(...td),rd=(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]},Ua=1024,__="Breadcrumbs",E_=(t={})=>{let e=b({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:__,setup(r){e.console&&jl(w_(r)),e.dom&&Au(b_(r,e.dom)),e.xhr&&Lu(I_(r)),e.fetch&&zl(T_(r)),e.history&&Ou(x_(r)),e.sentry&&r.on("beforeSendEvent",S_(r))}}},nd=E_;function S_(t){return function(e){Be()===t&&Cr({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:ir(e)},{event:e})}}function b_(t,e){return function(r){if(Be()!==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>Ua&&(Mr&&q.warn(`\`dom.maxStringLength\` cannot exceed ${Ua}, but a value of ${o} was configured. Sentry will use ${Ua} instead.`),o=Ua),typeof s=="string"&&(s=[s]);try{let u=r.event,f=C_(u)?u.target:u;n=Eo(f,{keyAttrs:s,maxStringLength:o}),i=Ul(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 w_(t){return function(e){if(Be()!==t)return;let r={category:"console",data:{arguments:e.args,logger:"console"},level:Ql(e.level),message:ra(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)r.message=`Assertion failed: ${ra(e.args.slice(1)," ")||"console.assert"}`,r.data.arguments=e.args.slice(1);else return;Cr(r,{input:e.args,level:e.level})}}function I_(t){return function(e){if(Be()!==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},g={xhr:e.xhr,input:u,startTimestamp:r,endTimestamp:n};Cr({category:"xhr",data:f,type:"http"},g)}}function T_(t){return function(e){if(Be()!==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 x_(t){return function(e){if(Be()!==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 C_(t){return!!t&&!!t.target}var D_=["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"],R_="BrowserApiErrors",N_=(t={})=>{let e=b({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:R_,setupOnce(){e.setTimeout&&Oe(Ge,"setTimeout",id),e.setInterval&&Oe(Ge,"setInterval",id),e.requestAnimationFrame&&Oe(Ge,"requestAnimationFrame",A_),e.XMLHttpRequest&&"XMLHttpRequest"in Ge&&Oe(XMLHttpRequest.prototype,"send",O_);let r=e.eventTarget;r&&(Array.isArray(r)?r:D_).forEach(P_)}}},od=N_;function id(t){return function(...e){let r=e[0];return e[0]=Rn(r,{mechanism:{data:{function:zt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function A_(t){return function(e){return t.apply(this,[Rn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:zt(t)},handled:!1,type:"instrument"}})])}}function O_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&Oe(r,n,function(i){let s={mechanism:{data:{function:n,handler:zt(i)},handled:!1,type:"instrument"}},o=In(i);return o&&(s.mechanism.data.handler=zt(o)),Rn(i,s)})}),t.apply(this,e)}}function P_(t){let e=Ge,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Oe(r,"addEventListener",function(n){return function(i,s,o){try{typeof s.handleEvent=="function"&&(s.handleEvent=Rn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:zt(s),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Rn(s,{mechanism:{data:{function:"addEventListener",handler:zt(s),target:t},handled:!1,type:"instrument"}}),o])}}),Oe(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 L_="GlobalHandlers",B_=(t={})=>{let e=b({onerror:!0,onunhandledrejection:!0},t);return{name:L_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(U_(r),sd("onerror")),e.onunhandledrejection&&(M_(r),sd("onunhandledrejection"))}}},ad=B_;function U_(t){Yl(e=>{let{stackParser:r,attachStacktrace:n}=cd();if(Be()!==t||Tu())return;let{msg:i,url:s,line:o,column:c,error:u}=e,f=H_(Oa(r,u||i,void 0,n,!1),s,o,c);f.level="error",Ro(f,{originalException:u,mechanism:{handled:!1,type:"onerror"}})})}function M_(t){ql(e=>{let{stackParser:r,attachStacktrace:n}=cd();if(Be()!==t||Tu())return;let i=k_(e),s=bn(i)?F_(i):Oa(r,i,void 0,n,!0);s.level="error",Ro(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function k_(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 F_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function H_(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,g=isNaN(parseInt(r,10))?void 0:r,h=yt(e)&&e.length>0?e:Bl();return u.length===0&&u.push({colno:f,filename:h,function:Ir,in_app:!0,lineno:g}),t}function sd(t){Mr&&q.log(`Global Handler attached: ${t}`)}function cd(){let t=Be();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var ld=()=>({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}}),$_="cause",j_=5,W_="LinkedErrors",G_=(t={})=>{let e=t.limit||j_,r=t.key||$_;return{name:W_,preprocessEvent(n,i,s){let o=s.getOptions();Pl(Aa,o.stackParser,o.maxValueLength,r,e,n,i)}}},ud=G_;function ku(t){return[Ra(),Ca(),od(),nd(),ad(),ud(),Na(),ld()]}var Fu=class extends Error{cause;constructor(t,e){super(t),this.cause=e}},Ue=class Cd{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Cd),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 Fu(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 ut;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=ku({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new Ao({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Bu,stackParser:Mu,integrations:e,environment:Qt.mode,release:`web-sdk@${A.SDK_VERSION}`,debug:Qt.debug}),this.client.init()}},Hu={d:(t,e)=>{for(var r in e)Hu.o(e,r)&&!Hu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},$u={};Hu.d($u,{A:()=>Y_,k:()=>ju});var V_=function(t,e,r,n){return new(r||(r=Promise))(function(i,s){function o(f){try{u(n.next(f))}catch(g){s(g)}}function c(f){try{u(n.throw(f))}catch(g){s(g)}}function u(f){var g;f.done?i(f.value):(g=f.value,g instanceof r?g:new r(function(h){h(g)})).then(o,c)}u((n=n.apply(t,e||[])).next())})},z_=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(g){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,g[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,n=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=e.call(t,o)}catch(h){g=[6,h],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([u,f])}}};function ju(){return V_(this,void 0,Promise,function(){return z_(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=ju);var Y_=ju,pd=$u.A,PL=$u.k,hd=Xt(tn()),Ma=class{parser;result={};constructor(){this.parser=Nt.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))}},ka=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)})}},Fa=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"}},Ha=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"),Fa.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}},qt=class{renderer=Nt.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 Ha(t,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}},Dr=class extends qt{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 qt{constructor(t,e,r){super(t,e,r),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}},An=class extends qt{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 Td extends qt{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",Td.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(){}},ja=class extends qt{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)}},Wa=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()})}},Ga=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()})}},Va=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)}},za=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}},Ya=class extends An{constructor(t,e,r){super(t,e,r)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}},qa=Xt(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 gt),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new gt),this.topics[e].asObservable()}},et=class Gr{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=je.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 qa.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(console.log(`
39
39
 
40
40
  cooee_debug CartDrawer:open:97`,this.cartDrawerElement,`
41
41
 
42
- `),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){this.isMiniCart()&&this.element?._rerenderCart?this.element._rerenderCart({detail:{cart:e}}):this.isShopifyDefaultDrawer()?this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e)):this.element?.onCartDrawerUpdate?this.element.onCartDrawerUpdate():window.icartCartActivityEvent?window.icartCartActivityEvent():window.theme?.CartDrawer?new window.theme.CartDrawer().init():window.Hs_CartDrawer?.updateSlideCart?window.Hs_CartDrawer.updateSlideCart():window.theme?.fetch_side_cart?window.theme.fetch_side_cart():window.theme?.Cart?.updateCart?window.theme.Cart.updateCart():window.cartUpdate?window.cartUpdate():this.element?._onCartRefresh?this.element._onCartRefresh():this.element?.tagName?.toLowerCase()==="cart-drawer-component"?document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart")):this.element?.id==="sidebar-cart"?document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}})):w.info("No method found to update the cart without refreshing"),r&&Dr.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){qa.default.warn("Max attempts exhausted to find cart drawer");return}qa.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()===Wr.DEFAULT_SELECTOR&&this.cartDrawerElement.open,u=getComputedStyle(this.cartDrawerElement),f=u.display!=="none"&&u.visibility!=="hidden"&&parseFloat(u.opacity)>0,g=!this.cartDrawerElement.hidden,h=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,v=u.transform.match(/matrix\(([^)]+)\)/),_=0,m=0;if(v){let V=v[1].split(", ").map(parseFloat);_=V[4],m=V[5]}let y=_+e.left>n||_+e.right<0||m+e.top>r||m+e.bottom<0,T=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=T*O,R=e.width*e.height,k=R>0&&H/R>=.1;return(o||c||!y)&&f&&g&&h&&k}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new ht;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(tr(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 vc{static ACTIVE_TRIGGER_DATA;renderer=Nt.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 Pt(e))}async renderEngagement(e){if(!e.previewType&&vc.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mi(vc.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(e,r);return}if(vc.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){Ue.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 Wa(e,r,n).render():r instanceof ni?new Ga(e,r,n).render():r instanceof Yr?new Oo(e,r,n).render():r instanceof ii?new Ya(e,r,n).render():r instanceof Ar?new An(e,r,n).render():r instanceof an?new Po(e,r,n).render():r instanceof ei?new Va(e,r,n).render():r instanceof ti?new za(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new ja(this.rootContainer,r,e).render().getHTMLElement(),new ka().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),vc.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(){Nt.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"})}},Ka=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(kt.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}},Ja=class{static trackIntent(t){if(!this.isInstalled()){w.log("Facebook pixel not installed");return}if(!je.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"}},md=Xt(fd()),On=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ae.isShopify()}},q_=(0,md.default)(fetch),K_={retryDelay:A.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=A.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Tt=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=Gr.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 Ue.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({},K_),r),i=await q_(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),Gr.debug&&e.set("cooee-sdk-debug",String(1)),e}},Pi=class{static sentryService=Ue.getInstance();static httpApiService=Tt.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 wt(o);f.name=u.title;let g=new mr(c);g.name=u.variant_title,g.price.d=u.discounted_price/100,f.variants=[g],s.push(f)}return s}if(je.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)}},Xa=class kd{static INSTANCE;httpService=ae.get(Tt);sentryService=ae.get(Ue);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}`),Kt.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),Kt.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=vr.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 Pt(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 Ka().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),Ja.trackIntent(e),Kt.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=Tt.getInstance();eventAPIService=Xa.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)}},Kt=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="&#x2022; "+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)}},Qa=class{static processConfiguration(){let t=je.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=je.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},Za=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)),Qa.processConfiguration(),r.website&&(It.injectRawScript(r.website.commonJS),It.injectRawCSS(r.website.commonCSS)),et.get().onToggle().subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(ae.get(sr).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))}},dd=Xt(vl()),ec=class Yu{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 dd.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 Yu(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Yu(r)}},Pn=class Ld{static INSTANCE=new Ld;httpAPIService=Tt.getInstance();coreService=Za.getInstance();sentryService=Ue.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),Kt.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 Ma().get();r.host=location.origin;try{(await pd())?.isPrivate&&(r.private=!0)}catch(i){hd.default.error("Unable to detect private/incognito window",i)}let n=await Ne.get(ne.DEVICE_ID);return n||(n=new Xe().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:vr.parseFromCurrent(),ad:ec.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 yc{static replaySubject=new ho(1);static INSTANCE;sentryService=ae.get(Ue);lock=new Jn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new yc),this.INSTANCE}init(e){if(w.debug("Initialising SDK",e),Gf(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}Pn.getInstance().init(e),yc.INSTANCE.checkForNewSession(!0).then(async()=>{yc.replaySubject.next(!0),yc.replaySubject.complete()}).catch(r=>w.error("Unable to perform device init",r))}getCurrentSessionID(){return at.set(ne.SESSION_LAST_USED_TIME,new Date().getTime()),at.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 at.set(ne.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){w.debug("Starting new session"),await at.clear(),w.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Xe().toHexString();w.debug("New session ID to be used",r);let n=await Ne.get(ne.SESSION_NUMBER,0)+1;Kt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ne.set(ne.SESSION_NUMBER,n),at.set(ne.ID,r),at.set(ne.SESSION_LAST_USED_TIME,e.getTime()),at.set(ne.SESSION_LANDING_PAGE,vr.parseFromCurrent())])}getLandingPage(){return at.get(ne.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ne.get(ne.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await at.get(ne.ID))return!0;let e=await at.get(ne.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>A.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await at.get(ne.SESSION_SYNCED,!1)}},yd=Xt(tn()),gd=Xt(tn()),J_=`
42
+ `),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){this.isMiniCart()&&this.element?._rerenderCart?this.element._rerenderCart({detail:{cart:e}}):this.isShopifyDefaultDrawer()?this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e)):this.element?.onCartDrawerUpdate?this.element.onCartDrawerUpdate():window.icartCartActivityEvent?window.icartCartActivityEvent():window.theme?.CartDrawer?new window.theme.CartDrawer().init():window.Hs_CartDrawer?.updateSlideCart?window.Hs_CartDrawer.updateSlideCart():window.theme?.fetch_side_cart?window.theme.fetch_side_cart():window.theme?.Cart?.updateCart?window.theme.Cart.updateCart():window.cartUpdate?window.cartUpdate():this.element?._onCartRefresh?this.element._onCartRefresh():this.element?.tagName?.toLowerCase()==="cart-drawer-component"?document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart")):this.element?.id==="sidebar-cart"?document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}})):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){qa.default.warn("Max attempts exhausted to find cart drawer");return}qa.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,g=!this.cartDrawerElement.hidden,h=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,v=u.transform.match(/matrix\(([^)]+)\)/),_=0,m=0;if(v){let V=v[1].split(", ").map(parseFloat);_=V[4],m=V[5]}let y=_+e.left>n||_+e.right<0||m+e.top>r||m+e.bottom<0,T=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=T*O,R=e.width*e.height,k=R>0&&H/R>=.1;return(o||c||!y)&&f&&g&&h&&k}createMutationObserver(){if(!this.cartDrawerElement&&!this.cartDrawerShadowElement)return;let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new gt;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 vc{static ACTIVE_TRIGGER_DATA;renderer=Nt.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 Pt(e))}async renderEngagement(e){if(!e.previewType&&vc.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mi(vc.ACTIVE_TRIGGER_DATA??{})};this.skipTrigger(e,r);return}if(vc.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){Ue.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 Wa(e,r,n).render():r instanceof ni?new Ga(e,r,n).render():r instanceof Yr?new Oo(e,r,n).render():r instanceof ii?new Ya(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 Va(e,r,n).render():r instanceof ti?new za(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new ja(this.rootContainer,r,e).render().getHTMLElement(),new ka().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),vc.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(){Nt.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"})}},Ka=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(kt.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}},Ja=class{static trackIntent(t){if(!this.isInstalled()){w.log("Facebook pixel not installed");return}if(!je.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"}},md=Xt(fd()),On=class{static _flags={};static getFlags(){return this._flags}static setFlags(t){this._flags=t??{}}static isECommerceApp(){return Ae.isShopify()}},q_=(0,md.default)(fetch),K_={retryDelay:A.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=A.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},Tt=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=Qt.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 Ue.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({},K_),r),i=await q_(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),Qt.debug&&e.set("cooee-sdk-debug",String(1)),e}},Pi=class{static sentryService=Ue.getInstance();static httpApiService=Tt.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 It(o);f.name=u.title;let g=new dr(c);g.name=u.variant_title,g.price.d=u.discounted_price/100,f.variants=[g],s.push(f)}return s}if(je.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)}},Xa=class kd{static INSTANCE;httpService=ae.get(Tt);sentryService=ae.get(Ue);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}`),Kt.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),Kt.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 Pt(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 Ka().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),Ja.trackIntent(e),Kt.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=Tt.getInstance();eventAPIService=Xa.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)}},Kt=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="&#x2022; "+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)}},Qa=class{static processConfiguration(){let t=je.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=je.get().gaMeasurementID;if(!(!t||!window.gtag))return new Promise(e=>{window.gtag("get",t,"client_id",r=>{e(r)})})}},Za=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)),Qa.processConfiguration(),r.website&&(ht.injectRawScript(r.website.commonJS),ht.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))}},dd=Xt(vl()),ec=class Yu{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 dd.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 Yu(r);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return r={source:"GOOGLE"},new Yu(r)}},Pn=class Ld{static INSTANCE=new Ld;httpAPIService=Tt.getInstance();coreService=Za.getInstance();sentryService=Ue.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),Kt.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 Ma().get();r.host=location.origin;try{(await pd())?.isPrivate&&(r.private=!0)}catch(i){hd.default.error("Unable to detect private/incognito window",i)}let n=await Ne.get(ne.DEVICE_ID);return n||(n=new Xe().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:ec.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 yc{static replaySubject=new ho(1);static INSTANCE;sentryService=ae.get(Ue);lock=new Jn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new yc),this.INSTANCE}init(e){if(w.debug("Initialising SDK",e),Gf(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}Pn.getInstance().init(e),yc.INSTANCE.checkForNewSession(!0).then(async()=>{yc.replaySubject.next(!0),yc.replaySubject.complete()}).catch(r=>w.error("Unable to perform device init",r))}getCurrentSessionID(){return at.set(ne.SESSION_LAST_USED_TIME,new Date().getTime()),at.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 at.set(ne.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){w.debug("Starting new session"),await at.clear(),w.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new Xe().toHexString();w.debug("New session ID to be used",r);let n=await Ne.get(ne.SESSION_NUMBER,0)+1;Kt.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Ne.set(ne.SESSION_NUMBER,n),at.set(ne.ID,r),at.set(ne.SESSION_LAST_USED_TIME,e.getTime()),at.set(ne.SESSION_LANDING_PAGE,_r.parseFromCurrent())])}getLandingPage(){return at.get(ne.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Ne.get(ne.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await at.get(ne.ID))return!0;let e=await at.get(ne.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>A.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await at.get(ne.SESSION_SYNCED,!1)}},yd=Xt(tn()),gd=Xt(tn()),J_=`
43
43
  mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
44
44
  cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
45
45
  cart {
@@ -51,11 +51,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
51
51
  }
52
52
  }
53
53
  }
54
- `,Qr=class{static navigate(t,e,r){let n=`${location.origin}/discount/${t}`;switch(w.log(`Applying discount code ${t}`,e,r),e){case cr.CART_PAGE:location.href=`${n}?redirect=/cart`;break;case cr.CART_DRAWER:location.href=`${n}?redirect=${location.pathname}#${A.HASH_OPEN_CART_DRAWER}=1`;break;case cr.SHOPIFY_CHECKOUT:location.href=`${n}?redirect=/checkout`;break;case cr.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 cr.CART_PAGE:location.href="/cart";break;case cr.SHOPIFY_CHECKOUT:location.href="/checkout";break;case cr.THIRD_PARTY_CHECKOUT:location.href=`/cart#${A.HASH_INITIATE_CHECKOUT}=1`;break;case cr.CART_DRAWER:default:{let r=et.get();!r.isOpen()&&r.open(),r.refreshUI(e)}}}static async applyWithStorefront(t){let e=je.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:J_,variables:{cartId:`gid://shopify/Cart/${ge.getCurrent().token}`,discountCodes:[t]}}),i={method:"POST",headers:r,body:n};await Tt.getInstance().request(A.GRAPHQL_API_PATH,i)}},Mr=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(!kt.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 bt)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 Mr,s=n.triggerData.redirectBehaviour,o=!!n.triggerData.discount.type&&!!e?.applyDiscount,c={selectedVariants:n.triggerData.nonMutableItems.map(m=>({itemMID:m.mID,mID:m.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},u="",f=[],g=r?[r.toEmbed()]:[];if(e.at===108){let m=n.selectedItems;if(g=t.embeddedItems??m.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=m.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID}));let T=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&T&&y.push({itemMID:T.mID,mID:T.selectedOrFirstVariant.value.mID}),c.selectedVariants=y}else c=void 0;f=t.embeddedItems??m}else if(e.at===107){let m=await ge.getCurrent().getNormalisedCart();g=m.items,c.selectedVariants=m.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 m=se.isValidURL(e.gu?.u);m&&(u=m.pathname+m.search+m.hash)}else e.at===109&&(await i.upgradeToSubscription(r,n.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(g,{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(m){if(!this.triggerContext.triggerData.isBYOB()){gd.default.error("Unable to get a discount code",m);return}}h&&e.at===103&&await new Mr().performCopyCoupon(h);try{h&&await Qr.applyWithStorefront(h)}catch(m){w.error(m),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===ur.STATIC){if(!e.code)throw Ue.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),Ue.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},De=class extends pr{stylesConverter=new Ni(1);renderer=Nt.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)}},X_=0,AF=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:--X_,__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 Et=class extends De{componentDidMount(){this.setState(()=>({text:this.props.element.text})),nt(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=Zt.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 it;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 Et{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"})}},Vu=class extends pr{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 Et{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(Vu,{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 De{componentDidMount(){nt(()=>{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 it;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return Z(b({},this.getTypoStyles()),{display:"flex"})}},kr=class extends De{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 De{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 De{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(){nt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new it;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 De{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(){nt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new it;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 De{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(Ho,{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===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(Et,{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 De{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=Zt.render(t,this.getProductData());if(this.productElement=new hr(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=e.cmp&&e.cmp>e.d,u=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,f=e.effective,g={name:r,price:i,quantity:u,image_url:s,meta:o,effective_price:f,category:n};if(c){g.compare_price=se.formatCurrency(e.cmp);let v=e.cmp-e.d;g.discount_percent=(v/e.cmp*100).toFixed(0),g.discount_price=se.formatCurrency(v)}let h={name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity};return{product:g,variant:h}}};function tc(){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 rc(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)=>`
54
+ `,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.isOpen()&&r.open(),r.refreshUI(e)}}}static async applyWithStorefront(t){let e=je.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:J_,variables:{cartId:`gid://shopify/Cart/${ge.getCurrent().token}`,discountCodes:[t]}}),i={method:"POST",headers:r,body:n};await Tt.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(!kt.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 wt)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(m=>({itemMID:m.mID,mID:m.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},u="",f=[],g=r?[r.toEmbed()]:[];if(e.at===108){let m=n.selectedItems;if(g=t.embeddedItems??m.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=m.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID}));let T=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&T&&y.push({itemMID:T.mID,mID:T.selectedOrFirstVariant.value.mID}),c.selectedVariants=y}else c=void 0;f=t.embeddedItems??m}else if(e.at===107){let m=await ge.getCurrent().getNormalisedCart();g=m.items,c.selectedVariants=m.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 m=se.isValidURL(e.gu?.u);m&&(u=m.pathname+m.search+m.hash)}else e.at===109&&(await i.upgradeToSubscription(r,n.triggerData),this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy());if(this.sendTriggerClicked(g,{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(m){if(!this.triggerContext.triggerData.isBYOB()){gd.default.error("Unable to get a discount code",m);return}}h&&e.at===103&&await new kr().performCopyCoupon(h);try{h&&await Qr.applyWithStorefront(h)}catch(m){w.error(m),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 Ue.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),Ue.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(t),triggerContext:this.triggerContext,error:e}),e}}},De=class extends fr{stylesConverter=new Ni(1);renderer=Nt.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)}},X_=0,OF=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:--X_,__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 St=class extends De{componentDidMount(){this.setState(()=>({text:this.props.element.text})),nt(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=er.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 it;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 St{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"})}},Vu=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 St{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(Vu,{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 De{componentDidMount(){nt(()=>{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 it;return t.textAlign=e.alignment,t.justifyContent=e.alignment,t}getComponentStyles(){return Z(b({},this.getTypoStyles()),{display:"flex"})}},Fr=class extends De{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 De{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 De{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(){nt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new it;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 De{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(){nt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let t={},e=this.mediaStyle.typo??new it;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 De{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(Ho,{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===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(St,{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 De{productElement;constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"}))}render(){let t=JSON.stringify(this.props.element),e=er.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=e.cmp&&e.cmp>e.d,u=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,f=e.effective,g={name:r,price:i,quantity:u,image_url:s,meta:o,effective_price:f,category:n};if(c){g.compare_price=se.formatCurrency(e.cmp);let v=e.cmp-e.d;g.discount_percent=(v/e.cmp*100).toFixed(0),g.discount_price=se.formatCurrency(v)}let h={name:t.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity};return{product:g,variant:h}}};function tc(){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 rc(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)=>`
55
55
  <span class="${i}"
56
56
  style="background-color: ${e.pagination.color?.rgba};"></span>
57
57
  `,renderProgressbar:n=>`
58
58
  <span class="${n}"
59
59
  style="background-color: ${e.pagination.color?.rgba};">
60
60
  </span>
61
- `},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 nc(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 $o=class extends De{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&&tc().then(()=>{this.swiperInstance=rc(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:nc(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(fr,{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(Et,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},jo=class extends De{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){tc().then(()=>{this.swiperInstance=rc(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 nc(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=Zt.render(r,{form:e});return Ot.getParsedElement(JSON.parse(n))}getClickAction(t){let e=b({},this.props.element.clc),r=JSON.stringify(e),n=Zt.render(r,{form:t});return JSON.parse(n)}},Zr=class extends De{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),nt(()=>{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(Et,{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($o,{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(jo,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Wo=class extends De{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(){nt(()=>{let t=this.props.triggerContext.triggerData,e=this.props.triggerContext.selectedItems;t.calculateDiscountData(e,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return M(fr,{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)}},xt=class zo{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(sr);safeHTTPService=ae.get(ue);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>Ue.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(),zo.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){yd.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 wt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new wt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new wt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&kt.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(){zo.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(tr(zo.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(zo.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),zo.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()}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=je.get().website.commonCSS;n&&It.injectRawCSS(n,r),It.injectStylesheet("https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@latest/dist/widget-sdk.min.css",r),It.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),e=r}Qo(Ji(Wo,{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))}},Rr=class Md extends xt{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()}},ic=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(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new mr(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let g of i.sellingPlans??[])g.mID===s.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let o=new wt(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 Pt(this.engagementTrigger);u.placement.selector=`.${c}`,u.items=[o];let f=new Rr(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))})}},oc=class extends Rr{ctaListener=new Mr;constructor(t){super(t),Dr.get().subscriber(A.CART_UPDATE_BROADCAST).pipe(Cl(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===Tc.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})}},vd=new hr({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]}]}]}]}]}),_d=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"}),Go=class extends De{render(){return M("div",{style:{marginTop:30},class:"lc-container",children:[M(Et,{element:_d,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 bt(t)],{from:"video"})},children:M("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),M(Hr,{element:vd,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}}},sc=class extends xt{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){Qo(Ji(Go,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}},ac=class extends xt{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(!kt.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 bt({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=[...Rr.renderedEngagements];Rr.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 oc(r).renderSilently():r.isSubscriptionUpsell()?ic.renderCartUpsell(r):new Rr(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...xt.renderedEngagements];xt.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 sc(r).renderSilently():r.isBYOB()?new ac(r).renderSilently():new xt(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()}},sr=class jd{static INSTANCE;httpService=ae.get(Tt);sessionManager=ae.get(qe);runtimeData=fe.get();loadWidgetsSubject=new ht;constructor(){this.loadWidgetsSubject.pipe(tr(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))}),Dr.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(){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 Pt(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 Pt(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=vr.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}},cc=class{runtimeData=fe.get();widgetAPIService=ae.get(sr);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 _c{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 _c),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(tr(_c.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)>=_c.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)}},lc=class Bd{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[Bd.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ve(A.EVENT_APP_BACKGROUND,r))}},uc=class{compareCartItemSubject=new ht;constructor(){this.compareCartItemSubject.pipe(tr(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),g=Z(b({},o),{quantity:f});u?i.push(g):s.push(g)}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)&&Dr.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)}},pc=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){Ue.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)})}},fc=class Xu 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(Xu.selectors,A.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Xu),this.INSTANCE}},mc=class Ju 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(Ju.selectors,A.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ju),this.INSTANCE}},dc=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()}},hc=class{trackSilently(){this.track().catch(t=>Ue.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))}},Vo=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)})}},gc=class{async migrate(){}};Zt.escape=np.escapeHtml;var Se=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new gc().migrate(),this.autoAuthenticate(),new cc().meddle(),new lc().listen(),new hc().trackSilently(),new Mr().listen(),new uc().listen(),new pc().listen(),new dc().listen(),ae.get(ki).listen(),ae.get(mc).listenSilently(),ae.get(fc).listenSilently(),ae.get(sr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Kt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Xn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Xn(this.globalRef,"config",new je),Xn(this.globalRef,"runtimeData",new fe),w.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.includes("localhost")){let t="http://localhost:8002";It.injectScriptURL(`${t}/main.js`),It.injectStylesheet(`${t}/styles.css`)}else{let t=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}`;It.injectScriptURL(`${t}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),It.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(sr).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 xt(new Pt(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?Vo.attachCheckoutListener():window.addEventListener("gokwikLoaded",Vo.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");})();
61
+ `},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 nc(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 $o=class extends De{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&&tc().then(()=>{this.swiperInstance=rc(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:nc(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(St,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},t.mID)}},jo=class extends De{swiperRef=null;swiperInstance=null;constructor(t,e){super(t,e)}componentDidMount(){tc().then(()=>{this.swiperInstance=rc(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 nc(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=er.render(r,{form:e});return Ot.getParsedElement(JSON.parse(n))}getClickAction(t){let e=b({},this.props.element.clc),r=JSON.stringify(e),n=er.render(r,{form:t});return JSON.parse(n)}},Zr=class extends De{constructor(t,e){super(t,e),this.setState(()=>({decoration:"unset"})),nt(()=>{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(St,{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($o,{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(jo,{element:t,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(t=>this.renderElement(t))}getComponentStyles(){return{}}},Wo=class extends De{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(){nt(()=>{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)}},xt=class zo{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=>Ue.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(),zo.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){yd.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 It(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new It(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new It(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&kt.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(){zo.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(zo.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(zo.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),zo.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&&ht.injectStylesheet(Qt.styleURL,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=je.get().website.commonCSS;n&&ht.injectRawCSS(n,r),ht.injectStylesheet(Qt.styleURL,r),ht.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",r),e=r}Qo(Ji(Wo,{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 xt{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()}},ic=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(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new dr(n),s=e.selling_plan_allocation?.selling_plan;if(s)for(let g of i.sellingPlans??[])g.mID===s.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let o=new It(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 Pt(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))})}},oc=class extends Nr{ctaListener=new kr;constructor(t){super(t),Rr.get().subscriber(A.CART_UPDATE_BROADCAST).pipe(Cl(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===Tc.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})}},vd=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]}]}]}]}]}),_d=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"}),Go=class extends De{render(){return M("div",{style:{marginTop:30},class:"lc-container",children:[M(St,{element:_d,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 wt(t)],{from:"video"})},children:M("video",{width:"100%",autoplay:!0,muted:!0,loop:!0,children:this.getSources(t.portraitVideos[0].sources)})}),M($r,{element:vd,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}}},sc=class extends xt{constructor(t){super(t)}shouldStopRendering(){return!1}renderContainer(){Qo(Ji(Go,{element:this.widget?.cont,triggerContext:this.triggerContext}),this.rootContainer)}},ac=class extends xt{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(!kt.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 wt({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 oc(r).renderSilently():r.isSubscriptionUpsell()?ic.renderCartUpsell(r):new Nr(r).renderSilently());this.removeOldWidgets(e)}processPageWidgetResponse(t){let e=[...xt.renderedEngagements];xt.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 sc(r).renderSilently():r.isBYOB()?new ac(r).renderSilently():new xt(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=ae.get(Tt);sessionManager=ae.get(qe);runtimeData=fe.get();loadWidgetsSubject=new gt;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(){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 Pt(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 Pt(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}},cc=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){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 _c{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 _c),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(_c.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)>=_c.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)}},lc=class Bd{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[Bd.ACTIVE_DURATION]=e,this.apiService.sendEvent(new ve(A.EVENT_APP_BACKGROUND,r))}},uc=class{compareCartItemSubject=new gt;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),g=Z(b({},o),{quantity:f});u?i.push(g):s.push(g)}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)}},pc=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){Ue.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)})}},fc=class Xu 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(Xu.selectors,A.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Xu),this.INSTANCE}},mc=class Ju 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(Ju.selectors,A.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new Ju),this.INSTANCE}},dc=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()}},hc=class{trackSilently(){this.track().catch(t=>Ue.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))}},Vo=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)})}},gc=class{async migrate(){}};er.escape=np.escapeHtml;var Se=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new gc().migrate(),this.autoAuthenticate(),new cc().meddle(),new lc().listen(),new hc().trackSilently(),new kr().listen(),new uc().listen(),new pc().listen(),new dc().listen(),ae.get(ki).listen(),ae.get(mc).listenSilently(),ae.get(fc).listenSilently(),ae.get(ar).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),Kt.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||Xn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Xn(this.globalRef,"config",new je),Xn(this.globalRef,"runtimeData",new fe),w.debug("Global reference initialised")}static injectWidgetAssets(){if(document.currentScript.src.includes("localhost")){let t="http://localhost:8002";ht.injectScriptURL(`${t}/main.js`),ht.injectStylesheet(`${t}/styles.css`)}else{let t=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${A.SDK_VERSION}`;ht.injectScriptURL(`${t}/dist/widget-sdk.min.js`,"cooee-widget-sdk"),ht.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 xt(new Pt(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?Vo.attachCheckoutListener():window.addEventListener("gokwikLoaded",Vo.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");})();