@letscooee/web-sdk 9.3.34 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-sdk.min.js +19 -19
- package/dist/main.min.js +70 -0
- package/dist/widget-sdk.min.css +1 -1
- package/dist/widget-sdk.min.js +26 -23
- package/dist/widget.min.css +1 -0
- package/dist/widget.min.js +44 -0
- package/package.json +2 -2
package/dist/main.min.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var rg=Object.create;var xc=Object.defineProperty,ng=Object.defineProperties,ig=Object.getOwnPropertyDescriptor,og=Object.getOwnPropertyDescriptors,sg=Object.getOwnPropertyNames,op=Object.getOwnPropertySymbols,ag=Object.getPrototypeOf,ap=Object.prototype.hasOwnProperty,cg=Object.prototype.propertyIsEnumerable;var sp=(t,e,r)=>e in t?xc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e||={})ap.call(e,r)&&sp(t,r,e[r]);if(op)for(var r of op(e))cg.call(e,r)&&sp(t,r,e[r]);return t},ee=(t,e)=>ng(t,og(e));var zi=(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')});var ur=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lg=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sg(e))!ap.call(t,i)&&i!==r&&xc(t,i,{get:()=>e[i],enumerable:!(n=ig(e,i))||n.enumerable});return t};var Se=(t,e,r)=>(r=t!=null?rg(ag(t)):{},lg(e||!t||!t.__esModule?xc(r,"default",{value:t,enumerable:!0}):r,t));var nn=ur((lp,Yo)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(m,p){return function(){return p.apply(m,arguments)}},o=function(){var m=arguments,p=m[0],f,d;for(d=1;d<m.length;d++)for(f in m[d])!(f in p)&&m[d].hasOwnProperty(f)&&(p[f]=m[d][f]);return p},s=function(m,p){return{value:m,name:p}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(m){this.context=m,this.setLevel(m.filterLevel),this.log=this.info};a.prototype={setLevel:function(m){m&&"value"in m&&(this.context.filterLevel=m)},getLevel:function(){return this.context.filterLevel},enabledFor:function(m){var p=this.context.filterLevel;return m.value>=p.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(m){typeof m=="string"&&m.length>0&&this.invoke(e.TIME,[m,"start"])},timeEnd:function(m){typeof m=="string"&&m.length>0&&this.invoke(e.TIME,[m,"end"])},invoke:function(m,p){r&&this.enabledFor(m)&&r(p,o({level:m},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var m=e;m.enabledFor=i(c,c.enabledFor),m.trace=i(c,c.trace),m.debug=i(c,c.debug),m.time=i(c,c.time),m.timeEnd=i(c,c.timeEnd),m.info=i(c,c.info),m.warn=i(c,c.warn),m.error=i(c,c.error),m.log=m.info})(),e.setHandler=function(m){r=m},e.setLevel=function(m){c.setLevel(m);for(var p in n)n.hasOwnProperty(p)&&n[p].setLevel(m)},e.getLevel=function(){return c.getLevel()},e.get=function(m){return n[m]||(n[m]=new a(o({name:m},c.context)))},e.createDefaultHandler=function(m){m=m||{},m.formatter=m.formatter||function(g,E){E.name&&g.unshift("["+E.name+"]")};var p={},f=function(d,g){Function.prototype.apply.call(d,console,g)};return typeof console>"u"?function(){}:function(d,g){d=Array.prototype.slice.call(d);var E=console.log,A;g.level===e.TIME?(A=(g.name?"["+g.name+"] ":"")+d[0],d[1]==="start"?console.time?console.time(A):p[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):f(E,[A+": "+(new Date().getTime()-p[A])+"ms"])):(g.level===e.WARN&&console.warn?E=console.warn:g.level===e.ERROR&&console.error?E=console.error:g.level===e.INFO&&console.info?E=console.info:g.level===e.DEBUG&&console.debug?E=console.debug:g.level===e.TRACE&&console.trace&&(E=console.trace),m.formatter(d,g),f(E,d))}},e.useDefaults=function(m){e.setLevel(m&&m.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(m))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof Yo<"u"&&Yo.exports?Yo.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(lp)});var Dc=ur(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.MustacheUtils=void 0;var zo=class t{static escapeHtml(e){return String(e).replace(/"/g,r=>t.entityMap[r])}};qo.MustacheUtils=zo;zo.entityMap={'"':"""}});var Rr=ur(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.MilestoneRewardType=z.ProgressBarLayout=z.EngagementContentSource=z.EngagementObjective=z.OnsiteDeliveryType=z.ClickActionType=z.FrequencyGapUnit=z.FrequencyType=z.RedirectBehaviour=z.EngagementPlacementPosition=z.EngagementCollectionSource=z.PromotionType=z.CartFilterEnum=z.CartCurrencyOperator=z.CartCriteria=z.URLCriteria=z.UTMCriteria=z.CartItemSource=z.EngagementItemSource=z.PurchasedVisitor=z.LoggedInVisitor=z.VisitorType=z.SessionType=z.EngagementContentType=z.TriggerType=z.EngagementType=z.EngagementStatus=z.TimePreference=z.ScheduleFrequency=z.CriteriaFrequency=void 0;var up=function(t){return t[t.ONCE_PER_USER=1]="ONCE_PER_USER",t[t.ONCE_PER_SESSION=2]="ONCE_PER_SESSION",t[t.EVERY_TIME=3]="EVERY_TIME",t}(up||(z.CriteriaFrequency=up={})),pp=function(t){return t[t.ONE_TIME=1]="ONE_TIME",t[t.MULTIPLE=2]="MULTIPLE",t[t.RECURRING=3]="RECURRING",t}(pp||(z.ScheduleFrequency=pp={})),fp=function(t){return t[t.NOW=1]="NOW",t[t.LATER=2]="LATER",t[t.NEVER=3]="NEVER",t}(fp||(z.TimePreference=fp={})),mp=function(t){return t[t.PUBLISHED=1]="PUBLISHED",t[t.DRAFT=2]="DRAFT",t[t.PAUSED=3]="PAUSED",t[t.FAILED=4]="FAILED",t[t.STOPPED=5]="STOPPED",t[t.COMPLETED=6]="COMPLETED",t[t.ARCHIVED=7]="ARCHIVED",t[t.UNINSTALLED=8]="UNINSTALLED",t}(mp||(z.EngagementStatus=mp={})),dp=function(t){return t[t.POPUP=1]="POPUP",t[t.LEAD_GENERATION=2]="LEAD_GENERATION",t[t.PRODUCT_WIDGET=3]="PRODUCT_WIDGET",t[t.PRODUCT_BUNDLE=4]="PRODUCT_BUNDLE",t[t.ANNOUNCEMENT_BAR=5]="ANNOUNCEMENT_BAR",t[t.CART_REMINDER=6]="CART_REMINDER",t[t.CRO_COPILOT=10]="CRO_COPILOT",t[t.OTHER=11]="OTHER",t}(dp||(z.EngagementType=dp={})),hp=function(t){return t[t.NONE=0]="NONE",t[t.RULE_BASED=1]="RULE_BASED",t[t.INTENT_BASED=2]="INTENT_BASED",t}(hp||(z.TriggerType=hp={})),gp=function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t}(gp||(z.EngagementContentType=gp={})),yp=function(t){return t[t.ALL=0]="ALL",t[t.NEW_ONLY=1]="NEW_ONLY",t[t.RETURNING_ONLY=2]="RETURNING_ONLY",t}(yp||(z.SessionType=yp={})),vp=function(t){return t[t.ALL=0]="ALL",t[t.LOGGED_IN_ONLY=3]="LOGGED_IN_ONLY",t[t.NON_LOGGED_IN_ONLY=4]="NON_LOGGED_IN_ONLY",t[t.PURCHASED=5]="PURCHASED",t[t.NON_PURCHASED=6]="NON_PURCHASED",t[t.ABANDON_CART=7]="ABANDON_CART",t[t.RETURNING_AND_NON_PURCHASED=8]="RETURNING_AND_NON_PURCHASED",t}(vp||(z.VisitorType=vp={})),_p=function(t){return t.ALL="ALL",t.LOGGED_IN="LOGGED_IN",t.NON_LOGGED_IN="NON_LOGGED_IN",t}(_p||(z.LoggedInVisitor=_p={})),Ep=function(t){return t.ALL="ALL",t.PURCHASED="PURCHASED",t.NON_PURCHASED="NON_PURCHASED",t}(Ep||(z.PurchasedVisitor=Ep={})),Sp=function(t){return t[t.NONE=0]="NONE",t[t.ITEM_RECOMMENDATION=1]="ITEM_RECOMMENDATION",t[t.MULTIPLE_ITEMS=2]="MULTIPLE_ITEMS",t[t.SINGLE_ITEM=3]="SINGLE_ITEM",t[t.TOP_SELLING=4]="TOP_SELLING",t[t.STOCK_CLEARANCE=5]="STOCK_CLEARANCE",t[t.NEW_ARRIVALS=6]="NEW_ARRIVALS",t[t.RECENTLY_VIEWED=7]="RECENTLY_VIEWED",t[t.EVENT_ITEM=8]="EVENT_ITEM",t[t.CART_ITEM=9]="CART_ITEM",t[t.BUNDLE=10]="BUNDLE",t[t.CURRENT_ITEM=11]="CURRENT_ITEM",t[t.PURCHASED_PREVIOUSLY=12]="PURCHASED_PREVIOUSLY",t[t.COLLECTION_ITEMS=13]="COLLECTION_ITEMS",t[t.TRENDING_ITEMS=14]="TRENDING_ITEMS",t}(Sp||(z.EngagementItemSource=Sp={})),wp=function(t){return t[t.LAST_ADDED=1]="LAST_ADDED",t[t.FIRST_ADDED=2]="FIRST_ADDED",t[t.HIGHEST_PRICE=3]="HIGHEST_PRICE",t[t.LOWEST_PRICE=4]="LOWEST_PRICE",t[t.FIRST_MATCHING_TAG=5]="FIRST_MATCHING_TAG",t[t.ALL=6]="ALL",t}(wp||(z.CartItemSource=wp={})),bp=function(t){return t[t.ALL=0]="ALL",t[t.ONLY_ORGANIC=1]="ONLY_ORGANIC",t[t.ONLY_NON_ORGANIC=2]="ONLY_NON_ORGANIC",t[t.INCLUDES=3]="INCLUDES",t[t.EXCLUDES=4]="EXCLUDES",t}(bp||(z.UTMCriteria=bp={})),Ip=function(t){return t[t.NONE=0]="NONE",t[t.LIKE=1]="LIKE",t[t.NOT_LIKE=2]="NOT_LIKE",t[t.EQUALS=3]="EQUALS",t[t.NOT_EQUALS=4]="NOT_EQUALS",t}(Ip||(z.URLCriteria=Ip={})),Tp=function(t){return t[t.NONE=0]="NONE",t[t.LESS_THAN=1]="LESS_THAN",t[t.GREATER_THAN=2]="GREATER_THAN",t[t.BETWEEN=3]="BETWEEN",t[t.EQUALS=4]="EQUALS",t}(Tp||(z.CartCriteria=Tp={})),Cp=function(t){return t[t.ALL=0]="ALL",t[t.INCLUDES=1]="INCLUDES",t[t.EXCLUDES=2]="EXCLUDES",t}(Cp||(z.CartCurrencyOperator=Cp={})),xp=function(t){return t[t.NONE=0]="NONE",t[t.AMOUNT=1]="AMOUNT",t[t.TOTAL_PRODUCT=2]="TOTAL_PRODUCT",t[t.UNIQUE_PRODUCT=3]="UNIQUE_PRODUCT",t}(xp||(z.CartFilterEnum=xp={})),Dp=function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t}(Dp||(z.PromotionType=Dp={})),Rp=function(t){return t[t.NONE=0]="NONE",t[t.SINGLE=1]="SINGLE",t[t.MULTIPLE=2]="MULTIPLE",t}(Rp||(z.EngagementCollectionSource=Rp={})),Ap=function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t}(Ap||(z.EngagementPlacementPosition=Ap={})),Np=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}(Np||(z.RedirectBehaviour=Np={})),Op=function(t){return t.ONCE_IN_SESSION="ONCE_IN_SESSION",t.ACROSS_SESSIONS="ACROSS_SESSIONS",t}(Op||(z.FrequencyType=Op={})),Pp=function(t){return t.DAYS="DAYS",t.HOURS="HOURS",t.MINUTES="MINUTES",t.SECONDS="SECONDS",t}(Pp||(z.FrequencyGapUnit=Pp={})),Lp=function(t){return t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",t}(Lp||(z.ClickActionType=Lp={})),Bp=function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t}(Bp||(z.OnsiteDeliveryType=Bp={})),Up=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.BUY_NOW="BUY_NOW",t}(Up||(z.EngagementObjective=Up={})),kp=function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t}(kp||(z.EngagementContentSource=kp={})),Mp=function(t){return t.ICONS="ICONS",t.TILES="TILES",t}(Mp||(z.ProgressBarLayout=Mp={})),Fp=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}(Fp||(z.MilestoneRewardType=Fp={}))});var Ko=ur(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.PriceRuleType=Gn.DiscountType=void 0;var Hp=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[t.BXGY=6]="BXGY",t}(Hp||(Gn.DiscountType=Hp={})),$p=function(t){return t.FIXED_AMOUNT="fixed_amount",t.PERCENTAGE="percentage",t}($p||(Gn.PriceRuleType=$p={}))});var Ac=ur(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.ArrayUtils=void 0;var Rc=class t{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,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};Jo.ArrayUtils=Rc});var Sf=ur((Zi,is)=>{"use strict";(function(t,e){"use strict";var r="1.0.40",n="",i="?",o="function",s="undefined",a="object",c="string",m="major",p="model",f="name",d="type",g="vendor",E="version",A="architecture",O="console",D="mobile",R="tablet",P="smarttv",j="wearable",se="embedded",M=500,Q="Amazon",Y="Apple",ae="ASUS",Re="BlackBerry",ge="Browser",Ie="Chrome",Ge="Edge",Me="Firefox",lt="Google",Tt="Huawei",Te="LG",$e="Microsoft",me="Motorola",ne="Opera",je="Samsung",dt="Sharp",lr="Sony",Hr="Xiaomi",rn="Zebra",Mn="Facebook",$r="Chromium OS",Fn="Mac OS",Hn=" Browser",$n=function(V,X){var G={};for(var ye in V)X[ye]&&X[ye].length%2===0?G[ye]=X[ye].concat(V[ye]):G[ye]=V[ye];return G},tr=function(V){for(var X={},G=0;G<V.length;G++)X[V[G].toUpperCase()]=V[G];return X},ht=function(V,X){return typeof V===c?Ht(X).indexOf(Ht(V))!==-1:!1},Ht=function(V){return V.toLowerCase()},Wi=function(V){return typeof V===c?V.replace(/[^\d\.]/g,n).split(".")[0]:e},y=function(V,X){if(typeof V===c)return V=V.replace(/^\s\s*/,n),typeof X===s?V:V.substring(0,M)},l=function(V,X){for(var G=0,ye,gt,ut,ve,Z,Nt;G<X.length&&!Z;){var jn=X[G],Gi=X[G+1];for(ye=gt=0;ye<jn.length&&!Z&&jn[ye];)if(Z=jn[ye++].exec(V),Z)for(ut=0;ut<Gi.length;ut++)Nt=Z[++gt],ve=Gi[ut],typeof ve===a&&ve.length>0?ve.length===2?typeof ve[1]==o?this[ve[0]]=ve[1].call(this,Nt):this[ve[0]]=ve[1]:ve.length===3?typeof ve[1]===o&&!(ve[1].exec&&ve[1].test)?this[ve[0]]=Nt?ve[1].call(this,Nt,ve[2]):e:this[ve[0]]=Nt?Nt.replace(ve[1],ve[2]):e:ve.length===4&&(this[ve[0]]=Nt?ve[3].call(this,Nt.replace(ve[1],ve[2])):e):this[ve]=Nt||e;G+=2}},u=function(V,X){for(var G in X)if(typeof X[G]===a&&X[G].length>0){for(var ye=0;ye<X[G].length;ye++)if(ht(X[G][ye],V))return G===i?e:G}else if(ht(X[G],V))return G===i?e:G;return X.hasOwnProperty("*")?X["*"]:V},_={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},x={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},U={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[E,[f,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[E,[f,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[f,E],[/opios[\/ ]+([\w\.]+)/i],[E,[f,ne+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[E,[f,ne+" GX"]],[/\bopr\/([\w\.]+)/i],[E,[f,ne]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[E,[f,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[E,[f,"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],[f,E],[/quark(?:pc)?\/([-\w\.]+)/i],[E,[f,"Quark"]],[/\bddg\/([\w\.]+)/i],[E,[f,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[E,[f,"UC"+ge]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[E,[f,"WeChat"]],[/konqueror\/([\w\.]+)/i],[E,[f,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[E,[f,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[E,[f,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[E,[f,"Smart Lenovo "+ge]],[/(avast|avg)\/([\w\.]+)/i],[[f,/(.+)/,"$1 Secure "+ge],E],[/\bfocus\/([\w\.]+)/i],[E,[f,Me+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[f,ne+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[f,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[f,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[f,ne+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[f,"MIUI"+Hn]],[/fxios\/([\w\.-]+)/i],[E,[f,Me]],[/\bqihoobrowser\/?([\w\.]*)/i],[E,[f,"360"]],[/\b(qq)\/([\w\.]+)/i],[[f,/(.+)/,"$1Browser"],E],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[f,/(.+)/,"$1"+Hn],E],[/samsungbrowser\/([\w\.]+)/i],[E,[f,je+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[E,[f,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[f,"Sogou Mobile"],E],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[f,E],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[f],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[E,f],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[f,Mn],E],[/(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],[f,E],[/\bgsa\/([\w\.]+) .*safari\//i],[E,[f,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[E,[f,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[E,[f,Ie+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[f,Ie+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[f,"Android "+ge]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[f,E],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[E,[f,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[E,f],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[f,[E,u,_]],[/(webkit|khtml)\/([\w\.]+)/i],[f,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[f,"Netscape"],E],[/(wolvic|librewolf)\/([\w\.]+)/i],[f,E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[f,Me+" 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],[f,[E,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[f,[E,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[A,"amd64"]],[/(ia32(?=;))/i],[[A,Ht]],[/((?:i[346]|x)86)[;\)]/i],[[A,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[A,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[A,"armhf"]],[/windows (ce|mobile); ppc;/i],[[A,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[A,/ower/,n,Ht]],[/(sun4\w)[;\)]/i],[[A,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[A,Ht]]],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],[p,[g,je],[d,R]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[p,[g,je],[d,D]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[p,[g,Y],[d,D]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[p,[g,Y],[d,R]],[/(macintosh);/i],[p,[g,Y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[p,[g,dt],[d,D]],[/(?:honor)([-\w ]+)[;\)]/i],[p,[g,"Honor"],[d,D]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[p,[g,Tt],[d,R]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[p,[g,Tt],[d,D]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[p,/_/g," "],[g,Hr],[d,D]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[p,/_/g," "],[g,Hr],[d,R]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[p,[g,"OPPO"],[d,D]],[/\b(opd2\d{3}a?) bui/i],[p,[g,"OPPO"],[d,R]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[p,[g,"Vivo"],[d,D]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[p,[g,"Realme"],[d,D]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[p,[g,me],[d,D]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[p,[g,me],[d,R]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[p,[g,Te],[d,R]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[p,[g,Te],[d,D]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[p,[g,"Lenovo"],[d,R]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[p,/_/g," "],[g,"Nokia"],[d,D]],[/(pixel c)\b/i],[p,[g,lt],[d,R]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[p,[g,lt],[d,D]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[p,[g,lr],[d,D]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[p,"Xperia Tablet"],[g,lr],[d,R]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[p,[g,"OnePlus"],[d,D]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[p,[g,Q],[d,R]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[p,/(.+)/g,"Fire Phone $1"],[g,Q],[d,D]],[/(playbook);[-\w\),; ]+(rim)/i],[p,g,[d,R]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[p,[g,Re],[d,D]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[p,[g,ae],[d,R]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[p,[g,ae],[d,D]],[/(nexus 9)/i],[p,[g,"HTC"],[d,R]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[p,/_/g," "],[d,D]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[p,[g,"TCL"],[d,R]],[/(itel) ((\w+))/i],[[g,Ht],p,[d,u,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[p,[g,"Acer"],[d,R]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[p,[g,"Meizu"],[d,D]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[p,[g,"Ulefone"],[d,D]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[p,[g,"Energizer"],[d,D]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[p,[g,"Cat"],[d,D]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[p,[g,"Smartfren"],[d,D]],[/droid.+; (a(?:015|06[35]|142p?))/i],[p,[g,"Nothing"],[d,D]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[g,p,[d,D]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[g,p,[d,R]],[/(surface duo)/i],[p,[g,$e],[d,R]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[p,[g,"Fairphone"],[d,D]],[/(u304aa)/i],[p,[g,"AT&T"],[d,D]],[/\bsie-(\w*)/i],[p,[g,"Siemens"],[d,D]],[/\b(rct\w+) b/i],[p,[g,"RCA"],[d,R]],[/\b(venue[\d ]{2,7}) b/i],[p,[g,"Dell"],[d,R]],[/\b(q(?:mv|ta)\w+) b/i],[p,[g,"Verizon"],[d,R]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[p,[g,"Barnes & Noble"],[d,R]],[/\b(tm\d{3}\w+) b/i],[p,[g,"NuVision"],[d,R]],[/\b(k88) b/i],[p,[g,"ZTE"],[d,R]],[/\b(nx\d{3}j) b/i],[p,[g,"ZTE"],[d,D]],[/\b(gen\d{3}) b.+49h/i],[p,[g,"Swiss"],[d,D]],[/\b(zur\d{3}) b/i],[p,[g,"Swiss"],[d,R]],[/\b((zeki)?tb.*\b) b/i],[p,[g,"Zeki"],[d,R]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],p,[d,R]],[/\b(ns-?\w{0,9}) b/i],[p,[g,"Insignia"],[d,R]],[/\b((nxa|next)-?\w{0,9}) b/i],[p,[g,"NextBook"],[d,R]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],p,[d,D]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],p,[d,D]],[/\b(ph-1) /i],[p,[g,"Essential"],[d,D]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[p,[g,"Envizen"],[d,R]],[/\b(trio[-\w\. ]+) b/i],[p,[g,"MachSpeed"],[d,R]],[/\btu_(1491) b/i],[p,[g,"Rotor"],[d,R]],[/(shield[\w ]+) b/i],[p,[g,"Nvidia"],[d,R]],[/(sprint) (\w+)/i],[g,p,[d,D]],[/(kin\.[onetw]{3})/i],[[p,/\./g," "],[g,$e],[d,D]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[p,[g,rn],[d,R]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[p,[g,rn],[d,D]],[/smart-tv.+(samsung)/i],[g,[d,P]],[/hbbtv.+maple;(\d+)/i],[[p,/^/,"SmartTV"],[g,je],[d,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,Te],[d,P]],[/(apple) ?tv/i],[g,[p,Y+" TV"],[d,P]],[/crkey/i],[[p,Ie+"cast"],[g,lt],[d,P]],[/droid.+aft(\w+)( bui|\))/i],[p,[g,Q],[d,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[p,[g,dt],[d,P]],[/(bravia[\w ]+)( bui|\))/i],[p,[g,lr],[d,P]],[/(mitv-\w{5}) bui/i],[p,[g,Hr],[d,P]],[/Hbbtv.*(technisat) (.*);/i],[g,p,[d,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[g,y],[p,y],[d,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,p,[d,O]],[/droid.+; (shield) bui/i],[p,[g,"Nvidia"],[d,O]],[/(playstation [345portablevi]+)/i],[p,[g,lr],[d,O]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[p,[g,$e],[d,O]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[p,[g,je],[d,j]],[/((pebble))app/i],[g,p,[d,j]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[p,[g,Y],[d,j]],[/droid.+; (glass) \d/i],[p,[g,lt],[d,j]],[/droid.+; (wt63?0{2,3})\)/i],[p,[g,rn],[d,j]],[/droid.+; (glass) \d/i],[p,[g,lt],[d,j]],[/(pico) (4|neo3(?: link|pro)?)/i],[g,p,[d,j]],[/; (quest( \d| pro)?)/i],[p,[g,Mn],[d,j]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[d,se]],[/(aeobc)\b/i],[p,[g,Q],[d,se]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[p,[d,D]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[p,[d,R]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,R]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,D]],[/(android[-\w\. ]{0,9});.+buil/i],[p,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[f,Ge+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[f,E],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[E,[f,"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],[f,E],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[E,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,E],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[f,[E,u,x]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[E,u,x],[f,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[E,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[f,Fn],[E,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[E,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[f,E],[/\(bb(10);/i],[E,[f,Re]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[f,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[f,Me+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[E,[f,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[E,[f,"watchOS"]],[/crkey\/([\d\.]+)/i],[E,[f,Ie+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[f,$r],E],[/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],[f,E],[/(sunos) ?([\w\.\d]*)/i],[[f,"Solaris"],E],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[f,E]]},B=function(V,X){if(typeof V===a&&(X=V,V=e),!(this instanceof B))return new B(V,X).getResult();var G=typeof t!==s&&t.navigator?t.navigator:e,ye=V||(G&&G.userAgent?G.userAgent:n),gt=G&&G.userAgentData?G.userAgentData:e,ut=X?$n(U,X):U,ve=G&&G.userAgent==ye;return this.getBrowser=function(){var Z={};return Z[f]=e,Z[E]=e,l.call(Z,ye,ut.browser),Z[m]=Wi(Z[E]),ve&&G&&G.brave&&typeof G.brave.isBrave==o&&(Z[f]="Brave"),Z},this.getCPU=function(){var Z={};return Z[A]=e,l.call(Z,ye,ut.cpu),Z},this.getDevice=function(){var Z={};return Z[g]=e,Z[p]=e,Z[d]=e,l.call(Z,ye,ut.device),ve&&!Z[d]&>&>.mobile&&(Z[d]=D),ve&&Z[p]=="Macintosh"&&G&&typeof G.standalone!==s&&G.maxTouchPoints&&G.maxTouchPoints>2&&(Z[p]="iPad",Z[d]=R),Z},this.getEngine=function(){var Z={};return Z[f]=e,Z[E]=e,l.call(Z,ye,ut.engine),Z},this.getOS=function(){var Z={};return Z[f]=e,Z[E]=e,l.call(Z,ye,ut.os),ve&&!Z[f]&>&>.platform&>.platform!="Unknown"&&(Z[f]=gt.platform.replace(/chrome os/i,$r).replace(/macos/i,Fn)),Z},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 ye},this.setUA=function(Z){return ye=typeof Z===c&&Z.length>M?y(Z,M):Z,this},this.setUA(ye),this};B.VERSION=r,B.BROWSER=tr([f,E,m]),B.CPU=tr([A]),B.DEVICE=tr([p,g,d,O,D,P,R,j,se]),B.ENGINE=B.OS=tr([f,E]),typeof Zi!==s?(typeof is!==s&&is.exports&&(Zi=is.exports=B),Zi.UAParser=B):typeof define===o&&define.amd?define(function(){return B}):typeof t!==s&&(t.UAParser=B);var ie=typeof t!==s&&(t.jQuery||t.Zepto);if(ie&&!ie.ua){var he=new B;ie.ua=he.getResult(),ie.ua.get=function(){return he.getUA()},ie.ua.set=function(V){he.setUA(V);var X=he.getResult();for(var G in X)ie.ua[G]=X[G]}}})(typeof window=="object"?window:Zi)});var If=ur((bf,Zc)=>{"use strict";(function(t){if(typeof bf=="object"&&typeof Zc<"u")Zc.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return function n(i,o,s){function a(p,f){if(!o[p]){if(!i[p]){var d=typeof zi=="function"&&zi;if(!f&&d)return d(p,!0);if(c)return c(p,!0);var g=new Error("Cannot find module '"+p+"'");throw g.code="MODULE_NOT_FOUND",g}var E=o[p]={exports:{}};i[p][0].call(E.exports,function(A){var O=i[p][1][A];return a(O||A)},E,E.exports,n,i,o,s)}return o[p].exports}for(var c=typeof zi=="function"&&zi,m=0;m<s.length;m++)a(s[m]);return a}({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var m=0,p=new a(A),f=s.document.createTextNode("");p.observe(f,{characterData:!0}),c=function(){f.data=m=++m%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var d=new s.MessageChannel;d.port1.onmessage=A,c=function(){d.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var D=s.document.createElement("script");D.onreadystatechange=function(){A(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},s.document.documentElement.appendChild(D)}:c=function(){setTimeout(A,0)};var g,E=[];function A(){g=!0;for(var D,R,P=E.length;P;){for(R=E,E=[],D=-1;++D<P;)R[D]();P=E.length}g=!1}i.exports=O;function O(D){E.push(D)===1&&!g&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},m=["REJECTED"],p=["FULFILLED"],f=["PENDING"];i.exports=d;function d(M){if(typeof M!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,M!==a&&O(this,M)}d.prototype.catch=function(M){return this.then(null,M)},d.prototype.then=function(M,Q){if(typeof M!="function"&&this.state===p||typeof Q!="function"&&this.state===m)return this;var Y=new this.constructor(a);if(this.state!==f){var ae=this.state===p?M:Q;E(Y,ae,this.outcome)}else this.queue.push(new g(Y,M,Q));return Y};function g(M,Q,Y){this.promise=M,typeof Q=="function"&&(this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled),typeof Y=="function"&&(this.onRejected=Y,this.callRejected=this.otherCallRejected)}g.prototype.callFulfilled=function(M){c.resolve(this.promise,M)},g.prototype.otherCallFulfilled=function(M){E(this.promise,this.onFulfilled,M)},g.prototype.callRejected=function(M){c.reject(this.promise,M)},g.prototype.otherCallRejected=function(M){E(this.promise,this.onRejected,M)};function E(M,Q,Y){s(function(){var ae;try{ae=Q(Y)}catch(Re){return c.reject(M,Re)}ae===M?c.reject(M,new TypeError("Cannot resolve promise with itself")):c.resolve(M,ae)})}c.resolve=function(M,Q){var Y=D(A,Q);if(Y.status==="error")return c.reject(M,Y.value);var ae=Y.value;if(ae)O(M,ae);else{M.state=p,M.outcome=Q;for(var Re=-1,ge=M.queue.length;++Re<ge;)M.queue[Re].callFulfilled(Q)}return M},c.reject=function(M,Q){M.state=m,M.outcome=Q;for(var Y=-1,ae=M.queue.length;++Y<ae;)M.queue[Y].callRejected(Q);return M};function A(M){var Q=M&&M.then;if(M&&(typeof M=="object"||typeof M=="function")&&typeof Q=="function")return function(){Q.apply(M,arguments)}}function O(M,Q){var Y=!1;function ae(Ge){Y||(Y=!0,c.reject(M,Ge))}function Re(Ge){Y||(Y=!0,c.resolve(M,Ge))}function ge(){Q(Re,ae)}var Ie=D(ge);Ie.status==="error"&&ae(Ie.value)}function D(M,Q){var Y={};try{Y.value=M(Q),Y.status="success"}catch(ae){Y.status="error",Y.value=ae}return Y}d.resolve=R;function R(M){return M instanceof this?M:c.resolve(new this(a),M)}d.reject=P;function P(M){var Q=new this(a);return c.reject(Q,M)}d.all=j;function j(M){var Q=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=M.length,ae=!1;if(!Y)return this.resolve([]);for(var Re=new Array(Y),ge=0,Ie=-1,Ge=new this(a);++Ie<Y;)Me(M[Ie],Ie);return Ge;function Me(lt,Tt){Q.resolve(lt).then(Te,function($e){ae||(ae=!0,c.reject(Ge,$e))});function Te($e){Re[Tt]=$e,++ge===Y&&!ae&&(ae=!0,c.resolve(Ge,Re))}}}d.race=se;function se(M){var Q=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var Y=M.length,ae=!1;if(!Y)return this.resolve([]);for(var Re=-1,ge=new this(a);++Re<Y;)Ie(M[Re]);return ge;function Ie(Ge){Q.resolve(Ge).then(function(Me){ae||(ae=!0,c.resolve(ge,Me))},function(Me){ae||(ae=!0,c.reject(ge,Me))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h};function a(h,S){if(!(h instanceof S))throw new TypeError("Cannot call a class as a function")}function c(){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 m=c();function p(){try{if(!m||!m.open)return!1;var h=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),S=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!h||S)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(h,S){h=h||[],S=S||{};try{return new Blob(h,S)}catch(I){if(I.name!=="TypeError")throw I;for(var v=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new v,C=0;C<h.length;C+=1)T.append(h[C]);return T.getBlob(S.type)}}typeof Promise>"u"&&n(3);var d=Promise;function g(h,S){S&&h.then(function(v){S(null,v)},function(v){S(v)})}function E(h,S,v){typeof S=="function"&&h.then(S),typeof v=="function"&&h.catch(v)}function A(h){return typeof h!="string"&&(console.warn(h+" used as a key, but it is not a string."),h=String(h)),h}function O(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",R=void 0,P={},j=Object.prototype.toString,se="readonly",M="readwrite";function Q(h){for(var S=h.length,v=new ArrayBuffer(S),T=new Uint8Array(v),C=0;C<S;C++)T[C]=h.charCodeAt(C);return v}function Y(h){return new d(function(S){var v=h.transaction(D,M),T=f([""]);v.objectStore(D).put(T,"key"),v.onabort=function(C){C.preventDefault(),C.stopPropagation(),S(!1)},v.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),I=navigator.userAgent.match(/Edge\//);S(I||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function ae(h){return typeof R=="boolean"?d.resolve(R):Y(h).then(function(S){return R=S,R})}function Re(h){var S=P[h.name],v={};v.promise=new d(function(T,C){v.resolve=T,v.reject=C}),S.deferredOperations.push(v),S.dbReady?S.dbReady=S.dbReady.then(function(){return v.promise}):S.dbReady=v.promise}function ge(h){var S=P[h.name],v=S.deferredOperations.pop();if(v)return v.resolve(),v.promise}function Ie(h,S){var v=P[h.name],T=v.deferredOperations.pop();if(T)return T.reject(S),T.promise}function Ge(h,S){return new d(function(v,T){if(P[h.name]=P[h.name]||lr(),h.db)if(S)Re(h),h.db.close();else return v(h.db);var C=[h.name];S&&C.push(h.version);var I=m.open.apply(m,C);S&&(I.onupgradeneeded=function(L){var k=I.result;try{k.createObjectStore(h.storeName),L.oldVersion<=1&&k.createObjectStore(D)}catch(F){if(F.name==="ConstraintError")console.warn('The database "'+h.name+'" has been upgraded from version '+L.oldVersion+" to version "+L.newVersion+', but the storage "'+h.storeName+'" already exists.');else throw F}}),I.onerror=function(L){L.preventDefault(),T(I.error)},I.onsuccess=function(){var L=I.result;L.onversionchange=function(k){k.target.close()},v(L),ge(h)}})}function Me(h){return Ge(h,!1)}function lt(h){return Ge(h,!0)}function Tt(h,S){if(!h.db)return!0;var v=!h.db.objectStoreNames.contains(h.storeName),T=h.version<h.db.version,C=h.version>h.db.version;if(T&&(h.version!==S&&console.warn('The database "'+h.name+`" can't be downgraded from version `+h.db.version+" to version "+h.version+"."),h.version=h.db.version),C||v){if(v){var I=h.db.version+1;I>h.version&&(h.version=I)}return!0}return!1}function Te(h){return new d(function(S,v){var T=new FileReader;T.onerror=v,T.onloadend=function(C){var I=btoa(C.target.result||"");S({__local_forage_encoded_blob:!0,data:I,type:h.type})},T.readAsBinaryString(h)})}function $e(h){var S=Q(atob(h.data));return f([S],{type:h.type})}function me(h){return h&&h.__local_forage_encoded_blob}function ne(h){var S=this,v=S._initReady().then(function(){var T=P[S._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return E(v,h,h),v}function je(h){Re(h);for(var S=P[h.name],v=S.forages,T=0;T<v.length;T++){var C=v[T];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return h.db=null,Me(h).then(function(I){return h.db=I,Tt(h)?lt(h):I}).then(function(I){h.db=S.db=I;for(var L=0;L<v.length;L++)v[L]._dbInfo.db=I}).catch(function(I){throw Ie(h,I),I})}function dt(h,S,v,T){T===void 0&&(T=1);try{var C=h.db.transaction(h.storeName,S);v(null,C)}catch(I){if(T>0&&(!h.db||I.name==="InvalidStateError"||I.name==="NotFoundError"))return d.resolve().then(function(){if(!h.db||I.name==="NotFoundError"&&!h.db.objectStoreNames.contains(h.storeName)&&h.version<=h.db.version)return h.db&&(h.version=h.db.version+1),lt(h)}).then(function(){return je(h).then(function(){dt(h,S,v,T-1)})}).catch(v);v(I)}}function lr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Hr(h){var S=this,v={db:null};if(h)for(var T in h)v[T]=h[T];var C=P[v.name];C||(C=lr(),P[v.name]=C),C.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=ne);var I=[];function L(){return d.resolve()}for(var k=0;k<C.forages.length;k++){var F=C.forages[k];F!==S&&I.push(F._initReady().catch(L))}var H=C.forages.slice(0);return d.all(I).then(function(){return v.db=C.db,Me(v)}).then(function(W){return v.db=W,Tt(v,S._defaultConfig.version)?lt(v):W}).then(function(W){v.db=C.db=W,S._dbInfo=v;for(var q=0;q<H.length;q++){var ue=H[q];ue!==S&&(ue._dbInfo.db=v.db,ue._dbInfo.version=v.version)}})}function rn(h,S){var v=this;h=A(h);var T=new d(function(C,I){v.ready().then(function(){dt(v._dbInfo,se,function(L,k){if(L)return I(L);try{var F=k.objectStore(v._dbInfo.storeName),H=F.get(h);H.onsuccess=function(){var W=H.result;W===void 0&&(W=null),me(W)&&(W=$e(W)),C(W)},H.onerror=function(){I(H.error)}}catch(W){I(W)}})}).catch(I)});return g(T,S),T}function Mn(h,S){var v=this,T=new d(function(C,I){v.ready().then(function(){dt(v._dbInfo,se,function(L,k){if(L)return I(L);try{var F=k.objectStore(v._dbInfo.storeName),H=F.openCursor(),W=1;H.onsuccess=function(){var q=H.result;if(q){var ue=q.value;me(ue)&&(ue=$e(ue));var Ce=h(ue,q.key,W++);Ce!==void 0?C(Ce):q.continue()}else C()},H.onerror=function(){I(H.error)}}catch(q){I(q)}})}).catch(I)});return g(T,S),T}function $r(h,S,v){var T=this;h=A(h);var C=new d(function(I,L){var k;T.ready().then(function(){return k=T._dbInfo,j.call(S)==="[object Blob]"?ae(k.db).then(function(F){return F?S:Te(S)}):S}).then(function(F){dt(T._dbInfo,M,function(H,W){if(H)return L(H);try{var q=W.objectStore(T._dbInfo.storeName);F===null&&(F=void 0);var ue=q.put(F,h);W.oncomplete=function(){F===void 0&&(F=null),I(F)},W.onabort=W.onerror=function(){var Ce=ue.error?ue.error:ue.transaction.error;L(Ce)}}catch(Ce){L(Ce)}})}).catch(L)});return g(C,v),C}function Fn(h,S){var v=this;h=A(h);var T=new d(function(C,I){v.ready().then(function(){dt(v._dbInfo,M,function(L,k){if(L)return I(L);try{var F=k.objectStore(v._dbInfo.storeName),H=F.delete(h);k.oncomplete=function(){C()},k.onerror=function(){I(H.error)},k.onabort=function(){var W=H.error?H.error:H.transaction.error;I(W)}}catch(W){I(W)}})}).catch(I)});return g(T,S),T}function Hn(h){var S=this,v=new d(function(T,C){S.ready().then(function(){dt(S._dbInfo,M,function(I,L){if(I)return C(I);try{var k=L.objectStore(S._dbInfo.storeName),F=k.clear();L.oncomplete=function(){T()},L.onabort=L.onerror=function(){var H=F.error?F.error:F.transaction.error;C(H)}}catch(H){C(H)}})}).catch(C)});return g(v,h),v}function $n(h){var S=this,v=new d(function(T,C){S.ready().then(function(){dt(S._dbInfo,se,function(I,L){if(I)return C(I);try{var k=L.objectStore(S._dbInfo.storeName),F=k.count();F.onsuccess=function(){T(F.result)},F.onerror=function(){C(F.error)}}catch(H){C(H)}})}).catch(C)});return g(v,h),v}function tr(h,S){var v=this,T=new d(function(C,I){if(h<0){C(null);return}v.ready().then(function(){dt(v._dbInfo,se,function(L,k){if(L)return I(L);try{var F=k.objectStore(v._dbInfo.storeName),H=!1,W=F.openKeyCursor();W.onsuccess=function(){var q=W.result;if(!q){C(null);return}h===0||H?C(q.key):(H=!0,q.advance(h))},W.onerror=function(){I(W.error)}}catch(q){I(q)}})}).catch(I)});return g(T,S),T}function ht(h){var S=this,v=new d(function(T,C){S.ready().then(function(){dt(S._dbInfo,se,function(I,L){if(I)return C(I);try{var k=L.objectStore(S._dbInfo.storeName),F=k.openKeyCursor(),H=[];F.onsuccess=function(){var W=F.result;if(!W){T(H);return}H.push(W.key),W.continue()},F.onerror=function(){C(F.error)}}catch(W){C(W)}})}).catch(C)});return g(v,h),v}function Ht(h,S){S=O.apply(this,arguments);var v=this.config();h=typeof h!="function"&&h||{},h.name||(h.name=h.name||v.name,h.storeName=h.storeName||v.storeName);var T=this,C;if(!h.name)C=d.reject("Invalid arguments");else{var I=h.name===v.name&&T._dbInfo.db,L=I?d.resolve(T._dbInfo.db):Me(h).then(function(k){var F=P[h.name],H=F.forages;F.db=k;for(var W=0;W<H.length;W++)H[W]._dbInfo.db=k;return k});h.storeName?C=L.then(function(k){if(k.objectStoreNames.contains(h.storeName)){var F=k.version+1;Re(h);var H=P[h.name],W=H.forages;k.close();for(var q=0;q<W.length;q++){var ue=W[q];ue._dbInfo.db=null,ue._dbInfo.version=F}var Ce=new d(function(xe,qe){var Ve=m.open(h.name,F);Ve.onerror=function($t){var Yi=Ve.result;Yi.close(),qe($t)},Ve.onupgradeneeded=function(){var $t=Ve.result;$t.deleteObjectStore(h.storeName)},Ve.onsuccess=function(){var $t=Ve.result;$t.close(),xe($t)}});return Ce.then(function(xe){H.db=xe;for(var qe=0;qe<W.length;qe++){var Ve=W[qe];Ve._dbInfo.db=xe,ge(Ve._dbInfo)}}).catch(function(xe){throw(Ie(h,xe)||d.resolve()).catch(function(){}),xe})}}):C=L.then(function(k){Re(h);var F=P[h.name],H=F.forages;k.close();for(var W=0;W<H.length;W++){var q=H[W];q._dbInfo.db=null}var ue=new d(function(Ce,xe){var qe=m.deleteDatabase(h.name);qe.onerror=function(){var Ve=qe.result;Ve&&Ve.close(),xe(qe.error)},qe.onblocked=function(){console.warn('dropInstance blocked for database "'+h.name+'" until all open connections are closed')},qe.onsuccess=function(){var Ve=qe.result;Ve&&Ve.close(),Ce(Ve)}});return ue.then(function(Ce){F.db=Ce;for(var xe=0;xe<H.length;xe++){var qe=H[xe];ge(qe._dbInfo)}}).catch(function(Ce){throw(Ie(h,Ce)||d.resolve()).catch(function(){}),Ce})})}return g(C,S),C}var Wi={_driver:"asyncStorage",_initStorage:Hr,_support:p(),iterate:Mn,getItem:rn,setItem:$r,removeItem:Fn,clear:Hn,length:$n,key:tr,keys:ht,dropInstance:Ht};function y(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",_=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",U=x.length,B="arbf",ie="blob",he="si08",V="ui08",X="uic8",G="si16",ye="si32",gt="ur16",ut="ui32",ve="fl32",Z="fl64",Nt=U+B.length,jn=Object.prototype.toString;function Gi(h){var S=h.length*.75,v=h.length,T,C=0,I,L,k,F;h[h.length-1]==="="&&(S--,h[h.length-2]==="="&&S--);var H=new ArrayBuffer(S),W=new Uint8Array(H);for(T=0;T<v;T+=4)I=l.indexOf(h[T]),L=l.indexOf(h[T+1]),k=l.indexOf(h[T+2]),F=l.indexOf(h[T+3]),W[C++]=I<<2|L>>4,W[C++]=(L&15)<<4|k>>2,W[C++]=(k&3)<<6|F&63;return H}function Sc(h){var S=new Uint8Array(h),v="",T;for(T=0;T<S.length;T+=3)v+=l[S[T]>>2],v+=l[(S[T]&3)<<4|S[T+1]>>4],v+=l[(S[T+1]&15)<<2|S[T+2]>>6],v+=l[S[T+2]&63];return S.length%3===2?v=v.substring(0,v.length-1)+"=":S.length%3===1&&(v=v.substring(0,v.length-2)+"=="),v}function vh(h,S){var v="";if(h&&(v=jn.call(h)),h&&(v==="[object ArrayBuffer]"||h.buffer&&jn.call(h.buffer)==="[object ArrayBuffer]")){var T,C=x;h instanceof ArrayBuffer?(T=h,C+=B):(T=h.buffer,v==="[object Int8Array]"?C+=he:v==="[object Uint8Array]"?C+=V:v==="[object Uint8ClampedArray]"?C+=X:v==="[object Int16Array]"?C+=G:v==="[object Uint16Array]"?C+=gt:v==="[object Int32Array]"?C+=ye:v==="[object Uint32Array]"?C+=ut:v==="[object Float32Array]"?C+=ve:v==="[object Float64Array]"?C+=Z:S(new Error("Failed to get type for BinaryArray"))),S(C+Sc(T))}else if(v==="[object Blob]"){var I=new FileReader;I.onload=function(){var L=u+h.type+"~"+Sc(this.result);S(x+ie+L)},I.readAsArrayBuffer(h)}else try{S(JSON.stringify(h))}catch(L){console.error("Couldn't convert value into a JSON string: ",h),S(null,L)}}function _h(h){if(h.substring(0,U)!==x)return JSON.parse(h);var S=h.substring(Nt),v=h.substring(U,Nt),T;if(v===ie&&_.test(S)){var C=S.match(_);T=C[1],S=S.substring(C[0].length)}var I=Gi(S);switch(v){case B:return I;case ie:return f([I],{type:T});case he:return new Int8Array(I);case V:return new Uint8Array(I);case X:return new Uint8ClampedArray(I);case G:return new Int16Array(I);case gt:return new Uint16Array(I);case ye:return new Int32Array(I);case ut:return new Uint32Array(I);case ve:return new Float32Array(I);case Z:return new Float64Array(I);default:throw new Error("Unkown type: "+v)}}var wc={serialize:vh,deserialize:_h,stringToBuffer:Gi,bufferToString:Sc};function Zu(h,S,v,T){h.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],v,T)}function Eh(h){var S=this,v={db:null};if(h)for(var T in h)v[T]=typeof h[T]!="string"?h[T].toString():h[T];var C=new d(function(I,L){try{v.db=openDatabase(v.name,String(v.version),v.description,v.size)}catch(k){return L(k)}v.db.transaction(function(k){Zu(k,v,function(){S._dbInfo=v,I()},function(F,H){L(H)})},L)});return v.serializer=wc,C}function jr(h,S,v,T,C,I){h.executeSql(v,T,C,function(L,k){k.code===k.SYNTAX_ERR?L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(F,H){H.rows.length?I(F,k):Zu(F,S,function(){F.executeSql(v,T,C,I)},I)},I):I(L,k)},I)}function Sh(h,S){var v=this;h=A(h);var T=new d(function(C,I){v.ready().then(function(){var L=v._dbInfo;L.db.transaction(function(k){jr(k,L,"SELECT * FROM "+L.storeName+" WHERE key = ? LIMIT 1",[h],function(F,H){var W=H.rows.length?H.rows.item(0).value:null;W&&(W=L.serializer.deserialize(W)),C(W)},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function wh(h,S){var v=this,T=new d(function(C,I){v.ready().then(function(){var L=v._dbInfo;L.db.transaction(function(k){jr(k,L,"SELECT * FROM "+L.storeName,[],function(F,H){for(var W=H.rows,q=W.length,ue=0;ue<q;ue++){var Ce=W.item(ue),xe=Ce.value;if(xe&&(xe=L.serializer.deserialize(xe)),xe=h(xe,Ce.key,ue+1),xe!==void 0){C(xe);return}}C()},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function ep(h,S,v,T){var C=this;h=A(h);var I=new d(function(L,k){C.ready().then(function(){S===void 0&&(S=null);var F=S,H=C._dbInfo;H.serializer.serialize(S,function(W,q){q?k(q):H.db.transaction(function(ue){jr(ue,H,"INSERT OR REPLACE INTO "+H.storeName+" (key, value) VALUES (?, ?)",[h,W],function(){L(F)},function(Ce,xe){k(xe)})},function(ue){if(ue.code===ue.QUOTA_ERR){if(T>0){L(ep.apply(C,[h,F,v,T-1]));return}k(ue)}})})}).catch(k)});return g(I,v),I}function bh(h,S,v){return ep.apply(this,[h,S,v,1])}function Ih(h,S){var v=this;h=A(h);var T=new d(function(C,I){v.ready().then(function(){var L=v._dbInfo;L.db.transaction(function(k){jr(k,L,"DELETE FROM "+L.storeName+" WHERE key = ?",[h],function(){C()},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function Th(h){var S=this,v=new d(function(T,C){S.ready().then(function(){var I=S._dbInfo;I.db.transaction(function(L){jr(L,I,"DELETE FROM "+I.storeName,[],function(){T()},function(k,F){C(F)})})}).catch(C)});return g(v,h),v}function Ch(h){var S=this,v=new d(function(T,C){S.ready().then(function(){var I=S._dbInfo;I.db.transaction(function(L){jr(L,I,"SELECT COUNT(key) as c FROM "+I.storeName,[],function(k,F){var H=F.rows.item(0).c;T(H)},function(k,F){C(F)})})}).catch(C)});return g(v,h),v}function xh(h,S){var v=this,T=new d(function(C,I){v.ready().then(function(){var L=v._dbInfo;L.db.transaction(function(k){jr(k,L,"SELECT key FROM "+L.storeName+" WHERE id = ? LIMIT 1",[h+1],function(F,H){var W=H.rows.length?H.rows.item(0).key:null;C(W)},function(F,H){I(H)})})}).catch(I)});return g(T,S),T}function Dh(h){var S=this,v=new d(function(T,C){S.ready().then(function(){var I=S._dbInfo;I.db.transaction(function(L){jr(L,I,"SELECT key FROM "+I.storeName,[],function(k,F){for(var H=[],W=0;W<F.rows.length;W++)H.push(F.rows.item(W).key);T(H)},function(k,F){C(F)})})}).catch(C)});return g(v,h),v}function Rh(h){return new d(function(S,v){h.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,I){for(var L=[],k=0;k<I.rows.length;k++)L.push(I.rows.item(k).name);S({db:h,storeNames:L})},function(C,I){v(I)})},function(T){v(T)})})}function Ah(h,S){S=O.apply(this,arguments);var v=this.config();h=typeof h!="function"&&h||{},h.name||(h.name=h.name||v.name,h.storeName=h.storeName||v.storeName);var T=this,C;return h.name?C=new d(function(I){var L;h.name===v.name?L=T._dbInfo.db:L=openDatabase(h.name,"","",0),h.storeName?I({db:L,storeNames:[h.storeName]}):I(Rh(L))}).then(function(I){return new d(function(L,k){I.db.transaction(function(F){function H(Ce){return new d(function(xe,qe){F.executeSql("DROP TABLE IF EXISTS "+Ce,[],function(){xe()},function(Ve,$t){qe($t)})})}for(var W=[],q=0,ue=I.storeNames.length;q<ue;q++)W.push(H(I.storeNames[q]));d.all(W).then(function(){L()}).catch(function(Ce){k(Ce)})},function(F){k(F)})})}):C=d.reject("Invalid arguments"),g(C,S),C}var Nh={_driver:"webSQLStorage",_initStorage:Eh,_support:y(),iterate:wh,getItem:Sh,setItem:bh,removeItem:Ih,clear:Th,length:Ch,key:xh,keys:Dh,dropInstance:Ah};function Oh(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function tp(h,S){var v=h.name+"/";return h.storeName!==S.storeName&&(v+=h.storeName+"/"),v}function Ph(){var h="_localforage_support_test";try{return localStorage.setItem(h,!0),localStorage.removeItem(h),!1}catch{return!0}}function Lh(){return!Ph()||localStorage.length>0}function Bh(h){var S=this,v={};if(h)for(var T in h)v[T]=h[T];return v.keyPrefix=tp(h,S._defaultConfig),Lh()?(S._dbInfo=v,v.serializer=wc,d.resolve()):d.reject()}function Uh(h){var S=this,v=S.ready().then(function(){for(var T=S._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var I=localStorage.key(C);I.indexOf(T)===0&&localStorage.removeItem(I)}});return g(v,h),v}function kh(h,S){var v=this;h=A(h);var T=v.ready().then(function(){var C=v._dbInfo,I=localStorage.getItem(C.keyPrefix+h);return I&&(I=C.serializer.deserialize(I)),I});return g(T,S),T}function Mh(h,S){var v=this,T=v.ready().then(function(){for(var C=v._dbInfo,I=C.keyPrefix,L=I.length,k=localStorage.length,F=1,H=0;H<k;H++){var W=localStorage.key(H);if(W.indexOf(I)===0){var q=localStorage.getItem(W);if(q&&(q=C.serializer.deserialize(q)),q=h(q,W.substring(L),F++),q!==void 0)return q}}});return g(T,S),T}function Fh(h,S){var v=this,T=v.ready().then(function(){var C=v._dbInfo,I;try{I=localStorage.key(h)}catch{I=null}return I&&(I=I.substring(C.keyPrefix.length)),I});return g(T,S),T}function Hh(h){var S=this,v=S.ready().then(function(){for(var T=S._dbInfo,C=localStorage.length,I=[],L=0;L<C;L++){var k=localStorage.key(L);k.indexOf(T.keyPrefix)===0&&I.push(k.substring(T.keyPrefix.length))}return I});return g(v,h),v}function $h(h){var S=this,v=S.keys().then(function(T){return T.length});return g(v,h),v}function jh(h,S){var v=this;h=A(h);var T=v.ready().then(function(){var C=v._dbInfo;localStorage.removeItem(C.keyPrefix+h)});return g(T,S),T}function Wh(h,S,v){var T=this;h=A(h);var C=T.ready().then(function(){S===void 0&&(S=null);var I=S;return new d(function(L,k){var F=T._dbInfo;F.serializer.serialize(S,function(H,W){if(W)k(W);else try{localStorage.setItem(F.keyPrefix+h,H),L(I)}catch(q){(q.name==="QuotaExceededError"||q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&k(q),k(q)}})})});return g(C,v),C}function Gh(h,S){if(S=O.apply(this,arguments),h=typeof h!="function"&&h||{},!h.name){var v=this.config();h.name=h.name||v.name,h.storeName=h.storeName||v.storeName}var T=this,C;return h.name?C=new d(function(I){h.storeName?I(tp(h,T._defaultConfig)):I(h.name+"/")}).then(function(I){for(var L=localStorage.length-1;L>=0;L--){var k=localStorage.key(L);k.indexOf(I)===0&&localStorage.removeItem(k)}}):C=d.reject("Invalid arguments"),g(C,S),C}var Vh={_driver:"localStorageWrapper",_initStorage:Bh,_support:Oh(),iterate:Mh,getItem:kh,setItem:Wh,removeItem:jh,clear:Uh,length:$h,key:Fh,keys:Hh,dropInstance:Gh},Yh=function(S,v){return S===v||typeof S=="number"&&typeof v=="number"&&isNaN(S)&&isNaN(v)},zh=function(S,v){for(var T=S.length,C=0;C<T;){if(Yh(S[C],v))return!0;C++}return!1},rp=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"},Vi={},np={},Wn={INDEXEDDB:Wi,WEBSQL:Nh,LOCALSTORAGE:Vh},qh=[Wn.INDEXEDDB._driver,Wn.WEBSQL._driver,Wn.LOCALSTORAGE._driver],Vo=["dropInstance"],bc=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Vo),Kh={description:"",driver:qh.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Jh(h,S){h[S]=function(){var v=arguments;return h.ready().then(function(){return h[S].apply(h,v)})}}function Ic(){for(var h=1;h<arguments.length;h++){var S=arguments[h];if(S)for(var v in S)S.hasOwnProperty(v)&&(rp(S[v])?arguments[0][v]=S[v].slice():arguments[0][v]=S[v])}return arguments[0]}var Xh=function(){function h(S){a(this,h);for(var v in Wn)if(Wn.hasOwnProperty(v)){var T=Wn[v],C=T._driver;this[v]=C,Vi[C]||this.defineDriver(T)}this._defaultConfig=Ic({},Kh),this._config=Ic({},this._defaultConfig,S),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return h.prototype.config=function(v){if((typeof v>"u"?"undefined":s(v))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in v){if(T==="storeName"&&(v[T]=v[T].replace(/\W/g,"_")),T==="version"&&typeof v[T]!="number")return new Error("Database version must be a number.");this._config[T]=v[T]}return"driver"in v&&v.driver?this.setDriver(this._config.driver):!0}else return typeof v=="string"?this._config[v]:this._config},h.prototype.defineDriver=function(v,T,C){var I=new d(function(L,k){try{var F=v._driver,H=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!v._driver){k(H);return}for(var W=bc.concat("_initStorage"),q=0,ue=W.length;q<ue;q++){var Ce=W[q],xe=!zh(Vo,Ce);if((xe||v[Ce])&&typeof v[Ce]!="function"){k(H);return}}var qe=function(){for(var Yi=function(eg){return function(){var tg=new Error("Method "+eg+" is not implemented by the current driver"),ip=d.reject(tg);return g(ip,arguments[arguments.length-1]),ip}},Tc=0,Zh=Vo.length;Tc<Zh;Tc++){var Cc=Vo[Tc];v[Cc]||(v[Cc]=Yi(Cc))}};qe();var Ve=function(Yi){Vi[F]&&console.info("Redefining LocalForage driver: "+F),Vi[F]=v,np[F]=Yi,L()};"_support"in v?v._support&&typeof v._support=="function"?v._support().then(Ve,k):Ve(!!v._support):Ve(!0)}catch($t){k($t)}});return E(I,T,C),I},h.prototype.driver=function(){return this._driver||null},h.prototype.getDriver=function(v,T,C){var I=Vi[v]?d.resolve(Vi[v]):d.reject(new Error("Driver not found."));return E(I,T,C),I},h.prototype.getSerializer=function(v){var T=d.resolve(wc);return E(T,v),T},h.prototype.ready=function(v){var T=this,C=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return E(C,v,v),C},h.prototype.setDriver=function(v,T,C){var I=this;rp(v)||(v=[v]);var L=this._getSupportedDrivers(v);function k(){I._config.driver=I.driver()}function F(q){return I._extend(q),k(),I._ready=I._initStorage(I._config),I._ready}function H(q){return function(){var ue=0;function Ce(){for(;ue<q.length;){var xe=q[ue];return ue++,I._dbInfo=null,I._ready=null,I.getDriver(xe).then(F).catch(Ce)}k();var qe=new Error("No available storage method found.");return I._driverSet=d.reject(qe),I._driverSet}return Ce()}}var W=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=W.then(function(){var q=L[0];return I._dbInfo=null,I._ready=null,I.getDriver(q).then(function(ue){I._driver=ue._driver,k(),I._wrapLibraryMethodsWithReady(),I._initDriver=H(L)})}).catch(function(){k();var q=new Error("No available storage method found.");return I._driverSet=d.reject(q),I._driverSet}),E(this._driverSet,T,C),this._driverSet},h.prototype.supports=function(v){return!!np[v]},h.prototype._extend=function(v){Ic(this,v)},h.prototype._getSupportedDrivers=function(v){for(var T=[],C=0,I=v.length;C<I;C++){var L=v[C];this.supports(L)&&T.push(L)}return T},h.prototype._wrapLibraryMethodsWithReady=function(){for(var v=0,T=bc.length;v<T;v++)Jh(this,bc[v])},h.prototype.createInstance=function(v){return new h(v)},h}(),Qh=new Xh;i.exports=Qh},{3:3}]},{},[4])(4)})});var ei=ur(Zn=>{"use strict";var $g=Zn&&Zn.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(f){s(f)}}function c(p){try{m(n.throw(p))}catch(f){s(f)}}function m(p){p.done?o(p.value):i(p.value).then(a,c)}m((n=n.apply(t,e||[])).next())})};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.JSUtils=void 0;var ss=class{static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static sleep(e){return $g(this,void 0,void 0,function*(){return new Promise(r=>setTimeout(r,e))})}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};Zn.JSUtils=ss;ss.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)/)});var ku=ur(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.URLBuilder=void 0;var vE=function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t}();ya.URLBuilder=vE});var th=ur((Ju,Xu)=>{"use strict";(function(t,e){typeof Ju=="object"&&typeof Xu<"u"?Xu.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(Ju,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var m=i.retries,p=i.retryDelay,f=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))m=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")p=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(d,g){var E=function(O){var D=typeof Request<"u"&&a instanceof Request?a.clone():a;n(D,c).then(function(R){if(Array.isArray(f)&&f.indexOf(R.status)===-1)d(R);else if(typeof f=="function")try{return Promise.resolve(f(O,null,R)).then(function(P){P?A(O,null,R):d(R)}).catch(g)}catch(P){g(P)}else O<m?A(O,null,R):d(R)}).catch(function(R){if(typeof f=="function")try{Promise.resolve(f(O,R,null)).then(function(P){P?A(O,R,null):g(R)}).catch(function(P){g(P)})}catch(P){g(P)}else O<m?A(O,R,null):g(R)})};function A(O,D,R){var P=typeof p=="function"?p(O,D,R):p;setTimeout(function(){E(++O)},P)}E(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var cp="9.4.0";var N=class t{static SDK_VERSION=cp;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 CTA_AFTER_REFRESH_UI="letscooee:outbound:refresh-ui";static POPUP_ACTIVITY_EVENT="letscooee:outbound:popup-activities";static THIRD_PARTY_CHECKOUT_EVENT="letscooee:outbound:third-party-initiate-checkout";static CAMPAIGN_DISPLAYED_ACTIVITY="DISPLAYED";static CAMPAIGN_CLICKED_ACTIVITY="CLICKED";static CAMPAIGN_CLOSED_ACTIVITY="CLOSED";static BLACKLISTED_PAGE_NAMES=["collection","product","cart"];static API_CALL_MAX_ATTEMPTS=3;static API_CALL_RETRY_DELAY=1e3;static PLACEHOLDER_IMAGE="https://cdn.global.letscooee.com/images/placeholders/product.png";static CART_UPDATE_BROADCAST="CART_UPDATE";static GRAPHQL_VERSION="2024-10";static GRAPHQL_API_PATH=`/api/${this.GRAPHQL_VERSION}/graphql.json`;static SHADOW_SPLITTER=":shadow";static CAMPAIGN_ATTRIBUTE="_letscooee_campaign";static CONTENT_ATTRIBUTE="_letscooee_content";static VIA="_via";static PAYMENT_MODAL_DETAILS=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}];static{let e=t.SDK_VERSION.split(".").map(r=>r.padStart(2,"0")).join("");t.SDK_VERSION_CODE=parseInt(e,10)}};var Ct={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",styleURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.css`,widgetURL:`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${N.SDK_VERSION}/dist/widget.min.js`};var Ot=Se(nn());var b=class{static log(...e){Ot.default.info(...e)}static debug(...e){Ot.default.debug(...e)}static error(...e){Ot.default.error(...e)}static warn(...e){Ot.default.warn(...e)}static info(...e){Ot.default.info(...e)}static trace(...e){Ot.default.trace(...e)}static configure(e=N.LOG_PREFIX){Ot.default.useDefaults({formatter:function(n){n.unshift(`${e} (v${N.SDK_VERSION}):`)}});let r=this.getDebugParam();(r==="1"||r==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Ot.default.setLevel(Ot.default[localStorage.cooeeLogLevel]):Ot.default.setLevel(Ct.debug?Ot.default.TRACE:Ot.default.OFF)}static getDebugParam(){return new URL(location.href).searchParams?.get("cooee-debug")}static logBrand(){let e=`
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
5
|
+
color: white;
|
|
6
|
+
padding: 4px;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
`,r=`
|
|
9
|
+
`;r+=`\u{1F4E3} Drive higher conversions with AI-powered onsite engagement
|
|
10
|
+
`,r+=`\u{1F50D} Track real-time visitor intent & optimize engagement
|
|
11
|
+
`,r+=`\u{1F4CA} Improve Meta Ads ROAS with intent-driven campaigns
|
|
12
|
+
`,r+=`\u{1F6CD}\uFE0F Boost purchases & repeat sales effortlessly
|
|
13
|
+
`,r+=`
|
|
14
|
+
|
|
15
|
+
`,r+=`Learn more: https://www.letscooee.com
|
|
16
|
+
Cooee SDK: v${N.SDK_VERSION}`,console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",e),console.log(`%c${r}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd()}};var yh=Se(Dc());var Le=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var bt=Se(Rr()),Jr=Se(Ko()),wu=Se(Ac());var es,Ee,Yp,Lc,on,jp,zp,Nc,qp,Bc,Oc,Pc,pg,qi={},Kp=[],fg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Uc=Array.isArray;function Wr(t,e){for(var r in e)t[r]=e[r];return t}function kc(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Mc(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?es.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Qo(t,s,n,i,null)}function Qo(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Yp,__i:-1,__u:0};return i==null&&Ee.vnode!=null&&Ee.vnode(o),o}function fr(t){return t.children}function pr(t,e){this.props=t,this.context=e}function Vn(t,e){if(e==null)return t.__?Vn(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"?Vn(t):null}function Jp(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 Jp(t)}}function Wp(t){(!t.__d&&(t.__d=!0)&&on.push(t)&&!Zo.__r++||jp!==Ee.debounceRendering)&&((jp=Ee.debounceRendering)||zp)(Zo)}function Zo(){var t,e,r,n,i,o,s,a;for(on.sort(Nc);t=on.shift();)t.__d&&(e=on.length,n=void 0,o=(i=(r=t).__v).__e,s=[],a=[],r.__P&&((n=Wr({},i)).__v=i.__v+1,Ee.vnode&&Ee.vnode(n),Fc(r.__P,n,i,r.__n,r.__P.namespaceURI,32&i.__u?[o]:null,s,o??Vn(i),!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,Zp(s,n,a),n.__e!=o&&Jp(n)),on.length>e&&on.sort(Nc));Zo.__r=0}function Xp(t,e,r,n,i,o,s,a,c,m,p){var f,d,g,E,A,O,D=n&&n.__k||Kp,R=e.length;for(c=mg(r,e,D,c,R),f=0;f<R;f++)(g=r.__k[f])!=null&&(d=g.__i===-1?qi:D[g.__i]||qi,g.__i=f,O=Fc(t,g,d,i,o,s,a,c,m,p),E=g.__e,g.ref&&d.ref!=g.ref&&(d.ref&&Hc(d.ref,null,g),p.push(g.ref,g.__c||E,g)),A==null&&E!=null&&(A=E),4&g.__u||d.__k===g.__k?c=Qp(g,c,t):typeof g.type=="function"&&O!==void 0?c=O:E&&(c=E.nextSibling),g.__u&=-7);return r.__e=A,c}function mg(t,e,r,n,i){var o,s,a,c,m,p=r.length,f=p,d=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+d,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Qo(null,s,null,null,null):Uc(s)?Qo(fr,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?Qo(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(m=s.__i=dg(s,r,c,f))!==-1&&(f--,(a=r[m])&&(a.__u|=2)),a==null||a.__v===null?(m==-1&&d--,typeof s.type!="function"&&(s.__u|=4)):m!=c&&(m==c-1?d--:m==c+1?d++:(m>c?d--:d++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<p;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Vn(a)),ef(a,a));return n}function Qp(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=Qp(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Vn(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function dg(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null||c&&s==c.key&&a===c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a===c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a===c.type)return o;o++}}return-1}function Gp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||fg.test(e)?r:r+"px"}function Xo(t,e,r,n,i){var o;e: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||Gp(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||Gp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(qp,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Bc,t.addEventListener(e,o?Pc:Oc,o)):t.removeEventListener(e,o?Pc:Oc,o);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 e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Vp(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Bc++;else if(e.t<r.u)return;return r(Ee.event?Ee.event(e):e)}}}function Fc(t,e,r,n,i,o,s,a,c,m){var p,f,d,g,E,A,O,D,R,P,j,se,M,Q,Y,ae,Re,ge=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(p=Ee.__b)&&p(e);e:if(typeof ge=="function")try{if(D=e.props,R="prototype"in ge&&ge.prototype.render,P=(p=ge.contextType)&&n[p.__c],j=p?P?P.props.value:p.__:n,r.__c?O=(f=e.__c=r.__c).__=f.__E:(R?e.__c=f=new ge(D,j):(e.__c=f=new pr(D,j),f.constructor=ge,f.render=gg),P&&P.sub(f),f.props=D,f.state||(f.state={}),f.context=j,f.__n=n,d=f.__d=!0,f.__h=[],f._sb=[]),R&&f.__s==null&&(f.__s=f.state),R&&ge.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Wr({},f.__s)),Wr(f.__s,ge.getDerivedStateFromProps(D,f.__s))),g=f.props,E=f.state,f.__v=e,d)R&&ge.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),R&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(R&&ge.getDerivedStateFromProps==null&&D!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(D,j),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(D,f.__s,j)===!1||e.__v==r.__v)){for(e.__v!=r.__v&&(f.props=D,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Ie){Ie&&(Ie.__=e)}),se=0;se<f._sb.length;se++)f.__h.push(f._sb[se]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(D,f.__s,j),R&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,E,A)})}if(f.context=j,f.props=D,f.__P=t,f.__e=!1,M=Ee.__r,Q=0,R){for(f.state=f.__s,f.__d=!1,M&&M(e),p=f.render(f.props,f.state,f.context),Y=0;Y<f._sb.length;Y++)f.__h.push(f._sb[Y]);f._sb=[]}else do f.__d=!1,M&&M(e),p=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++Q<25);f.state=f.__s,f.getChildContext!=null&&(n=Wr(Wr({},n),f.getChildContext())),R&&!d&&f.getSnapshotBeforeUpdate!=null&&(A=f.getSnapshotBeforeUpdate(g,E)),a=Xp(t,Uc(ae=p!=null&&p.type===fr&&p.key==null?p.props.children:p)?ae:[ae],e,r,n,i,o,s,a,c,m),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),O&&(f.__E=f.__=null)}catch(Ie){if(e.__v=null,c||o!=null)if(Ie.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Re=o.length;Re--;)kc(o[Re]);else e.__e=r.__e,e.__k=r.__k;Ee.__e(Ie,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=hg(r.__e,e,r,n,i,o,s,c,m);return(p=Ee.diffed)&&p(e),128&e.__u?void 0:a}function Zp(t,e,r){for(var n=0;n<r.length;n++)Hc(r[n],r[++n],r[++n]);Ee.__c&&Ee.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){Ee.__e(o,i.__v)}})}function hg(t,e,r,n,i,o,s,a,c){var m,p,f,d,g,E,A,O=r.props,D=e.props,R=e.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(m=0;m<o.length;m++)if((g=o[m])&&"setAttribute"in g==!!R&&(R?g.localName==R:g.nodeType==3)){t=g,o[m]=null;break}}if(t==null){if(R==null)return document.createTextNode(D);t=document.createElementNS(i,R,D.is&&D),a&&(Ee.__m&&Ee.__m(e,o),a=!1),o=null}if(R===null)O===D||a&&t.data===D||(t.data=D);else{if(o=o&&es.call(t.childNodes),O=r.props||qi,!a&&o!=null)for(O={},m=0;m<t.attributes.length;m++)O[(g=t.attributes[m]).name]=g.value;for(m in O)if(g=O[m],m!="children"){if(m=="dangerouslySetInnerHTML")f=g;else if(!(m in D)){if(m=="value"&&"defaultValue"in D||m=="checked"&&"defaultChecked"in D)continue;Xo(t,m,null,g,i)}}for(m in D)g=D[m],m=="children"?d=g:m=="dangerouslySetInnerHTML"?p=g:m=="value"?E=g:m=="checked"?A=g:a&&typeof g!="function"||O[m]===g||Xo(t,m,g,O[m],i);if(p)a||f&&(p.__html===f.__html||p.__html===t.innerHTML)||(t.innerHTML=p.__html),e.__k=[];else if(f&&(t.innerHTML=""),Xp(t,Uc(d)?d:[d],e,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Vn(r,0),a,c),o!=null)for(m=o.length;m--;)kc(o[m]);a||(m="value",R=="progress"&&E==null?t.removeAttribute("value"):E!==void 0&&(E!==t[m]||R=="progress"&&!E||R=="option"&&E!==O[m])&&Xo(t,m,E,O[m],i),m="checked",A!==void 0&&A!==t[m]&&Xo(t,m,A,O[m],i))}return t}function Hc(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){Ee.__e(i,r)}}function ef(t,e,r){var n,i;if(Ee.unmount&&Ee.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Hc(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){Ee.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&ef(n[i],e,r||typeof t.type!="function");r||kc(t.__e),t.__c=t.__=t.__e=void 0}function gg(t,e,r){return this.constructor(t,r)}function tf(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),Ee.__&&Ee.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],Fc(e,t=(!n&&r||e).__k=Mc(fr,null,[t]),i||qi,qi,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?es.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),Zp(o,t,s)}es=Kp.slice,Ee={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},Yp=0,Lc=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=Wr({},this.state),typeof t=="function"&&(t=t(Wr({},r),this.props)),t&&Wr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Wp(this))},pr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Wp(this))},pr.prototype.render=fr,on=[],zp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nc=function(t,e){return t.__v.__b-e.__v.__b},Zo.__r=0,qp=/(PointerCapture)$|Capture$/i,Bc=0,Oc=Vp(!1),Pc=Vp(!0),pg=0;var jc,Pt,$c,rf,nf=0,ff=[],Je=Ee,of=Je.__b,sf=Je.__r,af=Je.diffed,cf=Je.__c,lf=Je.unmount,uf=Je.__;function yg(t,e){Je.__h&&Je.__h(Pt,t,nf||e),nf=0;var r=Pt.__H||(Pt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Gc(t,e){var r=yg(jc++,7);return Eg(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function vg(){for(var t;t=ff.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ts),t.__H.__h.forEach(Wc),t.__H.__h=[]}catch(e){t.__H.__h=[],Je.__e(e,t.__v)}}Je.__b=function(t){Pt=null,of&&of(t)},Je.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),uf&&uf(t,e)},Je.__r=function(t){sf&&sf(t),jc=0;var e=(Pt=t.__c).__H;e&&($c===Pt?(e.__h=[],Pt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(e.__h.forEach(ts),e.__h.forEach(Wc),e.__h=[],jc=0)),$c=Pt},Je.diffed=function(t){af&&af(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ff.push(e)!==1&&rf===Je.requestAnimationFrame||((rf=Je.requestAnimationFrame)||_g)(vg)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),$c=Pt=null},Je.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ts),r.__h=r.__h.filter(function(n){return!n.__||Wc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Je.__e(n,r.__v)}}),cf&&cf(t,e)},Je.unmount=function(t){lf&&lf(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ts(n)}catch(i){e=i}}),r.__H=void 0,e&&Je.__e(e,r.__v))};var pf=typeof requestAnimationFrame=="function";function _g(t){var e,r=function(){clearTimeout(n),pf&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);pf&&(e=requestAnimationFrame(r))}function ts(t){var e=Pt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Pt=e}function Wc(t){var e=Pt;t.__c=t.__(),Pt=e}function Eg(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Sg=Symbol.for("preact-signals");function Yc(){if(Yn>1)Yn--;else{for(var t,e=!1;Ki!==void 0;){var r=Ki;for(Ki=void 0,Vc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&df(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Vc=0,Yn--,e)throw t}}var Ne=void 0;var Ki=void 0,Yn=0,Vc=0,rs=0;function mf(t){if(Ne!==void 0){var e=t.n;if(e===void 0||e.t!==Ne)return e={i:0,S:t,p:Ne.s,n:void 0,t:Ne,e:void 0,x:void 0,r:e},Ne.s!==void 0&&(Ne.s.n=e),Ne.s=e,t.n=e,32&Ne.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=Ne.s,e.n=void 0,Ne.s.n=e,Ne.s=e),e}}function Xe(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Xe.prototype.brand=Sg;Xe.prototype.h=function(){return!0};Xe.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Xe.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Xe.prototype.subscribe=function(t){var e=this;return at(function(){var r=e.value,n=Ne;Ne=void 0;try{t(r)}finally{Ne=n}})};Xe.prototype.valueOf=function(){return this.value};Xe.prototype.toString=function(){return this.value+""};Xe.prototype.toJSON=function(){return this.value};Xe.prototype.peek=function(){var t=Ne;Ne=void 0;try{return this.value}finally{Ne=t}};Object.defineProperty(Xe.prototype,"value",{get:function(){var t=mf(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Vc>100)throw new Error("Cycle detected");this.v=t,this.i++,rs++,Yn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Yc()}}}});function jt(t){return new Xe(t)}function df(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 hf(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 gf(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 zn(t){Xe.call(this,void 0),this.x=t,this.s=void 0,this.g=rs-1,this.f=4}(zn.prototype=new Xe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rs))return!0;if(this.g=rs,this.f|=1,this.i>0&&!df(this))return this.f&=-2,!0;var t=Ne;try{hf(this),Ne=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 Ne=t,gf(this),this.f&=-2,!0};zn.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Xe.prototype.S.call(this,t)};zn.prototype.U=function(t){if(this.t!==void 0&&(Xe.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};zn.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(zn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=mf(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function zc(t){return new zn(t)}function yf(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Yn++;var r=Ne;Ne=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,qc(t),n}finally{Ne=r,Yc()}}}function qc(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,yf(t)}function wg(t){if(Ne!==this)throw new Error("Out-of-order effect");gf(this),Ne=t,this.f&=-2,8&this.f&&qc(this),Yc()}function Ji(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Ji.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()}};Ji.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,yf(this),hf(this),Yn++;var t=Ne;return Ne=this,wg.bind(this,t)};Ji.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ki,Ki=this)};Ji.prototype.d=function(){this.f|=8,1&this.f||qc(this)};function at(t){var e=new Ji(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Jc,Kc;function qn(t,e){Ee[t]=e.bind(null,Ee[t]||function(){})}function ns(t){Kc&&Kc(),Kc=t&&t.S()}function vf(t){var e=this,r=t.data,n=Ig(r);n.value=r;var i=Gc(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),Lc(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},zc(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}vf.displayName="_st";Object.defineProperties(Xe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:vf},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});qn("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Xe&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});qn("__r",function(t,e){ns();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return at(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Jc=n,ns(r),t(e)});qn("__e",function(t,e,r,n){ns(),Jc=void 0,t(e,r,n)});qn("diffed",function(t,e){ns(),Jc=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var m=o[c],p=n[c];m===void 0?(m=bg(r,c,p,i),o[c]=m):m.o(p,i)}}}t(e)});function bg(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=jt(r);return{o:function(s,a){o.value=s,n=a},d:at(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}qn("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 o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});qn("__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 o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function Ig(t){return Gc(function(){return jt(t)},[])}var Tg=Object.prototype.toString,Jn=Array.isArray||function(e){return Tg.call(e)==="[object Array]"};function Qc(t){return typeof t=="function"}function Cg(t){return Jn(t)?"array":typeof t}function Xc(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function _f(t,e){return t!=null&&typeof t=="object"&&e in t}function xg(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Dg=RegExp.prototype.test;function Rg(t,e){return Dg.call(t,e)}var Ag=/\S/;function Ng(t){return!Rg(Ag,t)}var Og={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Pg(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return Og[r]})}var Lg=/\s*/,Bg=/\s+/,Ef=/\s*=/,Ug=/\s*\}/,kg=/#|\^|\/|>|\{|&|=|!/;function Mg(t,e){if(!t)return[];var r=!1,n=[],i=[],o=[],s=!1,a=!1,c="",m=0;function p(){if(s&&!a)for(;o.length;)delete i[o.pop()];else o=[];s=!1,a=!1}var f,d,g;function E(Y){if(typeof Y=="string"&&(Y=Y.split(Bg,2)),!Jn(Y)||Y.length!==2)throw new Error("Invalid tags: "+Y);f=new RegExp(Xc(Y[0])+"\\s*"),d=new RegExp("\\s*"+Xc(Y[1])),g=new RegExp("\\s*"+Xc("}"+Y[1]))}E(e||Wt.tags);for(var A=new Qi(t),O,D,R,P,j,se;!A.eos();){if(O=A.pos,R=A.scanUntil(f),R)for(var M=0,Q=R.length;M<Q;++M)P=R.charAt(M),Ng(P)?(o.push(i.length),c+=P):(a=!0,r=!0,c+=" "),i.push(["text",P,O,O+1]),O+=1,P===`
|
|
17
|
+
`&&(p(),c="",m=0,r=!1);if(!A.scan(f))break;if(s=!0,D=A.scan(kg)||"name",A.scan(Lg),D==="="?(R=A.scanUntil(Ef),A.scan(Ef),A.scanUntil(d)):D==="{"?(R=A.scanUntil(g),A.scan(Ug),A.scanUntil(d),D="&"):R=A.scanUntil(d),!A.scan(d))throw new Error("Unclosed tag at "+A.pos);if(D==">"?j=[D,R,O,A.pos,c,m,r]:j=[D,R,O,A.pos],m++,i.push(j),D==="#"||D==="^")n.push(j);else if(D==="/"){if(se=n.pop(),!se)throw new Error('Unopened section "'+R+'" at '+O);if(se[1]!==R)throw new Error('Unclosed section "'+se[1]+'" at '+O)}else D==="name"||D==="{"||D==="&"?a=!0:D==="="&&E(R)}if(p(),se=n.pop(),se)throw new Error('Unclosed section "'+se[1]+'" at '+A.pos);return Hg(Fg(i))}function Fg(t){for(var e=[],r,n,i=0,o=t.length;i<o;++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 Hg(t){for(var e=[],r=e,n=[],i,o,s=0,a=t.length;s<a;++s)switch(i=t[s],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":o=n.pop(),o[5]=i[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(i)}return e}function Qi(t){this.string=t,this.tail=t,this.pos=0}Qi.prototype.eos=function(){return this.tail===""};Qi.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};Qi.prototype.scanUntil=function(e){var r=this.tail.search(e),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};function Kn(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Kn.prototype.push=function(e){return new Kn(e,this)};Kn.prototype.lookup=function(e){var r=this.cache,n;if(r.hasOwnProperty(e))n=r[e];else{for(var i=this,o,s,a,c=!1;i;){if(e.indexOf(".")>0)for(o=i.view,s=e.split("."),a=0;o!=null&&a<s.length;)a===s.length-1&&(c=_f(o,s[a])||xg(o,s[a])),o=o[s[a++]];else o=i.view[e],c=_f(i.view,e);if(c){n=o;break}i=i.parent}r[e]=n}return Qc(n)&&(n=n.call(this.view)),n};function yt(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}yt.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};yt.prototype.parse=function(e,r){var n=this.templateCache,i=e+":"+(r||Wt.tags).join(":"),o=typeof n<"u",s=o?n.get(i):void 0;return s==null&&(s=Mg(e,r),o&&n.set(i,s)),s};yt.prototype.render=function(e,r,n,i){var o=this.getConfigTags(i),s=this.parse(e,o),a=r instanceof Kn?r:new Kn(r,void 0);return this.renderTokens(s,a,n,e,i)};yt.prototype.renderTokens=function(e,r,n,i,o){for(var s="",a,c,m,p=0,f=e.length;p<f;++p)m=void 0,a=e[p],c=a[0],c==="#"?m=this.renderSection(a,r,n,i,o):c==="^"?m=this.renderInverted(a,r,n,i,o):c===">"?m=this.renderPartial(a,r,n,o):c==="&"?m=this.unescapedValue(a,r):c==="name"?m=this.escapedValue(a,r,o):c==="text"&&(m=this.rawValue(a)),m!==void 0&&(s+=m);return s};yt.prototype.renderSection=function(e,r,n,i,o){var s=this,a="",c=r.lookup(e[1]);function m(d){return s.render(d,r,n,o)}if(c){if(Jn(c))for(var p=0,f=c.length;p<f;++p)a+=this.renderTokens(e[4],r.push(c[p]),n,i,o);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],r.push(c),n,i,o);else if(Qc(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(r.view,i.slice(e[3],e[5]),m),c!=null&&(a+=c)}else a+=this.renderTokens(e[4],r,n,i,o);return a}};yt.prototype.renderInverted=function(e,r,n,i,o){var s=r.lookup(e[1]);if(!s||Jn(s)&&s.length===0)return this.renderTokens(e[4],r,n,i,o)};yt.prototype.indentPartial=function(e,r,n){for(var i=r.replace(/[^ \t]/g,""),o=e.split(`
|
|
18
|
+
`),s=0;s<o.length;s++)o[s].length&&(s>0||!n)&&(o[s]=i+o[s]);return o.join(`
|
|
19
|
+
`)};yt.prototype.renderPartial=function(e,r,n,i){if(n){var o=this.getConfigTags(i),s=Qc(n)?n(e[1]):n[e[1]];if(s!=null){var a=e[6],c=e[5],m=e[4],p=s;c==0&&m&&(p=this.indentPartial(s,m,a));var f=this.parse(p,o);return this.renderTokens(f,r,n,p,i)}}};yt.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};yt.prototype.escapedValue=function(e,r,n){var i=this.getConfigEscape(n)||Wt.escape,o=r.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===Wt.escape?String(o):i(o)};yt.prototype.rawValue=function(e){return e[1]};yt.prototype.getConfigTags=function(e){return Jn(e)?e:e&&typeof e=="object"?e.tags:void 0};yt.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Jn(e))return e.escape};var Wt={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){Xi.templateCache=t},get templateCache(){return Xi.templateCache}},Xi=new yt;Wt.clearCache=function(){return Xi.clearCache()};Wt.parse=function(e,r){return Xi.parse(e,r)};Wt.render=function(e,r,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Cg(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Xi.render(e,r,n,i)};Wt.escape=Pg;Wt.Scanner=Qi;Wt.Context=Kn;Wt.Writer=yt;var vt=Wt;var wf=Se(Sf()),Lt=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static _instance;parentContainer;scalingFactor=1;doc=document;parser=new wf.default;constructor(){}static get(){return t._instance||(t._instance=new t),t._instance}getUAParser(){return this.parser}getWidth(){return this.parentContainer&&this.parentContainer!==document.body?this.parentContainer.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parentContainer.clientHeight:document.compatMode===t.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,o=e.spc,s=t.get().getWidth(),a=t.get().getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/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}};var oe=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"};var el=Se(If());function Xn(t){return el.default.createInstance({name:"lc",storeName:t,driver:el.default.LOCALSTORAGE})}var Gr=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var tt=class extends Gr{static storeName="ses";static{this.storage=Xn(this.storeName)}};var Oe=class extends Gr{static storeName="usr";static{this.storage=Xn(this.storeName)}};var xt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price}};var le=class{isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;currentItem;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}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(e){this.currentItem=new xt(e)}};var Pe=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 r=new URL(window.location.href).pathname.slice(1).split("/"),n=r[0];if(n==="")return"home";if(n==="collections")return r[2]==="products"?"product":"collection";if(n==="products")return"product";if(n==="cart")return"cart";if(location.href.includes("thank_you"))return"thank_you"}static getProductSlug(e){let i=(e.includes("://")?new URL(e).pathname:e).match(/\/products\/([^/]+?)(?:\.html)?$/);return i?i[1]:null}static getRootPrefix(){return window.Shopify?.routes?.root??"/"}static getCartURL(e){return this.getRootPrefix()+e+this.COOEE_URL_PREFIX}};var Qn=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}};var de=class t{static CURRENT;token;items;total_price;original_total_price;currency;item_count;attributes;lock=new Qn;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Oe.set(oe.CURRENT_CART,r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await tt.get(oe.ID),r=await Oe.get(oe.DEVICE_ID);if(this.attributes?.letscooee_did===r&&this.attributes?.letscooee_sid===e){b.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()};b.debug("Updating Shopify cart with attributes:",n);let i=Pe.getCartURL("cart/update.js"),s=await(await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})})).json();b.debug("Updated cart attributes",JSON.stringify(s)),this.update(s),this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,le.get().currencyCode=this.currency,b.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 b.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){b.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},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){b.debug("Not fetching cart");return}b.debug("Fetching cart");let r=Pe.getCartURL("cart.js"),n=await(await fetch(r)).json();this.update(n)}};var os=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};var Vm=Se(ei());var Tf=Object.prototype.toString;function sn(t){switch(Tf.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return mr(t,Error)}}function ti(t,e){return Tf.call(t)===`[object ${e}]`}function as(t){return ti(t,"ErrorEvent")}function cs(t){return ti(t,"DOMError")}function tl(t){return ti(t,"DOMException")}function _t(t){return ti(t,"String")}function ri(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function an(t){return t===null||ri(t)||typeof t!="object"&&typeof t!="function"}function rr(t){return ti(t,"Object")}function cn(t){return typeof Event<"u"&&mr(t,Event)}function rl(t){return typeof Element<"u"&&mr(t,Element)}function nl(t){return ti(t,"RegExp")}function Ar(t){return!!(t&&t.then&&typeof t.then=="function")}function il(t){return rr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function mr(t,e){try{return t instanceof e}catch{return!1}}function eo(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function dr(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ls(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{eo(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Cf(t,e,r=!1){return _t(t)?nl(e)?e.test(t):_t(e)?r?t===e:t.includes(e):!1:!1}function ni(t,e=[],r=!1){return e.some(n=>Cf(t,n,r))}function sl(t,e,r=250,n,i,o,s){if(!o.exception||!o.exception.values||!s||!mr(s.originalException,Error))return;let a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=jg(ol(t,e,i,s.originalException,n,o.exception.values,a,0),r))}function ol(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(mr(n[i],Error)){xf(s,a);let m=t(e,n[i]),p=c.length;Df(m,i,p,a),c=ol(t,e,r,n[i],i,[m,...c],m,p)}return Array.isArray(n.errors)&&n.errors.forEach((m,p)=>{if(mr(m,Error)){xf(s,a);let f=t(e,m),d=c.length;Df(f,`errors[${p}]`,d,a),c=ol(t,e,r,m,i,[f,...c],f,d)}}),c}function xf(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=ee(w(w({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Df(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=ee(w({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function jg(t,e){return t.map(r=>(r.value&&(r.value=dr(r.value,e)),r))}var Gt="8.18.0";var re=globalThis;function ii(t,e,r){let n=r||re,i=n.__SENTRY__=n.__SENTRY__||{},o=i[Gt]=i[Gt]||{};return o[t]||(o[t]=e())}var al=re,Wg=80;function to(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,m,p=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Wg;for(;r&&o++<n&&(m=Gg(r,p),!(m==="html"||o>1&&s+i.length*c+m.length>=f));)i.push(m),s+=m.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Gg(t,e){let r=t,n=[];if(!r||!r.tagName)return"";if(al.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(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&_t(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function cl(){try{return al.document.location.href}catch{return""}}function ll(t){if(!al.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 hr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Vg="Sentry Logger ",ro=["debug","info","warn","error","log","assert","trace"],oi={};function si(t){if(!("console"in re))return t();let e=re.console,r={},n=Object.keys(oi);n.forEach(i=>{let o=oi[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function Yg(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return hr?ro.forEach(r=>{e[r]=(...n)=>{t&&si(()=>{re.console[r](`${Vg}[${r}]:`,...n)})}}):ro.forEach(r=>{e[r]=()=>{}}),e}var K=Yg();var zg=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function qg(t){return t==="http"||t==="https"}function gr(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function Rf(t){let e=zg.exec(t);if(!e){si(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",m=a,p=m.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),m=p.pop()),m){let f=m.match(/^\d+/);f&&(m=f[0])}return Af({host:o,pass:i,path:c,projectId:m,port:s,protocol:r,publicKey:n})}function Af(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Kg(t){if(!hr)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(K.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?qg(n)?e&&isNaN(parseInt(e,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function us(t){let e=typeof t=="string"?Rf(t):Af(t);if(!(!e||!Kg(e)))return e}var pt=class extends Error{constructor(e,r="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=r}};function Ue(t,e,r){if(!(e in t))return;let n=t[e],i=r(n);typeof i=="function"&&ps(i,n),t[e]=i}function Et(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{hr&&K.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ps(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,Et(t,"__sentry_original__",e)}catch{}}function ln(t){return t.__sentry_original__}function pl(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function fs(t){if(sn(t))return w({message:t.message,name:t.name,stack:t.stack},Of(t));if(cn(t)){let e=w({type:t.type,target:Nf(t.target),currentTarget:Nf(t.currentTarget)},Of(t));return typeof CustomEvent<"u"&&mr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Nf(t){try{return rl(t)?to(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Of(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(fs(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return dr(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:dr(o,e)}return""}function Qe(t){return ul(t,new Map)}function ul(t,e){if(Jg(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]=ul(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(ul(i,e))}),n}return t}function Jg(t){if(!rr(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var yr="?",Pf=/\(error: (.*)\)/,Lf=/captureMessage|captureException/;function dl(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
|
|
20
|
+
`);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let m=Pf.test(c)?c.replace(Pf,"$1"):c;if(!m.match(/\S*Error: /)){for(let p of e){let f=p(m);if(f){o.push(f);break}}if(o.length>=50+i)break}}return Bf(o.slice(i))}}function Bf(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(ms(e).function||"")&&e.pop(),e.reverse(),Lf.test(ms(e).function||"")&&(e.pop(),Lf.test(ms(e).function||"")&&e.pop()),e.slice(0,50).map(r=>ee(w({},r),{filename:r.filename||ms(e).filename,function:r.function||yr}))}function ms(t){return t[t.length-1]||{}}var ml="<anonymous>";function Vt(t){try{return!t||typeof t!="function"?ml:t.name||ml}catch{return ml}}function ds(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 hs={},Uf={};function St(t,e){hs[t]=hs[t]||[],hs[t].push(e)}function wt(t,e){Uf[t]||(e(),Uf[t]=!0)}function Ze(t,e){let r=t&&hs[t];if(r)for(let n of r)try{n(e)}catch(i){hr&&K.error(`Error while triggering instrumentation handler.
|
|
21
|
+
Type: ${t}
|
|
22
|
+
Name: ${Vt(n)}
|
|
23
|
+
Error:`,i)}}function hl(t){let e="console";St(e,t),wt(e,Xg)}function Xg(){"console"in re&&ro.forEach(function(t){t in re.console&&Ue(re.console,t,function(e){return oi[t]=e,function(...r){Ze("console",{args:r,level:t});let i=oi[t];i&&i.apply(re.console,r)}})})}var gl=re;function kf(){if(!("fetch"in gl))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function no(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function yl(){if(typeof EdgeRuntime=="string")return!0;if(!kf())return!1;if(no(gl.fetch))return!0;let t=!1,e=gl.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=no(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){hr&&K.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}var Mf=1e3;function vr(){return Date.now()/Mf}function Qg(){let{performance:t}=re;if(!t||!t.now)return vr;let e=Date.now()-t.now(),r=t.timeOrigin==null?e:t.timeOrigin;return()=>(r+t.now())/Mf}var Bt=Qg(),io,Zg=(()=>{let{performance:t}=re;if(!t||!t.now){io="none";return}let e=3600*1e3,r=t.now(),n=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+r-n):e,o=i<e,s=t.timing&&t.timing.navigationStart,c=typeof s=="number"?Math.abs(s+r-n):e,m=c<e;return o||m?i<=c?(io="timeOrigin",t.timeOrigin):(io="navigationStart",s):(io="dateNow",n)})();function _l(t){let e="fetch";St(e,t),wt(e,ey)}function ey(){yl()&&Ue(re,"fetch",function(t){return function(...e){let{method:r,url:n}=ty(e),i={args:e,fetchData:{method:r,url:n},startTimestamp:Bt()*1e3};Ze("fetch",w({},i));let o=new Error().stack;return t.apply(re,e).then(s=>{let a=ee(w({},i),{endTimestamp:Bt()*1e3,response:s});return Ze("fetch",a),s},s=>{let a=ee(w({},i),{endTimestamp:Bt()*1e3,error:s});throw Ze("fetch",a),sn(s)&&s.stack===void 0&&(s.stack=o,Et(s,"framesToPop",1)),s})}})}function vl(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Ff(t){return typeof t=="string"?t:t?vl(t,"url")?t.url:t.toString?t.toString():"":""}function ty(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:Ff(r),method:vl(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:Ff(e),method:vl(e,"method")?String(e.method).toUpperCase():"GET"}}var gs=null;function El(t){let e="error";St(e,t),wt(e,ry)}function ry(){gs=re.onerror,re.onerror=function(t,e,r,n,i){return Ze("error",{column:n,error:i,line:r,msg:t,url:e}),gs&&!gs.__SENTRY_LOADER__?gs.apply(this,arguments):!1},re.onerror.__SENTRY_INSTRUMENTED__=!0}var ys=null;function Sl(t){let e="unhandledrejection";St(e,t),wt(e,ny)}function ny(){ys=re.onunhandledrejection,re.onunhandledrejection=function(t){return Ze("unhandledrejection",t),ys&&!ys.__SENTRY_LOADER__?ys.apply(this,arguments):!0},re.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function wl(){return"npm"}function Hf(){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 o=0;o<e.length;o++)if(e[o]===i)return!0;return e.push(i),!1}function n(i){if(t)e.delete(i);else for(let o=0;o<e.length;o++)if(e[o]===i){e.splice(o,1);break}}return[r,n]}function rt(){let t=re,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 $f(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=$f(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function ai(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Nr(t,e){let r=$f(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=w(w(w({},n),i),e),e&&"data"in e){let o=w(w({},i&&i.data),e.data);r.mechanism.data=o}}function vs(t){if(t&&t.__sentry_captured__)return!0;try{Et(t,"__sentry_captured__",!0)}catch{}return!1}function _s(t){return Array.isArray(t)?t:[t]}function ir(t,e=100,r=1/0){try{return bl("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Es(t,e=3,r=100*1024){let n=ir(t,e);return ay(n)>r?Es(t,e-1,r):n}function bl(t,e,r=1/0,n=1/0,i=Hf()){let[o,s]=i;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let a=iy(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let m=e;if(m&&typeof m.toJSON=="function")try{let g=m.toJSON();return bl("",g,c-1,n,i)}catch{}let p=Array.isArray(e)?[]:{},f=0,d=fs(e);for(let g in d){if(!Object.prototype.hasOwnProperty.call(d,g))continue;if(f>=n){p[g]="[MaxProperties ~]";break}let E=d[g];p[g]=bl(g,E,c-1,n,i),f++}return s(e),p}function iy(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(eo(e))return"[VueViewModel]";if(il(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${Vt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=oy(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function oy(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function sy(t){return~-encodeURI(t).split(/%..|./).length}function ay(t){return sy(JSON.stringify(t))}var Or;(function(t){t[t.PENDING=0]="PENDING";let r=1;t[t.RESOLVED=r]="RESOLVED";let n=2;t[t.REJECTED=n]="REJECTED"})(Or||(Or={}));function Yt(t){return new or(e=>{e(t)})}function Vr(t){return new or((e,r)=>{r(t)})}var or=class t{constructor(e){t.prototype.__init.call(this),t.prototype.__init2.call(this),t.prototype.__init3.call(this),t.prototype.__init4.call(this),this._state=Or.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(r){this._reject(r)}}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}__init(){this._resolve=e=>{this._setResult(Or.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Or.REJECTED,e)}}__init3(){this._setResult=(e,r)=>{if(this._state===Or.PENDING){if(Ar(r)){r.then(this._resolve,this._reject);return}this._state=e,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Or.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Or.RESOLVED&&r[1](this._value),this._state===Or.REJECTED&&r[2](this._value),r[0]=!0)})}}};function Il(t){let e=[];function r(){return t===void 0||e.length<t}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!r())return Vr(new pt("Not adding Promise because buffer limit was reached."));let a=s();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function o(s){return new or((a,c)=>{let m=e.length;if(!m)return a(!0);let p=setTimeout(()=>{s&&s>0&&a(!1)},s);e.forEach(f=>{Yt(f).then(()=>{--m||(clearTimeout(p),a(!0))},c)})})}return{$:e,add:i,drain:o}}function oo(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 jf=["fatal","error","warning","log","info","debug"];function Tl(t){return t==="warn"?"warning":jf.includes(t)?t:"log"}var Gf="sentry-",Vf=/^sentry-/;function Cl(t){let e=Yf(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(Vf)){let s=i.slice(Gf.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function Yf(t){if(!(!t||!_t(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=Wf(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):Wf(t)}function Wf(t){return t.split(",").map(e=>e.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function _r(t,e=[]){return[t,e]}function Dl(t,e){let[r,n]=t;return[r,[...n,e]]}function Ss(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 xl(t){return re.__SENTRY__&&re.__SENTRY__.encodePolyfill?re.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function Rl(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[xl(n),o]:n.push(typeof o=="string"?xl(o):o)}for(let o of r){let[s,a]=o;if(i(`
|
|
24
|
+
${JSON.stringify(s)}
|
|
25
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(ir(a))}i(c)}}return typeof n=="string"?n:cy(n)}function cy(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Al(t){let e=typeof t.data=="string"?xl(t.data):t.data;return[Qe({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var ly={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 ws(t){return ly[t]}function bs(t){if(!t||!t.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Nl(t,e,r,n){let i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return w(w(w({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:gr(n)}),i&&{trace:Qe(w({},i))})}function Ol(t,e,r){let n=[{type:"client_report"},{timestamp:r||vr(),discarded_events:t}];return _r(e?{dsn:e}:{},[n])}function zf(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 qf(t,e){return t[e]||t.all||0}function Pl(t,e,r=Date.now()){return qf(t,e)>r}function Ll(t,{statusCode:e,headers:r},n=Date.now()){let i=w({},t),o=r&&r["x-sentry-rate-limits"],s=r&&r["retry-after"];if(o)for(let a of o.trim().split(",")){let[c,m,,,p]=a.split(":",5),f=parseInt(c,10),d=(isNaN(f)?60:f)*1e3;if(!m)i.all=n+d;else for(let g of m.split(";"))g==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(i[g]=n+d):i[g]=n+d}else s?i.all=n+zf(s,n):e===429&&(i.all=n+60*1e3);return i}function Is(){return{traceId:rt(),spanId:rt().substring(16)}}var Ts=re;function Bl(){let t=Ts.chrome,e=t&&t.app&&t.app.runtime,r="history"in Ts&&!!Ts.history.pushState&&!!Ts.history.replaceState;return!e&&r}var De=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function un(){return so(re),re}function so(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Gt,e[Gt]=e[Gt]||{}}function ao(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Bt(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid: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 Ul="_sentrySpan";function kl(t,e){e?Et(t,Ul,e):delete t[Ul]}function Ml(t){return t[Ul]}var fy=100,Fl=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Is()}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=w({},this._tags),e._extra=w({},this._extra),e._contexts=w({},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=w({},this._sdkProcessingMetadata),e._propagationContext=w({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,kl(e,Ml(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&&ao(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=w(w({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=ee(w({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=w(w({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=ee(w({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,[n,i]=r instanceof ft?[r.getScopeData(),r.getRequestSession()]:rr(r)?[e,e.requestSession]:[],{tags:o,extra:s,user:a,contexts:c,level:m,fingerprint:p=[],propagationContext:f}=n||{};return this._tags=w(w({},this._tags),o),this._extra=w(w({},this._extra),s),this._contexts=w(w({},this._contexts),c),a&&Object.keys(a).length&&(this._user=a),m&&(this._level=m),p.length&&(this._fingerprint=p),f&&(this._propagationContext=f),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,kl(this,void 0),this._attachments=[],this._propagationContext=Is(),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:fy;if(n<=0)return this;let i=w({timestamp:vr()},e),o=this._breadcrumbs;return o.push(i),this._breadcrumbs=o.length>n?o.slice(-n):o,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:Ml(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=w(w({},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 K.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,ee(w({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 K.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,ee(w({originalException:e,syntheticException:o},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,ee(w({},r),{event_id:n}),this),n):(K.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},ft=Fl;function Kf(){return ii("defaultCurrentScope",()=>new ft)}function Jf(){return ii("defaultIsolationScope",()=>new ft)}var Hl=class{constructor(e,r){let n;e?n=e:n=new ft;let i;r?i=r:i=new ft,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return Ar(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function ci(){let t=un(),e=so(t);return e.stack=e.stack||new Hl(Kf(),Jf())}function my(t){return ci().withScope(t)}function dy(t,e){let r=ci();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Xf(t){return ci().withScope(()=>t(ci().getIsolationScope()))}function Qf(){return{withIsolationScope:Xf,withScope:my,withSetScope:dy,withSetIsolationScope:(t,e)=>Xf(e),getCurrentScope:()=>ci().getScope(),getIsolationScope:()=>ci().getIsolationScope()}}function Cs(t){let e=so(t);return e.acs?e.acs:Qf()}function pn(){let t=un();return Cs(t).getCurrentScope()}function fn(){let t=un();return Cs(t).getIsolationScope()}function xs(){return ii("globalScope",()=>new ft)}function Ds(...t){let e=un(),r=Cs(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Fe(){return pn().getClient()}var hy="_sentryMetrics";function Zf(t){let e=t[hy];if(!e)return;let r={};for(let[,[n,i]]of e)(r[n]||(r[n]=[])).push(Qe(i));return r}var $l="sentry.source",jl="sentry.sample_rate",Wl="sentry.op",Gl="sentry.origin";var gy=1;function rm(t){let{spanId:e,traceId:r}=t.spanContext(),{parent_span_id:n}=mn(t);return Qe({parent_span_id:n,span_id:e,trace_id:r})}function em(t){return typeof t=="number"?tm(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?tm(t.getTime()):Bt()}function tm(t){return t>9999999999?t/1e3:t}function mn(t){if(vy(t))return t.getSpanJSON();try{let{spanId:e,traceId:r}=t.spanContext();if(yy(t)){let{attributes:n,startTime:i,name:o,endTime:s,parentSpanId:a,status:c}=t;return Qe({span_id:e,trace_id:r,data:n,description:o,parent_span_id:a,start_timestamp:em(i),timestamp:em(s)||void 0,status:_y(c),op:n[Wl],origin:n[Gl],_metrics_summary:Zf(t)})}return{span_id:e,trace_id:r}}catch{return{}}}function yy(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function vy(t){return typeof t.getSpanJSON=="function"}function nm(t){let{traceFlags:e}=t.spanContext();return e===gy}function _y(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var Ey="_sentryRootSpan";function co(t){return t[Ey]||t}var Rs="production";var Sy="_frozenDsc";function Vl(t,e){let r=e.getOptions(),{publicKey:n}=e.getDsn()||{},i=Qe({environment:r.environment||Rs,release:r.release,public_key:n,trace_id:t});return e.emit("createDsc",i),i}function im(t){let e=Fe();if(!e)return{};let r=Vl(mn(t).trace_id||"",e),n=co(t),i=n[Sy];if(i)return i;let o=n.spanContext().traceState,s=o&&o.get("sentry.dsc"),a=s&&Cl(s);if(a)return a;let c=mn(n),m=c.data||{},p=m[jl];p!=null&&(r.sample_rate=`${p}`);let f=m[$l],d=c.description;return f!=="url"&&d&&(r.transaction=d),r.sampled=String(nm(n)),e.emit("createDsc",r,n),r}function om(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){De&&K.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 wy(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 sm(t,e,r,n){let i=bs(r),o=w(w({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:gr(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return _r(o,[s])}function am(t,e,r,n){let i=bs(r),o=t.type&&t.type!=="replay_event"?t.type:"event";wy(t,r&&r.sdk);let s=Nl(t,i,n,e);return delete t.sdkProcessingMetadata,_r(s,[[{type:o},t]])}function As(t,e,r,n=0){return new or((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(w({},e),r);De&&s.id&&a===null&&K.log(`Event processor "${s.id}" dropped event`),Ar(a)?a.then(c=>As(t,c,r,n+1).then(i)).then(null,o):As(t,a,r,n+1).then(i).then(null,o)}})}function cm(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;by(t,e),n&&Cy(t,n),xy(t,r),Iy(t,i),Ty(t,o)}function Yl(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:m,eventProcessors:p,attachments:f,propagationContext:d,transactionName:g,span:E}=e;lo(t,"extra",r),lo(t,"tags",n),lo(t,"user",i),lo(t,"contexts",o),lo(t,"sdkProcessingMetadata",a),s&&(t.level=s),g&&(t.transactionName=g),E&&(t.span=E),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),m.length&&(t.fingerprint=[...t.fingerprint,...m]),p.length&&(t.eventProcessors=[...t.eventProcessors,...p]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=w(w({},t.propagationContext),d)}function lo(t,e,r){if(r&&Object.keys(r).length){t[e]=w({},t[e]);for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[e][n]=r[n])}}function by(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e,c=Qe(r);c&&Object.keys(c).length&&(t.extra=w(w({},c),t.extra));let m=Qe(n);m&&Object.keys(m).length&&(t.tags=w(w({},m),t.tags));let p=Qe(i);p&&Object.keys(p).length&&(t.user=w(w({},p),t.user));let f=Qe(o);f&&Object.keys(f).length&&(t.contexts=w(w({},f),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function Iy(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function Ty(t,e){t.sdkProcessingMetadata=w(w({},t.sdkProcessingMetadata),e)}function Cy(t,e){t.contexts=w({trace:rm(e)},t.contexts),t.sdkProcessingMetadata=w({dynamicSamplingContext:im(e)},t.sdkProcessingMetadata);let r=co(e),n=mn(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function xy(t,e){t.fingerprint=t.fingerprint?_s(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function um(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=ee(w({},e),{event_id:e.event_id||r.event_id||rt(),timestamp:e.timestamp||vr()}),m=r.integrations||t.integrations.map(O=>O.name);Dy(c,t),Ny(c,m),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Ry(c,t.stackParser);let p=Py(n,r.captureContext);r.mechanism&&Nr(c,r.mechanism);let f=i?i.getEventProcessors():[],d=xs().getScopeData();if(o){let O=o.getScopeData();Yl(d,O)}if(p){let O=p.getScopeData();Yl(d,O)}let g=[...r.attachments||[],...d.attachments];g.length&&(r.attachments=g),cm(c,d);let E=[...f,...d.eventProcessors];return As(E,c,r).then(O=>(O&&Ay(O),typeof s=="number"&&s>0?Oy(O,s,a):O))}function Dy(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;"environment"in t||(t.environment="environment"in e?r:Rs),t.release===void 0&&n!==void 0&&(t.release=n),t.dist===void 0&&i!==void 0&&(t.dist=i),t.message&&(t.message=dr(t.message,o));let s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=dr(s.value,o));let a=t.request;a&&a.url&&(a.url=dr(a.url,o))}var lm=new WeakMap;function Ry(t,e){let r=re._sentryDebugIds;if(!r)return;let n,i=lm.get(e);i?n=i:(n=new Map,lm.set(e,n));let o=Object.entries(r).reduce((s,[a,c])=>{let m,p=n.get(a);p?m=p:(m=e(a),n.set(a,m));for(let f=m.length-1;f>=0;f--){let d=m[f];if(d.filename){s[d.filename]=c;break}}return s},{});try{t.exception.values.forEach(s=>{s.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=o[a.filename])})})}catch{}}function Ay(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 Ny(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Oy(t,e,r){if(!t)return null;let n=w(w(w(w(w({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>w(w({},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=>w(w({},i),i.data&&{data:ir(i.data,e,r)}))),n}function Py(t,e){if(!e)return t;let r=t?t.clone():new ft;return r.update(e),r}function pm(t){if(t)return Ly(t)?{captureContext:t}:Uy(t)?{captureContext:t}:t}function Ly(t){return t instanceof ft||typeof t=="function"}var By=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Uy(t){return Object.keys(t).some(e=>By.includes(e))}function Ns(t,e){return pn().captureException(t,pm(e))}function uo(t,e){return pn().captureEvent(t,e)}var ky="7";function My(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function Fy(t){return`${My(t)}${t.projectId}/envelope/`}function Hy(t,e){return pl(w({sentry_key:t.publicKey,sentry_version:ky},e&&{sentry_client:`${e.name}/${e.version}`}))}function mm(t,e,r){return e||`${Fy(t)}?${Hy(t,r)}`}var dm=[];function hm(t,e){let r={};return e.forEach(n=>{n&&ql(t,n,r)}),r}function zl(t,e){for(let r of e)r&&r.afterAllSetup&&r.afterAllSetup(t)}function ql(t,e,r){if(r[e.name]){De&&K.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,dm.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),dm.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,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}De&&K.log(`Integration installed: ${e.name}`)}var gm="Not capturing exception because it's already been captured.",po=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=us(e.dsn):De&&K.warn("No DSN provided, client will not send events."),this._dsn){let r=mm(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(ee(w({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=rt();if(vs(e))return De&&K.log(gm),i;let o=w({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=w({event_id:rt()},n),s=ri(e)?e:String(e),a=an(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=rt();if(r&&r.originalException&&vs(r.originalException))return De&&K.log(gm),i;let o=w({event_id:i},r),a=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,a||n)),o.event_id}captureSession(e){typeof e.release!="string"?De&&K.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),ao(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):Yt(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];ql(this,e,this._integrations),r||zl(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=am(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=Dl(n,Al(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let r=sm(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,r,n){if(this._options.sendClientReports){let i=`${e}:${r}`;De&&K.log(`Adding outcome: "${i}"`),this._outcomes[i]=(this._outcomes[i]||0)+1}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(De&&K.error("Error while sending event:",r),r)):(De&&K.error("Transport disabled"),Yt({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=hm(this,e),zl(this,e)}_updateSessionFromEvent(e,r){let n=!1,i=!1,o=r.exception&&r.exception.values;if(o){i=!0;for(let c of o){let m=c.mechanism;if(m&&m.handled===!1){n=!0;break}}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(ao(e,ee(w({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new or(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i=fn()){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s.length>0&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),um(o,e,r,n,this,i).then(a=>{if(a===null)return a;let c=w(w({},i.getPropagationContext()),n?n.getPropagationContext():void 0);if(!(a.contexts&&a.contexts.trace)&&c){let{traceId:p,spanId:f,parentSpanId:d,dsc:g}=c;a.contexts=w({trace:Qe({trace_id:p,span_id:f,parent_span_id:d})},a.contexts);let E=g||Vl(p,this);a.sdkProcessingMetadata=w({dynamicSamplingContext:E},a.sdkProcessingMetadata)}return a})}_captureEvent(e,r={},n){return this._processEvent(e,r,n).then(i=>i.event_id,i=>{if(De){let o=i;o.logLevel==="log"?K.log(o.message):K.warn(o)}})}_processEvent(e,r,n){let i=this.getOptions(),{sampleRate:o}=i,s=Kl(e),a=ym(e),c=e.type||"error",m=`before send for type \`${c}\``,p=typeof o>"u"?void 0:om(o);if(a&&typeof p=="number"&&Math.random()>p)return this.recordDroppedEvent("sample_rate","error",e),Vr(new pt(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));let f=c==="replay_event"?"replay":c,g=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,r,n,g).then(E=>{if(E===null)throw this.recordDroppedEvent("event_processor",f,e),new pt("An event processor returned `null`, will not send event.","log");if(r.data&&r.data.__sentry__===!0)return E;let O=jy(this,i,E,r);return $y(O,m)}).then(E=>{if(E===null){if(this.recordDroppedEvent("before_send",f,e),Kl(e)){let R=1+(e.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+R}throw new pt(`${m} returned \`null\`, will not send event.`,"log")}let A=n&&n.getSession();!s&&A&&this._updateSessionFromEvent(A,E);let O=E.transaction_info;if(s&&O&&E.transaction!==e.transaction){let D="custom";E.transaction_info=ee(w({},O),{source:D})}return this.sendEvent(E,r),E}).then(null,E=>{throw E instanceof pt?E:(this.captureException(E,{data:{__sentry__:!0},originalException:E}),new pt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
26
|
+
Reason: ${E}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}};function $y(t,e){let r=`${e} must return \`null\` or a valid event.`;if(Ar(t))return t.then(n=>{if(!rr(n)&&n!==null)throw new pt(r);return n},n=>{throw new pt(`${e} rejected with ${n}`)});if(!rr(t)&&t!==null)throw new pt(r);return t}function jy(t,e,r,n){let{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e;if(ym(r)&&i)return i(r,n);if(Kl(r)){if(r.spans&&s){let a=[];for(let c of r.spans){let m=s(c);m?a.push(m):t.recordDroppedEvent("before_send","span")}r.spans=a}if(o)return o(r,n)}return r}function ym(t){return t.type===void 0}function Kl(t){return t.type==="transaction"}var Wy=64;function Os(t,e,r=Il(t.bufferSize||Wy)){let n={},i=s=>r.drain(s);function o(s){let a=[];if(Ss(s,(f,d)=>{let g=ws(d);if(Pl(n,g)){let E=vm(f,d);t.recordDroppedEvent("ratelimit_backoff",g,E)}else a.push(f)}),a.length===0)return Yt({});let c=_r(s[0],a),m=f=>{Ss(c,(d,g)=>{let E=vm(d,g);t.recordDroppedEvent(f,ws(g),E)})},p=()=>e({body:Rl(c)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&De&&K.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=Ll(n,f),f),f=>{throw m("network_error"),f});return r.add(p).then(f=>f,f=>{if(f instanceof pt)return De&&K.error("Skipped sending event because buffer is full."),m("queue_overflow"),Yt({});throw f})}return{send:o,flush:i}}function vm(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function Jl(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(o=>({name:`${n}:@sentry/${o}`,version:Gt})),version:Gt}),t._metadata=i}var Gy=100;function Er(t,e){let r=Fe(),n=fn();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Gy}=r.getOptions();if(o<=0)return;let s=vr(),a=w({timestamp:s},t),c=i?si(()=>i(a,e)):a;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,e),n.addBreadcrumb(c,o))}var _m,Vy="FunctionToString",Em=new WeakMap,Yy=()=>({name:Vy,setupOnce(){_m=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=ln(this),r=Em.has(Fe())&&e!==void 0?e:this;return _m.apply(r,t)}}catch{}},setup(t){Em.set(t,!0)}}),Ps=Yy;var zy=[/^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"],qy="InboundFilters",Ky=(t={})=>({name:qy,processEvent(e,r,n){let i=n.getOptions(),o=Jy(t,i);return Xy(e,o)?null:e}}),Bs=Ky;function Jy(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:zy],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function Xy(t,e){return e.ignoreInternal&&nv(t)?(De&&K.warn(`Event dropped due to being internal Sentry Error.
|
|
27
|
+
Event: ${nr(t)}`),!0):Qy(t,e.ignoreErrors)?(De&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
28
|
+
Event: ${nr(t)}`),!0):ov(t)?(De&&K.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
29
|
+
Event: ${nr(t)}`),!0):Zy(t,e.ignoreTransactions)?(De&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
30
|
+
Event: ${nr(t)}`),!0):ev(t,e.denyUrls)?(De&&K.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
31
|
+
Event: ${nr(t)}.
|
|
32
|
+
Url: ${Ls(t)}`),!0):tv(t,e.allowUrls)?!1:(De&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
33
|
+
Event: ${nr(t)}.
|
|
34
|
+
Url: ${Ls(t)}`),!0)}function Qy(t,e){return t.type||!e||!e.length?!1:rv(t).some(r=>ni(r,e))}function Zy(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let r=t.transaction;return r?ni(r,e):!1}function ev(t,e){if(!e||!e.length)return!1;let r=Ls(t);return r?ni(r,e):!1}function tv(t,e){if(!e||!e.length)return!0;let r=Ls(t);return r?ni(r,e):!0}function rv(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 nv(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function iv(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 Ls(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?iv(e):null}catch{return De&&K.error(`Cannot extract url for event ${nr(t)}`),null}}function ov(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 sv="Dedupe",av=()=>{let t;return{name:sv,processEvent(e){if(e.type)return e;try{if(cv(e,t))return De&&K.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Us=av;function cv(t,e){return e?!!(lv(t,e)||uv(t,e)):!1}function lv(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!bm(t,e)||!wm(t,e))}function uv(t,e){let r=Sm(e),n=Sm(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!bm(t,e)||!wm(t,e))}function wm(t,e){let r=ds(t),n=ds(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 o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function bm(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 Sm(t){return t.exception&&t.exception.values&&t.exception.values[0]}var Ye=re,Xl=0;function Ql(){return Xl>0}function bv(){Xl++,setTimeout(()=>{Xl--})}function dn(t,e={},r){if(typeof t!="function")return t;try{let i=t.__sentry_wrapped__;if(i)return i;if(ln(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 o=i.map(s=>dn(s,e));return t.apply(this,o)}catch(o){throw bv(),Ds(s=>{s.addEventProcessor(a=>(e.mechanism&&(ai(a,void 0,void 0),Nr(a,e.mechanism)),a.extra=ee(w({},a.extra),{arguments:i}),a)),Ns(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ps(n,t),Et(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}var Pr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function ks(t,e){let r=tu(t,e),n={type:e&&e.name,value:Dv(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Iv(t,e,r,n){let i=Fe(),o=i&&i.getOptions().normalizeDepth,s=Nv(e),a={__serialized__:Es(e,o)};if(s)return{exception:{values:[ks(t,s)]},extra:a};let c={exception:{values:[{type:cn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Rv(e,{isUnhandledRejection:n})}]},extra:a};if(r){let m=tu(t,r);m.length&&(c.exception.values[0].stacktrace={frames:m})}return c}function Zl(t,e){return{exception:{values:[ks(t,e)]}}}function tu(t,e){let r=e.stacktrace||e.stack||"",n=Cv(e),i=xv(e);try{return t(r,n,i)}catch{}return[]}var Tv=/Minified React error #\d+;/i;function Cv(t){return t&&Tv.test(t.message)?1:0}function xv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Dv(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function xm(t,e,r,n){let i=r&&r.syntheticException||void 0,o=Ms(t,e,i,n);return Nr(o),o.level="error",r&&r.event_id&&(o.event_id=r.event_id),Yt(o)}function Dm(t,e,r="info",n,i){let o=n&&n.syntheticException||void 0,s=eu(t,e,o,i);return s.level=r,n&&n.event_id&&(s.event_id=n.event_id),Yt(s)}function Ms(t,e,r,n,i){let o;if(as(e)&&e.error)return Zl(t,e.error);if(cs(e)||tl(e)){let s=e;if("stack"in e)o=Zl(t,e);else{let a=s.name||(cs(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=eu(t,c,r,n),ai(o,c)}return"code"in s&&(o.tags=ee(w({},o.tags),{"DOMException.code":`${s.code}`})),o}return sn(e)?Zl(t,e):rr(e)||cn(e)?(o=Iv(t,e,r,i),Nr(o,{synthetic:!0}),o):(o=eu(t,e,r,n),ai(o,`${e}`,void 0),Nr(o,{synthetic:!0}),o)}function eu(t,e,r,n){let i={};if(n&&r){let o=tu(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]})}if(ri(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function Rv(t,{isUnhandledRejection:e}){let r=fl(t),n=e?"promise rejection":"exception";return as(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:cn(t)?`Event \`${Av(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Av(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Nv(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}function Rm(t,{metadata:e,tunnel:r,dsn:n}){let i=w(w({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:gr(n)}),o=Ov(t);return _r(i,[o])}function Ov(t){return[{type:"user_report"},t]}var fo=class extends po{constructor(e){let r=w({parentSpanIsAlwaysRootSpan:!0},e),n=Ye.SENTRY_SDK_SOURCE||wl();Jl(r,"browser",["browser"],n),super(r),r.sendClientReports&&Ye.document&&Ye.document.addEventListener("visibilitychange",()=>{Ye.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,r){return xm(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return Dm(this._options.stackParser,e,r,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){Pr&&K.warn("SDK not enabled, will not capture user feedback.");return}let r=Rm(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(r)}_prepareEvent(e,r,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n)}_flushOutcomes(){let e=this._clearOutcomes();if(e.length===0){Pr&&K.log("No outcomes to send");return}if(!this._dsn){Pr&&K.log("No dsn provided, will not send outcomes");return}Pr&&K.log("Sending outcomes:",e);let r=Ol(e,this._options.tunnel&&gr(this._dsn));this.sendEnvelope(r)}};var Am=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Ke=re;var Pv=1e3,Nm,ru,nu;function iu(t){let e="dom";St(e,t),wt(e,Lv)}function Lv(){if(!Ke.document)return;let t=Ze.bind(null,"dom"),e=Om(t,!0);Ke.document.addEventListener("click",e,!1),Ke.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let n=Ke[r]&&Ke[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Ue(n,"addEventListener",function(i){return function(o,s,a){if(o==="click"||o=="keypress")try{let c=this,m=c.__sentry_instrumentation_handlers__=c.__sentry_instrumentation_handlers__||{},p=m[o]=m[o]||{refCount:0};if(!p.handler){let f=Om(t);p.handler=f,i.call(this,o,f,a)}p.refCount++}catch{}return i.call(this,o,s,a)}}),Ue(n,"removeEventListener",function(i){return function(o,s,a){if(o==="click"||o=="keypress")try{let c=this,m=c.__sentry_instrumentation_handlers__||{},p=m[o];p&&(p.refCount--,p.refCount<=0&&(i.call(this,o,p.handler,a),p.handler=void 0,delete m[o]),Object.keys(m).length===0&&delete c.__sentry_instrumentation_handlers__)}catch{}return i.call(this,o,s,a)}}))})}function Bv(t){if(t.type!==ru)return!1;try{if(!t.target||t.target._sentryId!==nu)return!1}catch{}return!0}function Uv(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Om(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=kv(r);if(Uv(r.type,n))return;Et(r,"_sentryCaptured",!0),n&&!n._sentryId&&Et(n,"_sentryId",rt());let i=r.type==="keypress"?"input":r.type;Bv(r)||(t({event:r,name:i,global:e}),ru=r.type,nu=n?n._sentryId:void 0),clearTimeout(Nm),Nm=Ke.setTimeout(()=>{nu=void 0,ru=void 0},Pv)}}function kv(t){try{return t.target}catch{return null}}var Fs;function ou(t){let e="history";St(e,t),wt(e,Mv)}function Mv(){if(!Bl())return;let t=Ke.onpopstate;Ke.onpopstate=function(...r){let n=Ke.location.href,i=Fs;if(Fs=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 o=Fs,s=String(i);Fs=s,Ze("history",{from:o,to:s})}return r.apply(this,n)}}Ue(Ke.history,"pushState",e),Ue(Ke.history,"replaceState",e)}var Hs={};function su(t){let e=Hs[t];if(e)return e;let r=Ke[t];if(no(r))return Hs[t]=r.bind(Ke);let n=Ke.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o&&o[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){Am&&K.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Hs[t]=r.bind(Ke))}function $s(t){Hs[t]=void 0}var hn="__sentry_xhr_v3__";function au(t){let e="xhr";St(e,t),wt(e,Fv)}function Fv(){if(!Ke.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;Ue(t,"open",function(e){return function(...r){let n=Bt()*1e3,i=_t(r[0])?r[0].toUpperCase():void 0,o=Hv(r[1]);if(!i||!o)return e.apply(this,r);this[hn]={method:i,url:o,request_headers:{}},i==="POST"&&o.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let s=()=>{let a=this[hn];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}let c={endTimestamp:Bt()*1e3,startTimestamp:n,xhr:this};Ze("xhr",c)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?Ue(this,"onreadystatechange",function(a){return function(...c){return s(),a.apply(this,c)}}):this.addEventListener("readystatechange",s),Ue(this,"setRequestHeader",function(a){return function(...c){let[m,p]=c,f=this[hn];return f&&_t(m)&&_t(p)&&(f.request_headers[m.toLowerCase()]=p),a.apply(this,c)}}),e.apply(this,r)}}),Ue(t,"send",function(e){return function(...r){let n=this[hn];if(!n)return e.apply(this,r);r[0]!==void 0&&(n.body=r[0]);let i={startTimestamp:Bt()*1e3,xhr:this};return Ze("xhr",i),e.apply(this,r)}})}function Hv(t){if(_t(t))return t;try{return t.toString()}catch{}}function cu(t,e=su("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=w({body:o.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return $s("fetch"),Vr("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return $s("fetch"),r-=s,n--,Vr(c)}}return Os(t,i)}var $v=30;var jv=50;function lu(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?yr:e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var Wv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Gv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Vv=/\((\S*)(?::(\d+))(?::(\d+))\)/,Yv=t=>{let e=Wv.exec(t);if(e){let[,n,i,o]=e;return lu(n,yr,+i,+o)}let r=Gv.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=Vv.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=Um(r[1]||yr,r[2]);return lu(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Pm=[$v,Yv],zv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Kv=t=>{let e=zv.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=qv.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||yr;return[i,n]=Um(i,n),lu(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Lm=[jv,Kv];var Bm=[Pm,Lm],uu=dl(...Bm),Um=(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]:yr,r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var js=1024,Xv="Breadcrumbs",Qv=(t={})=>{let e=w({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:Xv,setup(r){e.console&&hl(t_(r)),e.dom&&iu(e_(r,e.dom)),e.xhr&&au(r_(r)),e.fetch&&_l(n_(r)),e.history&&ou(i_(r)),e.sentry&&r.on("beforeSendEvent",Zv(r))}}},km=Qv;function Zv(t){return function(r){Fe()===t&&Er({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:nr(r)},{event:r})}}function e_(t,e){return function(n){if(Fe()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>js&&(Pr&&K.warn(`\`dom.maxStringLength\` cannot exceed ${js}, but a value of ${a} was configured. Sentry will use ${js} instead.`),a=js),typeof s=="string"&&(s=[s]);try{let m=n.event,p=o_(m)?m.target:m;i=to(p,{keyAttrs:s,maxStringLength:a}),o=ll(p)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),Er(c,{event:n.event,name:n.name,global:n.global})}}function t_(t){return function(r){if(Fe()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:Tl(r.level),message:ls(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${ls(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Er(n,{input:r.args,level:r.level})}}function r_(t){return function(r){if(Fe()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[hn];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:m}=o,p={method:s,url:a,status_code:c},f={xhr:r.xhr,input:m,startTimestamp:n,endTimestamp:i};Er({category:"xhr",data:p,type:"http"},f)}}function n_(t){return function(r){if(Fe()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i};Er({category:"fetch",data:o,level:"error",type:"http"},s)}else{let o=r.response,s=ee(w({},r.fetchData),{status_code:o&&o.status}),a={input:r.args,response:o,startTimestamp:n,endTimestamp:i};Er({category:"fetch",data:s,type:"http"},a)}}}function i_(t){return function(r){if(Fe()!==t)return;let n=r.from,i=r.to,o=oo(Ye.location.href),s=n?oo(n):void 0,a=oo(i);(!s||!s.path)&&(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),Er({category:"navigation",data:{from:n,to:i}})}}function o_(t){return!!t&&!!t.target}var s_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],a_="BrowserApiErrors",c_=(t={})=>{let e=w({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t);return{name:a_,setupOnce(){e.setTimeout&&Ue(Ye,"setTimeout",Mm),e.setInterval&&Ue(Ye,"setInterval",Mm),e.requestAnimationFrame&&Ue(Ye,"requestAnimationFrame",l_),e.XMLHttpRequest&&"XMLHttpRequest"in Ye&&Ue(XMLHttpRequest.prototype,"send",u_);let r=e.eventTarget;r&&(Array.isArray(r)?r:s_).forEach(p_)}}},Fm=c_;function Mm(t){return function(...e){let r=e[0];return e[0]=dn(r,{mechanism:{data:{function:Vt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function l_(t){return function(e){return t.apply(this,[dn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Vt(t)},handled:!1,type:"instrument"}})])}}function u_(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&Ue(r,i,function(o){let s={mechanism:{data:{function:i,handler:Vt(o)},handled:!1,type:"instrument"}},a=ln(o);return a&&(s.mechanism.data.handler=Vt(a)),dn(o,s)})}),t.apply(this,e)}}function p_(t){let e=Ye,r=e[t]&&e[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(Ue(r,"addEventListener",function(n){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=dn(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Vt(o),target:t},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,dn(o,{mechanism:{data:{function:"addEventListener",handler:Vt(o),target:t},handled:!1,type:"instrument"}}),s])}}),Ue(r,"removeEventListener",function(n){return function(i,o,s){let a=o;try{let c=a&&a.__sentry_wrapped__;c&&n.call(this,i,c,s)}catch{}return n.call(this,i,a,s)}}))}var f_="GlobalHandlers",m_=(t={})=>{let e=w({onerror:!0,onunhandledrejection:!0},t);return{name:f_,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(d_(r),Hm("onerror")),e.onunhandledrejection&&(h_(r),Hm("onunhandledrejection"))}}},$m=m_;function d_(t){El(e=>{let{stackParser:r,attachStacktrace:n}=jm();if(Fe()!==t||Ql())return;let{msg:i,url:o,line:s,column:a,error:c}=e,m=v_(Ms(r,c||i,void 0,n,!1),o,s,a);m.level="error",uo(m,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function h_(t){Sl(e=>{let{stackParser:r,attachStacktrace:n}=jm();if(Fe()!==t||Ql())return;let i=g_(e),o=an(i)?y_(i):Ms(r,i,void 0,n,!0);o.level="error",uo(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function g_(t){if(an(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 y_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function v_(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],m=isNaN(parseInt(n,10))?void 0:n,p=isNaN(parseInt(r,10))?void 0:r,f=_t(e)&&e.length>0?e:cl();return c.length===0&&c.push({colno:m,filename:f,function:yr,in_app:!0,lineno:p}),t}function Hm(t){Pr&&K.log(`Global Handler attached: ${t}`)}function jm(){let t=Fe();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Wm=()=>({name:"HttpContext",preprocessEvent(t){if(!Ye.navigator&&!Ye.location&&!Ye.document)return;let e=t.request&&t.request.url||Ye.location&&Ye.location.href,{referrer:r}=Ye.document||{},{userAgent:n}=Ye.navigator||{},i=w(w(w({},t.request&&t.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),o=ee(w(w({},t.request),e&&{url:e}),{headers:i});t.request=o}});var __="cause",E_=5,S_="LinkedErrors",w_=(t={})=>{let e=t.limit||E_,r=t.key||__;return{name:S_,preprocessEvent(n,i,o){let s=o.getOptions();sl(ks,s.stackParser,s.maxValueLength,r,e,n,i)}}},Gm=w_;function pu(t){return[Bs(),Ps(),Fm(),km(),$m(),Gm(),Us(),Wm()]}var fu=class extends Error{cause;constructor(e,r){super(e),this.cause=r}},Be=class t{static INSTANCE;contexts={};tags;client;user;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}captureException(e,r,n){b.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){b.error(e,r);let o=this.getNewScope(n,i),s=new fu(e,r);o.captureException(s)}setGlobalContext(e,r){this.contexts[e]=w({context:r},this.contexts[e])}setUser(e){this.user=e}setTags(e){this.tags=e}getNewScope(e,r){let n=new ft;if(n.setClient(this.client),n.setUser(this.user),e?.triggerContext){let i=e.triggerContext;n.setExtras(i.triggerData.sentryContext()),delete e.triggerContext}return e&&n.setExtras(e),this.tags&&n.setTags(this.tags),r&&n.setTags(r),Object.keys(this.contexts).forEach(i=>{n.setContext(i,this.contexts[i])}),n.setTag("language",navigator.language),n.setTag("timezone",te.getTimezone()),n}init(){let e=pu({}).filter(r=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(r.name));this.client=new fo({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:cu,stackParser:uu,integrations:e,environment:Ct.mode,release:`web-sdk@${N.SDK_VERSION}`,debug:Ct.debug}),this.client.init()}};var te=class{static tz;static isValidURL(e){try{return new URL(e)}catch{return}}static isNull(e){return!e||e==="null"||e==="undefined"}static removeFromArray(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static formatCurrency(e,r){if(e==0&&r)return"Free";let n=le.get(),i=Le.get(),o=n.shopCurrencyCode||i.currency,s=n.currencyCode;s||b.warn("Currency code is not set in RuntimeData");let a=i.money?.format??n.moneyFormat,c;if(a&&o===s)c=os.format(e*100,a);else{let m;try{m=new Intl.NumberFormat(this.getLang(),{style:"currency",currency:s||o,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return Be.getInstance().captureException(p,{currentCurrency:s,shopCurrency:o}),""}c=m.format(e),c=c.replace("\u20B9","Rs. "),i.money?.showCurrency&&s!=="INR"&&(c=c.concat(` ${s}`))}return c}static formatNumber(e){return new Intl.NumberFormat(this.getLang(),{notation:"compact"}).format(e)}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(e){document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e)}static onDocumentLoaded(e){document.readyState==="complete"?e():document.addEventListener("readystatechange",()=>{document.readyState==="complete"&&e()})}static showSnackbar(e){let r=document.createElement("span");r.id="snackbar",r.innerText=e,document.body.appendChild(r),r.className="show",setTimeout(()=>{r.classList.remove("show"),document.body.removeChild(r)},3e3)}static async retrySelectorForElements(e,r=10,n=document){let i=0,o=document.querySelectorAll("nonexistent-tag");for(;i<r;){let s=Math.min(100*2**i,5e3);if(await Vm.JSUtils.sleep(s),o=n.querySelectorAll(e),o.length)return b.debug(`Attempt ${i+1}: ${o.length} elements found with ${e}`),o;b.debug(`Attempt ${i+1}: Elements not found with ${e}. Retrying after ${s}ms.`),i++}return b.warn(`Max attempts reached. Element not found with ${e}.`),o}static async retrySelector(e,r=10,n=document){return(await this.retrySelectorForElements(e,r,n)).item(0)}static async getCartAttributes(){let e=await Oe.get(oe.DEVICE_ID),r=await tt.get(oe.ID,"");return[{key:"letscooee_did",value:e},{key:"letscooee_sid",value:r},{key:"__letscooee_time",value:new Date().toLocaleString()},{key:"__letscooee_via",value:"Buy Now"}]}static onNodesRemoved(e,r,n=document.body){let i=new MutationObserver(o=>{o.forEach(s=>{s.removedNodes.forEach(a=>{(a===e||a.contains(e))&&(r(),i.disconnect())})})});i.observe(n,{childList:!0})}};function li(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:r})}var Ws=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var Gs=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var mu=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},Sr=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new Ws(r))??[],this.link=e.link,this.price=new Gs(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.effectivePrice=jt(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=jt(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new mu(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}};var Dt=class{id;mID;name;status;ctg;imgs;videos;portraitVideos;vars;desc;sDesc;link;slug;quantity;category;meta;reviews;selectedOrFirstVariant;selected=jt(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=jt(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(e=>e.isAvailable)??this.vars[0]}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}update(e){return this.id=e.id,this.mID=e.mID,this.name=e.name,this.status=e.status,this.ctg=e.ctg,this.imgs=e.imgs,this.desc=e.desc,this.sDesc=e.sDesc,this.link=e.link,this.slug=e.slug,this.quantity=e.quantity,this.meta=e.meta,this.category=e.category,this.videos=e.videos,this.reviews=e.reviews,this.portraitVideos=e.videos?.filter(r=>r.orientation==="PORTRAIT"),e.vars&&(this.vars=e.vars.map(r=>new Sr(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new xt({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}};var Vs=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var du=class{enabled;constructor(e){this.enabled=e.enabled}},hu=class extends du{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},Ys=class{productQuantity;constructor(e){e??={},this.productQuantity=new hu(e.productQuantity)}};var gn=class{s;g;i;constructor(e){e.s&&(this.s=new He(e.s)),e.g&&(this.g=new mo(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var ho="a-f\\d",b_=`#?[${ho}]{3}[${ho}]?`,I_=`#?[${ho}]{6}([${ho}]{2})?`,T_=new RegExp(`[^#${ho}]`,"gi"),C_=new RegExp(`^${b_}$|^${I_}$`,"i");function gu(t,e={}){if(typeof t!="string"||T_.test(t)||!C_.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,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var He=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return gu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var yn=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new He(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Ym[this.s??1]}},Ym=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(Ym||{});var mo=class t{static DEFAULT_FALLBACK=new He({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new He(e.c)),e.fb&&(this.fb=new He(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var go=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new He(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Lr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.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`}};var vn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var Ut=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new gn(e.bg)),e.br&&(this.br=new yn(e.br)),e.shd&&(this.shd=new go(e.shd)),e.spc&&(this.spc=new Lr(e.spc)),this.trf=new vn(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return ke[this.t]}get click(){return this.clc}},ke=(P=>(P[P.IMAGE=1]="IMAGE",P[P.TEXT=2]="TEXT",P[P.BUTTON=3]="BUTTON",P[P.FLEXBOX=4]="FLEXBOX",P[P.MULTI_COLUMN=5]="MULTI_COLUMN",P[P.CHECKBOX=6]="CHECKBOX",P[P.PRODUCTS=11]="PRODUCTS",P[P.PRODUCT=12]="PRODUCT",P[P.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",P[P.PRODUCT_TITLE=14]="PRODUCT_TITLE",P[P.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",P[P.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",P[P.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",P[P.PRODUCT_RATING=19]="PRODUCT_RATING",P[P.EMAIL_INPUT=51]="EMAIL_INPUT",P[P.PHONE_INPUT=52]="PHONE_INPUT",P[P.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",P[P.CAROUSEL=62]="CAROUSEL",P[P.SHAPE=100]="SHAPE",P))(ke||{});var _n=class extends Ut{constructor(e){super(e)}};var Br=class extends Ut{src;constructor(e){super(e),this.src=e.src}};var ui=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(ui||{});var zs=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new yu(r))}},yu=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.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')`}};var ct=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return ui[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new He(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new He(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new zs(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var wr=class extends Ut{typo;constructor(e){super(e);let r=w(w({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new ct(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Yr=class extends wr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var qs=class extends Ut{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var pi=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),m=Math.floor(s%(1e3*60*60)/(1e3*60)),p=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:m,seconds:p})},1e3);return i}};var fi=class extends wr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new pi(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Ks=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new He(e.c??{})}get text(){return this.txt}get color(){return this.c}};var zr=class extends wr{ph;constructor(e){super(e),this.ph=new Ks(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var mi=class extends zr{constructor(e){e??={},super(e)}};var di=class extends zr{};var hi=class extends zr{};var gi=class extends Br{};var En=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(En||{});var Js=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.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[]}}};var yo=class extends Ut{gvt;max;cover;anim;embedded;position;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new Js(e.anim),this.embedded=e.embedded,this.position=e.position??1,this.spc||(this.spc=new Lr({pl:N.IN_APP_DEFAULT_PADDING,pr:N.IN_APP_DEFAULT_PADDING,pt:N.IN_APP_DEFAULT_PADDING,pb:N.IN_APP_DEFAULT_PADDING}))}isEmbedded(){return this.position===2&&!!this.embedded}getEmbeddedSelector(){return`.letscooee-engagement.container-${this.embedded}`}};var Xs=class extends yo{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new qs(e.cont),this.mob=new yo(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new Br(r)):r.t===2?this.elems.push(new Yr(r)):r.t===3?this.elems.push(new Yr(r)):r.t===100?this.elems.push(new _n(r)):r.t===51?this.elems.push(new di(r)):r.t===52?this.elems.push(new hi(r)):r.t===61?this.elems.push(new fi(r)):r.t===15||r.t===16?this.elems.push(new mi(r)):r.t===13&&this.elems.push(new gi(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}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}};var yi=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var Qs=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var Zs=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var ea=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Lr(e.spc),e.size&&(this.size=new Zs(e.size)),e.bg&&(this.bg=new gn(e.bg)),e.br&&(this.br=new yn(e.br)),e.typo&&(this.typo=new ct(e.typo)),e.lout&&(this.lout=new Qs(e.lout)),e.flex&&(this.flex=new yi(e.flex))}},vi=class{sm;lg;constructor(e){e??={},this.sm=new ea(e.sm),this.lg=new ea(e.lg)}};var nt=class{t;style;hide;when;clc;constructor(e,r){r??={},this.t=e,this.style=new vi(r.style),this.hide=r.hide,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return ke[this.t]}};var it=class extends nt{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var Sn=class extends it{constructor(e,r){super(e,r??3)}};var _i=class extends nt{value;constructor(e){super(6,e),e??={},this.value=e.value}};var Ei=class extends it{constructor(e=15,r){super(r,e)}};var ta=class extends nt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new He(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var zm=Se(nn());var vu=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new He(e.color)}},_u=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new He(e.color)}},vo=class{navigation;pagination;autoplay;maxInRow;gap;slidesPerView;constructor(e){e??={},this.navigation=new _u(e.navigation),this.pagination=new vu(e.pagination),this.autoplay=e.autoplay,this.slidesPerView=e.slidesPerView??1,this.maxInRow=e.maxInRow??e.slidesPerView??4,this.gap=e.gap??0}},ra=class extends nt{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=kt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new vo(e.conf),this.allowedTypes=e.allowedTypes}};var na=class extends it{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new pi(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var qr=class extends nt{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=kt.getParsedElement(r);n&&this.elems.push(n)})}};var wn=class extends nt{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var kt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new it(e);case 3:return new Sn(e);case 6:return new _i(e);case 11:return new ia(e);case 12:return new Kr(e);case 61:return new na(e);case 4:return new qr(e);case 1:return new wn(e);case 13:return new wn(e,13);case 14:return new it(e,14);case 15:case 16:return new Ei(e.t,e);case 18:return new Sn(e,18);case 62:return new ra(e);case 19:return new ta(e);default:zm.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"}}};var Kr=class extends nt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=kt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new _i(e.cBox)),this.elems.push(new wn(e.img,13));let r=new it(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new it(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new it(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new vi(n.style),i.style.lg.typo=new ct(ee(w({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new ct(ee(w({},i.style.sm.typo),{td:"line-through"})));let o=new qr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:kt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new Ei(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new Sn(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new it(e.symbol))}};var ia=class extends nt{conf;prod;constructor(e){super(11,e),e??={},this.conf=new Eu(e.conf),this.prod=new Kr(e.prod)}};var oa=class extends vo{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},Eu=class{lg;sm;constructor(e){e??={},this.lg=new oa(e.lg),this.sm=new oa(e.sm)}};var sa=class extends qr{constructor(e){super(e)}};var Si=class{cont;elems=[];constructor(e){e=e??{},this.cont=new sa(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=kt.getParsedElement(e);return r&&this.elems.push(r),r}};var qm=Se(Rr()),Su=class{minValue;rewardType;label;reachingText;reachedText;discount;items;calculatedAlignment;constructor(e){this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new xt(r))}},aa=class{layout;milestones;constructor(e){this.layout=e.layout??qm.ProgressBarLayout.ICONS,this.milestones=e.milestones?.map(r=>new Su(r))??[]}};var ca=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var bu=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===bt.EngagementContentType.EXCLUSION}isABTesting(){return this.contentType===bt.EngagementContentType.ABTESTING}isSingleContent(){return this.contentType===bt.EngagementContentType.SINGLE}},Mt=class t extends bu{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=jt({});constructor(e){super(e),this.id=e.id,this.nudgeID=e.nudgeID,this.currency=le.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Si(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.embeddedItems=e.embeddedItems?.map(r=>new xt(r)),this.items=e.items?.map(r=>new Dt(r))??[],this.nonMutableItems=e.items?.map(r=>new Dt(r))??[],this.collections=e.collections?.map(r=>new Vs(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 Ys(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,e.progressBarConfig&&(this.progressBarConfig=new aa(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new ca(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Dt(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===bt.EngagementObjective.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===bt.OnsiteDeliveryType.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===bt.OnsiteDeliveryType.PAGE_EMBED}isProgressBar(){return this.objective===bt.EngagementObjective.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===bt.EngagementObjective.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===bt.EngagementObjective.CART_RECOVERY}isProductPromotion(){return this.objective===bt.EngagementObjective.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isBYOB(){return this.objective===bt.EngagementObjective.BYOB}isShoppableVideo(){return this.objective===bt.EngagementObjective.SHOPPABLE_VIDEO}processPopup(e){let r=JSON.stringify(e),n=this.items[0],i={},o={};if(n){let c=n.selectedOrFirstVariant.value;i={name:n.name,id:n.mID,link:n.link,vID:c.mID,image:n.variantImage,price:te.formatCurrency(c.price.d),comparePrice:te.formatCurrency(c.price.cmp),quantity:n.quantity},o={quantity:c.quantity}}let s={productCount:de.getCurrent().item_count},a=vt.render(r,{product:i,variant:o,cart:s,discount:this.discount,customer:this.customerData});return n&&(a=a.replace(new RegExp(N.PLACEHOLDER_IMAGE,"gi"),n.variantImage??n.imageURL)),new Xs(JSON.parse(a))}calculateDiscountData(e,r){let n=wu.ArrayUtils.sum(e,o=>o.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(Jr.DiscountType.BXGY===this.discount.type&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,i.discountPercentage,!0),i.discountAmount=i.actualPrice-wu.ArrayUtils.sum(e,o=>o.selectedOrFirstVariant.value.effectivePrice.value);else if([Jr.DiscountType.UNIQUE_FLAT_ITEMS,Jr.DiscountType.STATIC].includes(this.discount.type)&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100,this.updateEffectivePrice(e,i.discountPercentage);else if(this.discount.type===Jr.DiscountType.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)i.discountAmount=i.actualPrice-this.discount.values[0],i.discountPercentage=i.discountAmount/i.actualPrice*100,this.updateEffectivePrice(e,i.discountPercentage);else if(this.discount.type===Jr.DiscountType.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((s,a)=>a.selectedOrFirstVariant.value.price.d-s.selectedOrFirstVariant.value.price.d);let o=e[e.length-1];o.selectedOrFirstVariant.value.effectivePrice.value=0,i.discountAmount=o.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 Le.get().skipItemAttribute?{}:{[N.VIA]:"Cooee",[N.CAMPAIGN_ATTRIBUTE]:this.shortID,[N.CONTENT_ATTRIBUTE]:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Le.get().skipItemAttribute?[]:[{key:N.VIA,value:"Cooee"},{key:N.CAMPAIGN_ATTRIBUTE,value:this.shortID},{key:N.CONTENT_ATTRIBUTE,value:this.contentID}]}isBundleDiscount(){return[Jr.DiscountType.UNIQUE_FIXED_ITEMS,Jr.DiscountType.UNIQUE_FLAT_ITEMS].includes(this.discount.type)}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){let e=this.widget?.elems.find(n=>t.SWIPER_ELEMENTS.has(n.t));if(!e)return!1;if(e.t===62)return!0;let r=Lt.get().isMobile()?"sm":"lg";return e.conf[r].disp===2}toString(){return`Engagement(id=${this.shortID})`}getCartMagicVariables(){let e=de.getCurrent();return{productCount:e.item_count,amount:te.formatCurrency(e.total_price/100),originalAmount:te.formatCurrency(e.original_total_price/100)}}updateEffectivePrice(e,r,n=!1){let i=le.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:te.formatNumber(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice"].map(n=>{r[n]=te.formatCurrency(e[n])}),r}};function D_(t,e){return e={exports:{}},t(e,e.exports),e.exports}var R_=P_,A_=B_,N_=M_,Ir=[],qt=[],O_=typeof Uint8Array<"u"?Uint8Array:Array,Iu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(bn=0,Km=Iu.length;bn<Km;++bn)Ir[bn]=Iu[bn],qt[Iu.charCodeAt(bn)]=bn;var bn,Km;qt[45]=62;qt[95]=63;function pd(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 P_(t){var e=pd(t),r=e[0],n=e[1];return(r+n)*3/4-n}function L_(t,e,r){return(e+r)*3/4-r}function B_(t){var e,r=pd(t),n=r[0],i=r[1],o=new O_(L_(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=qt[t.charCodeAt(c)]<<18|qt[t.charCodeAt(c+1)]<<12|qt[t.charCodeAt(c+2)]<<6|qt[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=qt[t.charCodeAt(c)]<<2|qt[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=qt[t.charCodeAt(c)]<<10|qt[t.charCodeAt(c+1)]<<4|qt[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function U_(t){return Ir[t>>18&63]+Ir[t>>12&63]+Ir[t>>6&63]+Ir[t&63]}function k_(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(U_(n));return i.join("")}function M_(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(k_(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Ir[e>>2]+Ir[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ir[e>>10]+Ir[e>>4&63]+Ir[e<<2&63]+"=")),i.join("")}var Tu={byteLength:R_,toByteArray:A_,fromByteArray:N_};var F_=function(e,r,n,i,o){var s,a,c=o*8-i-1,m=(1<<c)-1,p=m>>1,f=-7,d=n?o-1:0,g=n?-1:1,E=e[r+d];for(d+=g,s=E&(1<<-f)-1,E>>=-f,f+=c;f>0;s=s*256+e[r+d],d+=g,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+d],d+=g,f-=8);if(s===0)s=1-p;else{if(s===m)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-p}return(E?-1:1)*a*Math.pow(2,s-i)},H_=function(e,r,n,i,o,s){var a,c,m,p=s*8-o-1,f=(1<<p)-1,d=f>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:s-1,A=i?1:-1,O=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+d>=1?r+=g/m:r+=g*Math.pow(2,1-d),r*m>=2&&(a++,m/=2),a+d>=f?(c=0,a=f):a+d>=1?(c=(r*m-1)*Math.pow(2,o),a=a+d):(c=r*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+E]=c&255,E+=A,c/=256,o-=8);for(a=a<<o|c,p+=o;p>0;e[n+E]=a&255,E+=A,a/=256,p-=8);e[n+E-A]|=O*128},wi={read:F_,write:H_},pa=D_(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=D,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.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 y=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(y,l),y.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(y){if(y>n)throw new RangeError('The value "'+y+'" is invalid for option "size"');var l=new Uint8Array(y);return Object.setPrototypeOf(l,s.prototype),l}function s(y,l,u){if(typeof y=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(y)}return a(y,l,u)}s.poolSize=8192;function a(y,l,u){if(typeof y=="string")return f(y,l);if(ArrayBuffer.isView(y))return g(y);if(y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(y));if(ht(y,ArrayBuffer)||y&&ht(y.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ht(y,SharedArrayBuffer)||y&&ht(y.buffer,SharedArrayBuffer)))return E(y,l,u);if(typeof y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var _=y.valueOf&&y.valueOf();if(_!=null&&_!==y)return s.from(_,l,u);var x=A(y);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof y[Symbol.toPrimitive]=="function")return s.from(y[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(y))}s.from=function(y,l,u){return a(y,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(y){if(typeof y!="number")throw new TypeError('"size" argument must be of type number');if(y<0)throw new RangeError('The value "'+y+'" is invalid for option "size"')}function m(y,l,u){return c(y),y<=0?o(y):l!==void 0?typeof u=="string"?o(y).fill(l,u):o(y).fill(l):o(y)}s.alloc=function(y,l,u){return m(y,l,u)};function p(y){return c(y),o(y<0?0:O(y)|0)}s.allocUnsafe=function(y){return p(y)},s.allocUnsafeSlow=function(y){return p(y)};function f(y,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=R(y,l)|0,_=o(u),x=_.write(y,l);return x!==u&&(_=_.slice(0,x)),_}function d(y){for(var l=y.length<0?0:O(y.length)|0,u=o(l),_=0;_<l;_+=1)u[_]=y[_]&255;return u}function g(y){if(ht(y,Uint8Array)){var l=new Uint8Array(y);return E(l.buffer,l.byteOffset,l.byteLength)}return d(y)}function E(y,l,u){if(l<0||y.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(y.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var _;return l===void 0&&u===void 0?_=new Uint8Array(y):u===void 0?_=new Uint8Array(y,l):_=new Uint8Array(y,l,u),Object.setPrototypeOf(_,s.prototype),_}function A(y){if(s.isBuffer(y)){var l=O(y.length)|0,u=o(l);return u.length===0||y.copy(u,0,0,l),u}if(y.length!==void 0)return typeof y.length!="number"||Ht(y.length)?o(0):d(y);if(y.type==="Buffer"&&Array.isArray(y.data))return d(y.data)}function O(y){if(y>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return y|0}function D(y){return+y!=y&&(y=0),s.alloc(+y)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(ht(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),ht(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var _=l.length,x=u.length,U=0,B=Math.min(_,x);U<B;++U)if(l[U]!==u[U]){_=l[U],x=u[U];break}return _<x?-1:x<_?1:0},s.isEncoding=function(l){switch(String(l).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}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var _;if(u===void 0)for(u=0,_=0;_<l.length;++_)u+=l[_].length;var x=s.allocUnsafe(u),U=0;for(_=0;_<l.length;++_){var B=l[_];if(ht(B,Uint8Array))U+B.length>x.length?s.from(B).copy(x,U):Uint8Array.prototype.set.call(x,B,U);else if(s.isBuffer(B))B.copy(x,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=B.length}return x};function R(y,l){if(s.isBuffer(y))return y.length;if(ArrayBuffer.isView(y)||ht(y,ArrayBuffer))return y.byteLength;if(typeof y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(y));var u=y.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&u===0)return 0;for(var x=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return $r(y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return $n(y).length;default:if(x)return _?-1:$r(y).length;l=(""+l).toLowerCase(),x=!0}}s.byteLength=R;function P(y,l,u){var _=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(y||(y="utf8");;)switch(y){case"hex":return $e(this,l,u);case"utf8":case"utf-8":return Ge(this,l,u);case"ascii":return Tt(this,l,u);case"latin1":case"binary":return Te(this,l,u);case"base64":return Ie(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,l,u);default:if(_)throw new TypeError("Unknown encoding: "+y);y=(y+"").toLowerCase(),_=!0}}s.prototype._isBuffer=!0;function j(y,l,u){var _=y[l];y[l]=y[u],y[u]=_}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)j(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)j(this,u,u+3),j(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)j(this,u,u+7),j(this,u+1,u+6),j(this,u+2,u+5),j(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?Ge(this,0,l):P.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,_,x,U){if(ht(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),_===void 0&&(_=l?l.length:0),x===void 0&&(x=0),U===void 0&&(U=this.length),u<0||_>l.length||x<0||U>this.length)throw new RangeError("out of range index");if(x>=U&&u>=_)return 0;if(x>=U)return-1;if(u>=_)return 1;if(u>>>=0,_>>>=0,x>>>=0,U>>>=0,this===l)return 0;for(var B=U-x,ie=_-u,he=Math.min(B,ie),V=this.slice(x,U),X=l.slice(u,_),G=0;G<he;++G)if(V[G]!==X[G]){B=V[G],ie=X[G];break}return B<ie?-1:ie<B?1:0};function se(y,l,u,_,x){if(y.length===0)return-1;if(typeof u=="string"?(_=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Ht(u)&&(u=x?0:y.length-1),u<0&&(u=y.length+u),u>=y.length){if(x)return-1;u=y.length-1}else if(u<0)if(x)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,_)),s.isBuffer(l))return l.length===0?-1:M(y,l,u,_,x);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(y,l,u):Uint8Array.prototype.lastIndexOf.call(y,l,u):M(y,[l],u,_,x);throw new TypeError("val must be string, number or Buffer")}function M(y,l,u,_,x){var U=1,B=y.length,ie=l.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(y.length<2||l.length<2)return-1;U=2,B/=2,ie/=2,u/=2}function he(gt,ut){return U===1?gt[ut]:gt.readUInt16BE(ut*U)}var V;if(x){var X=-1;for(V=u;V<B;V++)if(he(y,V)===he(l,X===-1?0:V-X)){if(X===-1&&(X=V),V-X+1===ie)return X*U}else X!==-1&&(V-=V-X),X=-1}else for(u+ie>B&&(u=B-ie),V=u;V>=0;V--){for(var G=!0,ye=0;ye<ie;ye++)if(he(y,V+ye)!==he(l,ye)){G=!1;break}if(G)return V}return-1}s.prototype.includes=function(l,u,_){return this.indexOf(l,u,_)!==-1},s.prototype.indexOf=function(l,u,_){return se(this,l,u,_,!0)},s.prototype.lastIndexOf=function(l,u,_){return se(this,l,u,_,!1)};function Q(y,l,u,_){u=Number(u)||0;var x=y.length-u;_?(_=Number(_),_>x&&(_=x)):_=x;var U=l.length;_>U/2&&(_=U/2);for(var B=0;B<_;++B){var ie=parseInt(l.substr(B*2,2),16);if(Ht(ie))return B;y[u+B]=ie}return B}function Y(y,l,u,_){return tr($r(l,y.length-u),y,u,_)}function ae(y,l,u,_){return tr(Fn(l),y,u,_)}function Re(y,l,u,_){return tr($n(l),y,u,_)}function ge(y,l,u,_){return tr(Hn(l,y.length-u),y,u,_)}s.prototype.write=function(l,u,_,x){if(u===void 0)x="utf8",_=this.length,u=0;else if(_===void 0&&typeof u=="string")x=u,_=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(_)?(_=_>>>0,x===void 0&&(x="utf8")):(x=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var U=this.length-u;if((_===void 0||_>U)&&(_=U),l.length>0&&(_<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var B=!1;;)switch(x){case"hex":return Q(this,l,u,_);case"utf8":case"utf-8":return Y(this,l,u,_);case"ascii":case"latin1":case"binary":return ae(this,l,u,_);case"base64":return Re(this,l,u,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ge(this,l,u,_);default:if(B)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),B=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ie(y,l,u){return l===0&&u===y.length?Tu.fromByteArray(y):Tu.fromByteArray(y.slice(l,u))}function Ge(y,l,u){u=Math.min(y.length,u);for(var _=[],x=l;x<u;){var U=y[x],B=null,ie=U>239?4:U>223?3:U>191?2:1;if(x+ie<=u){var he,V,X,G;switch(ie){case 1:U<128&&(B=U);break;case 2:he=y[x+1],(he&192)===128&&(G=(U&31)<<6|he&63,G>127&&(B=G));break;case 3:he=y[x+1],V=y[x+2],(he&192)===128&&(V&192)===128&&(G=(U&15)<<12|(he&63)<<6|V&63,G>2047&&(G<55296||G>57343)&&(B=G));break;case 4:he=y[x+1],V=y[x+2],X=y[x+3],(he&192)===128&&(V&192)===128&&(X&192)===128&&(G=(U&15)<<18|(he&63)<<12|(V&63)<<6|X&63,G>65535&&G<1114112&&(B=G))}}B===null?(B=65533,ie=1):B>65535&&(B-=65536,_.push(B>>>10&1023|55296),B=56320|B&1023),_.push(B),x+=ie}return lt(_)}var Me=4096;function lt(y){var l=y.length;if(l<=Me)return String.fromCharCode.apply(String,y);for(var u="",_=0;_<l;)u+=String.fromCharCode.apply(String,y.slice(_,_+=Me));return u}function Tt(y,l,u){var _="";u=Math.min(y.length,u);for(var x=l;x<u;++x)_+=String.fromCharCode(y[x]&127);return _}function Te(y,l,u){var _="";u=Math.min(y.length,u);for(var x=l;x<u;++x)_+=String.fromCharCode(y[x]);return _}function $e(y,l,u){var _=y.length;(!l||l<0)&&(l=0),(!u||u<0||u>_)&&(u=_);for(var x="",U=l;U<u;++U)x+=Wi[y[U]];return x}function me(y,l,u){for(var _=y.slice(l,u),x="",U=0;U<_.length-1;U+=2)x+=String.fromCharCode(_[U]+_[U+1]*256);return x}s.prototype.slice=function(l,u){var _=this.length;l=~~l,u=u===void 0?_:~~u,l<0?(l+=_,l<0&&(l=0)):l>_&&(l=_),u<0?(u+=_,u<0&&(u=0)):u>_&&(u=_),u<l&&(u=l);var x=this.subarray(l,u);return Object.setPrototypeOf(x,s.prototype),x};function ne(y,l,u){if(y%1!==0||y<0)throw new RangeError("offset is not uint");if(y+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,_){l=l>>>0,u=u>>>0,_||ne(l,u,this.length);for(var x=this[l],U=1,B=0;++B<u&&(U*=256);)x+=this[l+B]*U;return x},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,_){l=l>>>0,u=u>>>0,_||ne(l,u,this.length);for(var x=this[l+--u],U=1;u>0&&(U*=256);)x+=this[l+--u]*U;return x},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||ne(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||ne(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||ne(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||ne(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||ne(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,_){l=l>>>0,u=u>>>0,_||ne(l,u,this.length);for(var x=this[l],U=1,B=0;++B<u&&(U*=256);)x+=this[l+B]*U;return U*=128,x>=U&&(x-=Math.pow(2,8*u)),x},s.prototype.readIntBE=function(l,u,_){l=l>>>0,u=u>>>0,_||ne(l,u,this.length);for(var x=u,U=1,B=this[l+--x];x>0&&(U*=256);)B+=this[l+--x]*U;return U*=128,B>=U&&(B-=Math.pow(2,8*u)),B},s.prototype.readInt8=function(l,u){return l=l>>>0,u||ne(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||ne(l,2,this.length);var _=this[l]|this[l+1]<<8;return _&32768?_|4294901760:_},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||ne(l,2,this.length);var _=this[l+1]|this[l]<<8;return _&32768?_|4294901760:_},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||ne(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||ne(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||ne(l,4,this.length),wi.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||ne(l,4,this.length),wi.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||ne(l,8,this.length),wi.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||ne(l,8,this.length),wi.read(this,l,!1,52,8)};function je(y,l,u,_,x,U){if(!s.isBuffer(y))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>x||l<U)throw new RangeError('"value" argument is out of bounds');if(u+_>y.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,_,x){if(l=+l,u=u>>>0,_=_>>>0,!x){var U=Math.pow(2,8*_)-1;je(this,l,u,_,U,0)}var B=1,ie=0;for(this[u]=l&255;++ie<_&&(B*=256);)this[u+ie]=l/B&255;return u+_},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,_,x){if(l=+l,u=u>>>0,_=_>>>0,!x){var U=Math.pow(2,8*_)-1;je(this,l,u,_,U,0)}var B=_-1,ie=1;for(this[u+B]=l&255;--B>=0&&(ie*=256);)this[u+B]=l/ie&255;return u+_},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,_,x){if(l=+l,u=u>>>0,!x){var U=Math.pow(2,8*_-1);je(this,l,u,_,U-1,-U)}var B=0,ie=1,he=0;for(this[u]=l&255;++B<_&&(ie*=256);)l<0&&he===0&&this[u+B-1]!==0&&(he=1),this[u+B]=(l/ie>>0)-he&255;return u+_},s.prototype.writeIntBE=function(l,u,_,x){if(l=+l,u=u>>>0,!x){var U=Math.pow(2,8*_-1);je(this,l,u,_,U-1,-U)}var B=_-1,ie=1,he=0;for(this[u+B]=l&255;--B>=0&&(ie*=256);)l<0&&he===0&&this[u+B+1]!==0&&(he=1),this[u+B]=(l/ie>>0)-he&255;return u+_},s.prototype.writeInt8=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,_){return l=+l,u=u>>>0,_||je(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function dt(y,l,u,_,x,U){if(u+_>y.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function lr(y,l,u,_,x){return l=+l,u=u>>>0,x||dt(y,l,u,4),wi.write(y,l,u,_,23,4),u+4}s.prototype.writeFloatLE=function(l,u,_){return lr(this,l,u,!0,_)},s.prototype.writeFloatBE=function(l,u,_){return lr(this,l,u,!1,_)};function Hr(y,l,u,_,x){return l=+l,u=u>>>0,x||dt(y,l,u,8),wi.write(y,l,u,_,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,_){return Hr(this,l,u,!0,_)},s.prototype.writeDoubleBE=function(l,u,_){return Hr(this,l,u,!1,_)},s.prototype.copy=function(l,u,_,x){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(_||(_=0),!x&&x!==0&&(x=this.length),u>=l.length&&(u=l.length),u||(u=0),x>0&&x<_&&(x=_),x===_||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),l.length-u<x-_&&(x=l.length-u+_);var U=x-_;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,_,x):Uint8Array.prototype.set.call(l,this.subarray(_,x),u),U},s.prototype.fill=function(l,u,_,x){if(typeof l=="string"){if(typeof u=="string"?(x=u,u=0,_=this.length):typeof _=="string"&&(x=_,_=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!s.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(l.length===1){var U=l.charCodeAt(0);(x==="utf8"&&U<128||x==="latin1")&&(l=U)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<_)throw new RangeError("Out of range index");if(_<=u)return this;u=u>>>0,_=_===void 0?this.length:_>>>0,l||(l=0);var B;if(typeof l=="number")for(B=u;B<_;++B)this[B]=l;else{var ie=s.isBuffer(l)?l:s.from(l,x),he=ie.length;if(he===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(B=0;B<_-u;++B)this[B+u]=ie[B%he]}return this};var rn=/[^+/0-9A-Za-z-_]/g;function Mn(y){if(y=y.split("=")[0],y=y.trim().replace(rn,""),y.length<2)return"";for(;y.length%4!==0;)y=y+"=";return y}function $r(y,l){l=l||1/0;for(var u,_=y.length,x=null,U=[],B=0;B<_;++B){if(u=y.charCodeAt(B),u>55295&&u<57344){if(!x){if(u>56319){(l-=3)>-1&&U.push(239,191,189);continue}else if(B+1===_){(l-=3)>-1&&U.push(239,191,189);continue}x=u;continue}if(u<56320){(l-=3)>-1&&U.push(239,191,189),x=u;continue}u=(x-55296<<10|u-56320)+65536}else x&&(l-=3)>-1&&U.push(239,191,189);if(x=null,u<128){if((l-=1)<0)break;U.push(u)}else if(u<2048){if((l-=2)<0)break;U.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;U.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;U.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return U}function Fn(y){for(var l=[],u=0;u<y.length;++u)l.push(y.charCodeAt(u)&255);return l}function Hn(y,l){for(var u,_,x,U=[],B=0;B<y.length&&!((l-=2)<0);++B)u=y.charCodeAt(B),_=u>>8,x=u%256,U.push(x),U.push(_);return U}function $n(y){return Tu.toByteArray(Mn(y))}function tr(y,l,u,_){for(var x=0;x<_&&!(x+u>=l.length||x>=y.length);++x)l[x+u]=y[x];return x}function ht(y,l){return y instanceof l||y!=null&&y.constructor!=null&&y.constructor.name!=null&&y.constructor.name===l.name}function Ht(y){return y!==y}var Wi=function(){for(var y="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var _=u*16,x=0;x<16;++x)l[_+x]=y[u]+y[x];return l}()}),we=pa.Buffer;pa.SlowBuffer;pa.INSPECT_MAX_BYTES;pa.kMaxLength;var Au=function(e,r){return Au=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},Au(e,r)};function fa(t,e){Au(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Tn=function(t){fa(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),We=function(t){fa(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 la(t){return t&&t.Math==Math&&t}function fd(){return la(typeof globalThis=="object"&&globalThis)||la(typeof window=="object"&&window)||la(typeof self=="object"&&self)||la(typeof global=="object"&&global)||Function("return this")()}function $_(){var t=fd();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var j_=function(e){var r=$_()?"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(r);for(var n=we.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},W_=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(we.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(we.alloc(e))}:j_}},md=W_();function G_(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ou(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function V_(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Y_(t){return wo(t)&&Object.prototype.toString.call(t)==="[object Date]"}function wo(t){return typeof t=="object"&&t!==null}function ma(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function ua(t){if(ArrayBuffer.isView(t))return we.from(t.buffer,t.byteOffset,t.byteLength);if(G_(t))return we.from(t);throw new We("Must use either Buffer or TypedArray")}var z_=/^(?:[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,dd=function(t){return typeof t=="string"&&z_.test(t)},Nu=function(t){if(!dd(t))throw new We('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 we.from(e,"hex")},Jm=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")};var BO=Math.pow(2,63)-1,UO=-Math.pow(2,63),q_=Math.pow(2,53),K_=-Math.pow(2,53);var hd=4;var Cn=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 We("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=we.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=we.from(e,"binary"):Array.isArray(e)?this.buffer=we.from(e):this.buffer=ua(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new We("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new We("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 We("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=we.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=we.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(ua(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 Xm(this.buffer.slice(0,this.position));throw new Tn('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=we.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=we.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=Nu(e.$uuid)),!n)throw new We("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===hd?new Xm(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(Cn.prototype,"_bsontype",{value:"Binary"});var Cu=16,Xm=function(t){fa(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=we.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Cu)i=ua(r);else if(typeof r=="string")i=Nu(r);else throw new We("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,hd)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Jm(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=Jm(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 Cn(this.id,Cn.SUBTYPE_UUID)},e.generate=function(){var r=md(Cu);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,we.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?dd(r):Ou(r)?r.length!==Cu?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Nu(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}(Cn),da=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(da.prototype,"_bsontype",{value:"Code"});function J_(t){return wo(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var Eo=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.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(Eo.prototype,"_bsontype",{value:"DBRef"});var zt=void 0;try{zt=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 Qm=65536,X_=1<<24,Ii=Qm*Qm,gd=Ii*Ii,Zm=gd/2,ed={},td={},J=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,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=td[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(td[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=ed[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(ed[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>=gd)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Zm)return t.MIN_VALUE;if(e+1>=Zm)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%Ii|0,e/Ii|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 o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),m=parseInt(e.substring(a,a+c),n);if(c<8){var p=t.fromNumber(Math.pow(n,c));s=s.mul(p).add(t.fromNumber(m))}else s=s.mul(o),s=s.add(t.fromNumber(m))}return s.unsigned=r,s},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 wo(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,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,m=e.low&65535,p=0,f=0,d=0,g=0;return g+=o+m,d+=g>>>16,g&=65535,d+=i+c,f+=d>>>16,d&=65535,f+=n+a,p+=f>>>16,f&=65535,p+=r+s,p&=65535,t.fromBits(d<<16|g,p<<16|f,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(zt){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?zt.div_u:zt.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,zt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}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();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),m=t.fromNumber(n),p=m.mul(e);p.isNegative()||p.gt(i);)n-=c,m=t.fromNumber(n,this.unsigned),p=m.mul(e);m.isZero()&&(m=t.ONE),o=o.add(m),i=i.sub(p)}return o},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)),zt){var r=(this.unsigned?zt.rem_u:zt.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,zt.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)),zt){var r=zt.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,zt.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,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,m=e.low>>>16,p=e.low&65535,f=0,d=0,g=0,E=0;return E+=s*p,g+=E>>>16,E&=65535,g+=o*p,d+=g>>>16,g&=65535,g+=s*m,d+=g>>>16,g&=65535,d+=i*p,f+=d>>>16,d&=65535,d+=o*m,f+=d>>>16,d&=65535,d+=s*c,f+=d>>>16,d&=65535,f+=n*p+i*m+o*c+s*a,f&=65535,t.fromBits(g<<16|E,f<<16|d,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)*Ii+(this.low>>>0):this.high*Ii+(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 o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),m=s.sub(c.mul(o)).toInt()>>>0,p=m.toString(e);if(s=c,s.isZero())return p+a;for(;p.length<6;)p="0"+p;a=""+p+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(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(X_),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(J.prototype,"__isLong__",{value:!0});Object.defineProperty(J.prototype,"_bsontype",{value:"Long"});var Q_=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Z_=/^(\+|-)?(Infinity|inf)$/i,eE=/^(\+|-)?NaN$/i,_o=6111,xu=-6176,rd=6176,tE=34,Du=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),nd=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),id=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),rE=/^([-+])?(\d+)?$/,nE=31,od=16383,iE=30,oE=31;function sd(t){return!isNaN(parseInt(t,10))}function sE(t){var e=J.fromNumber(1e9),r=J.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 J(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function aE(t,e){if(!t&&!e)return{high:J.fromNumber(0),low:J.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new J(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new J(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),m=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new J(a.getLowBits(),0).add(c).add(m.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),m=a.shiftLeft(32).add(new J(m.getLowBits(),0)),{high:s,low:m}}function cE(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function bi(t,e){throw new We('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Pu=function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ou(e)){if(e.byteLength!==16)throw new We("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new We("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,m=0,p=[0],f=0,d=0,g=0,E=0,A=0,O=0,D=new J(0,0),R=new J(0,0),P=0,j=0;if(e.length>=7e3)throw new We(""+e+" not a valid Decimal128 string");var se=e.match(Q_),M=e.match(Z_),Q=e.match(eE);if(!se&&!M&&!Q||e.length===0)throw new We(""+e+" not a valid Decimal128 string");if(se){var Y=se[2],ae=se[4],Re=se[5],ge=se[6];ae&&ge===void 0&&bi(e,"missing exponent power"),ae&&Y===void 0&&bi(e,"missing exponent base"),ae===void 0&&(Re||ge)&&bi(e,"missing e before exponent")}if((e[j]==="+"||e[j]==="-")&&(r=e[j++]==="-"),!sd(e[j])&&e[j]!=="."){if(e[j]==="i"||e[j]==="I")return new t(we.from(r?nd:id));if(e[j]==="N")return new t(we.from(Du))}for(;sd(e[j])||e[j]===".";){if(e[j]==="."){n&&bi(e,"contains multiple periods"),n=!0,j=j+1;continue}f<34&&(e[j]!=="0"||i)&&(i||(m=s),i=!0,p[d++]=parseInt(e[j],10),f=f+1),i&&(a=a+1),n&&(c=c+1),s=s+1,j=j+1}if(n&&!s)throw new We(""+e+" not a valid Decimal128 string");if(e[j]==="e"||e[j]==="E"){var Ie=e.substr(++j).match(rE);if(!Ie||!Ie[2])return new t(we.from(Du));A=parseInt(Ie[0],10),j=j+Ie[0].length}if(e[j])return new t(we.from(Du));if(g=0,!f)g=0,E=0,p[0]=0,a=1,f=1,o=0;else if(E=f-1,o=a,o!==1)for(;p[m+o-1]===0;)o=o-1;for(A<=c&&c-A>16384?A=xu:A=A-c;A>_o;){if(E=E+1,E-g>tE){var Ge=p.join("");if(Ge.match(/^0+$/)){A=_o;break}bi(e,"overflow")}A=A-1}for(;A<xu||f<a;){if(E===0&&o<f){A=xu,o=0;break}if(f<a?a=a-1:E=E-1,A<_o)A=A+1;else{var Ge=p.join("");if(Ge.match(/^0+$/)){A=_o;break}bi(e,"overflow")}}if(E-g+1<o){var Me=s;n&&(m=m+1,Me=Me+1),r&&(m=m+1,Me=Me+1);var lt=parseInt(e[m+E+1],10),Tt=0;if(lt>=5&&(Tt=1,lt===5)){for(Tt=p[E]%2===1?1:0,O=m+E+2;O<Me;O++)if(parseInt(e[O],10)){Tt=1;break}}if(Tt){for(var Te=E;Te>=0;Te--)if(++p[Te]>9&&(p[Te]=0,Te===0))if(A<_o)A=A+1,p[Te]=1;else return new t(we.from(r?nd:id))}}if(D=J.fromNumber(0),R=J.fromNumber(0),o===0)D=J.fromNumber(0),R=J.fromNumber(0);else if(E-g<17){var Te=g;for(R=J.fromNumber(p[Te++]),D=new J(0,0);Te<=E;Te++)R=R.multiply(J.fromNumber(10)),R=R.add(J.fromNumber(p[Te]))}else{var Te=g;for(D=J.fromNumber(p[Te++]);Te<=E-17;Te++)D=D.multiply(J.fromNumber(10)),D=D.add(J.fromNumber(p[Te]));for(R=J.fromNumber(p[Te++]);Te<=E;Te++)R=R.multiply(J.fromNumber(10)),R=R.add(J.fromNumber(p[Te]))}var $e=aE(D,J.fromString("100000000000000000"));$e.low=$e.low.add(R),cE($e.low,R)&&($e.high=$e.high.add(J.fromNumber(1))),P=A+rd;var me={low:J.fromNumber(0),high:J.fromNumber(0)};$e.high.shiftRightUnsigned(49).and(J.fromNumber(1)).equals(J.fromNumber(1))?(me.high=me.high.or(J.fromNumber(3).shiftLeft(61)),me.high=me.high.or(J.fromNumber(P).and(J.fromNumber(16383).shiftLeft(47))),me.high=me.high.or($e.high.and(J.fromNumber(0x7fffffffffff)))):(me.high=me.high.or(J.fromNumber(P&16383).shiftLeft(49)),me.high=me.high.or($e.high.and(J.fromNumber(562949953421311)))),me.low=$e.low,r&&(me.high=me.high.or(J.fromString("9223372036854775808")));var ne=we.alloc(16);return j=0,ne[j++]=me.low.low&255,ne[j++]=me.low.low>>8&255,ne[j++]=me.low.low>>16&255,ne[j++]=me.low.low>>24&255,ne[j++]=me.low.high&255,ne[j++]=me.low.high>>8&255,ne[j++]=me.low.high>>16&255,ne[j++]=me.low.high>>24&255,ne[j++]=me.high.low&255,ne[j++]=me.high.low>>8&255,ne[j++]=me.high.low>>16&255,ne[j++]=me.high.low>>24&255,ne[j++]=me.high.high&255,ne[j++]=me.high.high>>8&255,ne[j++]=me.high.high>>16&255,ne[j++]=me.high.high>>24&255,new t(ne)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},m,p,f=[];o=0;var d=this.bytes,g=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24,E=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24,A=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24,O=d[o++]|d[o++]<<8|d[o++]<<16|d[o++]<<24;o=0;var D={low:new J(g,E),high:new J(A,O)};D.high.lessThan(J.ZERO)&&f.push("-");var R=O>>26&nE;if(R>>3===3){if(R===iE)return f.join("")+"Infinity";if(R===oE)return"NaN";e=O>>15&od,a=8+(O>>14&1)}else a=O>>14&7,e=O>>17&od;var P=e-rd;if(c.parts[0]=(O&16383)+((a&15)<<14),c.parts[1]=A,c.parts[2]=E,c.parts[3]=g,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(p=3;p>=0;p--){var j=0,se=sE(c);if(c=se.quotient,j=se.rem.low,!!j)for(m=8;m>=0;m--)n[p*9+m]=j%10,j=Math.floor(j/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var M=r-1+P;if(M>=34||M<=-7||P>0){if(r>34)return f.push("".concat(0)),P>0?f.push("E+".concat(P)):P<0&&f.push("E".concat(P)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),M>0?f.push("+".concat(M)):f.push("".concat(M))}else if(P>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var Q=r+P;if(Q>0)for(var i=0;i<Q;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");Q++<0;)f.push("0");for(var i=0;i<r-Math.max(Q-1,0);i++)f.push("".concat(n[o++]))}return f.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(Pu.prototype,"_bsontype",{value:"Decimal128"});var ha=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(ha.prototype,"_bsontype",{value:"Double"});var ga=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(ga.prototype,"_bsontype",{value:"Int32"});var Lu=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(Lu.prototype,"_bsontype",{value:"MaxKey"});var Bu=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(Bu.prototype,"_bsontype",{value:"MinKey"});var lE=new RegExp("^[0-9a-fA-F]{24}$"),In=null,br=Symbol("id"),et=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 We("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=we.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[br]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[br]=r instanceof we?r:ua(r);else if(typeof r=="string")if(r.length===12){var n=we.from(r);if(n.byteLength===12)this[br]=n;else throw new We("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&lE.test(r))this[br]=we.from(r,"hex");else throw new We("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new We("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[br]},set:function(e){this[br]=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=we.alloc(12);return n.writeUInt32BE(e,0),In===null&&(In=md(5)),n[4]=In[0],n[5]=In[1],n[6]=In[2],n[7]=In[3],n[8]=In[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[br][11]===e[br][11]&&this[br].equals(e[br]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ou(this.id))return e===we.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 we.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=we.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 We("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(we.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(et.prototype,"generate",{value:ma(function(t){return et.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(et.prototype,"getInc",{value:ma(function(){return et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(et.prototype,"get_inc",{value:ma(function(){return et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(et,"get_inc",{value:ma(function(){return et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(et.prototype,"_bsontype",{value:"ObjectID"});function uE(t){return t.split("").sort().join("")}var So=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=uE(r??""),this.pattern.indexOf("\0")!==-1)throw new Tn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new Tn("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 Tn("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 We("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(So.prototype,"_bsontype",{value:"BSONRegExp"});var Uu=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(Uu.prototype,"_bsontype",{value:"Symbol"});var pE=J,yd=function(t){fa(e,t);function e(r,n){var i=this;return i instanceof e?(J.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:wo(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(J.fromInt(r,!0))},e.fromNumber=function(r){return new e(J.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(J.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=J.MAX_UNSIGNED_VALUE,e}(pE);function fE(t){return wo(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var vd=2147483647,_d=-2147483648,Ed=9223372036854776e3,Sd=-9223372036854776e3,mE={$oid:et,$binary:Cn,$uuid:Cn,$symbol:Uu,$numberInt:ga,$numberDecimal:Pu,$numberDouble:ha,$numberLong:J,$minKey:Bu,$maxKey:Lu,$regex:So,$regularExpression:So,$timestamp:yd};function wd(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=_d&&t<=vd)return new ga(t);if(t>=Sd&&t<=Ed)return J.fromNumber(t)}return new ha(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=mE[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):J.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=wd(t.$scope)),da.fromExtendedJSON(t)}if(J_(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof Eo)return c;var m=Object.keys(c).filter(function(f){return f.startsWith("$")}),p=!0;if(m.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(p=!1)}),p)return Eo.fromExtendedJSON(c)}return t}function dE(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Xr(r,e)}finally{e.seenObjects.pop()}})}function ad(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Xr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(D){return D.obj===t});if(r!==-1){var n=e.seenObjects.map(function(D){return D.propertyName}),i=n.slice(0,r).map(function(D){return"".concat(D," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(D){return"".concat(D," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),m="-".repeat(s.length+(o.length+a.length)/2-1);throw new We(`Converting circular structure to EJSON:
|
|
35
|
+
`+" ".concat(i).concat(o).concat(s).concat(a,`
|
|
36
|
+
`)+" ".concat(c,"\\").concat(m,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return dE(t,e);if(t===void 0)return null;if(t instanceof Date||Y_(t)){var p=t.getTime(),f=p>-1&&p<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:ad(t)}:e.relaxed&&f?{$date:ad(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var d=t>=_d&&t<=vd,g=t>=Sd&&t<=Ed;if(d)return{$numberInt:t.toString()};if(g)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||V_(t)){var E=t.flags;if(E===void 0){var A=t.toString().match(/[gimuy]*$/);A&&(E=A[0])}var O=new So(t.source,E);return O.toExtendedJSON(e)}return t!=null&&typeof t=="object"?gE(t,e):t}var hE={Binary:function(t){return new Cn(t.value(),t.sub_type)},Code:function(t){return new da(t.code,t.scope)},DBRef:function(t){return new Eo(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Pu(t.bytes)},Double:function(t){return new ha(t.value)},Int32:function(t){return new ga(t.value)},Long:function(t){return J.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 Lu},MinKey:function(){return new Bu},ObjectID:function(t){return new et(t)},ObjectId:function(t){return new et(t)},BSONRegExp:function(t){return new So(t.pattern,t.options)},Symbol:function(t){return new Uu(t.value)},Timestamp:function(t){return yd.fromBits(t.low,t.high)}};function gE(t,e){if(t==null||typeof t!="object")throw new Tn("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 o=Xr(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(fE(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=hE[t._bsontype];if(!a)throw new We("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new da(s.code,Xr(s.scope,e)):r==="DBRef"&&s.oid&&(s=new Eo(Xr(s.collection,e),Xr(s.oid,e),Xr(s.db,e),Xr(s.fields,e))),s.toExtendedJSON(e)}else throw new Tn("_bsontype must be a string, but was: "+typeof r)}var cd;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,m){if(c.indexOf("\0")!==-1)throw new Tn("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return wd(m,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var m=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),p=Xr(o,m);return JSON.stringify(p,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(cd||(cd={}));var ld,ud=fd();ud.Map?ld=ud.Map:ld=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],o=n[1];this._keys.push(i),this._values[i]={v:o,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 kO=J.fromNumber(q_),MO=J.fromNumber(K_);var Ru=new Uint8Array(8),FO=new DataView(Ru.buffer,Ru.byteOffset,Ru.byteLength);var yE=1024*1024*17,HO=we.alloc(yE);var Ti=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var _e=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new et(i):new et,this.occurred=new Date,n&&(this.trigger=new Ti(n)),this.newEvent=!i}trigger;items;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale};var Rt=class{static injectScriptURL(e,r){if(!e)return;let n=document.createElement("script");n.id=r??"",n.src=e,n.defer=!0,e.includes("localhost")&&(n.type="module"),document.head.appendChild(n)}static injectRawScript(e){if(!e)return;let r=document.createElement("script");r.id="cooee-app-script",r.innerHTML=e,document.head.appendChild(r)}static injectRawCSS(e,r=document.head){if(!e)return;let n=document.createElement("style");n.textContent=e,r.appendChild(n)}static injectStylesheet(e,r=document.head){if(!e)return;let n=document.createElement("link");n.rel="stylesheet",n.href=e,e==="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"&&(n.crossOrigin="anonymous",n.onload=i=>{let s=i.currentTarget?.sheet?.cssRules;if(s){for(let a of s)if(a.type==CSSRule.FONT_FACE_RULE){let c=e.split("/"),m=c.slice(0,c.length-1).join("/"),p=a.cssText;p=p.replace(/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g,`url("${m}/$4")`);let f=document.createElement("style");f.appendChild(document.createTextNode(p)),document.head.appendChild(f)}}}),r.appendChild(n)}};var pe=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var bd=Se(ku());var bo=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 e;try{e=new bd.URLBuilder(location.href)}catch{return{}}let r={};this.UTM_PARAMS.forEach(i=>{let o=e.getQueryParam(i);o&&(r[i]=o)});let n={};return Object.keys(this.TW_PARAMS).forEach(i=>{let o=e.getQueryParam(this.TW_PARAMS[i]);o&&(n[i]=o)}),w(w({},n),r)}};var Tr=class t{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 t(w({origin:location.origin,path:e,qs:location.search,referrer:bo.getReferrer(),name:le.get().pageName},bo.getUTMParams()))}};function ce(t){return typeof t=="function"}function va(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Ea=va(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
37
|
+
${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
|
|
38
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function xn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Kt=class t{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 o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(ce(n))try{n()}catch(o){e=o instanceof Ea?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{Id(o)}catch(s){e=e??[],s instanceof Ea?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Ea(e)}}add(e){var r;if(e&&e!==this)if(this.closed)Id(e);else{if(e instanceof t){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)&&xn(r,e)}remove(e){let{_finalizers:r}=this;r&&xn(r,e),e instanceof t&&e._removeParent(this)}};Kt.EMPTY=(()=>{let t=new Kt;return t.closed=!0,t})();var Mu=Kt.EMPTY;function Sa(t){return t instanceof Kt||t&&"closed"in t&&ce(t.remove)&&ce(t.add)&&ce(t.unsubscribe)}function Id(t){ce(t)?t():t.unsubscribe()}var sr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Ci={setTimeout(t,e,...r){let{delegate:n}=Ci;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=Ci;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function wa(t){Ci.setTimeout(()=>{let{onUnhandledError:e}=sr;if(e)e(t);else throw t})}function Fu(){}var Td=Hu("C",void 0,void 0);function Cd(t){return Hu("E",void 0,t)}function xd(t){return Hu("N",t,void 0)}function Hu(t,e,r){return{kind:t,value:e,error:r}}var Dn=null;function xi(t){if(sr.useDeprecatedSynchronousErrorHandling){let e=!Dn;if(e&&(Dn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=Dn;if(Dn=null,r)throw n}}else t()}function Dd(t){sr.useDeprecatedSynchronousErrorHandling&&Dn&&(Dn.errorThrown=!0,Dn.error=t)}var Rn=class extends Kt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Sa(e)&&e.add(this)):this.destination=SE}static create(e,r,n){return new Di(e,r,n)}next(e){this.isStopped?ju(xd(e),this):this._next(e)}error(e){this.isStopped?ju(Cd(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?ju(Td,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},_E=Function.prototype.bind;function $u(t,e){return _E.call(t,e)}var Wu=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){ba(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){ba(n)}else ba(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){ba(r)}}},Di=class extends Rn{constructor(e,r,n){super();let i;if(ce(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&sr.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&$u(e.next,o),error:e.error&&$u(e.error,o),complete:e.complete&&$u(e.complete,o)}):i=e}this.destination=new Wu(i)}};function ba(t){sr.useDeprecatedSynchronousErrorHandling?Dd(t):wa(t)}function EE(t){throw t}function ju(t,e){let{onStoppedNotification:r}=sr;r&&Ci.setTimeout(()=>r(t,e))}var SE={closed:!0,next:Fu,error:EE,complete:Fu};var Ri=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ia(t){return t}function Rd(t){return t.length===0?Ia:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var ot=(()=>{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 o=bE(r)?r:new Di(r,n,i);return xi(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Ad(n),new n((i,o)=>{let s=new Di({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Ri](){return this}pipe(...r){return Rd(r)(this)}toPromise(r){return r=Ad(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Ad(t){var e;return(e=t??sr.Promise)!==null&&e!==void 0?e:Promise}function wE(t){return t&&ce(t.next)&&ce(t.error)&&ce(t.complete)}function bE(t){return t&&t instanceof Rn||wE(t)&&Sa(t)}function IE(t){return ce(t?.lift)}function Jt(t){return e=>{if(IE(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 Ur(t,e,r,n,i){return new Gu(t,e,r,n,i)}var Gu=class extends Rn{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var Nd=va(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var It=(()=>{class t extends ot{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Ta(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Nd}next(r){xi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){xi(()=>{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(){xi(()=>{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:o}=this;return n||i?Mu:(this.currentObservers=null,o.push(r),new Kt(()=>{this.currentObservers=null,xn(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new ot;return r.source=this,r}}return t.create=(e,r)=>new Ta(e,r),t})(),Ta=class extends It{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:Mu}};var Io=class extends It{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var To={now(){return(To.delegate||Date).now()},delegate:void 0};var Co=class extends It{constructor(e=1/0,r=1/0,n=To){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var Ca=class extends Kt{constructor(e,r){super()}schedule(e,r=0){return this}};var xo={setInterval(t,e,...r){let{delegate:n}=xo;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=xo;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var xa=class extends Ca{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return xo.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&xo.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,xn(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var Ai=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};Ai.now=To.now;var Da=class extends Ai{constructor(e,r=Ai.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Od=new Da(xa);function Pd(t){return t&&ce(t.schedule)}function TE(t){return t[t.length-1]}function Ra(t){return Pd(TE(t))?t.pop():void 0}function Bd(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(p){try{m(n.next(p))}catch(f){s(f)}}function c(p){try{m(n.throw(p))}catch(f){s(f)}}function m(p){p.done?o(p.value):i(p.value).then(a,c)}m((n=n.apply(t,e||[])).next())})}function Ld(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 An(t){return this instanceof An?(this.v=t,this):new An(t)}function Ud(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(E){return Promise.resolve(E).then(g,f)}}function a(g,E){n[g]&&(i[g]=function(A){return new Promise(function(O,D){o.push([g,A,O,D])>1||c(g,A)})},E&&(i[g]=E(i[g])))}function c(g,E){try{m(n[g](E))}catch(A){d(o[0][3],A)}}function m(g){g.value instanceof An?Promise.resolve(g.value.v).then(p,f):d(o[0][2],g)}function p(g){c("next",g)}function f(g){c("throw",g)}function d(g,E){g(E),o.shift(),o.length&&c(o[0][0],o[0][1])}}function kd(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 Ld=="function"?Ld(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(m){o({value:m,done:a})},s)}}var Ni=t=>t&&typeof t.length=="number"&&typeof t!="function";function Aa(t){return ce(t?.then)}function Na(t){return ce(t[Ri])}function Oa(t){return Symbol.asyncIterator&&ce(t?.[Symbol.asyncIterator])}function Pa(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 CE(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var La=CE();function Ba(t){return ce(t?.[La])}function Ua(t){return Ud(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield An(r.read());if(i)return yield An(void 0);yield yield An(n)}}finally{r.releaseLock()}})}function ka(t){return ce(t?.getReader)}function Xt(t){if(t instanceof ot)return t;if(t!=null){if(Na(t))return xE(t);if(Ni(t))return DE(t);if(Aa(t))return RE(t);if(Oa(t))return Md(t);if(Ba(t))return AE(t);if(ka(t))return NE(t)}throw Pa(t)}function xE(t){return new ot(e=>{let r=t[Ri]();if(ce(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function DE(t){return new ot(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function RE(t){return new ot(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,wa)})}function AE(t){return new ot(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Md(t){return new ot(e=>{OE(t,e).catch(r=>e.error(r))})}function NE(t){return Md(Ua(t))}function OE(t,e){var r,n,i,o;return Bd(this,void 0,void 0,function*(){try{for(r=kd(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function Qt(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function Ma(t,e=0){return Jt((r,n)=>{r.subscribe(Ur(n,i=>Qt(n,t,()=>n.next(i),e),()=>Qt(n,t,()=>n.complete(),e),i=>Qt(n,t,()=>n.error(i),e)))})}function Fa(t,e=0){return Jt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Fd(t,e){return Xt(t).pipe(Fa(e),Ma(e))}function Hd(t,e){return Xt(t).pipe(Fa(e),Ma(e))}function $d(t,e){return new ot(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function jd(t,e){return new ot(r=>{let n;return Qt(r,e,()=>{n=t[La](),Qt(r,e,()=>{let i,o;try{({value:i,done:o}=n.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>ce(n?.return)&&n.return()})}function Ha(t,e){if(!t)throw new Error("Iterable cannot be null");return new ot(r=>{Qt(r,e,()=>{let n=t[Symbol.asyncIterator]();Qt(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Wd(t,e){return Ha(Ua(t),e)}function Gd(t,e){if(t!=null){if(Na(t))return Fd(t,e);if(Ni(t))return $d(t,e);if(Aa(t))return Hd(t,e);if(Oa(t))return Ha(t,e);if(Ba(t))return jd(t,e);if(ka(t))return Wd(t,e)}throw Pa(t)}function Vd(t,e){return e?Gd(t,e):Xt(t)}function Nn(t,e){return Jt((r,n)=>{let i=0;r.subscribe(Ur(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:PE}=Array;function LE(t,e){return PE(e)?t(...e):t(e)}function Yd(t){return Nn(e=>LE(t,e))}function zd(t,e,r,n,i,o,s,a){let c=[],m=0,p=0,f=!1,d=()=>{f&&!c.length&&!m&&e.complete()},g=A=>m<n?E(A):c.push(A),E=A=>{o&&e.next(A),m++;let O=!1;Xt(r(A,p++)).subscribe(Ur(e,D=>{i?.(D),o?g(D):e.next(D)},()=>{O=!0},void 0,()=>{if(O)try{for(m--;c.length&&m<n;){let D=c.shift();s?Qt(e,s,()=>E(D)):E(D)}d()}catch(D){e.error(D)}}))};return t.subscribe(Ur(e,g,()=>{f=!0,d()})),()=>{a?.()}}function Do(t,e,r=1/0){return ce(e)?Do((n,i)=>Nn((o,s)=>e(n,o,i,s))(Xt(t(n,i))),r):(typeof e=="number"&&(r=e),Jt((n,i)=>zd(n,i,t,r)))}function qd(t=1/0){return Do(Ia,t)}function Kd(){return qd(1)}function Vu(...t){return Kd()(Vd(t,Ra(t)))}var BE=["addListener","removeListener"],UE=["addEventListener","removeEventListener"],kE=["on","off"];function On(t,e,r,n){if(ce(r)&&(n=r,r=void 0),n)return On(t,e,r).pipe(Yd(n));let[i,o]=HE(t)?UE.map(s=>a=>t[s](e,a,r)):ME(t)?BE.map(Jd(t,e)):FE(t)?kE.map(Jd(t,e)):[];if(!i&&Ni(t))return Do(s=>On(s,e,r))(Xt(t));if(!i)throw new TypeError("Invalid event target");return new ot(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function Jd(t,e){return r=>n=>t[r](e,n)}function ME(t){return ce(t.addListener)&&ce(t.removeListener)}function FE(t){return ce(t.on)&&ce(t.off)}function HE(t){return ce(t.addEventListener)&&ce(t.removeEventListener)}function ar(t,e=Od){return Jt((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let m=o;o=null,n.next(m)}};function c(){let m=s+t,p=e.now();if(p<m){i=this.schedule(void 0,m-p),n.add(i);return}a()}r.subscribe(Ur(n,m=>{o=m,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}function Yu(...t){let e=Ra(t);return Jt((r,n)=>{(e?Vu(t,r,e):Vu(t,r)).subscribe(n)})}var $E=" 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/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^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|infrawatch|insight|inspect|iplabel|ips-agent|java(?!;)|jsjcw_scanner|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scanner\\.|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|zgrab",jE=/bot|crawl|http|lighthouse|scan|search|spider/i,Ro;function WE(){if(Ro instanceof RegExp)return Ro;try{Ro=new RegExp($E,"i")}catch{Ro=jE}return Ro}function Xd(t){return!!t&&WE().test(t)}var zu={d:(t,e)=>{for(var r in e)zu.o(e,r)&&!zu.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},qu={};zu.d(qu,{A:()=>YE,k:()=>Ku});var GE=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(m){try{c(n.next(m))}catch(p){o(p)}}function a(m){try{c(n.throw(m))}catch(p){o(p)}}function c(m){var p;m.done?i(m.value):(p=m.value,p instanceof r?p:new r(function(f){f(p)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},VE=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(m){return function(p){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,p[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&p[0]?n.return:p[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,p[1])).done)return i;switch(n=0,i&&(p=[2&p[0],i.value]),p[0]){case 0:case 1:i=p;break;case 4:return s.label++,{value:p[1],done:!1};case 5:s.label++,n=p[1],p=[0];continue;case 7:p=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||p[0]!==6&&p[0]!==2)){s=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]<i[3])){s.label=p[1];break}if(p[0]===6&&s.label<i[1]){s.label=i[1],i=p;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(p);break}i[2]&&s.ops.pop(),s.trys.pop();continue}p=e.call(t,s)}catch(f){p=[6,f],n=0}finally{r=i=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([c,m])}}};function Ku(){return GE(this,void 0,Promise,function(){return VE(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(s){var o=s;return s instanceof Error&&(o=(n=s.message)!==null&&n!==void 0?n:s),typeof o!="string"?void __callback(!1):void __callback(o.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=Ku);var YE=Ku,Qd=qu.A,MB=qu.k;var oh=Se(nn());var $a=class{parser;result={};constructor(){this.parser=Lt.get().getUAParser()}async get(){let e=this.result;return this.getDeviceMemory(),this.getNetworkType(),this.getOrientation(),await this.getBatteryInfo(),await this.getLocation(),e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:this.getDPI()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},e.browser={name:this.parser.getBrowser().name,ver:this.parser.getBrowser().version},e.device={model:this.parser.getDevice().model,type:this.parser.getDevice().type,vendor:this.parser.getDevice().vendor},e.os={name:this.parser.getOS().name,ver:this.parser.getOS().version},e.navigatorUA=navigator.userAgent,e.isHeadless=navigator.webdriver,e}getDeviceMemory(){let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;this.result.mem={tot:r*1024}}getNetworkType(){let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(this.result.net={type:r.effectiveType})}getOrientation(){let e=screen.orientation?.type;e&&(this.result.orientation=e)}getDPI(){let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let r=window.devicePixelRatio||1,n=e.offsetWidth*r;return document.body.removeChild(e),n}async getLocation(){if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{this.result.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})}async getBatteryInfo(){if("getBattery"in navigator)try{let r=await navigator.getBattery();this.result.bat={l:r.level*100,c:r.charging}}catch{}}};var Oi=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=En[e]?.toLowerCase();r&&(b.debug(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var nh=Se(Rr());var Pi=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),N.IN_APP_WRAPPER_NAME+"-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=w({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return b.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var ja=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof wr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace(N.COOEE+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var Wa=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),b.debug("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var Ga=class{apiService;action;triggerContext;constructor(e,r){this.action=e,this.apiService=fe.getInstance(),this.triggerContext=r}async execute(){let e=this.containsCTA()?N.EVENT_TRIGGER_CLICKED:N.EVENT_TRIGGER_CLOSED;switch(this.action.at!==106&&this.closeTriggerAndSendEvent(e),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:b.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 e=this.action.gu.u;te.isValidURL(e)||(e=`//${e}`),window.open(e,"_self")}}prompt(){let e=this.action.pmpt;e&&(e===2&&this.promptLocationPermission(),e===3&&this.promptPushNotificationPermission(),e===1&&this.promptCameraPermission())}closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){b.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==1?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}promptLocationPermission(){!navigator.geolocation||!navigator.permissions||navigator.geolocation.getCurrentPosition(e=>{this.apiService.updateDeviceProps({coords:[e.coords.latitude,e.coords.longitude]}),this.sendPermissionData()})}promptPushNotificationPermission(){if(!("Notification"in window)){b.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(e){return navigator.permissions.query({name:e}).then(r=>r.state.toString())}async checkAllPermission(){let e=await this.checkPermission("camera"),r=await this.checkPermission("geolocation"),n=Notification.permission;return{camera:e,location:r,notification:n}}sendPermissionData(){this.checkAllPermission().then(e=>{this.apiService.updateDeviceProps({perm:e})})}collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}this.closeTriggerAndSendEvent(N.EVENT_FORM_SUBMITTED,{form:e}),te.showSnackbar("Coupon applied on cart"),Wa.updateIdentity(e)}dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};document.dispatchEvent(new CustomEvent(N.CTA_EVENT,{detail:r}));let n={action:this.containsCTA()?N.CAMPAIGN_CLICKED_ACTIVITY:N.CAMPAIGN_CLOSED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:n}))}};var Li=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var Zt=class{renderer=Lt.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new Li(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 e=ee(w(w(w(w({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});this.renderer.setStyles(this.inappHTMLEl,e)}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 e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};this.renderer.setStyles(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);this.renderer.setStyle(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?this.renderer.setStyle(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):this.renderer.setStyle(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new vn(this.inappElement.trf);e&&e.rotate&&this.renderer.setStyle(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new Ga(e,this.triggerContext).execute()}),this.renderer.setStyle(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var Cr=class extends Zt{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily=N.COOEE+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.renderer.setStyles(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),this.renderer.setStyle(e,"font-weight",r.b?"bold":"normal"),this.renderer.setStyle(e,"font-style",r.i?"italic":"normal"),this.renderer.setStyle(e,"text-decoration",n.join(" ")),this.renderer.setStyle(e,"color",r.c??"inherit"),this.renderer.setStyle(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?ui[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),this.renderer.setStyle(this.inappHTMLEl,"text-align",r)}};var Ao=class extends Cr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=this.renderer.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.renderer.appendChild(this.inappHTMLEl,r)}),this.processCommonBlocks()}};var No=class extends Zt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var Pn=class extends Zt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("img"),this.insertElement()}render(){this.renderer.setAttribute(this.inappHTMLEl,"src",this.inappElement.src),this.renderer.setStyle(this.inappHTMLEl,"max-width","none"),this.renderer.setStyle(this.inappHTMLEl,"max-height","none"),this.renderer.setStyle(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Oo=class t extends Zt{constructor(r,n,i){super(r,n,i);this.parent=r;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(N.IN_APP_WRAPPER_NAME),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),this.renderer.setStyle(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=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 n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();this.renderer.setStyle(this.inappHTMLEl,"width",i+"px"),this.renderer.setStyle(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return w(w({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(){}};var Ya=class extends Zt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),this.renderer.setStyle(this.inappHTMLEl,"position","relative"),this.renderer.setStyle(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(N.IN_APP_CONTAINER_NAME),this}};var Bi=class extends Cr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("input"),this.insertElement()}render(){let e=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",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var za=class t extends Bi{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(t.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()})}};var qa=class t extends Bi{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(t.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()})}};var Ka=class t 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=ee(w(w(w({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(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.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-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var Ja=class extends Cr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=this.renderer.createElement("select"),this.insertElement()}render(){this.renderer.setStyle(this.inappHTMLEl,"background","#ffffff00"),this.renderer.setStyle(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new Sr(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=this.renderer.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var Xa=class extends Pn{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var Qa=Se(nn());var xr=class t{static INSTANCE=new t;topics={};constructor(){}static get(){return this.INSTANCE}broadcast(e,r){this.topics[e]||(this.topics[e]=new It),this.topics[e].next(r)}subscriber(e){return this.topics[e]||(this.topics[e]=new It),this.topics[e].asObservable()}};var ze=class t{static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Le.get().website??{};currentState=!1;drawerSubject=new Io({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",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.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(),document.addEventListener(N.CTA_AFTER_REFRESH_UI,this.updateBubble.bind(this))}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():this.isVisible();return Qa.default.log(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){b.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent(N.CTA_OPEN_CART_EVENT));let e=document.querySelector(this.iconSelector);if(!e){b.debug("No clickable cart icon found with selector",this.iconSelector);return}e.click()}onToggle(){return this.drawerSubject}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(this.isShopifyDefaultDrawer())this.element?.renderContents&&e&&(this.element.classList.remove("is-empty"),this.element.renderContents?.(e));else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer)window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else b.info("No method found to update the cart without refreshing");document.dispatchEvent(new CustomEvent(N.CTA_AFTER_REFRESH_UI)),r&&xr.get().broadcast(N.CART_UPDATE_BROADCAST)}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(N.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(!Pe.isShopify())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await te.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.createMutationObservers()}async findCartDrawerWithShadow(){if(!Pe.isShopify()||!this.shadowParentElementSelector)return;let r=(await te.retrySelector(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}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,o=e.left<=n&&e.right>=0,s=i&&o,a=this.cartDrawerElement.tagName.toLowerCase()===t.DEFAULT_SELECTOR&&this.cartDrawerElement.open,c=getComputedStyle(this.cartDrawerElement),m=c.display!=="none"&&c.visibility!=="hidden"&&parseFloat(c.opacity)>0,p=!this.cartDrawerElement.hidden,f=this.cartDrawerElement.offsetWidth>0||this.cartDrawerElement.offsetHeight>0||this.cartDrawerElement.getClientRects().length>0,d=c.transform.match(/matrix\(([^)]+)\)/),g=0,E=0;if(d){let se=d[1].split(", ").map(parseFloat);g=se[4],E=se[5]}let A=g+e.left>n||g+e.right<0||E+e.top>r||E+e.bottom<0,O=Math.max(0,Math.min(e.right,n)-Math.max(e.left,0)),D=Math.max(0,Math.min(e.bottom,r)-Math.max(e.top,0)),R=O*D,P=e.width*e.height,j=P>0&&R/P>=.1;return(s||a||!A)&&m&&p&&f&&j}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||(te.onNodesRemoved(this.cartDrawerElement,()=>{this.initialize()}),this.watchForCartToggle())}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new It;this.mutationObserver?.disconnect(),this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),r.pipe(ar(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)}async updateBubble(){let e=(await de.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}};var Ui=class t{static ACTIVE_TRIGGER_DATA;renderer=Lt.get();safeHTTP;parent;rootContainer;containerHTMLElement;ian;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.safeHTTP=fe.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 Mt(e))}async renderEngagement(e){if(this.triggerContext=new Pi(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(this.renderer.isMobile()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),this.ian.isEmbedded()){let r=document.querySelector(this.ian.getEmbeddedSelector());this.setParentContainer(r)}await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!ze.get().isOpen()||!this.renderer.isMobile()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=ze.get().onToggle().subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData;try{this.startRendering()}catch(e){Be.getInstance().captureException(e,{triggerData:JSON.stringify(this.triggerContext.triggerData)});return}this.sendTriggerDisplayed(),this.renderer.isMobile()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Ti(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(le.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=N.PAYMENT_MODAL_DETAILS.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.renderer.calculateScalingFactor(this.ian),this.rootContainer=new Oo(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw b.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new _e(N.EVENT_TRIGGER_DISPLAYED,e,this.triggerContext.triggerData);this.safeHTTP.sendEvent(r);let n={action:N.CAMPAIGN_DISPLAYED_ACTIVITY};document.dispatchEvent(new CustomEvent(N.POPUP_ACTIVITY_EVENT,{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new _e(r,e,this.triggerContext.triggerData);n.name===N.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 di?new za(e,r,n).render():r instanceof hi?new qa(e,r,n).render():r instanceof Yr?new Ao(e,r,n).render():r instanceof gi?new Xa(e,r,n).render():r instanceof Br?new Pn(e,r,n).render():r instanceof _n?new No(e,r,n).render():r instanceof fi?new Ka(e,r,n).render():r instanceof mi?new Ja(e,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Ya(this.rootContainer,r,e).render().getHTMLElement(),new ja().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),t.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(){Lt.get().removeInApp(this.triggerContext)}skipTrigger(e,r){let n=new _e(N.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 o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),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"})}};var Zd=Se(Rr()),eh=Se(ei());var Za=class{triggerData;safeHttpService=fe.getInstance();render(e){e.contentSource===Zd.EngagementContentSource.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){b.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.safeHttpService.sendEvent(new _e(N.EVENT_TRIGGER_DISPLAYED,{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.safeHttpService.sendEvent(new _e(N.EVENT_FORM_SUBMITTED,{form:n},this.triggerData)),this.safeHttpService.updateProfile(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.safeHttpService.sendEvent(new _e(N.EVENT_TRIGGER_CLOSED,{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(eh.JSUtils.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var ec=class{static trackIntent(e){if(!this.isInstalled()){b.log("Facebook pixel not installed");return}if(!Le.get().pixelPush){b.log("Facebook pixel push not enabled");return}let n=En[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(b.debug(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var rh=Se(th());var Ln=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return Pe.isShopify()}};var zE=(0,rh.default)(fetch),qE={retryDelay:N.API_CALL_RETRY_DELAY,retryOn:(t,e,r)=>t>=N.API_CALL_MAX_ATTEMPTS?!1:!!(e!==null||r?.status&&r?.status>=500)},mt=class t{static INSTANCE;apiToken="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateUserData(e){this.put("/v1/user/update",e).then(async r=>{b.log("Updated user profile"),await Bn.getInstance().storeAndPopulateAuthData(r)}).catch(r=>{b.error("Error saving user profile",r)})}trackOrder(e){this.post("/v1/event/track-order",e).then(()=>{b.log("Sent Order")}).catch(r=>{b.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(()=>{b.log("Updated device property")}).catch(async r=>{b.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(!Ln.isECommerceApp()&&!Ln.getFlags().allowEvents)return b.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Ct.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request("");if(n&&!o&&JSON.stringify(n).includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(a){return Be.getInstance().captureException(a,{body:JSON.stringify(n)}),{}}let s={method:e,headers:i,keepalive:!0};return n&&(s.body=JSON.stringify(n)),this.request(r,s)}async request(e,r){let n=w(w({},qE),r),i=await zE(e,n);if(!i.ok)throw i;return i.json()}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{s.getResponseHeader("Content-Type")?.includes("application/json")?i(JSON.parse(s.responseText)):o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",N.SDK),e.set("cooee-sdk-code",N.SDK_VERSION_CODE.toString()),e.set("cooee-sdk-version",N.SDK_VERSION),e.set("cooee-first-seen",this.firstSeen),this.apiToken&&e.append("cooee-sdk-token",this.apiToken),Ct.debug&&e.set("cooee-sdk-debug",String(1)),e}};var ki=class{static sentryService=Be.getInstance();static httpApiService=mt.getInstance();static async refreshItems(e){if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let a=(await de.getCurrent().getNormalisedCart()).items.map(c=>c.mID);e.items=e.items.filter(c=>!a.includes(c.mID))}if(Le.get().currencyCount<=1)return e.items;let r=e.items.length,n=e.items.map(s=>this.updatedItem(s,e.engagementID)),o=(await Promise.all(n)).filter(s=>s!=null);if(r&&!o.length){let s="Failed to fetch any product from Ajax API",a=new _e(N.EVENT_CAMPAIGN_FAILED,{reason:s,currency:e.currency},e);throw fe.getInstance().sendEvent(a),new Error(s)}if(e.isCartRecovery()){let s=de.getCurrent().items,a=[];for(let c of o)for(let m of c.vars){if(!m.isAvailable)continue;let p=s.find(g=>g.variant_id.toString()===m.mID);if(!p)continue;let f=new Dt(c);f.name=p.title;let d=new Sr(m);d.name=p.variant_title,d.price.d=p.discounted_price/100,f.variants=[d],a.push(f)}return a}return o}static async updatedItem(e,r){let n=e,i,o=Pe.getRootPrefix()+`products/${n.slug}.js`;try{i=await this.httpApiService.request(o)}catch(a){return b.error(`Failed to fetch ${o}`,a),a instanceof Response?this.sentryService.captureMessage(`Shopify product fetch failed ${a.status}`,"error",{item:n,path:o},{"engagement.id":r}):this.sentryService.captureException(a,{item:n,path:o},{"engagement.id":r}),null}if(!i)return b.error("Item not found after AJAX call for:",n),null;n.name=i.title;let s=n.selectedOrFirstVariant.value;return n.vars.map(a=>{let c=i.variants.find(m=>m.id===+a.mID);a.name=c.title,a.isAvailable=c.available,a.price.d=c.price?c.price/100:c.price,a.price.effective=a.price.d,a.price.cmp=c.compare_at_price?c.compare_at_price/100:c.compare_at_price,+s.mID===c.id&&(s.effectivePrice.value=a.price.d)}),n}};var tc=class t{static INSTANCE;httpService=pe.get(mt);sentryService=pe.get(Be);sessionManager=pe.get(st);runtime=le.get();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSilently(e){this.send(e).catch(r=>b.error(`Failed to send ${e.name}`,r))}async send(e){if(b.debug(`Sending event ${e.name}`),er.prepend(`Sending event <strong>${e.name}</strong> with id ${e.id}`),this.shouldReject(e)){b.warn(`Rejecting event ${e.name}`);return}await Promise.all([this.addSessionContext(e),this.addShopifyContext(e)]),this.addShopifyAttributes(),e.name!==N.EVENT_APP_BACKGROUND&&this.runtime.setActive(),e.currentItem=this.runtime.getCurrentItem(),e.locale=this.runtime.locale,this.httpService.post("/v1/event/track",e).then(async r=>{b.log("\u2705 Event tracked:",e.name),er.prepend(`\u2705 Event <strong>${r.eventName}</strong> tracked`),this.processEventResponse(e,r)}).catch(r=>{b.error(`Error sending event ${e.name} to server`,r)})}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(b.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=Tr.parseFromCurrent()}async addShopifyContext(e){if(Pe.isShopify())try{e.cart=await de.getCurrent().getNormalisedCart()}catch(r){b.error("Error fetching Shopify cart before sending the event",r)}}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{b.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){b.log(`Nothing to engage after ${e.name}`);return}b.log(`\u{1F4E3} Engagement(id=${r.triggerData.shortID}) will be shown`,r.triggerData);let n=new Mt(r.triggerData);n.occurred=e.occurred;let i;try{i=await ki.refreshItems(n)}catch(o){b.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===nh.EngagementContentSource.KLAVIYO){new Za().render(n);return}new Ui().renderEngagement(n).catch(o=>{b.error("Failed to render popup",o),this.sentryService.captureException(o,{event:e,triggerData:n})})}utiliseIntentIfCalculated(e){e.intent&&(Oi.trackIntent(e.intent),ec.trackIntent(e),er.prepend(`Intent is <strong>${En[e.intent]}</strong>`))}addShopifyAttributes(){Pe.isShopify()&&de.getCurrent().addCooeeAttributes().catch(e=>{b.error("Fail to add attributes in cart",e)})}};var fe=class t{static INSTANCE;httpApiService=mt.getInstance();eventAPIService=tc.getInstance();constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendEvent(e){b.debug(`Waiting for auth to send event ${e.name}`),st.replaySubject.subscribe(async()=>{this.eventAPIService.sendSilently(e)})}updateProfile(e){st.replaySubject.subscribe(()=>{this.httpApiService.updateUserData(e??{})})}trackOrder(e){st.replaySubject.subscribe(()=>{this.httpApiService.trackOrder(e)})}updateDeviceProps(e){st.replaySubject.subscribe(()=>{this.httpApiService.updateDeviceProps({props:e})})}generateDiscount(e){return this.httpApiService.generateDiscount(e)}};var er=class{static isOn=!1;static element;static watch(){let e=b.getDebugParam();(e==="1"||e==="on")&&fe.getInstance().updateDeviceProps({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&(this.isOn=!0,this.renderDebugBar())}static prepend(e){if(!this.isOn)return;let r=document.createElement("div");r.innerHTML="• "+new Date().toLocaleString()+" - "+e,this.element.prepend(r)}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 e=0,r=0,n=0,i=0,o=c=>{c=c||window.event,c.preventDefault(),n=c.clientX,i=c.clientY,document.onmouseup=a,document.onmousemove=s},s=c=>{c=c||window.event,c.preventDefault(),e=n-c.clientX,r=i-c.clientY,n=c.clientX,i=c.clientY,this.element.style.top=this.element.offsetTop-r+"px",this.element.style.left=this.element.offsetLeft-e+"px"},a=()=>{document.onmouseup=null,document.onmousemove=null};this.element.onmousedown=o}static getDebugMillis(){return new Date().getTime()+6*60*60*1e3}};var Po=class extends Gr{static storeName="app";static{this.storage=Xn(this.storeName)}};var rc=class{static processConfiguration(){let e=Le.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&fe.getInstance().updateDeviceProps({gaClientID:e})}static async getClientID(){let e=await Oe.get(oe.GA_CLIENT_ID),r=await this.getClientIDViaGTag();if(e!==r)return await Oe.set(oe.GA_CLIENT_ID,r),r}static async getClientIDViaGTag(){let r=Le.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var nc=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Po.get(oe.APP_CONFIG,{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){b.log("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Po.set(oe.APP_CONFIG,r).catch(n=>b.error(n)),rc.processConfiguration(),r.website&&(Rt.injectRawScript(r.website.commonJS),Rt.injectRawCSS(r.website.commonCSS)),ze.get().onToggle().subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(pe.get(cr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=be.globalRef.config.update(e);return ze.forceUpdate(),b.debug("App configurations",r),r}async trackViewCartEvent(){let e=await de.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};fe.getInstance().sendEvent(new _e(N.EVENT_VIEW_CART,n))}};var ih=Se(ku()),ic=class t{static META_REQUIRED_FIELDS=["ad_id"];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 ih.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};var Bn=class t{static INSTANCE=new t;httpAPIService=mt.getInstance();coreService=nc.getInstance();sentryService=Be.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 Oe.set(oe.ID,e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Oe.set(oe.DEVICE_ID,e.deviceID)),e.sdkToken&&(this.sdkToken=e.sdkToken,await Oe.set(oe.SDK_TOKEN,e.sdkToken)),this.updateAPIClient())}async validateSession(e){await this.populateFirstSeen(),await this.populateUserDataFromStorage(),b.log("Validating session with server");let r=await this.getSessionValidateData(e);try{let n=await this.httpAPIService.validateSession(r);b.log("Validating session Response",n),await this.coreService.processAppConfigurations(n.appSettings),await this.storeAndPopulateAuthData(n)}catch(n){throw b.error(n),n}}async populateUserDataFromStorage(){if(this.sdkToken=await Oe.get(oe.SDK_TOKEN),!this.sdkToken){b.warn("No SDK token found in local storage");return}this.userID=await Oe.get(oe.ID),this.deviceID=await Oe.get(oe.DEVICE_ID),this.updateAPIClient()}updateAPIClient(){b.debug("SDK Token:",this.sdkToken),b.log("Device ID:",this.deviceID),b.log("User ID:",this.userID),Oi.trackDeviceID(this.deviceID),er.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 $a().get();r.host=location.origin;try{(await Qd())?.isPrivate&&(r.private=!0)}catch(i){oh.default.error("Unable to detect private/incognito window",i)}let n=await Oe.get(oe.DEVICE_ID);return n||(n=new et().toHexString(),await Oe.set(oe.DEVICE_ID,n)),ee(w({deviceID:n,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),{sdk:N.SDK,page:Tr.parseFromCurrent(),ad:ic.getAdParams(),occurred:this.getSessionStartTime(le.get().jsLoadTime),currentItem:le.get().getCurrentItem(),cart:await de.getCurrent().getNormalisedCart(),properties:{}})}async populateFirstSeen(){let e=await Oe.get(oe.FIRST_SEEN),r=e?new Date(e):new Date;e||await Oe.set(oe.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>N.IDLE_TIME_IN_SECONDS?new Date:e}};var st=class t{static replaySubject=new Co(1);static INSTANCE;sentryService=pe.get(Be);lock=new Qn;constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(e){if(b.debug("Initialising SDK",e),Xd(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}Bn.getInstance().init(e),t.INSTANCE.checkForNewSession(!0).then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>b.error("Unable to perform device init",r))}getCurrentSessionID(){return tt.set(oe.SESSION_LAST_USED_TIME,new Date().getTime()),tt.get(oe.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 Bn.getInstance().validateSession({sessionID:n[0],sessionNumber:n[1],landingPage:n[2],newSession:r}),await tt.set(oe.SESSION_SYNCED,!0)}this.lock.release()}async startNewSession(){b.debug("Starting new session"),await tt.clear(),b.debug("Cleared SessionStorage before starting new session");let e=new Date,r=new et().toHexString();b.debug("New session ID to be used",r);let n=await Oe.get(oe.SESSION_NUMBER,0)+1;er.prepend(`New Session ID: <strong>${r}</strong> & number: ${n}`),await Promise.all([Oe.set(oe.SESSION_NUMBER,n),tt.set(oe.ID,r),tt.set(oe.SESSION_LAST_USED_TIME,e.getTime()),tt.set(oe.SESSION_LANDING_PAGE,Tr.parseFromCurrent())])}getLandingPage(){return tt.get(oe.SESSION_LANDING_PAGE,{})}getCurrentSessionNumber(){return Oe.get(oe.SESSION_NUMBER,1)}async isNewSessionRequired(){if(!await tt.get(oe.ID))return!0;let e=await tt.get(oe.SESSION_LAST_USED_TIME,0);return e?(new Date().getTime()-e)/1e3>N.IDLE_TIME_IN_SECONDS:!0}async notSynced(){return!await tt.get(oe.SESSION_SYNCED,!1)}};var Wo=Se(Rr()),ph=Se(Ac()),fh=Se(ei());var mh=Se(nn());var ah=Se(Ko()),ch=Se(nn());var kr=Se(Rr());var KE=`
|
|
39
|
+
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
40
|
+
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
41
|
+
cart {
|
|
42
|
+
id
|
|
43
|
+
}
|
|
44
|
+
userErrors {
|
|
45
|
+
field
|
|
46
|
+
message
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`,Qr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(b.log(`Applying discount code ${e}`,r,n),r){case kr.RedirectBehaviour.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case kr.RedirectBehaviour.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#${N.HASH_OPEN_CART_DRAWER}=1`;break;case kr.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case kr.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#${N.HASH_INITIATE_CHECKOUT}=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){let n=ze.get();switch(e){case kr.RedirectBehaviour.CART_PAGE:location.href="/cart";break;case kr.RedirectBehaviour.SHOPIFY_CHECKOUT:location.href="/checkout";break;case kr.RedirectBehaviour.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#${N.HASH_INITIATE_CHECKOUT}=1`);break;case kr.RedirectBehaviour.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(e){let r=Le.get().storefrontToken;if(!r)throw new Error("Storefront token not set for the store");let n=new Headers;n.append("Content-Type","application/json"),n.append("X-Shopify-Storefront-Access-Token",r);let i=JSON.stringify({query:KE,variables:{cartId:`gid://shopify/Cart/${de.getCurrent().token}`,discountCodes:[e]}}),o={method:"POST",headers:n,body:i};await mt.getInstance().request(N.GRAPHQL_API_PATH,o)}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.openRzpCheckout?window.openRzpCheckout():location.href=e}};var sh=Se(ei());var JE=`
|
|
51
|
+
mutation cartCreate($input: CartInput) {
|
|
52
|
+
cartCreate(input: $input) {
|
|
53
|
+
cart {
|
|
54
|
+
id
|
|
55
|
+
checkoutUrl
|
|
56
|
+
}
|
|
57
|
+
userErrors {
|
|
58
|
+
field
|
|
59
|
+
message
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`,Zr=class{listen(){document.addEventListener(N.CTA_EVENT,async e=>{await this.processEvent(e)},!1)}async performAddToCart(e,r){if(!e.length)return;let n=e.map(c=>{let{vID:m,quantity:p}=this.getVIDAndQuantity(c);return{id:m?+m:+c.mID,quantity:p,properties:r.getPrivateAttributesForLineItem()}}),i=Pe.getCartURL("cart/add.js"),o={items:n},s=ze.get();s.isMiniCart()?o.sections=["mini-cart"]:s.isShopifyDefaultDrawer()&&(o.sections=s.element.getSectionsToRender?.().map(c=>c.section??c.id));let a=JSON.stringify(o);try{let c=await fetch(i,{body:a,method:"post",headers:{"Content-Type":"application/json"}});if(c.status===200||c.status===302)return b.log(`Added ${e.length} items to Cart`),te.showSnackbar("Product added to your cart"),c.json()}catch(c){b.error("Failed to add product in cart",c)}}async performUpdate(e,r){if(!sh.JSUtils.hasKeys(r)){b.warn("No update fields provided");return}let n=Pe.getCartURL("cart/change.js"),i=w({id:+e.vID},r),o=JSON.stringify(i);try{let s=await fetch(n,{body:o,method:"post",headers:{"Content-Type":"application/json"}});(s.status===200||s.status===302)&&(b.log(`Updated ${e}`),de.getCurrent().update(s.json()))}catch(s){b.error("Failed to update item in cart",s,e)}}async performCopyCoupon(e){if(e)try{await navigator.clipboard.writeText(e),b.log(`Code-${e} copied`),te.showSnackbar("Discount code copied")}catch(r){b.error("Failed to copy code",r)}}performGoToItem(e){if(!e?.link)return;let r=Pe.getProductSlug(e.link);r&&(location.pathname=Pe.getRootPrefix()+"products/"+r)}async upgradeToSubscription(e,r){if(!e){b.warn("Trying to upgrade to subscription with no item");return}let n=await de.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(p=>p.vID===i.mID),s=i.selectedSellingPlan.value,a=Pe.getCartURL("cart/change.js"),c={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()},m=JSON.stringify(c);try{let p=await fetch(a,{body:m,method:"post",headers:{"Content-Type":"application/json"}});if(p.status===200||p.status===302){b.log(`Upgraded ${e} selling plan`),te.showSnackbar("Line item updated");let f=await p.json();return de.getCurrent().update(f),f}}catch(p){b.error("Failed to update subscription for item in cart",p)}}async performCartCreate(e,r,n){let i=Le.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");if(!e?.vID){b.error("No variant ID found to perform Buy now",e);return}let o=r?[r]:[],s=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],a=await te.getCartAttributes(),c=new Headers;c.append("Content-Type","application/json"),c.append("X-Shopify-Storefront-Access-Token",i);let m=JSON.stringify({query:JE,variables:{input:{lines:s,discountCodes:o,attributes:a}}});return(await mt.getInstance().request(N.GRAPHQL_API_PATH,{method:"POST",headers:c,body:m})).data?.cartCreate?.cart?.checkoutUrl}async processEvent(e){let r=e?.detail;if(!r)return;let n=r.clickAction,i=r.items,o=r.triggerData;if(n.at){let s=n;if(b.log(`Performing ${JSON.stringify(s)} action`),s.at===101)i?.length&&this.performGoToItem(i[0]);else if(s.at===102)i?.length&&await this.performAddToCart(i,o);else if(s.at===103)await this.performCopyCoupon(o.discount.code);else if(s.at===105)ze.get().open();else if(s.at===104){let a=r.collections;if(!a?.length)return;location.pathname=Pe.getRootPrefix()+"collections/"+a[0].handle}}n.applyDiscount&&o.discount?.code&&Qr.navigate(o.discount.code,o.redirectBehaviour)}getVIDAndQuantity(e){let r,n;if(e instanceof xt)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var en=class{constructor(e,r){this.triggerContext=e;this.element=r}safeHTTP=fe.getInstance();async execute(e){let r=le.get().getCurrentItem(),n=e.clickAction||this.element?.clc;if(!n)return;let i=e.item,o=this.triggerContext,s=new Zr,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount.type&&!!n?.applyDiscount,m={selectedVariants:o.triggerData.nonMutableItems.map(O=>({itemMID:O.mID,mID:O.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},p="",f=[],d=i?[i.toEmbed()]:[];if(n.at===108){let O=o.selectedItems;if(d=e.embeddedItems??O.map(D=>D.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let D;e.embeddedItems?D=e.embeddedItems.map(P=>({itemMID:P.mID,mID:P.vID,quantity:P.quantity})):D=O.map(P=>({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID}));let R=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&R&&D.push({itemMID:R.mID,mID:R.selectedOrFirstVariant.value.mID,isPrimary:!0}),m.selectedVariants=D,o.triggerData.isBundleOnPDP()&&m.selectedVariants.forEach(P=>{P.mID===r.vID&&(P.isPrimary=!0)})}else m=void 0;f=e.embeddedItems??O}else if(n.at===107){let O=await de.getCurrent().getNormalisedCart();d=O.items,m.selectedVariants=O.items.map(D=>({itemMID:D.mID,mID:D.vID}))}else if(n.at===102)f=[i];else if(n.at===101)p=Pe.getRootPrefix()+"products/"+i.slug;else if(n.at===4){let O=te.isValidURL(n.gu?.u);O&&(p=O.href)}else if(n.at===109){let O=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),ze.get().refreshUI(O)}if(this.sendTriggerClicked(d,{from:"button"}),b.debug({redirectPath:p,redirectBehaviour:a,hasDiscount:c}),!c&&p){location.href=p;return}let g,E=!1;try{g=await this.getOrGenerateDiscountCode(m),b.debug("Discount code (if any) to apply",g)}catch(O){if(!this.triggerContext.triggerData.isBYOB()){ch.default.error("Unable to get a discount code",O);return}}if(g&&n.at===103)await s.performCopyCoupon(g);else if(n.at===110){let O=await s.performCartCreate(r,g,o.triggerData);O&&(location.href=O);return}try{g&&await Qr.applyWithStorefront(g)}catch(O){b.error(O),E=!0}let A;if(f?.length&&(A=await s.performAddToCart(f,o.triggerData)),E&&g){Qr.navigate(g,a,p);return}if(p){location.href=p;return}Qr.navigateWithoutDiscount(a,A)}sendTriggerClicked(e,r){let n=N.EVENT_TRIGGER_CLICKED,i=new _e(n,r,this.triggerContext.triggerData);i.items=e,this.safeHTTP.sendEvent(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===ah.DiscountType.STATIC){if(!r.code)throw Be.getInstance().captureMessage("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw b.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.safeHTTP.generateDiscount(e))?.code}catch(r){throw te.showSnackbar("Failed to generate a discount code"),b.error("Error generating discount code",r,e),Be.getInstance().captureMessage("Failed to generate discount code","error",{discountData:JSON.stringify(e),triggerContext:this.triggerContext,error:r}),r}}};var Ae=class extends pr{stylesConverter=new Li(1);renderer=Lt.get();mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=this.renderer.isMobile()?"sm":"lg",this.clickExecutor=new en(this.props.triggerContext,this.props.element)}getCompiledStyles(){return this.putStyleAccordingToDevice(),w(w(ee(w(w(w(w(w(w({},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(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";default:return b.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,this.renderer.isMobile()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=w(w({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e){await this.clickExecutor.execute(e)}};var XE=0,U2=Array.isArray;function $(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var m={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--XE,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return Ee.vnode&&Ee.vnode(m),m}var Ft=class extends Ae{componentDidMount(){this.setState(()=>({text:this.props.element.text})),at(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),$("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:$("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=vt.render(JSON.stringify(this.props.element),r),i=new it(JSON.parse(n));if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return w({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var Un=class extends Ft{render(){return $("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:()=>this.onClick({item:this.props.item}),children:$("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return ee(w({},super.getComponentStyles()),{cursor:"pointer"})}};var Qu=class extends pr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?$("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[$("span",{children:this.props.time}),$("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):$("div",{style:w(w({},this.getElementStyle()),this.props.styles),children:[$("span",{style:this.getTimeLabelStyle(),children:this.props.label}),$("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Lo=class extends Ft{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>w({},this.labels)),this.processAndStartTimer()}render(){return $("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>$(Qu,{styles:this.getCompiledStyles(),label:e,time:this.state[e],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 w(w({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>w({},this.labels))})}};var Bo=class extends Ae{componentDidMount(){at(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return $("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:$("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return ee(w({},this.getTypoStyles()),{display:"flex"})}};var Mr=class extends Ae{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return $("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(){this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var Fr=class extends Ae{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return $("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:$(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new yi,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Uo=class extends Fr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return $("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:$(Mi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var ko=class extends Ae{render(){return $("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(){at(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),w(w({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push($("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push($("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var lh=Se(Dc());var Mo=class extends Ae{colorRegex=new RegExp('fill="#[a-zA-Z0-9]+"');constructor(){super(),vt.escape=lh.MustacheUtils.escapeHtml}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),$("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e=this.props.element.fullStar,r=this.props.element.halfStart,n={size:this.props.element.iconSize,color:this.props.element.c.hex};e=vt.render(e,{svg:n}),r=vt.render(r,{svg:n});let i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=e;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=e,s--;a[1]&&(o+=r,s--);for(let c=0;c<s;c++)o+=e.replace(this.colorRegex,'fill="#f1f1f1')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Fo=class extends Ae{render(){return $("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(){at(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ct;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),w(w({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push($("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value;this.props.item.selectedOrFirstVariant.value=this.props.item.vars.find(n=>n.mID===r)}};var Mi=class extends Ae{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return $(Uo,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?$(Bo,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.imageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=$(Mr,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:$("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:$(Fo,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?$(ko,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?$(Mo,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?$(Un,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):$(tn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=$(Ft,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:$("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:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var uh=Se(Ko());var kn=class extends Ae{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=JSON.stringify(this.props.element),r=vt.render(e,this.getProductData());if(this.productElement=new Kr(JSON.parse(r)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return $("div",{style:w({},this.getCompiledStyles()),class:"lc-single-product",children:$(Mi,{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 e=this.props.item.selectedOrFirstVariant.value,r=e.price,n=this.props.item.name,i=this.props.item.category,o=te.formatCurrency(r.d,!0),s=this.props.item.variantImage??this.props.item.imageURL,a=this.props.item.meta,c=this.props.item.reviews?.rating,m=this.props.item.reviews?.totalReviews,p=r.cmp&&r.cmp>r.d,f=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity,d={name:n,price:o,quantity:f,image_url:s,meta:a,category:i,rating:c,reviews:m},g=e.effectivePrice.value!==r.d;g&&(d.effective_price=te.formatCurrency(e.effectivePrice.value));let E=this.props.triggerContext.triggerData.discount.type===uh.DiscountType.BXGY;if(!g&&E&&(d.effective_price=te.formatCurrency(e.effectivePrice.value),d.price=""),p){d.compare_price=te.formatCurrency(r.cmp);let O=r.cmp-r.d;d.discount_percent=(O/r.cmp*100).toFixed(0),d.discount_price=te.formatCurrency(O)}let A={name:e.name,quantity:this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(e.quantity):e.quantity};return{product:d,variant:A,svg:{color:()=>"{{svg.color}}",size:()=>"{{svg.size}}"}}}};function oc(){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 sc(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)=>`
|
|
64
|
+
<span class="${i}"
|
|
65
|
+
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
66
|
+
`,renderProgressbar:n=>`
|
|
67
|
+
<span class="${n}"
|
|
68
|
+
style="background-color: ${e.pagination.color?.rgba};">
|
|
69
|
+
</span>
|
|
70
|
+
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1}:!1,autoHeight:!0});return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),r}function ac(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),$("div",{class:"swiper-container",ref:e,children:[$("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&$("div",{class:"swiper-button-next",style:n,children:$("span",{})}),t.navigation.enabled&&$("div",{class:"swiper-button-prev",style:n,children:$("span",{})}),t.pagination.enabled&&$("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Ho=class extends Ae{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),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&&oc().then(()=>{this.swiperInstance=sc(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>$("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=$("div",{style:ee(w({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:ac(this.configuration,n,i)})}else r=$("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return $(fr,{children:[$(kn,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&$("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:$(Ft,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var $o=class extends Ae{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){oc().then(()=>{this.swiperInstance=sc(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>e.values?.map(i=>$("div",{class:"swiper-slide",onClick:()=>this.onClick({clickAction:this.getClickAction(i)}),children:this.renderElement(i)}));return ac(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return $(Mr,{element:r,triggerContext:this.props.triggerContext});case 4:return $(Fr,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=JSON.stringify(e),i=vt.render(n,{form:r});return kt.getParsedElement(JSON.parse(i))}getClickAction(e){let r=w({},this.props.element.clc),n=JSON.stringify(r),i=vt.render(n,{form:e});return JSON.parse(i)}};var tn=class extends Ae{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),at(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return $(Fr,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return $(Lo,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?$(Un,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return $(Ft,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return $(Mr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return $(Ho,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return $(kn,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return $($o,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var jo=class extends Ae{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===4&&this.clickAction.gu?.u}componentDidMount(){at(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return $(fr,{children:[$("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:()=>{this.onClick({clickAction:this.clickAction})},children:$(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&$("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}async onClick(e){if(this.isClickable)return super.onClick(e)}};var At=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Pi(new Date,this.engagementTrigger)}static renderedEngagements=[];static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=le.get();widgetAPIService=pe.get(cr);safeHTTPService=pe.get(fe);scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>Be.getInstance().captureException(e,w({},this.engagementTrigger.sentryContext())))}destroy(){b.log(`${this.engagementTrigger} will be destroyed`),this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()}),this.rootContainer?.remove(),t.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){b.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){mh.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){b.log(`${this.engagementTrigger} already has required data to render widget`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(b.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Dt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Dt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Dt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&fh.JSUtils.hasKeys(e.props)&&(this.engagementTrigger.props=w(w({},this.engagementTrigger.props),e.props)),this.triggerContext.triggerData.widget=this.widget=new Si(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){t.renderedEngagements.push(this)}async getVariation(){b.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){b.error(`${this.engagementTrigger} unable to get the variation`,r);return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.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((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=On(window,"scroll").pipe(ar(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!await this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?N.EVENT_CAMPAIGN_HOLDOUT:N.EVENT_TRIGGER_DISPLAYED,o=new _e(i,n,this.engagementTrigger);o.name===N.EVENT_CAMPAIGN_HOLDOUT&&(o.trigger.holdout=!0),this.safeHTTPService.sendEvent(o),t.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,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*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 b.warn(`${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(N.SHADOW_SPLITTER)){let c=n.split(N.SHADOW_SPLITTER);i=(await te.retrySelector(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&Rt.injectStylesheet(Ct.styleURL,i);let m=Le.get().website.commonCSS;i&&m&&Rt.injectRawCSS(m,i)}b.debug(`${this.engagementTrigger} attempt to render ${r.position}-${n}`);let o=await te.retrySelector(n,10,i??document);if(!o)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case Wo.EngagementPlacementPosition.BEFORE:{o.parentElement?.insertBefore(a,o);break}case Wo.EngagementPlacementPosition.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case Wo.EngagementPlacementPosition.INSIDE_LAST:{o.appendChild(a);break}case Wo.EngagementPlacementPosition.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async startRendering(){let e;try{e=await ki.refreshItems(this.engagementTrigger)}catch(r){b.error(`${this.engagementTrigger} error refreshing the items`,r);return}if(!e?.length&&this.engagementTrigger.isProductPromoted()){b.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.style.minWidth="0.5px",n}renderContainer(){if(!this.widget)return;let e=this.rootContainer;if(this.triggerContext.triggerData.hasSwiperElement()){let n=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),i=Le.get().website.commonCSS;i&&Rt.injectRawCSS(i,n),Rt.injectStylesheet(Ct.styleURL,n),Rt.injectStylesheet("https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",n),e=n}tf(Mc(jo,{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 o of i)ph.ArrayUtils.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var Dr=class t extends At{static renderedEngagements=[];constructor(e){super(e)}addToRendered(){t.renderedEngagements.push(this)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!ze.get().isOpen()&&this.runtimeData.pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var cc=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=de.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(p=>p.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(p=>p.mID===e.id.toString());if(!n)return;let i=new Sr(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let p of i.sellingPlans??[])p.mID===o.id.toString()&&(p.isSelected=!0,i.changeSellingPlan(p));let s=new Dt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new Mt(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let m=new Dr(c);m.renderSilently(),this.watchForCartItemDeletion(m,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(b.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))})}};var dh=Se(Rr());var lc=class extends Dr{ctaListener=new Zr;constructor(e){super(e),xr.get().subscriber(N.CART_UPDATE_BROADCAST).pipe(Yu(null)).subscribe(this.checkMilestone.bind(this))}update(e){super.update(e),this.widgetElement.update()}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e=this.widgetElement=document.createElement("cooee-progressbar");e.className="cooee-root",e.cart=de.getCurrent(),e.engagementTrigger=this.engagementTrigger,e.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(e),this.addToRendered()}async checkMilestone(){let e=await de.getCurrent().getNormalisedCart(),i=[...this.engagementTrigger.progressBarConfig.milestones].reverse().find(o=>o.minValue<e.amount);if(!i){b.log("No milestone achieved yet");return}if(b.log("Current milestone",i),i.rewardType===dh.MilestoneRewardType.FREE_AUTO_GIFT){let o=i.items[0];if(e.items.find(a=>a.vID===o.vID||a.mID===o.mID)){b.log(`Item(vID:${o.vID}) already present in the cart. Updating item's properties`),await this.ctaListener.performUpdate(o,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()});return}else{let a=await this.ctaListener.performAddToCart([o],this.engagementTrigger);ze.get().refreshUI(a,!1),await this.removeOtherFreeGifts(o)}}}async removeOtherFreeGifts(e){let n=(await de.getCurrent().getNormalisedCart()).items.filter(i=>i.vID!==e?.vID&&i.properties[N.CAMPAIGN_ATTRIBUTE]===this.engagementTrigger.shortID);if(n.length)for(let i of n)await this.ctaListener.performUpdate(i,{quantity:0})}};var hh=Se(Rr()),uc=class extends At{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e=this.widgetElement=document.createElement("cooee-shoppable-videos");e.className="cooee-root",e.items=this.triggerContext.triggerData.items,e.engagementTrigger=this.engagementTrigger,e.addEventListener("triggerClicked",r=>{let n=r.detail;this.safeHTTPService.sendEvent(n)}),e.addEventListener("performCTA",async r=>{let n={at:hh.ClickActionType.ADD_TO_CART,applyDiscount:!0},i=r.detail;await new en(this.triggerContext).execute({clickAction:n,item:i})}),e.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(e),this.addToRendered()}};var gh=Se(ei());var pc=class extends At{constructor(e){super(e)}shouldStopRendering(){return!1}renderContainer(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(N.ADD_BUNDLE_CTA_INBOUND_EVENT,this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!gh.JSUtils.hasKeys(i)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new xt({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new en(this.triggerContext).execute({embeddedItems:a,clickAction:{at:108,applyDiscount:!0}})}};var Fi=class{runtimeData=le.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[...Dr.renderedEngagements];Dr.renderedEngagements.length=0;for(let n of e)b.log(`\u{1F4E3} ${n} received as cart embed`),!this.findAndUpdateCurrent(n,r)&&(b.log(`${n} is new`),n.isProgressBar()?new lc(n).renderSilently():n.isSubscriptionUpsell()?cc.renderCartUpsell(n):new Dr(n).renderSilently());this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...At.renderedEngagements];At.renderedEngagements.length=0;for(let n of e)b.log(`\u{1F4E3} ${n} received as page embed`),!this.findAndUpdateCurrent(n,r)&&(b.log(`${n} is new`),n.isShoppableVideo()?new uc(n).renderSilently():n.isBYOB()?new pc(n).renderSilently():new At(n).renderSilently());this.removeOldWidgets(r)}findAndUpdateCurrent(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?!1:(r[n].update(e),r[n].renderSilently(),r.splice(n,1),!0)}removeOldWidgets(e){for(let r of e)r.destroy()}};var cr=class t{static INSTANCE;httpService=pe.get(mt);sessionManager=pe.get(st);runtimeData=le.get();loadWidgetsSubject=new It;constructor(){this.loadWidgetsSubject.pipe(ar(300)).subscribe(()=>{this.loadCartWidgets().catch(e=>b.error("Unable to initiate cart widgets",e)),this.loadPageWidgets().catch(e=>b.error("Unable to initiate page widgets",e))}),xr.get().subscriber(N.CART_UPDATE_BROADCAST).subscribe(()=>this.loadWidgetsSubject.next())}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSilently(){st.replaySubject.subscribe(async()=>{this.loadPageWidgets().catch(e=>b.error("Unable to initiate load page widgets",e))})}loadCartWidgetsSilently(){st.replaySubject.subscribe(async()=>{this.loadCartWidgets().catch(e=>b.error("Unable to initiate cart widgets",e))})}loadWidgetsSilently(){st.replaySubject.subscribe(async()=>{this.loadWidgetsSubject.next()})}async loadPageWidgets(){let e=await this.getWidgetProps();b.log("Load widgets",e),this.httpService.post("/v1/engagement/page-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Mt(i));new Fi().processPageWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async loadCartWidgets(){let e=await this.getWidgetProps();b.log("Load cart widgets",e),this.httpService.post("/v1/engagement/cart-widgets",e).then(async r=>{let n=r.widgets.map(i=>new Mt(i));new Fi().processCartWidgetResponse(n)}).catch(r=>{b.error("Error sending widget getter",r)})}async getVariation(e){let r=await this.getWidgetProps();return this.httpService.post("/v1/engagement/get-variant",w(w({},e),r))}renderCachedCartWidgets(){new Fi().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=Tr.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(),e.locale=this.runtimeData.locale,await this.addSessionContext(e),e.currentItem=this.runtimeData.getCurrentItem();try{e.cart=await de.getCurrent().getNormalisedCart()}catch(o){b.error("Error fetching Shopify cart before sending widget call",o)}let r=new URLSearchParams(location.search),n=r.get("cooee-preview");n?e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)):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}};var fc=class{runtimeData=le.get();widgetAPIService=pe.get(cr);meddle(){let e=be.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.screen=e.screen??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.meddleScreen(),this.exposeMethods()}exposeMethods(){let e=be.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSilently()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSilently()},e.previewWidget=be.previewWidget.bind(be),e.previewPopup=be.previewPopup.bind(be)}overwritePush(e,r){li(e,"push",r)}meddleAccount(){this.overwritePush(be.globalRef.account,(...e)=>{this.processAccount(e[0])}),be.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(be.globalRef.events,(...e)=>{this.processEvent(e[0])}),be.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(be.globalRef.profile,(...e)=>{this.processProfile(e[0])}),be.globalRef.profile.forEach(this.processProfile.bind(this))}meddleScreen(){this.overwritePush(be.globalRef.screen,(...e)=>{this.processPageName(e[0])}),be.globalRef.screen.forEach(this.processPageName.bind(this))}processAccount(e){e&&(e.appID&&be.authenticate(e),e.flags&&Ln.setFlags(e.flags))}processEvent(e){e&&(N.JS_LOAD_WHITELIST_EVENTS.includes(e[0])?be.sendEvent(e[0],e[1],this.runtimeData.jsLoadTime):be.sendEvent(e[0],e[1]))}processProfile(e){e&&be.updateProfile(e)}processPageName(e){e&&be.setPageName(e)}meddlePage(){this.overwritePush(be.globalRef.page,(...e)=>{this.processPage(e[0])}),be.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&be.setPageName(e.pageName)}};var Hi=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=N.COOEE.concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var $i=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;safeHttpService=pe.get(fe);_lastScreenOrScroll=new Date;lastPercent=0;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){Hi.remove(N.SESSION_STORAGE_SCROLL_ID),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}te.onDocumentLoaded(()=>{this.observeWindowScroll()})}observeWindowScroll(){On(window,"scroll").pipe(ar(t.DEBOUNCE_TIME),Nn(()=>{let e=this.getPercentScrolledY();if(e>100){b.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)>=t.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=Hi.getString(N.SESSION_STORAGE_SCROLL_ID,""),i=new _e(N.EVENT_SCROLL,r,null,n);this.safeHttpService.sendEvent(i),Hi.setString(N.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)}};var mc=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";apiService=pe.get(fe);runtimeData=le.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){b.info("Not sending background event as user was inactive on website");return}b.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,this.apiService.sendEvent(new _e(N.EVENT_APP_BACKGROUND,r))}};var dc=class{compareCartItemSubject=new It;constructor(){this.compareCartItemSubject.pipe(ar(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>b.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},b.debug("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>b.error("Unable to process cart change in fetch",o)),i))},b.debug("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(le.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(b.debug(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(m=>m.vID===a.vID);if(c){if(c.quantity!==a.quantity){let m=c.quantity<a.quantity,p=Math.abs(c.quantity-a.quantity),f=ee(w({},a),{quantity:p});m?o.push(f):s.push(f)}n&&te.removeFromArray(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);b.debug(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent(N.EVENT_ADD_TO_CART,{items:o}),s.length&&e.token===r.token&&this.sendEvent(N.EVENT_REMOVE_FROM_CART,{items:s}),(s.length||o.length)&&xr.get().broadcast(N.CART_UPDATE_BROADCAST,{itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new _e(e,r);pe.get(fe).sendEvent(n)}async compareCartItems(){let e=await Oe.get(oe.CURRENT_CART,{}),r=await de.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var hc=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){Be.getInstance().captureError("Failed to modify graphql request",o,{body:JSON.stringify(i?.body)})}return r(n,i)},b.debug("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;b.debug("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent())}async updatedBody(e){let r=e.variables.input.attributes??[],n=await te.getCartAttributes();return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=le.get().getCurrentItem();if(!e)return;let r=new _e(N.EVENT_BUY_NOW_CLICKED,{items:[e]});fe.getInstance().sendEvent(r)}};var ji=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new _e(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});fe.getInstance().sendEvent(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await te.retrySelectorForElements(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var gc=class t extends ji{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(t.selectors,N.EVENT_ITEM_THUMBNAIL_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var yc=class t extends ji{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(t.selectors,N.EVENT_REVIEW_CLICKED)}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var vc=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(){te.onDocumentLoaded(()=>{b.debug("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes(N.HASH_INITIATE_CHECKOUT)){document.dispatchEvent(new Event(N.THIRD_PARTY_CHECKOUT_EVENT));let r=document.querySelector(this.selector);if(!r){b.debug("No clickable cart checkout button found");return}b.debug("Clickable cart checkout button found",r),r.click()}else e.includes(N.HASH_OPEN_CART_DRAWER)&&ze.get().open()}};var _c=class{trackSilently(){this.track().catch(e=>Be.getInstance().captureException(e))}async track(){let e=window.Shopify?.checkout,r=window.Shopify?.Checkout;if(!e&&!r)return;let n={};this.processSmallCheckout(e,n),this.processBigCheckout(r,n);let i=this.getTokenFromCurrentURLPath();if(i&&(n.urlToken=i),!Object.keys(n).length){b.warn("No processable data found in",e,r);return}n.referrer=document.referrer,n.url=location.href;let o=await pe.get(st).checkSessionAndGetContext();n.sessionID=o[0],this.trackOrder(n)}processSmallCheckout(e,r){e&&(e.order_id&&(r.orderID=e.order_id.toString()),e.token&&(r.checkoutToken=e.token.toString()),e.customer_id&&(r.customerID=e.customer_id.toString()))}processBigCheckout(e,r){e&&(e.token&&!r.checkoutToken&&(r.checkoutToken=e.token.toString()),e.cartToken&&(r.cartToken=e.cartToken.toString()))}trackOrder(e){b.info("Found order to be send",e),fe.getInstance().trackOrder(e)}getTokenFromCurrentURLPath(){let e=new RegExp("[A-Fa-f0-9]{28,32}");return location.pathname?.split("/").find(r=>r.length&&e.test(r))}};var Go=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await de.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new _e(N.EVENT_CHECKOUT_STARTED,r);fe.getInstance().sendEvent(n)})}};var Ec=class{async migrate(){}};vt.escape=yh.MustacheUtils.escapeHtml;var be=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(){window.cooeeSDKPreview||(this.initGlobalReference(),await new Ec().migrate(),this.autoAuthenticate(),new fc().meddle(),new mc().listen(),new _c().trackSilently(),new Zr().listen(),new dc().listen(),new hc().listen(),new vc().listen(),pe.get($i).listen(),pe.get(yc).listenSilently(),pe.get(gc).listenSilently(),pe.get(cr).loadPageWidgetsSilently(),this.attachGoKwikListeners(),this.storePreviewParams(),this.setupPreviewListeners(),er.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(){window.CooeeSDK||li(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,li(this.globalRef,"config",new Le),li(this.globalRef,"runtimeData",new le),b.debug("Global reference initialised")}static injectWidgetAssets(){Rt.injectScriptURL(Ct.widgetURL,"cooee-widget-sdk"),Rt.injectStylesheet(Ct.styleURL)}static autoAuthenticate(){let e=Pe.getShopName();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;let r=e.appID?.trim(),n=e.shopifyShop;if((te.isNull(r)||r.length!==24)&&te.isNull(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,pe.get(st).init(e)}static sendEvent(e,r,n){for(let o in r)if(o.length>3&&o.toLowerCase().startsWith("ce "))throw new Error("Event property name cannot start with 'CE '");let i=new _e(e,r);i.occurred=n??new Date,pe.get(fe).sendEvent(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");pe.get(fe).updateProfile(e)}static setPageName(e){if(!e)return;let r=le.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&pe.get(cr).loadOrRenderWidgetsAfterCartChange(),N.BLACKLISTED_PAGE_NAMES.some(s=>e.includes(s))){pe.get($i).resetScrollID();return}let i={};n&&(i.ps=n);let o=new _e(N.EVENT_SCREEN_VIEW,i);o.occurred=r.jsLoadTime,pe.get(fe).sendEvent(o),pe.get($i).resetScrollID(o.occurred)}static previewPopup(e,r){new Ui(r).render(e)}static previewWidget(e){new At(new Mt(e)).render()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){b.error(e)}window.addEventListener("message",e=>{if(b.debug("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=le.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?Go.attachCheckoutListener():window.addEventListener("gokwikLoaded",Go.attachCheckoutListener)}static storePreviewParams(){let e=le.get(),r=new URLSearchParams(location.search),n=r.get("cooee-preview");n&&(e.previewIDs=n.trim().split(",").filter(o=>Number.isInteger(+o)));let i=r.get("cooee-variant");i&&(e.previewVariant=i)}};b.configure();b.logBrand();b.debug("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.debug("Execution order:","IIFE start"),await be.initForMerchantWebsiteOnly(),await be.initForAll(),b.debug("Execution order:","IIFE end")))());b.debug("Execution order:","bottom");
|