@letscooee/web-sdk 12.2.7 → 12.2.8

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/main.min.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as js,b as Gs,c as Sm,d as Tm,e as Im,f as xm,g as Cm,h as gr,i as zs,j as w,k as Rm,l as Am,m as Dm,n as Om,o as Jr}from"./chunk-WKAYFIPO.js";import{a as _,b as Z,c as Ai,d as bm,e as Ql,f as Xr,g as So}from"./chunk-V7UGKYBN.js";var Zl=Ql(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.URLBuilder=void 0;var w_=(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})();qs.URLBuilder=w_});var Fm=Ql((km,au)=>{"use strict";(function(t){if(typeof km=="object"&&typeof au<"u")au.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(o,i,s){function a(d,m){if(!i[d]){if(!o[d]){var E=typeof Ai=="function"&&Ai;if(!m&&E)return E(d,!0);if(l)return l(d,!0);var y=new Error("Cannot find module '"+d+"'");throw y.code="MODULE_NOT_FOUND",y}var C=i[d]={exports:{}};o[d][0].call(C.exports,function(D){var N=o[d][1][D];return a(N||D)},C,C.exports,n,o,i,s)}return i[d].exports}for(var l=typeof Ai=="function"&&Ai,f=0;f<s.length;f++)a(s[f]);return a})({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var f=0,d=new a(D),m=s.document.createTextNode("");d.observe(m,{characterData:!0}),l=function(){m.data=f=++f%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,l=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var k=s.document.createElement("script");k.onreadystatechange=function(){D(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},s.document.documentElement.appendChild(k)}:l=function(){setTimeout(D,0)};var y,C=[];function D(){y=!0;for(var k,X,B=C.length;B;){for(X=C,C=[],k=-1;++k<B;)X[k]();B=C.length}y=!1}o.exports=N;function N(k){C.push(k)===1&&!y&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var l={},f=["REJECTED"],d=["FULFILLED"],m=["PENDING"];o.exports=E;function E(K){if(typeof K!="function")throw new TypeError("resolver must be a function");this.state=m,this.queue=[],this.outcome=void 0,K!==a&&N(this,K)}E.prototype.catch=function(K){return this.then(null,K)},E.prototype.then=function(K,ce){if(typeof K!="function"&&this.state===d||typeof ce!="function"&&this.state===f)return this;var se=new this.constructor(a);if(this.state!==m){var me=this.state===d?K:ce;C(se,me,this.outcome)}else this.queue.push(new y(se,K,ce));return se};function y(K,ce,se){this.promise=K,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(K){l.resolve(this.promise,K)},y.prototype.otherCallFulfilled=function(K){C(this.promise,this.onFulfilled,K)},y.prototype.callRejected=function(K){l.reject(this.promise,K)},y.prototype.otherCallRejected=function(K){C(this.promise,this.onRejected,K)};function C(K,ce,se){s(function(){var me;try{me=ce(se)}catch(Pe){return l.reject(K,Pe)}me===K?l.reject(K,new TypeError("Cannot resolve promise with itself")):l.resolve(K,me)})}l.resolve=function(K,ce){var se=k(D,ce);if(se.status==="error")return l.reject(K,se.value);var me=se.value;if(me)N(K,me);else{K.state=d,K.outcome=ce;for(var Pe=-1,Se=K.queue.length;++Pe<Se;)K.queue[Pe].callFulfilled(ce)}return K},l.reject=function(K,ce){K.state=f,K.outcome=ce;for(var se=-1,me=K.queue.length;++se<me;)K.queue[se].callRejected(ce);return K};function D(K){var ce=K&&K.then;if(K&&(typeof K=="object"||typeof K=="function")&&typeof ce=="function")return function(){ce.apply(K,arguments)}}function N(K,ce){var se=!1;function me(Ge){se||(se=!0,l.reject(K,Ge))}function Pe(Ge){se||(se=!0,l.resolve(K,Ge))}function Se(){ce(Pe,me)}var Re=k(Se);Re.status==="error"&&me(Re.value)}function k(K,ce){var se={};try{se.value=K(ce),se.status="success"}catch(me){se.status="error",se.value=me}return se}E.resolve=X;function X(K){return K instanceof this?K:l.resolve(new this(a),K)}E.reject=B;function B(K){var ce=new this(a);return l.reject(ce,K)}E.all=Q;function Q(K){var ce=this;if(Object.prototype.toString.call(K)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=K.length,me=!1;if(!se)return this.resolve([]);for(var Pe=new Array(se),Se=0,Re=-1,Ge=new this(a);++Re<se;)Ze(K[Re],Re);return Ge;function Ze(kt,A){ce.resolve(kt).then(R,function(V){me||(me=!0,l.reject(Ge,V))});function R(V){Pe[A]=V,++Se===se&&!me&&(me=!0,l.resolve(Ge,Pe))}}}E.race=_e;function _e(K){var ce=this;if(Object.prototype.toString.call(K)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=K.length,me=!1;if(!se)return this.resolve([]);for(var Pe=-1,Se=new this(a);++Pe<se;)Re(K[Pe]);return Se;function Re(Ge){ce.resolve(Ge).then(function(Ze){me||(me=!0,l.resolve(Se,Ze))},function(Ze){me||(me=!0,l.reject(Se,Ze))})}}},{1:1}],3:[function(n,o,i){(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,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function a(p,b){if(!(p instanceof b))throw new TypeError("Cannot call a class as a function")}function l(){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 f=l();function d(){try{if(!f||!f.open)return!1;var p=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),b=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||b)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function m(p,b){p=p||[],b=b||{};try{return new Blob(p,b)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,I=0;I<p.length;I+=1)T.append(p[I]);return T.getBlob(b.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(p,b){b&&p.then(function(g){b(null,g)},function(g){b(g)})}function C(p,b,g){typeof b=="function"&&p.then(b),typeof g=="function"&&p.catch(g)}function D(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function N(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",X=void 0,B={},Q=Object.prototype.toString,_e="readonly",K="readwrite";function ce(p){for(var b=p.length,g=new ArrayBuffer(b),T=new Uint8Array(g),I=0;I<b;I++)T[I]=p.charCodeAt(I);return g}function se(p){return new E(function(b){var g=p.transaction(k,K),T=m([""]);g.objectStore(k).put(T,"key"),g.onabort=function(I){I.preventDefault(),I.stopPropagation(),b(!1)},g.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);b(S||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function me(p){return typeof X=="boolean"?E.resolve(X):se(p).then(function(b){return X=b,X})}function Pe(p){var b=B[p.name],g={};g.promise=new E(function(T,I){g.resolve=T,g.reject=I}),b.deferredOperations.push(g),b.dbReady?b.dbReady=b.dbReady.then(function(){return g.promise}):b.dbReady=g.promise}function Se(p){var b=B[p.name],g=b.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Re(p,b){var g=B[p.name],T=g.deferredOperations.pop();if(T)return T.reject(b),T.promise}function Ge(p,b){return new E(function(g,T){if(B[p.name]=B[p.name]||qe(),p.db)if(b)Pe(p),p.db.close();else return g(p.db);var I=[p.name];b&&I.push(p.version);var S=f.open.apply(f,I);b&&(S.onupgradeneeded=function(L){var G=S.result;try{G.createObjectStore(p.storeName),L.oldVersion<=1&&G.createObjectStore(k)}catch(z){if(z.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+L.oldVersion+" to version "+L.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw z}}),S.onerror=function(L){L.preventDefault(),T(S.error)},S.onsuccess=function(){var L=S.result;L.onversionchange=function(G){G.target.close()},g(L),Se(p)}})}function Ze(p){return Ge(p,!1)}function kt(p){return Ge(p,!0)}function A(p,b){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),T=p.version<p.db.version,I=p.version>p.db.version;if(T&&(p.version!==b&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),I||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function R(p){return new E(function(b,g){var T=new FileReader;T.onerror=g,T.onloadend=function(I){var S=btoa(I.target.result||"");b({__local_forage_encoded_blob:!0,data:S,type:p.type})},T.readAsBinaryString(p)})}function V(p){var b=ce(atob(p.data));return m([b],{type:p.type})}function U(p){return p&&p.__local_forage_encoded_blob}function H(p){var b=this,g=b._initReady().then(function(){var T=B[b._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(g,p,p),g}function ne(p){Pe(p);for(var b=B[p.name],g=b.forages,T=0;T<g.length;T++){var I=g[T];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return p.db=null,Ze(p).then(function(S){return p.db=S,A(p)?kt(p):S}).then(function(S){p.db=b.db=S;for(var L=0;L<g.length;L++)g[L]._dbInfo.db=S}).catch(function(S){throw Re(p,S),S})}function ge(p,b,g,T){T===void 0&&(T=1);try{var I=p.db.transaction(p.storeName,b);g(null,I)}catch(S){if(T>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return E.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),kt(p)}).then(function(){return ne(p).then(function(){ge(p,b,g,T-1)})}).catch(g);g(S)}}function qe(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function tt(p){var b=this,g={db:null};if(p)for(var T in p)g[T]=p[T];var I=B[g.name];I||(I=qe(),B[g.name]=I),I.forages.push(b),b._initReady||(b._initReady=b.ready,b.ready=H);var S=[];function L(){return E.resolve()}for(var G=0;G<I.forages.length;G++){var z=I.forages[G];z!==b&&S.push(z._initReady().catch(L))}var q=I.forages.slice(0);return E.all(S).then(function(){return g.db=I.db,Ze(g)}).then(function(J){return g.db=J,A(g,b._defaultConfig.version)?kt(g):J}).then(function(J){g.db=I.db=J,b._dbInfo=g;for(var te=0;te<q.length;te++){var ve=q[te];ve!==b&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function rt(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){ge(g._dbInfo,_e,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=z.get(p);q.onsuccess=function(){var J=q.result;J===void 0&&(J=null),U(J)&&(J=V(J)),I(J)},q.onerror=function(){S(q.error)}}catch(J){S(J)}})}).catch(S)});return y(T,b),T}function _t(p,b){var g=this,T=new E(function(I,S){g.ready().then(function(){ge(g._dbInfo,_e,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=z.openCursor(),J=1;q.onsuccess=function(){var te=q.result;if(te){var ve=te.value;U(ve)&&(ve=V(ve));var Oe=p(ve,te.key,J++);Oe!==void 0?I(Oe):te.continue()}else I()},q.onerror=function(){S(q.error)}}catch(te){S(te)}})}).catch(S)});return y(T,b),T}function Et(p,b,g){var T=this;p=D(p);var I=new E(function(S,L){var G;T.ready().then(function(){return G=T._dbInfo,Q.call(b)==="[object Blob]"?me(G.db).then(function(z){return z?b:R(b)}):b}).then(function(z){ge(T._dbInfo,K,function(q,J){if(q)return L(q);try{var te=J.objectStore(T._dbInfo.storeName);z===null&&(z=void 0);var ve=te.put(z,p);J.oncomplete=function(){z===void 0&&(z=null),S(z)},J.onabort=J.onerror=function(){var Oe=ve.error?ve.error:ve.transaction.error;L(Oe)}}catch(Oe){L(Oe)}})}).catch(L)});return y(I,g),I}function st(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){ge(g._dbInfo,K,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=z.delete(p);G.oncomplete=function(){I()},G.onerror=function(){S(q.error)},G.onabort=function(){var J=q.error?q.error:q.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(T,b),T}function be(p){var b=this,g=new E(function(T,I){b.ready().then(function(){ge(b._dbInfo,K,function(S,L){if(S)return I(S);try{var G=L.objectStore(b._dbInfo.storeName),z=G.clear();L.oncomplete=function(){T()},L.onabort=L.onerror=function(){var q=z.error?z.error:z.transaction.error;I(q)}}catch(q){I(q)}})}).catch(I)});return y(g,p),g}function He(p){var b=this,g=new E(function(T,I){b.ready().then(function(){ge(b._dbInfo,_e,function(S,L){if(S)return I(S);try{var G=L.objectStore(b._dbInfo.storeName),z=G.count();z.onsuccess=function(){T(z.result)},z.onerror=function(){I(z.error)}}catch(q){I(q)}})}).catch(I)});return y(g,p),g}function Ae(p,b){var g=this,T=new E(function(I,S){if(p<0){I(null);return}g.ready().then(function(){ge(g._dbInfo,_e,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=!1,J=z.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){I(null);return}p===0||q?I(te.key):(q=!0,te.advance(p))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(T,b),T}function $e(p){var b=this,g=new E(function(T,I){b.ready().then(function(){ge(b._dbInfo,_e,function(S,L){if(S)return I(S);try{var G=L.objectStore(b._dbInfo.storeName),z=G.openKeyCursor(),q=[];z.onsuccess=function(){var J=z.result;if(!J){T(q);return}q.push(J.key),J.continue()},z.onerror=function(){I(z.error)}}catch(J){I(J)}})}).catch(I)});return y(g,p),g}function De(p,b){b=N.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;if(!p.name)I=E.reject("Invalid arguments");else{var S=p.name===g.name&&T._dbInfo.db,L=S?E.resolve(T._dbInfo.db):Ze(p).then(function(G){var z=B[p.name],q=z.forages;z.db=G;for(var J=0;J<q.length;J++)q[J]._dbInfo.db=G;return G});p.storeName?I=L.then(function(G){if(G.objectStoreNames.contains(p.storeName)){var z=G.version+1;Pe(p);var q=B[p.name],J=q.forages;G.close();for(var te=0;te<J.length;te++){var ve=J[te];ve._dbInfo.db=null,ve._dbInfo.version=z}var Oe=new E(function(Ne,ot){var et=f.open(p.name,z);et.onerror=function(Zt){var Ri=et.result;Ri.close(),ot(Zt)},et.onupgradeneeded=function(){var Zt=et.result;Zt.deleteObjectStore(p.storeName)},et.onsuccess=function(){var Zt=et.result;Zt.close(),Ne(Zt)}});return Oe.then(function(Ne){q.db=Ne;for(var ot=0;ot<J.length;ot++){var et=J[ot];et._dbInfo.db=Ne,Se(et._dbInfo)}}).catch(function(Ne){throw(Re(p,Ne)||E.resolve()).catch(function(){}),Ne})}}):I=L.then(function(G){Pe(p);var z=B[p.name],q=z.forages;G.close();for(var J=0;J<q.length;J++){var te=q[J];te._dbInfo.db=null}var ve=new E(function(Oe,Ne){var ot=f.deleteDatabase(p.name);ot.onerror=function(){var et=ot.result;et&&et.close(),Ne(ot.error)},ot.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},ot.onsuccess=function(){var et=ot.result;et&&et.close(),Oe(et)}});return ve.then(function(Oe){z.db=Oe;for(var Ne=0;Ne<q.length;Ne++){var ot=q[Ne];Se(ot._dbInfo)}}).catch(function(Oe){throw(Re(p,Oe)||E.resolve()).catch(function(){}),Oe})})}return y(I,b),I}var Wt={_driver:"asyncStorage",_initStorage:tt,_support:d(),iterate:_t,getItem:rt,setItem:Et,removeItem:st,clear:be,length:He,key:Ae,keys:$e,dropInstance:De};function h(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ue="blob",Ee="si08",ye="ui08",Le="uic8",ke="si16",nt="si32",mr="ur16",Kr="ui32",wo="fl32",dr="fl64",hr=O+W.length,dm=Object.prototype.toString;function hm(p){var b=p.length*.75,g=p.length,T,I=0,S,L,G,z;p[p.length-1]==="="&&(b--,p[p.length-2]==="="&&b--);var q=new ArrayBuffer(b),J=new Uint8Array(q);for(T=0;T<g;T+=4)S=c.indexOf(p[T]),L=c.indexOf(p[T+1]),G=c.indexOf(p[T+2]),z=c.indexOf(p[T+3]),J[I++]=S<<2|L>>4,J[I++]=(L&15)<<4|G>>2,J[I++]=(G&3)<<6|z&63;return q}function zl(p){var b=new Uint8Array(p),g="",T;for(T=0;T<b.length;T+=3)g+=c[b[T]>>2],g+=c[(b[T]&3)<<4|b[T+1]>>4],g+=c[(b[T+1]&15)<<2|b[T+2]>>6],g+=c[b[T+2]&63];return b.length%3===2?g=g.substring(0,g.length-1)+"=":b.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Uv(p,b){var g="";if(p&&(g=dm.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&dm.call(p.buffer)==="[object ArrayBuffer]")){var T,I=x;p instanceof ArrayBuffer?(T=p,I+=W):(T=p.buffer,g==="[object Int8Array]"?I+=Ee:g==="[object Uint8Array]"?I+=ye:g==="[object Uint8ClampedArray]"?I+=Le:g==="[object Int16Array]"?I+=ke:g==="[object Uint16Array]"?I+=mr:g==="[object Int32Array]"?I+=nt:g==="[object Uint32Array]"?I+=Kr:g==="[object Float32Array]"?I+=wo:g==="[object Float64Array]"?I+=dr:b(new Error("Failed to get type for BinaryArray"))),b(I+zl(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var L=u+p.type+"~"+zl(this.result);b(x+ue+L)},S.readAsArrayBuffer(p)}else try{b(JSON.stringify(p))}catch(L){console.error("Couldn't convert value into a JSON string: ",p),b(null,L)}}function kv(p){if(p.substring(0,O)!==x)return JSON.parse(p);var b=p.substring(hr),g=p.substring(O,hr),T;if(g===ue&&v.test(b)){var I=b.match(v);T=I[1],b=b.substring(I[0].length)}var S=hm(b);switch(g){case W:return S;case ue:return m([S],{type:T});case Ee:return new Int8Array(S);case ye:return new Uint8Array(S);case Le:return new Uint8ClampedArray(S);case ke:return new Int16Array(S);case mr:return new Uint16Array(S);case nt:return new Int32Array(S);case Kr:return new Uint32Array(S);case wo:return new Float32Array(S);case dr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var ql={serialize:Uv,deserialize:kv,stringToBuffer:hm,bufferToString:zl};function gm(p,b,g,T){p.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function Fv(p){var b=this,g={db:null};if(p)for(var T in p)g[T]=typeof p[T]!="string"?p[T].toString():p[T];var I=new E(function(S,L){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(G){return L(G)}g.db.transaction(function(G){gm(G,g,function(){b._dbInfo=g,S()},function(z,q){L(q)})},L)});return g.serializer=ql,I}function vn(p,b,g,T,I,S){p.executeSql(g,T,I,function(L,G){G.code===G.SYNTAX_ERR?L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(z,q){q.rows.length?S(z,G):gm(z,b,function(){z.executeSql(g,T,I,S)},S)},S):S(L,G)},S)}function Hv(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"SELECT * FROM "+L.storeName+" WHERE key = ? LIMIT 1",[p],function(z,q){var J=q.rows.length?q.rows.item(0).value:null;J&&(J=L.serializer.deserialize(J)),I(J)},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function $v(p,b){var g=this,T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"SELECT * FROM "+L.storeName,[],function(z,q){for(var J=q.rows,te=J.length,ve=0;ve<te;ve++){var Oe=J.item(ve),Ne=Oe.value;if(Ne&&(Ne=L.serializer.deserialize(Ne)),Ne=p(Ne,Oe.key,ve+1),Ne!==void 0){I(Ne);return}}I()},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function ym(p,b,g,T){var I=this;p=D(p);var S=new E(function(L,G){I.ready().then(function(){b===void 0&&(b=null);var z=b,q=I._dbInfo;q.serializer.serialize(b,function(J,te){te?G(te):q.db.transaction(function(ve){vn(ve,q,"INSERT OR REPLACE INTO "+q.storeName+" (key, value) VALUES (?, ?)",[p,J],function(){L(z)},function(Oe,Ne){G(Ne)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){L(ym.apply(I,[p,z,g,T-1]));return}G(ve)}})})}).catch(G)});return y(S,g),S}function Vv(p,b,g){return ym.apply(this,[p,b,g,1])}function Wv(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"DELETE FROM "+L.storeName+" WHERE key = ?",[p],function(){I()},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function jv(p){var b=this,g=new E(function(T,I){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(L){vn(L,S,"DELETE FROM "+S.storeName,[],function(){T()},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function Gv(p){var b=this,g=new E(function(T,I){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(L){vn(L,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(G,z){var q=z.rows.item(0).c;T(q)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function zv(p,b){var g=this,T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"SELECT key FROM "+L.storeName+" WHERE id = ? LIMIT 1",[p+1],function(z,q){var J=q.rows.length?q.rows.item(0).key:null;I(J)},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function qv(p){var b=this,g=new E(function(T,I){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(L){vn(L,S,"SELECT key FROM "+S.storeName,[],function(G,z){for(var q=[],J=0;J<z.rows.length;J++)q.push(z.rows.item(J).key);T(q)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function Yv(p){return new E(function(b,g){p.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,S){for(var L=[],G=0;G<S.rows.length;G++)L.push(S.rows.item(G).name);b({db:p,storeNames:L})},function(I,S){g(S)})},function(T){g(T)})})}function Kv(p,b){b=N.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;return p.name?I=new E(function(S){var L;p.name===g.name?L=T._dbInfo.db:L=openDatabase(p.name,"","",0),p.storeName?S({db:L,storeNames:[p.storeName]}):S(Yv(L))}).then(function(S){return new E(function(L,G){S.db.transaction(function(z){function q(Oe){return new E(function(Ne,ot){z.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Ne()},function(et,Zt){ot(Zt)})})}for(var J=[],te=0,ve=S.storeNames.length;te<ve;te++)J.push(q(S.storeNames[te]));E.all(J).then(function(){L()}).catch(function(Oe){G(Oe)})},function(z){G(z)})})}):I=E.reject("Invalid arguments"),y(I,b),I}var Xv={_driver:"webSQLStorage",_initStorage:Fv,_support:h(),iterate:$v,getItem:Hv,setItem:Vv,removeItem:Wv,clear:jv,length:Gv,key:zv,keys:qv,dropInstance:Kv};function Jv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vm(p,b){var g=p.name+"/";return p.storeName!==b.storeName&&(g+=p.storeName+"/"),g}function Qv(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch{return!0}}function Zv(){return!Qv()||localStorage.length>0}function e_(p){var b=this,g={};if(p)for(var T in p)g[T]=p[T];return g.keyPrefix=vm(p,b._defaultConfig),Zv()?(b._dbInfo=g,g.serializer=ql,E.resolve()):E.reject()}function t_(p){var b=this,g=b.ready().then(function(){for(var T=b._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var S=localStorage.key(I);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,p),g}function r_(p,b){var g=this;p=D(p);var T=g.ready().then(function(){var I=g._dbInfo,S=localStorage.getItem(I.keyPrefix+p);return S&&(S=I.serializer.deserialize(S)),S});return y(T,b),T}function n_(p,b){var g=this,T=g.ready().then(function(){for(var I=g._dbInfo,S=I.keyPrefix,L=S.length,G=localStorage.length,z=1,q=0;q<G;q++){var J=localStorage.key(q);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=I.serializer.deserialize(te)),te=p(te,J.substring(L),z++),te!==void 0)return te}}});return y(T,b),T}function o_(p,b){var g=this,T=g.ready().then(function(){var I=g._dbInfo,S;try{S=localStorage.key(p)}catch{S=null}return S&&(S=S.substring(I.keyPrefix.length)),S});return y(T,b),T}function i_(p){var b=this,g=b.ready().then(function(){for(var T=b._dbInfo,I=localStorage.length,S=[],L=0;L<I;L++){var G=localStorage.key(L);G.indexOf(T.keyPrefix)===0&&S.push(G.substring(T.keyPrefix.length))}return S});return y(g,p),g}function s_(p){var b=this,g=b.keys().then(function(T){return T.length});return y(g,p),g}function a_(p,b){var g=this;p=D(p);var T=g.ready().then(function(){var I=g._dbInfo;localStorage.removeItem(I.keyPrefix+p)});return y(T,b),T}function c_(p,b,g){var T=this;p=D(p);var I=T.ready().then(function(){b===void 0&&(b=null);var S=b;return new E(function(L,G){var z=T._dbInfo;z.serializer.serialize(b,function(q,J){if(J)G(J);else try{localStorage.setItem(z.keyPrefix+p,q),L(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(te),G(te)}})})});return y(I,g),I}function l_(p,b){if(b=N.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var T=this,I;return p.name?I=new E(function(S){p.storeName?S(vm(p,T._defaultConfig)):S(p.name+"/")}).then(function(S){for(var L=localStorage.length-1;L>=0;L--){var G=localStorage.key(L);G.indexOf(S)===0&&localStorage.removeItem(G)}}):I=E.reject("Invalid arguments"),y(I,b),I}var u_={_driver:"localStorageWrapper",_initStorage:e_,_support:Jv(),iterate:n_,getItem:r_,setItem:c_,removeItem:a_,clear:t_,length:s_,key:o_,keys:i_,dropInstance:l_},f_=function(b,g){return b===g||typeof b=="number"&&typeof g=="number"&&isNaN(b)&&isNaN(g)},p_=function(b,g){for(var T=b.length,I=0;I<T;){if(f_(b[I],g))return!0;I++}return!1},_m=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Ci={},Em={},bo={INDEXEDDB:Wt,WEBSQL:Xv,LOCALSTORAGE:u_},m_=[bo.INDEXEDDB._driver,bo.WEBSQL._driver,bo.LOCALSTORAGE._driver],Ws=["dropInstance"],Yl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ws),d_={description:"",driver:m_.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function h_(p,b){p[b]=function(){var g=arguments;return p.ready().then(function(){return p[b].apply(p,g)})}}function Kl(){for(var p=1;p<arguments.length;p++){var b=arguments[p];if(b)for(var g in b)b.hasOwnProperty(g)&&(_m(b[g])?arguments[0][g]=b[g].slice():arguments[0][g]=b[g])}return arguments[0]}var g_=(function(){function p(b){a(this,p);for(var g in bo)if(bo.hasOwnProperty(g)){var T=bo[g],I=T._driver;this[g]=I,Ci[I]||this.defineDriver(T)}this._defaultConfig=Kl({},d_),this._config=Kl({},this._defaultConfig,b),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,T,I){var S=new E(function(L,G){try{var z=g._driver,q=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){G(q);return}for(var J=Yl.concat("_initStorage"),te=0,ve=J.length;te<ve;te++){var Oe=J[te],Ne=!p_(Ws,Oe);if((Ne||g[Oe])&&typeof g[Oe]!="function"){G(q);return}}var ot=function(){for(var Ri=function(__){return function(){var E_=new Error("Method "+__+" is not implemented by the current driver"),wm=E.reject(E_);return y(wm,arguments[arguments.length-1]),wm}},Xl=0,v_=Ws.length;Xl<v_;Xl++){var Jl=Ws[Xl];g[Jl]||(g[Jl]=Ri(Jl))}};ot();var et=function(Ri){Ci[z]&&console.info("Redefining LocalForage driver: "+z),Ci[z]=g,Em[z]=Ri,L()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(et,G):et(!!g._support):et(!0)}catch(Zt){G(Zt)}});return C(S,T,I),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,T,I){var S=Ci[g]?E.resolve(Ci[g]):E.reject(new Error("Driver not found."));return C(S,T,I),S},p.prototype.getSerializer=function(g){var T=E.resolve(ql);return C(T,g),T},p.prototype.ready=function(g){var T=this,I=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return C(I,g,g),I},p.prototype.setDriver=function(g,T,I){var S=this;_m(g)||(g=[g]);var L=this._getSupportedDrivers(g);function G(){S._config.driver=S.driver()}function z(te){return S._extend(te),G(),S._ready=S._initStorage(S._config),S._ready}function q(te){return function(){var ve=0;function Oe(){for(;ve<te.length;){var Ne=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Ne).then(z).catch(Oe)}G();var ot=new Error("No available storage method found.");return S._driverSet=E.reject(ot),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=J.then(function(){var te=L[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,G(),S._wrapLibraryMethodsWithReady(),S._initDriver=q(L)})}).catch(function(){G();var te=new Error("No available storage method found.");return S._driverSet=E.reject(te),S._driverSet}),C(this._driverSet,T,I),this._driverSet},p.prototype.supports=function(g){return!!Em[g]},p.prototype._extend=function(g){Kl(this,g)},p.prototype._getSupportedDrivers=function(g){for(var T=[],I=0,S=g.length;I<S;I++){var L=g[I];this.supports(L)&&T.push(L)}return T},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Yl.length;g<T;g++)h_(this,Yl[g])},p.prototype.createInstance=function(g){return new p(g)},p})(),y_=new g_;o.exports=y_},{3:3}]},{},[4])(4)})});var Qf=Ql((nc,hg)=>{"use strict";(function(t,e){typeof nc=="object"&&typeof hg<"u"?e(nc):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(nc,function(t){"use strict";function e(A){var R,V,U=new Error(A);return R=U,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,U}function r(A,R,V){var U=R.slice(0,V).split(/\n/),H=U.length,ne=U[H-1].length+1;throw e(A+=" at line "+H+" col "+ne+`:
1
+ import{a as js,b as Gs,c as Sm,d as Tm,e as Im,f as xm,g as Cm,h as gr,i as zs,j as w,k as Rm,l as Am,m as Dm,n as Om,o as Jr}from"./chunk-GJ2LOJY5.js";import{a as _,b as Z,c as Ai,d as bm,e as Ql,f as Xr,g as So}from"./chunk-V7UGKYBN.js";var Zl=Ql(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.URLBuilder=void 0;var w_=(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})();qs.URLBuilder=w_});var Fm=Ql((km,au)=>{"use strict";(function(t){if(typeof km=="object"&&typeof au<"u")au.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(o,i,s){function a(d,m){if(!i[d]){if(!o[d]){var E=typeof Ai=="function"&&Ai;if(!m&&E)return E(d,!0);if(l)return l(d,!0);var y=new Error("Cannot find module '"+d+"'");throw y.code="MODULE_NOT_FOUND",y}var C=i[d]={exports:{}};o[d][0].call(C.exports,function(D){var N=o[d][1][D];return a(N||D)},C,C.exports,n,o,i,s)}return i[d].exports}for(var l=typeof Ai=="function"&&Ai,f=0;f<s.length;f++)a(s[f]);return a})({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var f=0,d=new a(D),m=s.document.createTextNode("");d.observe(m,{characterData:!0}),l=function(){m.data=f=++f%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,l=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var k=s.document.createElement("script");k.onreadystatechange=function(){D(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},s.document.documentElement.appendChild(k)}:l=function(){setTimeout(D,0)};var y,C=[];function D(){y=!0;for(var k,X,B=C.length;B;){for(X=C,C=[],k=-1;++k<B;)X[k]();B=C.length}y=!1}o.exports=N;function N(k){C.push(k)===1&&!y&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var l={},f=["REJECTED"],d=["FULFILLED"],m=["PENDING"];o.exports=E;function E(K){if(typeof K!="function")throw new TypeError("resolver must be a function");this.state=m,this.queue=[],this.outcome=void 0,K!==a&&N(this,K)}E.prototype.catch=function(K){return this.then(null,K)},E.prototype.then=function(K,ce){if(typeof K!="function"&&this.state===d||typeof ce!="function"&&this.state===f)return this;var se=new this.constructor(a);if(this.state!==m){var me=this.state===d?K:ce;C(se,me,this.outcome)}else this.queue.push(new y(se,K,ce));return se};function y(K,ce,se){this.promise=K,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(K){l.resolve(this.promise,K)},y.prototype.otherCallFulfilled=function(K){C(this.promise,this.onFulfilled,K)},y.prototype.callRejected=function(K){l.reject(this.promise,K)},y.prototype.otherCallRejected=function(K){C(this.promise,this.onRejected,K)};function C(K,ce,se){s(function(){var me;try{me=ce(se)}catch(Pe){return l.reject(K,Pe)}me===K?l.reject(K,new TypeError("Cannot resolve promise with itself")):l.resolve(K,me)})}l.resolve=function(K,ce){var se=k(D,ce);if(se.status==="error")return l.reject(K,se.value);var me=se.value;if(me)N(K,me);else{K.state=d,K.outcome=ce;for(var Pe=-1,Se=K.queue.length;++Pe<Se;)K.queue[Pe].callFulfilled(ce)}return K},l.reject=function(K,ce){K.state=f,K.outcome=ce;for(var se=-1,me=K.queue.length;++se<me;)K.queue[se].callRejected(ce);return K};function D(K){var ce=K&&K.then;if(K&&(typeof K=="object"||typeof K=="function")&&typeof ce=="function")return function(){ce.apply(K,arguments)}}function N(K,ce){var se=!1;function me(Ge){se||(se=!0,l.reject(K,Ge))}function Pe(Ge){se||(se=!0,l.resolve(K,Ge))}function Se(){ce(Pe,me)}var Re=k(Se);Re.status==="error"&&me(Re.value)}function k(K,ce){var se={};try{se.value=K(ce),se.status="success"}catch(me){se.status="error",se.value=me}return se}E.resolve=X;function X(K){return K instanceof this?K:l.resolve(new this(a),K)}E.reject=B;function B(K){var ce=new this(a);return l.reject(ce,K)}E.all=Q;function Q(K){var ce=this;if(Object.prototype.toString.call(K)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=K.length,me=!1;if(!se)return this.resolve([]);for(var Pe=new Array(se),Se=0,Re=-1,Ge=new this(a);++Re<se;)Ze(K[Re],Re);return Ge;function Ze(kt,A){ce.resolve(kt).then(R,function(V){me||(me=!0,l.reject(Ge,V))});function R(V){Pe[A]=V,++Se===se&&!me&&(me=!0,l.resolve(Ge,Pe))}}}E.race=_e;function _e(K){var ce=this;if(Object.prototype.toString.call(K)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=K.length,me=!1;if(!se)return this.resolve([]);for(var Pe=-1,Se=new this(a);++Pe<se;)Re(K[Pe]);return Se;function Re(Ge){ce.resolve(Ge).then(function(Ze){me||(me=!0,l.resolve(Se,Ze))},function(Ze){me||(me=!0,l.reject(Se,Ze))})}}},{1:1}],3:[function(n,o,i){(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,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function a(p,b){if(!(p instanceof b))throw new TypeError("Cannot call a class as a function")}function l(){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 f=l();function d(){try{if(!f||!f.open)return!1;var p=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),b=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||b)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function m(p,b){p=p||[],b=b||{};try{return new Blob(p,b)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,I=0;I<p.length;I+=1)T.append(p[I]);return T.getBlob(b.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(p,b){b&&p.then(function(g){b(null,g)},function(g){b(g)})}function C(p,b,g){typeof b=="function"&&p.then(b),typeof g=="function"&&p.catch(g)}function D(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function N(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",X=void 0,B={},Q=Object.prototype.toString,_e="readonly",K="readwrite";function ce(p){for(var b=p.length,g=new ArrayBuffer(b),T=new Uint8Array(g),I=0;I<b;I++)T[I]=p.charCodeAt(I);return g}function se(p){return new E(function(b){var g=p.transaction(k,K),T=m([""]);g.objectStore(k).put(T,"key"),g.onabort=function(I){I.preventDefault(),I.stopPropagation(),b(!1)},g.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);b(S||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function me(p){return typeof X=="boolean"?E.resolve(X):se(p).then(function(b){return X=b,X})}function Pe(p){var b=B[p.name],g={};g.promise=new E(function(T,I){g.resolve=T,g.reject=I}),b.deferredOperations.push(g),b.dbReady?b.dbReady=b.dbReady.then(function(){return g.promise}):b.dbReady=g.promise}function Se(p){var b=B[p.name],g=b.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Re(p,b){var g=B[p.name],T=g.deferredOperations.pop();if(T)return T.reject(b),T.promise}function Ge(p,b){return new E(function(g,T){if(B[p.name]=B[p.name]||qe(),p.db)if(b)Pe(p),p.db.close();else return g(p.db);var I=[p.name];b&&I.push(p.version);var S=f.open.apply(f,I);b&&(S.onupgradeneeded=function(L){var G=S.result;try{G.createObjectStore(p.storeName),L.oldVersion<=1&&G.createObjectStore(k)}catch(z){if(z.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+L.oldVersion+" to version "+L.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw z}}),S.onerror=function(L){L.preventDefault(),T(S.error)},S.onsuccess=function(){var L=S.result;L.onversionchange=function(G){G.target.close()},g(L),Se(p)}})}function Ze(p){return Ge(p,!1)}function kt(p){return Ge(p,!0)}function A(p,b){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),T=p.version<p.db.version,I=p.version>p.db.version;if(T&&(p.version!==b&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),I||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function R(p){return new E(function(b,g){var T=new FileReader;T.onerror=g,T.onloadend=function(I){var S=btoa(I.target.result||"");b({__local_forage_encoded_blob:!0,data:S,type:p.type})},T.readAsBinaryString(p)})}function V(p){var b=ce(atob(p.data));return m([b],{type:p.type})}function U(p){return p&&p.__local_forage_encoded_blob}function H(p){var b=this,g=b._initReady().then(function(){var T=B[b._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(g,p,p),g}function ne(p){Pe(p);for(var b=B[p.name],g=b.forages,T=0;T<g.length;T++){var I=g[T];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return p.db=null,Ze(p).then(function(S){return p.db=S,A(p)?kt(p):S}).then(function(S){p.db=b.db=S;for(var L=0;L<g.length;L++)g[L]._dbInfo.db=S}).catch(function(S){throw Re(p,S),S})}function ge(p,b,g,T){T===void 0&&(T=1);try{var I=p.db.transaction(p.storeName,b);g(null,I)}catch(S){if(T>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return E.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),kt(p)}).then(function(){return ne(p).then(function(){ge(p,b,g,T-1)})}).catch(g);g(S)}}function qe(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function tt(p){var b=this,g={db:null};if(p)for(var T in p)g[T]=p[T];var I=B[g.name];I||(I=qe(),B[g.name]=I),I.forages.push(b),b._initReady||(b._initReady=b.ready,b.ready=H);var S=[];function L(){return E.resolve()}for(var G=0;G<I.forages.length;G++){var z=I.forages[G];z!==b&&S.push(z._initReady().catch(L))}var q=I.forages.slice(0);return E.all(S).then(function(){return g.db=I.db,Ze(g)}).then(function(J){return g.db=J,A(g,b._defaultConfig.version)?kt(g):J}).then(function(J){g.db=I.db=J,b._dbInfo=g;for(var te=0;te<q.length;te++){var ve=q[te];ve!==b&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function rt(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){ge(g._dbInfo,_e,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=z.get(p);q.onsuccess=function(){var J=q.result;J===void 0&&(J=null),U(J)&&(J=V(J)),I(J)},q.onerror=function(){S(q.error)}}catch(J){S(J)}})}).catch(S)});return y(T,b),T}function _t(p,b){var g=this,T=new E(function(I,S){g.ready().then(function(){ge(g._dbInfo,_e,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=z.openCursor(),J=1;q.onsuccess=function(){var te=q.result;if(te){var ve=te.value;U(ve)&&(ve=V(ve));var Oe=p(ve,te.key,J++);Oe!==void 0?I(Oe):te.continue()}else I()},q.onerror=function(){S(q.error)}}catch(te){S(te)}})}).catch(S)});return y(T,b),T}function Et(p,b,g){var T=this;p=D(p);var I=new E(function(S,L){var G;T.ready().then(function(){return G=T._dbInfo,Q.call(b)==="[object Blob]"?me(G.db).then(function(z){return z?b:R(b)}):b}).then(function(z){ge(T._dbInfo,K,function(q,J){if(q)return L(q);try{var te=J.objectStore(T._dbInfo.storeName);z===null&&(z=void 0);var ve=te.put(z,p);J.oncomplete=function(){z===void 0&&(z=null),S(z)},J.onabort=J.onerror=function(){var Oe=ve.error?ve.error:ve.transaction.error;L(Oe)}}catch(Oe){L(Oe)}})}).catch(L)});return y(I,g),I}function st(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){ge(g._dbInfo,K,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=z.delete(p);G.oncomplete=function(){I()},G.onerror=function(){S(q.error)},G.onabort=function(){var J=q.error?q.error:q.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(T,b),T}function be(p){var b=this,g=new E(function(T,I){b.ready().then(function(){ge(b._dbInfo,K,function(S,L){if(S)return I(S);try{var G=L.objectStore(b._dbInfo.storeName),z=G.clear();L.oncomplete=function(){T()},L.onabort=L.onerror=function(){var q=z.error?z.error:z.transaction.error;I(q)}}catch(q){I(q)}})}).catch(I)});return y(g,p),g}function He(p){var b=this,g=new E(function(T,I){b.ready().then(function(){ge(b._dbInfo,_e,function(S,L){if(S)return I(S);try{var G=L.objectStore(b._dbInfo.storeName),z=G.count();z.onsuccess=function(){T(z.result)},z.onerror=function(){I(z.error)}}catch(q){I(q)}})}).catch(I)});return y(g,p),g}function Ae(p,b){var g=this,T=new E(function(I,S){if(p<0){I(null);return}g.ready().then(function(){ge(g._dbInfo,_e,function(L,G){if(L)return S(L);try{var z=G.objectStore(g._dbInfo.storeName),q=!1,J=z.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){I(null);return}p===0||q?I(te.key):(q=!0,te.advance(p))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(T,b),T}function $e(p){var b=this,g=new E(function(T,I){b.ready().then(function(){ge(b._dbInfo,_e,function(S,L){if(S)return I(S);try{var G=L.objectStore(b._dbInfo.storeName),z=G.openKeyCursor(),q=[];z.onsuccess=function(){var J=z.result;if(!J){T(q);return}q.push(J.key),J.continue()},z.onerror=function(){I(z.error)}}catch(J){I(J)}})}).catch(I)});return y(g,p),g}function De(p,b){b=N.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;if(!p.name)I=E.reject("Invalid arguments");else{var S=p.name===g.name&&T._dbInfo.db,L=S?E.resolve(T._dbInfo.db):Ze(p).then(function(G){var z=B[p.name],q=z.forages;z.db=G;for(var J=0;J<q.length;J++)q[J]._dbInfo.db=G;return G});p.storeName?I=L.then(function(G){if(G.objectStoreNames.contains(p.storeName)){var z=G.version+1;Pe(p);var q=B[p.name],J=q.forages;G.close();for(var te=0;te<J.length;te++){var ve=J[te];ve._dbInfo.db=null,ve._dbInfo.version=z}var Oe=new E(function(Ne,ot){var et=f.open(p.name,z);et.onerror=function(Zt){var Ri=et.result;Ri.close(),ot(Zt)},et.onupgradeneeded=function(){var Zt=et.result;Zt.deleteObjectStore(p.storeName)},et.onsuccess=function(){var Zt=et.result;Zt.close(),Ne(Zt)}});return Oe.then(function(Ne){q.db=Ne;for(var ot=0;ot<J.length;ot++){var et=J[ot];et._dbInfo.db=Ne,Se(et._dbInfo)}}).catch(function(Ne){throw(Re(p,Ne)||E.resolve()).catch(function(){}),Ne})}}):I=L.then(function(G){Pe(p);var z=B[p.name],q=z.forages;G.close();for(var J=0;J<q.length;J++){var te=q[J];te._dbInfo.db=null}var ve=new E(function(Oe,Ne){var ot=f.deleteDatabase(p.name);ot.onerror=function(){var et=ot.result;et&&et.close(),Ne(ot.error)},ot.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},ot.onsuccess=function(){var et=ot.result;et&&et.close(),Oe(et)}});return ve.then(function(Oe){z.db=Oe;for(var Ne=0;Ne<q.length;Ne++){var ot=q[Ne];Se(ot._dbInfo)}}).catch(function(Oe){throw(Re(p,Oe)||E.resolve()).catch(function(){}),Oe})})}return y(I,b),I}var Wt={_driver:"asyncStorage",_initStorage:tt,_support:d(),iterate:_t,getItem:rt,setItem:Et,removeItem:st,clear:be,length:He,key:Ae,keys:$e,dropInstance:De};function h(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ue="blob",Ee="si08",ye="ui08",Le="uic8",ke="si16",nt="si32",mr="ur16",Kr="ui32",wo="fl32",dr="fl64",hr=O+W.length,dm=Object.prototype.toString;function hm(p){var b=p.length*.75,g=p.length,T,I=0,S,L,G,z;p[p.length-1]==="="&&(b--,p[p.length-2]==="="&&b--);var q=new ArrayBuffer(b),J=new Uint8Array(q);for(T=0;T<g;T+=4)S=c.indexOf(p[T]),L=c.indexOf(p[T+1]),G=c.indexOf(p[T+2]),z=c.indexOf(p[T+3]),J[I++]=S<<2|L>>4,J[I++]=(L&15)<<4|G>>2,J[I++]=(G&3)<<6|z&63;return q}function zl(p){var b=new Uint8Array(p),g="",T;for(T=0;T<b.length;T+=3)g+=c[b[T]>>2],g+=c[(b[T]&3)<<4|b[T+1]>>4],g+=c[(b[T+1]&15)<<2|b[T+2]>>6],g+=c[b[T+2]&63];return b.length%3===2?g=g.substring(0,g.length-1)+"=":b.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Uv(p,b){var g="";if(p&&(g=dm.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&dm.call(p.buffer)==="[object ArrayBuffer]")){var T,I=x;p instanceof ArrayBuffer?(T=p,I+=W):(T=p.buffer,g==="[object Int8Array]"?I+=Ee:g==="[object Uint8Array]"?I+=ye:g==="[object Uint8ClampedArray]"?I+=Le:g==="[object Int16Array]"?I+=ke:g==="[object Uint16Array]"?I+=mr:g==="[object Int32Array]"?I+=nt:g==="[object Uint32Array]"?I+=Kr:g==="[object Float32Array]"?I+=wo:g==="[object Float64Array]"?I+=dr:b(new Error("Failed to get type for BinaryArray"))),b(I+zl(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var L=u+p.type+"~"+zl(this.result);b(x+ue+L)},S.readAsArrayBuffer(p)}else try{b(JSON.stringify(p))}catch(L){console.error("Couldn't convert value into a JSON string: ",p),b(null,L)}}function kv(p){if(p.substring(0,O)!==x)return JSON.parse(p);var b=p.substring(hr),g=p.substring(O,hr),T;if(g===ue&&v.test(b)){var I=b.match(v);T=I[1],b=b.substring(I[0].length)}var S=hm(b);switch(g){case W:return S;case ue:return m([S],{type:T});case Ee:return new Int8Array(S);case ye:return new Uint8Array(S);case Le:return new Uint8ClampedArray(S);case ke:return new Int16Array(S);case mr:return new Uint16Array(S);case nt:return new Int32Array(S);case Kr:return new Uint32Array(S);case wo:return new Float32Array(S);case dr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var ql={serialize:Uv,deserialize:kv,stringToBuffer:hm,bufferToString:zl};function gm(p,b,g,T){p.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function Fv(p){var b=this,g={db:null};if(p)for(var T in p)g[T]=typeof p[T]!="string"?p[T].toString():p[T];var I=new E(function(S,L){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(G){return L(G)}g.db.transaction(function(G){gm(G,g,function(){b._dbInfo=g,S()},function(z,q){L(q)})},L)});return g.serializer=ql,I}function vn(p,b,g,T,I,S){p.executeSql(g,T,I,function(L,G){G.code===G.SYNTAX_ERR?L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(z,q){q.rows.length?S(z,G):gm(z,b,function(){z.executeSql(g,T,I,S)},S)},S):S(L,G)},S)}function Hv(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"SELECT * FROM "+L.storeName+" WHERE key = ? LIMIT 1",[p],function(z,q){var J=q.rows.length?q.rows.item(0).value:null;J&&(J=L.serializer.deserialize(J)),I(J)},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function $v(p,b){var g=this,T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"SELECT * FROM "+L.storeName,[],function(z,q){for(var J=q.rows,te=J.length,ve=0;ve<te;ve++){var Oe=J.item(ve),Ne=Oe.value;if(Ne&&(Ne=L.serializer.deserialize(Ne)),Ne=p(Ne,Oe.key,ve+1),Ne!==void 0){I(Ne);return}}I()},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function ym(p,b,g,T){var I=this;p=D(p);var S=new E(function(L,G){I.ready().then(function(){b===void 0&&(b=null);var z=b,q=I._dbInfo;q.serializer.serialize(b,function(J,te){te?G(te):q.db.transaction(function(ve){vn(ve,q,"INSERT OR REPLACE INTO "+q.storeName+" (key, value) VALUES (?, ?)",[p,J],function(){L(z)},function(Oe,Ne){G(Ne)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){L(ym.apply(I,[p,z,g,T-1]));return}G(ve)}})})}).catch(G)});return y(S,g),S}function Vv(p,b,g){return ym.apply(this,[p,b,g,1])}function Wv(p,b){var g=this;p=D(p);var T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"DELETE FROM "+L.storeName+" WHERE key = ?",[p],function(){I()},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function jv(p){var b=this,g=new E(function(T,I){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(L){vn(L,S,"DELETE FROM "+S.storeName,[],function(){T()},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function Gv(p){var b=this,g=new E(function(T,I){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(L){vn(L,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(G,z){var q=z.rows.item(0).c;T(q)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function zv(p,b){var g=this,T=new E(function(I,S){g.ready().then(function(){var L=g._dbInfo;L.db.transaction(function(G){vn(G,L,"SELECT key FROM "+L.storeName+" WHERE id = ? LIMIT 1",[p+1],function(z,q){var J=q.rows.length?q.rows.item(0).key:null;I(J)},function(z,q){S(q)})})}).catch(S)});return y(T,b),T}function qv(p){var b=this,g=new E(function(T,I){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(L){vn(L,S,"SELECT key FROM "+S.storeName,[],function(G,z){for(var q=[],J=0;J<z.rows.length;J++)q.push(z.rows.item(J).key);T(q)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function Yv(p){return new E(function(b,g){p.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,S){for(var L=[],G=0;G<S.rows.length;G++)L.push(S.rows.item(G).name);b({db:p,storeNames:L})},function(I,S){g(S)})},function(T){g(T)})})}function Kv(p,b){b=N.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;return p.name?I=new E(function(S){var L;p.name===g.name?L=T._dbInfo.db:L=openDatabase(p.name,"","",0),p.storeName?S({db:L,storeNames:[p.storeName]}):S(Yv(L))}).then(function(S){return new E(function(L,G){S.db.transaction(function(z){function q(Oe){return new E(function(Ne,ot){z.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Ne()},function(et,Zt){ot(Zt)})})}for(var J=[],te=0,ve=S.storeNames.length;te<ve;te++)J.push(q(S.storeNames[te]));E.all(J).then(function(){L()}).catch(function(Oe){G(Oe)})},function(z){G(z)})})}):I=E.reject("Invalid arguments"),y(I,b),I}var Xv={_driver:"webSQLStorage",_initStorage:Fv,_support:h(),iterate:$v,getItem:Hv,setItem:Vv,removeItem:Wv,clear:jv,length:Gv,key:zv,keys:qv,dropInstance:Kv};function Jv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vm(p,b){var g=p.name+"/";return p.storeName!==b.storeName&&(g+=p.storeName+"/"),g}function Qv(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch{return!0}}function Zv(){return!Qv()||localStorage.length>0}function e_(p){var b=this,g={};if(p)for(var T in p)g[T]=p[T];return g.keyPrefix=vm(p,b._defaultConfig),Zv()?(b._dbInfo=g,g.serializer=ql,E.resolve()):E.reject()}function t_(p){var b=this,g=b.ready().then(function(){for(var T=b._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var S=localStorage.key(I);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,p),g}function r_(p,b){var g=this;p=D(p);var T=g.ready().then(function(){var I=g._dbInfo,S=localStorage.getItem(I.keyPrefix+p);return S&&(S=I.serializer.deserialize(S)),S});return y(T,b),T}function n_(p,b){var g=this,T=g.ready().then(function(){for(var I=g._dbInfo,S=I.keyPrefix,L=S.length,G=localStorage.length,z=1,q=0;q<G;q++){var J=localStorage.key(q);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=I.serializer.deserialize(te)),te=p(te,J.substring(L),z++),te!==void 0)return te}}});return y(T,b),T}function o_(p,b){var g=this,T=g.ready().then(function(){var I=g._dbInfo,S;try{S=localStorage.key(p)}catch{S=null}return S&&(S=S.substring(I.keyPrefix.length)),S});return y(T,b),T}function i_(p){var b=this,g=b.ready().then(function(){for(var T=b._dbInfo,I=localStorage.length,S=[],L=0;L<I;L++){var G=localStorage.key(L);G.indexOf(T.keyPrefix)===0&&S.push(G.substring(T.keyPrefix.length))}return S});return y(g,p),g}function s_(p){var b=this,g=b.keys().then(function(T){return T.length});return y(g,p),g}function a_(p,b){var g=this;p=D(p);var T=g.ready().then(function(){var I=g._dbInfo;localStorage.removeItem(I.keyPrefix+p)});return y(T,b),T}function c_(p,b,g){var T=this;p=D(p);var I=T.ready().then(function(){b===void 0&&(b=null);var S=b;return new E(function(L,G){var z=T._dbInfo;z.serializer.serialize(b,function(q,J){if(J)G(J);else try{localStorage.setItem(z.keyPrefix+p,q),L(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(te),G(te)}})})});return y(I,g),I}function l_(p,b){if(b=N.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var T=this,I;return p.name?I=new E(function(S){p.storeName?S(vm(p,T._defaultConfig)):S(p.name+"/")}).then(function(S){for(var L=localStorage.length-1;L>=0;L--){var G=localStorage.key(L);G.indexOf(S)===0&&localStorage.removeItem(G)}}):I=E.reject("Invalid arguments"),y(I,b),I}var u_={_driver:"localStorageWrapper",_initStorage:e_,_support:Jv(),iterate:n_,getItem:r_,setItem:c_,removeItem:a_,clear:t_,length:s_,key:o_,keys:i_,dropInstance:l_},f_=function(b,g){return b===g||typeof b=="number"&&typeof g=="number"&&isNaN(b)&&isNaN(g)},p_=function(b,g){for(var T=b.length,I=0;I<T;){if(f_(b[I],g))return!0;I++}return!1},_m=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Ci={},Em={},bo={INDEXEDDB:Wt,WEBSQL:Xv,LOCALSTORAGE:u_},m_=[bo.INDEXEDDB._driver,bo.WEBSQL._driver,bo.LOCALSTORAGE._driver],Ws=["dropInstance"],Yl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ws),d_={description:"",driver:m_.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function h_(p,b){p[b]=function(){var g=arguments;return p.ready().then(function(){return p[b].apply(p,g)})}}function Kl(){for(var p=1;p<arguments.length;p++){var b=arguments[p];if(b)for(var g in b)b.hasOwnProperty(g)&&(_m(b[g])?arguments[0][g]=b[g].slice():arguments[0][g]=b[g])}return arguments[0]}var g_=(function(){function p(b){a(this,p);for(var g in bo)if(bo.hasOwnProperty(g)){var T=bo[g],I=T._driver;this[g]=I,Ci[I]||this.defineDriver(T)}this._defaultConfig=Kl({},d_),this._config=Kl({},this._defaultConfig,b),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,T,I){var S=new E(function(L,G){try{var z=g._driver,q=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){G(q);return}for(var J=Yl.concat("_initStorage"),te=0,ve=J.length;te<ve;te++){var Oe=J[te],Ne=!p_(Ws,Oe);if((Ne||g[Oe])&&typeof g[Oe]!="function"){G(q);return}}var ot=function(){for(var Ri=function(__){return function(){var E_=new Error("Method "+__+" is not implemented by the current driver"),wm=E.reject(E_);return y(wm,arguments[arguments.length-1]),wm}},Xl=0,v_=Ws.length;Xl<v_;Xl++){var Jl=Ws[Xl];g[Jl]||(g[Jl]=Ri(Jl))}};ot();var et=function(Ri){Ci[z]&&console.info("Redefining LocalForage driver: "+z),Ci[z]=g,Em[z]=Ri,L()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(et,G):et(!!g._support):et(!0)}catch(Zt){G(Zt)}});return C(S,T,I),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,T,I){var S=Ci[g]?E.resolve(Ci[g]):E.reject(new Error("Driver not found."));return C(S,T,I),S},p.prototype.getSerializer=function(g){var T=E.resolve(ql);return C(T,g),T},p.prototype.ready=function(g){var T=this,I=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return C(I,g,g),I},p.prototype.setDriver=function(g,T,I){var S=this;_m(g)||(g=[g]);var L=this._getSupportedDrivers(g);function G(){S._config.driver=S.driver()}function z(te){return S._extend(te),G(),S._ready=S._initStorage(S._config),S._ready}function q(te){return function(){var ve=0;function Oe(){for(;ve<te.length;){var Ne=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Ne).then(z).catch(Oe)}G();var ot=new Error("No available storage method found.");return S._driverSet=E.reject(ot),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=J.then(function(){var te=L[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,G(),S._wrapLibraryMethodsWithReady(),S._initDriver=q(L)})}).catch(function(){G();var te=new Error("No available storage method found.");return S._driverSet=E.reject(te),S._driverSet}),C(this._driverSet,T,I),this._driverSet},p.prototype.supports=function(g){return!!Em[g]},p.prototype._extend=function(g){Kl(this,g)},p.prototype._getSupportedDrivers=function(g){for(var T=[],I=0,S=g.length;I<S;I++){var L=g[I];this.supports(L)&&T.push(L)}return T},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Yl.length;g<T;g++)h_(this,Yl[g])},p.prototype.createInstance=function(g){return new p(g)},p})(),y_=new g_;o.exports=y_},{3:3}]},{},[4])(4)})});var Qf=Ql((nc,hg)=>{"use strict";(function(t,e){typeof nc=="object"&&typeof hg<"u"?e(nc):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(nc,function(t){"use strict";function e(A){var R,V,U=new Error(A);return R=U,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,U}function r(A,R,V){var U=R.slice(0,V).split(/\n/),H=U.length,ne=U[H-1].length+1;throw e(A+=" at line "+H+" col "+ne+`:
2
2
 
3
3
  `+R.split(/\n/)[H-1]+`
4
4
  `+Array(ne).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(A){if(!(A instanceof SyntaxError))throw A}function i(A,R){return Object.prototype.hasOwnProperty.call(A,R)}function s(A,R,V){for(var U in R)i(R,U)&&(R[U]==null||typeof R[U]!="object"||U!=="storage"&&U!=="prefixes"||V?A[U]=R[U]:A[U]=s({},R[U]));return A}var a=/^async +/,l=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,f=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,m=/[.*+\-?^${}()|[\]\\]/g;function E(A){return m.test(A)?A.replace(m,"\\$&"):A}function y(A,R){R.rmWhitespace&&(A=A.replace(/[\r\n]+/g,`
@@ -21,7 +21,7 @@ Event: ${Ar(t)}`),!0;if(XE(t,e.denyUrls))return ie&&ee.warn(`Event dropped due t
21
21
  Event: ${Ar(t)}.
22
22
  Url: ${Ra(t)}`),!0;if(!JE(t,e.allowUrls))return ie&&ee.warn(`Event dropped due to not being matched by \`allowUrls\` option.
23
23
  Event: ${Ar(t)}.
24
- Url: ${Ra(t)}`),!0}return!1}function YE(t,e){return e?.length?Ta(t).some(r=>Do(r,e)):!1}function KE(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Do(r,e):!1}function XE(t,e){if(!e?.length)return!1;let r=Ra(t);return r?Do(r,e):!1}function JE(t,e){if(!e?.length)return!0;let r=Ra(t);return r?Do(r,e):!0}function QE(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 Ra(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?QE(r):null}catch{return ie&&ee.error(`Cannot extract url for event ${Ar(t)}`),null}}function ZE(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function rf(t,e,r,n,o,i){if(!o.exception?.values||!i||!_r(i.originalException,Error))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=tf(t,e,n,i.originalException,r,o.exception.values,s,0))}function tf(t,e,r,n,o,i,s,a){if(i.length>=r+1)return i;let l=[...i];if(_r(n[o],Error)){rh(s,a);let f=t(e,n[o]),d=l.length;nh(f,o,d,a),l=tf(t,e,r,n[o],o,[f,...l],f,d)}return Array.isArray(n.errors)&&n.errors.forEach((f,d)=>{if(_r(f,Error)){rh(s,a);let m=t(e,f),E=l.length;nh(m,`errors[${d}]`,E,a),l=tf(t,e,r,f,o,[m,...l],m,E)}}),l}function rh(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function nh(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function nf(t){let e="console";Nt(e,t),Pt(e,ew)}function ew(){"console"in pe&&lu.forEach(function(t){t in pe.console&&lt(pe.console,t,function(e){return Co[t]=e,function(...r){ct("console",{args:r,level:t}),Co[t]?.apply(pe.console,r)}})})}function of(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var tw="Dedupe",rw=()=>{let t;return{name:tw,processEvent(e){if(e.type)return e;try{if(nw(e,t))return ie&&ee.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Da=rw;function nw(t,e){return e?!!(ow(t,e)||iw(t,e)):!1}function ow(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!sh(t,e)||!ih(t,e))}function iw(t,e){let r=oh(e),n=oh(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!sh(t,e)||!ih(t,e))}function ih(t,e){let r=na(t),n=na(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let o=0;o<n.length;o++){let i=n[o],s=r[o];if(i.filename!==s.filename||i.lineno!==s.lineno||i.colno!==s.colno||i.function!==s.function)return!1}return!0}function sh(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 oh(t){return t.exception?.values?.[0]}function Yi(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}}function Oa(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var Ki=pe;function sf(){return"history"in Ki&&!!Ki.history}function sw(){if(!("fetch"in Ki))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Xi(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function af(){if(typeof EdgeRuntime=="string")return!0;if(!sw())return!1;if(Xi(Ki.fetch))return!0;let t=!1,e=Ki.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=Xi(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){ie&&ee.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function lf(t,e){let r="fetch";Nt(r,t),Pt(r,()=>aw(void 0,e))}function aw(t,e=!1){e&&!af()||lt(pe,"fetch",function(r){return function(...n){let o=new Error,{method:i,url:s}=cw(n),a={args:n,fetchData:{method:i,url:s},startTimestamp:Ft()*1e3,virtualError:o,headers:lw(n)};return t||ct("fetch",_({},a)),r.apply(pe,n).then(async l=>(t?t(l):ct("fetch",Z(_({},a),{endTimestamp:Ft()*1e3,response:l})),l),l=>{if(ct("fetch",Z(_({},a),{endTimestamp:Ft()*1e3,error:l})),qn(l)&&l.stack===void 0&&(l.stack=o.stack,Gt(l,"framesToPop",1)),l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{let f=new URL(a.fetchData.url);l.message=`${l.message} (${f.host})`}catch{}throw l})}})}function cf(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ah(t){return typeof t=="string"?t:t?cf(t,"url")?t.url:t.toString?t.toString():"":""}function cw(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:ah(r),method:cf(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:ah(e),method:cf(e,"method")?String(e.method).toUpperCase():"GET"}}function lw(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(zm(e))return new Headers(e.headers)}catch{}}function uf(){return"npm"}var Ke=pe,ff=0;function pf(){return ff>0}function Sw(){ff++,setTimeout(()=>{ff--})}function Jn(t,e={}){function r(o){return typeof o=="function"}if(!r(t))return t;try{let o=t.__sentry_wrapped__;if(o)return typeof o=="function"?o:t;if(Xn(t))return t}catch{return t}let n=function(...o){try{let i=o.map(s=>Jn(s,e));return t.apply(this,i)}catch(i){throw Sw(),$i(s=>{s.addEventProcessor(a=>(e.mechanism&&(Oo(a,void 0,void 0),Dr(a,e.mechanism)),a.extra=Z(_({},a.extra),{arguments:o}),a)),wa(i)}),i}};try{for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}catch{}ca(n,t),Gt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function ch(){let t=Hi(),{referrer:e}=Ke.document||{},{userAgent:r}=Ke.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Na(t,e){let r=hf(t,e),n={type:Rw(e),value:Aw(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Tw(t,e,r,n){let i=We()?.getOptions().normalizeDepth,s=Nw(e),a={__serialized__:ga(e,i)};if(s)return{exception:{values:[Na(t,s)]},extra:a};let l={exception:{values:[{type:Kn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Dw(e,{isUnhandledRejection:n})}]},extra:a};if(r){let f=hf(t,r);f.length&&(l.exception.values[0].stacktrace={frames:f})}return l}function mf(t,e){return{exception:{values:[Na(t,e)]}}}function hf(t,e){let r=e.stacktrace||e.stack||"",n=xw(e),o=Cw(e);try{return t(r,n,o)}catch{}return[]}var Iw=/Minified React error #\d+;/i;function xw(t){return t&&Iw.test(t.message)?1:0}function Cw(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function lh(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Rw(t){let e=t?.name;return!e&&lh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Aw(t){let e=t?.message;return lh(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function uh(t,e,r,n){let o=r?.syntheticException||void 0,i=Pa(t,e,o,n);return Dr(i),i.level="error",r?.event_id&&(i.event_id=r.event_id),or(i)}function fh(t,e,r="info",n,o){let i=n?.syntheticException||void 0,s=df(t,e,i,o);return s.level=r,n?.event_id&&(s.event_id=n.event_id),or(s)}function Pa(t,e,r,n,o){let i;if(ia(e)&&e.error)return mf(t,e.error);if(sa(e)||vu(e)){let s=e;if("stack"in e)i=mf(t,e);else{let a=s.name||(sa(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;i=df(t,l,r,n),Oo(i,l)}return"code"in s&&(i.tags=Z(_({},i.tags),{"DOMException.code":`${s.code}`})),i}return qn(e)?mf(t,e):nn(e)||Kn(e)?(i=Tw(t,e,r,o),Dr(i,{synthetic:!0}),i):(i=df(t,e,r,n),Oo(i,`${e}`,void 0),Dr(i,{synthetic:!0}),i)}function df(t,e,r,n){let o={};if(n&&r){let i=hf(t,r);i.length&&(o.exception={values:[{value:e,stacktrace:{frames:i}}]}),Dr(o,{synthetic:!0})}if(Ao(e)){let{__sentry_template_string__:i,__sentry_template_values__:s}=e;return o.logentry={message:i,params:s},o}return o.message=e,o}function Dw(t,{isUnhandledRejection:e}){let r=Tu(t),n=e?"promise rejection":"exception";return ia(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:Kn(t)?`Event \`${Ow(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Ow(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Nw(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var Pw=5e3,Ji=class extends zi{constructor(e){let r=Lw(e),n=Ke.SENTRY_SDK_SOURCE||uf();Zu(r,"browser",["browser"],n),super(r);let{sendDefaultPii:o,sendClientReports:i,enableLogs:s,_experiments:a}=this._options,l=s??a?.enableLogs;Ke.document&&(i||l)&&Ke.document.addEventListener("visibilitychange",()=>{Ke.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),l&&qi(this))}),l&&(this.on("flush",()=>{qi(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{qi(this)},Pw)})),o&&(this.on("postprocessEvent",Ju),this.on("beforeSendSession",Qu))}eventFromException(e,r){return uh(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return fh(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,o){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,o)}};function Lw(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Ke.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var ph=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var ft=pe;var Mw=1e3,mh,gf,yf;function vf(t){Nt("dom",t),Pt("dom",Bw)}function Bw(){if(!ft.document)return;let t=ct.bind(null,"dom"),e=dh(t,!0);ft.document.addEventListener("click",e,!1),ft.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let o=ft[r]?.prototype;o?.hasOwnProperty?.("addEventListener")&&(lt(o,"addEventListener",function(i){return function(s,a,l){if(s==="click"||s=="keypress")try{let f=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=f[s]=f[s]||{refCount:0};if(!d.handler){let m=dh(t);d.handler=m,i.call(this,s,m,l)}d.refCount++}catch{}return i.call(this,s,a,l)}}),lt(o,"removeEventListener",function(i){return function(s,a,l){if(s==="click"||s=="keypress")try{let f=this.__sentry_instrumentation_handlers__||{},d=f[s];d&&(d.refCount--,d.refCount<=0&&(i.call(this,s,d.handler,l),d.handler=void 0,delete f[s]),Object.keys(f).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,a,l)}}))})}function Uw(t){if(t.type!==gf)return!1;try{if(!t.target||t.target._sentryId!==yf)return!1}catch{}return!0}function kw(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function dh(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Fw(r);if(kw(r.type,n))return;Gt(r,"_sentryCaptured",!0),n&&!n._sentryId&&Gt(n,"_sentryId",ut());let o=r.type==="keypress"?"input":r.type;Uw(r)||(t({event:r,name:o,global:e}),gf=r.type,yf=n?n._sentryId:void 0),clearTimeout(mh),mh=ft.setTimeout(()=>{yf=void 0,gf=void 0},Mw)}}function Fw(t){try{return t.target}catch{return null}}var La;function Qi(t){let e="history";Nt(e,t),Pt(e,Hw)}function Hw(){if(ft.addEventListener("popstate",()=>{let e=ft.location.href,r=La;if(La=e,r===e)return;ct("history",{from:r,to:e})}),!sf())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let o=La,i=$w(String(n));if(La=i,o===i)return e.apply(this,r);ct("history",{from:o,to:i})}return e.apply(this,r)}}lt(ft.history,"pushState",t),lt(ft.history,"replaceState",t)}function $w(t){try{return new URL(t,ft.location.origin).toString()}catch{return t}}var Ma={};function _f(t){let e=Ma[t];if(e)return e;let r=ft[t];if(Xi(r))return Ma[t]=r.bind(ft);let n=ft.document;if(n&&typeof n.createElement=="function")try{let o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o);let i=o.contentWindow;i?.[t]&&(r=i[t]),n.head.removeChild(o)}catch(o){ph&&ee.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,o)}return r&&(Ma[t]=r.bind(ft))}function Ba(t){Ma[t]=void 0}var Qn="__sentry_xhr_v3__";function Ef(t){Nt("xhr",t),Pt("xhr",Vw)}function Vw(){if(!ft.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let o=new Error,i=Ft()*1e3,s=Lt(n[0])?n[0].toUpperCase():void 0,a=Ww(n[1]);if(!s||!a)return e.apply(r,n);r[Qn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let l=()=>{let f=r[Qn];if(f&&r.readyState===4){try{f.status_code=r.status}catch{}let d={endTimestamp:Ft()*1e3,startTimestamp:i,xhr:r,virtualError:o};ct("xhr",d)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(f,d,m){return l(),f.apply(d,m)}}):r.addEventListener("readystatechange",l),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(f,d,m){let[E,y]=m,C=d[Qn];return C&&Lt(E)&&Lt(y)&&(C.request_headers[E.toLowerCase()]=y),f.apply(d,m)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let o=r[Qn];if(!o)return e.apply(r,n);n[0]!==void 0&&(o.body=n[0]);let i={startTimestamp:Ft()*1e3,xhr:r};return ct("xhr",i),e.apply(r,n)}})}function Ww(t){if(Lt(t))return t;try{return t.toString()}catch{}}function wf(t,e=_f("fetch")){let r=0,n=0;function o(i){let s=i.body.length;r+=s,n++;let a=_({body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Ba("fetch"),Tn("No fetch implementation available");try{return e(t.url,a).then(l=>(r-=s,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return Ba("fetch"),r-=s,n--,Tn(l)}}return xa(t,o)}var jw=30;var Gw=50;function bf(t,e,r,n){let o={filename:t,function:e==="<anonymous>"?"?":e,in_app:!0};return r!==void 0&&(o.lineno=r),n!==void 0&&(o.colno=n),o}var zw=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qw=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yw=/\((\S*)(?::(\d+))(?::(\d+))\)/,Kw=t=>{let e=zw.exec(t);if(e){let[,n,o,i]=e;return bf(n,"?",+o,+i)}let r=qw.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=Yw.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[o,i]=vh(r[1]||"?",r[2]);return bf(i,o,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},hh=[jw,Kw],Xw=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Jw=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qw=t=>{let e=Xw.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=Jw.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let n=e[3],o=e[1]||"?";return[o,n]=vh(o,n),bf(n,o,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},gh=[Gw,Qw];var yh=[hh,gh],Sf=mu(...yh),vh=(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]:"?",r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Mo=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Ua=1024,Zw="Breadcrumbs",eb=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:Zw,setup(r){e.console&&nf(nb(r)),e.dom&&vf(rb(r,e.dom)),e.xhr&&Ef(ob(r)),e.fetch&&lf(ib(r)),e.history&&Qi(sb(r)),e.sentry&&r.on("beforeSendEvent",tb(r))}}},_h=eb;function tb(t){return function(r){We()===t&&Pr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:Ar(r)},{event:r})}}function rb(t,e){return function(n){if(We()!==t)return;let o,i,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Ua&&(Mo&&ee.warn(`\`dom.maxStringLength\` cannot exceed ${Ua}, but a value of ${a} was configured. Sentry will use ${Ua} instead.`),a=Ua),typeof s=="string"&&(s=[s]);try{let f=n.event,d=ab(f)?f.target:f;o=Fi(d,{keyAttrs:s,maxStringLength:a}),i=Su(d)}catch{o="<unknown>"}if(o.length===0)return;let l={category:`ui.${n.name}`,message:o};i&&(l.data={"ui.component_name":i}),Pr(l,{event:n.event,name:n.name,global:n.global})}}function nb(t){return function(r){if(We()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:of(r.level),message:aa(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${aa(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Pr(n,{input:r.args,level:r.level})}}function ob(t){return function(r){if(We()!==t)return;let{startTimestamp:n,endTimestamp:o}=r,i=r.xhr[Qn];if(!n||!o||!i)return;let{method:s,url:a,status_code:l,body:f}=i,d={method:s,url:a,status_code:l},m={xhr:r.xhr,input:f,startTimestamp:n,endTimestamp:o},E={category:"xhr",data:d,type:"http",level:Oa(l)};t.emit("beforeOutgoingRequestBreadcrumb",E,m),Pr(E,m)}}function ib(t){return function(r){if(We()!==t)return;let{startTimestamp:n,endTimestamp:o}=r;if(o&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let i=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:o},a={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Pr(a,s)}else{let i=r.response,s=Z(_({},r.fetchData),{status_code:i?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,i?.status;let a={input:r.args,response:i,startTimestamp:n,endTimestamp:o},l={category:"fetch",data:s,type:"http",level:Oa(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),Pr(l,a)}}}function sb(t){return function(r){if(We()!==t)return;let n=r.from,o=r.to,i=Yi(Ke.location.href),s=n?Yi(n):void 0,a=Yi(o);s?.path||(s=i),i.protocol===a.protocol&&i.host===a.host&&(o=a.relative),i.protocol===s.protocol&&i.host===s.host&&(n=s.relative),Pr({category:"navigation",data:{from:n,to:o}})}}function ab(t){return!!t&&!!t.target}var cb=["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"],lb="BrowserApiErrors",ub=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:lb,setupOnce(){e.setTimeout&&lt(Ke,"setTimeout",Eh),e.setInterval&&lt(Ke,"setInterval",Eh),e.requestAnimationFrame&&lt(Ke,"requestAnimationFrame",fb),e.XMLHttpRequest&&"XMLHttpRequest"in Ke&&lt(XMLHttpRequest.prototype,"send",pb);let r=e.eventTarget;r&&(Array.isArray(r)?r:cb).forEach(o=>mb(o,e))}}},wh=ub;function Eh(t){return function(...e){let r=e[0];return e[0]=Jn(r,{mechanism:{data:{function:rr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function fb(t){return function(e){return t.apply(this,[Jn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:rr(t)},handled:!1,type:"instrument"}})])}}function pb(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in r&&typeof r[o]=="function"&&lt(r,o,function(i){let s={mechanism:{data:{function:o,handler:rr(i)},handled:!1,type:"instrument"}},a=Xn(i);return a&&(s.mechanism.data.handler=rr(a)),Jn(i,s)})}),t.apply(this,e)}}function mb(t,e){let n=Ke[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(lt(n,"addEventListener",function(o){return function(i,s,a){try{db(s)&&(s.handleEvent=Jn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:rr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&hb(this,i,s),o.apply(this,[i,Jn(s,{mechanism:{data:{function:"addEventListener",handler:rr(s),target:t},handled:!1,type:"instrument"}}),a])}}),lt(n,"removeEventListener",function(o){return function(i,s,a){try{let l=s.__sentry_wrapped__;l&&o.call(this,i,l,a)}catch{}return o.call(this,i,s,a)}}))}function db(t){return typeof t.handleEvent=="function"}function hb(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var bh=()=>({name:"BrowserSession",setupOnce(){if(typeof Ke.document>"u"){Mo&&ee.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}ji({ignoreDuration:!0}),Gi(),Qi(({from:t,to:e})=>{t!==void 0&&t!==e&&(ji({ignoreDuration:!0}),Gi())})}});var gb="GlobalHandlers",yb=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:gb,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(vb(r),Sh("onerror")),e.onunhandledrejection&&(_b(r),Sh("onunhandledrejection"))}}},Th=yb;function vb(t){hu(e=>{let{stackParser:r,attachStacktrace:n}=Ih();if(We()!==t||pf())return;let{msg:o,url:i,line:s,column:a,error:l}=e,f=bb(Pa(r,l||o,void 0,n,!1),i,s,a);f.level="error",Wi(f,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function _b(t){yu(e=>{let{stackParser:r,attachStacktrace:n}=Ih();if(We()!==t||pf())return;let o=Eb(e),i=Yn(o)?wb(o):Pa(r,o,void 0,n,!0);i.level="error",Wi(i,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Eb(t){if(Yn(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 wb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function bb(t,e,r,n){let o=t.exception=t.exception||{},i=o.values=o.values||[],s=i[0]=i[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[],f=n,d=r,m=Lt(e)&&e.length>0?e:Hi();return l.length===0&&l.push({colno:f,filename:m,function:"?",in_app:!0,lineno:d}),t}function Sh(t){Mo&&ee.log(`Global Handler attached: ${t}`)}function Ih(){return We()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var xh=()=>({name:"HttpContext",preprocessEvent(t){if(!Ke.navigator&&!Ke.location&&!Ke.document)return;let e=ch(),r=_(_({},e.headers),t.request?.headers);t.request=Z(_(_({},e),t.request),{headers:r})}});var Sb="cause",Tb=5,Ib="LinkedErrors",xb=(t={})=>{let e=t.limit||Tb,r=t.key||Sb;return{name:Ib,preprocessEvent(n,o,i){let s=i.getOptions();rf(Na,s.stackParser,r,e,n,o)}}},Ch=xb;function Tf(t){return[Aa(),Ca(),wh(),_h(),Th(),Ch(),Da(),xh(),bh()]}var Fa={},Ha,If,Rh;(()=>{let t=Tf({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));If=new Ji({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:wf,stackParser:Sf,integrations:t,environment:gr.mode,release:`web-sdk@${Gs}`,debug:gr.debug,sampleRate:.5}),If.init()})();function ae(t,e,r){w.error(`${e}:`,t);let n=Oh(r);if(n.setTag("operation",e),t instanceof vr){Cb(n,t,e);return}n.captureException(t)}function Ah(t,e,r){Oh(r).captureMessage(t,e??"error")}function Cb(t,e,r){if(Rb(t,e),e.response){let n=e.response,o=e.responseText;n.status&&t.setTag("http.status_code",n.status),n.statusText&&t.setTag("http.status_text",n.statusText),o&&typeof o=="object"&&"error"in o&&(t.setTag("http.error_code",o.error.code),t.setTag("http.error_message",o.error.message)),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function Rb(t,e){let r=e.request;if(!r)return;t.setExtras({body:e.requestBody,headers:r.headers,method:r.method,url:r.url});let n=r.headers?.get("Cooee-Retry-Attempt");n!==null&&t.setTag("retry.attempt",n)}function Dh(t){Rh=t}function $a(t,e){Fa[t]=_(_({},Fa[t]),e)}function Bo(t){Ha=_(_({},Ha),t)}function Oh(t){t??={};let{extra:e,tags:r}=t,n=new wt;if(n.setClient(If),n.setUser(Rh),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let o=t.engagementTrigger;n.setTags({"engagement.id":o.engagementID,"engagement.short_id":o.shortID,"engagement.objective":o.objective,"engagement.delivery_type":o.onsiteDeliveryType,"engagement.content_id":o.contentID,"engagement.variation":o.variation,"engagement.currency":o.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Ha&&n.setTags(Ha),Object.keys(Fa).forEach(o=>{n.setContext(o,Fa[o])}),n.setTag("language",navigator.language),n.setTag("timezone",Nh()),Ab(n),n}function Ab(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var Va=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(o,i)=>{switch(i){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 o}})}static formatWithDelimiters(e,r=2,n=",",o="."){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),l=s[1]?o+s[1]:"";return a+l}};function Uo(t){try{return new URL(t)}catch{return}}function xf(t){return!t||t==="null"||t==="undefined"}function Ph(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Mt(t,e,r){return{[t]:Cf(e,r),[t+"_wo_currency"]:e}}function Cf(t,e){if(t==0&&e)return"Free";let r=fe(),n=Ye.get(),o=r.shopCurrencyCode||n.currency,i=r.currencyCode;i||w.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&o===i)a=Va.format(t*100,s);else{let l;try{l=new Intl.NumberFormat(Mh(),{style:"currency",currency:i||o,minimumFractionDigits:0,maximumFractionDigits:2})}catch(f){return ae(f,"format-currency",{extra:{currentCurrency:i,shopCurrency:o}}),""}a=l.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&i!=="INR"&&(a=a.concat(` ${i}`))}return a}function Lh(t){let e=Mh();try{return new Intl.NumberFormat(e,{notation:"compact"}).format(t)}catch(r){return ae(r,"format-number",{extra:{lang:e,value:t}}),t.toString()}}function Mh(){let t="en";return typeof navigator<"u"&&(navigator.languages!==void 0&&navigator.languages.length>0?t=navigator.languages[0]:navigator.language&&(t=navigator.language)),t=t.split(";")[0],t=t.split("-")[0],t||"en"}var Wa;function Nh(){if(Wa)return Wa;try{return Wa=Intl.DateTimeFormat().resolvedOptions().timeZone,Wa}catch{return""}}function xn(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function br(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},5e3)}async function Rf(t,e=10,r=document){let n=0,o=document.querySelectorAll("nonexistent-tag");for(;n<e;){let i=Math.min(100*2**n,5e3);if(await jt.sleep(i),o=r.querySelectorAll(t),o.length)return w.verbose(`Attempt ${n+1}: ${o.length} elements found with ${t}`),o;w.verbose(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${i}ms.`),n++}return w.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),o}async function Cn(t,e=10,r=document){return(await Rf(t,e,r)).item(0)}async function Af(t){let[e,r,n]=await Promise.all([ze.get("did"),xt.get("id",""),ze.get("sessionNumber",1)]),o={letscooee_did:e,letscooee_sid:r,letscooee_sn:n,__letscooee_time:new Date().toLocaleString()};return t&&(o.__letscooee_via=t),o}async function ja(t){let e=await Af(t);return Object.entries(e).map(([r,n])=>({key:r,value:n.toString()}))}function Lr(t,e,r,n=!1){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:n,value:r})}function Bh(t){if(t%100>=11&&t%100<=13)return t+"th";switch(t%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd";default:return t+"th"}}var Ya,Te,$h,Nf,Zn,Uh,Vh,Wh,jh,Pf,Df,Of,Db,es={},Gh=[],Ob=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ka=Array.isArray;function cn(t,e){for(var r in e)t[r]=e[r];return t}function Lf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Mf(t,e,r){var n,o,i,s={};for(i in e)i=="key"?n=e[i]:i=="ref"?o=e[i]:s[i]=e[i];if(arguments.length>2&&(s.children=arguments.length>3?Ya.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)s[i]===void 0&&(s[i]=t.defaultProps[i]);return za(t,s,n,o,null)}function za(t,e,r,n,o){var i={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++$h,__i:-1,__u:0};return o==null&&Te.vnode!=null&&Te.vnode(i),i}function Br(t){return t.children}function Mr(t,e){this.props=t,this.context=e}function ko(t,e){if(e==null)return t.__?ko(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"?ko(t):null}function zh(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 zh(t)}}function kh(t){(!t.__d&&(t.__d=!0)&&Zn.push(t)&&!qa.__r++||Uh!=Te.debounceRendering)&&((Uh=Te.debounceRendering)||Vh)(qa)}function qa(){for(var t,e,r,n,o,i,s,a=1;Zn.length;)Zn.length>a&&Zn.sort(Wh),t=Zn.shift(),a=Zn.length,t.__d&&(r=void 0,o=(n=(e=t).__v).__e,i=[],s=[],e.__P&&((r=cn({},n)).__v=n.__v+1,Te.vnode&&Te.vnode(r),Bf(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[o]:null,i,o??ko(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,Kh(i,r,s),r.__e!=o&&zh(r)));qa.__r=0}function qh(t,e,r,n,o,i,s,a,l,f,d){var m,E,y,C,D,N,k=n&&n.__k||Gh,X=e.length;for(l=Nb(r,e,k,l,X),m=0;m<X;m++)(y=r.__k[m])!=null&&(E=y.__i==-1?es:k[y.__i]||es,y.__i=m,N=Bf(t,y,E,o,i,s,a,l,f,d),C=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&Uf(E.ref,null,y),d.push(y.ref,y.__c||C,y)),D==null&&C!=null&&(D=C),4&y.__u||E.__k===y.__k?l=Yh(y,l,t):typeof y.type=="function"&&N!==void 0?l=N:C&&(l=C.nextSibling),y.__u&=-7);return r.__e=D,l}function Nb(t,e,r,n,o){var i,s,a,l,f,d=r.length,m=d,E=0;for(t.__k=new Array(o),i=0;i<o;i++)(s=e[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=i+E,(s=t.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?za(null,s,null,null,null):Ka(s)?za(Br,{children:s},null,null,null):s.constructor==null&&s.__b>0?za(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(f=s.__i=Pb(s,r,l,m))!=-1&&(m--,(a=r[f])&&(a.__u|=2)),a==null||a.__v==null?(f==-1&&(o>d?E--:o<d&&E++),typeof s.type!="function"&&(s.__u|=4)):f!=l&&(f==l-1?E--:f==l+1?E++:(f>l?E--:E++,s.__u|=4))):t.__k[i]=null;if(m)for(i=0;i<d;i++)(a=r[i])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=ko(a)),Jh(a,a));return n}function Yh(t,e,r){var n,o;if(typeof t.type=="function"){for(n=t.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=t,e=Yh(n[o],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=ko(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Pb(t,e,r,n){var o,i,s=t.key,a=t.type,l=e[r];if(l===null&&t.key==null||l&&s==l.key&&a==l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(o=r-1,i=r+1;o>=0||i<e.length;){if(o>=0){if((l=e[o])&&(2&l.__u)==0&&s==l.key&&a==l.type)return o;o--}if(i<e.length){if((l=e[i])&&(2&l.__u)==0&&s==l.key&&a==l.type)return i;i++}}return-1}function Fh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Ob.test(e)?r:r+"px"}function Ga(t,e,r,n,o){var i,s;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||Fh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Fh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(jh,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=r,r?n?r.u=n.u:(r.u=Pf,t.addEventListener(e,i?Of:Df,i)):t.removeEventListener(e,i?Of:Df,i);else{if(o=="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 Hh(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Pf++;else if(e.t<r.u)return;return r(Te.event?Te.event(e):e)}}}function Bf(t,e,r,n,o,i,s,a,l,f){var d,m,E,y,C,D,N,k,X,B,Q,_e,K,ce,se,me,Pe,Se=e.type;if(e.constructor!=null)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=e.__e=r.__e]),(d=Te.__b)&&d(e);e:if(typeof Se=="function")try{if(k=e.props,X="prototype"in Se&&Se.prototype.render,B=(d=Se.contextType)&&n[d.__c],Q=d?B?B.props.value:d.__:n,r.__c?N=(m=e.__c=r.__c).__=m.__E:(X?e.__c=m=new Se(k,Q):(e.__c=m=new Mr(k,Q),m.constructor=Se,m.render=Mb),B&&B.sub(m),m.props=k,m.state||(m.state={}),m.context=Q,m.__n=n,E=m.__d=!0,m.__h=[],m._sb=[]),X&&m.__s==null&&(m.__s=m.state),X&&Se.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=cn({},m.__s)),cn(m.__s,Se.getDerivedStateFromProps(k,m.__s))),y=m.props,C=m.state,m.__v=e,E)X&&Se.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),X&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(X&&Se.getDerivedStateFromProps==null&&k!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(k,Q),!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(k,m.__s,Q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(m.props=k,m.state=m.__s,m.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Re){Re&&(Re.__=e)}),_e=0;_e<m._sb.length;_e++)m.__h.push(m._sb[_e]);m._sb=[],m.__h.length&&s.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(k,m.__s,Q),X&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,C,D)})}if(m.context=Q,m.props=k,m.__P=t,m.__e=!1,K=Te.__r,ce=0,X){for(m.state=m.__s,m.__d=!1,K&&K(e),d=m.render(m.props,m.state,m.context),se=0;se<m._sb.length;se++)m.__h.push(m._sb[se]);m._sb=[]}else do m.__d=!1,K&&K(e),d=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++ce<25);m.state=m.__s,m.getChildContext!=null&&(n=cn(cn({},n),m.getChildContext())),X&&!E&&m.getSnapshotBeforeUpdate!=null&&(D=m.getSnapshotBeforeUpdate(y,C)),me=d,d!=null&&d.type===Br&&d.key==null&&(me=Xh(d.props.children)),a=qh(t,Ka(me)?me:[me],e,r,n,o,i,s,a,l,f),m.base=e.__e,e.__u&=-161,m.__h.length&&s.push(m),N&&(m.__E=m.__=null)}catch(Re){if(e.__v=null,l||i!=null)if(Re.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else for(Pe=i.length;Pe--;)Lf(i[Pe]);else e.__e=r.__e,e.__k=r.__k;Te.__e(Re,e,r)}else i==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=Lb(r.__e,e,r,n,o,i,s,l,f);return(d=Te.diffed)&&d(e),128&e.__u?void 0:a}function Kh(t,e,r){for(var n=0;n<r.length;n++)Uf(r[n],r[++n],r[++n]);Te.__c&&Te.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(i){i.call(o)})}catch(i){Te.__e(i,o.__v)}})}function Xh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Ka(t)?t.map(Xh):cn({},t)}function Lb(t,e,r,n,o,i,s,a,l){var f,d,m,E,y,C,D,N=r.props,k=e.props,X=e.type;if(X=="svg"?o="http://www.w3.org/2000/svg":X=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(f=0;f<i.length;f++)if((y=i[f])&&"setAttribute"in y==!!X&&(X?y.localName==X:y.nodeType==3)){t=y,i[f]=null;break}}if(t==null){if(X==null)return document.createTextNode(k);t=document.createElementNS(o,X,k.is&&k),a&&(Te.__m&&Te.__m(e,i),a=!1),i=null}if(X==null)N===k||a&&t.data==k||(t.data=k);else{if(i=i&&Ya.call(t.childNodes),N=r.props||es,!a&&i!=null)for(N={},f=0;f<t.attributes.length;f++)N[(y=t.attributes[f]).name]=y.value;for(f in N)if(y=N[f],f!="children"){if(f=="dangerouslySetInnerHTML")m=y;else if(!(f in k)){if(f=="value"&&"defaultValue"in k||f=="checked"&&"defaultChecked"in k)continue;Ga(t,f,null,y,o)}}for(f in k)y=k[f],f=="children"?E=y:f=="dangerouslySetInnerHTML"?d=y:f=="value"?C=y:f=="checked"?D=y:a&&typeof y!="function"||N[f]===y||Ga(t,f,y,N[f],o);if(d)a||m&&(d.__html==m.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(m&&(t.innerHTML=""),qh(e.type=="template"?t.content:t,Ka(E)?E:[E],e,r,n,X=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:r.__k&&ko(r,0),a,l),i!=null)for(f=i.length;f--;)Lf(i[f]);a||(f="value",X=="progress"&&C==null?t.removeAttribute("value"):C!=null&&(C!==t[f]||X=="progress"&&!C||X=="option"&&C!=N[f])&&Ga(t,f,C,N[f],o),f="checked",D!=null&&D!=t[f]&&Ga(t,f,D,N[f],o))}return t}function Uf(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(o){Te.__e(o,r)}}function Jh(t,e,r){var n,o;if(Te.unmount&&Te.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Uf(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){Te.__e(i,e)}n.base=n.__P=null}if(n=t.__k)for(o=0;o<n.length;o++)n[o]&&Jh(n[o],e,r||typeof t.type!="function");r||Lf(t.__e),t.__c=t.__=t.__e=void 0}function Mb(t,e,r){return this.constructor(t,r)}function Qh(t,e,r){var n,o,i,s;e==document&&(e=document.documentElement),Te.__&&Te.__(t,e),o=(n=typeof r=="function")?null:r&&r.__k||e.__k,i=[],s=[],Bf(e,t=(!n&&r||e).__k=Mf(Br,null,[t]),o||es,es,e.namespaceURI,!n&&r?[r]:o?null:e.firstChild?Ya.call(e.childNodes):null,i,!n&&r?r:o?o.__e:e.firstChild,n,s),Kh(i,t,s)}Ya=Gh.slice,Te={__e:function(t,e,r,n){for(var o,i,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(t)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,n||{}),s=o.__d),s)return o.__E=o}catch(a){t=a}throw t}},$h=0,Nf=function(t){return t!=null&&t.constructor==null},Mr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=cn({},this.state),typeof t=="function"&&(t=t(cn({},r),this.props)),t&&cn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),kh(this))},Mr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),kh(this))},Mr.prototype.render=Br,Zn=[],Vh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Wh=function(t,e){return t.__v.__b-e.__v.__b},qa.__r=0,jh=/(PointerCapture)$|Capture$/i,Pf=0,Df=Hh(!1),Of=Hh(!0),Db=0;var Ff,zt,kf,Zh,eg=0,cg=[],pt=Te,tg=pt.__b,rg=pt.__r,ng=pt.diffed,og=pt.__c,ig=pt.unmount,sg=pt.__;function Bb(t,e){pt.__h&&pt.__h(zt,t,eg||e),eg=0;var r=zt.__H||(zt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function $f(t,e){var r=Bb(Ff++,7);return Fb(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Ub(){for(var t;t=cg.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Xa),t.__H.__h.forEach(Hf),t.__H.__h=[]}catch(e){t.__H.__h=[],pt.__e(e,t.__v)}}pt.__b=function(t){zt=null,tg&&tg(t)},pt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),sg&&sg(t,e)},pt.__r=function(t){rg&&rg(t),Ff=0;var e=(zt=t.__c).__H;e&&(kf===zt?(e.__h=[],zt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Xa),e.__h.forEach(Hf),e.__h=[],Ff=0)),kf=zt},pt.diffed=function(t){ng&&ng(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(cg.push(e)!==1&&Zh===pt.requestAnimationFrame||((Zh=pt.requestAnimationFrame)||kb)(Ub)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),kf=zt=null},pt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Xa),r.__h=r.__h.filter(function(n){return!n.__||Hf(n)})}catch(n){e.some(function(o){o.__h&&(o.__h=[])}),e=[],pt.__e(n,r.__v)}}),og&&og(t,e)},pt.unmount=function(t){ig&&ig(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Xa(n)}catch(o){e=o}}),r.__H=void 0,e&&pt.__e(e,r.__v))};var ag=typeof requestAnimationFrame=="function";function kb(t){var e,r=function(){clearTimeout(n),ag&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);ag&&(e=requestAnimationFrame(r))}function Xa(t){var e=zt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),zt=e}function Hf(t){var e=zt;t.__c=t.__(),zt=e}function Fb(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Hb=Symbol.for("preact-signals");function Wf(){if(Fo>1)Fo--;else{for(var t,e=!1;ts!==void 0;){var r=ts;for(ts=void 0,Vf++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ug(r))try{r.c()}catch(o){e||(t=o,e=!0)}r=n}}if(Vf=0,Fo--,e)throw t}}var Fe=void 0;var ts=void 0,Fo=0,Vf=0,Ja=0;function lg(t){if(Fe!==void 0){var e=t.n;if(e===void 0||e.t!==Fe)return e={i:0,S:t,p:Fe.s,n:void 0,t:Fe,e:void 0,x:void 0,r:e},Fe.s!==void 0&&(Fe.s.n=e),Fe.s=e,t.n=e,32&Fe.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=Fe.s,e.n=void 0,Fe.s.n=e,Fe.s=e),e}}function mt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}mt.prototype.brand=Hb;mt.prototype.h=function(){return!0};mt.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)};mt.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)}};mt.prototype.subscribe=function(t){var e=this;return bt(function(){var r=e.value,n=Fe;Fe=void 0;try{t(r)}finally{Fe=n}})};mt.prototype.valueOf=function(){return this.value};mt.prototype.toString=function(){return this.value+""};mt.prototype.toJSON=function(){return this.value};mt.prototype.peek=function(){var t=Fe;Fe=void 0;try{return this.value}finally{Fe=t}};Object.defineProperty(mt.prototype,"value",{get:function(){var t=lg(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Vf>100)throw new Error("Cycle detected");this.v=t,this.i++,Ja++,Fo++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Wf()}}}});function ir(t){return new mt(t)}function ug(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 fg(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 pg(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 Ho(t){mt.call(this,void 0),this.x=t,this.s=void 0,this.g=Ja-1,this.f=4}(Ho.prototype=new mt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ja))return!0;if(this.g=Ja,this.f|=1,this.i>0&&!ug(this))return this.f&=-2,!0;var t=Fe;try{fg(this),Fe=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 Fe=t,pg(this),this.f&=-2,!0};Ho.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)}mt.prototype.S.call(this,t)};Ho.prototype.U=function(t){if(this.t!==void 0&&(mt.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)}};Ho.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(Ho.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=lg(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function jf(t){return new Ho(t)}function mg(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Fo++;var r=Fe;Fe=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Gf(t),n}finally{Fe=r,Wf()}}}function Gf(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,mg(t)}function $b(t){if(Fe!==this)throw new Error("Out-of-order effect");pg(this),Fe=t,this.f&=-2,8&this.f&&Gf(this),Wf()}function rs(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}rs.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()}};rs.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,mg(this),fg(this),Fo++;var t=Fe;return Fe=this,$b.bind(this,t)};rs.prototype.N=function(){2&this.f||(this.f|=2,this.o=ts,ts=this)};rs.prototype.d=function(){this.f|=8,1&this.f||Gf(this)};function bt(t){var e=new rs(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var qf,zf;function $o(t,e){Te[t]=e.bind(null,Te[t]||function(){})}function Qa(t){zf&&zf(),zf=t&&t.S()}function dg(t){var e=this,r=t.data,n=Wb(r);n.value=r;var o=$f(function(){for(var i=e.__v;i=i.__;)if(i.__c){i.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),l=o.value;a(),Nf(l)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},jf(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return o.value}dg.displayName="_st";Object.defineProperties(mt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:dg},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});$o("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var o in n)if(o!=="children"){var i=n[o];i instanceof mt&&(r||(e.__np=r={}),r[o]=i,n[o]=i.peek())}}t(e)});$o("__r",function(t,e){Qa();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(o){var i;return bt(function(){i=this}),i.c=function(){n.__$f|=1,n.setState({})},i})())),qf=n,Qa(r),t(e)});$o("__e",function(t,e,r,n){Qa(),qf=void 0,t(e,r,n)});$o("diffed",function(t,e){Qa(),qf=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,o=e.props;if(n){var i=r.U;if(i)for(var s in i){var a=i[s];a!==void 0&&!(s in n)&&(a.d(),i[s]=void 0)}else r.U=i={};for(var l in n){var f=i[l],d=n[l];f===void 0?(f=Vb(r,l,d,o),i[l]=f):f.o(d,o)}}}t(e)});function Vb(t,e,r,n){var o=e in t&&t.ownerSVGElement===void 0,i=ir(r);return{o:function(s,a){i.value=s,n=a},d:bt(function(){var s=i.value.value;n[e]!==s&&(n[e]=s,o?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}$o("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 o in n){var i=n[o];i&&i.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});$o("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Mr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var o 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 i in t)if(i!=="__source"&&t[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function Wb(t){return $f(function(){return ir(t)},[])}var Za=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var ec=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var Yf=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}},Ur=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new Za(r))??[],this.link=e.link,this.price=new ec(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=ir(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=ir(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new Yf(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var Ct=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=ir(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=ir(this.selectedVariant)}get firstImageURL(){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}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}setSelectedVariantByID(e){if(!e)return;let r=this.vars.find(n=>n.mID===e.toString());r&&this.setSelectedVariant(r)}update(e){return this.id=e.id??this.id,this.mID=e.mID??this.mID,this.name=e.name??this.name,this.imgs=e.imgs??this.imgs,this.desc=e.desc??this.desc,this.link=e.link??this.link,this.slug=e.slug??this.slug,this.quantity=e.quantity??this.quantity,this.meta=e.meta??this.meta,this.category=e.category??this.category,this.reviews=e.reviews??this.reviews,this.options=e.options??this.options,this.tags=e.tags??this.tags,e.vars&&(this.vars=e.vars.map(r=>new Ur(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new Ot({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})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,o=this.category,i=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",l=this.reviews?.rating,f=this.reviews?.totalReviews,d=r.cmp&&r.cmp>r.d,m=Z(_({name:n},Mt("price",r.d,!0)),{image_url:i,meta:s,category:o,rating:l,reviews:f,tags:a});if(e.hasEffectivePrice()){let y=Mt("effective_price",e.effectivePrice.value,!0);Object.assign(m,y)}if(d){let y=r.cmp-r.d,C={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(m,C),Object.assign(m,Mt("compare_price",r.cmp)),Object.assign(m,Mt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:m,variant:E}}};var tc=class{id;alt;shortID;sources;items;durationMS;thumbnail;card;bestSource;highSource;goodSource;lowSource;m3u8Source;constructor(e={}){if(this.id=e.id,this.alt=e.alt,this.shortID=e.shortID,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new Ct(r)):[],this.card=e.card,this.sources){let r=[];for(let n of this.sources)n.format==="mp4"?r.push(n):n.format==="m3u8"&&!this.m3u8Source&&(this.m3u8Source=n);r.length>0&&(this.bestSource=r[0],this.highSource=r.length>1?r[1]:r[0],this.lowSource=r.length>2?r[r.length-1]:r[0])}}};var Kf=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new Ve(e.color)}},Xf=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new Ve(e.color)}},Jf=class{enabled;delay;constructor(e={}){this.enabled=e.enabled,e.delay&&(this.delay=e.delay>100?e.delay:e.delay*1e3)}},Rn=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(e){e??={},this.navigation=new Xf(e.navigation),this.pagination=new Kf(e.pagination),this.autoplay=new Jf(e.autoplay),this.loop=e.loop??!1,this.maxInRow=e.maxInRow??4,this.gap=e.gap??0,this.maxInRowSm=e.maxInRowSm??this.maxInRow,this.gapSm=e.gapSm??this.gap,e.speed&&(this.speed=e.speed*1e3),this.marquee=e.marquee}};var rc=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;constructor(e={}){this.videos=e.videos?.map(r=>new tc(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM",this.playlistConfig=e.playlistConfig?.videoSwiper?{videoSwiper:new Rn(e.playlistConfig?.videoSwiper)}:void 0}};var Bt=Xr(Qf());Bt.filters.define("default",function(t){return typeof t>"u"||t==null?"":Gb(t)});+Bt.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Bt.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Bt.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Bt.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return w.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Bt.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return w.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return w.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Bt.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(w.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Bt.filters.define("currency",t=>(t=+t,isNaN(t)?(w.error("Need value as a number for `currency` filter"),NaN):Cf(t)));Bt.defaultConfig.defaultFilter="default";Bt.defaultConfig.useWith=!0;Bt.defaultConfig.autoEscape=!1;var jb={'"':"&quot;","\\":"&bsol;","\n":"\\n"};function Gb(t){return String(t).replace(/["\\\n]/g,e=>jb[e])}function zb(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,o,i)=>`{{ ${(o||i||"").trim()} }}`)}var Vo=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Bt.render(zb(t),e)}catch(n){throw ae(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},eo=(t,e,r)=>{let n=JSON.stringify(t),o=Vo(n,e,r);try{return JSON.parse(o)}catch(i){throw ae(i,"variable-replacement",{extra:{before:t,after:o},triggerContext:r}),i}};function ns(){return!!window.Shopify}function oc(){if(ns())return window.Shopify.shop?.split(".")?.[0]}function gg(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Wo(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function ic(t){return Wo(t+"?from=cooee")}var de=class t{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;discount_codes;total_discount=0;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCart(e){return qb(e)}getCooeeCart(){return Zf()}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.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.discount_codes=e.discount_codes,this.total_discount=e.total_discount,fe().currencyCode=this.currency,w.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function qb(t){let e=de.getCurrent();await Kb(e,t);let r=yg(e);return t&&await ze.set("cart",r),r}function Zf(){return yg(de.getCurrent())}function yg(t){return{amount:t.total_price/100,originalAmount:t.original_total_price/100,itemsSubtotalPrice:t.items_subtotal_price/100,currency:t.currency,itemCount:t.item_count,items:Yb(t.items),token:t.token}}function Yb(t){if(!t)return w.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);let e=[];for(let r of t){if(!r.id||!r.title){w.warn("Invalid item received",r);continue}let n={name:r.title,quantity:+r.quantity||1,mID:r.product_id?.toString(),vID:r.id.toString(),price:+r.price/100||0,finalPrice:+r.final_price/100||0,properties:r.properties,key:r.key},o=r.selling_plan_allocation?.selling_plan;if(!o){e.push(n);continue}n.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},e.push(n)}return e}async function Kb(t,e){if(!e&&t.token){w.verbose("Not fetching cart");return}w.verbose("Fetching cart");let r=ic("/cart.js");try{let n=(await tn(r)).data;t.update(n)}catch(n){w.error("Unable to fetch the cart",n)}}var sc=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 ep=class{enabled;constructor(e){this.enabled=e.enabled}},tp=class extends ep{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},ac=class{productQuantity;constructor(e){e??={},this.productQuantity=new tp(e.productQuantity)}};var qt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new Wn(e.bg)),e.br&&(this.br=new Zr(e.br)),e.shd&&(this.shd=new Mi(e.shd)),e.spc&&(this.spc=new en(e.spc)),this.trf=new jn(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 je[this.t]}get click(){return this.clc}},je=(B=>(B[B.IMAGE=1]="IMAGE",B[B.TEXT=2]="TEXT",B[B.BUTTON=3]="BUTTON",B[B.FLEXBOX=4]="FLEXBOX",B[B.MULTI_COLUMN=5]="MULTI_COLUMN",B[B.CHECKBOX=6]="CHECKBOX",B[B.PRODUCTS=11]="PRODUCTS",B[B.PRODUCT=12]="PRODUCT",B[B.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",B[B.PRODUCT_TITLE=14]="PRODUCT_TITLE",B[B.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",B[B.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",B[B.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",B[B.PRODUCT_RATING=19]="PRODUCT_RATING",B[B.EMAIL_INPUT=51]="EMAIL_INPUT",B[B.PHONE_INPUT=52]="PHONE_INPUT",B[B.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",B[B.CAROUSEL=62]="CAROUSEL",B[B.SHAPE=100]="SHAPE",B))(je||{});var to=class extends qt{constructor(e){super(e)}};var ln=class extends qt{src;constructor(e){super(e),this.src=e.src}};var kr=class extends qt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new at(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var An=class extends kr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var cc=class extends qt{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 jo=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 o=window.setInterval(()=>{let i=new Date().getTime(),s=n.getTime()-i;if(s<1){clearInterval(o);return}let a=Math.floor(s/(1e3*60*60*24)),l=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),f=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:l,minutes:f,seconds:d})},1e3);return o}};var Go=class extends kr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new jo(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var lc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new Ve(e.c??{})}get text(){return this.txt}get color(){return this.c}};var Dn=class extends kr{ph;constructor(e){super(e),this.ph=new lc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var zo=class extends Dn{constructor(e){e??={},super(e)}};var qo=class extends Dn{};var Yo=class extends Dn{};var Ko=class extends ln{};var uc=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 fc=15,os=class extends qt{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new uc(e.anim),this.spc||(this.spc=new en({pl:fc,pr:fc,pt:fc,pb:fc}))}};var pc=class extends os{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new cc(e.cont),this.mob=new os(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new ln(r)):r.t===2?this.elems.push(new An(r)):r.t===3?this.elems.push(new An(r)):r.t===100?this.elems.push(new to(r)):r.t===51?this.elems.push(new qo(r)):r.t===52?this.elems.push(new Yo(r)):r.t===61?this.elems.push(new Go(r)):r.t===15||r.t===16?this.elems.push(new zo(r)):r.t===13&&this.elems.push(new Ko(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}};var Xo=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 mc=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 dc=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 hc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new en(e.spc),e.size&&(this.size=new dc(e.size)),e.bg&&(this.bg=new Wn(e.bg)),e.br&&(this.br=new Zr(e.br)),e.typo&&(this.typo=new at(e.typo)),e.lout&&(this.lout=new mc(e.lout)),e.flex&&(this.flex=new Xo(e.flex))}},Jo=class{sm;lg;constructor(e){e??={},this.sm=new hc(e.sm),this.lg=new hc(e.lg)}};var ht=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new Jo(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return je[this.t]}};var gt=class extends ht{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 ro=class extends gt{constructor(e,r){super(e,r??3)}};var Qo=class extends ht{value;constructor(e){super(6,e),e??={},this.value=e.value}};var Zo=class extends gt{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var gc=class extends ht{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new Ve(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var vg=Xr(zs());var yc=class extends ht{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Yt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new Rn(e.conf),this.allowedTypes=e.allowedTypes}};var vc=class extends gt{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new jo(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var On=class extends ht{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Yt.getParsedElement(r);n&&this.elems.push(n)})}};var no=class extends ht{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 Yt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let o=t.getParsedElement(n);o&&r.push(o)}),r}static getParsedElement(e){switch(e.t){case 2:return new gt(e);case 3:return new ro(e);case 6:return new Qo(e);case 11:return new _c(e);case 12:return new Nn(e);case 61:return new vc(e);case 4:return new On(e);case 1:return new no(e);case 13:return new no(e,13);case 14:return new gt(e,14);case 15:case 16:return new Zo(e.t,e);case 18:return new ro(e,18);case 62:return new yc(e);case 19:return new gc(e);default:vg.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 Nn=class extends ht{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=Yt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new Qo(e.cBox)),this.elems.push(new no(e.img,13));let r=new gt(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new gt(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let o=new gt(e.compareAt);o.text="{{ product.compare_price }}",o.hide=!e.show?.price,e.compareAt||(o.style=new Jo(n.style),o.style.lg.typo=new at(Z(_({},o.style.lg.typo),{td:"line-through"})),o.style.sm.typo=new at(Z(_({},o.style.sm.typo),{td:"line-through"})));let i=new On({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Yt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});i.elems.push(o),i.elems.push(n),this.elems.push(i);let s=new Zo(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new ro(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new gt(e.symbol))}};var _c=class extends ht{conf;prod;constructor(e){super(11,e),e??={},this.conf=new rp(e.conf),this.prod=new Nn(e.prod)}};var Ec=class extends Rn{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},rp=class{lg;sm;constructor(e){e??={},this.lg=new Ec(e.lg),this.sm=new Ec(e.sm)}};var wc=class extends On{constructor(e){super(e)}};var ei=class{cont;elems=[];constructor(e){e=e??{},this.cont=new wc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Yt.getParsedElement(e);return r&&this.elems.push(r),r}};function bc(t,e){return Xb(t,e,0,5)}function Xb(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let o of e){if(o.t===t)return o;let i="elems"in o?o.elems:[];if(i?.length>0){let s=bc(t,i);if(s)return s}}}}var np=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===Di.EXCLUSION}isABTesting(){return this.contentType===Di.ABTESTING}isSingleContent(){return this.contentType===Di.SINGLE}},is=class{videoConfig;savingsBarConfig;afterDeleteJS;afterRenderJS;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new rc(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new ta(e.savingsBarConfig)),e.afterDeleteJS&&(this.afterDeleteJS=e.afterDeleteJS),e.afterRenderJS&&(this.afterRenderJS=e.afterRenderJS)}},St=class extends np{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=ir({});constructor(e){super(e),this.id=e.id,this.currency=fe().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new ei(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new Ot(r)),this.items=e.items?.map(r=>new Ct(r))??[],this.nonMutableItems=e.items?.map(r=>new Ct(r))??[],this.collections=e.collections?.map(r=>new sc(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 ac(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new Qs(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new ea(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Ks(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Ct(e.bundleFrom)),e.content&&(this.content=new is(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===yr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Oi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Oi.PAGE_EMBED}isProgressBar(){return this.objective===yr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===yr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===yr.CART_RECOVERY}isProductPromotion(){return this.objective===yr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===tu.COLLECTION}isBYOB(){return this.objective===yr.BYOB}isStickyATC(){return this.objective===yr.STICKY_ATC}isShoppableVideo(){return this.objective===yr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===yr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},o={};if(r){let a=r.selectedOrFirstVariant.value;n=Z(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},Mt("price",a.price.d)),Mt("comparePrice",a.price.cmp)),{quantity:r.quantity}),o={quantity:a.quantity}}let i={productCount:de.getCurrent().item_count},s=Vo(JSON.stringify(e),{product:n,variant:o,cart:i,discount:this.discount,customer:this.customerData},new Cr(new Date,this));return r&&(s=s.replace(new RegExp("https://cdn.global.letscooee.com/images/placeholders/product.png","gi"),r.variantImage??r.firstImageURL)),new pc(JSON.parse(s))}calculateDiscountData(e,r){let n=Qr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),o=Qr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),i={actualPrice:n,totalComparePrice:o,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(i);return}if(er.BXGY===this.discount.type&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,i.discountPercentage,!0),i.discountAmount=i.actualPrice-Qr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([er.STATIC,er.UNIQUE_FLAT].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(er.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType==="fixed_amount"?(i.discountAmount=this.discount.values[0],i.discountPercentage=i.actualPrice>0?i.discountAmount*100/i.actualPrice:0):(i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100),this.updateEffectivePrice(e,i.discountPercentage);else if(this.discount.type===er.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===er.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,l)=>l.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,i.discountAmount=s.selectedOrFirstVariant.value.price.d,i.discountPercentage=i.discountAmount/i.actualPrice*100}i.discountedPrice=i.actualPrice-i.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(i)}getPrivateAttributesForLineItem(){return Ye.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Ye.get().skipItemAttribute?[]:[{key:"_via",value:"Cooee"},{key:"_letscooee_campaign",value:this.shortID},{key:"_letscooee_content",value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(bc(62,this.widget?.elems))return!0;let r=bc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===Oi.POPUP?e="Popup":e=Um.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=de.getCurrent(),r=Qr.sum(e.items??[],n=>n.discounts?.reduce((o,i)=>o+(i.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},Mt("amount",e.total_price/100)),Mt("originalAmount",e.original_total_price/100)),Mt("total_line_items_discount",r/100)),Mt("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.isProgressBar()&&!this.isSavingsBar()}shouldSkipVariation(){return this.isSingleContent()||this.isProgressBar()||this.isSavingsBar()||!!this.widget}updateEffectivePrice(e,r,n=!1){let o=fe().currentItem;e.forEach(i=>{let s=i.selectedOrFirstVariant.value,a=s.price;if(n&&i.mID===o.mID)s.effectivePrice.value=a.d;else{let l=a.d*r/100;s.effectivePrice.value=a.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Lh(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Mt(n,e[n]))}),r}};function Qb(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Zb=nS,eS=iS,tS=cS,Hr=[],ar=[],rS=typeof Uint8Array<"u"?Uint8Array:Array,op="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(oo=0,_g=op.length;oo<_g;++oo)Hr[oo]=op[oo],ar[op.charCodeAt(oo)]=oo;var oo,_g;ar[45]=62;ar[95]=63;function Mg(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 nS(t){var e=Mg(t),r=e[0],n=e[1];return(r+n)*3/4-n}function oS(t,e,r){return(e+r)*3/4-r}function iS(t){var e,r=Mg(t),n=r[0],o=r[1],i=new rS(oS(t,n,o)),s=0,a=o>0?n-4:n,l;for(l=0;l<a;l+=4)e=ar[t.charCodeAt(l)]<<18|ar[t.charCodeAt(l+1)]<<12|ar[t.charCodeAt(l+2)]<<6|ar[t.charCodeAt(l+3)],i[s++]=e>>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=ar[t.charCodeAt(l)]<<2|ar[t.charCodeAt(l+1)]>>4,i[s++]=e&255),o===1&&(e=ar[t.charCodeAt(l)]<<10|ar[t.charCodeAt(l+1)]<<4|ar[t.charCodeAt(l+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function sS(t){return Hr[t>>18&63]+Hr[t>>12&63]+Hr[t>>6&63]+Hr[t&63]}function aS(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(sS(n));return o.join("")}function cS(t){for(var e,r=t.length,n=r%3,o=[],i=16383,s=0,a=r-n;s<a;s+=i)o.push(aS(t,s,s+i>a?a:s+i));return n===1?(e=t[r-1],o.push(Hr[e>>2]+Hr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(Hr[e>>10]+Hr[e>>4&63]+Hr[e<<2&63]+"=")),o.join("")}var ip={byteLength:Zb,toByteArray:eS,fromByteArray:tS};var lS=function(e,r,n,o,i){var s,a,l=i*8-o-1,f=(1<<l)-1,d=f>>1,m=-7,E=n?i-1:0,y=n?-1:1,C=e[r+E];for(E+=y,s=C&(1<<-m)-1,C>>=-m,m+=l;m>0;s=s*256+e[r+E],E+=y,m-=8);for(a=s&(1<<-m)-1,s>>=-m,m+=o;m>0;a=a*256+e[r+E],E+=y,m-=8);if(s===0)s=1-d;else{if(s===f)return a?NaN:(C?-1:1)*(1/0);a=a+Math.pow(2,o),s=s-d}return(C?-1:1)*a*Math.pow(2,s-o)},uS=function(e,r,n,o,i,s){var a,l,f,d=s*8-i-1,m=(1<<d)-1,E=m>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=o?0:s-1,D=o?1:-1,N=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=m):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+E>=1?r+=y/f:r+=y*Math.pow(2,1-E),r*f>=2&&(a++,f/=2),a+E>=m?(l=0,a=m):a+E>=1?(l=(r*f-1)*Math.pow(2,i),a=a+E):(l=r*Math.pow(2,E-1)*Math.pow(2,i),a=0));i>=8;e[n+C]=l&255,C+=D,l/=256,i-=8);for(a=a<<i|l,d+=i;d>0;e[n+C]=a&255,C+=D,a/=256,d-=8);e[n+C-D]|=N*128},ti={read:lS,write:uS},Ic=Qb(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=k,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=o(),!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 o(){try{var h=new Uint8Array(1),c={foo:function(){return 42}};return Object.setPrototypeOf(c,Uint8Array.prototype),Object.setPrototypeOf(h,c),h.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 i(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var c=new Uint8Array(h);return Object.setPrototypeOf(c,s.prototype),c}function s(h,c,u){if(typeof h=="number"){if(typeof c=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(h)}return a(h,c,u)}s.poolSize=8192;function a(h,c,u){if(typeof h=="string")return m(h,c);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if($e(h,ArrayBuffer)||h&&$e(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($e(h,SharedArrayBuffer)||h&&$e(h.buffer,SharedArrayBuffer)))return C(h,c,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,c,u);var x=D(h);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),c,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,c,u){return a(h,c,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function f(h,c,u){return l(h),h<=0?i(h):c!==void 0?typeof u=="string"?i(h).fill(c,u):i(h).fill(c):i(h)}s.alloc=function(h,c,u){return f(h,c,u)};function d(h){return l(h),i(h<0?0:N(h)|0)}s.allocUnsafe=function(h){return d(h)},s.allocUnsafeSlow=function(h){return d(h)};function m(h,c){if((typeof c!="string"||c==="")&&(c="utf8"),!s.isEncoding(c))throw new TypeError("Unknown encoding: "+c);var u=X(h,c)|0,v=i(u),x=v.write(h,c);return x!==u&&(v=v.slice(0,x)),v}function E(h){for(var c=h.length<0?0:N(h.length)|0,u=i(c),v=0;v<c;v+=1)u[v]=h[v]&255;return u}function y(h){if($e(h,Uint8Array)){var c=new Uint8Array(h);return C(c.buffer,c.byteOffset,c.byteLength)}return E(h)}function C(h,c,u){if(c<0||h.byteLength<c)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<c+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return c===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,c):v=new Uint8Array(h,c,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var c=N(h.length)|0,u=i(c);return u.length===0||h.copy(u,0,0,c),u}if(h.length!==void 0)return typeof h.length!="number"||De(h.length)?i(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function N(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function k(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==s.prototype},s.compare=function(c,u){if($e(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),$e(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(c)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===u)return 0;for(var v=c.length,x=u.length,O=0,W=Math.min(v,x);O<W;++O)if(c[O]!==u[O]){v=c[O],x=u[O];break}return v<x?-1:x<v?1:0},s.isEncoding=function(c){switch(String(c).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(c,u){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<c.length;++v)u+=c[v].length;var x=s.allocUnsafe(u),O=0;for(v=0;v<c.length;++v){var W=c[v];if($e(W,Uint8Array))O+W.length>x.length?s.from(W).copy(x,O):Uint8Array.prototype.set.call(x,W,O);else if(s.isBuffer(W))W.copy(x,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=W.length}return x};function X(h,c){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||$e(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var x=!1;;)switch(c){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return Et(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return He(h).length;default:if(x)return v?-1:Et(h).length;c=(""+c).toLowerCase(),x=!0}}s.byteLength=X;function B(h,c,u){var v=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,c>>>=0,u<=c))return"";for(h||(h="utf8");;)switch(h){case"hex":return V(this,c,u);case"utf8":case"utf-8":return Ge(this,c,u);case"ascii":return A(this,c,u);case"latin1":case"binary":return R(this,c,u);case"base64":return Re(this,c,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,c,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function Q(h,c,u){var v=h[c];h[c]=h[u],h[u]=v}s.prototype.swap16=function(){var c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<c;u+=2)Q(this,u,u+1);return this},s.prototype.swap32=function(){var c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<c;u+=4)Q(this,u,u+3),Q(this,u+1,u+2);return this},s.prototype.swap64=function(){var c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<c;u+=8)Q(this,u,u+7),Q(this,u+1,u+6),Q(this,u+2,u+5),Q(this,u+3,u+4);return this},s.prototype.toString=function(){var c=this.length;return c===0?"":arguments.length===0?Ge(this,0,c):B.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(c){if(!s.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:s.compare(this,c)===0},s.prototype.inspect=function(){var c="",u=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(c+=" ... "),"<Buffer "+c+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(c,u,v,x,O){if($e(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(c));if(u===void 0&&(u=0),v===void 0&&(v=c?c.length:0),x===void 0&&(x=0),O===void 0&&(O=this.length),u<0||v>c.length||x<0||O>this.length)throw new RangeError("out of range index");if(x>=O&&u>=v)return 0;if(x>=O)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,x>>>=0,O>>>=0,this===c)return 0;for(var W=O-x,ue=v-u,Ee=Math.min(W,ue),ye=this.slice(x,O),Le=c.slice(u,v),ke=0;ke<Ee;++ke)if(ye[ke]!==Le[ke]){W=ye[ke],ue=Le[ke];break}return W<ue?-1:ue<W?1:0};function _e(h,c,u,v,x){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,De(u)&&(u=x?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(x)return-1;u=h.length-1}else if(u<0)if(x)u=0;else return-1;if(typeof c=="string"&&(c=s.from(c,v)),s.isBuffer(c))return c.length===0?-1:K(h,c,u,v,x);if(typeof c=="number")return c=c&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(h,c,u):Uint8Array.prototype.lastIndexOf.call(h,c,u):K(h,[c],u,v,x);throw new TypeError("val must be string, number or Buffer")}function K(h,c,u,v,x){var O=1,W=h.length,ue=c.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||c.length<2)return-1;O=2,W/=2,ue/=2,u/=2}function Ee(mr,Kr){return O===1?mr[Kr]:mr.readUInt16BE(Kr*O)}var ye;if(x){var Le=-1;for(ye=u;ye<W;ye++)if(Ee(h,ye)===Ee(c,Le===-1?0:ye-Le)){if(Le===-1&&(Le=ye),ye-Le+1===ue)return Le*O}else Le!==-1&&(ye-=ye-Le),Le=-1}else for(u+ue>W&&(u=W-ue),ye=u;ye>=0;ye--){for(var ke=!0,nt=0;nt<ue;nt++)if(Ee(h,ye+nt)!==Ee(c,nt)){ke=!1;break}if(ke)return ye}return-1}s.prototype.includes=function(c,u,v){return this.indexOf(c,u,v)!==-1},s.prototype.indexOf=function(c,u,v){return _e(this,c,u,v,!0)},s.prototype.lastIndexOf=function(c,u,v){return _e(this,c,u,v,!1)};function ce(h,c,u,v){u=Number(u)||0;var x=h.length-u;v?(v=Number(v),v>x&&(v=x)):v=x;var O=c.length;v>O/2&&(v=O/2);for(var W=0;W<v;++W){var ue=parseInt(c.substr(W*2,2),16);if(De(ue))return W;h[u+W]=ue}return W}function se(h,c,u,v){return Ae(Et(c,h.length-u),h,u,v)}function me(h,c,u,v){return Ae(st(c),h,u,v)}function Pe(h,c,u,v){return Ae(He(c),h,u,v)}function Se(h,c,u,v){return Ae(be(c,h.length-u),h,u,v)}s.prototype.write=function(c,u,v,x){if(u===void 0)x="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")x=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,x===void 0&&(x="utf8")):(x=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var O=this.length-u;if((v===void 0||v>O)&&(v=O),c.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var W=!1;;)switch(x){case"hex":return ce(this,c,u,v);case"utf8":case"utf-8":return se(this,c,u,v);case"ascii":case"latin1":case"binary":return me(this,c,u,v);case"base64":return Pe(this,c,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,c,u,v);default:if(W)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),W=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Re(h,c,u){return c===0&&u===h.length?ip.fromByteArray(h):ip.fromByteArray(h.slice(c,u))}function Ge(h,c,u){u=Math.min(h.length,u);for(var v=[],x=c;x<u;){var O=h[x],W=null,ue=O>239?4:O>223?3:O>191?2:1;if(x+ue<=u){var Ee,ye,Le,ke;switch(ue){case 1:O<128&&(W=O);break;case 2:Ee=h[x+1],(Ee&192)===128&&(ke=(O&31)<<6|Ee&63,ke>127&&(W=ke));break;case 3:Ee=h[x+1],ye=h[x+2],(Ee&192)===128&&(ye&192)===128&&(ke=(O&15)<<12|(Ee&63)<<6|ye&63,ke>2047&&(ke<55296||ke>57343)&&(W=ke));break;case 4:Ee=h[x+1],ye=h[x+2],Le=h[x+3],(Ee&192)===128&&(ye&192)===128&&(Le&192)===128&&(ke=(O&15)<<18|(Ee&63)<<12|(ye&63)<<6|Le&63,ke>65535&&ke<1114112&&(W=ke))}}W===null?(W=65533,ue=1):W>65535&&(W-=65536,v.push(W>>>10&1023|55296),W=56320|W&1023),v.push(W),x+=ue}return kt(v)}var Ze=4096;function kt(h){var c=h.length;if(c<=Ze)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<c;)u+=String.fromCharCode.apply(String,h.slice(v,v+=Ze));return u}function A(h,c,u){var v="";u=Math.min(h.length,u);for(var x=c;x<u;++x)v+=String.fromCharCode(h[x]&127);return v}function R(h,c,u){var v="";u=Math.min(h.length,u);for(var x=c;x<u;++x)v+=String.fromCharCode(h[x]);return v}function V(h,c,u){var v=h.length;(!c||c<0)&&(c=0),(!u||u<0||u>v)&&(u=v);for(var x="",O=c;O<u;++O)x+=Wt[h[O]];return x}function U(h,c,u){for(var v=h.slice(c,u),x="",O=0;O<v.length-1;O+=2)x+=String.fromCharCode(v[O]+v[O+1]*256);return x}s.prototype.slice=function(c,u){var v=this.length;c=~~c,u=u===void 0?v:~~u,c<0?(c+=v,c<0&&(c=0)):c>v&&(c=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<c&&(u=c);var x=this.subarray(c,u);return Object.setPrototypeOf(x,s.prototype),x};function H(h,c,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+c>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=this[c],O=1,W=0;++W<u&&(O*=256);)x+=this[c+W]*O;return x},s.prototype.readUintBE=s.prototype.readUIntBE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=this[c+--u],O=1;u>0&&(O*=256);)x+=this[c+--u]*O;return x},s.prototype.readUint8=s.prototype.readUInt8=function(c,u){return c=c>>>0,u||H(c,1,this.length),this[c]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(c,u){return c=c>>>0,u||H(c,2,this.length),this[c]|this[c+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(c,u){return c=c>>>0,u||H(c,2,this.length),this[c]<<8|this[c+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(c,u){return c=c>>>0,u||H(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(c,u){return c=c>>>0,u||H(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},s.prototype.readIntLE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=this[c],O=1,W=0;++W<u&&(O*=256);)x+=this[c+W]*O;return O*=128,x>=O&&(x-=Math.pow(2,8*u)),x},s.prototype.readIntBE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=u,O=1,W=this[c+--x];x>0&&(O*=256);)W+=this[c+--x]*O;return O*=128,W>=O&&(W-=Math.pow(2,8*u)),W},s.prototype.readInt8=function(c,u){return c=c>>>0,u||H(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},s.prototype.readInt16LE=function(c,u){c=c>>>0,u||H(c,2,this.length);var v=this[c]|this[c+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(c,u){c=c>>>0,u||H(c,2,this.length);var v=this[c+1]|this[c]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(c,u){return c=c>>>0,u||H(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},s.prototype.readInt32BE=function(c,u){return c=c>>>0,u||H(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},s.prototype.readFloatLE=function(c,u){return c=c>>>0,u||H(c,4,this.length),ti.read(this,c,!0,23,4)},s.prototype.readFloatBE=function(c,u){return c=c>>>0,u||H(c,4,this.length),ti.read(this,c,!1,23,4)},s.prototype.readDoubleLE=function(c,u){return c=c>>>0,u||H(c,8,this.length),ti.read(this,c,!0,52,8)},s.prototype.readDoubleBE=function(c,u){return c=c>>>0,u||H(c,8,this.length),ti.read(this,c,!1,52,8)};function ne(h,c,u,v,x,O){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>x||c<O)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(c,u,v,x){if(c=+c,u=u>>>0,v=v>>>0,!x){var O=Math.pow(2,8*v)-1;ne(this,c,u,v,O,0)}var W=1,ue=0;for(this[u]=c&255;++ue<v&&(W*=256);)this[u+ue]=c/W&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(c,u,v,x){if(c=+c,u=u>>>0,v=v>>>0,!x){var O=Math.pow(2,8*v)-1;ne(this,c,u,v,O,0)}var W=v-1,ue=1;for(this[u+W]=c&255;--W>=0&&(ue*=256);)this[u+W]=c/ue&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,1,255,0),this[u]=c&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,65535,0),this[u]=c&255,this[u+1]=c>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,65535,0),this[u]=c>>>8,this[u+1]=c&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,4294967295,0),this[u+3]=c>>>24,this[u+2]=c>>>16,this[u+1]=c>>>8,this[u]=c&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,4294967295,0),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4},s.prototype.writeIntLE=function(c,u,v,x){if(c=+c,u=u>>>0,!x){var O=Math.pow(2,8*v-1);ne(this,c,u,v,O-1,-O)}var W=0,ue=1,Ee=0;for(this[u]=c&255;++W<v&&(ue*=256);)c<0&&Ee===0&&this[u+W-1]!==0&&(Ee=1),this[u+W]=(c/ue>>0)-Ee&255;return u+v},s.prototype.writeIntBE=function(c,u,v,x){if(c=+c,u=u>>>0,!x){var O=Math.pow(2,8*v-1);ne(this,c,u,v,O-1,-O)}var W=v-1,ue=1,Ee=0;for(this[u+W]=c&255;--W>=0&&(ue*=256);)c<0&&Ee===0&&this[u+W+1]!==0&&(Ee=1),this[u+W]=(c/ue>>0)-Ee&255;return u+v},s.prototype.writeInt8=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,1,127,-128),c<0&&(c=255+c+1),this[u]=c&255,u+1},s.prototype.writeInt16LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,32767,-32768),this[u]=c&255,this[u+1]=c>>>8,u+2},s.prototype.writeInt16BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,32767,-32768),this[u]=c>>>8,this[u+1]=c&255,u+2},s.prototype.writeInt32LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,2147483647,-2147483648),this[u]=c&255,this[u+1]=c>>>8,this[u+2]=c>>>16,this[u+3]=c>>>24,u+4},s.prototype.writeInt32BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4};function ge(h,c,u,v,x,O){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function qe(h,c,u,v,x){return c=+c,u=u>>>0,x||ge(h,c,u,4),ti.write(h,c,u,v,23,4),u+4}s.prototype.writeFloatLE=function(c,u,v){return qe(this,c,u,!0,v)},s.prototype.writeFloatBE=function(c,u,v){return qe(this,c,u,!1,v)};function tt(h,c,u,v,x){return c=+c,u=u>>>0,x||ge(h,c,u,8),ti.write(h,c,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(c,u,v){return tt(this,c,u,!0,v)},s.prototype.writeDoubleBE=function(c,u,v){return tt(this,c,u,!1,v)},s.prototype.copy=function(c,u,v,x){if(!s.isBuffer(c))throw new TypeError("argument should be a Buffer");if(v||(v=0),!x&&x!==0&&(x=this.length),u>=c.length&&(u=c.length),u||(u=0),x>0&&x<v&&(x=v),x===v||c.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=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),c.length-u<x-v&&(x=c.length-u+v);var O=x-v;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,x):Uint8Array.prototype.set.call(c,this.subarray(v,x),u),O},s.prototype.fill=function(c,u,v,x){if(typeof c=="string"){if(typeof u=="string"?(x=u,u=0,v=this.length):typeof v=="string"&&(x=v,v=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(c.length===1){var O=c.charCodeAt(0);(x==="utf8"&&O<128||x==="latin1")&&(c=O)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,c||(c=0);var W;if(typeof c=="number")for(W=u;W<v;++W)this[W]=c;else{var ue=s.isBuffer(c)?c:s.from(c,x),Ee=ue.length;if(Ee===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(W=0;W<v-u;++W)this[W+u]=ue[W%Ee]}return this};var rt=/[^+/0-9A-Za-z-_]/g;function _t(h){if(h=h.split("=")[0],h=h.trim().replace(rt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function Et(h,c){c=c||1/0;for(var u,v=h.length,x=null,O=[],W=0;W<v;++W){if(u=h.charCodeAt(W),u>55295&&u<57344){if(!x){if(u>56319){(c-=3)>-1&&O.push(239,191,189);continue}else if(W+1===v){(c-=3)>-1&&O.push(239,191,189);continue}x=u;continue}if(u<56320){(c-=3)>-1&&O.push(239,191,189),x=u;continue}u=(x-55296<<10|u-56320)+65536}else x&&(c-=3)>-1&&O.push(239,191,189);if(x=null,u<128){if((c-=1)<0)break;O.push(u)}else if(u<2048){if((c-=2)<0)break;O.push(u>>6|192,u&63|128)}else if(u<65536){if((c-=3)<0)break;O.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((c-=4)<0)break;O.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return O}function st(h){for(var c=[],u=0;u<h.length;++u)c.push(h.charCodeAt(u)&255);return c}function be(h,c){for(var u,v,x,O=[],W=0;W<h.length&&!((c-=2)<0);++W)u=h.charCodeAt(W),v=u>>8,x=u%256,O.push(x),O.push(v);return O}function He(h){return ip.toByteArray(_t(h))}function Ae(h,c,u,v){for(var x=0;x<v&&!(x+u>=c.length||x>=h.length);++x)c[x+u]=h[x];return x}function $e(h,c){return h instanceof c||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===c.name}function De(h){return h!==h}var Wt=(function(){for(var h="0123456789abcdef",c=new Array(256),u=0;u<16;++u)for(var v=u*16,x=0;x<16;++x)c[v+x]=h[u]+h[x];return c})()}),Ie=Ic.Buffer;Ic.SlowBuffer;Ic.INSPECT_MAX_BYTES;Ic.kMaxLength;var up=function(e,r){return up=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},up(e,r)};function xc(t,e){up(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var so=(function(t){xc(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),Xe=(function(t){xc(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 Sc(t){return t&&t.Math==Math&&t}function Bg(){return Sc(typeof globalThis=="object"&&globalThis)||Sc(typeof window=="object"&&window)||Sc(typeof self=="object"&&self)||Sc(typeof global=="object"&&global)||Function("return this")()}function fS(){var t=Bg();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var pS=function(e){var r=fS()?"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=Ie.alloc(e),o=0;o<e;++o)n[o]=Math.floor(Math.random()*256);return n},mS=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ie.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ie.alloc(e))}:pS}},Ug=mS();function dS(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function pp(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function hS(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function gS(t){return ls(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ls(t){return typeof t=="object"&&t!==null}function Cc(t,e){var r=!1;function n(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return r||(console.warn(e),r=!0),t.apply(this,o)}return n}function Tc(t){if(ArrayBuffer.isView(t))return Ie.from(t.buffer,t.byteOffset,t.byteLength);if(dS(t))return Ie.from(t);throw new Xe("Must use either Buffer or TypedArray")}var yS=/^(?:[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,kg=function(t){return typeof t=="string"&&yS.test(t)},fp=function(t){if(!kg(t))throw new Xe('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 Ie.from(e,"hex")},Eg=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 BU=Math.pow(2,63)-1,UU=-Math.pow(2,63),vS=Math.pow(2,53),_S=-Math.pow(2,53);var Fg=4;var ao=(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 Xe("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=Ie.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ie.from(e,"binary"):Array.isArray(e)?this.buffer=Ie.from(e):this.buffer=Tc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Xe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Xe("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 Xe("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=Ie.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=Ie.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Tc(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 wg(this.buffer.slice(0,this.position));throw new so('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,o;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(o=e.$type?parseInt(e.$type,16):0,n=Ie.from(e.$binary,"base64")):typeof e.$binary!="string"&&(o=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ie.from(e.$binary.base64,"base64")):"$uuid"in e&&(o=4,n=fp(e.$uuid)),!n)throw new Xe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return o===Fg?new wg(n):new t(n,o)},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(ao.prototype,"_bsontype",{value:"Binary"});var sp=16,wg=(function(t){xc(e,t);function e(r){var n=this,o,i;if(r==null)o=e.generate();else if(r instanceof e)o=Ie.from(r.buffer),i=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===sp)o=Tc(r);else if(typeof r=="string")o=fp(r);else throw new Xe("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,o,Fg)||this,n.__id=i,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Eg(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=Eg(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 ao(this.id,ao.SUBTYPE_UUID)},e.generate=function(){var r=Ug(sp);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ie.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?kg(r):pp(r)?r.length!==sp?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=fp(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})(ao),Rc=(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(Rc.prototype,"_bsontype",{value:"Code"});function ES(t){return ls(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var as=(function(){function t(e,r,n,o){if(!(this instanceof t))return new t(e,r,n,o);var i=e.split(".");i.length===2&&(n=i.shift(),e=i.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=o||{}}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(as.prototype,"_bsontype",{value:"DBRef"});var sr=void 0;try{sr=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 bg=65536,wS=1<<24,ni=bg*bg,Hg=ni*ni,Sg=Hg/2,Tg={},Ig={},oe=(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,o,i;return r?(e>>>=0,(i=0<=e&&e<256)&&(o=Ig[e],o)?o:(n=t.fromBits(e,(e|0)<0?-1:0,!0),i&&(Ig[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=Tg[e],o)?o:(n=t.fromBits(e,e<0?-1:0,!1),i&&(Tg[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>=Hg)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Sg)return t.MIN_VALUE;if(e+1>=Sg)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%ni|0,e/ni|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 o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return t.fromString(e.substring(1),r,n).neg();for(var i=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var l=Math.min(8,e.length-a),f=parseInt(e.substring(a,a+l),n);if(l<8){var d=t.fromNumber(Math.pow(n,l));s=s.mul(d).add(t.fromNumber(f))}else s=s.mul(i),s=s.add(t.fromNumber(f))}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 ls(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,o=this.low>>>16,i=this.low&65535,s=e.high>>>16,a=e.high&65535,l=e.low>>>16,f=e.low&65535,d=0,m=0,E=0,y=0;return y+=i+f,E+=y>>>16,y&=65535,E+=o+l,m+=E>>>16,E&=65535,m+=n+a,d+=m>>>16,m&=65535,d+=r+s,d&=65535,t.fromBits(E<<16|y,d<<16|m,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(sr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?sr.div_u:sr.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;i=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:(o=this.sub(e.mul(n)),i=n.add(o.div(e)),i)}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();i=t.ZERO}for(o=this;o.gte(e);){n=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),l=a<=48?1:Math.pow(2,a-48),f=t.fromNumber(n),d=f.mul(e);d.isNegative()||d.gt(o);)n-=l,f=t.fromNumber(n,this.unsigned),d=f.mul(e);f.isZero()&&(f=t.ONE),i=i.add(f),o=o.sub(d)}return i},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)),sr){var r=(this.unsigned?sr.rem_u:sr.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.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)),sr){var r=sr.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.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,o=this.high&65535,i=this.low>>>16,s=this.low&65535,a=e.high>>>16,l=e.high&65535,f=e.low>>>16,d=e.low&65535,m=0,E=0,y=0,C=0;return C+=s*d,y+=C>>>16,C&=65535,y+=i*d,E+=y>>>16,y&=65535,y+=s*f,E+=y>>>16,y&=65535,E+=o*d,m+=E>>>16,E&=65535,E+=i*f,m+=E>>>16,E&=65535,E+=s*l,m+=E>>>16,E&=65535,m+=n*d+o*f+i*l+s*a,m&=65535,t.fromBits(y<<16|C,m<<16|E,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)*ni+(this.low>>>0):this.high*ni+(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),o=n.mul(r).sub(this);return n.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var l=s.div(i),f=s.sub(l.mul(i)).toInt()>>>0,d=f.toString(e);if(s=l,s.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+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(wS),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(oe.prototype,"__isLong__",{value:!0});Object.defineProperty(oe.prototype,"_bsontype",{value:"Long"});var bS=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,SS=/^(\+|-)?(Infinity|inf)$/i,TS=/^(\+|-)?NaN$/i,ss=6111,ap=-6176,xg=6176,IS=34,cp=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Cg=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Rg=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),xS=/^([-+])?(\d+)?$/,CS=31,Ag=16383,RS=30,AS=31;function Dg(t){return!isNaN(parseInt(t,10))}function DS(t){var e=oe.fromNumber(1e9),r=oe.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 oe(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function OS(t,e){if(!t&&!e)return{high:oe.fromNumber(0),low:oe.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new oe(t.getLowBits(),0),o=e.shiftRightUnsigned(32),i=new oe(e.getLowBits(),0),s=r.multiply(o),a=r.multiply(i),l=n.multiply(o),f=n.multiply(i);return s=s.add(a.shiftRightUnsigned(32)),a=new oe(a.getLowBits(),0).add(l).add(f.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),f=a.shiftLeft(32).add(new oe(f.getLowBits(),0)),{high:s,low:f}}function NS(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var o=t.low>>>0,i=e.low>>>0;if(o<i)return!0}return!1}function ri(t,e){throw new Xe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var mp=(function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(pp(e)){if(e.byteLength!==16)throw new Xe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Xe("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,o=!1,i=0,s=0,a=0,l=0,f=0,d=[0],m=0,E=0,y=0,C=0,D=0,N=0,k=new oe(0,0),X=new oe(0,0),B=0,Q=0;if(e.length>=7e3)throw new Xe(""+e+" not a valid Decimal128 string");var _e=e.match(bS),K=e.match(SS),ce=e.match(TS);if(!_e&&!K&&!ce||e.length===0)throw new Xe(""+e+" not a valid Decimal128 string");if(_e){var se=_e[2],me=_e[4],Pe=_e[5],Se=_e[6];me&&Se===void 0&&ri(e,"missing exponent power"),me&&se===void 0&&ri(e,"missing exponent base"),me===void 0&&(Pe||Se)&&ri(e,"missing e before exponent")}if((e[Q]==="+"||e[Q]==="-")&&(r=e[Q++]==="-"),!Dg(e[Q])&&e[Q]!=="."){if(e[Q]==="i"||e[Q]==="I")return new t(Ie.from(r?Cg:Rg));if(e[Q]==="N")return new t(Ie.from(cp))}for(;Dg(e[Q])||e[Q]===".";){if(e[Q]==="."){n&&ri(e,"contains multiple periods"),n=!0,Q=Q+1;continue}m<34&&(e[Q]!=="0"||o)&&(o||(f=s),o=!0,d[E++]=parseInt(e[Q],10),m=m+1),o&&(a=a+1),n&&(l=l+1),s=s+1,Q=Q+1}if(n&&!s)throw new Xe(""+e+" not a valid Decimal128 string");if(e[Q]==="e"||e[Q]==="E"){var Re=e.substr(++Q).match(xS);if(!Re||!Re[2])return new t(Ie.from(cp));D=parseInt(Re[0],10),Q=Q+Re[0].length}if(e[Q])return new t(Ie.from(cp));if(y=0,!m)y=0,C=0,d[0]=0,a=1,m=1,i=0;else if(C=m-1,i=a,i!==1)for(;d[f+i-1]===0;)i=i-1;for(D<=l&&l-D>16384?D=ap:D=D-l;D>ss;){if(C=C+1,C-y>IS){var Ge=d.join("");if(Ge.match(/^0+$/)){D=ss;break}ri(e,"overflow")}D=D-1}for(;D<ap||m<a;){if(C===0&&i<m){D=ap,i=0;break}if(m<a?a=a-1:C=C-1,D<ss)D=D+1;else{var Ge=d.join("");if(Ge.match(/^0+$/)){D=ss;break}ri(e,"overflow")}}if(C-y+1<i){var Ze=s;n&&(f=f+1,Ze=Ze+1),r&&(f=f+1,Ze=Ze+1);var kt=parseInt(e[f+C+1],10),A=0;if(kt>=5&&(A=1,kt===5)){for(A=d[C]%2===1?1:0,N=f+C+2;N<Ze;N++)if(parseInt(e[N],10)){A=1;break}}if(A){for(var R=C;R>=0;R--)if(++d[R]>9&&(d[R]=0,R===0))if(D<ss)D=D+1,d[R]=1;else return new t(Ie.from(r?Cg:Rg))}}if(k=oe.fromNumber(0),X=oe.fromNumber(0),i===0)k=oe.fromNumber(0),X=oe.fromNumber(0);else if(C-y<17){var R=y;for(X=oe.fromNumber(d[R++]),k=new oe(0,0);R<=C;R++)X=X.multiply(oe.fromNumber(10)),X=X.add(oe.fromNumber(d[R]))}else{var R=y;for(k=oe.fromNumber(d[R++]);R<=C-17;R++)k=k.multiply(oe.fromNumber(10)),k=k.add(oe.fromNumber(d[R]));for(X=oe.fromNumber(d[R++]);R<=C;R++)X=X.multiply(oe.fromNumber(10)),X=X.add(oe.fromNumber(d[R]))}var V=OS(k,oe.fromString("100000000000000000"));V.low=V.low.add(X),NS(V.low,X)&&(V.high=V.high.add(oe.fromNumber(1))),B=D+xg;var U={low:oe.fromNumber(0),high:oe.fromNumber(0)};V.high.shiftRightUnsigned(49).and(oe.fromNumber(1)).equals(oe.fromNumber(1))?(U.high=U.high.or(oe.fromNumber(3).shiftLeft(61)),U.high=U.high.or(oe.fromNumber(B).and(oe.fromNumber(16383).shiftLeft(47))),U.high=U.high.or(V.high.and(oe.fromNumber(0x7fffffffffff)))):(U.high=U.high.or(oe.fromNumber(B&16383).shiftLeft(49)),U.high=U.high.or(V.high.and(oe.fromNumber(562949953421311)))),U.low=V.low,r&&(U.high=U.high.or(oe.fromString("9223372036854775808")));var H=Ie.alloc(16);return Q=0,H[Q++]=U.low.low&255,H[Q++]=U.low.low>>8&255,H[Q++]=U.low.low>>16&255,H[Q++]=U.low.low>>24&255,H[Q++]=U.low.high&255,H[Q++]=U.low.high>>8&255,H[Q++]=U.low.high>>16&255,H[Q++]=U.low.high>>24&255,H[Q++]=U.high.low&255,H[Q++]=U.high.low>>8&255,H[Q++]=U.high.low>>16&255,H[Q++]=U.high.low>>24&255,H[Q++]=U.high.high&255,H[Q++]=U.high.high>>8&255,H[Q++]=U.high.high>>16&255,H[Q++]=U.high.high>>24&255,new t(H)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),o=0;o<n.length;o++)n[o]=0;var i=0,s=!1,a,l={parts:[0,0,0,0]},f,d,m=[];i=0;var E=this.bytes,y=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24,C=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24,D=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24,N=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24;i=0;var k={low:new oe(y,C),high:new oe(D,N)};k.high.lessThan(oe.ZERO)&&m.push("-");var X=N>>26&CS;if(X>>3===3){if(X===RS)return m.join("")+"Infinity";if(X===AS)return"NaN";e=N>>15&Ag,a=8+(N>>14&1)}else a=N>>14&7,e=N>>17&Ag;var B=e-xg;if(l.parts[0]=(N&16383)+((a&15)<<14),l.parts[1]=D,l.parts[2]=C,l.parts[3]=y,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)s=!0;else for(d=3;d>=0;d--){var Q=0,_e=DS(l);if(l=_e.quotient,Q=_e.rem.low,!!Q)for(f=8;f>=0;f--)n[d*9+f]=Q%10,Q=Math.floor(Q/10)}if(s)r=1,n[i]=0;else for(r=36;!n[i];)r=r-1,i=i+1;var K=r-1+B;if(K>=34||K<=-7||B>0){if(r>34)return m.push("".concat(0)),B>0?m.push("E+".concat(B)):B<0&&m.push("E".concat(B)),m.join("");m.push("".concat(n[i++])),r=r-1,r&&m.push(".");for(var o=0;o<r;o++)m.push("".concat(n[i++]));m.push("E"),K>0?m.push("+".concat(K)):m.push("".concat(K))}else if(B>=0)for(var o=0;o<r;o++)m.push("".concat(n[i++]));else{var ce=r+B;if(ce>0)for(var o=0;o<ce;o++)m.push("".concat(n[i++]));else m.push("0");for(m.push(".");ce++<0;)m.push("0");for(var o=0;o<r-Math.max(ce-1,0);o++)m.push("".concat(n[i++]))}return m.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(mp.prototype,"_bsontype",{value:"Decimal128"});var Ac=(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(Ac.prototype,"_bsontype",{value:"Double"});var Dc=(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(Dc.prototype,"_bsontype",{value:"Int32"});var dp=(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(dp.prototype,"_bsontype",{value:"MaxKey"});var hp=(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(hp.prototype,"_bsontype",{value:"MinKey"});var PS=new RegExp("^[0-9a-fA-F]{24}$"),io=null,Fr=Symbol("id"),yt=(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 Xe("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ie.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Fr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Fr]=r instanceof Ie?r:Tc(r);else if(typeof r=="string")if(r.length===12){var n=Ie.from(r);if(n.byteLength===12)this[Fr]=n;else throw new Xe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&PS.test(r))this[Fr]=Ie.from(r,"hex");else throw new Xe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Xe("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[Fr]},set:function(e){this[Fr]=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=Ie.alloc(12);return n.writeUInt32BE(e,0),io===null&&(io=Ug(5)),n[4]=io[0],n[5]=io[1],n[6]=io[2],n[7]=io[3],n[8]=io[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[Fr][11]===e[Fr][11]&&this[Fr].equals(e[Fr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&pp(this.id))return e===Ie.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 Ie.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=Ie.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 Xe("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ie.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(yt.prototype,"generate",{value:Cc(function(t){return yt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(yt.prototype,"getInc",{value:Cc(function(){return yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(yt.prototype,"get_inc",{value:Cc(function(){return yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(yt,"get_inc",{value:Cc(function(){return yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(yt.prototype,"_bsontype",{value:"ObjectID"});function LS(t){return t.split("").sort().join("")}var cs=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=LS(r??""),this.pattern.indexOf("\0")!==-1)throw new so("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new so("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 so("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 Xe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t})();Object.defineProperty(cs.prototype,"_bsontype",{value:"BSONRegExp"});var gp=(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(gp.prototype,"_bsontype",{value:"Symbol"});var MS=oe,$g=(function(t){xc(e,t);function e(r,n){var o=this;return o instanceof e?(oe.isLong(r)?o=t.call(this,r.low,r.high,!0)||this:ls(r)&&typeof r.t<"u"&&typeof r.i<"u"?o=t.call(this,r.i,r.t,!0)||this:o=t.call(this,r,n,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(oe.fromInt(r,!0))},e.fromNumber=function(r){return new e(oe.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(oe.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=oe.MAX_UNSIGNED_VALUE,e})(MS);function BS(t){return ls(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Vg=2147483647,Wg=-2147483648,jg=9223372036854776e3,Gg=-9223372036854776e3,US={$oid:yt,$binary:ao,$uuid:ao,$symbol:gp,$numberInt:Dc,$numberDecimal:mp,$numberDouble:Ac,$numberLong:oe,$minKey:hp,$maxKey:dp,$regex:cs,$regularExpression:cs,$timestamp:$g};function zg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Wg&&t<=Vg)return new Dc(t);if(t>=Gg&&t<=jg)return oe.fromNumber(t)}return new Ac(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(m){return m.startsWith("$")&&t[m]!=null}),n=0;n<r.length;n++){var o=US[r[n]];if(o)return o.fromExtendedJSON(t,e)}if(t.$date!=null){var i=t.$date,s=new Date;return e.legacy?typeof i=="number"?s.setTime(i):typeof i=="string"&&s.setTime(Date.parse(i)):typeof i=="string"?s.setTime(Date.parse(i)):oe.isLong(i)?s.setTime(i.toNumber()):typeof i=="number"&&e.relaxed&&s.setTime(i),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=zg(t.$scope)),Rc.fromExtendedJSON(t)}if(ES(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof as)return l;var f=Object.keys(l).filter(function(m){return m.startsWith("$")}),d=!0;if(f.forEach(function(m){["$ref","$id","$db"].indexOf(m)===-1&&(d=!1)}),d)return as.fromExtendedJSON(l)}return t}function kS(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Pn(r,e)}finally{e.seenObjects.pop()}})}function Og(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Pn(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(k){return k.obj===t});if(r!==-1){var n=e.seenObjects.map(function(k){return k.propertyName}),o=n.slice(0,r).map(function(k){return"".concat(k," -> ")}).join(""),i=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(k){return"".concat(k," -> ")}).join(""),a=n[n.length-1],l=" ".repeat(o.length+i.length/2),f="-".repeat(s.length+(i.length+a.length)/2-1);throw new Xe(`Converting circular structure to EJSON:
24
+ Url: ${Ra(t)}`),!0}return!1}function YE(t,e){return e?.length?Ta(t).some(r=>Do(r,e)):!1}function KE(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Do(r,e):!1}function XE(t,e){if(!e?.length)return!1;let r=Ra(t);return r?Do(r,e):!1}function JE(t,e){if(!e?.length)return!0;let r=Ra(t);return r?Do(r,e):!0}function QE(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 Ra(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?QE(r):null}catch{return ie&&ee.error(`Cannot extract url for event ${Ar(t)}`),null}}function ZE(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function rf(t,e,r,n,o,i){if(!o.exception?.values||!i||!_r(i.originalException,Error))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=tf(t,e,n,i.originalException,r,o.exception.values,s,0))}function tf(t,e,r,n,o,i,s,a){if(i.length>=r+1)return i;let l=[...i];if(_r(n[o],Error)){rh(s,a);let f=t(e,n[o]),d=l.length;nh(f,o,d,a),l=tf(t,e,r,n[o],o,[f,...l],f,d)}return Array.isArray(n.errors)&&n.errors.forEach((f,d)=>{if(_r(f,Error)){rh(s,a);let m=t(e,f),E=l.length;nh(m,`errors[${d}]`,E,a),l=tf(t,e,r,f,o,[m,...l],m,E)}}),l}function rh(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function nh(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function nf(t){let e="console";Nt(e,t),Pt(e,ew)}function ew(){"console"in pe&&lu.forEach(function(t){t in pe.console&&lt(pe.console,t,function(e){return Co[t]=e,function(...r){ct("console",{args:r,level:t}),Co[t]?.apply(pe.console,r)}})})}function of(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var tw="Dedupe",rw=()=>{let t;return{name:tw,processEvent(e){if(e.type)return e;try{if(nw(e,t))return ie&&ee.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Da=rw;function nw(t,e){return e?!!(ow(t,e)||iw(t,e)):!1}function ow(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!sh(t,e)||!ih(t,e))}function iw(t,e){let r=oh(e),n=oh(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!sh(t,e)||!ih(t,e))}function ih(t,e){let r=na(t),n=na(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let o=0;o<n.length;o++){let i=n[o],s=r[o];if(i.filename!==s.filename||i.lineno!==s.lineno||i.colno!==s.colno||i.function!==s.function)return!1}return!0}function sh(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 oh(t){return t.exception?.values?.[0]}function Yi(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}}function Oa(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var Ki=pe;function sf(){return"history"in Ki&&!!Ki.history}function sw(){if(!("fetch"in Ki))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Xi(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function af(){if(typeof EdgeRuntime=="string")return!0;if(!sw())return!1;if(Xi(Ki.fetch))return!0;let t=!1,e=Ki.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=Xi(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){ie&&ee.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function lf(t,e){let r="fetch";Nt(r,t),Pt(r,()=>aw(void 0,e))}function aw(t,e=!1){e&&!af()||lt(pe,"fetch",function(r){return function(...n){let o=new Error,{method:i,url:s}=cw(n),a={args:n,fetchData:{method:i,url:s},startTimestamp:Ft()*1e3,virtualError:o,headers:lw(n)};return t||ct("fetch",_({},a)),r.apply(pe,n).then(async l=>(t?t(l):ct("fetch",Z(_({},a),{endTimestamp:Ft()*1e3,response:l})),l),l=>{if(ct("fetch",Z(_({},a),{endTimestamp:Ft()*1e3,error:l})),qn(l)&&l.stack===void 0&&(l.stack=o.stack,Gt(l,"framesToPop",1)),l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{let f=new URL(a.fetchData.url);l.message=`${l.message} (${f.host})`}catch{}throw l})}})}function cf(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ah(t){return typeof t=="string"?t:t?cf(t,"url")?t.url:t.toString?t.toString():"":""}function cw(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:ah(r),method:cf(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:ah(e),method:cf(e,"method")?String(e.method).toUpperCase():"GET"}}function lw(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(zm(e))return new Headers(e.headers)}catch{}}function uf(){return"npm"}var Ke=pe,ff=0;function pf(){return ff>0}function Sw(){ff++,setTimeout(()=>{ff--})}function Jn(t,e={}){function r(o){return typeof o=="function"}if(!r(t))return t;try{let o=t.__sentry_wrapped__;if(o)return typeof o=="function"?o:t;if(Xn(t))return t}catch{return t}let n=function(...o){try{let i=o.map(s=>Jn(s,e));return t.apply(this,i)}catch(i){throw Sw(),$i(s=>{s.addEventProcessor(a=>(e.mechanism&&(Oo(a,void 0,void 0),Dr(a,e.mechanism)),a.extra=Z(_({},a.extra),{arguments:o}),a)),wa(i)}),i}};try{for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}catch{}ca(n,t),Gt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function ch(){let t=Hi(),{referrer:e}=Ke.document||{},{userAgent:r}=Ke.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Na(t,e){let r=hf(t,e),n={type:Rw(e),value:Aw(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Tw(t,e,r,n){let i=We()?.getOptions().normalizeDepth,s=Nw(e),a={__serialized__:ga(e,i)};if(s)return{exception:{values:[Na(t,s)]},extra:a};let l={exception:{values:[{type:Kn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Dw(e,{isUnhandledRejection:n})}]},extra:a};if(r){let f=hf(t,r);f.length&&(l.exception.values[0].stacktrace={frames:f})}return l}function mf(t,e){return{exception:{values:[Na(t,e)]}}}function hf(t,e){let r=e.stacktrace||e.stack||"",n=xw(e),o=Cw(e);try{return t(r,n,o)}catch{}return[]}var Iw=/Minified React error #\d+;/i;function xw(t){return t&&Iw.test(t.message)?1:0}function Cw(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function lh(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Rw(t){let e=t?.name;return!e&&lh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Aw(t){let e=t?.message;return lh(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function uh(t,e,r,n){let o=r?.syntheticException||void 0,i=Pa(t,e,o,n);return Dr(i),i.level="error",r?.event_id&&(i.event_id=r.event_id),or(i)}function fh(t,e,r="info",n,o){let i=n?.syntheticException||void 0,s=df(t,e,i,o);return s.level=r,n?.event_id&&(s.event_id=n.event_id),or(s)}function Pa(t,e,r,n,o){let i;if(ia(e)&&e.error)return mf(t,e.error);if(sa(e)||vu(e)){let s=e;if("stack"in e)i=mf(t,e);else{let a=s.name||(sa(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;i=df(t,l,r,n),Oo(i,l)}return"code"in s&&(i.tags=Z(_({},i.tags),{"DOMException.code":`${s.code}`})),i}return qn(e)?mf(t,e):nn(e)||Kn(e)?(i=Tw(t,e,r,o),Dr(i,{synthetic:!0}),i):(i=df(t,e,r,n),Oo(i,`${e}`,void 0),Dr(i,{synthetic:!0}),i)}function df(t,e,r,n){let o={};if(n&&r){let i=hf(t,r);i.length&&(o.exception={values:[{value:e,stacktrace:{frames:i}}]}),Dr(o,{synthetic:!0})}if(Ao(e)){let{__sentry_template_string__:i,__sentry_template_values__:s}=e;return o.logentry={message:i,params:s},o}return o.message=e,o}function Dw(t,{isUnhandledRejection:e}){let r=Tu(t),n=e?"promise rejection":"exception";return ia(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:Kn(t)?`Event \`${Ow(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function Ow(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Nw(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var Pw=5e3,Ji=class extends zi{constructor(e){let r=Lw(e),n=Ke.SENTRY_SDK_SOURCE||uf();Zu(r,"browser",["browser"],n),super(r);let{sendDefaultPii:o,sendClientReports:i,enableLogs:s,_experiments:a}=this._options,l=s??a?.enableLogs;Ke.document&&(i||l)&&Ke.document.addEventListener("visibilitychange",()=>{Ke.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),l&&qi(this))}),l&&(this.on("flush",()=>{qi(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{qi(this)},Pw)})),o&&(this.on("postprocessEvent",Ju),this.on("beforeSendSession",Qu))}eventFromException(e,r){return uh(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return fh(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,o){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,o)}};function Lw(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Ke.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var ph=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var ft=pe;var Mw=1e3,mh,gf,yf;function vf(t){Nt("dom",t),Pt("dom",Bw)}function Bw(){if(!ft.document)return;let t=ct.bind(null,"dom"),e=dh(t,!0);ft.document.addEventListener("click",e,!1),ft.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let o=ft[r]?.prototype;o?.hasOwnProperty?.("addEventListener")&&(lt(o,"addEventListener",function(i){return function(s,a,l){if(s==="click"||s=="keypress")try{let f=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=f[s]=f[s]||{refCount:0};if(!d.handler){let m=dh(t);d.handler=m,i.call(this,s,m,l)}d.refCount++}catch{}return i.call(this,s,a,l)}}),lt(o,"removeEventListener",function(i){return function(s,a,l){if(s==="click"||s=="keypress")try{let f=this.__sentry_instrumentation_handlers__||{},d=f[s];d&&(d.refCount--,d.refCount<=0&&(i.call(this,s,d.handler,l),d.handler=void 0,delete f[s]),Object.keys(f).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,s,a,l)}}))})}function Uw(t){if(t.type!==gf)return!1;try{if(!t.target||t.target._sentryId!==yf)return!1}catch{}return!0}function kw(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function dh(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=Fw(r);if(kw(r.type,n))return;Gt(r,"_sentryCaptured",!0),n&&!n._sentryId&&Gt(n,"_sentryId",ut());let o=r.type==="keypress"?"input":r.type;Uw(r)||(t({event:r,name:o,global:e}),gf=r.type,yf=n?n._sentryId:void 0),clearTimeout(mh),mh=ft.setTimeout(()=>{yf=void 0,gf=void 0},Mw)}}function Fw(t){try{return t.target}catch{return null}}var La;function Qi(t){let e="history";Nt(e,t),Pt(e,Hw)}function Hw(){if(ft.addEventListener("popstate",()=>{let e=ft.location.href,r=La;if(La=e,r===e)return;ct("history",{from:r,to:e})}),!sf())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let o=La,i=$w(String(n));if(La=i,o===i)return e.apply(this,r);ct("history",{from:o,to:i})}return e.apply(this,r)}}lt(ft.history,"pushState",t),lt(ft.history,"replaceState",t)}function $w(t){try{return new URL(t,ft.location.origin).toString()}catch{return t}}var Ma={};function _f(t){let e=Ma[t];if(e)return e;let r=ft[t];if(Xi(r))return Ma[t]=r.bind(ft);let n=ft.document;if(n&&typeof n.createElement=="function")try{let o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o);let i=o.contentWindow;i?.[t]&&(r=i[t]),n.head.removeChild(o)}catch(o){ph&&ee.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,o)}return r&&(Ma[t]=r.bind(ft))}function Ba(t){Ma[t]=void 0}var Qn="__sentry_xhr_v3__";function Ef(t){Nt("xhr",t),Pt("xhr",Vw)}function Vw(){if(!ft.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let o=new Error,i=Ft()*1e3,s=Lt(n[0])?n[0].toUpperCase():void 0,a=Ww(n[1]);if(!s||!a)return e.apply(r,n);r[Qn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let l=()=>{let f=r[Qn];if(f&&r.readyState===4){try{f.status_code=r.status}catch{}let d={endTimestamp:Ft()*1e3,startTimestamp:i,xhr:r,virtualError:o};ct("xhr",d)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(f,d,m){return l(),f.apply(d,m)}}):r.addEventListener("readystatechange",l),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(f,d,m){let[E,y]=m,C=d[Qn];return C&&Lt(E)&&Lt(y)&&(C.request_headers[E.toLowerCase()]=y),f.apply(d,m)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let o=r[Qn];if(!o)return e.apply(r,n);n[0]!==void 0&&(o.body=n[0]);let i={startTimestamp:Ft()*1e3,xhr:r};return ct("xhr",i),e.apply(r,n)}})}function Ww(t){if(Lt(t))return t;try{return t.toString()}catch{}}function wf(t,e=_f("fetch")){let r=0,n=0;function o(i){let s=i.body.length;r+=s,n++;let a=_({body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Ba("fetch"),Tn("No fetch implementation available");try{return e(t.url,a).then(l=>(r-=s,n--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return Ba("fetch"),r-=s,n--,Tn(l)}}return xa(t,o)}var jw=30;var Gw=50;function bf(t,e,r,n){let o={filename:t,function:e==="<anonymous>"?"?":e,in_app:!0};return r!==void 0&&(o.lineno=r),n!==void 0&&(o.colno=n),o}var zw=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qw=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yw=/\((\S*)(?::(\d+))(?::(\d+))\)/,Kw=t=>{let e=zw.exec(t);if(e){let[,n,o,i]=e;return bf(n,"?",+o,+i)}let r=qw.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=Yw.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[o,i]=vh(r[1]||"?",r[2]);return bf(i,o,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},hh=[jw,Kw],Xw=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Jw=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qw=t=>{let e=Xw.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let i=Jw.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let n=e[3],o=e[1]||"?";return[o,n]=vh(o,n),bf(n,o,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},gh=[Gw,Qw];var yh=[hh,gh],Sf=mu(...yh),vh=(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]:"?",r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Mo=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Ua=1024,Zw="Breadcrumbs",eb=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:Zw,setup(r){e.console&&nf(nb(r)),e.dom&&vf(rb(r,e.dom)),e.xhr&&Ef(ob(r)),e.fetch&&lf(ib(r)),e.history&&Qi(sb(r)),e.sentry&&r.on("beforeSendEvent",tb(r))}}},_h=eb;function tb(t){return function(r){We()===t&&Pr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:Ar(r)},{event:r})}}function rb(t,e){return function(n){if(We()!==t)return;let o,i,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Ua&&(Mo&&ee.warn(`\`dom.maxStringLength\` cannot exceed ${Ua}, but a value of ${a} was configured. Sentry will use ${Ua} instead.`),a=Ua),typeof s=="string"&&(s=[s]);try{let f=n.event,d=ab(f)?f.target:f;o=Fi(d,{keyAttrs:s,maxStringLength:a}),i=Su(d)}catch{o="<unknown>"}if(o.length===0)return;let l={category:`ui.${n.name}`,message:o};i&&(l.data={"ui.component_name":i}),Pr(l,{event:n.event,name:n.name,global:n.global})}}function nb(t){return function(r){if(We()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:of(r.level),message:aa(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${aa(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Pr(n,{input:r.args,level:r.level})}}function ob(t){return function(r){if(We()!==t)return;let{startTimestamp:n,endTimestamp:o}=r,i=r.xhr[Qn];if(!n||!o||!i)return;let{method:s,url:a,status_code:l,body:f}=i,d={method:s,url:a,status_code:l},m={xhr:r.xhr,input:f,startTimestamp:n,endTimestamp:o},E={category:"xhr",data:d,type:"http",level:Oa(l)};t.emit("beforeOutgoingRequestBreadcrumb",E,m),Pr(E,m)}}function ib(t){return function(r){if(We()!==t)return;let{startTimestamp:n,endTimestamp:o}=r;if(o&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let i=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:o},a={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Pr(a,s)}else{let i=r.response,s=Z(_({},r.fetchData),{status_code:i?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,i?.status;let a={input:r.args,response:i,startTimestamp:n,endTimestamp:o},l={category:"fetch",data:s,type:"http",level:Oa(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),Pr(l,a)}}}function sb(t){return function(r){if(We()!==t)return;let n=r.from,o=r.to,i=Yi(Ke.location.href),s=n?Yi(n):void 0,a=Yi(o);s?.path||(s=i),i.protocol===a.protocol&&i.host===a.host&&(o=a.relative),i.protocol===s.protocol&&i.host===s.host&&(n=s.relative),Pr({category:"navigation",data:{from:n,to:o}})}}function ab(t){return!!t&&!!t.target}var cb=["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"],lb="BrowserApiErrors",ub=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:lb,setupOnce(){e.setTimeout&&lt(Ke,"setTimeout",Eh),e.setInterval&&lt(Ke,"setInterval",Eh),e.requestAnimationFrame&&lt(Ke,"requestAnimationFrame",fb),e.XMLHttpRequest&&"XMLHttpRequest"in Ke&&lt(XMLHttpRequest.prototype,"send",pb);let r=e.eventTarget;r&&(Array.isArray(r)?r:cb).forEach(o=>mb(o,e))}}},wh=ub;function Eh(t){return function(...e){let r=e[0];return e[0]=Jn(r,{mechanism:{data:{function:rr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function fb(t){return function(e){return t.apply(this,[Jn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:rr(t)},handled:!1,type:"instrument"}})])}}function pb(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in r&&typeof r[o]=="function"&&lt(r,o,function(i){let s={mechanism:{data:{function:o,handler:rr(i)},handled:!1,type:"instrument"}},a=Xn(i);return a&&(s.mechanism.data.handler=rr(a)),Jn(i,s)})}),t.apply(this,e)}}function mb(t,e){let n=Ke[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(lt(n,"addEventListener",function(o){return function(i,s,a){try{db(s)&&(s.handleEvent=Jn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:rr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&hb(this,i,s),o.apply(this,[i,Jn(s,{mechanism:{data:{function:"addEventListener",handler:rr(s),target:t},handled:!1,type:"instrument"}}),a])}}),lt(n,"removeEventListener",function(o){return function(i,s,a){try{let l=s.__sentry_wrapped__;l&&o.call(this,i,l,a)}catch{}return o.call(this,i,s,a)}}))}function db(t){return typeof t.handleEvent=="function"}function hb(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var bh=()=>({name:"BrowserSession",setupOnce(){if(typeof Ke.document>"u"){Mo&&ee.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}ji({ignoreDuration:!0}),Gi(),Qi(({from:t,to:e})=>{t!==void 0&&t!==e&&(ji({ignoreDuration:!0}),Gi())})}});var gb="GlobalHandlers",yb=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:gb,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(vb(r),Sh("onerror")),e.onunhandledrejection&&(_b(r),Sh("onunhandledrejection"))}}},Th=yb;function vb(t){hu(e=>{let{stackParser:r,attachStacktrace:n}=Ih();if(We()!==t||pf())return;let{msg:o,url:i,line:s,column:a,error:l}=e,f=bb(Pa(r,l||o,void 0,n,!1),i,s,a);f.level="error",Wi(f,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function _b(t){yu(e=>{let{stackParser:r,attachStacktrace:n}=Ih();if(We()!==t||pf())return;let o=Eb(e),i=Yn(o)?wb(o):Pa(r,o,void 0,n,!0);i.level="error",Wi(i,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Eb(t){if(Yn(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 wb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function bb(t,e,r,n){let o=t.exception=t.exception||{},i=o.values=o.values||[],s=i[0]=i[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[],f=n,d=r,m=Lt(e)&&e.length>0?e:Hi();return l.length===0&&l.push({colno:f,filename:m,function:"?",in_app:!0,lineno:d}),t}function Sh(t){Mo&&ee.log(`Global Handler attached: ${t}`)}function Ih(){return We()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var xh=()=>({name:"HttpContext",preprocessEvent(t){if(!Ke.navigator&&!Ke.location&&!Ke.document)return;let e=ch(),r=_(_({},e.headers),t.request?.headers);t.request=Z(_(_({},e),t.request),{headers:r})}});var Sb="cause",Tb=5,Ib="LinkedErrors",xb=(t={})=>{let e=t.limit||Tb,r=t.key||Sb;return{name:Ib,preprocessEvent(n,o,i){let s=i.getOptions();rf(Na,s.stackParser,r,e,n,o)}}},Ch=xb;function Tf(t){return[Aa(),Ca(),wh(),_h(),Th(),Ch(),Da(),xh(),bh()]}var Fa={},Ha,If,Rh;(()=>{let t=Tf({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));If=new Ji({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:wf,stackParser:Sf,integrations:t,environment:gr.mode,release:`web-sdk@${Gs}`,debug:gr.debug,sampleRate:.5}),If.init()})();function ae(t,e,r){w.error(`${e}:`,t);let n=Oh(r);if(n.setTag("operation",e),t instanceof vr){Cb(n,t,e);return}n.captureException(t)}function Ah(t,e,r){Oh(r).captureMessage(t,e??"error")}function Cb(t,e,r){if(Rb(t,e),e.response){let n=e.response,o=e.responseText;n.status&&t.setTag("http.status_code",n.status),n.statusText&&t.setTag("http.status_text",n.statusText),o&&typeof o=="object"&&"error"in o&&(t.setTag("http.error_code",o.error.code),t.setTag("http.error_message",o.error.message)),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function Rb(t,e){let r=e.request;if(!r)return;t.setExtras({body:e.requestBody,headers:r.headers,method:r.method,url:r.url});let n=r.headers?.get("Cooee-Retry-Attempt");n!==null&&t.setTag("retry.attempt",n)}function Dh(t){Rh=t}function $a(t,e){Fa[t]=_(_({},Fa[t]),e)}function Bo(t){Ha=_(_({},Ha),t)}function Oh(t){t??={};let{extra:e,tags:r}=t,n=new wt;if(n.setClient(If),n.setUser(Rh),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let o=t.engagementTrigger;n.setTags({"engagement.id":o.engagementID,"engagement.short_id":o.shortID,"engagement.objective":o.objective,"engagement.delivery_type":o.onsiteDeliveryType,"engagement.content_id":o.contentID,"engagement.variation":o.variation,"engagement.currency":o.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Ha&&n.setTags(Ha),Object.keys(Fa).forEach(o=>{n.setContext(o,Fa[o])}),n.setTag("language",navigator.language),n.setTag("timezone",Nh()),Ab(n),n}function Ab(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var Va=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(o,i)=>{switch(i){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 o}})}static formatWithDelimiters(e,r=2,n=",",o="."){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),l=s[1]?o+s[1]:"";return a+l}};function Uo(t){try{return new URL(t)}catch{return}}function xf(t){return!t||t==="null"||t==="undefined"}function Ph(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Mt(t,e,r){return{[t]:Cf(e,r),[t+"_wo_currency"]:e}}function Cf(t,e){if(t==0&&e)return"Free";let r=fe(),n=Ye.get(),o=r.shopCurrencyCode||n.currency,i=r.currencyCode;i||w.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&o===i)a=Va.format(t*100,s);else{let l;try{l=new Intl.NumberFormat(Mh(),{style:"currency",currency:i||o,minimumFractionDigits:0,maximumFractionDigits:2})}catch(f){return ae(f,"format-currency",{extra:{currentCurrency:i,shopCurrency:o}}),""}a=l.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&i!=="INR"&&(a=a.concat(` ${i}`))}return a}function Lh(t){let e=Mh();try{return new Intl.NumberFormat(e,{notation:"compact"}).format(t)}catch(r){return ae(r,"format-number",{extra:{lang:e,value:t}}),t.toString()}}function Mh(){let t="en";return typeof navigator<"u"&&(navigator.languages!==void 0&&navigator.languages.length>0?t=navigator.languages[0]:navigator.language&&(t=navigator.language)),t=t.split(";")[0],t=t.split("-")[0],t||"en"}var Wa;function Nh(){if(Wa)return Wa;try{return Wa=Intl.DateTimeFormat().resolvedOptions().timeZone,Wa}catch{return""}}function xn(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function br(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},5e3)}async function Rf(t,e=10,r=document){let n=0,o=document.querySelectorAll("nonexistent-tag");for(;n<e;){let i=Math.min(100*2**n,5e3);if(await jt.sleep(i),o=r.querySelectorAll(t),o.length)return w.verbose(`Attempt ${n+1}: ${o.length} elements found with ${t}`),o;w.verbose(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${i}ms.`),n++}return w.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),o}async function Cn(t,e=10,r=document){return(await Rf(t,e,r)).item(0)}async function Af(t){let[e,r,n]=await Promise.all([ze.get("did"),xt.get("id",""),ze.get("sessionNumber",1)]),o={letscooee_did:e,letscooee_sid:r,letscooee_sn:n,__letscooee_time:new Date().toLocaleString()};return t&&(o.__letscooee_via=t),o}async function ja(t){let e=await Af(t);return Object.entries(e).map(([r,n])=>({key:r,value:n.toString()}))}function Lr(t,e,r,n=!1){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:n,value:r})}function Bh(t){if(t%100>=11&&t%100<=13)return t+"th";switch(t%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd";default:return t+"th"}}var Ya,Te,$h,Nf,Zn,Uh,Vh,Wh,jh,Pf,Df,Of,Db,es={},Gh=[],Ob=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ka=Array.isArray;function cn(t,e){for(var r in e)t[r]=e[r];return t}function Lf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Mf(t,e,r){var n,o,i,s={};for(i in e)i=="key"?n=e[i]:i=="ref"?o=e[i]:s[i]=e[i];if(arguments.length>2&&(s.children=arguments.length>3?Ya.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)s[i]===void 0&&(s[i]=t.defaultProps[i]);return za(t,s,n,o,null)}function za(t,e,r,n,o){var i={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++$h,__i:-1,__u:0};return o==null&&Te.vnode!=null&&Te.vnode(i),i}function Br(t){return t.children}function Mr(t,e){this.props=t,this.context=e}function ko(t,e){if(e==null)return t.__?ko(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"?ko(t):null}function zh(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 zh(t)}}function kh(t){(!t.__d&&(t.__d=!0)&&Zn.push(t)&&!qa.__r++||Uh!=Te.debounceRendering)&&((Uh=Te.debounceRendering)||Vh)(qa)}function qa(){for(var t,e,r,n,o,i,s,a=1;Zn.length;)Zn.length>a&&Zn.sort(Wh),t=Zn.shift(),a=Zn.length,t.__d&&(r=void 0,o=(n=(e=t).__v).__e,i=[],s=[],e.__P&&((r=cn({},n)).__v=n.__v+1,Te.vnode&&Te.vnode(r),Bf(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[o]:null,i,o??ko(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,Kh(i,r,s),r.__e!=o&&zh(r)));qa.__r=0}function qh(t,e,r,n,o,i,s,a,l,f,d){var m,E,y,C,D,N,k=n&&n.__k||Gh,X=e.length;for(l=Nb(r,e,k,l,X),m=0;m<X;m++)(y=r.__k[m])!=null&&(E=y.__i==-1?es:k[y.__i]||es,y.__i=m,N=Bf(t,y,E,o,i,s,a,l,f,d),C=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&Uf(E.ref,null,y),d.push(y.ref,y.__c||C,y)),D==null&&C!=null&&(D=C),4&y.__u||E.__k===y.__k?l=Yh(y,l,t):typeof y.type=="function"&&N!==void 0?l=N:C&&(l=C.nextSibling),y.__u&=-7);return r.__e=D,l}function Nb(t,e,r,n,o){var i,s,a,l,f,d=r.length,m=d,E=0;for(t.__k=new Array(o),i=0;i<o;i++)(s=e[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=i+E,(s=t.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?za(null,s,null,null,null):Ka(s)?za(Br,{children:s},null,null,null):s.constructor==null&&s.__b>0?za(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(f=s.__i=Pb(s,r,l,m))!=-1&&(m--,(a=r[f])&&(a.__u|=2)),a==null||a.__v==null?(f==-1&&(o>d?E--:o<d&&E++),typeof s.type!="function"&&(s.__u|=4)):f!=l&&(f==l-1?E--:f==l+1?E++:(f>l?E--:E++,s.__u|=4))):t.__k[i]=null;if(m)for(i=0;i<d;i++)(a=r[i])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=ko(a)),Jh(a,a));return n}function Yh(t,e,r){var n,o;if(typeof t.type=="function"){for(n=t.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=t,e=Yh(n[o],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=ko(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Pb(t,e,r,n){var o,i,s=t.key,a=t.type,l=e[r];if(l===null&&t.key==null||l&&s==l.key&&a==l.type&&(2&l.__u)==0)return r;if(n>(l!=null&&(2&l.__u)==0?1:0))for(o=r-1,i=r+1;o>=0||i<e.length;){if(o>=0){if((l=e[o])&&(2&l.__u)==0&&s==l.key&&a==l.type)return o;o--}if(i<e.length){if((l=e[i])&&(2&l.__u)==0&&s==l.key&&a==l.type)return i;i++}}return-1}function Fh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Ob.test(e)?r:r+"px"}function Ga(t,e,r,n,o){var i,s;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||Fh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Fh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(jh,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=r,r?n?r.u=n.u:(r.u=Pf,t.addEventListener(e,i?Of:Df,i)):t.removeEventListener(e,i?Of:Df,i);else{if(o=="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 Hh(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Pf++;else if(e.t<r.u)return;return r(Te.event?Te.event(e):e)}}}function Bf(t,e,r,n,o,i,s,a,l,f){var d,m,E,y,C,D,N,k,X,B,Q,_e,K,ce,se,me,Pe,Se=e.type;if(e.constructor!=null)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=e.__e=r.__e]),(d=Te.__b)&&d(e);e:if(typeof Se=="function")try{if(k=e.props,X="prototype"in Se&&Se.prototype.render,B=(d=Se.contextType)&&n[d.__c],Q=d?B?B.props.value:d.__:n,r.__c?N=(m=e.__c=r.__c).__=m.__E:(X?e.__c=m=new Se(k,Q):(e.__c=m=new Mr(k,Q),m.constructor=Se,m.render=Mb),B&&B.sub(m),m.props=k,m.state||(m.state={}),m.context=Q,m.__n=n,E=m.__d=!0,m.__h=[],m._sb=[]),X&&m.__s==null&&(m.__s=m.state),X&&Se.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=cn({},m.__s)),cn(m.__s,Se.getDerivedStateFromProps(k,m.__s))),y=m.props,C=m.state,m.__v=e,E)X&&Se.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),X&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(X&&Se.getDerivedStateFromProps==null&&k!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(k,Q),!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(k,m.__s,Q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(m.props=k,m.state=m.__s,m.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Re){Re&&(Re.__=e)}),_e=0;_e<m._sb.length;_e++)m.__h.push(m._sb[_e]);m._sb=[],m.__h.length&&s.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(k,m.__s,Q),X&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,C,D)})}if(m.context=Q,m.props=k,m.__P=t,m.__e=!1,K=Te.__r,ce=0,X){for(m.state=m.__s,m.__d=!1,K&&K(e),d=m.render(m.props,m.state,m.context),se=0;se<m._sb.length;se++)m.__h.push(m._sb[se]);m._sb=[]}else do m.__d=!1,K&&K(e),d=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++ce<25);m.state=m.__s,m.getChildContext!=null&&(n=cn(cn({},n),m.getChildContext())),X&&!E&&m.getSnapshotBeforeUpdate!=null&&(D=m.getSnapshotBeforeUpdate(y,C)),me=d,d!=null&&d.type===Br&&d.key==null&&(me=Xh(d.props.children)),a=qh(t,Ka(me)?me:[me],e,r,n,o,i,s,a,l,f),m.base=e.__e,e.__u&=-161,m.__h.length&&s.push(m),N&&(m.__E=m.__=null)}catch(Re){if(e.__v=null,l||i!=null)if(Re.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else for(Pe=i.length;Pe--;)Lf(i[Pe]);else e.__e=r.__e,e.__k=r.__k;Te.__e(Re,e,r)}else i==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=Lb(r.__e,e,r,n,o,i,s,l,f);return(d=Te.diffed)&&d(e),128&e.__u?void 0:a}function Kh(t,e,r){for(var n=0;n<r.length;n++)Uf(r[n],r[++n],r[++n]);Te.__c&&Te.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(i){i.call(o)})}catch(i){Te.__e(i,o.__v)}})}function Xh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Ka(t)?t.map(Xh):cn({},t)}function Lb(t,e,r,n,o,i,s,a,l){var f,d,m,E,y,C,D,N=r.props,k=e.props,X=e.type;if(X=="svg"?o="http://www.w3.org/2000/svg":X=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(f=0;f<i.length;f++)if((y=i[f])&&"setAttribute"in y==!!X&&(X?y.localName==X:y.nodeType==3)){t=y,i[f]=null;break}}if(t==null){if(X==null)return document.createTextNode(k);t=document.createElementNS(o,X,k.is&&k),a&&(Te.__m&&Te.__m(e,i),a=!1),i=null}if(X==null)N===k||a&&t.data==k||(t.data=k);else{if(i=i&&Ya.call(t.childNodes),N=r.props||es,!a&&i!=null)for(N={},f=0;f<t.attributes.length;f++)N[(y=t.attributes[f]).name]=y.value;for(f in N)if(y=N[f],f!="children"){if(f=="dangerouslySetInnerHTML")m=y;else if(!(f in k)){if(f=="value"&&"defaultValue"in k||f=="checked"&&"defaultChecked"in k)continue;Ga(t,f,null,y,o)}}for(f in k)y=k[f],f=="children"?E=y:f=="dangerouslySetInnerHTML"?d=y:f=="value"?C=y:f=="checked"?D=y:a&&typeof y!="function"||N[f]===y||Ga(t,f,y,N[f],o);if(d)a||m&&(d.__html==m.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(m&&(t.innerHTML=""),qh(e.type=="template"?t.content:t,Ka(E)?E:[E],e,r,n,X=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:r.__k&&ko(r,0),a,l),i!=null)for(f=i.length;f--;)Lf(i[f]);a||(f="value",X=="progress"&&C==null?t.removeAttribute("value"):C!=null&&(C!==t[f]||X=="progress"&&!C||X=="option"&&C!=N[f])&&Ga(t,f,C,N[f],o),f="checked",D!=null&&D!=t[f]&&Ga(t,f,D,N[f],o))}return t}function Uf(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(o){Te.__e(o,r)}}function Jh(t,e,r){var n,o;if(Te.unmount&&Te.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Uf(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){Te.__e(i,e)}n.base=n.__P=null}if(n=t.__k)for(o=0;o<n.length;o++)n[o]&&Jh(n[o],e,r||typeof t.type!="function");r||Lf(t.__e),t.__c=t.__=t.__e=void 0}function Mb(t,e,r){return this.constructor(t,r)}function Qh(t,e,r){var n,o,i,s;e==document&&(e=document.documentElement),Te.__&&Te.__(t,e),o=(n=typeof r=="function")?null:r&&r.__k||e.__k,i=[],s=[],Bf(e,t=(!n&&r||e).__k=Mf(Br,null,[t]),o||es,es,e.namespaceURI,!n&&r?[r]:o?null:e.firstChild?Ya.call(e.childNodes):null,i,!n&&r?r:o?o.__e:e.firstChild,n,s),Kh(i,t,s)}Ya=Gh.slice,Te={__e:function(t,e,r,n){for(var o,i,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(t)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,n||{}),s=o.__d),s)return o.__E=o}catch(a){t=a}throw t}},$h=0,Nf=function(t){return t!=null&&t.constructor==null},Mr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=cn({},this.state),typeof t=="function"&&(t=t(cn({},r),this.props)),t&&cn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),kh(this))},Mr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),kh(this))},Mr.prototype.render=Br,Zn=[],Vh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Wh=function(t,e){return t.__v.__b-e.__v.__b},qa.__r=0,jh=/(PointerCapture)$|Capture$/i,Pf=0,Df=Hh(!1),Of=Hh(!0),Db=0;var Ff,zt,kf,Zh,eg=0,cg=[],pt=Te,tg=pt.__b,rg=pt.__r,ng=pt.diffed,og=pt.__c,ig=pt.unmount,sg=pt.__;function Bb(t,e){pt.__h&&pt.__h(zt,t,eg||e),eg=0;var r=zt.__H||(zt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function $f(t,e){var r=Bb(Ff++,7);return Fb(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Ub(){for(var t;t=cg.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Xa),t.__H.__h.forEach(Hf),t.__H.__h=[]}catch(e){t.__H.__h=[],pt.__e(e,t.__v)}}pt.__b=function(t){zt=null,tg&&tg(t)},pt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),sg&&sg(t,e)},pt.__r=function(t){rg&&rg(t),Ff=0;var e=(zt=t.__c).__H;e&&(kf===zt?(e.__h=[],zt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Xa),e.__h.forEach(Hf),e.__h=[],Ff=0)),kf=zt},pt.diffed=function(t){ng&&ng(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(cg.push(e)!==1&&Zh===pt.requestAnimationFrame||((Zh=pt.requestAnimationFrame)||kb)(Ub)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),kf=zt=null},pt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Xa),r.__h=r.__h.filter(function(n){return!n.__||Hf(n)})}catch(n){e.some(function(o){o.__h&&(o.__h=[])}),e=[],pt.__e(n,r.__v)}}),og&&og(t,e)},pt.unmount=function(t){ig&&ig(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Xa(n)}catch(o){e=o}}),r.__H=void 0,e&&pt.__e(e,r.__v))};var ag=typeof requestAnimationFrame=="function";function kb(t){var e,r=function(){clearTimeout(n),ag&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);ag&&(e=requestAnimationFrame(r))}function Xa(t){var e=zt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),zt=e}function Hf(t){var e=zt;t.__c=t.__(),zt=e}function Fb(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var Hb=Symbol.for("preact-signals");function Wf(){if(Fo>1)Fo--;else{for(var t,e=!1;ts!==void 0;){var r=ts;for(ts=void 0,Vf++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&ug(r))try{r.c()}catch(o){e||(t=o,e=!0)}r=n}}if(Vf=0,Fo--,e)throw t}}var Fe=void 0;var ts=void 0,Fo=0,Vf=0,Ja=0;function lg(t){if(Fe!==void 0){var e=t.n;if(e===void 0||e.t!==Fe)return e={i:0,S:t,p:Fe.s,n:void 0,t:Fe,e:void 0,x:void 0,r:e},Fe.s!==void 0&&(Fe.s.n=e),Fe.s=e,t.n=e,32&Fe.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=Fe.s,e.n=void 0,Fe.s.n=e,Fe.s=e),e}}function mt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}mt.prototype.brand=Hb;mt.prototype.h=function(){return!0};mt.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)};mt.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)}};mt.prototype.subscribe=function(t){var e=this;return bt(function(){var r=e.value,n=Fe;Fe=void 0;try{t(r)}finally{Fe=n}})};mt.prototype.valueOf=function(){return this.value};mt.prototype.toString=function(){return this.value+""};mt.prototype.toJSON=function(){return this.value};mt.prototype.peek=function(){var t=Fe;Fe=void 0;try{return this.value}finally{Fe=t}};Object.defineProperty(mt.prototype,"value",{get:function(){var t=lg(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Vf>100)throw new Error("Cycle detected");this.v=t,this.i++,Ja++,Fo++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Wf()}}}});function ir(t){return new mt(t)}function ug(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 fg(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 pg(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 Ho(t){mt.call(this,void 0),this.x=t,this.s=void 0,this.g=Ja-1,this.f=4}(Ho.prototype=new mt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ja))return!0;if(this.g=Ja,this.f|=1,this.i>0&&!ug(this))return this.f&=-2,!0;var t=Fe;try{fg(this),Fe=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 Fe=t,pg(this),this.f&=-2,!0};Ho.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)}mt.prototype.S.call(this,t)};Ho.prototype.U=function(t){if(this.t!==void 0&&(mt.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)}};Ho.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(Ho.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=lg(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function jf(t){return new Ho(t)}function mg(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Fo++;var r=Fe;Fe=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Gf(t),n}finally{Fe=r,Wf()}}}function Gf(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,mg(t)}function $b(t){if(Fe!==this)throw new Error("Out-of-order effect");pg(this),Fe=t,this.f&=-2,8&this.f&&Gf(this),Wf()}function rs(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}rs.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()}};rs.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,mg(this),fg(this),Fo++;var t=Fe;return Fe=this,$b.bind(this,t)};rs.prototype.N=function(){2&this.f||(this.f|=2,this.o=ts,ts=this)};rs.prototype.d=function(){this.f|=8,1&this.f||Gf(this)};function bt(t){var e=new rs(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var qf,zf;function $o(t,e){Te[t]=e.bind(null,Te[t]||function(){})}function Qa(t){zf&&zf(),zf=t&&t.S()}function dg(t){var e=this,r=t.data,n=Wb(r);n.value=r;var o=$f(function(){for(var i=e.__v;i=i.__;)if(i.__c){i.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),l=o.value;a(),Nf(l)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=l},jf(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return o.value}dg.displayName="_st";Object.defineProperties(mt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:dg},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});$o("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var o in n)if(o!=="children"){var i=n[o];i instanceof mt&&(r||(e.__np=r={}),r[o]=i,n[o]=i.peek())}}t(e)});$o("__r",function(t,e){Qa();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(o){var i;return bt(function(){i=this}),i.c=function(){n.__$f|=1,n.setState({})},i})())),qf=n,Qa(r),t(e)});$o("__e",function(t,e,r,n){Qa(),qf=void 0,t(e,r,n)});$o("diffed",function(t,e){Qa(),qf=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,o=e.props;if(n){var i=r.U;if(i)for(var s in i){var a=i[s];a!==void 0&&!(s in n)&&(a.d(),i[s]=void 0)}else r.U=i={};for(var l in n){var f=i[l],d=n[l];f===void 0?(f=Vb(r,l,d,o),i[l]=f):f.o(d,o)}}}t(e)});function Vb(t,e,r,n){var o=e in t&&t.ownerSVGElement===void 0,i=ir(r);return{o:function(s,a){i.value=s,n=a},d:bt(function(){var s=i.value.value;n[e]!==s&&(n[e]=s,o?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}$o("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 o in n){var i=n[o];i&&i.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});$o("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Mr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var o 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 i in t)if(i!=="__source"&&t[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function Wb(t){return $f(function(){return ir(t)},[])}var Za=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var ec=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var Yf=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}},Ur=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new Za(r))??[],this.link=e.link,this.price=new ec(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=ir(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=ir(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new Yf(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var Ct=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=ir(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=ir(this.selectedVariant)}get firstImageURL(){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}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}setSelectedVariantByID(e){if(!e)return;let r=this.vars.find(n=>n.mID===e.toString());r&&this.setSelectedVariant(r)}update(e){return this.id=e.id??this.id,this.mID=e.mID??this.mID,this.name=e.name??this.name,this.imgs=e.imgs??this.imgs,this.desc=e.desc??this.desc,this.link=e.link??this.link,this.slug=e.slug??this.slug,this.quantity=e.quantity??this.quantity,this.meta=e.meta??this.meta,this.category=e.category??this.category,this.reviews=e.reviews??this.reviews,this.options=e.options??this.options,this.tags=e.tags??this.tags,this.templateSuffix=e.templateSuffix??this.templateSuffix,e.vars&&(this.vars=e.vars.map(r=>new Ur(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new Ot({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})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,o=this.category,i=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",l=this.reviews?.rating,f=this.reviews?.totalReviews,d=r.cmp&&r.cmp>r.d,m=Z(_({name:n},Mt("price",r.d,!0)),{image_url:i,meta:s,category:o,rating:l,reviews:f,tags:a});if(e.hasEffectivePrice()){let y=Mt("effective_price",e.effectivePrice.value,!0);Object.assign(m,y)}if(d){let y=r.cmp-r.d,C={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(m,C),Object.assign(m,Mt("compare_price",r.cmp)),Object.assign(m,Mt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:m,variant:E}}};var tc=class{id;alt;shortID;sources;items;durationMS;thumbnail;card;bestSource;highSource;goodSource;lowSource;m3u8Source;constructor(e={}){if(this.id=e.id,this.alt=e.alt,this.shortID=e.shortID,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new Ct(r)):[],this.card=e.card,this.sources){let r=[];for(let n of this.sources)n.format==="mp4"?r.push(n):n.format==="m3u8"&&!this.m3u8Source&&(this.m3u8Source=n);r.length>0&&(this.bestSource=r[0],this.highSource=r.length>1?r[1]:r[0],this.lowSource=r.length>2?r[r.length-1]:r[0])}}};var Kf=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new Ve(e.color)}},Xf=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new Ve(e.color)}},Jf=class{enabled;delay;constructor(e={}){this.enabled=e.enabled,e.delay&&(this.delay=e.delay>100?e.delay:e.delay*1e3)}},Rn=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(e){e??={},this.navigation=new Xf(e.navigation),this.pagination=new Kf(e.pagination),this.autoplay=new Jf(e.autoplay),this.loop=e.loop??!1,this.maxInRow=e.maxInRow??4,this.gap=e.gap??0,this.maxInRowSm=e.maxInRowSm??this.maxInRow,this.gapSm=e.gapSm??this.gap,e.speed&&(this.speed=e.speed*1e3),this.marquee=e.marquee}};var rc=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;constructor(e={}){this.videos=e.videos?.map(r=>new tc(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM",this.playlistConfig=e.playlistConfig?.videoSwiper?{videoSwiper:new Rn(e.playlistConfig?.videoSwiper)}:void 0}};var Bt=Xr(Qf());Bt.filters.define("default",function(t){return typeof t>"u"||t==null?"":Gb(t)});+Bt.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Bt.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Bt.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Bt.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return w.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Bt.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return w.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return w.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Bt.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(w.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Bt.filters.define("currency",t=>(t=+t,isNaN(t)?(w.error("Need value as a number for `currency` filter"),NaN):Cf(t)));Bt.defaultConfig.defaultFilter="default";Bt.defaultConfig.useWith=!0;Bt.defaultConfig.autoEscape=!1;var jb={'"':"&quot;","\\":"&bsol;","\n":"\\n"};function Gb(t){return String(t).replace(/["\\\n]/g,e=>jb[e])}function zb(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,o,i)=>`{{ ${(o||i||"").trim()} }}`)}var Vo=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Bt.render(zb(t),e)}catch(n){throw ae(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},eo=(t,e,r)=>{let n=JSON.stringify(t),o=Vo(n,e,r);try{return JSON.parse(o)}catch(i){throw ae(i,"variable-replacement",{extra:{before:t,after:o},triggerContext:r}),i}};function ns(){return!!window.Shopify}function oc(){if(ns())return window.Shopify.shop?.split(".")?.[0]}function gg(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Wo(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function ic(t){return Wo(t+"?from=cooee")}var de=class t{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;discount_codes;total_discount=0;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCart(e){return qb(e)}getCooeeCart(){return Zf()}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.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.discount_codes=e.discount_codes,this.total_discount=e.total_discount,fe().currencyCode=this.currency,w.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function qb(t){let e=de.getCurrent();await Kb(e,t);let r=yg(e);return t&&await ze.set("cart",r),r}function Zf(){return yg(de.getCurrent())}function yg(t){return{amount:t.total_price/100,originalAmount:t.original_total_price/100,itemsSubtotalPrice:t.items_subtotal_price/100,currency:t.currency,itemCount:t.item_count,items:Yb(t.items),token:t.token}}function Yb(t){if(!t)return w.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);let e=[];for(let r of t){if(!r.id||!r.title){w.warn("Invalid item received",r);continue}let n={name:r.title,quantity:+r.quantity||1,mID:r.product_id?.toString(),vID:r.id.toString(),price:+r.price/100||0,finalPrice:+r.final_price/100||0,properties:r.properties,key:r.key},o=r.selling_plan_allocation?.selling_plan;if(!o){e.push(n);continue}n.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},e.push(n)}return e}async function Kb(t,e){if(!e&&t.token){w.verbose("Not fetching cart");return}w.verbose("Fetching cart");let r=ic("/cart.js");try{let n=(await tn(r)).data;t.update(n)}catch(n){w.error("Unable to fetch the cart",n)}}var sc=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 ep=class{enabled;constructor(e){this.enabled=e.enabled}},tp=class extends ep{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},ac=class{productQuantity;constructor(e){e??={},this.productQuantity=new tp(e.productQuantity)}};var qt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new Wn(e.bg)),e.br&&(this.br=new Zr(e.br)),e.shd&&(this.shd=new Mi(e.shd)),e.spc&&(this.spc=new en(e.spc)),this.trf=new jn(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 je[this.t]}get click(){return this.clc}},je=(B=>(B[B.IMAGE=1]="IMAGE",B[B.TEXT=2]="TEXT",B[B.BUTTON=3]="BUTTON",B[B.FLEXBOX=4]="FLEXBOX",B[B.MULTI_COLUMN=5]="MULTI_COLUMN",B[B.CHECKBOX=6]="CHECKBOX",B[B.PRODUCTS=11]="PRODUCTS",B[B.PRODUCT=12]="PRODUCT",B[B.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",B[B.PRODUCT_TITLE=14]="PRODUCT_TITLE",B[B.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",B[B.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",B[B.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",B[B.PRODUCT_RATING=19]="PRODUCT_RATING",B[B.EMAIL_INPUT=51]="EMAIL_INPUT",B[B.PHONE_INPUT=52]="PHONE_INPUT",B[B.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",B[B.CAROUSEL=62]="CAROUSEL",B[B.SHAPE=100]="SHAPE",B))(je||{});var to=class extends qt{constructor(e){super(e)}};var ln=class extends qt{src;constructor(e){super(e),this.src=e.src}};var kr=class extends qt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new at(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var An=class extends kr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var cc=class extends qt{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 jo=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 o=window.setInterval(()=>{let i=new Date().getTime(),s=n.getTime()-i;if(s<1){clearInterval(o);return}let a=Math.floor(s/(1e3*60*60*24)),l=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),f=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:l,minutes:f,seconds:d})},1e3);return o}};var Go=class extends kr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new jo(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var lc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new Ve(e.c??{})}get text(){return this.txt}get color(){return this.c}};var Dn=class extends kr{ph;constructor(e){super(e),this.ph=new lc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var zo=class extends Dn{constructor(e){e??={},super(e)}};var qo=class extends Dn{};var Yo=class extends Dn{};var Ko=class extends ln{};var uc=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 fc=15,os=class extends qt{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new uc(e.anim),this.spc||(this.spc=new en({pl:fc,pr:fc,pt:fc,pb:fc}))}};var pc=class extends os{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new cc(e.cont),this.mob=new os(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new ln(r)):r.t===2?this.elems.push(new An(r)):r.t===3?this.elems.push(new An(r)):r.t===100?this.elems.push(new to(r)):r.t===51?this.elems.push(new qo(r)):r.t===52?this.elems.push(new Yo(r)):r.t===61?this.elems.push(new Go(r)):r.t===15||r.t===16?this.elems.push(new zo(r)):r.t===13&&this.elems.push(new Ko(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}};var Xo=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 mc=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 dc=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 hc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new en(e.spc),e.size&&(this.size=new dc(e.size)),e.bg&&(this.bg=new Wn(e.bg)),e.br&&(this.br=new Zr(e.br)),e.typo&&(this.typo=new at(e.typo)),e.lout&&(this.lout=new mc(e.lout)),e.flex&&(this.flex=new Xo(e.flex))}},Jo=class{sm;lg;constructor(e){e??={},this.sm=new hc(e.sm),this.lg=new hc(e.lg)}};var ht=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new Jo(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return je[this.t]}};var gt=class extends ht{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 ro=class extends gt{constructor(e,r){super(e,r??3)}};var Qo=class extends ht{value;constructor(e){super(6,e),e??={},this.value=e.value}};var Zo=class extends gt{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var gc=class extends ht{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new Ve(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var vg=Xr(zs());var yc=class extends ht{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Yt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new Rn(e.conf),this.allowedTypes=e.allowedTypes}};var vc=class extends gt{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new jo(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var On=class extends ht{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Yt.getParsedElement(r);n&&this.elems.push(n)})}};var no=class extends ht{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 Yt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let o=t.getParsedElement(n);o&&r.push(o)}),r}static getParsedElement(e){switch(e.t){case 2:return new gt(e);case 3:return new ro(e);case 6:return new Qo(e);case 11:return new _c(e);case 12:return new Nn(e);case 61:return new vc(e);case 4:return new On(e);case 1:return new no(e);case 13:return new no(e,13);case 14:return new gt(e,14);case 15:case 16:return new Zo(e.t,e);case 18:return new ro(e,18);case 62:return new yc(e);case 19:return new gc(e);default:vg.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 Nn=class extends ht{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=Yt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new Qo(e.cBox)),this.elems.push(new no(e.img,13));let r=new gt(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new gt(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let o=new gt(e.compareAt);o.text="{{ product.compare_price }}",o.hide=!e.show?.price,e.compareAt||(o.style=new Jo(n.style),o.style.lg.typo=new at(Z(_({},o.style.lg.typo),{td:"line-through"})),o.style.sm.typo=new at(Z(_({},o.style.sm.typo),{td:"line-through"})));let i=new On({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Yt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});i.elems.push(o),i.elems.push(n),this.elems.push(i);let s=new Zo(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new ro(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new gt(e.symbol))}};var _c=class extends ht{conf;prod;constructor(e){super(11,e),e??={},this.conf=new rp(e.conf),this.prod=new Nn(e.prod)}};var Ec=class extends Rn{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},rp=class{lg;sm;constructor(e){e??={},this.lg=new Ec(e.lg),this.sm=new Ec(e.sm)}};var wc=class extends On{constructor(e){super(e)}};var ei=class{cont;elems=[];constructor(e){e=e??{},this.cont=new wc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Yt.getParsedElement(e);return r&&this.elems.push(r),r}};function bc(t,e){return Xb(t,e,0,5)}function Xb(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let o of e){if(o.t===t)return o;let i="elems"in o?o.elems:[];if(i?.length>0){let s=bc(t,i);if(s)return s}}}}var np=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===Di.EXCLUSION}isABTesting(){return this.contentType===Di.ABTESTING}isSingleContent(){return this.contentType===Di.SINGLE}},is=class{videoConfig;savingsBarConfig;afterDeleteJS;afterRenderJS;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new rc(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new ta(e.savingsBarConfig)),e.afterDeleteJS&&(this.afterDeleteJS=e.afterDeleteJS),e.afterRenderJS&&(this.afterRenderJS=e.afterRenderJS)}},St=class extends np{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=ir({});constructor(e){super(e),this.id=e.id,this.currency=fe().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new ei(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new Ot(r)),this.items=e.items?.map(r=>new Ct(r))??[],this.nonMutableItems=e.items?.map(r=>new Ct(r))??[],this.collections=e.collections?.map(r=>new sc(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 ac(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new Qs(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new ea(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Ks(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Ct(e.bundleFrom)),e.content&&(this.content=new is(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===yr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Oi.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Oi.PAGE_EMBED}isProgressBar(){return this.objective===yr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===yr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===yr.CART_RECOVERY}isProductPromotion(){return this.objective===yr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===tu.COLLECTION}isBYOB(){return this.objective===yr.BYOB}isStickyATC(){return this.objective===yr.STICKY_ATC}isShoppableVideo(){return this.objective===yr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===yr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},o={};if(r){let a=r.selectedOrFirstVariant.value;n=Z(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},Mt("price",a.price.d)),Mt("comparePrice",a.price.cmp)),{quantity:r.quantity}),o={quantity:a.quantity}}let i={productCount:de.getCurrent().item_count},s=Vo(JSON.stringify(e),{product:n,variant:o,cart:i,discount:this.discount,customer:this.customerData},new Cr(new Date,this));return r&&(s=s.replace(new RegExp("https://cdn.global.letscooee.com/images/placeholders/product.png","gi"),r.variantImage??r.firstImageURL)),new pc(JSON.parse(s))}calculateDiscountData(e,r){let n=Qr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),o=Qr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),i={actualPrice:n,totalComparePrice:o,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(i);return}if(er.BXGY===this.discount.type&&this.discount.values?.length)i.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,i.discountPercentage,!0),i.discountAmount=i.actualPrice-Qr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([er.STATIC,er.UNIQUE_FLAT].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(er.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType==="fixed_amount"?(i.discountAmount=this.discount.values[0],i.discountPercentage=i.actualPrice>0?i.discountAmount*100/i.actualPrice:0):(i.discountPercentage=this.discount.values[0],i.discountAmount=i.actualPrice*i.discountPercentage/100),this.updateEffectivePrice(e,i.discountPercentage);else if(this.discount.type===er.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===er.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,l)=>l.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,i.discountAmount=s.selectedOrFirstVariant.value.price.d,i.discountPercentage=i.discountAmount/i.actualPrice*100}i.discountedPrice=i.actualPrice-i.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(i)}getPrivateAttributesForLineItem(){return Ye.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Ye.get().skipItemAttribute?[]:[{key:"_via",value:"Cooee"},{key:"_letscooee_campaign",value:this.shortID},{key:"_letscooee_content",value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(bc(62,this.widget?.elems))return!0;let r=bc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===Oi.POPUP?e="Popup":e=Um.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=de.getCurrent(),r=Qr.sum(e.items??[],n=>n.discounts?.reduce((o,i)=>o+(i.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},Mt("amount",e.total_price/100)),Mt("originalAmount",e.original_total_price/100)),Mt("total_line_items_discount",r/100)),Mt("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.isProgressBar()&&!this.isSavingsBar()}shouldSkipVariation(){return this.isSingleContent()||this.isProgressBar()||this.isSavingsBar()||!!this.widget}updateEffectivePrice(e,r,n=!1){let o=fe().currentItem;e.forEach(i=>{let s=i.selectedOrFirstVariant.value,a=s.price;if(n&&i.mID===o.mID)s.effectivePrice.value=a.d;else{let l=a.d*r/100;s.effectivePrice.value=a.d-l}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Lh(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Mt(n,e[n]))}),r}};function Qb(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Zb=nS,eS=iS,tS=cS,Hr=[],ar=[],rS=typeof Uint8Array<"u"?Uint8Array:Array,op="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(oo=0,_g=op.length;oo<_g;++oo)Hr[oo]=op[oo],ar[op.charCodeAt(oo)]=oo;var oo,_g;ar[45]=62;ar[95]=63;function Mg(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 nS(t){var e=Mg(t),r=e[0],n=e[1];return(r+n)*3/4-n}function oS(t,e,r){return(e+r)*3/4-r}function iS(t){var e,r=Mg(t),n=r[0],o=r[1],i=new rS(oS(t,n,o)),s=0,a=o>0?n-4:n,l;for(l=0;l<a;l+=4)e=ar[t.charCodeAt(l)]<<18|ar[t.charCodeAt(l+1)]<<12|ar[t.charCodeAt(l+2)]<<6|ar[t.charCodeAt(l+3)],i[s++]=e>>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=ar[t.charCodeAt(l)]<<2|ar[t.charCodeAt(l+1)]>>4,i[s++]=e&255),o===1&&(e=ar[t.charCodeAt(l)]<<10|ar[t.charCodeAt(l+1)]<<4|ar[t.charCodeAt(l+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function sS(t){return Hr[t>>18&63]+Hr[t>>12&63]+Hr[t>>6&63]+Hr[t&63]}function aS(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(sS(n));return o.join("")}function cS(t){for(var e,r=t.length,n=r%3,o=[],i=16383,s=0,a=r-n;s<a;s+=i)o.push(aS(t,s,s+i>a?a:s+i));return n===1?(e=t[r-1],o.push(Hr[e>>2]+Hr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(Hr[e>>10]+Hr[e>>4&63]+Hr[e<<2&63]+"=")),o.join("")}var ip={byteLength:Zb,toByteArray:eS,fromByteArray:tS};var lS=function(e,r,n,o,i){var s,a,l=i*8-o-1,f=(1<<l)-1,d=f>>1,m=-7,E=n?i-1:0,y=n?-1:1,C=e[r+E];for(E+=y,s=C&(1<<-m)-1,C>>=-m,m+=l;m>0;s=s*256+e[r+E],E+=y,m-=8);for(a=s&(1<<-m)-1,s>>=-m,m+=o;m>0;a=a*256+e[r+E],E+=y,m-=8);if(s===0)s=1-d;else{if(s===f)return a?NaN:(C?-1:1)*(1/0);a=a+Math.pow(2,o),s=s-d}return(C?-1:1)*a*Math.pow(2,s-o)},uS=function(e,r,n,o,i,s){var a,l,f,d=s*8-i-1,m=(1<<d)-1,E=m>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=o?0:s-1,D=o?1:-1,N=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=m):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+E>=1?r+=y/f:r+=y*Math.pow(2,1-E),r*f>=2&&(a++,f/=2),a+E>=m?(l=0,a=m):a+E>=1?(l=(r*f-1)*Math.pow(2,i),a=a+E):(l=r*Math.pow(2,E-1)*Math.pow(2,i),a=0));i>=8;e[n+C]=l&255,C+=D,l/=256,i-=8);for(a=a<<i|l,d+=i;d>0;e[n+C]=a&255,C+=D,a/=256,d-=8);e[n+C-D]|=N*128},ti={read:lS,write:uS},Ic=Qb(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=k,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=o(),!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 o(){try{var h=new Uint8Array(1),c={foo:function(){return 42}};return Object.setPrototypeOf(c,Uint8Array.prototype),Object.setPrototypeOf(h,c),h.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 i(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var c=new Uint8Array(h);return Object.setPrototypeOf(c,s.prototype),c}function s(h,c,u){if(typeof h=="number"){if(typeof c=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(h)}return a(h,c,u)}s.poolSize=8192;function a(h,c,u){if(typeof h=="string")return m(h,c);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if($e(h,ArrayBuffer)||h&&$e(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($e(h,SharedArrayBuffer)||h&&$e(h.buffer,SharedArrayBuffer)))return C(h,c,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,c,u);var x=D(h);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),c,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,c,u){return a(h,c,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function f(h,c,u){return l(h),h<=0?i(h):c!==void 0?typeof u=="string"?i(h).fill(c,u):i(h).fill(c):i(h)}s.alloc=function(h,c,u){return f(h,c,u)};function d(h){return l(h),i(h<0?0:N(h)|0)}s.allocUnsafe=function(h){return d(h)},s.allocUnsafeSlow=function(h){return d(h)};function m(h,c){if((typeof c!="string"||c==="")&&(c="utf8"),!s.isEncoding(c))throw new TypeError("Unknown encoding: "+c);var u=X(h,c)|0,v=i(u),x=v.write(h,c);return x!==u&&(v=v.slice(0,x)),v}function E(h){for(var c=h.length<0?0:N(h.length)|0,u=i(c),v=0;v<c;v+=1)u[v]=h[v]&255;return u}function y(h){if($e(h,Uint8Array)){var c=new Uint8Array(h);return C(c.buffer,c.byteOffset,c.byteLength)}return E(h)}function C(h,c,u){if(c<0||h.byteLength<c)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<c+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return c===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,c):v=new Uint8Array(h,c,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var c=N(h.length)|0,u=i(c);return u.length===0||h.copy(u,0,0,c),u}if(h.length!==void 0)return typeof h.length!="number"||De(h.length)?i(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function N(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function k(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==s.prototype},s.compare=function(c,u){if($e(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),$e(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(c)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===u)return 0;for(var v=c.length,x=u.length,O=0,W=Math.min(v,x);O<W;++O)if(c[O]!==u[O]){v=c[O],x=u[O];break}return v<x?-1:x<v?1:0},s.isEncoding=function(c){switch(String(c).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(c,u){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<c.length;++v)u+=c[v].length;var x=s.allocUnsafe(u),O=0;for(v=0;v<c.length;++v){var W=c[v];if($e(W,Uint8Array))O+W.length>x.length?s.from(W).copy(x,O):Uint8Array.prototype.set.call(x,W,O);else if(s.isBuffer(W))W.copy(x,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=W.length}return x};function X(h,c){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||$e(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var x=!1;;)switch(c){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return Et(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return He(h).length;default:if(x)return v?-1:Et(h).length;c=(""+c).toLowerCase(),x=!0}}s.byteLength=X;function B(h,c,u){var v=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,c>>>=0,u<=c))return"";for(h||(h="utf8");;)switch(h){case"hex":return V(this,c,u);case"utf8":case"utf-8":return Ge(this,c,u);case"ascii":return A(this,c,u);case"latin1":case"binary":return R(this,c,u);case"base64":return Re(this,c,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,c,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function Q(h,c,u){var v=h[c];h[c]=h[u],h[u]=v}s.prototype.swap16=function(){var c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<c;u+=2)Q(this,u,u+1);return this},s.prototype.swap32=function(){var c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<c;u+=4)Q(this,u,u+3),Q(this,u+1,u+2);return this},s.prototype.swap64=function(){var c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<c;u+=8)Q(this,u,u+7),Q(this,u+1,u+6),Q(this,u+2,u+5),Q(this,u+3,u+4);return this},s.prototype.toString=function(){var c=this.length;return c===0?"":arguments.length===0?Ge(this,0,c):B.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(c){if(!s.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:s.compare(this,c)===0},s.prototype.inspect=function(){var c="",u=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(c+=" ... "),"<Buffer "+c+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(c,u,v,x,O){if($e(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(c));if(u===void 0&&(u=0),v===void 0&&(v=c?c.length:0),x===void 0&&(x=0),O===void 0&&(O=this.length),u<0||v>c.length||x<0||O>this.length)throw new RangeError("out of range index");if(x>=O&&u>=v)return 0;if(x>=O)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,x>>>=0,O>>>=0,this===c)return 0;for(var W=O-x,ue=v-u,Ee=Math.min(W,ue),ye=this.slice(x,O),Le=c.slice(u,v),ke=0;ke<Ee;++ke)if(ye[ke]!==Le[ke]){W=ye[ke],ue=Le[ke];break}return W<ue?-1:ue<W?1:0};function _e(h,c,u,v,x){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,De(u)&&(u=x?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(x)return-1;u=h.length-1}else if(u<0)if(x)u=0;else return-1;if(typeof c=="string"&&(c=s.from(c,v)),s.isBuffer(c))return c.length===0?-1:K(h,c,u,v,x);if(typeof c=="number")return c=c&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(h,c,u):Uint8Array.prototype.lastIndexOf.call(h,c,u):K(h,[c],u,v,x);throw new TypeError("val must be string, number or Buffer")}function K(h,c,u,v,x){var O=1,W=h.length,ue=c.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||c.length<2)return-1;O=2,W/=2,ue/=2,u/=2}function Ee(mr,Kr){return O===1?mr[Kr]:mr.readUInt16BE(Kr*O)}var ye;if(x){var Le=-1;for(ye=u;ye<W;ye++)if(Ee(h,ye)===Ee(c,Le===-1?0:ye-Le)){if(Le===-1&&(Le=ye),ye-Le+1===ue)return Le*O}else Le!==-1&&(ye-=ye-Le),Le=-1}else for(u+ue>W&&(u=W-ue),ye=u;ye>=0;ye--){for(var ke=!0,nt=0;nt<ue;nt++)if(Ee(h,ye+nt)!==Ee(c,nt)){ke=!1;break}if(ke)return ye}return-1}s.prototype.includes=function(c,u,v){return this.indexOf(c,u,v)!==-1},s.prototype.indexOf=function(c,u,v){return _e(this,c,u,v,!0)},s.prototype.lastIndexOf=function(c,u,v){return _e(this,c,u,v,!1)};function ce(h,c,u,v){u=Number(u)||0;var x=h.length-u;v?(v=Number(v),v>x&&(v=x)):v=x;var O=c.length;v>O/2&&(v=O/2);for(var W=0;W<v;++W){var ue=parseInt(c.substr(W*2,2),16);if(De(ue))return W;h[u+W]=ue}return W}function se(h,c,u,v){return Ae(Et(c,h.length-u),h,u,v)}function me(h,c,u,v){return Ae(st(c),h,u,v)}function Pe(h,c,u,v){return Ae(He(c),h,u,v)}function Se(h,c,u,v){return Ae(be(c,h.length-u),h,u,v)}s.prototype.write=function(c,u,v,x){if(u===void 0)x="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")x=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,x===void 0&&(x="utf8")):(x=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var O=this.length-u;if((v===void 0||v>O)&&(v=O),c.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var W=!1;;)switch(x){case"hex":return ce(this,c,u,v);case"utf8":case"utf-8":return se(this,c,u,v);case"ascii":case"latin1":case"binary":return me(this,c,u,v);case"base64":return Pe(this,c,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,c,u,v);default:if(W)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),W=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Re(h,c,u){return c===0&&u===h.length?ip.fromByteArray(h):ip.fromByteArray(h.slice(c,u))}function Ge(h,c,u){u=Math.min(h.length,u);for(var v=[],x=c;x<u;){var O=h[x],W=null,ue=O>239?4:O>223?3:O>191?2:1;if(x+ue<=u){var Ee,ye,Le,ke;switch(ue){case 1:O<128&&(W=O);break;case 2:Ee=h[x+1],(Ee&192)===128&&(ke=(O&31)<<6|Ee&63,ke>127&&(W=ke));break;case 3:Ee=h[x+1],ye=h[x+2],(Ee&192)===128&&(ye&192)===128&&(ke=(O&15)<<12|(Ee&63)<<6|ye&63,ke>2047&&(ke<55296||ke>57343)&&(W=ke));break;case 4:Ee=h[x+1],ye=h[x+2],Le=h[x+3],(Ee&192)===128&&(ye&192)===128&&(Le&192)===128&&(ke=(O&15)<<18|(Ee&63)<<12|(ye&63)<<6|Le&63,ke>65535&&ke<1114112&&(W=ke))}}W===null?(W=65533,ue=1):W>65535&&(W-=65536,v.push(W>>>10&1023|55296),W=56320|W&1023),v.push(W),x+=ue}return kt(v)}var Ze=4096;function kt(h){var c=h.length;if(c<=Ze)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<c;)u+=String.fromCharCode.apply(String,h.slice(v,v+=Ze));return u}function A(h,c,u){var v="";u=Math.min(h.length,u);for(var x=c;x<u;++x)v+=String.fromCharCode(h[x]&127);return v}function R(h,c,u){var v="";u=Math.min(h.length,u);for(var x=c;x<u;++x)v+=String.fromCharCode(h[x]);return v}function V(h,c,u){var v=h.length;(!c||c<0)&&(c=0),(!u||u<0||u>v)&&(u=v);for(var x="",O=c;O<u;++O)x+=Wt[h[O]];return x}function U(h,c,u){for(var v=h.slice(c,u),x="",O=0;O<v.length-1;O+=2)x+=String.fromCharCode(v[O]+v[O+1]*256);return x}s.prototype.slice=function(c,u){var v=this.length;c=~~c,u=u===void 0?v:~~u,c<0?(c+=v,c<0&&(c=0)):c>v&&(c=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<c&&(u=c);var x=this.subarray(c,u);return Object.setPrototypeOf(x,s.prototype),x};function H(h,c,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+c>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=this[c],O=1,W=0;++W<u&&(O*=256);)x+=this[c+W]*O;return x},s.prototype.readUintBE=s.prototype.readUIntBE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=this[c+--u],O=1;u>0&&(O*=256);)x+=this[c+--u]*O;return x},s.prototype.readUint8=s.prototype.readUInt8=function(c,u){return c=c>>>0,u||H(c,1,this.length),this[c]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(c,u){return c=c>>>0,u||H(c,2,this.length),this[c]|this[c+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(c,u){return c=c>>>0,u||H(c,2,this.length),this[c]<<8|this[c+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(c,u){return c=c>>>0,u||H(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(c,u){return c=c>>>0,u||H(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},s.prototype.readIntLE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=this[c],O=1,W=0;++W<u&&(O*=256);)x+=this[c+W]*O;return O*=128,x>=O&&(x-=Math.pow(2,8*u)),x},s.prototype.readIntBE=function(c,u,v){c=c>>>0,u=u>>>0,v||H(c,u,this.length);for(var x=u,O=1,W=this[c+--x];x>0&&(O*=256);)W+=this[c+--x]*O;return O*=128,W>=O&&(W-=Math.pow(2,8*u)),W},s.prototype.readInt8=function(c,u){return c=c>>>0,u||H(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},s.prototype.readInt16LE=function(c,u){c=c>>>0,u||H(c,2,this.length);var v=this[c]|this[c+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(c,u){c=c>>>0,u||H(c,2,this.length);var v=this[c+1]|this[c]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(c,u){return c=c>>>0,u||H(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},s.prototype.readInt32BE=function(c,u){return c=c>>>0,u||H(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},s.prototype.readFloatLE=function(c,u){return c=c>>>0,u||H(c,4,this.length),ti.read(this,c,!0,23,4)},s.prototype.readFloatBE=function(c,u){return c=c>>>0,u||H(c,4,this.length),ti.read(this,c,!1,23,4)},s.prototype.readDoubleLE=function(c,u){return c=c>>>0,u||H(c,8,this.length),ti.read(this,c,!0,52,8)},s.prototype.readDoubleBE=function(c,u){return c=c>>>0,u||H(c,8,this.length),ti.read(this,c,!1,52,8)};function ne(h,c,u,v,x,O){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>x||c<O)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(c,u,v,x){if(c=+c,u=u>>>0,v=v>>>0,!x){var O=Math.pow(2,8*v)-1;ne(this,c,u,v,O,0)}var W=1,ue=0;for(this[u]=c&255;++ue<v&&(W*=256);)this[u+ue]=c/W&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(c,u,v,x){if(c=+c,u=u>>>0,v=v>>>0,!x){var O=Math.pow(2,8*v)-1;ne(this,c,u,v,O,0)}var W=v-1,ue=1;for(this[u+W]=c&255;--W>=0&&(ue*=256);)this[u+W]=c/ue&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,1,255,0),this[u]=c&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,65535,0),this[u]=c&255,this[u+1]=c>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,65535,0),this[u]=c>>>8,this[u+1]=c&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,4294967295,0),this[u+3]=c>>>24,this[u+2]=c>>>16,this[u+1]=c>>>8,this[u]=c&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,4294967295,0),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4},s.prototype.writeIntLE=function(c,u,v,x){if(c=+c,u=u>>>0,!x){var O=Math.pow(2,8*v-1);ne(this,c,u,v,O-1,-O)}var W=0,ue=1,Ee=0;for(this[u]=c&255;++W<v&&(ue*=256);)c<0&&Ee===0&&this[u+W-1]!==0&&(Ee=1),this[u+W]=(c/ue>>0)-Ee&255;return u+v},s.prototype.writeIntBE=function(c,u,v,x){if(c=+c,u=u>>>0,!x){var O=Math.pow(2,8*v-1);ne(this,c,u,v,O-1,-O)}var W=v-1,ue=1,Ee=0;for(this[u+W]=c&255;--W>=0&&(ue*=256);)c<0&&Ee===0&&this[u+W+1]!==0&&(Ee=1),this[u+W]=(c/ue>>0)-Ee&255;return u+v},s.prototype.writeInt8=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,1,127,-128),c<0&&(c=255+c+1),this[u]=c&255,u+1},s.prototype.writeInt16LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,32767,-32768),this[u]=c&255,this[u+1]=c>>>8,u+2},s.prototype.writeInt16BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,2,32767,-32768),this[u]=c>>>8,this[u+1]=c&255,u+2},s.prototype.writeInt32LE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,2147483647,-2147483648),this[u]=c&255,this[u+1]=c>>>8,this[u+2]=c>>>16,this[u+3]=c>>>24,u+4},s.prototype.writeInt32BE=function(c,u,v){return c=+c,u=u>>>0,v||ne(this,c,u,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[u]=c>>>24,this[u+1]=c>>>16,this[u+2]=c>>>8,this[u+3]=c&255,u+4};function ge(h,c,u,v,x,O){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function qe(h,c,u,v,x){return c=+c,u=u>>>0,x||ge(h,c,u,4),ti.write(h,c,u,v,23,4),u+4}s.prototype.writeFloatLE=function(c,u,v){return qe(this,c,u,!0,v)},s.prototype.writeFloatBE=function(c,u,v){return qe(this,c,u,!1,v)};function tt(h,c,u,v,x){return c=+c,u=u>>>0,x||ge(h,c,u,8),ti.write(h,c,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(c,u,v){return tt(this,c,u,!0,v)},s.prototype.writeDoubleBE=function(c,u,v){return tt(this,c,u,!1,v)},s.prototype.copy=function(c,u,v,x){if(!s.isBuffer(c))throw new TypeError("argument should be a Buffer");if(v||(v=0),!x&&x!==0&&(x=this.length),u>=c.length&&(u=c.length),u||(u=0),x>0&&x<v&&(x=v),x===v||c.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=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),c.length-u<x-v&&(x=c.length-u+v);var O=x-v;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,x):Uint8Array.prototype.set.call(c,this.subarray(v,x),u),O},s.prototype.fill=function(c,u,v,x){if(typeof c=="string"){if(typeof u=="string"?(x=u,u=0,v=this.length):typeof v=="string"&&(x=v,v=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(c.length===1){var O=c.charCodeAt(0);(x==="utf8"&&O<128||x==="latin1")&&(c=O)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,c||(c=0);var W;if(typeof c=="number")for(W=u;W<v;++W)this[W]=c;else{var ue=s.isBuffer(c)?c:s.from(c,x),Ee=ue.length;if(Ee===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(W=0;W<v-u;++W)this[W+u]=ue[W%Ee]}return this};var rt=/[^+/0-9A-Za-z-_]/g;function _t(h){if(h=h.split("=")[0],h=h.trim().replace(rt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function Et(h,c){c=c||1/0;for(var u,v=h.length,x=null,O=[],W=0;W<v;++W){if(u=h.charCodeAt(W),u>55295&&u<57344){if(!x){if(u>56319){(c-=3)>-1&&O.push(239,191,189);continue}else if(W+1===v){(c-=3)>-1&&O.push(239,191,189);continue}x=u;continue}if(u<56320){(c-=3)>-1&&O.push(239,191,189),x=u;continue}u=(x-55296<<10|u-56320)+65536}else x&&(c-=3)>-1&&O.push(239,191,189);if(x=null,u<128){if((c-=1)<0)break;O.push(u)}else if(u<2048){if((c-=2)<0)break;O.push(u>>6|192,u&63|128)}else if(u<65536){if((c-=3)<0)break;O.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((c-=4)<0)break;O.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return O}function st(h){for(var c=[],u=0;u<h.length;++u)c.push(h.charCodeAt(u)&255);return c}function be(h,c){for(var u,v,x,O=[],W=0;W<h.length&&!((c-=2)<0);++W)u=h.charCodeAt(W),v=u>>8,x=u%256,O.push(x),O.push(v);return O}function He(h){return ip.toByteArray(_t(h))}function Ae(h,c,u,v){for(var x=0;x<v&&!(x+u>=c.length||x>=h.length);++x)c[x+u]=h[x];return x}function $e(h,c){return h instanceof c||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===c.name}function De(h){return h!==h}var Wt=(function(){for(var h="0123456789abcdef",c=new Array(256),u=0;u<16;++u)for(var v=u*16,x=0;x<16;++x)c[v+x]=h[u]+h[x];return c})()}),Ie=Ic.Buffer;Ic.SlowBuffer;Ic.INSPECT_MAX_BYTES;Ic.kMaxLength;var up=function(e,r){return up=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},up(e,r)};function xc(t,e){up(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var so=(function(t){xc(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),Xe=(function(t){xc(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 Sc(t){return t&&t.Math==Math&&t}function Bg(){return Sc(typeof globalThis=="object"&&globalThis)||Sc(typeof window=="object"&&window)||Sc(typeof self=="object"&&self)||Sc(typeof global=="object"&&global)||Function("return this")()}function fS(){var t=Bg();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var pS=function(e){var r=fS()?"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=Ie.alloc(e),o=0;o<e;++o)n[o]=Math.floor(Math.random()*256);return n},mS=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ie.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ie.alloc(e))}:pS}},Ug=mS();function dS(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function pp(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function hS(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function gS(t){return ls(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ls(t){return typeof t=="object"&&t!==null}function Cc(t,e){var r=!1;function n(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return r||(console.warn(e),r=!0),t.apply(this,o)}return n}function Tc(t){if(ArrayBuffer.isView(t))return Ie.from(t.buffer,t.byteOffset,t.byteLength);if(dS(t))return Ie.from(t);throw new Xe("Must use either Buffer or TypedArray")}var yS=/^(?:[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,kg=function(t){return typeof t=="string"&&yS.test(t)},fp=function(t){if(!kg(t))throw new Xe('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 Ie.from(e,"hex")},Eg=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 BU=Math.pow(2,63)-1,UU=-Math.pow(2,63),vS=Math.pow(2,53),_S=-Math.pow(2,53);var Fg=4;var ao=(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 Xe("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=Ie.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ie.from(e,"binary"):Array.isArray(e)?this.buffer=Ie.from(e):this.buffer=Tc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Xe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Xe("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 Xe("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=Ie.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=Ie.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Tc(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 wg(this.buffer.slice(0,this.position));throw new so('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,o;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(o=e.$type?parseInt(e.$type,16):0,n=Ie.from(e.$binary,"base64")):typeof e.$binary!="string"&&(o=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ie.from(e.$binary.base64,"base64")):"$uuid"in e&&(o=4,n=fp(e.$uuid)),!n)throw new Xe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return o===Fg?new wg(n):new t(n,o)},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(ao.prototype,"_bsontype",{value:"Binary"});var sp=16,wg=(function(t){xc(e,t);function e(r){var n=this,o,i;if(r==null)o=e.generate();else if(r instanceof e)o=Ie.from(r.buffer),i=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===sp)o=Tc(r);else if(typeof r=="string")o=fp(r);else throw new Xe("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,o,Fg)||this,n.__id=i,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=Eg(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=Eg(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 ao(this.id,ao.SUBTYPE_UUID)},e.generate=function(){var r=Ug(sp);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ie.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?kg(r):pp(r)?r.length!==sp?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=fp(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})(ao),Rc=(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(Rc.prototype,"_bsontype",{value:"Code"});function ES(t){return ls(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var as=(function(){function t(e,r,n,o){if(!(this instanceof t))return new t(e,r,n,o);var i=e.split(".");i.length===2&&(n=i.shift(),e=i.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=o||{}}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(as.prototype,"_bsontype",{value:"DBRef"});var sr=void 0;try{sr=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 bg=65536,wS=1<<24,ni=bg*bg,Hg=ni*ni,Sg=Hg/2,Tg={},Ig={},oe=(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,o,i;return r?(e>>>=0,(i=0<=e&&e<256)&&(o=Ig[e],o)?o:(n=t.fromBits(e,(e|0)<0?-1:0,!0),i&&(Ig[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=Tg[e],o)?o:(n=t.fromBits(e,e<0?-1:0,!1),i&&(Tg[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>=Hg)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Sg)return t.MIN_VALUE;if(e+1>=Sg)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%ni|0,e/ni|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 o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return t.fromString(e.substring(1),r,n).neg();for(var i=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var l=Math.min(8,e.length-a),f=parseInt(e.substring(a,a+l),n);if(l<8){var d=t.fromNumber(Math.pow(n,l));s=s.mul(d).add(t.fromNumber(f))}else s=s.mul(i),s=s.add(t.fromNumber(f))}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 ls(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,o=this.low>>>16,i=this.low&65535,s=e.high>>>16,a=e.high&65535,l=e.low>>>16,f=e.low&65535,d=0,m=0,E=0,y=0;return y+=i+f,E+=y>>>16,y&=65535,E+=o+l,m+=E>>>16,E&=65535,m+=n+a,d+=m>>>16,m&=65535,d+=r+s,d&=65535,t.fromBits(E<<16|y,d<<16|m,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(sr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?sr.div_u:sr.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,o,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;i=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:(o=this.sub(e.mul(n)),i=n.add(o.div(e)),i)}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();i=t.ZERO}for(o=this;o.gte(e);){n=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),l=a<=48?1:Math.pow(2,a-48),f=t.fromNumber(n),d=f.mul(e);d.isNegative()||d.gt(o);)n-=l,f=t.fromNumber(n,this.unsigned),d=f.mul(e);f.isZero()&&(f=t.ONE),i=i.add(f),o=o.sub(d)}return i},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)),sr){var r=(this.unsigned?sr.rem_u:sr.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.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)),sr){var r=sr.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,sr.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,o=this.high&65535,i=this.low>>>16,s=this.low&65535,a=e.high>>>16,l=e.high&65535,f=e.low>>>16,d=e.low&65535,m=0,E=0,y=0,C=0;return C+=s*d,y+=C>>>16,C&=65535,y+=i*d,E+=y>>>16,y&=65535,y+=s*f,E+=y>>>16,y&=65535,E+=o*d,m+=E>>>16,E&=65535,E+=i*f,m+=E>>>16,E&=65535,E+=s*l,m+=E>>>16,E&=65535,m+=n*d+o*f+i*l+s*a,m&=65535,t.fromBits(y<<16|C,m<<16|E,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)*ni+(this.low>>>0):this.high*ni+(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),o=n.mul(r).sub(this);return n.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var l=s.div(i),f=s.sub(l.mul(i)).toInt()>>>0,d=f.toString(e);if(s=l,s.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+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(wS),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(oe.prototype,"__isLong__",{value:!0});Object.defineProperty(oe.prototype,"_bsontype",{value:"Long"});var bS=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,SS=/^(\+|-)?(Infinity|inf)$/i,TS=/^(\+|-)?NaN$/i,ss=6111,ap=-6176,xg=6176,IS=34,cp=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Cg=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Rg=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),xS=/^([-+])?(\d+)?$/,CS=31,Ag=16383,RS=30,AS=31;function Dg(t){return!isNaN(parseInt(t,10))}function DS(t){var e=oe.fromNumber(1e9),r=oe.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 oe(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function OS(t,e){if(!t&&!e)return{high:oe.fromNumber(0),low:oe.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new oe(t.getLowBits(),0),o=e.shiftRightUnsigned(32),i=new oe(e.getLowBits(),0),s=r.multiply(o),a=r.multiply(i),l=n.multiply(o),f=n.multiply(i);return s=s.add(a.shiftRightUnsigned(32)),a=new oe(a.getLowBits(),0).add(l).add(f.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),f=a.shiftLeft(32).add(new oe(f.getLowBits(),0)),{high:s,low:f}}function NS(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var o=t.low>>>0,i=e.low>>>0;if(o<i)return!0}return!1}function ri(t,e){throw new Xe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var mp=(function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(pp(e)){if(e.byteLength!==16)throw new Xe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Xe("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,o=!1,i=0,s=0,a=0,l=0,f=0,d=[0],m=0,E=0,y=0,C=0,D=0,N=0,k=new oe(0,0),X=new oe(0,0),B=0,Q=0;if(e.length>=7e3)throw new Xe(""+e+" not a valid Decimal128 string");var _e=e.match(bS),K=e.match(SS),ce=e.match(TS);if(!_e&&!K&&!ce||e.length===0)throw new Xe(""+e+" not a valid Decimal128 string");if(_e){var se=_e[2],me=_e[4],Pe=_e[5],Se=_e[6];me&&Se===void 0&&ri(e,"missing exponent power"),me&&se===void 0&&ri(e,"missing exponent base"),me===void 0&&(Pe||Se)&&ri(e,"missing e before exponent")}if((e[Q]==="+"||e[Q]==="-")&&(r=e[Q++]==="-"),!Dg(e[Q])&&e[Q]!=="."){if(e[Q]==="i"||e[Q]==="I")return new t(Ie.from(r?Cg:Rg));if(e[Q]==="N")return new t(Ie.from(cp))}for(;Dg(e[Q])||e[Q]===".";){if(e[Q]==="."){n&&ri(e,"contains multiple periods"),n=!0,Q=Q+1;continue}m<34&&(e[Q]!=="0"||o)&&(o||(f=s),o=!0,d[E++]=parseInt(e[Q],10),m=m+1),o&&(a=a+1),n&&(l=l+1),s=s+1,Q=Q+1}if(n&&!s)throw new Xe(""+e+" not a valid Decimal128 string");if(e[Q]==="e"||e[Q]==="E"){var Re=e.substr(++Q).match(xS);if(!Re||!Re[2])return new t(Ie.from(cp));D=parseInt(Re[0],10),Q=Q+Re[0].length}if(e[Q])return new t(Ie.from(cp));if(y=0,!m)y=0,C=0,d[0]=0,a=1,m=1,i=0;else if(C=m-1,i=a,i!==1)for(;d[f+i-1]===0;)i=i-1;for(D<=l&&l-D>16384?D=ap:D=D-l;D>ss;){if(C=C+1,C-y>IS){var Ge=d.join("");if(Ge.match(/^0+$/)){D=ss;break}ri(e,"overflow")}D=D-1}for(;D<ap||m<a;){if(C===0&&i<m){D=ap,i=0;break}if(m<a?a=a-1:C=C-1,D<ss)D=D+1;else{var Ge=d.join("");if(Ge.match(/^0+$/)){D=ss;break}ri(e,"overflow")}}if(C-y+1<i){var Ze=s;n&&(f=f+1,Ze=Ze+1),r&&(f=f+1,Ze=Ze+1);var kt=parseInt(e[f+C+1],10),A=0;if(kt>=5&&(A=1,kt===5)){for(A=d[C]%2===1?1:0,N=f+C+2;N<Ze;N++)if(parseInt(e[N],10)){A=1;break}}if(A){for(var R=C;R>=0;R--)if(++d[R]>9&&(d[R]=0,R===0))if(D<ss)D=D+1,d[R]=1;else return new t(Ie.from(r?Cg:Rg))}}if(k=oe.fromNumber(0),X=oe.fromNumber(0),i===0)k=oe.fromNumber(0),X=oe.fromNumber(0);else if(C-y<17){var R=y;for(X=oe.fromNumber(d[R++]),k=new oe(0,0);R<=C;R++)X=X.multiply(oe.fromNumber(10)),X=X.add(oe.fromNumber(d[R]))}else{var R=y;for(k=oe.fromNumber(d[R++]);R<=C-17;R++)k=k.multiply(oe.fromNumber(10)),k=k.add(oe.fromNumber(d[R]));for(X=oe.fromNumber(d[R++]);R<=C;R++)X=X.multiply(oe.fromNumber(10)),X=X.add(oe.fromNumber(d[R]))}var V=OS(k,oe.fromString("100000000000000000"));V.low=V.low.add(X),NS(V.low,X)&&(V.high=V.high.add(oe.fromNumber(1))),B=D+xg;var U={low:oe.fromNumber(0),high:oe.fromNumber(0)};V.high.shiftRightUnsigned(49).and(oe.fromNumber(1)).equals(oe.fromNumber(1))?(U.high=U.high.or(oe.fromNumber(3).shiftLeft(61)),U.high=U.high.or(oe.fromNumber(B).and(oe.fromNumber(16383).shiftLeft(47))),U.high=U.high.or(V.high.and(oe.fromNumber(0x7fffffffffff)))):(U.high=U.high.or(oe.fromNumber(B&16383).shiftLeft(49)),U.high=U.high.or(V.high.and(oe.fromNumber(562949953421311)))),U.low=V.low,r&&(U.high=U.high.or(oe.fromString("9223372036854775808")));var H=Ie.alloc(16);return Q=0,H[Q++]=U.low.low&255,H[Q++]=U.low.low>>8&255,H[Q++]=U.low.low>>16&255,H[Q++]=U.low.low>>24&255,H[Q++]=U.low.high&255,H[Q++]=U.low.high>>8&255,H[Q++]=U.low.high>>16&255,H[Q++]=U.low.high>>24&255,H[Q++]=U.high.low&255,H[Q++]=U.high.low>>8&255,H[Q++]=U.high.low>>16&255,H[Q++]=U.high.low>>24&255,H[Q++]=U.high.high&255,H[Q++]=U.high.high>>8&255,H[Q++]=U.high.high>>16&255,H[Q++]=U.high.high>>24&255,new t(H)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),o=0;o<n.length;o++)n[o]=0;var i=0,s=!1,a,l={parts:[0,0,0,0]},f,d,m=[];i=0;var E=this.bytes,y=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24,C=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24,D=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24,N=E[i++]|E[i++]<<8|E[i++]<<16|E[i++]<<24;i=0;var k={low:new oe(y,C),high:new oe(D,N)};k.high.lessThan(oe.ZERO)&&m.push("-");var X=N>>26&CS;if(X>>3===3){if(X===RS)return m.join("")+"Infinity";if(X===AS)return"NaN";e=N>>15&Ag,a=8+(N>>14&1)}else a=N>>14&7,e=N>>17&Ag;var B=e-xg;if(l.parts[0]=(N&16383)+((a&15)<<14),l.parts[1]=D,l.parts[2]=C,l.parts[3]=y,l.parts[0]===0&&l.parts[1]===0&&l.parts[2]===0&&l.parts[3]===0)s=!0;else for(d=3;d>=0;d--){var Q=0,_e=DS(l);if(l=_e.quotient,Q=_e.rem.low,!!Q)for(f=8;f>=0;f--)n[d*9+f]=Q%10,Q=Math.floor(Q/10)}if(s)r=1,n[i]=0;else for(r=36;!n[i];)r=r-1,i=i+1;var K=r-1+B;if(K>=34||K<=-7||B>0){if(r>34)return m.push("".concat(0)),B>0?m.push("E+".concat(B)):B<0&&m.push("E".concat(B)),m.join("");m.push("".concat(n[i++])),r=r-1,r&&m.push(".");for(var o=0;o<r;o++)m.push("".concat(n[i++]));m.push("E"),K>0?m.push("+".concat(K)):m.push("".concat(K))}else if(B>=0)for(var o=0;o<r;o++)m.push("".concat(n[i++]));else{var ce=r+B;if(ce>0)for(var o=0;o<ce;o++)m.push("".concat(n[i++]));else m.push("0");for(m.push(".");ce++<0;)m.push("0");for(var o=0;o<r-Math.max(ce-1,0);o++)m.push("".concat(n[i++]))}return m.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(mp.prototype,"_bsontype",{value:"Decimal128"});var Ac=(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(Ac.prototype,"_bsontype",{value:"Double"});var Dc=(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(Dc.prototype,"_bsontype",{value:"Int32"});var dp=(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(dp.prototype,"_bsontype",{value:"MaxKey"});var hp=(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(hp.prototype,"_bsontype",{value:"MinKey"});var PS=new RegExp("^[0-9a-fA-F]{24}$"),io=null,Fr=Symbol("id"),yt=(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 Xe("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ie.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Fr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Fr]=r instanceof Ie?r:Tc(r);else if(typeof r=="string")if(r.length===12){var n=Ie.from(r);if(n.byteLength===12)this[Fr]=n;else throw new Xe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&PS.test(r))this[Fr]=Ie.from(r,"hex");else throw new Xe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Xe("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[Fr]},set:function(e){this[Fr]=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=Ie.alloc(12);return n.writeUInt32BE(e,0),io===null&&(io=Ug(5)),n[4]=io[0],n[5]=io[1],n[6]=io[2],n[7]=io[3],n[8]=io[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[Fr][11]===e[Fr][11]&&this[Fr].equals(e[Fr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&pp(this.id))return e===Ie.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 Ie.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=Ie.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 Xe("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ie.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(yt.prototype,"generate",{value:Cc(function(t){return yt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(yt.prototype,"getInc",{value:Cc(function(){return yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(yt.prototype,"get_inc",{value:Cc(function(){return yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(yt,"get_inc",{value:Cc(function(){return yt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(yt.prototype,"_bsontype",{value:"ObjectID"});function LS(t){return t.split("").sort().join("")}var cs=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=LS(r??""),this.pattern.indexOf("\0")!==-1)throw new so("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new so("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 so("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 Xe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t})();Object.defineProperty(cs.prototype,"_bsontype",{value:"BSONRegExp"});var gp=(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(gp.prototype,"_bsontype",{value:"Symbol"});var MS=oe,$g=(function(t){xc(e,t);function e(r,n){var o=this;return o instanceof e?(oe.isLong(r)?o=t.call(this,r.low,r.high,!0)||this:ls(r)&&typeof r.t<"u"&&typeof r.i<"u"?o=t.call(this,r.i,r.t,!0)||this:o=t.call(this,r,n,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(oe.fromInt(r,!0))},e.fromNumber=function(r){return new e(oe.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(oe.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=oe.MAX_UNSIGNED_VALUE,e})(MS);function BS(t){return ls(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Vg=2147483647,Wg=-2147483648,jg=9223372036854776e3,Gg=-9223372036854776e3,US={$oid:yt,$binary:ao,$uuid:ao,$symbol:gp,$numberInt:Dc,$numberDecimal:mp,$numberDouble:Ac,$numberLong:oe,$minKey:hp,$maxKey:dp,$regex:cs,$regularExpression:cs,$timestamp:$g};function zg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Wg&&t<=Vg)return new Dc(t);if(t>=Gg&&t<=jg)return oe.fromNumber(t)}return new Ac(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(m){return m.startsWith("$")&&t[m]!=null}),n=0;n<r.length;n++){var o=US[r[n]];if(o)return o.fromExtendedJSON(t,e)}if(t.$date!=null){var i=t.$date,s=new Date;return e.legacy?typeof i=="number"?s.setTime(i):typeof i=="string"&&s.setTime(Date.parse(i)):typeof i=="string"?s.setTime(Date.parse(i)):oe.isLong(i)?s.setTime(i.toNumber()):typeof i=="number"&&e.relaxed&&s.setTime(i),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=zg(t.$scope)),Rc.fromExtendedJSON(t)}if(ES(t)||t.$dbPointer){var l=t.$ref?t:t.$dbPointer;if(l instanceof as)return l;var f=Object.keys(l).filter(function(m){return m.startsWith("$")}),d=!0;if(f.forEach(function(m){["$ref","$id","$db"].indexOf(m)===-1&&(d=!1)}),d)return as.fromExtendedJSON(l)}return t}function kS(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Pn(r,e)}finally{e.seenObjects.pop()}})}function Og(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Pn(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(k){return k.obj===t});if(r!==-1){var n=e.seenObjects.map(function(k){return k.propertyName}),o=n.slice(0,r).map(function(k){return"".concat(k," -> ")}).join(""),i=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(k){return"".concat(k," -> ")}).join(""),a=n[n.length-1],l=" ".repeat(o.length+i.length/2),f="-".repeat(s.length+(i.length+a.length)/2-1);throw new Xe(`Converting circular structure to EJSON:
25
25
  `+" ".concat(o).concat(i).concat(s).concat(a,`
26
26
  `)+" ".concat(l,"\\").concat(f,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return kS(t,e);if(t===void 0)return null;if(t instanceof Date||gS(t)){var d=t.getTime(),m=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&m?{$date:t.getTime()}:{$date:Og(t)}:e.relaxed&&m?{$date:Og(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=Wg&&t<=Vg,y=t>=Gg&&t<=jg;if(E)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||hS(t)){var C=t.flags;if(C===void 0){var D=t.toString().match(/[gimuy]*$/);D&&(C=D[0])}var N=new cs(t.source,C);return N.toExtendedJSON(e)}return t!=null&&typeof t=="object"?HS(t,e):t}var FS={Binary:function(t){return new ao(t.value(),t.sub_type)},Code:function(t){return new Rc(t.code,t.scope)},DBRef:function(t){return new as(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new mp(t.bytes)},Double:function(t){return new Ac(t.value)},Int32:function(t){return new Dc(t.value)},Long:function(t){return oe.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 dp},MinKey:function(){return new hp},ObjectID:function(t){return new yt(t)},ObjectId:function(t){return new yt(t)},BSONRegExp:function(t){return new cs(t.pattern,t.options)},Symbol:function(t){return new gp(t.value)},Timestamp:function(t){return $g.fromBits(t.low,t.high)}};function HS(t,e){if(t==null||typeof t!="object")throw new so("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var o in t){e.seenObjects.push({propertyName:o,obj:null});try{var i=Pn(t[o],e);o==="__proto__"?Object.defineProperty(n,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):n[o]=i}finally{e.seenObjects.pop()}}return n}else if(BS(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=FS[t._bsontype];if(!a)throw new Xe("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Rc(s.code,Pn(s.scope,e)):r==="DBRef"&&s.oid&&(s=new as(Pn(s.collection,e),Pn(s.oid,e),Pn(s.db,e),Pn(s.fields,e))),s.toExtendedJSON(e)}else throw new so("_bsontype must be a string, but was: "+typeof r)}var Ng;(function(t){function e(i,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(i,function(l,f){if(l.indexOf("\0")!==-1)throw new so("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(l)));return zg(f,a)})}t.parse=e;function r(i,s,a,l){a!=null&&typeof a=="object"&&(l=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(l=s,s=void 0,a=0);var f=Object.assign({relaxed:!0,legacy:!1},l,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=Pn(i,f);return JSON.stringify(d,s,a)}t.stringify=r;function n(i,s){return s=s||{},JSON.parse(r(i,s))}t.serialize=n;function o(i,s){return s=s||{},e(JSON.stringify(i),s)}t.deserialize=o})(Ng||(Ng={}));var Pg,Lg=Bg();Lg.Map?Pg=Lg.Map:Pg=(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],o=n[0],i=n[1];this._keys.push(o),this._values[o]={v:i,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 o=this._keys[n];e.call(r,this._values[o].v,o,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 kU=oe.fromNumber(vS),FU=oe.fromNumber(_S);var lp=new Uint8Array(8),HU=new DataView(lp.buffer,lp.byteOffset,lp.byteLength);var $S=1024*1024*17,$U=Ie.alloc($S);var Ln=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 xe=class{constructor(e,r={},n,o){this.name=e;this.properties=r;this.id=o?new yt(o):new yt,this.occurred=new Date,n&&(this.trigger=new Ln(n)),this.newEvent=!o}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(e){e&&(this.videos=[e.id])}};var qg=0;function Yg(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}function yp(t=document.head){return Kg(gr.styleURL,t,"cooee-global-styles")}function VS(t=document.head){return Kg(gr.swiperStyleURL,t,"cooee-swiper-styles")}function Kg(t,e=document.head,r){return new Promise(n=>{if(e.querySelector(`#${r}`)){n();return}let i=document.createElement("link");i.rel="stylesheet",i.href=t,i.id=r,i.onload=()=>{n()},i.onerror=()=>{console.error("Failed to load stylesheet:",t),n()},e.appendChild(i)})}function vp(t,e=document.head){if(!t)return;qg++;let r=document.createElement("style");r.id=`cooee-app-css-${qg}`,r.textContent=t,e.appendChild(r)}function Xg(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}function _p(t){if(t)try{(0,eval)(t)}catch(e){console.error("Failed to execute script:",e)}}async function Oc(){let t=(await import("./swiper-bundle-WHJS64TU.js")).default;return window.CooeeSDK.Swiper=t}async function Ep(t,e=!0){if(!t)return;let r=[];e&&r.push(VS(t)),r.push(yp(t)),await Promise.all(r);let n=Ye.get().website.commonCSS;vp(n,t)}var Nc=class{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(e){this.onResizeCallback=e,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener("resize",this.debouncedResize),window.addEventListener("orientationchange",this.handleImmediateResize)}destroy(){window.removeEventListener("resize",this.debouncedResize),window.removeEventListener("orientationchange",this.handleImmediateResize)}handleImmediateResize=()=>{this.triggerResize()};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize()},this.debounceDelay)};triggerResize(){let e=window.innerWidth,r=window.innerHeight;(r!==this.lastHeight||e!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=e,this.lastHeight=r)}};var WS="2.0.4",Np=500,Jg="user-agent",ci="",Qg="?",kc="function",Un="undefined",li="object",Pp="string",Ht="browser",un="cpu",Wr="device",Sr="engine",cr="os",si="result",$="name",P="type",F="vendor",j="version",$t="architecture",_s="major",M="model",ys="console",le="mobile",Be="tablet",it="smarttv",$r="wearable",Pc="xr",vs="embedded",us="inapp",Bp="brands",lo="formFactors",Up="fullVersionList",ai="platform",kp="platformVersion",$c="bitness",kn="sec-ch-ua",jS=kn+"-full-version-list",GS=kn+"-arch",zS=kn+"-"+$c,qS=kn+"-form-factors",YS=kn+"-"+le,KS=kn+"-"+M,py=kn+"-"+ai,XS=py+"-version",my=[Bp,Up,le,M,ai,kp,$t,lo,$c],Lc="Amazon",oi="Apple",Zg="ASUS",ey="BlackBerry",co="Google",ty="Huawei",wp="Lenovo",ry="Honor",Mc="LG",bp="Microsoft",Sp="Motorola",Tp="Nvidia",ny="OnePlus",Ip="OPPO",fs="Samsung",oy="Sharp",ps="Sony",xp="Xiaomi",Cp="Zebra",iy="Chrome",sy="Chromium",Mn="Chromecast",Uc="Edge",ms="Firefox",ds="Opera",Rp="Facebook",ay="Sogou",ii="Mobile ",hs=" Browser",Lp="Windows",JS=typeof window!==Un,Vt=JS&&window.navigator?window.navigator:void 0,Bn=Vt&&Vt.userAgentData?Vt.userAgentData:void 0,QS=function(t,e){var r={},n=e;if(!Fc(e)){n={};for(var o in e)for(var i in e[o])n[i]=e[o][i].concat(n[i]?n[i]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},Vc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Mp=function(t,e){if(typeof t===li&&t.length>0){for(var r in t)if(fn(e)==fn(t[r]))return!0;return!1}return fi(t)?fn(e)==fn(t):!1},Fc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Fc(t[r]):!1)},fi=function(t){return typeof t===Pp},Ap=function(t){if(t){for(var e=[],r=ui(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var o=Hc(r[n]).split(";v=");e[n]={brand:o[0],version:o[1]}}else e[n]=Hc(r[n]);return e}},fn=function(t){return fi(t)?t.toLowerCase():t},Dp=function(t){return fi(t)?ui(/[^\d\.]/g,t).split(".")[0]:void 0},pn=function(t){for(var e in t){var r=t[e];typeof r==li&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},ui=function(t,e){return fi(e)?e.replace(t,ci):e},gs=function(t){return ui(/\\?\"/g,t)},Hc=function(t,e){if(fi(t))return t=ui(/^\s\s*/,t),typeof e===Un?t:t.substring(0,Np)},Op=function(t,e){if(!(!t||!e))for(var r=0,n,o,i,s,a,l;r<e.length&&!a;){var f=e[r],d=e[r+1];for(n=o=0;n<f.length&&!a&&f[n];)if(a=f[n++].exec(t),a)for(i=0;i<d.length;i++)l=a[++o],s=d[i],typeof s===li&&s.length>0?s.length===2?typeof s[1]==kc?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===kc&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=l?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:s.length==3?this[s[0]]=l?l.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=l?s[3].apply(this,[l.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=l||void 0;r+=2}},Vr=function(t,e){for(var r in e)if(typeof e[r]===li&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Mp(e[r][n],t))return r===Qg?void 0:r}else if(Mp(e[r],t))return r===Qg?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},cy={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},ly={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},ZS={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},uy={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[j,[$,ii+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[j,[$,Uc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[j,[$,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[$,j],[/opios[\/ ]+([\w\.]+)/i],[j,[$,ds+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[j,[$,ds+" GX"]],[/\bopr\/([\w\.]+)/i],[j,[$,ds]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[j,[$,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[j,[$,"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|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[$,j],[/quark(?:pc)?\/([-\w\.]+)/i],[j,[$,"Quark"]],[/\bddg\/([\w\.]+)/i],[j,[$,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[j,[$,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[j,[$,"WeChat"]],[/konqueror\/([\w\.]+)/i],[j,[$,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[j,[$,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[j,[$,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[j,[$,"Smart "+wp+hs]],[/(avast|avg)\/([\w\.]+)/i],[[$,/(.+)/,"$1 Secure"+hs],j],[/\bfocus\/([\w\.]+)/i],[j,[$,ms+" Focus"]],[/\bopt\/([\w\.]+)/i],[j,[$,ds+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[j,[$,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[j,[$,"Dolphin"]],[/coast\/([\w\.]+)/i],[j,[$,ds+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[j,[$,"MIUI"+hs]],[/fxios\/([\w\.-]+)/i],[j,[$,ii+ms]],[/\bqihoobrowser\/?([\w\.]*)/i],[j,[$,"360"]],[/\b(qq)\/([\w\.]+)/i],[[$,/(.+)/,"$1Browser"],j],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[$,/(.+)/,"$1"+hs],j],[/samsungbrowser\/([\w\.]+)/i],[j,[$,fs+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[j,[$,ay+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[$,ay+" Mobile"],j],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[$,j],[/(lbbrowser|rekonq)/i],[$],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[j,$],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[$,Rp],j,[P,us]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[$,j,[P,us]],[/\bgsa\/([\w\.]+) .*safari\//i],[j,[$,"GSA"],[P,us]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[j,[$,"TikTok"],[P,us]],[/\[(linkedin)app\]/i],[$,[P,us]],[/(chromium)[\/ ]([-\w\.]+)/i],[$,j],[/headlesschrome(?:\/([\w\.]+)| )/i],[j,[$,iy+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[j,[$,Uc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[$,iy+" WebView"],j],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[j,[$,"Android"+hs]],[/chrome\/([\w\.]+) mobile/i],[j,[$,ii+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[$,j],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[j,[$,ii+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[$,ii+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[j,$],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[$,[j,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[$,j],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[$,ii+ms],j],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[$,"Netscape"],j],[/(wolvic|librewolf)\/([\w\.]+)/i],[$,j],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[j,[$,ms+" 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,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[$,[j,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[$,[j,/[^\d\.]+./,ci]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[$t,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[$t,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[$t,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[$t,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[$t,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[$t,/ower/,ci,fn]],[/ sun4\w[;\)]/i],[[$t,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[$t,fn]]],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],[M,[F,fs],[P,Be]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[M,[F,fs],[P,le]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[M,[F,oi],[P,le]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[M,[F,oi],[P,Be]],[/(macintosh);/i],[M,[F,oi]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[M,[F,oy],[P,le]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[M,[F,ry],[P,Be]],[/honor([-\w ]+)[;\)]/i],[M,[F,ry],[P,le]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[M,[F,ty],[P,Be]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[M,[F,ty],[P,le]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[M,/_/g," "],[F,xp],[P,Be]],[/\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,/ ([\w ]+) miui\/v?\d/i],[[M,/_/g," "],[F,xp],[P,le]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[M,[F,ny],[P,le]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[M,[F,Ip],[P,le]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[M,[F,Vr,{OnePlus:["203","304","403","404","413","415"],"*":Ip}],[P,Be]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[M,[F,"BLU"],[P,le]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[M,[F,"Vivo"],[P,le]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[M,[F,"Realme"],[P,le]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[M,[F,wp],[P,Be]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[M,[F,wp],[P,le]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[M,[F,Sp],[P,le]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[M,[F,Sp],[P,Be]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[M,[F,Mc],[P,Be]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[M,[F,Mc],[P,le]],[/(nokia) (t[12][01])/i],[F,M,[P,Be]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[M,/_/g," "],[P,le],[F,"Nokia"]],[/(pixel (c|tablet))\b/i],[M,[F,co],[P,Be]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[M,[F,co],[P,le]],[/(google) (pixelbook( go)?)/i],[F,M],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[M,[F,ps],[P,le]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[M,"Xperia Tablet"],[F,ps],[P,Be]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[M,[F,Lc],[P,Be]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[M,/(.+)/g,"Fire Phone $1"],[F,Lc],[P,le]],[/(playbook);[-\w\),; ]+(rim)/i],[M,F,[P,Be]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[M,[F,ey],[P,le]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[M,[F,Zg],[P,Be]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[M,[F,Zg],[P,le]],[/(nexus 9)/i],[M,[F,"HTC"],[P,Be]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[F,[M,/_/g," "],[P,le]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[M,[F,"TCL"],[P,Be]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[M,[F,"TCL"],[P,le]],[/(itel) ((\w+))/i],[[F,fn],M,[P,Vr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[M,[F,"Acer"],[P,Be]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[M,[F,"Meizu"],[P,le]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[M,[F,"Ulefone"],[P,le]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[M,[F,"Energizer"],[P,le]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[M,[F,"Cat"],[P,le]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[M,[F,"Smartfren"],[P,le]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[M,[F,"Nothing"],[P,le]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[M,[F,"Archos"],[P,Be]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[M,[F,"Archos"],[P,le]],[/; (n159v)/i],[M,[F,"HMD"],[P,le]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[F,M,[P,Be]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[F,M,[P,le]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[F,M,[P,Be]],[/(surface duo)/i],[M,[F,bp],[P,Be]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[M,[F,"Fairphone"],[P,le]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[M,[F,Tp],[P,Be]],[/(sprint) (\w+)/i],[F,M,[P,le]],[/(kin\.[onetw]{3})/i],[[M,/\./g," "],[F,bp],[P,le]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[M,[F,Cp],[P,Be]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[M,[F,Cp],[P,le]],[/smart-tv.+(samsung)/i],[F,[P,it]],[/hbbtv.+maple;(\d+)/i],[[M,/^/,"SmartTV"],[F,fs],[P,it]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[F,M,[P,it]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[F,Mc],[P,it]],[/(apple) ?tv/i],[F,[M,oi+" TV"],[P,it]],[/crkey.*devicetype\/chromecast/i],[[M,Mn+" Third Generation"],[F,co],[P,it]],[/crkey.*devicetype\/([^/]*)/i],[[M,/^/,"Chromecast "],[F,co],[P,it]],[/fuchsia.*crkey/i],[[M,Mn+" Nest Hub"],[F,co],[P,it]],[/crkey/i],[[M,Mn],[F,co],[P,it]],[/(portaltv)/i],[M,[F,Rp],[P,it]],[/droid.+aft(\w+)( bui|\))/i],[M,[F,Lc],[P,it]],[/(shield \w+ tv)/i],[M,[F,Tp],[P,it]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[M,[F,oy],[P,it]],[/(bravia[\w ]+)( bui|\))/i],[M,[F,ps],[P,it]],[/(mi(tv|box)-?\w+) bui/i],[M,[F,xp],[P,it]],[/Hbbtv.*(technisat) (.*);/i],[F,M,[P,it]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[F,/.+\/(\w+)/,"$1",Vr,{LG:"lge"}],[M,Hc],[P,it]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[M,[P,it]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[P,it]],[/(playstation \w+)/i],[M,[F,ps],[P,ys]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[M,[F,bp],[P,ys]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[F,M,[P,ys]],[/droid.+; (shield)( bui|\))/i],[M,[F,Tp],[P,ys]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[M,[F,fs],[P,$r]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[F,M,[P,$r]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[M,[F,Ip],[P,$r]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[M,[F,oi],[P,$r]],[/(opwwe\d{3})/i],[M,[F,ny],[P,$r]],[/(moto 360)/i],[M,[F,Sp],[P,$r]],[/(smartwatch 3)/i],[M,[F,ps],[P,$r]],[/(g watch r)/i],[M,[F,Mc],[P,$r]],[/droid.+; (wt63?0{2,3})\)/i],[M,[F,Cp],[P,$r]],[/droid.+; (glass) \d/i],[M,[F,co],[P,Pc]],[/(pico) (4|neo3(?: link|pro)?)/i],[F,M,[P,Pc]],[/(quest( \d| pro)?s?).+vr/i],[M,[F,Rp],[P,Pc]],[/mobile vr; rv.+firefox/i],[[P,Pc]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[F,[P,vs]],[/(aeobc)\b/i],[M,[F,Lc],[P,vs]],[/(homepod).+mac os/i],[M,[F,oi],[P,vs]],[/windows iot/i],[[P,vs]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[M,[P,Vr,{mobile:"Mobile",xr:"VR","*":Be}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[P,Be]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[P,le]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[M,[F,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[j,[$,Uc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[$,j],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[j,[$,"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],[$,j],[/ladybird\//i],[[$,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[j,$]],os:[[/(windows nt) (6\.[23]); arm/i],[[$,/N/,"R"],[j,Vr,cy]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[$,j],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[j,/(;|\))/g,"",Vr,cy],[$,Lp]],[/(windows ce)\/?([\d\.]*)/i],[$,j],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[j,/_/g,"."],[$,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[$,"macOS"],[j,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[j,[$,Mn+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[j,[$,Mn+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[j,[$,Mn+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[j,[$,Mn+" Linux"]],[/crkey\/([\d\.]+)/i],[j,[$,Mn]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[j,$],[/(ubuntu) ([\w\.]+) like android/i],[[$,/(.+)/,"$1 Touch"],j],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[$,j],[/\(bb(10);/i],[j,[$,ey]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[j,[$,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[j,[$,ms+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[j,[$,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[j,Vr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[$,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[j,[$,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[$,"Chrome OS"],j],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[$,j],[/(sunos) ?([\d\.]*)/i],[[$,"Solaris"],j],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[$,j]]},Bc=(function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return pn.call(t.init,[[Ht,[$,j,_s,P]],[un,[$t]],[Wr,[P,M,F]],[Sr,[$,j]],[cr,[$,j]]]),pn.call(t.isIgnore,[[Ht,[j,_s]],[Sr,[j]],[cr,[j]]]),pn.call(t.isIgnoreRgx,[[Ht,/ ?browser$/i],[cr,/ ?os$/i]]),pn.call(t.toString,[[Ht,[$,j]],[un,[$t]],[Wr,[F,M]],[Sr,[$,j]],[cr,[$,j]]]),t})(),e0=function(t,e){var r=Bc.init[e],n=Bc.isIgnore[e]||0,o=Bc.isIgnoreRgx[e]||0,i=Bc.toString[e]||0;function s(){pn.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return Bn?Bn.getHighEntropyValues(my).then(function(a){return t.setCH(new dy(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=si&&(s.prototype.is=function(a){var l=!1;for(var f in this)if(this.hasOwnProperty(f)&&!Mp(n,f)&&fn(o?ui(o,this[f]):this[f])==fn(o?ui(o,a):a)){if(l=!0,a!=Un)break}else if(a==Un&&l){l=!l;break}return l},s.prototype.toString=function(){var a=ci;for(var l in i)typeof this[i[l]]!==Un&&(a+=(a?" ":ci)+this[i[l]]);return a||Un}),Bn||(s.prototype.then=function(a){var l=this,f=function(){for(var m in l)l.hasOwnProperty(m)&&(this[m]=l[m])};f.prototype={is:s.prototype.is,toString:s.prototype.toString};var d=new f;return a(d),d}),new s};function dy(t,e){if(t=t||{},pn.call(this,my),e)pn.call(this,[[Bp,Ap(t[kn])],[Up,Ap(t[jS])],[le,/\?1/.test(t[YS])],[M,gs(t[KS])],[ai,gs(t[py])],[kp,gs(t[XS])],[$t,gs(t[GS])],[lo,Ap(t[qS])],[$c,gs(t[zS])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==Un&&(this[r]=t[r])}function fy(t,e,r,n){return this.get=function(o){return o?this.data.hasOwnProperty(o)?this.data[o]:void 0:this.data},this.set=function(o,i){return this.data[o]=i,this},this.setCH=function(o){return this.uaCH=o,this},this.detectFeature=function(){if(Vt&&Vt.userAgent==this.ua)switch(this.itemType){case Ht:Vt.brave&&typeof Vt.brave.isBrave==kc&&this.set($,"Brave");break;case Wr:!this.get(P)&&Bn&&Bn[le]&&this.set(P,le),this.get(M)=="Macintosh"&&Vt&&typeof Vt.standalone!==Un&&Vt.maxTouchPoints&&Vt.maxTouchPoints>2&&this.set(M,"iPad").set(P,Be);break;case cr:!this.get($)&&Bn&&Bn[ai]&&this.set($,Bn[ai]);break;case si:var o=this.data,i=function(s){return o[s].getItem().detectFeature().get()};this.set(Ht,i(Ht)).set(un,i(un)).set(Wr,i(Wr)).set(Sr,i(Sr)).set(cr,i(cr))}return this},this.parseUA=function(){return this.itemType!=si&&Op.call(this.data,this.ua,this.rgxMap),this.itemType==Ht&&this.set(_s,Dp(this.get(j))),this},this.parseCH=function(){var o=this.uaCH,i=this.rgxMap;switch(this.itemType){case Ht:case Sr:var s=o[Up]||o[Bp],a;if(s)for(var l in s){var f=s[l].brand||s[l],d=s[l].version;this.itemType==Ht&&!/not.a.brand/i.test(f)&&(!a||/Chrom/.test(a)&&f!=sy||a==Uc&&/WebView2/.test(f))&&(f=Vr(f,ZS),a=this.get($),a&&!/Chrom/.test(a)&&/Chrom/.test(f)||this.set($,f).set(j,d).set(_s,Dp(d)),a=f),this.itemType==Sr&&f==sy&&this.set(j,d)}break;case un:var m=o[$t];m&&(m&&o[$c]=="64"&&(m+="64"),Op.call(this.data,m+";",i));break;case Wr:if(o[le]&&this.set(P,le),o[M]&&(this.set(M,o[M]),!this.get(P)||!this.get(F))){var E={};Op.call(E,"droid 9; "+o[M]+")",i),!this.get(P)&&E.type&&this.set(P,E.type),!this.get(F)&&E.vendor&&this.set(F,E.vendor)}if(o[lo]){var y;if(typeof o[lo]!="string")for(var C=0;!y&&C<o[lo].length;)y=Vr(o[lo][C++],ly);else y=Vr(o[lo],ly);this.set(P,y)}break;case cr:var D=o[ai];if(D){var N=o[kp];D==Lp&&(N=parseInt(Dp(N),10)>=13?"11":"10"),this.set($,D).set(j,N)}this.get($)==Lp&&o[M]=="Xbox"&&this.set($,"Xbox").set(j,void 0);break;case si:var k=this.data,X=function(B){return k[B].getItem().setCH(o).parseCH().get()};this.set(Ht,X(Ht)).set(un,X(un)).set(Wr,X(Wr)).set(Sr,X(Sr)).set(cr,X(cr))}return this},pn.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",e0(this,t)]]),this}function Tr(t,e,r){if(typeof t===li?(Fc(t,!0)?(typeof e===li&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Pp&&!Fc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===kc){var n={};r.forEach(function(l,f){n[f]=l}),r=n}if(!(this instanceof Tr))return new Tr(t,e,r).getResult();var o=typeof t===Pp?t:r&&r[Jg]?r[Jg]:Vt&&Vt.userAgent?Vt.userAgent:ci,i=new dy(r,!0),s=e?QS(uy,e):uy,a=function(l){return l==si?function(){return new fy(l,o,s,i).set("ua",o).set(Ht,this.getBrowser()).set(un,this.getCPU()).set(Wr,this.getDevice()).set(Sr,this.getEngine()).set(cr,this.getOS()).get()}:function(){return new fy(l,o,s[l],i).parseUA().get()}};return pn.call(this,[["getBrowser",a(Ht)],["getCPU",a(un)],["getDevice",a(Wr)],["getEngine",a(Sr)],["getOS",a(cr)],["getResult",a(si)],["getUA",function(){return o}],["setUA",function(l){return fi(l)&&(o=l.length>Np?Hc(l,Np):l),this}]]).setUA(o),this}Tr.VERSION=WS;Tr.BROWSER=Vc([$,j,_s,P]);Tr.CPU=Vc([$t]);Tr.DEVICE=Vc([M,F,P,ys,le,it,Be,$r,vs]);Tr.ENGINE=Tr.OS=Vc([$,j]);function Wc(){let t=fe();return Z(_({},t.customContext),{page:Ys(),locale:t.locale,currentItem:t.currentItem,previewIDs:t.previewIDs,previewVariant:t.previewVariant,engagementIDs:t0(),cart:Zf()})}function t0(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}function he(t){return typeof t=="function"}function pi(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 jc=pi(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
27
27
  ${r.map((n,o)=>`${o+1}) ${n.toString()}`).join(`
@@ -50,11 +50,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
50
50
  }
51
51
  }
52
52
  }
53
- `,Hn=class{async addToCart(e,r){if(!e.length)return;let o={items:e.map(s=>{let{vID:a,vName:l,quantity:f}=this.getVariantDetails(s),d=r.getPrivateAttributesForLineItem();if(jt.hasKeys(window.CooeeSDK.customItemProperties)){let m={name:l},E=sv.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:m});d=_(_({},JSON.parse(E)),d)}return{id:a?+a:+s.mID,quantity:f,properties:d}})},i=Qe.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{o.sections_url=window.location.pathname,o.sections=window.cooeeGetCartSections()}catch(s){ae(s,"execute-cooeeGetCartSections",{engagementTrigger:r})}else i.isMiniCart()?o.sections=["mini-cart"]:i.isShopifyDefaultDrawer()&&(o.sections=i.element.getSectionsToRender?.().map((s=>s.section??s.id)));try{let s=await vi("/cart/add.js",o);return w.log(`Added ${e.length} items to Cart`),br("Product added to your cart"),s.data}catch(s){ae(s,"cart-item-add",{engagementTrigger:r});let a=["Failed to add product in cart."];if(s instanceof vr&&s.is40x()&&s.responseText){let l=s.responseText;l.description&&a.push(`Reason: ${l.description}`)}a.push("Please try again later."),br(a.join(" "))}}async updateLineItem(e,r){if(!jt.hasKeys(r)){w.warn("No update fields provided");return}let n=_({id:e.key},r);try{let o=await vi("/cart/change.js",n);w.log(`Updated ${e}`),de.getCurrent().update(o.data)}catch(o){ae(o,"cart-item-update"),br("Failed to update item in cart")}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),w.log(`Code-${e} copied`),br("Discount code copied")}catch(r){w.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=gg(e.link);if(r)return Wo("/products/"+r)}async upgradeToSubscription(e,r){if(!e){w.warn("Trying to upgrade to subscription with no item");return}let n=await de.getCurrent().getNormalisedCart(),o=e.selectedOrFirstVariant.value,i=n.items.findIndex(l=>l.vID===o.mID),s=o.selectedSellingPlan.value,a={line:i+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let l=await vi("/cart/change.js",a);return w.log(`Upgraded ${e} selling plan`),br("Line item updated"),de.getCurrent().update(l.data),l.data}catch(l){ae(l,"cart-switch-subscription",{engagementTrigger:r}),br("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){w.error("No variant ID found to perform Buy now",e);return}let o=r?[r]:[],i=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await ja("Buy Now");return(await dl(Q0,{input:{lines:i,discountCodes:o,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,o=e.triggerData,i;if(r.at){let s=r;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===we.GO_TO_PRODUCT)i=this.getProductURL(n[0]);else if(s.at===we.ADD_TO_CART)n?.length&&await this.addToCart(n,o);else if(s.at===we.COPY_COUPON_CODE)await this.copyDiscountCode(o.discount?.code);else if(s.at===we.OPEN_CART)Qe.get().open();else if(s.at===we.GO_TO_COLLECTION){let a=e.collections;if(!a?.length)return;i=Wo("/collections/"+a[0].handle)}}r.applyDiscount&&o.discount?.code?Gr.navigate(o.discount.code,o.redirectBehaviour,i):i&&(location.pathname=i)}getVariantDetails(e){let r,n,o;if(e instanceof Ot)r=e.vID,n=e.vName,o=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=e.selectedOrFirstVariant.value.name,o=1}return{vID:r,quantity:o,vName:n}}};var yl=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),w.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var vl=class{action;triggerContext;constructor(e,r){this.action=e,this.triggerContext=r}async execute(){let e=this.containsCTA()?"CE Trigger Clicked":"CE Trigger Closed";switch(this.action.at!==we.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case we.ACCEPT_POPUP:break;case we.GO_TO_URL:this.gotoURLAction();break;case we.SHARE:this.shareAction();break;case we.SUBMIT_FORM:await this.collectFormData();break;case void 0:case we.OPEN_CART:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Uo(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){w.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!==we.REJECT_POPUP?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let o=document.getElementById(r.id).value;r.type===51?e.email=o:r.type===52&&(e.mobile=o)}await this.closeTriggerAndSendEvent("CE Form Submitted",{form:e}),this.action.applyDiscount&&br("Coupon applied on cart"),yl.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Hn().process(r);let n={action:this.containsCTA()?"CLICKED":"CLOSED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}};var fr=class{renderer=$n.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new _i(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});yo(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&re(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&re(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)};yo(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);re(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?re(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):re(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new jn(this.inappElement.trf);e&&e.rotate&&re(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 vl(e,this.triggerContext).execute()}),re(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var zr=class extends fr{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="cooee"+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),yo(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"),re(e,"font-weight",r.b?"bold":"normal"),re(e,"font-style",r.i?"italic":"normal"),re(e,"text-decoration",n.join(" ")),re(e,"color",r.c??"inherit"),re(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Io[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),re(this.inappHTMLEl,"text-align",r)}};var Ds=class extends zr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Os=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var vo=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),re(this.inappHTMLEl,"max-width","none"),re(this.inappHTMLEl,"max-height","none"),re(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Ns=class t extends fr{constructor(r,n,o){super(r,n,o);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add("cooee-wrapper"),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),re(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()?(re(this.inappHTMLEl,"width","100%"),re(this.inappHTMLEl,"height","100%")):(re(this.inappHTMLEl,"width","100vw"),re(this.inappHTMLEl,"height","100vh")),re(this.inappHTMLEl,"top","0"),re(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,o=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),i=this.stylesConverter.getScaledSize(r.h)+n.getVertical();re(this.inappHTMLEl,"width",o+"px"),re(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?re(this.inappHTMLEl,"position","absolute"):re(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var Z0="cooee-container",_l=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),re(this.inappHTMLEl,"position","relative"),re(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(Z0),this}};var El=class t extends zr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(_(_(_({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=>yo(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=document.createElement("div"),n=document.createElement("span"),o=document.createElement("span");return o.innerText=e,n.innerText="00",n.id=`lc-${e}`,re(o,"font-size","0.5em"),re(o,"text-align","center"),re(o,"font-family","inherit"),re(n,"text-align","center"),re(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(o),r.appendChild(n)):(r.appendChild(n),r.appendChild(o)),re(r,"display","flex"),re(r,"flex-direction",this.inappElement.horizontal?"":"column"),re(r,"justify-content","center"),re(r,"align-items","center"),re(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 wl=class extends zr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){re(this.inappHTMLEl,"background","#ffffff00"),re(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 Ur(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 o=e.imgs[0]??r.imgs?.at(0);o?.url&&n.setAttribute("src",o.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(o=>{r.add(this.createOption(o.name??"Default",o,o.mID===n?.vID))})}createOption(e,r,n){let o=document.createElement("option");return o.text=e,o.value=JSON.stringify(r),n&&(o.selected=!0),r||(o.disabled=!0),o}};var Ei=class extends zr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),re(this.inappHTMLEl,"background","#ffffff00"),re(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 bl=class t extends Ei{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.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Sl=class t extends Ei{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Tl=class extends vo{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var $n=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new St(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,o=e.cont.h,i=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=i.getHorizontal(),a-=i.getVertical(),s/a<n/o?this.scalingFactor=s/n:this.scalingFactor=a/o,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&re(this.parent,"position","relative")}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Cr(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(jr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Qe.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,t._instance=this;try{this.startRendering()}catch(e){ae(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),jr()||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 Ln(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(fe().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=Im.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Ns(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(o=>o.mID));let r=new xe("CE Trigger Displayed",e,this.triggerContext.triggerData);Ut(r);let n={action:"DISPLAYED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new xe(r,e,this.triggerContext.triggerData);n.name==="CE Trigger Clicked"&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(o=>o.toEmbed())),Ut(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof qo?new bl(e,r,n).render():r instanceof Yo?new Sl(e,r,n).render():r instanceof An?new Ds(e,r,n).render():r instanceof Ko?new Tl(e,r,n).render():r instanceof ln?new vo(e,r,n).render():r instanceof to?new Os(e,r,n).render():r instanceof Go?new El(e,r,n).render():r instanceof zo?new wl(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new _l(this.rootContainer,r,e).render().getHTMLElement(),new hl().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(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new xe("CE Campaign Rejected",r,e);Ut(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(o=>{let i=o.bg?.img?.src;if(i&&n.push(this.getPromise(i)),o.t===1){let s=o.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 wi=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=go[e]?.toLowerCase();r&&(w.verbose(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var Il=class{triggerData;render(e){e.contentSource===Ni.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){w.warn("Received invalid trigger callback");return}switch(r.type){case"open":Ut(new xe("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);Ut(new xe("CE Form Submitted",{form:n},this.triggerData)),bi(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),Ut(new xe("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(jt.hasKeys(n)){let o=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{o.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let i=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(i?.length||s?.length)&&(r.name=i+" "+s)}return r}};var xl=class{static trackIntent(e){if(!this.isInstalled()){w.verbose("Facebook pixel not installed");return}if(!Ye.get().pixelPush){w.verbose("Facebook pixel push not enabled");return}let n=go[e.intent]?.toLowerCase(),o=e.segmentName;!n&&!o||(w.verbose(`Sending ${n} intent and ${o} 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 rm=new Map,Cl=async t=>{for(let i of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(i,t)}catch(s){w.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let s=(await de.getCurrent().getNormalisedCart()).items.map(a=>a.mID);t.items=t.items.filter(a=>!s.includes(a.mID))}if(Ye.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await eT(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(i=>av(i,t)),o=(await Promise.all(r)).filter(i=>i!=null);if(e&&!o.length){let i="Failed to fetch any product from Ajax API",s=new xe("CE Campaign Failed",{reason:i,currency:t.currency},t);throw Ut(s),new Error(i)}if(t.isCartRecovery()){let i=de.getCurrent().items,s=[];for(let a of o)for(let l of a.vars){if(!l.isAvailable)continue;let f=i.find(E=>E.variant_id.toString()===l.mID);if(!f)continue;let d=new Ct(a);d.name=f.title;let m=new Ur(l);m.name=f.variant_title,m.price.d=f.discounted_price/100,d.variants=[m],s.push(d)}return s}return o},eT=async(t,e)=>{await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let o=await av(n,e);return o||n}))}))},av=async(t,e)=>{if(rm.has(t.mID))return rm.get(t.mID);let r,n=`/products/${t.slug}.js`;try{r=(await tn(n)).data}catch(o){return o instanceof vr&&o.response?.status===404||ae(o,"fetch-shopify-product",{extra:{item:t,path:n},engagementTrigger:e}),null}return r?tT(t,r):(w.error("Item not found after AJAX call for:",t),null)},tT=(t,e)=>{if(!t||!e)return t;t.name=e.title,t.tags=e.tags,t.slug=e.handle;let r=t.selectedOrFirstVariant.value;return t.vars.map(n=>{let o=e.variants.find(i=>i.id===+n.mID);o!=null&&(n.name=o.title,n.isAvailable=o.available,n.price.d=o.price?o.price/100:o.price,n.price.effective=n.price.d,n.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price,+r.mID===o.id&&(r.effectivePrice.value=n.price.d))}),rm.set(t.mID,t),t};var nm="/v1/event/track-page-unload";function It(t){w.verbose(`Waiting for auth to send event ${t.name}`),xr(pr).then(()=>Ut(t))}function Qy(t){xr(pr).then(()=>{rT(t).catch(e=>ae(e,"track-page-unload"))})}async function rT(t){let e=fe().currentPageViewEvent;if(!e){w.warn("No page view event was stored previously");return}let r={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:t};w.verbose("Sending page unload",r);try{await Jt(nm,r)}catch(n){throw w.error(`Error sending page unload for ${e} to server`,n),n}}function Ut(t){nT(t).catch(e=>ae(e,"track-event",{extra:{event:t}}))}async function nT(t){if(w.verbose(`Sending event: ${t.name}`,t),lT(t)){w.warn(`Rejecting event ${t.name}`);return}Ky();let e=await dn();Object.assign(t,e),Jy();let r=cT(t.name),n=r.toLowerCase().replace(/\s+/g,"-");try{let o=await Jt(`/v1/event/track/${n}`,t);w.info("\u2705 Event tracked:",r),oT(t)&&(fe().currentPageViewEvent={id:t.id,name:t.name}),iT(t,o.data)}catch(o){throw w.error(`Error sending event ${t.name} to server`,o),o}}function oT(t){return Cm.includes(t.name)?t.name==="View Cart"?!t.properties.drawer:!0:!1}function iT(t,e){sT(t,e).catch(r=>{ae(r,"process-popup-response",{extra:{event:t,response:e}})}),aT(e)}async function sT(t,e){if(!e.triggerData)return;let r=new St(e.triggerData);r.occurred=t.occurred,w.log(`${r} will be shown`);let n;try{n=await Cl(r)}catch(o){w.error("Failed to refresh the products",o);return}if(r.items=n,r.contentSource===Ni.KLAVIYO){new Il().render(r);return}new $n().renderEngagement(r).catch(o=>{ae(o,"render-popup",{extra:{event:t},engagementTrigger:r})})}function aT(t){t.intent&&(wi.trackIntent(t.intent),xl.trackIntent(t),w.info(`Intent is ${go[t.intent]}`))}function cT(t){return t.replace("CE ","").replace("Trigger","Campaign").replace("Screen","Page").replace("App ","")}function lT(t){return t.trigger?.triggerID==="test"||t.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}var cv=Xr(zs());var hn=class{constructor(e){this.triggerContext=e}async execute(e){let r=fe().currentItem,n=e.clickAction;if(!n)return;let o=e.item,i=this.triggerContext,s=new Hn,a=i.triggerData.redirectBehaviour,l=!!i.triggerData.discount?.type&&!!n?.applyDiscount,f={selectedVariants:i.triggerData.nonMutableItems.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID,variantID:N.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},d="",m=[],E=[];if(o?E=[o.toEmbed()]:e.embeddedItem&&(E=[e.embeddedItem]),n.at===we.ADD_BUNDLE){let N=i.selectedItems;if(E=e.embeddedItems??N.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let k;e.embeddedItems?k=e.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,variantID:B.vID,quantity:B.quantity})):k=N.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID,variantID:B.selectedOrFirstVariant.value.mID}));let X=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&X&&(k.push({itemMID:X.mID,mID:X.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(X.toEmbed())),f.selectedVariants=k,i.triggerData.isBundleOnPDP()&&f.selectedVariants.forEach(B=>{B.mID===r.vID&&(B.isPrimary=!0)})}else f=void 0;m=e.embeddedItems??N}else if(n.at===we.INITIATE_CHECKOUT){let N=await de.getCurrent().getNormalisedCart();E=N.items,f.selectedVariants=N.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(n.at===we.ADD_TO_CART)m=o?[o]:[e.embeddedItem];else if(n.at===we.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,o),this.sendTriggerClicked(E,{from:"button"},e.video);return}else if(n.at===we.GO_TO_PRODUCT)d=o?Wo("/products/"+o.slug):e.embeddedItem?.link;else if(n.at===we.GO_TO_URL){let N=Uo(n.gu?.u);N&&(d=N.href)}else if(n.at===we.UPGRADE_TO_SUBSCRIPTION){let N=await s.upgradeToSubscription(o,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Qe.get().refreshUI(N)}else if(n.at===we.GO_TO_COLLECTION){let N=this.triggerContext.triggerData.collections?.[0];N&&(d="collections/"+N.handle)}if(this.sendTriggerClicked(E,{from:"button"},e.video),w.verbose({redirectPath:d,redirectBehaviour:a,hasDiscount:l}),!l&&d){location.href=d;return}let y,C=!1;try{y=await this.getOrGenerateDiscountCode(f),w.verbose("Discount code (if any) to apply",y)}catch(N){if(!this.triggerContext.triggerData.isBYOB()){cv.default.error("Unable to get a discount code",N);return}}if(y&&n.at===we.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(n.at===we.BUY_NOW){let N=await s.createNewCart(r,y,i.triggerData);N&&(location.href=N);return}try{y&&await Gr.applyWithStorefront([y])}catch(N){w.error(N),C=!0}let D;if(m?.length&&(D=await s.addToCart(m,i.triggerData)),C&&y){Gr.navigate(y,a,d);return}if(d){location.href=d;return}Gr.navigateWithoutDiscount(a,D)}sendTriggerClicked(e,r,n){let o=new xe("CE Trigger Clicked",r,this.triggerContext.triggerData);o.items=e,o.setVideos(n),Ut(o)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===er.STATIC){if(!r.code)throw Ah("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await uT(e,this.triggerContext),!n)throw w.error("No discount code found",e),new Error("Discount code not found or generated");return n}}};async function uT(t,e){try{return(await lv(t)).data.code}catch(r){throw br("Failed to generate a discount code"),ae(r,"backend-generate-discount",{triggerContext:e}),r}}var Ue=class extends Mr{stylesConverter=new _i(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=jr()?"sm":"lg",this.clickExecutor=new hn(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(Z(_(_(_(_(_(_({},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()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return w.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,jr()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),r.clickAction||(r.clickAction=this.props.element.clc),r.clickAction?.at&&await this.clickExecutor.execute(r)}};var fT=0,Aj=Array.isArray;function Y(t,e,r,n,o,i){e||(e={});var s,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?s=e[a]:l[a]=e[a];var f={type:t,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fT,__i:-1,__u:0,__source:o,__self:i};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return Te.vnode&&Te.vnode(f),f}var Qt=class extends Ue{componentDidMount(){this.setState(()=>({text:this.props.element.text})),bt(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=""),Y("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:Y("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=eo(this.props.element,r,this.props.triggerContext),o=new gt(n);if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:o.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;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 _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var _o=class extends Qt{render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(_({},super.getComponentStyles()),{cursor:"pointer"})}};var om=class extends Mr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?Y("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[Y("span",{children:this.props.time}),Y("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):Y("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[Y("span",{style:this.getTimeLabelStyle(),children:this.props.label}),Y("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}},Ps=class extends Qt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return Y("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>Y(om,{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 _(_({},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(()=>_({},this.labels))})}};function Rl(t,e){if(!t)return;let r={loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(o,i)=>`
53
+ `,Hn=class{async addToCart(e,r){if(!e.length)return;let o={items:e.map(s=>{let{vID:a,vName:l,quantity:f}=this.getVariantDetails(s),d=r.getPrivateAttributesForLineItem();if(jt.hasKeys(window.CooeeSDK.customItemProperties)){let m={name:l},E={templateSuffix:s.templateSuffix},y=sv.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:m,product:E});d=_(_({},JSON.parse(y)),d)}return{id:a?+a:+s.mID,quantity:f,properties:d}})},i=Qe.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{o.sections_url=window.location.pathname,o.sections=window.cooeeGetCartSections()}catch(s){ae(s,"execute-cooeeGetCartSections",{engagementTrigger:r})}else i.isMiniCart()?o.sections=["mini-cart"]:i.isShopifyDefaultDrawer()&&(o.sections=i.element.getSectionsToRender?.().map((s=>s.section??s.id)));try{let s=await vi("/cart/add.js",o);return w.log(`Added ${e.length} items to Cart`),br("Product added to your cart"),s.data}catch(s){ae(s,"cart-item-add",{engagementTrigger:r});let a=["Failed to add product in cart."];if(s instanceof vr&&s.is40x()&&s.responseText){let l=s.responseText;l.description&&a.push(`Reason: ${l.description}`)}a.push("Please try again later."),br(a.join(" "))}}async updateLineItem(e,r){if(!jt.hasKeys(r)){w.warn("No update fields provided");return}let n=_({id:e.key},r);try{let o=await vi("/cart/change.js",n);w.log(`Updated ${e}`),de.getCurrent().update(o.data)}catch(o){ae(o,"cart-item-update"),br("Failed to update item in cart")}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),w.log(`Code-${e} copied`),br("Discount code copied")}catch(r){w.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=gg(e.link);if(r)return Wo("/products/"+r)}async upgradeToSubscription(e,r){if(!e){w.warn("Trying to upgrade to subscription with no item");return}let n=await de.getCurrent().getNormalisedCart(),o=e.selectedOrFirstVariant.value,i=n.items.findIndex(l=>l.vID===o.mID),s=o.selectedSellingPlan.value,a={line:i+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let l=await vi("/cart/change.js",a);return w.log(`Upgraded ${e} selling plan`),br("Line item updated"),de.getCurrent().update(l.data),l.data}catch(l){ae(l,"cart-switch-subscription",{engagementTrigger:r}),br("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){w.error("No variant ID found to perform Buy now",e);return}let o=r?[r]:[],i=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await ja("Buy Now");return(await dl(Q0,{input:{lines:i,discountCodes:o,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,o=e.triggerData,i;if(r.at){let s=r;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===we.GO_TO_PRODUCT)i=this.getProductURL(n[0]);else if(s.at===we.ADD_TO_CART)n?.length&&await this.addToCart(n,o);else if(s.at===we.COPY_COUPON_CODE)await this.copyDiscountCode(o.discount?.code);else if(s.at===we.OPEN_CART)Qe.get().open();else if(s.at===we.GO_TO_COLLECTION){let a=e.collections;if(!a?.length)return;i=Wo("/collections/"+a[0].handle)}}r.applyDiscount&&o.discount?.code?Gr.navigate(o.discount.code,o.redirectBehaviour,i):i&&(location.pathname=i)}getVariantDetails(e){let r,n,o;if(e instanceof Ot)r=e.vID,n=e.vName,o=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=e.selectedOrFirstVariant.value.name,o=1}return{vID:r,quantity:o,vName:n}}};var yl=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),w.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var vl=class{action;triggerContext;constructor(e,r){this.action=e,this.triggerContext=r}async execute(){let e=this.containsCTA()?"CE Trigger Clicked":"CE Trigger Closed";switch(this.action.at!==we.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case we.ACCEPT_POPUP:break;case we.GO_TO_URL:this.gotoURLAction();break;case we.SHARE:this.shareAction();break;case we.SUBMIT_FORM:await this.collectFormData();break;case void 0:case we.OPEN_CART:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Uo(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){w.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!==we.REJECT_POPUP?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let o=document.getElementById(r.id).value;r.type===51?e.email=o:r.type===52&&(e.mobile=o)}await this.closeTriggerAndSendEvent("CE Form Submitted",{form:e}),this.action.applyDiscount&&br("Coupon applied on cart"),yl.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Hn().process(r);let n={action:this.containsCTA()?"CLICKED":"CLOSED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}};var fr=class{renderer=$n.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new _i(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});yo(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&re(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&re(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)};yo(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);re(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?re(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):re(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new jn(this.inappElement.trf);e&&e.rotate&&re(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 vl(e,this.triggerContext).execute()}),re(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var zr=class extends fr{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="cooee"+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),yo(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"),re(e,"font-weight",r.b?"bold":"normal"),re(e,"font-style",r.i?"italic":"normal"),re(e,"text-decoration",n.join(" ")),re(e,"color",r.c??"inherit"),re(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Io[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),re(this.inappHTMLEl,"text-align",r)}};var Ds=class extends zr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Os=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var vo=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),re(this.inappHTMLEl,"max-width","none"),re(this.inappHTMLEl,"max-height","none"),re(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Ns=class t extends fr{constructor(r,n,o){super(r,n,o);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add("cooee-wrapper"),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),re(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()?(re(this.inappHTMLEl,"width","100%"),re(this.inappHTMLEl,"height","100%")):(re(this.inappHTMLEl,"width","100vw"),re(this.inappHTMLEl,"height","100vh")),re(this.inappHTMLEl,"top","0"),re(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,o=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),i=this.stylesConverter.getScaledSize(r.h)+n.getVertical();re(this.inappHTMLEl,"width",o+"px"),re(this.inappHTMLEl,"height",i+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?re(this.inappHTMLEl,"position","absolute"):re(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var Z0="cooee-container",_l=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),re(this.inappHTMLEl,"position","relative"),re(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(Z0),this}};var El=class t extends zr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(_(_(_({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=>yo(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=document.createElement("div"),n=document.createElement("span"),o=document.createElement("span");return o.innerText=e,n.innerText="00",n.id=`lc-${e}`,re(o,"font-size","0.5em"),re(o,"text-align","center"),re(o,"font-family","inherit"),re(n,"text-align","center"),re(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(o),r.appendChild(n)):(r.appendChild(n),r.appendChild(o)),re(r,"display","flex"),re(r,"flex-direction",this.inappElement.horizontal?"":"column"),re(r,"justify-content","center"),re(r,"align-items","center"),re(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 wl=class extends zr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){re(this.inappHTMLEl,"background","#ffffff00"),re(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 Ur(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 o=e.imgs[0]??r.imgs?.at(0);o?.url&&n.setAttribute("src",o.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(o=>{r.add(this.createOption(o.name??"Default",o,o.mID===n?.vID))})}createOption(e,r,n){let o=document.createElement("option");return o.text=e,o.value=JSON.stringify(r),n&&(o.selected=!0),r||(o.disabled=!0),o}};var Ei=class extends zr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),re(this.inappHTMLEl,"background","#ffffff00"),re(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 bl=class t extends Ei{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.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Sl=class t extends Ei{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Tl=class extends vo{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var $n=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new St(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,o=e.cont.h,i=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=i.getHorizontal(),a-=i.getVertical(),s/a<n/o?this.scalingFactor=s/n:this.scalingFactor=a/o,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&re(this.parent,"position","relative")}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Cr(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(jr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!Qe.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,t._instance=this;try{this.startRendering()}catch(e){ae(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),jr()||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 Ln(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(fe().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=Im.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Ns(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(o=>o.mID));let r=new xe("CE Trigger Displayed",e,this.triggerContext.triggerData);Ut(r);let n={action:"DISPLAYED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new xe(r,e,this.triggerContext.triggerData);n.name==="CE Trigger Clicked"&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(o=>o.toEmbed())),Ut(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof qo?new bl(e,r,n).render():r instanceof Yo?new Sl(e,r,n).render():r instanceof An?new Ds(e,r,n).render():r instanceof Ko?new Tl(e,r,n).render():r instanceof ln?new vo(e,r,n).render():r instanceof to?new Os(e,r,n).render():r instanceof Go?new El(e,r,n).render():r instanceof zo?new wl(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new _l(this.rootContainer,r,e).render().getHTMLElement(),new hl().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(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new xe("CE Campaign Rejected",r,e);Ut(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(o=>{let i=o.bg?.img?.src;if(i&&n.push(this.getPromise(i)),o.t===1){let s=o.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 wi=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=go[e]?.toLowerCase();r&&(w.verbose(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var Il=class{triggerData;render(e){e.contentSource===Ni.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){w.warn("Received invalid trigger callback");return}switch(r.type){case"open":Ut(new xe("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);Ut(new xe("CE Form Submitted",{form:n},this.triggerData)),bi(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),Ut(new xe("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(jt.hasKeys(n)){let o=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{o.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let i=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(i?.length||s?.length)&&(r.name=i+" "+s)}return r}};var xl=class{static trackIntent(e){if(!this.isInstalled()){w.verbose("Facebook pixel not installed");return}if(!Ye.get().pixelPush){w.verbose("Facebook pixel push not enabled");return}let n=go[e.intent]?.toLowerCase(),o=e.segmentName;!n&&!o||(w.verbose(`Sending ${n} intent and ${o} 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 rm=new Map,Cl=async t=>{for(let i of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(i,t)}catch(s){w.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let s=(await de.getCurrent().getNormalisedCart()).items.map(a=>a.mID);t.items=t.items.filter(a=>!s.includes(a.mID))}if(Ye.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await eT(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(i=>av(i,t)),o=(await Promise.all(r)).filter(i=>i!=null);if(e&&!o.length){let i="Failed to fetch any product from Ajax API",s=new xe("CE Campaign Failed",{reason:i,currency:t.currency},t);throw Ut(s),new Error(i)}if(t.isCartRecovery()){let i=de.getCurrent().items,s=[];for(let a of o)for(let l of a.vars){if(!l.isAvailable)continue;let f=i.find(E=>E.variant_id.toString()===l.mID);if(!f)continue;let d=new Ct(a);d.name=f.title;let m=new Ur(l);m.name=f.variant_title,m.price.d=f.discounted_price/100,d.variants=[m],s.push(d)}return s}return o},eT=async(t,e)=>{await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let o=await av(n,e);return o||n}))}))},av=async(t,e)=>{if(rm.has(t.mID))return rm.get(t.mID);let r,n=`/products/${t.slug}.js`;try{r=(await tn(n)).data}catch(o){return o instanceof vr&&o.response?.status===404||ae(o,"fetch-shopify-product",{extra:{item:t,path:n},engagementTrigger:e}),null}return r?tT(t,r):(w.error("Item not found after AJAX call for:",t),null)},tT=(t,e)=>{if(!t||!e)return t;t.name=e.title,t.tags=e.tags,t.slug=e.handle;let r=t.selectedOrFirstVariant.value;return t.vars.map(n=>{let o=e.variants.find(i=>i.id===+n.mID);o!=null&&(n.name=o.title,n.isAvailable=o.available,n.price.d=o.price?o.price/100:o.price,n.price.effective=n.price.d,n.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price,+r.mID===o.id&&(r.effectivePrice.value=n.price.d))}),rm.set(t.mID,t),t};var nm="/v1/event/track-page-unload";function It(t){w.verbose(`Waiting for auth to send event ${t.name}`),xr(pr).then(()=>Ut(t))}function Qy(t){xr(pr).then(()=>{rT(t).catch(e=>ae(e,"track-page-unload"))})}async function rT(t){let e=fe().currentPageViewEvent;if(!e){w.warn("No page view event was stored previously");return}let r={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:t};w.verbose("Sending page unload",r);try{await Jt(nm,r)}catch(n){throw w.error(`Error sending page unload for ${e} to server`,n),n}}function Ut(t){nT(t).catch(e=>ae(e,"track-event",{extra:{event:t}}))}async function nT(t){if(w.verbose(`Sending event: ${t.name}`,t),lT(t)){w.warn(`Rejecting event ${t.name}`);return}Ky();let e=await dn();Object.assign(t,e),Jy();let r=cT(t.name),n=r.toLowerCase().replace(/\s+/g,"-");try{let o=await Jt(`/v1/event/track/${n}`,t);w.info("\u2705 Event tracked:",r),oT(t)&&(fe().currentPageViewEvent={id:t.id,name:t.name}),iT(t,o.data)}catch(o){throw w.error(`Error sending event ${t.name} to server`,o),o}}function oT(t){return Cm.includes(t.name)?t.name==="View Cart"?!t.properties.drawer:!0:!1}function iT(t,e){sT(t,e).catch(r=>{ae(r,"process-popup-response",{extra:{event:t,response:e}})}),aT(e)}async function sT(t,e){if(!e.triggerData)return;let r=new St(e.triggerData);r.occurred=t.occurred,w.log(`${r} will be shown`);let n;try{n=await Cl(r)}catch(o){w.error("Failed to refresh the products",o);return}if(r.items=n,r.contentSource===Ni.KLAVIYO){new Il().render(r);return}new $n().renderEngagement(r).catch(o=>{ae(o,"render-popup",{extra:{event:t},engagementTrigger:r})})}function aT(t){t.intent&&(wi.trackIntent(t.intent),xl.trackIntent(t),w.info(`Intent is ${go[t.intent]}`))}function cT(t){return t.replace("CE ","").replace("Trigger","Campaign").replace("Screen","Page").replace("App ","")}function lT(t){return t.trigger?.triggerID==="test"||t.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}var cv=Xr(zs());var hn=class{constructor(e){this.triggerContext=e}async execute(e){let r=fe().currentItem,n=e.clickAction;if(!n)return;let o=e.item,i=this.triggerContext,s=new Hn,a=i.triggerData.redirectBehaviour,l=!!i.triggerData.discount?.type&&!!n?.applyDiscount,f={selectedVariants:i.triggerData.nonMutableItems.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID,variantID:N.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},d="",m=[],E=[];if(o?E=[o.toEmbed()]:e.embeddedItem&&(E=[e.embeddedItem]),n.at===we.ADD_BUNDLE){let N=i.selectedItems;if(E=e.embeddedItems??N.map(k=>k.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let k;e.embeddedItems?k=e.embeddedItems.map(B=>({itemMID:B.mID,mID:B.vID,variantID:B.vID,quantity:B.quantity})):k=N.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID,variantID:B.selectedOrFirstVariant.value.mID}));let X=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&X&&(k.push({itemMID:X.mID,mID:X.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(X.toEmbed())),f.selectedVariants=k,i.triggerData.isBundleOnPDP()&&f.selectedVariants.forEach(B=>{B.mID===r.vID&&(B.isPrimary=!0)})}else f=void 0;m=e.embeddedItems??N}else if(n.at===we.INITIATE_CHECKOUT){let N=await de.getCurrent().getNormalisedCart();E=N.items,f.selectedVariants=N.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(n.at===we.ADD_TO_CART)m=o?[o]:[e.embeddedItem];else if(n.at===we.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,o),this.sendTriggerClicked(E,{from:"button"},e.video);return}else if(n.at===we.GO_TO_PRODUCT)d=o?Wo("/products/"+o.slug):e.embeddedItem?.link;else if(n.at===we.GO_TO_URL){let N=Uo(n.gu?.u);N&&(d=N.href)}else if(n.at===we.UPGRADE_TO_SUBSCRIPTION){let N=await s.upgradeToSubscription(o,i.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Qe.get().refreshUI(N)}else if(n.at===we.GO_TO_COLLECTION){let N=this.triggerContext.triggerData.collections?.[0];N&&(d="collections/"+N.handle)}if(this.sendTriggerClicked(E,{from:"button"},e.video),w.verbose({redirectPath:d,redirectBehaviour:a,hasDiscount:l}),!l&&d){location.href=d;return}let y,C=!1;try{y=await this.getOrGenerateDiscountCode(f),w.verbose("Discount code (if any) to apply",y)}catch(N){if(!this.triggerContext.triggerData.isBYOB()){cv.default.error("Unable to get a discount code",N);return}}if(y&&n.at===we.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(n.at===we.BUY_NOW){let N=await s.createNewCart(r,y,i.triggerData);N&&(location.href=N);return}try{y&&await Gr.applyWithStorefront([y])}catch(N){w.error(N),C=!0}let D;if(m?.length&&(D=await s.addToCart(m,i.triggerData)),C&&y){Gr.navigate(y,a,d);return}if(d){location.href=d;return}Gr.navigateWithoutDiscount(a,D)}sendTriggerClicked(e,r,n){let o=new xe("CE Trigger Clicked",r,this.triggerContext.triggerData);o.items=e,o.setVideos(n),Ut(o)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===er.STATIC){if(!r.code)throw Ah("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await uT(e,this.triggerContext),!n)throw w.error("No discount code found",e),new Error("Discount code not found or generated");return n}}};async function uT(t,e){try{return(await lv(t)).data.code}catch(r){throw br("Failed to generate a discount code"),ae(r,"backend-generate-discount",{triggerContext:e}),r}}var Ue=class extends Mr{stylesConverter=new _i(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=jr()?"sm":"lg",this.clickExecutor=new hn(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(Z(_(_(_(_(_(_({},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()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return w.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,jr()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),r.clickAction||(r.clickAction=this.props.element.clc),r.clickAction?.at&&await this.clickExecutor.execute(r)}};var fT=0,Aj=Array.isArray;function Y(t,e,r,n,o,i){e||(e={});var s,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?s=e[a]:l[a]=e[a];var f={type:t,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fT,__i:-1,__u:0,__source:o,__self:i};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return Te.vnode&&Te.vnode(f),f}var Qt=class extends Ue{componentDidMount(){this.setState(()=>({text:this.props.element.text})),bt(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=""),Y("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:Y("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=eo(this.props.element,r,this.props.triggerContext),o=new gt(n);if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:o.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;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 _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var _o=class extends Qt{render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:Y("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(_({},super.getComponentStyles()),{cursor:"pointer"})}};var om=class extends Mr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?Y("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[Y("span",{children:this.props.time}),Y("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):Y("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[Y("span",{style:this.getTimeLabelStyle(),children:this.props.label}),Y("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}},Ps=class extends Qt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return Y("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>Y(om,{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 _(_({},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(()=>_({},this.labels))})}};function Rl(t,e){if(!t)return;let r={loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(o,i)=>`
54
54
  <span class="${i}"
55
55
  style="background-color: ${e.pagination.color?.rgba};"></span>
56
56
  `,renderProgressbar:o=>`
57
57
  <span class="${o}"
58
58
  style="background-color: ${e.pagination.color?.rgba};">
59
59
  </span>
60
- `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0};e.marquee&&r.autoplay&&typeof r.autoplay=="object"&&(r.speed=e.speed,r.autoplay.pauseOnMouseEnter=!0,t.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let n=new window.CooeeSDK.Swiper(t,r);return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function Al(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),Y("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[Y("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&Y("div",{class:"swiper-button-next",style:n,children:Y("span",{})}),t.navigation.enabled&&Y("div",{class:"swiper-button-prev",style:n,children:Y("span",{})}),t.pagination.enabled&&Y("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Ls=class extends Ue{componentDidMount(){bt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:Y("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 at;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(_({},this.getTypoStyles()),{display:"flex"})}};var gn=class extends Ue{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 Y("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(e){this.props.element.clc?.at===we.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};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 yn=class extends Ue{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(Vn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Xo,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 Ms=class extends yn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(Si,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Bs=class extends Ue{render(){return Y("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(){bt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;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"),_(_({},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(Y("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(Y("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 pT=new RegExp('fill="#[a-zA-Z0-9]+"'),Us=class extends Ue{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),Y("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Vo(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Vo(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return"";let i="";if(this.props.element.showSingleStar)i=r;else{let s=5,a=`${o.rating}`.split(".");for(let l=0;l<+a[0];l++)i+=r,s--;a[1]&&(i+=n,s--);for(let l=0;l<s;l++)i+=r.replace(pT,'fill="#f1f1f1"')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var ks=class extends Ue{render(){return Y("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(){bt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;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"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(Y("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(o=>o.mID===r);this.props.item.setSelectedVariant(n)}};var uv=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id},im=t=>{if(!t)return;let e;try{e=new URL(t)}catch{return}if(e.hostname!=="cdn.shopify.com")return t;let r=e.pathname.split(".");return r.length!==2?t:(e.pathname=r[0]+"_large."+r[1],e.toString())};var Si=class extends Ue{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 r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:Y(Ms,{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()?Y(Ls,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,o=im(n.variantImage??n.firstImageURL),i=im(n.variantSecondaryImage??n.secondaryImageURL);r.lg=r.sm={src:o,name:n.name,secondarySrc:i};let s=Y(gn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:Y("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:r.showChips?Y("cooee-product-options-picker",{item:this.props.item}):Y(ks,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?Y(Bs,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?Y(Us,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?Y(_o,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):Y(Vn,{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=Y(Qt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:Y("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 Eo=class extends Ue{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=eo(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Nn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return Y("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:Y(Si,{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,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===er.BXGY;return!r.hasEffectivePrice()&&o&&(n.product=Z(_(_({},n.product),Mt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var Fs=class extends Ue{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=jr()?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=Rl(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=i=>{this.swiperRef=i},o=()=>e?.map(i=>Y("div",{class:"swiper-slide",children:this.getProductFragment(i)}));r=Y("div",{style:Z(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Al(this.configuration,n,o)})}else r=Y("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,o)=>this.getProductFragment(n,o!==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,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${i}, auto)`}}return r}getProductFragment(e,r=!1){return Y(Br,{children:[Y(Eo,{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&&Y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Y(Qt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Hs=class extends Ue{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Oc().then(()=>{this.swiperInstance=Rl(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=o=>{this.swiperRef=o},n=()=>{let o=e.values?.map(a=>Y("div",{class:"swiper-slide",onClick:l=>this.onClick(l,{clickAction:this.getClickAction(a)}),children:this.renderElement(a)}));if(!o?.length)return[];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let a=Number(i.maxInRow)-s+1;for(let l=0;l<a;l++)o.push(o[l%s])}return o};return Al(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return Y(gn,{element:r,triggerContext:this.props.triggerContext});case 4:return Y(yn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=eo(e,{form:r},this.props.triggerContext);return Yt.getParsedElement(n)}getClickAction(e){return eo(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Vn=class extends Ue{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),bt(()=>{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 Y(yn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return Y(Ps,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?Y(_o,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return Y(Qt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return Y(gn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return Y(Fs,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return Y(Eo,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return Y(Hs,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var $s=class extends Ue{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===we.GO_TO_URL&&!!Uo(this.clickAction.gu?.u)||this.clickAction?.at===we.OPEN_CART||this.clickAction?.at===we.INITIATE_CHECKOUT}componentDidMount(){bt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return Y(Br,{children:[Y("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:Y(Vn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&Y("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}};var vt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Cr(new Date,this.engagementTrigger)}static currentEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];renderedCount=0;scrollSubscription;variation;isExclusionWithBVariation;isRendering=!1;renderSilently(){this.render().catch(e=>{ae(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){w.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),_p(this.engagementTrigger.content?.afterDeleteJS)}async render(){if(this.isRendering){w.verbose(`${this.engagementTrigger} rendering already in progress, skipping`);return}this.isRendering=!0;try{if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this,_p(this.engagementTrigger.content?.afterRenderJS)}finally{this.isRendering=!1}}matches(e){return this.engagementTrigger.shortID===e.shortID}async updateAndReRender(e){w.info(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}async update(e){}rerender(){this.rootContainer?.isConnected||(w.info(`${this.engagementTrigger} deleted. Will be re-rendered`),this.preDestroy(),this.renderSilently())}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),!0):!1}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}isAllOkToRender(){return!!this.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){w.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Ct(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Ct(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Ct(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&jt.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new is(e.content)),this.triggerContext.triggerData.widget=this.widget=new ei(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.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this.renderedCount++,w.info(`${this.engagementTrigger} rendered \u2705 ${Bh(this.renderedCount)} time`)}removeFromRendered(){this instanceof dt?dt.currentEngagements.delete(this):t.currentEngagements.delete(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await fv(e)).data}catch(r){if(r instanceof vr&&r.response?.status===400)return;ae(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async a=>{if(a.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),s.unobserve(this.rootContainer)}})},r);o.observe(this.rootContainer),this.observers.push(o)})}attachScroll(){this.scrollSubscription=ho(window,"scroll").pipe(Xt(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let o=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",i=new xe(o,n,this.engagementTrigger);i.name==="CE Campaign Holdout"&&(i.trigger.holdout=!0),Ut(i),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=de.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i} lc-${o}`,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}startRendering(){let e=this.rootContainer;this.triggerContext.triggerData.hasSwiperElement()&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),Ep(e)),Qh(Mf($s,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=o/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,o;if(n.includes(":shadow")){let l=n.split(":shadow");o=(await Cn(l[0].trim()))?.shadowRoot,n=l[1].trim(),o&&Ep(o,!1)}w.verbose(`${this.engagementTrigger} attempt to render ${r.position} "${n}"`);let i=await Cn(n,10,o??document);if(!i)return w.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 Dt.BEFORE1:case Dt.BEFORE:{i.parentElement?.insertBefore(a,i);break}case Dt.INSIDE_FIRST1:case Dt.INSIDE_FIRST:{i.insertBefore(a,i.firstChild);break}case Dt.INSIDE_LAST1:case Dt.INSIDE_LAST:{i.appendChild(a);break}case Dt.AFTER1:case Dt.AFTER:default:i.parentElement?.insertBefore(a,i.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){w.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}w.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await Cl(this.engagementTrigger)}catch(r){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),o=this.getItemDiff(r,e);r.push(...n);for(let i of o)Qr.remove(r,i)}getItemDiff(e,r){return e.filter(n=>!r.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var dt=class extends vt{static currentEngagements=new Set;constructor(e){super(e)}rerender(){super.rerender(),this.checkAndSendEvent()}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!Qe.get().isOpen()&&fe().pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var mT=t=>t,pv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function mv(t,e={childList:!0,subtree:!0},r=500,n=mT){return ul(o=>{let i=new MutationObserver(s=>o(s));return i.observe(t,e),i},(o,i)=>i.disconnect()).pipe(mn(o=>n(o)),Yp(o=>o.length>0),Xt(r))}var Dl=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){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new t(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(d=>d.mID===e.id.toString());if(!n)return;let o=new Ur(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of o.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=!0,o.changeSellingPlan(d));let s=new Ct(r);s.vars=[o],s.selectedOrFirstVariant.value=o;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new St(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let f=new dt(l);f.renderSilently(),this.watchForCartItemDeletion(f,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(w.verbose(`${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 Ol=class extends dt{ctaExecutor=new Hn;constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=!1,r=await de.getCurrent().getNormalisedCart(),n=this.engagementTrigger.progressBarConfig,o,i=[],s=[],a=[],l,f,d=[...n.milestones];for(let E of d){if(E.rewardType!==nu.FREE_AUTO_GIFT)continue;if(E.isUIOnly&&!E.allowATC){w.verbose(`Skipping milestone ${E.label} as it is UI only and does not allow ATC`);continue}let y=E.items[0],C=E.reached,D=r.items.find(N=>(N.vID===y.vID||N.mID===y.mID)&&N.properties._letscooee_campaign===this.engagementTrigger.shortID);C&&(l=E,f=D),D&&i.push(D),!C&&D&&n.removeIneligibleItem?(w.verbose(`Removing free gift ${D.vID} from cart`),a.push(D)):C&&!D&&(w.verbose(`Adding free gift ${y.vID} to cart`),s.push(y))}n.restrictToLatestFreebie&&l&&(f?(i=i.filter(E=>E.vID!==f.vID),s=[]):s=[l.items[0]],a.push(...i)),a.length&&(await this.removeFreeGifts(a),e=!0),s.length&&(o=await this.ctaExecutor.addToCart(s,this.engagementTrigger),e=!0);let m=n.coupons;if(!m?.length){e&&Qe.get().refreshUI(o,!1);return}try{let E=m.map(D=>D.couponCode),y=de.getCurrent().discount_codes?.map(D=>D.code)??[];E.every(D=>y.some(N=>N===D))||(await Gr.applyWithStorefront(E),e=!0)}catch(E){ae(E,"cart-apply-discount",{extra:{coupons:m},engagementTrigger:this.engagementTrigger})}e&&Qe.get().refreshUI(o,!1)}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var Vs=class extends dt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.content}startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Nl=class extends vt{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Pl=class extends vt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Ll=class extends vt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,o=e.detail;if(!jt.hasKeys(o)){w.error(`No detail received for ${n}`);return}w.log("Detail received for BYOB",o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==r.shortID&&i!==r.engagementID){w.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let a=s.map(l=>new Ot({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new hn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:we.ADD_BUNDLE,applyDiscount:!0}})}};var sm=!1,am=!1,Ml=null,Bl=null,dv=!1;function hv(){dv||(dv=!0,xn(()=>{mv(document.body,{childList:!0,subtree:!0},500,pv).subscribe(()=>{vt.currentEngagements.forEach(t=>t.rerender()),dt.currentEngagements.forEach(t=>t.rerender())})}))}function cm(t){if(hv(),sm){w.verbose("Cart widget processing in progress, queuing latest triggers"),Ml=t;return}sm=!0;try{dT(t)}finally{if(sm=!1,Ml){let e=Ml;Ml=null,w.verbose("Processing queued cart triggers"),cm(e)}}}function lm(t){if(hv(),am){w.verbose("Page widget processing in progress, queuing latest triggers"),Bl=t;return}am=!0;try{hT(t)}finally{if(am=!1,Bl){let e=Bl;Bl=null,w.verbose("Processing queued page triggers"),lm(e)}}}function dT(t){yv(dt.currentEngagements,t);for(let e of t){w.info(`${e} received as cart embed`);let r=gv(dt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}w.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new Ol(e);else if(e.isSubscriptionUpsell()){Dl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Vs(e):n=new dt(e);dt.currentEngagements.add(n),n.renderSilently()}}function hT(t){yv(vt.currentEngagements,t);for(let e of t){w.info(`${e} received as page embed`);let r=gv(vt.currentEngagements,e);if(r){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}w.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Nl(e):e.isBYOB()?n=new Ll(e):e.isStickyATC()?n=new Pl(e):e.isSavingsBar()?n=new Vs(e):n=new vt(e),vt.currentEngagements.add(n),n.renderSilently()}}function gv(t,e){for(let r of t)if(r.matches(e))return r}function yv(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var _v=new Kt,vv=0;_v.pipe(Xt(50),Kp(t=>zp(Promise.all([gT().catch(e=>{ae(e,"load-page-widgets",{extra:{firstLoad:t}})}),yT().catch(e=>{ae(e,"load-cart-widgets",{extra:{firstLoad:t}})})])))).subscribe();function Ti(t=!1){xr(pr).then(()=>{_v.next(t)})}function Ev(){dt.currentEngagements.forEach(t=>t.rerender())}async function fv(t){let e=await dn();return Object.assign(t,e),Jt("/v1/engagement/get-variant",t)}async function gT(){vv++,vv===1?w.info("Fetch page widgets (after \u23F0",To()+" of SDK load)"):w.info("Fetch page widgets");let t=await dn(),e=_({},t);Jt("/v1/engagement/page-widgets",e).then(r=>{w.info(`Page widgets loaded in \u23F0 ${Jr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));lm(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async function yT(){w.info("Fetch cart widgets");let t=await dn(),e=_({},t);Jt("/v1/engagement/cart-widgets",e).then(r=>{w.info(`Cart widgets loaded in \u23F0 ${Jr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));cm(n)}).catch(r=>{w.error("Error sending widget getter",r)})}var Ul=class{static processConfiguration(){let e=Ye.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&kl({gaClientID:e})}static async getClientID(){let e=await ze.get("gacid"),r=await this.getClientIDViaGTag();if(e!==r)return await ze.set("gacid",r),r}static async getClientIDViaGTag(){let r=Ye.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",o=>{n(o)})})}};var Fl=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){As.get("conf",{}).then(e=>this.updateGlobalConfig(e)),window.CooeeSDK.cartChange$.subscribe(()=>{Ti()})}async processAppConfigurations(e){w.verbose("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);As.set("conf",r).catch(n=>w.error(n)),Ul.processConfiguration(),r.website&&(Xg(r.website.commonJS),vp(r.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Xt(10)).subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(Ev(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Ce.globalRef.config.update(e);return Qe.forceUpdate(),w.verbose("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};It(new xe("View Cart",n))}};var pr=new bs(1),wv="App ID or Shopify shop is not set",um,qr=class t{coreService=Fl.getInstance();userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return um||(um=new t),um}async populateAuthDataFromStorage(){await this.getOrSetDeviceIDSafe(),this.userID=await ze.get("id"),this.updateAPIClient()}async isAuthenticated(){return!this.deviceID||await this.isNewSessionRequired()?!1:!await this.notSynced()}authenticate(e){if(w.verbose("Initialising SDK",e),jy(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}this.appID=e.appID,this.shopifyShop=e.shopifyShop,this.checkForNewSessionOnPageLoad().then(async()=>{pr.next(!0),pr.complete()}).catch(r=>{r?.message?.includes(wv)&&ae(r,"initiate-session",{extra:e}),w.error("Unable to initiate session",r)})}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await ze.set("id",e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await ze.set("did",e.deviceID)),this.updateAPIClient())}async checkSessionAndGetContext(){return await this.checkForNewSessionUnsafe(!1),this.getContext()}async checkForNewSessionOnPageLoad(){await this.checkForNewSessionSafe(!0)}async getOrSetDeviceIDSafe(){await ml.request("gen_did",async()=>{let e=await ze.get("did");e||(e=new yt().toHexString(),await ze.set("did",e)),this.deviceID=e,w.info("Device ID:",this.deviceID)})}async getContext(){xt.set("lastUsedTime",new Date().getTime());let[e,r,n]=await Promise.all([xt.get("id",""),ze.get("sessionNumber",1),xt.get("landing",{})]);return Bo({"cooee_session.number":r}),$a("Visitor Session",{id:e,number:r,landing_page:n}),{sessionID:e,sessionNumber:r,landingPage:n}}async checkForNewSessionSafe(e){await this.checkForNewSessionUnsafe(e)}async checkForNewSessionUnsafe(e){let r=!1;if(await this.isNewSessionRequired()?(w.info("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();w.info(`Session ID: ${n.sessionID} & number: ${n.sessionNumber}`),await this.validateSessionFromServer(Z(_({},n),{newSession:r})),await xt.set("synced",!0)}}async startNewSession(){w.verbose("Starting new session"),await xt.clear(),w.verbose("Cleared SessionStorage before starting new session");let e=new Date,r=new yt().toHexString();w.verbose("New session ID to be used",r);let n=await ze.get("sessionNumber",0)+1;await Promise.all([ze.set("sessionNumber",n),xt.set("id",r),xt.set("lastUsedTime",e.getTime()),xt.set("landing",Ys())])}async isNewSessionRequired(){if(!await xt.get("id"))return!0;let e=await xt.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async notSynced(){return!await xt.get("synced",!1)}async getSessionValidateData(e){if(!this.appID&&!this.shopifyShop)throw new Error(wv);let r=await qy(),n=Wc();return Z(_(_({deviceID:this.deviceID,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),n),{sdk:js,ad:fl.getAdParams(),occurred:vT(fe().jsLoadTime),properties:{}})}async validateSessionFromServer(e){w.verbose("Validating session with server"),await this.populateFirstSeen();let r=await this.getSessionValidateData(e);try{let n=await Jt("/v1/event/validate-session",r),o=n.data;w.info(`Auth finished in \u23F0 ${Jr(n.timeTakenMs)}`),w.verbose("Validate session Response",o),await this.coreService.processAppConfigurations(o.appSettings),await this.storeAndPopulateAuthData(o)}catch(n){throw w.error(n),n}}async populateFirstSeen(){let e=await ze.get("firstSeen"),r=e?new Date(e):new Date;e||await ze.set("firstSeen",r.toISOString()),Sv(r),$a("Visitor Info",{first_seen:r.toISOString()})}updateAPIClient(){this.userID&&w.info("User ID:",this.userID),wi.trackDeviceID(this.deviceID),bv(this.deviceID),$a("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),Dh({id:this.deviceID})}};function vT(t){return(new Date().getTime()-t.getTime())/1e3>1800?new Date:t}var _T="keepalive"in new Request(""),Yr=new Headers;ST();async function dn(){let[t]=await Promise.all([qr.getInstance().checkSessionAndGetContext()]);return _(_({},Wc()),t)}function bi(t){xr(pr).then(()=>ET(t??{}))}function ET(t){Tv("/v1/user/update",t).then(async e=>{w.verbose("Updated user profile"),await qr.getInstance().storeAndPopulateAuthData(e.data)}).catch(e=>{w.error("Error saving user profile",e)})}function lv(t){return Jt("/v1/event/generate-discount",t)}function kl(t){xr(pr).then(()=>wT({props:t}))}function wT(t){Tv("/v1/device/update",t).then(()=>{w.verbose("Updated device properties")}).catch(async e=>{w.error("Error saving device property",e)})}function bv(t){t&&Yr.set("cooee-device-id",t)}function Sv(t){t&&Yr.set("cooee-first-seen",t.toUTCString())}function Jt(t,e){return Iv("POST",t,e)}function Tv(t,e){return Iv("PUT",t,e)}function Iv(t,e,r){if(!ns()&&!fe().flags?.allowEvents)return w.log(`Rejecting ${t} ${e} as this is not e-commerce app`),Promise.reject();if(e.startsWith("http")||(e=gr.apiURL+e),r&&!_T&&e.includes(nm))try{return bT(e,Yr,r)}catch(o){throw ae(o,"http-request",{extra:{body:JSON.stringify(r)}}),o}let n={method:t,headers:Yr,keepalive:!1};return r&&(n.body=JSON.stringify(r)),tn(e,n)}function bT(t,e,r){return new Promise((n,o)=>{let i=new XMLHttpRequest;i.open("POST",t,!0),e.forEach((s,a)=>{i.setRequestHeader(a,s)}),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(i.status>=200&&i.status<300)try{if(i.getResponseHeader("Content-Type")?.includes("application/json")){let a=JSON.parse(i.responseText);n({data:a,headers:e,request:i,status:i.status,statusText:i.statusText})}else o(new Error("Content-Type of response header is not json"))}catch(s){o(s)}else o(new Error(`Received status - ${i.status}(${i.statusText})`))},i.onerror=()=>{o(new Error("Network error occurred during the request."))},i.send(JSON.stringify(r))})}function ST(){Yr.set("Content-Type","application/json; charset=utf-8"),Yr.set("cooee-sdk",js),Yr.set("cooee-sdk-code",Sm.toString()),Yr.set("cooee-sdk-version",Gs),Yr.set("cooee-shop-name",oc()??""),gr.debug&&Yr.set("cooee-sdk-debug",String(1))}var Hl=class{modifications=[];constructor(){}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){ba("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;if(!r?.length)return w.log("Nothing to experiment",e.toString()),!0;let n=!1;for(let o of r){if(!o.cssSelector){w.verbose("No CSS Selector available",e?.toString());continue}this.modifications.push(o);let i=Array.from(document.querySelectorAll(o.cssSelector));i?.length&&(this.executeSingleModification(o,i),n=!0)}return n}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n),e.moveTo?.selector&&this.changePlacement(e,n).catch(console.error)}async changePlacement(e,r){let n=await Cn(e.moveTo.selector);if(n)switch(e.moveTo.position){case Dt.BEFORE1:{r.nextElementSibling!==n&&n.parentElement?.insertBefore(r,n);break}case Dt.INSIDE_FIRST1:{n.firstChild!==r&&n.insertBefore(r,n.firstChild);break}case Dt.INSIDE_LAST1:{n.lastChild!==r&&n.appendChild(r);break}case Dt.AFTER1:default:r.previousElementSibling!==n&&n.parentElement?.insertBefore(r,n.nextSibling)}}trackExperimentRan(e){if(e.id==="preview"){w.warn("Skipping experiment attribution as its preview",e.toString());return}xv({name:"CE Experiment Start",experiment:new Ln(e)}).catch(r=>{w.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(o=>{o instanceof HTMLElement&&this.modifications.forEach(i=>{o.matches&&o.matches(i.cssSelector)?(w.verbose("Re-applying experiment",i.toString()),this.executeSingleModification(i,[o])):o.querySelectorAll&&(w.verbose("Re-applying experiment",i.toString()),this.executeSingleModification(i,Array.from(o.querySelectorAll(i.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,o=e.image?.sm?.src;!n&&!o||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:o},r):this.updateImageElement({desktop:n,mobile:o},r))}updateImageElement(e,r){jr()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let o=document.createElement("source");o.srcset=e.mobile,o.media="(max-width: 767px)",r.append(o)}if(e.desktop){let o=document.createElement("source");o.srcset=e.desktop,o.media="(min-width: 768px)",r.append(o)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};async function xv(t){let e=await dn(),r=_(_({},t),e);await Jt("/v1/event/experiment",r)}function $l(){TT().catch(t=>ae(t,"fetch-experiments"))}async function TT(){if(!fe().activeExperiments)return;await qr.getInstance().isAuthenticated()?await Cv():(await xr(pr),await Cv())}async function Cv(){w.info("Fetch experiments after \u23F0",To()+" of SDK load");let t=await dn(),e=_({},t);Jt("/v1/engagement/experiments",e).then(async r=>{w.info(`Experiments fetched in \u23F0 ${Jr(r.timeTakenMs)}`);let n=r.data.experiments.map(o=>new St(o));new Hl().execute(n)}).catch(r=>{w.error("Error sending experiment getter",r)})}var Vl=class{runtimeData=fe();meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{Ti()},e.loadExperiments=()=>{$l()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce),e.executeCTA=(r,n)=>{new hn(r).execute(n)},e.sendEvent=r=>{It(r)}}overwritePush(e,r){Lr(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(xm.includes(e[0])?Ce.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&IT(e.currentItem),e.currency&&(fe().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&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&de.getCurrent().update(e.cart),e.customContext&&(this.runtimeData.customContext=_(_({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(fe().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=uv();if(e||(e=fe().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new St({id:"preview",shortID:"1",redirectBehaviour:tr.CART_DRAWER});await new hn(new Cr(new Date,r)).execute({clickAction:{at:we.ADD_TO_CART},embeddedItem:new Ot({vID:e})})}};function IT(t){let e=fe();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID}});document.dispatchEvent(r)}e.currentItem=new Ot(t)}var Ii=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="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 xT=1e3,CT=10,fm=0,pm=new Date;function mm(t){Ii.remove("sleid"),pm=t??new Date}function Rv(){if(window.scrollY){let t=Ov();Av(t)&&Dv(t)}xn(()=>{RT()})}function RT(){ho(window,"scroll").pipe(Xt(xT),mn(()=>{let t=Ov();if(t>100){w.warn("Received scroll percent is more than 100",t);return}if(Av(t))return t})).subscribe(t=>{Dv(t)})}function Av(t){return Math.abs(fm-t)>=CT||fm!==t&&t===100}function Dv(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-pm.getTime()};fm=t;let r=Ii.getString("sleid",""),n=new xe("CE Scroll",e,null,r);It(n),Ii.setString("sleid",n.id.toHexString()),pm=new Date(n.occurred)}function Ov(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Nv(){AT()}function AT(){let t=window.fetch;window.fetch=async function(e,r){try{await DT(e,r)}catch(n){ae(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)},w.verbose("Securely overwritten window.fetch method for graphql query")}async function DT(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;n?.variables?.input&&(w.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await OT(n),NT()))}async function OT(t){let e=t.variables.input.attributes??[],r=await ja("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function NT(){let t=fe().currentItem;if(!t)return;let e=new xe("Buy Now Clicked",{items:[t]});It(e)}var xi=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 xe(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});It(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>w.error(e))}async listen(){this.elements=await Rf(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Wl=class t extends xi{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,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var jl=class t extends xi{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,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var PT=[".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(",");function Pv(){xn(()=>{w.verbose("Execution order:","document ready"),LT()})}function LT(){let t=window.location.hash?.substring(1);if(t)if(t.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let e=document.querySelector(PT);if(!e){w.verbose("No clickable cart checkout button found");return}w.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&Qe.get().open()}function Mv(){window.addEventListener("kp-modal:opened",()=>{fe().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&bi({goKwikToken:e})}),window.gokwikSdk?Lv():window.addEventListener("gokwikLoaded",Lv)}function Lv(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await de.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new xe("Checkout Started",e);It(r)})}var Gl=class{static watch(){let e=Dm();(e==="1"||e==="on")&&kl({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar()}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,xn(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){window.cooeeSDKPreview||(this.initGlobalReference(e),await qr.getInstance().populateAuthDataFromStorage(),this.autoAuthenticate(),new Vl().meddle(),Bm(),Ti(!0),$l(),Xy(),nv(),Nv(),Pv(),Rv(),jl.getInstance().listenSilently(),Wl.getInstance().listenSilently(),Mv(),MT(),Gl.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Lr(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Lr(this.globalRef,"config",new Ye),Lr(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Lr(this.globalRef,"uaParser",new Tr,!0),Lr(this.globalRef,"cart",de.getCurrent()),Lr(this.globalRef,"cartChange$",rv()),Lr(this.globalRef,"cartDrawerToggle$",Qe.cartDrawerToggle$.asObservable()),w.verbose("Global reference initialised"),new Nc(()=>{this.globalRef.uaParser=new Tr})}static injectWidgetAssets(){Yg(gr.widgetURL,"cooee-widget-sdk"),yp()}static autoAuthenticate(){let e=oc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;w.info("Begin auth after \u23F0",To(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((xf(r)||r.length!==24)&&xf(n)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,qr.getInstance().authenticate(e)}static sendEvent(e,r,n){let o=new xe(e,r,n?.triggerData);n?.occurred&&(o.occurred=n.occurred),It(o)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");bi(e)}static setPageName(e){if(!e)return;let r=fe(),n=r.pageName;if(e===n)return;if(r.pageName=e,Tm.some(s=>e.includes(s))){mm();return}let o={};n&&(o.ps=n);let i=new xe("CE Screen View",o);i.occurred=r.jsLoadTime,It(i),mm(i.occurred)}static previewPopup(e,r){new $n(r).render(e)}static previewWidget(e){new vt(new St(e)).renderSilently()}};function MT(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){w.error(t)}window.addEventListener("message",t=>{if(w.verbose("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(Ce.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(Ce.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}var Bv=new Date;Rm();Om();w.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.verbose("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(Bv),await Ce.initForAll(),BT(),w.verbose("Execution order:","IIFE end")))());w.verbose("Execution order:","bottom");function BT(){Am()&&import("./debug-logs-OQ2CZWJN.js").then(({printAllDebugLogs:t})=>t(Bv))}
60
+ `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0};e.marquee&&r.autoplay&&typeof r.autoplay=="object"&&(r.speed=e.speed,r.autoplay.pauseOnMouseEnter=!0,t.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let n=new window.CooeeSDK.Swiper(t,r);return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function Al(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),Y("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[Y("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&Y("div",{class:"swiper-button-next",style:n,children:Y("span",{})}),t.navigation.enabled&&Y("div",{class:"swiper-button-prev",style:n,children:Y("span",{})}),t.pagination.enabled&&Y("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var Ls=class extends Ue{componentDidMount(){bt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return Y("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:Y("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 at;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(_({},this.getTypoStyles()),{display:"flex"})}};var gn=class extends Ue{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 Y("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(e){this.props.element.clc?.at===we.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};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 yn=class extends Ue{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(Vn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Xo,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 Ms=class extends yn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return Y("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:Y(Si,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Bs=class extends Ue{render(){return Y("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(){bt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;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"),_(_({},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(Y("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(Y("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 pT=new RegExp('fill="#[a-zA-Z0-9]+"'),Us=class extends Ue{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),Y("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Vo(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Vo(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return"";let i="";if(this.props.element.showSingleStar)i=r;else{let s=5,a=`${o.rating}`.split(".");for(let l=0;l<+a[0];l++)i+=r,s--;a[1]&&(i+=n,s--);for(let l=0;l<s;l++)i+=r.replace(pT,'fill="#f1f1f1"')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var ks=class extends Ue{render(){return Y("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(){bt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;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"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(Y("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(o=>o.mID===r);this.props.item.setSelectedVariant(n)}};var uv=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id},im=t=>{if(!t)return;let e;try{e=new URL(t)}catch{return}if(e.hostname!=="cdn.shopify.com")return t;let r=e.pathname.split(".");return r.length!==2?t:(e.pathname=r[0]+"_large."+r[1],e.toString())};var Si=class extends Ue{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 r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:Y(Ms,{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()?Y(Ls,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,o=im(n.variantImage??n.firstImageURL),i=im(n.variantSecondaryImage??n.secondaryImageURL);r.lg=r.sm={src:o,name:n.name,secondarySrc:i};let s=Y(gn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:Y("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:r.showChips?Y("cooee-product-options-picker",{item:this.props.item}):Y(ks,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?Y(Bs,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?Y(Us,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?Y(_o,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):Y(Vn,{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=Y(Qt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:Y("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 Eo=class extends Ue{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=eo(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Nn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return Y("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:Y(Si,{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,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===er.BXGY;return!r.hasEffectivePrice()&&o&&(n.product=Z(_(_({},n.product),Mt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var Fs=class extends Ue{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=jr()?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=Rl(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=i=>{this.swiperRef=i},o=()=>e?.map(i=>Y("div",{class:"swiper-slide",children:this.getProductFragment(i)}));r=Y("div",{style:Z(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Al(this.configuration,n,o)})}else r=Y("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,o)=>this.getProductFragment(n,o!==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,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${i}, auto)`}}return r}getProductFragment(e,r=!1){return Y(Br,{children:[Y(Eo,{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&&Y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Y(Qt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Hs=class extends Ue{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Oc().then(()=>{this.swiperInstance=Rl(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=o=>{this.swiperRef=o},n=()=>{let o=e.values?.map(a=>Y("div",{class:"swiper-slide",onClick:l=>this.onClick(l,{clickAction:this.getClickAction(a)}),children:this.renderElement(a)}));if(!o?.length)return[];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let a=Number(i.maxInRow)-s+1;for(let l=0;l<a;l++)o.push(o[l%s])}return o};return Al(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return Y(gn,{element:r,triggerContext:this.props.triggerContext});case 4:return Y(yn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=eo(e,{form:r},this.props.triggerContext);return Yt.getParsedElement(n)}getClickAction(e){return eo(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Vn=class extends Ue{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),bt(()=>{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 Y(yn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return Y(Ps,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?Y(_o,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return Y(Qt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return Y(gn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return Y(Fs,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return Y(Eo,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return Y(Hs,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var $s=class extends Ue{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===we.GO_TO_URL&&!!Uo(this.clickAction.gu?.u)||this.clickAction?.at===we.OPEN_CART||this.clickAction?.at===we.INITIATE_CHECKOUT}componentDidMount(){bt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return Y(Br,{children:[Y("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:Y(Vn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&Y("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}};var vt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Cr(new Date,this.engagementTrigger)}static currentEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];renderedCount=0;scrollSubscription;variation;isExclusionWithBVariation;isRendering=!1;renderSilently(){this.render().catch(e=>{ae(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){w.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),_p(this.engagementTrigger.content?.afterDeleteJS)}async render(){if(this.isRendering){w.verbose(`${this.engagementTrigger} rendering already in progress, skipping`);return}this.isRendering=!0;try{if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this,_p(this.engagementTrigger.content?.afterRenderJS)}finally{this.isRendering=!1}}matches(e){return this.engagementTrigger.shortID===e.shortID}async updateAndReRender(e){w.info(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}async update(e){}rerender(){this.rootContainer?.isConnected||(w.info(`${this.engagementTrigger} deleted. Will be re-rendered`),this.preDestroy(),this.renderSilently())}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),!0):!1}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}isAllOkToRender(){return!!this.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){w.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Ct(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Ct(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Ct(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&jt.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new is(e.content)),this.triggerContext.triggerData.widget=this.widget=new ei(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.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this.renderedCount++,w.info(`${this.engagementTrigger} rendered \u2705 ${Bh(this.renderedCount)} time`)}removeFromRendered(){this instanceof dt?dt.currentEngagements.delete(this):t.currentEngagements.delete(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await fv(e)).data}catch(r){if(r instanceof vr&&r.response?.status===400)return;ae(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async a=>{if(a.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),s.unobserve(this.rootContainer)}})},r);o.observe(this.rootContainer),this.observers.push(o)})}attachScroll(){this.scrollSubscription=ho(window,"scroll").pipe(Xt(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let o=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",i=new xe(o,n,this.engagementTrigger);i.name==="CE Campaign Holdout"&&(i.trigger.holdout=!0),Ut(i),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=de.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i} lc-${o}`,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}startRendering(){let e=this.rootContainer;this.triggerContext.triggerData.hasSwiperElement()&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),Ep(e)),Qh(Mf($s,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=o/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,o;if(n.includes(":shadow")){let l=n.split(":shadow");o=(await Cn(l[0].trim()))?.shadowRoot,n=l[1].trim(),o&&Ep(o,!1)}w.verbose(`${this.engagementTrigger} attempt to render ${r.position} "${n}"`);let i=await Cn(n,10,o??document);if(!i)return w.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 Dt.BEFORE1:case Dt.BEFORE:{i.parentElement?.insertBefore(a,i);break}case Dt.INSIDE_FIRST1:case Dt.INSIDE_FIRST:{i.insertBefore(a,i.firstChild);break}case Dt.INSIDE_LAST1:case Dt.INSIDE_LAST:{i.appendChild(a);break}case Dt.AFTER1:case Dt.AFTER:default:i.parentElement?.insertBefore(a,i.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){w.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}w.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await Cl(this.engagementTrigger)}catch(r){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),o=this.getItemDiff(r,e);r.push(...n);for(let i of o)Qr.remove(r,i)}getItemDiff(e,r){return e.filter(n=>!r.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var dt=class extends vt{static currentEngagements=new Set;constructor(e){super(e)}rerender(){super.rerender(),this.checkAndSendEvent()}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!Qe.get().isOpen()&&fe().pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var mT=t=>t,pv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function mv(t,e={childList:!0,subtree:!0},r=500,n=mT){return ul(o=>{let i=new MutationObserver(s=>o(s));return i.observe(t,e),i},(o,i)=>i.disconnect()).pipe(mn(o=>n(o)),Yp(o=>o.length>0),Xt(r))}var Dl=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){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new t(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(d=>d.mID===e.id.toString());if(!n)return;let o=new Ur(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of o.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=!0,o.changeSellingPlan(d));let s=new Ct(r);s.vars=[o],s.selectedOrFirstVariant.value=o;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new St(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let f=new dt(l);f.renderSilently(),this.watchForCartItemDeletion(f,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(w.verbose(`${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 Ol=class extends dt{ctaExecutor=new Hn;constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=!1,r=await de.getCurrent().getNormalisedCart(),n=this.engagementTrigger.progressBarConfig,o,i=[],s=[],a=[],l,f,d=[...n.milestones];for(let E of d){if(E.rewardType!==nu.FREE_AUTO_GIFT)continue;if(E.isUIOnly&&!E.allowATC){w.verbose(`Skipping milestone ${E.label} as it is UI only and does not allow ATC`);continue}let y=E.items[0],C=E.reached,D=r.items.find(N=>(N.vID===y.vID||N.mID===y.mID)&&N.properties._letscooee_campaign===this.engagementTrigger.shortID);C&&(l=E,f=D),D&&i.push(D),!C&&D&&n.removeIneligibleItem?(w.verbose(`Removing free gift ${D.vID} from cart`),a.push(D)):C&&!D&&(w.verbose(`Adding free gift ${y.vID} to cart`),s.push(y))}n.restrictToLatestFreebie&&l&&(f?(i=i.filter(E=>E.vID!==f.vID),s=[]):s=[l.items[0]],a.push(...i)),a.length&&(await this.removeFreeGifts(a),e=!0),s.length&&(o=await this.ctaExecutor.addToCart(s,this.engagementTrigger),e=!0);let m=n.coupons;if(!m?.length){e&&Qe.get().refreshUI(o,!1);return}try{let E=m.map(D=>D.couponCode),y=de.getCurrent().discount_codes?.map(D=>D.code)??[];E.every(D=>y.some(N=>N===D))||(await Gr.applyWithStorefront(E),e=!0)}catch(E){ae(E,"cart-apply-discount",{extra:{coupons:m},engagementTrigger:this.engagementTrigger})}e&&Qe.get().refreshUI(o,!1)}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var Vs=class extends dt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.content}startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Nl=class extends vt{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Pl=class extends vt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Ll=class extends vt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,o=e.detail;if(!jt.hasKeys(o)){w.error(`No detail received for ${n}`);return}w.log("Detail received for BYOB",o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==r.shortID&&i!==r.engagementID){w.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let a=s.map(l=>new Ot({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new hn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:we.ADD_BUNDLE,applyDiscount:!0}})}};var sm=!1,am=!1,Ml=null,Bl=null,dv=!1;function hv(){dv||(dv=!0,xn(()=>{mv(document.body,{childList:!0,subtree:!0},500,pv).subscribe(()=>{vt.currentEngagements.forEach(t=>t.rerender()),dt.currentEngagements.forEach(t=>t.rerender())})}))}function cm(t){if(hv(),sm){w.verbose("Cart widget processing in progress, queuing latest triggers"),Ml=t;return}sm=!0;try{dT(t)}finally{if(sm=!1,Ml){let e=Ml;Ml=null,w.verbose("Processing queued cart triggers"),cm(e)}}}function lm(t){if(hv(),am){w.verbose("Page widget processing in progress, queuing latest triggers"),Bl=t;return}am=!0;try{hT(t)}finally{if(am=!1,Bl){let e=Bl;Bl=null,w.verbose("Processing queued page triggers"),lm(e)}}}function dT(t){yv(dt.currentEngagements,t);for(let e of t){w.info(`${e} received as cart embed`);let r=gv(dt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}w.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new Ol(e);else if(e.isSubscriptionUpsell()){Dl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Vs(e):n=new dt(e);dt.currentEngagements.add(n),n.renderSilently()}}function hT(t){yv(vt.currentEngagements,t);for(let e of t){w.info(`${e} received as page embed`);let r=gv(vt.currentEngagements,e);if(r){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}w.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Nl(e):e.isBYOB()?n=new Ll(e):e.isStickyATC()?n=new Pl(e):e.isSavingsBar()?n=new Vs(e):n=new vt(e),vt.currentEngagements.add(n),n.renderSilently()}}function gv(t,e){for(let r of t)if(r.matches(e))return r}function yv(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var _v=new Kt,vv=0;_v.pipe(Xt(50),Kp(t=>zp(Promise.all([gT().catch(e=>{ae(e,"load-page-widgets",{extra:{firstLoad:t}})}),yT().catch(e=>{ae(e,"load-cart-widgets",{extra:{firstLoad:t}})})])))).subscribe();function Ti(t=!1){xr(pr).then(()=>{_v.next(t)})}function Ev(){dt.currentEngagements.forEach(t=>t.rerender())}async function fv(t){let e=await dn();return Object.assign(t,e),Jt("/v1/engagement/get-variant",t)}async function gT(){vv++,vv===1?w.info("Fetch page widgets (after \u23F0",To()+" of SDK load)"):w.info("Fetch page widgets");let t=await dn(),e=_({},t);Jt("/v1/engagement/page-widgets",e).then(r=>{w.info(`Page widgets loaded in \u23F0 ${Jr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));lm(n)}).catch(r=>{w.error("Error sending widget getter",r)})}async function yT(){w.info("Fetch cart widgets");let t=await dn(),e=_({},t);Jt("/v1/engagement/cart-widgets",e).then(r=>{w.info(`Cart widgets loaded in \u23F0 ${Jr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));cm(n)}).catch(r=>{w.error("Error sending widget getter",r)})}var Ul=class{static processConfiguration(){let e=Ye.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&kl({gaClientID:e})}static async getClientID(){let e=await ze.get("gacid"),r=await this.getClientIDViaGTag();if(e!==r)return await ze.set("gacid",r),r}static async getClientIDViaGTag(){let r=Ye.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",o=>{n(o)})})}};var Fl=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){As.get("conf",{}).then(e=>this.updateGlobalConfig(e)),window.CooeeSDK.cartChange$.subscribe(()=>{Ti()})}async processAppConfigurations(e){w.verbose("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);As.set("conf",r).catch(n=>w.error(n)),Ul.processConfiguration(),r.website&&(Xg(r.website.commonJS),vp(r.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Xt(10)).subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(Ev(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Ce.globalRef.config.update(e);return Qe.forceUpdate(),w.verbose("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};It(new xe("View Cart",n))}};var pr=new bs(1),wv="App ID or Shopify shop is not set",um,qr=class t{coreService=Fl.getInstance();userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return um||(um=new t),um}async populateAuthDataFromStorage(){await this.getOrSetDeviceIDSafe(),this.userID=await ze.get("id"),this.updateAPIClient()}async isAuthenticated(){return!this.deviceID||await this.isNewSessionRequired()?!1:!await this.notSynced()}authenticate(e){if(w.verbose("Initialising SDK",e),jy(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}this.appID=e.appID,this.shopifyShop=e.shopifyShop,this.checkForNewSessionOnPageLoad().then(async()=>{pr.next(!0),pr.complete()}).catch(r=>{r?.message?.includes(wv)&&ae(r,"initiate-session",{extra:e}),w.error("Unable to initiate session",r)})}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await ze.set("id",e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await ze.set("did",e.deviceID)),this.updateAPIClient())}async checkSessionAndGetContext(){return await this.checkForNewSessionUnsafe(!1),this.getContext()}async checkForNewSessionOnPageLoad(){await this.checkForNewSessionSafe(!0)}async getOrSetDeviceIDSafe(){await ml.request("gen_did",async()=>{let e=await ze.get("did");e||(e=new yt().toHexString(),await ze.set("did",e)),this.deviceID=e,w.info("Device ID:",this.deviceID)})}async getContext(){xt.set("lastUsedTime",new Date().getTime());let[e,r,n]=await Promise.all([xt.get("id",""),ze.get("sessionNumber",1),xt.get("landing",{})]);return Bo({"cooee_session.number":r}),$a("Visitor Session",{id:e,number:r,landing_page:n}),{sessionID:e,sessionNumber:r,landingPage:n}}async checkForNewSessionSafe(e){await this.checkForNewSessionUnsafe(e)}async checkForNewSessionUnsafe(e){let r=!1;if(await this.isNewSessionRequired()?(w.info("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();w.info(`Session ID: ${n.sessionID} & number: ${n.sessionNumber}`),await this.validateSessionFromServer(Z(_({},n),{newSession:r})),await xt.set("synced",!0)}}async startNewSession(){w.verbose("Starting new session"),await xt.clear(),w.verbose("Cleared SessionStorage before starting new session");let e=new Date,r=new yt().toHexString();w.verbose("New session ID to be used",r);let n=await ze.get("sessionNumber",0)+1;await Promise.all([ze.set("sessionNumber",n),xt.set("id",r),xt.set("lastUsedTime",e.getTime()),xt.set("landing",Ys())])}async isNewSessionRequired(){if(!await xt.get("id"))return!0;let e=await xt.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async notSynced(){return!await xt.get("synced",!1)}async getSessionValidateData(e){if(!this.appID&&!this.shopifyShop)throw new Error(wv);let r=await qy(),n=Wc();return Z(_(_({deviceID:this.deviceID,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),n),{sdk:js,ad:fl.getAdParams(),occurred:vT(fe().jsLoadTime),properties:{}})}async validateSessionFromServer(e){w.verbose("Validating session with server"),await this.populateFirstSeen();let r=await this.getSessionValidateData(e);try{let n=await Jt("/v1/event/validate-session",r),o=n.data;w.info(`Auth finished in \u23F0 ${Jr(n.timeTakenMs)}`),w.verbose("Validate session Response",o),await this.coreService.processAppConfigurations(o.appSettings),await this.storeAndPopulateAuthData(o)}catch(n){throw w.error(n),n}}async populateFirstSeen(){let e=await ze.get("firstSeen"),r=e?new Date(e):new Date;e||await ze.set("firstSeen",r.toISOString()),Sv(r),$a("Visitor Info",{first_seen:r.toISOString()})}updateAPIClient(){this.userID&&w.info("User ID:",this.userID),wi.trackDeviceID(this.deviceID),bv(this.deviceID),$a("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),Dh({id:this.deviceID})}};function vT(t){return(new Date().getTime()-t.getTime())/1e3>1800?new Date:t}var _T="keepalive"in new Request(""),Yr=new Headers;ST();async function dn(){let[t]=await Promise.all([qr.getInstance().checkSessionAndGetContext()]);return _(_({},Wc()),t)}function bi(t){xr(pr).then(()=>ET(t??{}))}function ET(t){Tv("/v1/user/update",t).then(async e=>{w.verbose("Updated user profile"),await qr.getInstance().storeAndPopulateAuthData(e.data)}).catch(e=>{w.error("Error saving user profile",e)})}function lv(t){return Jt("/v1/event/generate-discount",t)}function kl(t){xr(pr).then(()=>wT({props:t}))}function wT(t){Tv("/v1/device/update",t).then(()=>{w.verbose("Updated device properties")}).catch(async e=>{w.error("Error saving device property",e)})}function bv(t){t&&Yr.set("cooee-device-id",t)}function Sv(t){t&&Yr.set("cooee-first-seen",t.toUTCString())}function Jt(t,e){return Iv("POST",t,e)}function Tv(t,e){return Iv("PUT",t,e)}function Iv(t,e,r){if(!ns()&&!fe().flags?.allowEvents)return w.log(`Rejecting ${t} ${e} as this is not e-commerce app`),Promise.reject();if(e.startsWith("http")||(e=gr.apiURL+e),r&&!_T&&e.includes(nm))try{return bT(e,Yr,r)}catch(o){throw ae(o,"http-request",{extra:{body:JSON.stringify(r)}}),o}let n={method:t,headers:Yr,keepalive:!1};return r&&(n.body=JSON.stringify(r)),tn(e,n)}function bT(t,e,r){return new Promise((n,o)=>{let i=new XMLHttpRequest;i.open("POST",t,!0),e.forEach((s,a)=>{i.setRequestHeader(a,s)}),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(i.status>=200&&i.status<300)try{if(i.getResponseHeader("Content-Type")?.includes("application/json")){let a=JSON.parse(i.responseText);n({data:a,headers:e,request:i,status:i.status,statusText:i.statusText})}else o(new Error("Content-Type of response header is not json"))}catch(s){o(s)}else o(new Error(`Received status - ${i.status}(${i.statusText})`))},i.onerror=()=>{o(new Error("Network error occurred during the request."))},i.send(JSON.stringify(r))})}function ST(){Yr.set("Content-Type","application/json; charset=utf-8"),Yr.set("cooee-sdk",js),Yr.set("cooee-sdk-code",Sm.toString()),Yr.set("cooee-sdk-version",Gs),Yr.set("cooee-shop-name",oc()??""),gr.debug&&Yr.set("cooee-sdk-debug",String(1))}var Hl=class{modifications=[];constructor(){}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){ba("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;if(!r?.length)return w.log("Nothing to experiment",e.toString()),!0;let n=!1;for(let o of r){if(!o.cssSelector){w.verbose("No CSS Selector available",e?.toString());continue}this.modifications.push(o);let i=Array.from(document.querySelectorAll(o.cssSelector));i?.length&&(this.executeSingleModification(o,i),n=!0)}return n}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n),e.moveTo?.selector&&this.changePlacement(e,n).catch(console.error)}async changePlacement(e,r){let n=await Cn(e.moveTo.selector);if(n)switch(e.moveTo.position){case Dt.BEFORE1:{r.nextElementSibling!==n&&n.parentElement?.insertBefore(r,n);break}case Dt.INSIDE_FIRST1:{n.firstChild!==r&&n.insertBefore(r,n.firstChild);break}case Dt.INSIDE_LAST1:{n.lastChild!==r&&n.appendChild(r);break}case Dt.AFTER1:default:r.previousElementSibling!==n&&n.parentElement?.insertBefore(r,n.nextSibling)}}trackExperimentRan(e){if(e.id==="preview"){w.warn("Skipping experiment attribution as its preview",e.toString());return}xv({name:"CE Experiment Start",experiment:new Ln(e)}).catch(r=>{w.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(o=>{o instanceof HTMLElement&&this.modifications.forEach(i=>{o.matches&&o.matches(i.cssSelector)?(w.verbose("Re-applying experiment",i.toString()),this.executeSingleModification(i,[o])):o.querySelectorAll&&(w.verbose("Re-applying experiment",i.toString()),this.executeSingleModification(i,Array.from(o.querySelectorAll(i.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,o=e.image?.sm?.src;!n&&!o||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:o},r):this.updateImageElement({desktop:n,mobile:o},r))}updateImageElement(e,r){jr()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let o=document.createElement("source");o.srcset=e.mobile,o.media="(max-width: 767px)",r.append(o)}if(e.desktop){let o=document.createElement("source");o.srcset=e.desktop,o.media="(min-width: 768px)",r.append(o)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};async function xv(t){let e=await dn(),r=_(_({},t),e);await Jt("/v1/event/experiment",r)}function $l(){TT().catch(t=>ae(t,"fetch-experiments"))}async function TT(){if(!fe().activeExperiments)return;await qr.getInstance().isAuthenticated()?await Cv():(await xr(pr),await Cv())}async function Cv(){w.info("Fetch experiments after \u23F0",To()+" of SDK load");let t=await dn(),e=_({},t);Jt("/v1/engagement/experiments",e).then(async r=>{w.info(`Experiments fetched in \u23F0 ${Jr(r.timeTakenMs)}`);let n=r.data.experiments.map(o=>new St(o));new Hl().execute(n)}).catch(r=>{w.error("Error sending experiment getter",r)})}var Vl=class{runtimeData=fe();meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{Ti()},e.loadExperiments=()=>{$l()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce),e.executeCTA=(r,n)=>{new hn(r).execute(n)},e.sendEvent=r=>{It(r)}}overwritePush(e,r){Lr(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(xm.includes(e[0])?Ce.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&IT(e.currentItem),e.currency&&(fe().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&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&de.getCurrent().update(e.cart),e.customContext&&(this.runtimeData.customContext=_(_({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(fe().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=uv();if(e||(e=fe().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new St({id:"preview",shortID:"1",redirectBehaviour:tr.CART_DRAWER});await new hn(new Cr(new Date,r)).execute({clickAction:{at:we.ADD_TO_CART},embeddedItem:new Ot({vID:e})})}};function IT(t){let e=fe();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID}});document.dispatchEvent(r)}e.currentItem=new Ot(t)}var Ii=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="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 xT=1e3,CT=10,fm=0,pm=new Date;function mm(t){Ii.remove("sleid"),pm=t??new Date}function Rv(){if(window.scrollY){let t=Ov();Av(t)&&Dv(t)}xn(()=>{RT()})}function RT(){ho(window,"scroll").pipe(Xt(xT),mn(()=>{let t=Ov();if(t>100){w.warn("Received scroll percent is more than 100",t);return}if(Av(t))return t})).subscribe(t=>{Dv(t)})}function Av(t){return Math.abs(fm-t)>=CT||fm!==t&&t===100}function Dv(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-pm.getTime()};fm=t;let r=Ii.getString("sleid",""),n=new xe("CE Scroll",e,null,r);It(n),Ii.setString("sleid",n.id.toHexString()),pm=new Date(n.occurred)}function Ov(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Nv(){AT()}function AT(){let t=window.fetch;window.fetch=async function(e,r){try{await DT(e,r)}catch(n){ae(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)},w.verbose("Securely overwritten window.fetch method for graphql query")}async function DT(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;n?.variables?.input&&(w.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await OT(n),NT()))}async function OT(t){let e=t.variables.input.attributes??[],r=await ja("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function NT(){let t=fe().currentItem;if(!t)return;let e=new xe("Buy Now Clicked",{items:[t]});It(e)}var xi=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 xe(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});It(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>w.error(e))}async listen(){this.elements=await Rf(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Wl=class t extends xi{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,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var jl=class t extends xi{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,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var PT=[".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(",");function Pv(){xn(()=>{w.verbose("Execution order:","document ready"),LT()})}function LT(){let t=window.location.hash?.substring(1);if(t)if(t.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let e=document.querySelector(PT);if(!e){w.verbose("No clickable cart checkout button found");return}w.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&Qe.get().open()}function Mv(){window.addEventListener("kp-modal:opened",()=>{fe().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&bi({goKwikToken:e})}),window.gokwikSdk?Lv():window.addEventListener("gokwikLoaded",Lv)}function Lv(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await de.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new xe("Checkout Started",e);It(r)})}var Gl=class{static watch(){let e=Dm();(e==="1"||e==="on")&&kl({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar()}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,xn(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){window.cooeeSDKPreview||(this.initGlobalReference(e),await qr.getInstance().populateAuthDataFromStorage(),this.autoAuthenticate(),new Vl().meddle(),Bm(),Ti(!0),$l(),Xy(),nv(),Nv(),Pv(),Rv(),jl.getInstance().listenSilently(),Wl.getInstance().listenSilently(),Mv(),MT(),Gl.watch())}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Lr(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Lr(this.globalRef,"config",new Ye),Lr(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Lr(this.globalRef,"uaParser",new Tr,!0),Lr(this.globalRef,"cart",de.getCurrent()),Lr(this.globalRef,"cartChange$",rv()),Lr(this.globalRef,"cartDrawerToggle$",Qe.cartDrawerToggle$.asObservable()),w.verbose("Global reference initialised"),new Nc(()=>{this.globalRef.uaParser=new Tr})}static injectWidgetAssets(){Yg(gr.widgetURL,"cooee-widget-sdk"),yp()}static autoAuthenticate(){let e=oc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;w.info("Begin auth after \u23F0",To(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((xf(r)||r.length!==24)&&xf(n)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,qr.getInstance().authenticate(e)}static sendEvent(e,r,n){let o=new xe(e,r,n?.triggerData);n?.occurred&&(o.occurred=n.occurred),It(o)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");bi(e)}static setPageName(e){if(!e)return;let r=fe(),n=r.pageName;if(e===n)return;if(r.pageName=e,Tm.some(s=>e.includes(s))){mm();return}let o={};n&&(o.ps=n);let i=new xe("CE Screen View",o);i.occurred=r.jsLoadTime,It(i),mm(i.occurred)}static previewPopup(e,r){new $n(r).render(e)}static previewWidget(e){new vt(new St(e)).renderSilently()}};function MT(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){w.error(t)}window.addEventListener("message",t=>{if(w.verbose("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(Ce.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(Ce.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}var Bv=new Date;Rm();Om();w.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.verbose("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(Bv),await Ce.initForAll(),BT(),w.verbose("Execution order:","IIFE end")))());w.verbose("Execution order:","bottom");function BT(){Am()&&import("./debug-logs-2IMHJ2YP.js").then(({printAllDebugLogs:t})=>t(Bv))}