@letscooee/web-sdk 13.1.9 → 13.1.11
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/chunk-7XDM4HDH.js +1 -0
- package/dist/{chunk-ODA4FRXD.js → chunk-BJ5UBWZZ.js} +1 -1
- package/dist/chunk-CFZOV3EF.js +6 -0
- package/dist/chunk-GIEYLCFF.js +4 -0
- package/dist/chunk-JAIJ74CO.js +39 -0
- package/dist/chunk-MHKDPBHM.js +8 -0
- package/dist/{chunk-EJH6GSNR.js → chunk-Z7UUW7XD.js} +2 -2
- package/dist/{chunk-KJQW3WFK.js → chunk-ZFMH37WK.js} +1 -1
- package/dist/debugger.component-UQRQT3KM.js +7 -0
- package/dist/main.min.js +7 -45
- package/dist/renderer-7THALERZ.js +1 -0
- package/dist/sdk-debug-logs-PG5BE6E3.js +1 -0
- package/dist/share-dialog.component-OXWTLKYG.js +1 -0
- package/dist/video-detail-dialog.component-E4FB7GMC.js +2 -0
- package/dist/widget.min.js +5 -5
- package/package.json +2 -2
- package/dist/chunk-3FC4J3DE.js +0 -1
- package/dist/chunk-6BNGPIT6.js +0 -4
- package/dist/chunk-I2DJTZ62.js +0 -8
- package/dist/chunk-ICI7BO4Q.js +0 -1
- package/dist/chunk-T263X3DM.js +0 -1
- package/dist/chunk-WTCNMWSD.js +0 -6
- package/dist/debug-logs-J2VHCTDA.js +0 -1
- package/dist/debugger.component-KKAN5FYA.js +0 -6
- package/dist/resource-metrics-EW2N36H5.js +0 -1
- package/dist/share-dialog.component-4S4XKPRU.js +0 -1
- package/dist/video-detail-dialog.component-76UPZ4UM.js +0 -2
package/dist/main.min.js
CHANGED
|
@@ -1,49 +1,11 @@
|
|
|
1
|
-
import{a as Ro,b as Do,c as Ql,d as Zl,e as eu,f as tu,g as ru,h as nu,i as Rt,j as Oo,k as v,l as iu,m as ou,n as su,o as au,p as nr,r as Ti}from"./chunk-I2DJTZ62.js";import{a as B,b as Re,c as xi,e as qa,g as br,h as Dn}from"./chunk-U4XWPFUW.js";var za=qa(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.URLBuilder=void 0;var Ud=(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})();Po.URLBuilder=Ud});var hu=qa((du,tc)=>{"use strict";(function(t){if(typeof du=="object"&&typeof tc<"u")tc.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(i,o,s){function l(g,y){if(!o[g]){if(!i[g]){var E=typeof xi=="function"&ξif(!y&&E)return E(g,!0);if(u)return u(g,!0);var b=new Error("Cannot find module '"+g+"'");throw b.code="MODULE_NOT_FOUND",b}var I=o[g]={exports:{}};i[g][0].call(I.exports,function(L){var D=i[g][1][L];return l(D||L)},I,I.exports,n,i,o,s)}return o[g].exports}for(var u=typeof xi=="function"&&xi,h=0;h<s.length;h++)l(s[h]);return l})({1:[function(n,i,o){(function(s){"use strict";var l=s.MutationObserver||s.WebKitMutationObserver,u;if(l){var h=0,g=new l(L),y=s.document.createTextNode("");g.observe(y,{characterData:!0}),u=function(){y.data=h=++h%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=L,u=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?u=function(){var U=s.document.createElement("script");U.onreadystatechange=function(){L(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},s.document.documentElement.appendChild(U)}:u=function(){setTimeout(L,0)};var b,I=[];function L(){b=!0;for(var U,q,P=I.length;P;){for(q=I,I=[],U=-1;++U<P;)q[U]();P=I.length}b=!1}i.exports=D;function D(U){I.push(U)===1&&!b&&u()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function l(){}var u={},h=["REJECTED"],g=["FULFILLED"],y=["PENDING"];i.exports=E;function E(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=y,this.queue=[],this.outcome=void 0,X!==l&&D(this,X)}E.prototype.catch=function(X){return this.then(null,X)},E.prototype.then=function(X,oe){if(typeof X!="function"&&this.state===g||typeof oe!="function"&&this.state===h)return this;var ne=new this.constructor(l);if(this.state!==y){var ue=this.state===g?X:oe;I(ne,ue,this.outcome)}else this.queue.push(new b(ne,X,oe));return ne};function b(X,oe,ne){this.promise=X,typeof oe=="function"&&(this.onFulfilled=oe,this.callFulfilled=this.otherCallFulfilled),typeof ne=="function"&&(this.onRejected=ne,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(X){u.resolve(this.promise,X)},b.prototype.otherCallFulfilled=function(X){I(this.promise,this.onFulfilled,X)},b.prototype.callRejected=function(X){u.reject(this.promise,X)},b.prototype.otherCallRejected=function(X){I(this.promise,this.onRejected,X)};function I(X,oe,ne){s(function(){var ue;try{ue=oe(ne)}catch(Pe){return u.reject(X,Pe)}ue===X?u.reject(X,new TypeError("Cannot resolve promise with itself")):u.resolve(X,ue)})}u.resolve=function(X,oe){var ne=U(L,oe);if(ne.status==="error")return u.reject(X,ne.value);var ue=ne.value;if(ue)D(X,ue);else{X.state=g,X.outcome=oe;for(var Pe=-1,be=X.queue.length;++Pe<be;)X.queue[Pe].callFulfilled(oe)}return X},u.reject=function(X,oe){X.state=h,X.outcome=oe;for(var ne=-1,ue=X.queue.length;++ne<ue;)X.queue[ne].callRejected(oe);return X};function L(X){var oe=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof oe=="function")return function(){oe.apply(X,arguments)}}function D(X,oe){var ne=!1;function ue($e){ne||(ne=!0,u.reject(X,$e))}function Pe($e){ne||(ne=!0,u.resolve(X,$e))}function be(){oe(Pe,ue)}var Ce=U(be);Ce.status==="error"&&ue(Ce.value)}function U(X,oe){var ne={};try{ne.value=X(oe),ne.status="success"}catch(ue){ne.status="error",ne.value=ue}return ne}E.resolve=q;function q(X){return X instanceof this?X:u.resolve(new this(l),X)}E.reject=P;function P(X){var oe=new this(l);return u.reject(oe,X)}E.all=Q;function Q(X){var oe=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var ne=X.length,ue=!1;if(!ne)return this.resolve([]);for(var Pe=new Array(ne),be=0,Ce=-1,$e=new this(l);++Ce<ne;)ze(X[Ce],Ce);return $e;function ze(St,R){oe.resolve(St).then(T,function($){ue||(ue=!0,u.reject($e,$))});function T($){Pe[R]=$,++be===ne&&!ue&&(ue=!0,u.resolve($e,Pe))}}}E.race=ge;function ge(X){var oe=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var ne=X.length,ue=!1;if(!ne)return this.resolve([]);for(var Pe=-1,be=new this(l);++Pe<ne;)Ce(X[Pe]);return be;function Ce($e){oe.resolve($e).then(function(ze){ue||(ue=!0,u.resolve(be,ze))},function(ze){ue||(ue=!0,u.reject(be,ze))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f};function l(f,w){if(!(f instanceof w))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var h=u();function g(){try{if(!h||!h.open)return!1;var f=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!f||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function y(f,w){f=f||[],w=w||{};try{return new Blob(f,w)}catch(_){if(_.name!=="TypeError")throw _;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,S=new m,C=0;C<f.length;C+=1)S.append(f[C]);return S.getBlob(w.type)}}typeof Promise>"u"&&n(3);var E=Promise;function b(f,w){w&&f.then(function(m){w(null,m)},function(m){w(m)})}function I(f,w,m){typeof w=="function"&&f.then(w),typeof m=="function"&&f.catch(m)}function L(f){return typeof f!="string"&&(console.warn(f+" used as a key, but it is not a string."),f=String(f)),f}function D(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var U="local-forage-detect-blob-support",q=void 0,P={},Q=Object.prototype.toString,ge="readonly",X="readwrite";function oe(f){for(var w=f.length,m=new ArrayBuffer(w),S=new Uint8Array(m),C=0;C<w;C++)S[C]=f.charCodeAt(C);return m}function ne(f){return new E(function(w){var m=f.transaction(U,X),S=y([""]);m.objectStore(U).put(S,"key"),m.onabort=function(C){C.preventDefault(),C.stopPropagation(),w(!1)},m.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),_=navigator.userAgent.match(/Edge\//);w(_||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function ue(f){return typeof q=="boolean"?E.resolve(q):ne(f).then(function(w){return q=w,q})}function Pe(f){var w=P[f.name],m={};m.promise=new E(function(S,C){m.resolve=S,m.reject=C}),w.deferredOperations.push(m),w.dbReady?w.dbReady=w.dbReady.then(function(){return m.promise}):w.dbReady=m.promise}function be(f){var w=P[f.name],m=w.deferredOperations.pop();if(m)return m.resolve(),m.promise}function Ce(f,w){var m=P[f.name],S=m.deferredOperations.pop();if(S)return S.reject(w),S.promise}function $e(f,w){return new E(function(m,S){if(P[f.name]=P[f.name]||We(),f.db)if(w)Pe(f),f.db.close();else return m(f.db);var C=[f.name];w&&C.push(f.version);var _=h.open.apply(h,C);w&&(_.onupgradeneeded=function(N){var G=_.result;try{G.createObjectStore(f.storeName),N.oldVersion<=1&&G.createObjectStore(U)}catch(z){if(z.name==="ConstraintError")console.warn('The database "'+f.name+'" has been upgraded from version '+N.oldVersion+" to version "+N.newVersion+', but the storage "'+f.storeName+'" already exists.');else throw z}}),_.onerror=function(N){N.preventDefault(),S(_.error)},_.onsuccess=function(){var N=_.result;N.onversionchange=function(G){G.target.close()},m(N),be(f)}})}function ze(f){return $e(f,!1)}function St(f){return $e(f,!0)}function R(f,w){if(!f.db)return!0;var m=!f.db.objectStoreNames.contains(f.storeName),S=f.version<f.db.version,C=f.version>f.db.version;if(S&&(f.version!==w&&console.warn('The database "'+f.name+`" can't be downgraded from version `+f.db.version+" to version "+f.version+"."),f.version=f.db.version),C||m){if(m){var _=f.db.version+1;_>f.version&&(f.version=_)}return!0}return!1}function T(f){return new E(function(w,m){var S=new FileReader;S.onerror=m,S.onloadend=function(C){var _=btoa(C.target.result||"");w({__local_forage_encoded_blob:!0,data:_,type:f.type})},S.readAsBinaryString(f)})}function $(f){var w=oe(atob(f.data));return y([w],{type:f.type})}function k(f){return f&&f.__local_forage_encoded_blob}function H(f){var w=this,m=w._initReady().then(function(){var S=P[w._dbInfo.name];if(S&&S.dbReady)return S.dbReady});return I(m,f,f),m}function te(f){Pe(f);for(var w=P[f.name],m=w.forages,S=0;S<m.length;S++){var C=m[S];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return f.db=null,ze(f).then(function(_){return f.db=_,R(f)?St(f):_}).then(function(_){f.db=w.db=_;for(var N=0;N<m.length;N++)m[N]._dbInfo.db=_}).catch(function(_){throw Ce(f,_),_})}function fe(f,w,m,S){S===void 0&&(S=1);try{var C=f.db.transaction(f.storeName,w);m(null,C)}catch(_){if(S>0&&(!f.db||_.name==="InvalidStateError"||_.name==="NotFoundError"))return E.resolve().then(function(){if(!f.db||_.name==="NotFoundError"&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),St(f)}).then(function(){return te(f).then(function(){fe(f,w,m,S-1)})}).catch(m);m(_)}}function We(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ke(f){var w=this,m={db:null};if(f)for(var S in f)m[S]=f[S];var C=P[m.name];C||(C=We(),P[m.name]=C),C.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=H);var _=[];function N(){return E.resolve()}for(var G=0;G<C.forages.length;G++){var z=C.forages[G];z!==w&&_.push(z._initReady().catch(N))}var Y=C.forages.slice(0);return E.all(_).then(function(){return m.db=C.db,ze(m)}).then(function(J){return m.db=J,R(m,w._defaultConfig.version)?St(m):J}).then(function(J){m.db=C.db=J,w._dbInfo=m;for(var Z=0;Z<Y.length;Z++){var de=Y[Z];de!==w&&(de._dbInfo.db=m.db,de._dbInfo.version=m.version)}})}function Xe(f,w){var m=this;f=L(f);var S=new E(function(C,_){m.ready().then(function(){fe(m._dbInfo,ge,function(N,G){if(N)return _(N);try{var z=G.objectStore(m._dbInfo.storeName),Y=z.get(f);Y.onsuccess=function(){var J=Y.result;J===void 0&&(J=null),k(J)&&(J=$(J)),C(J)},Y.onerror=function(){_(Y.error)}}catch(J){_(J)}})}).catch(_)});return b(S,w),S}function ut(f,w){var m=this,S=new E(function(C,_){m.ready().then(function(){fe(m._dbInfo,ge,function(N,G){if(N)return _(N);try{var z=G.objectStore(m._dbInfo.storeName),Y=z.openCursor(),J=1;Y.onsuccess=function(){var Z=Y.result;if(Z){var de=Z.value;k(de)&&(de=$(de));var Ie=f(de,Z.key,J++);Ie!==void 0?C(Ie):Z.continue()}else C()},Y.onerror=function(){_(Y.error)}}catch(Z){_(Z)}})}).catch(_)});return b(S,w),S}function ft(f,w,m){var S=this;f=L(f);var C=new E(function(_,N){var G;S.ready().then(function(){return G=S._dbInfo,Q.call(w)==="[object Blob]"?ue(G.db).then(function(z){return z?w:T(w)}):w}).then(function(z){fe(S._dbInfo,X,function(Y,J){if(Y)return N(Y);try{var Z=J.objectStore(S._dbInfo.storeName);z===null&&(z=void 0);var de=Z.put(z,f);J.oncomplete=function(){z===void 0&&(z=null),_(z)},J.onabort=J.onerror=function(){var Ie=de.error?de.error:de.transaction.error;N(Ie)}}catch(Ie){N(Ie)}})}).catch(N)});return b(C,m),C}function tt(f,w){var m=this;f=L(f);var S=new E(function(C,_){m.ready().then(function(){fe(m._dbInfo,X,function(N,G){if(N)return _(N);try{var z=G.objectStore(m._dbInfo.storeName),Y=z.delete(f);G.oncomplete=function(){C()},G.onerror=function(){_(Y.error)},G.onabort=function(){var J=Y.error?Y.error:Y.transaction.error;_(J)}}catch(J){_(J)}})}).catch(_)});return b(S,w),S}function ve(f){var w=this,m=new E(function(S,C){w.ready().then(function(){fe(w._dbInfo,X,function(_,N){if(_)return C(_);try{var G=N.objectStore(w._dbInfo.storeName),z=G.clear();N.oncomplete=function(){S()},N.onabort=N.onerror=function(){var Y=z.error?z.error:z.transaction.error;C(Y)}}catch(Y){C(Y)}})}).catch(C)});return b(m,f),m}function Ue(f){var w=this,m=new E(function(S,C){w.ready().then(function(){fe(w._dbInfo,ge,function(_,N){if(_)return C(_);try{var G=N.objectStore(w._dbInfo.storeName),z=G.count();z.onsuccess=function(){S(z.result)},z.onerror=function(){C(z.error)}}catch(Y){C(Y)}})}).catch(C)});return b(m,f),m}function xe(f,w){var m=this,S=new E(function(C,_){if(f<0){C(null);return}m.ready().then(function(){fe(m._dbInfo,ge,function(N,G){if(N)return _(N);try{var z=G.objectStore(m._dbInfo.storeName),Y=!1,J=z.openKeyCursor();J.onsuccess=function(){var Z=J.result;if(!Z){C(null);return}f===0||Y?C(Z.key):(Y=!0,Z.advance(f))},J.onerror=function(){_(J.error)}}catch(Z){_(Z)}})}).catch(_)});return b(S,w),S}function ke(f){var w=this,m=new E(function(S,C){w.ready().then(function(){fe(w._dbInfo,ge,function(_,N){if(_)return C(_);try{var G=N.objectStore(w._dbInfo.storeName),z=G.openKeyCursor(),Y=[];z.onsuccess=function(){var J=z.result;if(!J){S(Y);return}Y.push(J.key),J.continue()},z.onerror=function(){C(z.error)}}catch(J){C(J)}})}).catch(C)});return b(m,f),m}function Te(f,w){w=D.apply(this,arguments);var m=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||m.name,f.storeName=f.storeName||m.storeName);var S=this,C;if(!f.name)C=E.reject("Invalid arguments");else{var _=f.name===m.name&&S._dbInfo.db,N=_?E.resolve(S._dbInfo.db):ze(f).then(function(G){var z=P[f.name],Y=z.forages;z.db=G;for(var J=0;J<Y.length;J++)Y[J]._dbInfo.db=G;return G});f.storeName?C=N.then(function(G){if(G.objectStoreNames.contains(f.storeName)){var z=G.version+1;Pe(f);var Y=P[f.name],J=Y.forages;G.close();for(var Z=0;Z<J.length;Z++){var de=J[Z];de._dbInfo.db=null,de._dbInfo.version=z}var Ie=new E(function(De,Qe){var Ye=h.open(f.name,z);Ye.onerror=function(Mt){var Ci=Ye.result;Ci.close(),Qe(Mt)},Ye.onupgradeneeded=function(){var Mt=Ye.result;Mt.deleteObjectStore(f.storeName)},Ye.onsuccess=function(){var Mt=Ye.result;Mt.close(),De(Mt)}});return Ie.then(function(De){Y.db=De;for(var Qe=0;Qe<J.length;Qe++){var Ye=J[Qe];Ye._dbInfo.db=De,be(Ye._dbInfo)}}).catch(function(De){throw(Ce(f,De)||E.resolve()).catch(function(){}),De})}}):C=N.then(function(G){Pe(f);var z=P[f.name],Y=z.forages;G.close();for(var J=0;J<Y.length;J++){var Z=Y[J];Z._dbInfo.db=null}var de=new E(function(Ie,De){var Qe=h.deleteDatabase(f.name);Qe.onerror=function(){var Ye=Qe.result;Ye&&Ye.close(),De(Qe.error)},Qe.onblocked=function(){console.warn('dropInstance blocked for database "'+f.name+'" until all open connections are closed')},Qe.onsuccess=function(){var Ye=Qe.result;Ye&&Ye.close(),Ie(Ye)}});return de.then(function(Ie){z.db=Ie;for(var De=0;De<Y.length;De++){var Qe=Y[De];be(Qe._dbInfo)}}).catch(function(Ie){throw(Ce(f,Ie)||E.resolve()).catch(function(){}),Ie})})}return b(C,w),C}var It={_driver:"asyncStorage",_initStorage:Ke,_support:g(),iterate:ut,getItem:Xe,setItem:ft,removeItem:tt,clear:ve,length:Ue,key:xe,keys:ke,dropInstance:Te};function p(){return typeof openDatabase=="function"}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="~~local_forage_type~",d=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ae="blob",ye="si08",pe="ui08",Ae="uic8",Be="si16",Je="si32",Kt="ur16",wr="ui32",In="fl32",Xt="fl64",Jt=O+W.length,jl=Object.prototype.toString;function Gl(f){var w=f.length*.75,m=f.length,S,C=0,_,N,G,z;f[f.length-1]==="="&&(w--,f[f.length-2]==="="&&w--);var Y=new ArrayBuffer(w),J=new Uint8Array(Y);for(S=0;S<m;S+=4)_=a.indexOf(f[S]),N=a.indexOf(f[S+1]),G=a.indexOf(f[S+2]),z=a.indexOf(f[S+3]),J[C++]=_<<2|N>>4,J[C++]=(N&15)<<4|G>>2,J[C++]=(G&3)<<6|z&63;return Y}function Ha(f){var w=new Uint8Array(f),m="",S;for(S=0;S<w.length;S+=3)m+=a[w[S]>>2],m+=a[(w[S]&3)<<4|w[S+1]>>4],m+=a[(w[S+1]&15)<<2|w[S+2]>>6],m+=a[w[S+2]&63];return w.length%3===2?m=m.substring(0,m.length-1)+"=":w.length%3===1&&(m=m.substring(0,m.length-2)+"=="),m}function Zm(f,w){var m="";if(f&&(m=jl.call(f)),f&&(m==="[object ArrayBuffer]"||f.buffer&&jl.call(f.buffer)==="[object ArrayBuffer]")){var S,C=x;f instanceof ArrayBuffer?(S=f,C+=W):(S=f.buffer,m==="[object Int8Array]"?C+=ye:m==="[object Uint8Array]"?C+=pe:m==="[object Uint8ClampedArray]"?C+=Ae:m==="[object Int16Array]"?C+=Be:m==="[object Uint16Array]"?C+=Kt:m==="[object Int32Array]"?C+=Je:m==="[object Uint32Array]"?C+=wr:m==="[object Float32Array]"?C+=In:m==="[object Float64Array]"?C+=Xt:w(new Error("Failed to get type for BinaryArray"))),w(C+Ha(S))}else if(m==="[object Blob]"){var _=new FileReader;_.onload=function(){var N=c+f.type+"~"+Ha(this.result);w(x+ae+N)},_.readAsArrayBuffer(f)}else try{w(JSON.stringify(f))}catch(N){console.error("Couldn't convert value into a JSON string: ",f),w(null,N)}}function ed(f){if(f.substring(0,O)!==x)return JSON.parse(f);var w=f.substring(Jt),m=f.substring(O,Jt),S;if(m===ae&&d.test(w)){var C=w.match(d);S=C[1],w=w.substring(C[0].length)}var _=Gl(w);switch(m){case W:return _;case ae:return y([_],{type:S});case ye:return new Int8Array(_);case pe:return new Uint8Array(_);case Ae:return new Uint8ClampedArray(_);case Be:return new Int16Array(_);case Kt:return new Uint16Array(_);case Je:return new Int32Array(_);case wr:return new Uint32Array(_);case In:return new Float32Array(_);case Xt:return new Float64Array(_);default:throw new Error("Unkown type: "+m)}}var Va={serialize:Zm,deserialize:ed,stringToBuffer:Gl,bufferToString:Ha};function ql(f,w,m,S){f.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,S)}function td(f){var w=this,m={db:null};if(f)for(var S in f)m[S]=typeof f[S]!="string"?f[S].toString():f[S];var C=new E(function(_,N){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(G){return N(G)}m.db.transaction(function(G){ql(G,m,function(){w._dbInfo=m,_()},function(z,Y){N(Y)})},N)});return m.serializer=Va,C}function Br(f,w,m,S,C,_){f.executeSql(m,S,C,function(N,G){G.code===G.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(z,Y){Y.rows.length?_(z,G):ql(z,w,function(){z.executeSql(m,S,C,_)},_)},_):_(N,G)},_)}function rd(f,w){var m=this;f=L(f);var S=new E(function(C,_){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(G){Br(G,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[f],function(z,Y){var J=Y.rows.length?Y.rows.item(0).value:null;J&&(J=N.serializer.deserialize(J)),C(J)},function(z,Y){_(Y)})})}).catch(_)});return b(S,w),S}function nd(f,w){var m=this,S=new E(function(C,_){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(G){Br(G,N,"SELECT * FROM "+N.storeName,[],function(z,Y){for(var J=Y.rows,Z=J.length,de=0;de<Z;de++){var Ie=J.item(de),De=Ie.value;if(De&&(De=N.serializer.deserialize(De)),De=f(De,Ie.key,de+1),De!==void 0){C(De);return}}C()},function(z,Y){_(Y)})})}).catch(_)});return b(S,w),S}function zl(f,w,m,S){var C=this;f=L(f);var _=new E(function(N,G){C.ready().then(function(){w===void 0&&(w=null);var z=w,Y=C._dbInfo;Y.serializer.serialize(w,function(J,Z){Z?G(Z):Y.db.transaction(function(de){Br(de,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[f,J],function(){N(z)},function(Ie,De){G(De)})},function(de){if(de.code===de.QUOTA_ERR){if(S>0){N(zl.apply(C,[f,z,m,S-1]));return}G(de)}})})}).catch(G)});return b(_,m),_}function id(f,w,m){return zl.apply(this,[f,w,m,1])}function od(f,w){var m=this;f=L(f);var S=new E(function(C,_){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(G){Br(G,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[f],function(){C()},function(z,Y){_(Y)})})}).catch(_)});return b(S,w),S}function sd(f){var w=this,m=new E(function(S,C){w.ready().then(function(){var _=w._dbInfo;_.db.transaction(function(N){Br(N,_,"DELETE FROM "+_.storeName,[],function(){S()},function(G,z){C(z)})})}).catch(C)});return b(m,f),m}function ad(f){var w=this,m=new E(function(S,C){w.ready().then(function(){var _=w._dbInfo;_.db.transaction(function(N){Br(N,_,"SELECT COUNT(key) as c FROM "+_.storeName,[],function(G,z){var Y=z.rows.item(0).c;S(Y)},function(G,z){C(z)})})}).catch(C)});return b(m,f),m}function cd(f,w){var m=this,S=new E(function(C,_){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(G){Br(G,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[f+1],function(z,Y){var J=Y.rows.length?Y.rows.item(0).key:null;C(J)},function(z,Y){_(Y)})})}).catch(_)});return b(S,w),S}function ld(f){var w=this,m=new E(function(S,C){w.ready().then(function(){var _=w._dbInfo;_.db.transaction(function(N){Br(N,_,"SELECT key FROM "+_.storeName,[],function(G,z){for(var Y=[],J=0;J<z.rows.length;J++)Y.push(z.rows.item(J).key);S(Y)},function(G,z){C(z)})})}).catch(C)});return b(m,f),m}function ud(f){return new E(function(w,m){f.transaction(function(S){S.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,_){for(var N=[],G=0;G<_.rows.length;G++)N.push(_.rows.item(G).name);w({db:f,storeNames:N})},function(C,_){m(_)})},function(S){m(S)})})}function fd(f,w){w=D.apply(this,arguments);var m=this.config();f=typeof f!="function"&&f||{},f.name||(f.name=f.name||m.name,f.storeName=f.storeName||m.storeName);var S=this,C;return f.name?C=new E(function(_){var N;f.name===m.name?N=S._dbInfo.db:N=openDatabase(f.name,"","",0),f.storeName?_({db:N,storeNames:[f.storeName]}):_(ud(N))}).then(function(_){return new E(function(N,G){_.db.transaction(function(z){function Y(Ie){return new E(function(De,Qe){z.executeSql("DROP TABLE IF EXISTS "+Ie,[],function(){De()},function(Ye,Mt){Qe(Mt)})})}for(var J=[],Z=0,de=_.storeNames.length;Z<de;Z++)J.push(Y(_.storeNames[Z]));E.all(J).then(function(){N()}).catch(function(Ie){G(Ie)})},function(z){G(z)})})}):C=E.reject("Invalid arguments"),b(C,w),C}var pd={_driver:"webSQLStorage",_initStorage:td,_support:p(),iterate:nd,getItem:rd,setItem:id,removeItem:od,clear:sd,length:ad,key:cd,keys:ld,dropInstance:fd};function md(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Yl(f,w){var m=f.name+"/";return f.storeName!==w.storeName&&(m+=f.storeName+"/"),m}function dd(){var f="_localforage_support_test";try{return localStorage.setItem(f,!0),localStorage.removeItem(f),!1}catch{return!0}}function hd(){return!dd()||localStorage.length>0}function gd(f){var w=this,m={};if(f)for(var S in f)m[S]=f[S];return m.keyPrefix=Yl(f,w._defaultConfig),hd()?(w._dbInfo=m,m.serializer=Va,E.resolve()):E.reject()}function yd(f){var w=this,m=w.ready().then(function(){for(var S=w._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var _=localStorage.key(C);_.indexOf(S)===0&&localStorage.removeItem(_)}});return b(m,f),m}function vd(f,w){var m=this;f=L(f);var S=m.ready().then(function(){var C=m._dbInfo,_=localStorage.getItem(C.keyPrefix+f);return _&&(_=C.serializer.deserialize(_)),_});return b(S,w),S}function wd(f,w){var m=this,S=m.ready().then(function(){for(var C=m._dbInfo,_=C.keyPrefix,N=_.length,G=localStorage.length,z=1,Y=0;Y<G;Y++){var J=localStorage.key(Y);if(J.indexOf(_)===0){var Z=localStorage.getItem(J);if(Z&&(Z=C.serializer.deserialize(Z)),Z=f(Z,J.substring(N),z++),Z!==void 0)return Z}}});return b(S,w),S}function bd(f,w){var m=this,S=m.ready().then(function(){var C=m._dbInfo,_;try{_=localStorage.key(f)}catch{_=null}return _&&(_=_.substring(C.keyPrefix.length)),_});return b(S,w),S}function Ed(f){var w=this,m=w.ready().then(function(){for(var S=w._dbInfo,C=localStorage.length,_=[],N=0;N<C;N++){var G=localStorage.key(N);G.indexOf(S.keyPrefix)===0&&_.push(G.substring(S.keyPrefix.length))}return _});return b(m,f),m}function _d(f){var w=this,m=w.keys().then(function(S){return S.length});return b(m,f),m}function Sd(f,w){var m=this;f=L(f);var S=m.ready().then(function(){var C=m._dbInfo;localStorage.removeItem(C.keyPrefix+f)});return b(S,w),S}function Cd(f,w,m){var S=this;f=L(f);var C=S.ready().then(function(){w===void 0&&(w=null);var _=w;return new E(function(N,G){var z=S._dbInfo;z.serializer.serialize(w,function(Y,J){if(J)G(J);else try{localStorage.setItem(z.keyPrefix+f,Y),N(_)}catch(Z){(Z.name==="QuotaExceededError"||Z.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(Z),G(Z)}})})});return b(C,m),C}function xd(f,w){if(w=D.apply(this,arguments),f=typeof f!="function"&&f||{},!f.name){var m=this.config();f.name=f.name||m.name,f.storeName=f.storeName||m.storeName}var S=this,C;return f.name?C=new E(function(_){f.storeName?_(Yl(f,S._defaultConfig)):_(f.name+"/")}).then(function(_){for(var N=localStorage.length-1;N>=0;N--){var G=localStorage.key(N);G.indexOf(_)===0&&localStorage.removeItem(G)}}):C=E.reject("Invalid arguments"),b(C,w),C}var Td={_driver:"localStorageWrapper",_initStorage:gd,_support:md(),iterate:wd,getItem:vd,setItem:Cd,removeItem:Sd,clear:yd,length:_d,key:bd,keys:Ed,dropInstance:xd},Id=function(w,m){return w===m||typeof w=="number"&&typeof m=="number"&&isNaN(w)&&isNaN(m)},Rd=function(w,m){for(var S=w.length,C=0;C<S;){if(Id(w[C],m))return!0;C++}return!1},Kl=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"},Si={},Xl={},Rn={INDEXEDDB:It,WEBSQL:pd,LOCALSTORAGE:Td},Dd=[Rn.INDEXEDDB._driver,Rn.WEBSQL._driver,Rn.LOCALSTORAGE._driver],Io=["dropInstance"],$a=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Io),Od={description:"",driver:Dd.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Pd(f,w){f[w]=function(){var m=arguments;return f.ready().then(function(){return f[w].apply(f,m)})}}function Wa(){for(var f=1;f<arguments.length;f++){var w=arguments[f];if(w)for(var m in w)w.hasOwnProperty(m)&&(Kl(w[m])?arguments[0][m]=w[m].slice():arguments[0][m]=w[m])}return arguments[0]}var Ad=(function(){function f(w){l(this,f);for(var m in Rn)if(Rn.hasOwnProperty(m)){var S=Rn[m],C=S._driver;this[m]=C,Si[C]||this.defineDriver(S)}this._defaultConfig=Wa({},Od),this._config=Wa({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return f.prototype.config=function(m){if((typeof m>"u"?"undefined":s(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var S in m){if(S==="storeName"&&(m[S]=m[S].replace(/\W/g,"_")),S==="version"&&typeof m[S]!="number")return new Error("Database version must be a number.");this._config[S]=m[S]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},f.prototype.defineDriver=function(m,S,C){var _=new E(function(N,G){try{var z=m._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){G(Y);return}for(var J=$a.concat("_initStorage"),Z=0,de=J.length;Z<de;Z++){var Ie=J[Z],De=!Rd(Io,Ie);if((De||m[Ie])&&typeof m[Ie]!="function"){G(Y);return}}var Qe=function(){for(var Ci=function(Bd){return function(){var Md=new Error("Method "+Bd+" is not implemented by the current driver"),Jl=E.reject(Md);return b(Jl,arguments[arguments.length-1]),Jl}},ja=0,Ld=Io.length;ja<Ld;ja++){var Ga=Io[ja];m[Ga]||(m[Ga]=Ci(Ga))}};Qe();var Ye=function(Ci){Si[z]&&console.info("Redefining LocalForage driver: "+z),Si[z]=m,Xl[z]=Ci,N()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Ye,G):Ye(!!m._support):Ye(!0)}catch(Mt){G(Mt)}});return I(_,S,C),_},f.prototype.driver=function(){return this._driver||null},f.prototype.getDriver=function(m,S,C){var _=Si[m]?E.resolve(Si[m]):E.reject(new Error("Driver not found."));return I(_,S,C),_},f.prototype.getSerializer=function(m){var S=E.resolve(Va);return I(S,m),S},f.prototype.ready=function(m){var S=this,C=S._driverSet.then(function(){return S._ready===null&&(S._ready=S._initDriver()),S._ready});return I(C,m,m),C},f.prototype.setDriver=function(m,S,C){var _=this;Kl(m)||(m=[m]);var N=this._getSupportedDrivers(m);function G(){_._config.driver=_.driver()}function z(Z){return _._extend(Z),G(),_._ready=_._initStorage(_._config),_._ready}function Y(Z){return function(){var de=0;function Ie(){for(;de<Z.length;){var De=Z[de];return de++,_._dbInfo=null,_._ready=null,_.getDriver(De).then(z).catch(Ie)}G();var Qe=new Error("No available storage method found.");return _._driverSet=E.reject(Qe),_._driverSet}return Ie()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=J.then(function(){var Z=N[0];return _._dbInfo=null,_._ready=null,_.getDriver(Z).then(function(de){_._driver=de._driver,G(),_._wrapLibraryMethodsWithReady(),_._initDriver=Y(N)})}).catch(function(){G();var Z=new Error("No available storage method found.");return _._driverSet=E.reject(Z),_._driverSet}),I(this._driverSet,S,C),this._driverSet},f.prototype.supports=function(m){return!!Xl[m]},f.prototype._extend=function(m){Wa(this,m)},f.prototype._getSupportedDrivers=function(m){for(var S=[],C=0,_=m.length;C<_;C++){var N=m[C];this.supports(N)&&S.push(N)}return S},f.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,S=$a.length;m<S;m++)Pd(this,$a[m])},f.prototype.createInstance=function(m){return new f(m)},f})(),Nd=new Ad;i.exports=Nd},{3:3}]},{},[4])(4)})});var Ic=qa((ss,af)=>{"use strict";(function(t,e){typeof ss=="object"&&typeof af<"u"?e(ss):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ss,function(t){"use strict";function e(R){var T,$,k=new Error(R);return T=k,$=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(T,$):T.__proto__=$,k}function r(R,T,$){var k=T.slice(0,$).split(/\n/),H=k.length,te=k[H-1].length+1;throw e(R+=" at line "+H+" col "+te+`:
|
|
2
|
-
|
|
3
|
-
`+T.split(/\n/)[H-1]+`
|
|
4
|
-
`+Array(te).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,i=!1;try{i=new Function("return (async function(){}).constructor")()}catch(R){if(!(R instanceof SyntaxError))throw R}function o(R,T){return Object.prototype.hasOwnProperty.call(R,T)}function s(R,T,$){for(var k in T)o(T,k)&&(T[k]==null||typeof T[k]!="object"||k!=="storage"&&k!=="prefixes"||$?R[k]=T[k]:R[k]=s({},T[k]));return R}var l=/^async +/,u=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,h=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,g=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,y=/[.*+\-?^${}()|[\]\\]/g;function E(R){return y.test(R)?R.replace(y,"\\$&"):R}function b(R,T){T.rmWhitespace&&(R=R.replace(/[\r\n]+/g,`
|
|
5
|
-
`).replace(/^\s+|\s+$/gm,"")),u.lastIndex=0,h.lastIndex=0,g.lastIndex=0;var $=T.prefixes,k=[$.h,$.b,$.i,$.r,$.c,$.e].reduce(function(tt,ve){return tt&&ve?tt+"|"+E(ve):ve?E(ve):tt},""),H=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+E(T.tags[1])+")","g"),te=new RegExp("([^]*?)"+E(T.tags[0])+"(-|_)?\\s*("+k+")?\\s*","g"),fe=0,We=!1;function Ke(tt,ve){var Ue,xe={f:[]},ke=0,Te="c";function It(ae){var ye=R.slice(fe,ae),pe=ye.trim();if(Te==="f")pe==="safe"?xe.raw=!0:T.async&&l.test(pe)?(pe=pe.replace(l,""),xe.f.push([pe,"",!0])):xe.f.push([pe,""]);else if(Te==="fp")xe.f[xe.f.length-1][1]+=pe;else if(Te==="err"){if(pe){var Ae=ye.search(/\S/);r("invalid syntax",R,fe+Ae)}}else xe[Te]=pe;fe=ae+1}for(ve==="h"||ve==="b"||ve==="c"?Te="n":ve==="r"&&(xe.raw=!0,ve="i"),H.lastIndex=fe;(Ue=H.exec(R))!==null;){var p=Ue[1],a=Ue[2],c=Ue[3],d=Ue[4],x=Ue[5],O=Ue.index;if(p)p==="("?(ke===0&&(Te==="n"?(It(O),Te="p"):Te==="f"&&(It(O),Te="fp")),ke++):p===")"?--ke===0&&Te!=="c"&&(It(O),Te="err"):ke===0&&p==="|"?(It(O),Te="f"):p==="=>"&&(It(O),fe+=1,Te="res");else if(a)if(a==="/*"){var W=R.indexOf("*/",H.lastIndex);W===-1&&r("unclosed comment",R,Ue.index),H.lastIndex=W+2}else a==="'"?(h.lastIndex=Ue.index,h.exec(R)?H.lastIndex=h.lastIndex:r("unclosed string",R,Ue.index)):a==='"'?(g.lastIndex=Ue.index,g.exec(R)?H.lastIndex=g.lastIndex:r("unclosed string",R,Ue.index)):a==="`"&&(u.lastIndex=Ue.index,u.exec(R)?H.lastIndex=u.lastIndex:r("unclosed string",R,Ue.index));else if(c)return It(O),fe=O+Ue[0].length,te.lastIndex=fe,We=x,d&&ve==="h"&&(ve="s"),xe.t=ve,xe}return r("unclosed tag",R,tt),xe}var Xe=(function tt(ve,Ue){ve.b=[],ve.d=[];var xe,ke=!1,Te=[];function It(Ae,Be){Ae&&(Ae=(function(Je,Kt,wr,In){var Xt,Jt;return typeof Kt.autoTrim=="string"?Xt=Jt=Kt.autoTrim:Array.isArray(Kt.autoTrim)&&(Xt=Kt.autoTrim[1],Jt=Kt.autoTrim[0]),(wr||wr===!1)&&(Xt=wr),(In||In===!1)&&(Jt=In),Xt==="slurp"&&Jt==="slurp"?Je.trim():(Xt==="_"||Xt==="slurp"?Je=String.prototype.trimLeft?Je.trimLeft():Je.replace(/^[\s\uFEFF\xA0]+/,""):Xt!=="-"&&Xt!=="nl"||(Je=Je.replace(/^(?:\n|\r|\r\n)/,"")),Jt==="_"||Jt==="slurp"?Je=String.prototype.trimRight?Je.trimRight():Je.replace(/[\s\uFEFF\xA0]+$/,""):Jt!=="-"&&Jt!=="nl"||(Je=Je.replace(/(?:\n|\r|\r\n)$/,"")),Je)})(Ae,T,We,Be))&&(Ae=Ae.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Te.push(Ae))}for(;(xe=te.exec(R))!==null;){var p,a=xe[1],c=xe[2],d=xe[3]||"";for(var x in $)if($[x]===d){p=x;break}It(a,c),fe=xe.index+xe[0].length,p||r("unrecognized tag type: "+d,R,fe);var O=Ke(xe.index,p),W=O.t;if(W==="h"){var ae=O.n||"";T.async&&l.test(ae)&&(O.a=!0,O.n=ae.replace(l,"")),O=tt(O),Te.push(O)}else if(W==="c"){if(ve.n===O.n)return ke?(ke.d=Te,ve.b.push(ke)):ve.d=Te,ve;r("Helper start and end don't match",R,xe.index+xe[0].length)}else if(W==="b"){ke?(ke.d=Te,ve.b.push(ke)):ve.d=Te;var ye=O.n||"";T.async&&l.test(ye)&&(O.a=!0,O.n=ye.replace(l,"")),ke=O,Te=[]}else if(W==="s"){var pe=O.n||"";T.async&&l.test(pe)&&(O.a=!0,O.n=pe.replace(l,"")),Te.push(O)}else Te.push(O)}if(!Ue)throw e('unclosed helper "'+ve.n+'"');return It(R.slice(fe,R.length),!1),ve.d=Te,ve})({f:[]},!0);if(T.plugins)for(var ut=0;ut<T.plugins.length;ut++){var ft=T.plugins[ut];ft.processAST&&(Xe.d=ft.processAST(Xe.d,T))}return Xe.d}function I(R,T){var $=b(R,T),k="var tR='';"+(T.useWith?"with("+T.varName+"||{}){":"")+P($,T)+"if(cb){cb(null,tR)} return tR"+(T.useWith?"}":"");if(T.plugins)for(var H=0;H<T.plugins.length;H++){var te=T.plugins[H];te.processFnString&&(k=te.processFnString(k,T))}return k}function L(R,T){for(var $=0;$<T.length;$++){var k=T[$][0],H=T[$][1];R=(T[$][2]?"await ":"")+"c.l('F','"+k+"')("+R,H&&(R+=","+H),R+=")"}return R}function D(R,T,$,k,H,te){var fe="{exec:"+(H?"async ":"")+q($,T,R)+",params:["+k+"]";return te&&(fe+=",name:'"+te+"'"),H&&(fe+=",async:true"),fe+="}"}function U(R,T){for(var $="[",k=0;k<R.length;k++){var H=R[k];$+=D(T,H.res||"",H.d,H.p||"",H.a,H.n),k<R.length&&($+=",")}return $+="]"}function q(R,T,$){return"function("+T+"){var tR='';"+P(R,$)+"return tR}"}function P(R,T){for(var $=0,k=R.length,H="";$<k;$++){var te=R[$];if(typeof te=="string")H+="tR+='"+te+"';";else{var fe=te.t,We=te.c||"",Ke=te.f,Xe=te.n||"",ut=te.p||"",ft=te.res||"",tt=te.b,ve=!!te.a;if(fe==="i"){T.defaultFilter&&(We="c.l('F','"+T.defaultFilter+"')("+We+")");var Ue=L(We,Ke);!te.raw&&T.autoEscape&&(Ue="c.l('F','e')("+Ue+")"),H+="tR+="+Ue+";"}else if(fe==="h")if(T.storage.nativeHelpers.get(Xe))H+=T.storage.nativeHelpers.get(Xe)(te,T);else{var xe=(ve?"await ":"")+"c.l('H','"+Xe+"')("+D(T,ft,te.d,ut,ve);xe+=tt?","+U(tt,T):",[]",H+="tR+="+L(xe+=",c)",Ke)+";"}else fe==="s"?H+="tR+="+L((ve?"await ":"")+"c.l('H','"+Xe+"')({params:["+ut+"]},[],c)",Ke)+";":fe==="e"&&(H+=We+`
|
|
6
|
-
`)}}return H}var Q=(function(){function R(T){this.cache=T}return R.prototype.define=function(T,$){this.cache[T]=$},R.prototype.get=function(T){return this.cache[T]},R.prototype.remove=function(T){delete this.cache[T]},R.prototype.reset=function(){this.cache={}},R.prototype.load=function(T){s(this.cache,T,!0)},R})();function ge(R,T,$,k){if(T&&T.length>0)throw e((k?"Native":"")+"Helper '"+R+"' doesn't accept blocks");if($&&$.length>0)throw e((k?"Native":"")+"Helper '"+R+"' doesn't accept filters")}var X={"&":"&","<":"<",">":">",'"':""","'":"'"};function oe(R){return X[R]}var ne=new Q({}),ue=new Q({each:function(R,T){var $="",k=R.params[0];if(ge("each",T,!1),R.async)return new Promise(function(te){(function fe(We,Ke,Xe,ut,ft){Xe(We[Ke],Ke).then(function(tt){ut+=tt,Ke===We.length-1?ft(ut):fe(We,Ke+1,Xe,ut,ft)})})(k,0,R.exec,$,te)});for(var H=0;H<k.length;H++)$+=R.exec(k[H],H);return $},foreach:function(R,T){var $=R.params[0];if(ge("foreach",T,!1),R.async)return new Promise(function(te){(function fe(We,Ke,Xe,ut,ft,tt){ut(Ke[Xe],We[Ke[Xe]]).then(function(ve){ft+=ve,Xe===Ke.length-1?tt(ft):fe(We,Ke,Xe+1,ut,ft,tt)})})($,Object.keys($),0,R.exec,"",te)});var k="";for(var H in $)o($,H)&&(k+=R.exec(H,$[H]));return k},include:function(R,T,$){ge("include",T,!1);var k=$.storage.templates.get(R.params[0]);if(!k)throw e('Could not fetch template "'+R.params[0]+'"');return k(R.params[1],$)},extends:function(R,T,$){var k=R.params[1]||{};k.content=R.exec();for(var H=0;H<T.length;H++){var te=T[H];k[te.name]=te.exec()}var fe=$.storage.templates.get(R.params[0]);if(!fe)throw e('Could not fetch template "'+R.params[0]+'"');return fe(k,$)},useScope:function(R,T){return ge("useScope",T,!1),R.exec(R.params[0])}}),Pe=new Q({if:function(R,T){ge("if",!1,R.f,!0);var $="if("+R.p+"){"+P(R.d,T)+"}";if(R.b)for(var k=0;k<R.b.length;k++){var H=R.b[k];H.n==="else"?$+="else{"+P(H.d,T)+"}":H.n==="elif"&&($+="else if("+H.p+"){"+P(H.d,T)+"}")}return $},try:function(R,T){if(ge("try",!1,R.f,!0),!R.b||R.b.length!==1||R.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var $="try{"+P(R.d,T)+"}",k=R.b[0];return $+="catch"+(k.res?"("+k.res+")":"")+"{"+P(k.d,T)+"}"},block:function(R,T){return ge("block",R.b,R.f,!0),"if(!"+T.varName+"["+R.p+"]){tR+=("+q(R.d,"",T)+")()}else{tR+="+T.varName+"["+R.p+"]}"}}),be=new Q({e:function(R){var T=String(R);return/[&<>"']/.test(T)?T.replace(/[&<>"']/g,oe):T}}),Ce={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(R,T){if(R==="H"){var $=this.storage.helpers.get(T);if($)return $;throw e("Can't find helper '"+T+"'")}if(R==="F"){var k=this.storage.filters.get(T);if(k)return k;throw e("Can't find filter '"+T+"'")}},async:!1,storage:{helpers:ue,nativeHelpers:Pe,filters:be,templates:ne},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function $e(R,T){var $={};return s($,Ce),T&&s($,T),R&&s($,R),$.l.bind($),$}function ze(R,T){var $,k=$e(T||{}),H=Function;if(k.async){if(!i)throw e("This environment doesn't support async/await");H=i}if(k.varName&&($=k.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test($)===!1))throw e("options.varName must be a valid JS identifier");try{return new H(k.varName,"c","cb",I(R,k))}catch(te){throw te instanceof SyntaxError?e(`Bad template syntax
|
|
7
|
-
|
|
8
|
-
`+te.message+`
|
|
9
|
-
`+Array(te.message.length+1).join("=")+`
|
|
10
|
-
`+I(R,k)):te}}function St(R,T){var $;return T.cache&&T.name&&T.storage.templates.get(T.name)?T.storage.templates.get(T.name):($=typeof R=="function"?R:ze(R,T),T.cache&&T.name&&T.storage.templates.define(T.name,$),$)}Ce.l.bind(Ce),t.compile=ze,t.compileScope=P,t.compileScopeIntoFunction=q,t.compileToString=I,t.defaultConfig=Ce,t.filters=be,t.getConfig=$e,t.helpers=ue,t.nativeHelpers=Pe,t.parse=b,t.render=function(R,T,$,k){var H=$e($||{});if(!H.async)return St(R,H)(T,H);if(!k){if(typeof n=="function")return new n(function(te,fe){try{te(St(R,H)(T,H))}catch(We){fe(We)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{St(R,H)(T,H,k)}catch(te){return k(te)}},t.templates=ne,Object.defineProperty(t,"__esModule",{value:!0})})});var He=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;widgetCustomisation;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this.widgetCustomisation=e.widgetCustomisation,this}};var lu=br(za());var kd=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],cu={utm_source:"tw_source",utm_campaign:"tw_campaign"};var uu=()=>{if(document.referrer)return document.referrer.replace(location.origin,"")},fu=()=>{let t;try{t=new lu.URLBuilder(location.href)}catch{return{}}let e={};kd.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(cu).forEach(n=>{let i=t.getQueryParam(cu[n]);i&&(r[n]=i)}),B(B({},r),e)};function ce(){return window.CooeeSDK.runtimeData}function On(){return nr(Date.now()-ce().sdkLoadTime.getTime())}var Ya=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}};function Ao(){let t=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new Ya(B({origin:location.origin,path:t,qs:location.search,referrer:uu(),name:ce().pageName},fu()))}function pu(){let t=ce(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(t.previewIDs=i)}let n=e.get("cooee-variant")?.trim();n&&(t.previewVariant=n)}var Ut=(function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t[t.BXGY=6]="BXGY",t})(Ut||{});var Ii=(function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t})(Ii||{});var Ka=(function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t})(Ka||{});var wt=(function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t.BEFORE1="BEFORE",t.AFTER1="AFTER",t.INSIDE_FIRST1="INSIDE_FIRST",t.INSIDE_LAST1="INSIDE_LAST",t})(wt||{}),kt=(function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t})(kt||{});var he=(function(t){return t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",t[t.BUY_NOW=110]="BUY_NOW",t[t.QUICK_VIEW=111]="QUICK_VIEW",t})(he||{}),Ri=(function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t})(Ri||{}),Ft=(function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t.COLLECTION_FILTER="COLLECTION_FILTER",t})(Ft||{}),Di=(function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t})(Di||{}),Xa=(function(t){return t.ICONS="ICONS",t.TILES="TILES",t})(Xa||{}),Ja=(function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t.UI_ONLY="UI_ONLY",t})(Ja||{});var Er=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var mu=(()=>{class t{static toTitle(r){return r?this.titleCase(r.toLowerCase().split(/[_-]+/).join(" ")):""}static toSlug(r){return r?r.toLowerCase().replace(/[_-]+/," ").replace(/[^\w ]+/g,"").replace(/ +/g,"-"):""}static toCamelCase(r){return r.toLowerCase().split(" ").map((n,i)=>i===0?n:n.charAt(0).toUpperCase()+n.slice(1)).join("")}static format(r,...n){return r?.replace(/{(\d+)}/g,(i,o)=>{let s=n[o];return s!==void 0?s:i})}static chop(r,n){if(!(!r||!n))return r.length<=n?r:r.substring(0,n)}static titleCase=r=>r.replace(/(^|\s)\S/g,n=>n.toUpperCase())}return t})();var No=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var rn=class{s;g;i;constructor(e){e.s&&(this.s=new Fe(e.s)),e.g&&(this.g=new Oi(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Pi="a-f\\d",Fd=`#?[${Pi}]{3}[${Pi}]?`,Hd=`#?[${Pi}]{6}([${Pi}]{2})?`,Vd=new RegExp(`[^#${Pi}]`,"gi"),$d=new RegExp(`^${Fd}$|^${Hd}$`,"i");function Qa(t,e={}){if(typeof t!="string"||Vd.test(t)||!$d.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,l=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,l];if(e.format==="css"){let u=l===1?"":` / ${Number((l*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${u})`}return{red:i,green:o,blue:s,alpha:l}}var Fe=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return Qa(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var _r=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new Fe(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Lo[this.s??1]}},Lo=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(Lo||{});var Oi=class t{static DEFAULT_FALLBACK=new Fe({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new Fe(e.c)),e.fb&&(this.fb=new Fe(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var Ai=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new Fe(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Sr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var nn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var Pn=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(Pn||{});var Bo=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new Za(r))}},Za=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var rt=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return Pn[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new Fe(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new Fe(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new Bo(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var Mo=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new Uo(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new Uo(r)))}};var Uo=class{cssSelector;type;display;bg;typo;br;text;image;moveTo;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new Fe(e.bg)),e.typo&&(this.typo=new rt(e.typo)),e.br&&(this.br=new _r(e.br)),this.text=e.text,this.image=e.image,this.moveTo=e.moveTo}get style(){let e={};return this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=Lo[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var bt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};var ec=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new bt(r)),this.isUIOnly=e.isUIOnly,this.allowATC=e.allowATC}};var ko=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??Xa.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new ec(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var Fo=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var ir=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),"cooee-wrapper-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=B({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return v.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var pt=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var rc=br(hu());function An(t){return rc.default.createInstance({name:"lc",storeName:t,driver:rc.default.LOCALSTORAGE})}var Mr=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Ni=class Ni extends Mr{};Dn(Ni,"storeName","ses"),Ni.storage=An(Ni.storeName);var gt=Ni;var Li=class Li extends Mr{};Dn(Li,"storeName","usr"),Li.storage=An(Li.storeName);var je=Li;var Ht=class extends Error{request;response;status;requestBody;responseText;constructor(e){super(e),this.name="FetchError",Object.setPrototypeOf(this,new.target.prototype)}is40x(){return!!this.response&&this.response.status>=400&&this.response.status<500}};async function Cr(t,e){let r=Date.now(),n;try{n=await Wd(t,e)}catch{}let i=n?new Request(n.url,{method:e?.method||"GET"}):new Request(t,e);if(!n||!n.ok){let h="Failed to fetch";n?.statusText&&(h+=`: ${n.statusText}`);let g=new Ht(h);throw g.request=i,g.response=n?.clone(),g.status=n?.status,g.requestBody=e?.body,g.responseText=await gu(n),g}let o,s=(n.headers.get("content-type")||"").toLowerCase(),l=n.headers.get("content-length"),u=e?.method?.toUpperCase()||"GET";if(n.status===204||n.status===205||u==="HEAD"||l==="0")o=void 0;else if(s.includes("application/json")||s.includes("application/problem+json")||s.includes("text/javascript"))try{o=await n.clone().json()}catch(h){let g=new Ht(`Failed to parse JSON response: ${h?.message}`);throw g.request=i,g.response=n.clone(),g.status=n.status,g.requestBody=e?.body,g.responseText=await gu(n),g}else s.includes("text/")||s.includes("image/svg+xml")?o=await n.text():o=await n.arrayBuffer();return{data:o,status:n.status,statusText:n.statusText,headers:n.headers,timeTakenMs:Date.now()-r,options:e,request:i}}async function Wd(t,e){let r=null,n;for(let i=0;i<=5;i++){try{let o=new Headers(e?.headers);(t.includes("letscooee.com")||t.includes("localhost"))&&o.set("Cooee-Retry-Attempt",i.toString());let s=Re(B({},e),{headers:o});if(n=await fetch(t,s),n.ok||n.status>=400&&n.status<500)return n;r=new Error(`Server error: ${n.status} ${n.statusText}`)}catch(o){r=o instanceof Error?o:new Error(String(o))}if(i<5){let o=Math.pow(2,i)*500;await new Promise(s=>setTimeout(s,o))}}if(n&&!n.ok)return n;throw r||new Error("Request failed after retries")}async function gu(t){if(t){try{return t=t.clone(),await t.json()}catch{}try{return await t.text()}catch{}}}var Ho={},Vo,$o,vu,wu,yu;async function bu(){if(!$o)return yu??=jd(),yu}async function jd(){let{BrowserClient:t,Scope:e,defaultStackParser:r,getDefaultIntegrations:n,makeFetchTransport:i}=await import("./esm-EYV26LOR.js");wu=e;let o=n({}).filter(s=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(s.name));$o=new t({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:i,stackParser:r,integrations:o,environment:Rt.mode,release:`web-sdk@${Do}`,debug:Rt.debug,sampleRate:.5}),$o.init()}function ie(t,e,r){v.error(`${e}:`,t),bu().then(()=>{let n=_u(r);if(n.setTag("operation",e),t instanceof Ht){Gd(n,t,e);return}n.captureException(t)})}function Wo(t,e,r){bu().then(()=>{_u(r).captureMessage(t,e??"error")})}function Gd(t,e,r){if(qd(t,e),e.response){let n=e.response,i=e.responseText;t.setTag("error.message",e.message),n.status!=null&&t.setTag("http.status_code",n.status),n.statusText&&t.setTag("http.status_text",n.statusText),i&&typeof i=="object"&&"error"in i&&(t.setTag("http.error_code",i.error.code),t.setTag("http.error_message",i.error.message)),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url,originalError:e.message}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function qd(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 Eu(t){vu=t}function jo(t,e){Ho[t]=B(B({},Ho[t]),e)}function Nn(t){Vo=B(B({},Vo),t)}function _u(t){t??={};let{extra:e,tags:r}=t,n=new wu;if(n.setClient($o),n.setUser(vu),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),Vo&&n.setTags(Vo),Object.keys(Ho).forEach(i=>{n.setContext(i,Ho[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Su()),zd(n),n}function zd(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 Go=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),l=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),u=s[1]?i+s[1]:"";return l+u}};function Bn(t){try{return new URL(t)}catch{return}}function nc(t){return!t||t==="null"||t==="undefined"}function Cu(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Et(t,e,r){return{[t]:ic(e,r),[t+"_wo_currency"]:e}}function ic(t,e){if(t==0&&e)return"Free";let r=ce(),n=He.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||v.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,l;if(s&&i===o)l=Go.format(t*100,s);else{let u;try{u=new Intl.NumberFormat(Tu(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(h){return ie(h,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}l=u.format(t),l=l.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(l=l.concat(` ${o}`))}return l}function xu(t){let e=Tu();try{return new Intl.NumberFormat(e,{notation:"compact"}).format(t)}catch(r){return ie(r,"format-number",{extra:{lang:e,value:t}}),t.toString()}}function Tu(){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 qo;function Su(){if(qo)return qo;try{return qo=Intl.DateTimeFormat().resolvedOptions().timeZone,qo}catch{return""}}function Ur(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function Qt(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 oc(t,e=7,r=document){let n=1,i=document.querySelectorAll("nonexistent-tag");for(;n<=e;){let o=Math.min(50*2**n,1e3);if(n>1&&await pt.sleep(o),i=r.querySelectorAll(t),i.length)return v.verbose(`Attempt ${n}: ${i.length} elements found with ${t}`),i;v.verbose(`Attempt ${n}: Elements not found with ${t}. Will retry after ${o}ms.`),n++}return v.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),i}async function kr(t,e=10,r=document){return(await oc(t,e,r)).item(0)}async function sc(t){let[e,r,n]=await Promise.all([je.get("did"),gt.get("id",""),je.get("sessionNumber",1)]),i={letscooee_did:e,letscooee_sid:r,letscooee_sn:`${n}`,__letscooee_time:new Date().toLocaleString()};return t&&(i.__letscooee_via=t),i}async function zo(t){let e=await sc(t);return Object.entries(e).map(([r,n])=>({key:r,value:n.toString()}))}function or(t,e,r,n=!1){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:n,value:r})}function Iu(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 Jo,Ee,Au,lc,on,Ru,Nu,Lu,Bu,uc,ac,cc,Yd,Bi={},Mu=[],Kd=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qo=Array.isArray;function xr(t,e){for(var r in e)t[r]=e[r];return t}function fc(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function pc(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Jo.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Ko(t,s,n,i,null)}function Ko(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Au,__i:-1,__u:0};return i==null&&Ee.vnode!=null&&Ee.vnode(o),o}function ar(t){return t.children}function sr(t,e){this.props=t,this.context=e}function Mn(t,e){if(e==null)return t.__?Mn(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"?Mn(t):null}function Uu(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 Uu(t)}}function Du(t){(!t.__d&&(t.__d=!0)&&on.push(t)&&!Xo.__r++||Ru!=Ee.debounceRendering)&&((Ru=Ee.debounceRendering)||Nu)(Xo)}function Xo(){for(var t,e,r,n,i,o,s,l=1;on.length;)on.length>l&&on.sort(Lu),t=on.shift(),l=on.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=xr({},n)).__v=n.__v+1,Ee.vnode&&Ee.vnode(r),mc(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??Mn(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,Hu(o,r,s),r.__e!=i&&Uu(r)));Xo.__r=0}function ku(t,e,r,n,i,o,s,l,u,h,g){var y,E,b,I,L,D,U=n&&n.__k||Mu,q=e.length;for(u=Xd(r,e,U,u,q),y=0;y<q;y++)(b=r.__k[y])!=null&&(E=b.__i==-1?Bi:U[b.__i]||Bi,b.__i=y,D=mc(t,b,E,i,o,s,l,u,h,g),I=b.__e,b.ref&&E.ref!=b.ref&&(E.ref&&dc(E.ref,null,b),g.push(b.ref,b.__c||I,b)),L==null&&I!=null&&(L=I),4&b.__u||E.__k===b.__k?u=Fu(b,u,t):typeof b.type=="function"&&D!==void 0?u=D:I&&(u=I.nextSibling),b.__u&=-7);return r.__e=L,u}function Xd(t,e,r,n,i){var o,s,l,u,h,g=r.length,y=g,E=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(u=o+E,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Ko(null,s,null,null,null):Qo(s)?Ko(ar,{children:s},null,null,null):s.constructor==null&&s.__b>0?Ko(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,l=null,(h=s.__i=Jd(s,r,u,y))!=-1&&(y--,(l=r[h])&&(l.__u|=2)),l==null||l.__v==null?(h==-1&&(i>g?E--:i<g&&E++),typeof s.type!="function"&&(s.__u|=4)):h!=u&&(h==u-1?E--:h==u+1?E++:(h>u?E--:E++,s.__u|=4))):t.__k[o]=null;if(y)for(o=0;o<g;o++)(l=r[o])!=null&&(2&l.__u)==0&&(l.__e==n&&(n=Mn(l)),$u(l,l));return n}function Fu(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=Fu(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Mn(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Jd(t,e,r,n){var i,o,s=t.key,l=t.type,u=e[r];if(u===null&&t.key==null||u&&s==u.key&&l==u.type&&(2&u.__u)==0)return r;if(n>(u!=null&&(2&u.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((u=e[i])&&(2&u.__u)==0&&s==u.key&&l==u.type)return i;i--}if(o<e.length){if((u=e[o])&&(2&u.__u)==0&&s==u.key&&l==u.type)return o;o++}}return-1}function Ou(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||Kd.test(e)?r:r+"px"}function Yo(t,e,r,n,i){var o,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||Ou(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Ou(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Bu,"$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+o]=r,r?n?r.u=n.u:(r.u=uc,t.addEventListener(e,o?cc:ac,o)):t.removeEventListener(e,o?cc:ac,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Pu(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=uc++;else if(e.t<r.u)return;return r(Ee.event?Ee.event(e):e)}}}function mc(t,e,r,n,i,o,s,l,u,h){var g,y,E,b,I,L,D,U,q,P,Q,ge,X,oe,ne,ue,Pe,be=e.type;if(e.constructor!=null)return null;128&r.__u&&(u=!!(32&r.__u),o=[l=e.__e=r.__e]),(g=Ee.__b)&&g(e);e:if(typeof be=="function")try{if(U=e.props,q="prototype"in be&&be.prototype.render,P=(g=be.contextType)&&n[g.__c],Q=g?P?P.props.value:g.__:n,r.__c?D=(y=e.__c=r.__c).__=y.__E:(q?e.__c=y=new be(U,Q):(e.__c=y=new sr(U,Q),y.constructor=be,y.render=Zd),P&&P.sub(y),y.props=U,y.state||(y.state={}),y.context=Q,y.__n=n,E=y.__d=!0,y.__h=[],y._sb=[]),q&&y.__s==null&&(y.__s=y.state),q&&be.getDerivedStateFromProps!=null&&(y.__s==y.state&&(y.__s=xr({},y.__s)),xr(y.__s,be.getDerivedStateFromProps(U,y.__s))),b=y.props,I=y.state,y.__v=e,E)q&&be.getDerivedStateFromProps==null&&y.componentWillMount!=null&&y.componentWillMount(),q&&y.componentDidMount!=null&&y.__h.push(y.componentDidMount);else{if(q&&be.getDerivedStateFromProps==null&&U!==b&&y.componentWillReceiveProps!=null&&y.componentWillReceiveProps(U,Q),!y.__e&&y.shouldComponentUpdate!=null&&y.shouldComponentUpdate(U,y.__s,Q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(y.props=U,y.state=y.__s,y.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Ce){Ce&&(Ce.__=e)}),ge=0;ge<y._sb.length;ge++)y.__h.push(y._sb[ge]);y._sb=[],y.__h.length&&s.push(y);break e}y.componentWillUpdate!=null&&y.componentWillUpdate(U,y.__s,Q),q&&y.componentDidUpdate!=null&&y.__h.push(function(){y.componentDidUpdate(b,I,L)})}if(y.context=Q,y.props=U,y.__P=t,y.__e=!1,X=Ee.__r,oe=0,q){for(y.state=y.__s,y.__d=!1,X&&X(e),g=y.render(y.props,y.state,y.context),ne=0;ne<y._sb.length;ne++)y.__h.push(y._sb[ne]);y._sb=[]}else do y.__d=!1,X&&X(e),g=y.render(y.props,y.state,y.context),y.state=y.__s;while(y.__d&&++oe<25);y.state=y.__s,y.getChildContext!=null&&(n=xr(xr({},n),y.getChildContext())),q&&!E&&y.getSnapshotBeforeUpdate!=null&&(L=y.getSnapshotBeforeUpdate(b,I)),ue=g,g!=null&&g.type===ar&&g.key==null&&(ue=Vu(g.props.children)),l=ku(t,Qo(ue)?ue:[ue],e,r,n,i,o,s,l,u,h),y.base=e.__e,e.__u&=-161,y.__h.length&&s.push(y),D&&(y.__E=y.__=null)}catch(Ce){if(e.__v=null,u||o!=null)if(Ce.then){for(e.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o[o.indexOf(l)]=null,e.__e=l}else for(Pe=o.length;Pe--;)fc(o[Pe]);else e.__e=r.__e,e.__k=r.__k;Ee.__e(Ce,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):l=e.__e=Qd(r.__e,e,r,n,i,o,s,u,h);return(g=Ee.diffed)&&g(e),128&e.__u?void 0:l}function Hu(t,e,r){for(var n=0;n<r.length;n++)dc(r[n],r[++n],r[++n]);Ee.__c&&Ee.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){Ee.__e(o,i.__v)}})}function Vu(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Qo(t)?t.map(Vu):xr({},t)}function Qd(t,e,r,n,i,o,s,l,u){var h,g,y,E,b,I,L,D=r.props,U=e.props,q=e.type;if(q=="svg"?i="http://www.w3.org/2000/svg":q=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(h=0;h<o.length;h++)if((b=o[h])&&"setAttribute"in b==!!q&&(q?b.localName==q:b.nodeType==3)){t=b,o[h]=null;break}}if(t==null){if(q==null)return document.createTextNode(U);t=document.createElementNS(i,q,U.is&&U),l&&(Ee.__m&&Ee.__m(e,o),l=!1),o=null}if(q==null)D===U||l&&t.data==U||(t.data=U);else{if(o=o&&Jo.call(t.childNodes),D=r.props||Bi,!l&&o!=null)for(D={},h=0;h<t.attributes.length;h++)D[(b=t.attributes[h]).name]=b.value;for(h in D)if(b=D[h],h!="children"){if(h=="dangerouslySetInnerHTML")y=b;else if(!(h in U)){if(h=="value"&&"defaultValue"in U||h=="checked"&&"defaultChecked"in U)continue;Yo(t,h,null,b,i)}}for(h in U)b=U[h],h=="children"?E=b:h=="dangerouslySetInnerHTML"?g=b:h=="value"?I=b:h=="checked"?L=b:l&&typeof b!="function"||D[h]===b||Yo(t,h,b,D[h],i);if(g)l||y&&(g.__html==y.__html||g.__html==t.innerHTML)||(t.innerHTML=g.__html),e.__k=[];else if(y&&(t.innerHTML=""),ku(e.type=="template"?t.content:t,Qo(E)?E:[E],e,r,n,q=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Mn(r,0),l,u),o!=null)for(h=o.length;h--;)fc(o[h]);l||(h="value",q=="progress"&&I==null?t.removeAttribute("value"):I!=null&&(I!==t[h]||q=="progress"&&!I||q=="option"&&I!=D[h])&&Yo(t,h,I,D[h],i),h="checked",L!=null&&L!=t[h]&&Yo(t,h,L,D[h],i))}return t}function dc(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){Ee.__e(i,r)}}function $u(t,e,r){var n,i;if(Ee.unmount&&Ee.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||dc(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){Ee.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&$u(n[i],e,r||typeof t.type!="function");r||fc(t.__e),t.__c=t.__=t.__e=void 0}function Zd(t,e,r){return this.constructor(t,r)}function Wu(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),Ee.__&&Ee.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],mc(e,t=(!n&&r||e).__k=pc(ar,null,[t]),i||Bi,Bi,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Jo.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),Hu(o,t,s)}Jo=Mu.slice,Ee={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(l){t=l}throw t}},Au=0,lc=function(t){return t!=null&&t.constructor==null},sr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=xr({},this.state),typeof t=="function"&&(t=t(xr({},r),this.props)),t&&xr(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Du(this))},sr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Du(this))},sr.prototype.render=ar,on=[],Nu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Lu=function(t,e){return t.__v.__b-e.__v.__b},Xo.__r=0,Bu=/(PointerCapture)$|Capture$/i,uc=0,ac=Pu(!1),cc=Pu(!0),Yd=0;var gc,Dt,hc,ju,Gu=0,Zu=[],nt=Ee,qu=nt.__b,zu=nt.__r,Yu=nt.diffed,Ku=nt.__c,Xu=nt.unmount,Ju=nt.__;function eh(t,e){nt.__h&&nt.__h(Dt,t,Gu||e),Gu=0;var r=Dt.__H||(Dt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function vc(t,e){var r=eh(gc++,7);return nh(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function th(){for(var t;t=Zu.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Zo),t.__H.__h.forEach(yc),t.__H.__h=[]}catch(e){t.__H.__h=[],nt.__e(e,t.__v)}}nt.__b=function(t){Dt=null,qu&&qu(t)},nt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ju&&Ju(t,e)},nt.__r=function(t){zu&&zu(t),gc=0;var e=(Dt=t.__c).__H;e&&(hc===Dt?(e.__h=[],Dt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Zo),e.__h.forEach(yc),e.__h=[],gc=0)),hc=Dt},nt.diffed=function(t){Yu&&Yu(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Zu.push(e)!==1&&ju===nt.requestAnimationFrame||((ju=nt.requestAnimationFrame)||rh)(th)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),hc=Dt=null},nt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Zo),r.__h=r.__h.filter(function(n){return!n.__||yc(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],nt.__e(n,r.__v)}}),Ku&&Ku(t,e)},nt.unmount=function(t){Xu&&Xu(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Zo(n)}catch(i){e=i}}),r.__H=void 0,e&&nt.__e(e,r.__v))};var Qu=typeof requestAnimationFrame=="function";function rh(t){var e,r=function(){clearTimeout(n),Qu&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);Qu&&(e=requestAnimationFrame(r))}function Zo(t){var e=Dt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Dt=e}function yc(t){var e=Dt;t.__c=t.__(),Dt=e}function nh(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var ih=Symbol.for("preact-signals");function bc(){if(Un>1)Un--;else{for(var t,e=!1;Mi!==void 0;){var r=Mi;for(Mi=void 0,wc++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&tf(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(wc=0,Un--,e)throw t}}var Me=void 0;var Mi=void 0,Un=0,wc=0,es=0;function ef(t){if(Me!==void 0){var e=t.n;if(e===void 0||e.t!==Me)return e={i:0,S:t,p:Me.s,n:void 0,t:Me,e:void 0,x:void 0,r:e},Me.s!==void 0&&(Me.s.n=e),Me.s=e,t.n=e,32&Me.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=Me.s,e.n=void 0,Me.s.n=e,Me.s=e),e}}function it(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}it.prototype.brand=ih;it.prototype.h=function(){return!0};it.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)};it.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)}};it.prototype.subscribe=function(t){var e=this;return mt(function(){var r=e.value,n=Me;Me=void 0;try{t(r)}finally{Me=n}})};it.prototype.valueOf=function(){return this.value};it.prototype.toString=function(){return this.value+""};it.prototype.toJSON=function(){return this.value};it.prototype.peek=function(){var t=Me;Me=void 0;try{return this.value}finally{Me=t}};Object.defineProperty(it.prototype,"value",{get:function(){var t=ef(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(wc>100)throw new Error("Cycle detected");this.v=t,this.i++,es++,Un++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{bc()}}}});function Vt(t){return new it(t)}function tf(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 rf(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 nf(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 kn(t){it.call(this,void 0),this.x=t,this.s=void 0,this.g=es-1,this.f=4}(kn.prototype=new it).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===es))return!0;if(this.g=es,this.f|=1,this.i>0&&!tf(this))return this.f&=-2,!0;var t=Me;try{rf(this),Me=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 Me=t,nf(this),this.f&=-2,!0};kn.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)}it.prototype.S.call(this,t)};kn.prototype.U=function(t){if(this.t!==void 0&&(it.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)}};kn.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(kn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ef(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Ec(t){return new kn(t)}function of(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Un++;var r=Me;Me=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,_c(t),n}finally{Me=r,bc()}}}function _c(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,of(t)}function oh(t){if(Me!==this)throw new Error("Out-of-order effect");nf(this),Me=t,this.f&=-2,8&this.f&&_c(this),bc()}function Ui(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Ui.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()}};Ui.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,of(this),rf(this),Un++;var t=Me;return Me=this,oh.bind(this,t)};Ui.prototype.N=function(){2&this.f||(this.f|=2,this.o=Mi,Mi=this)};Ui.prototype.d=function(){this.f|=8,1&this.f||_c(this)};function mt(t){var e=new Ui(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var Cc,Sc;function Fn(t,e){Ee[t]=e.bind(null,Ee[t]||function(){})}function ts(t){Sc&&Sc(),Sc=t&&t.S()}function sf(t){var e=this,r=t.data,n=ah(r);n.value=r;var i=vc(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,l=e.__$u.S(),u=i.value;l(),lc(u)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=u},Ec(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}sf.displayName="_st";Object.defineProperties(it.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:sf},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Fn("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof it&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});Fn("__r",function(t,e){ts();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(i){var o;return mt(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o})())),Cc=n,ts(r),t(e)});Fn("__e",function(t,e,r,n){ts(),Cc=void 0,t(e,r,n)});Fn("diffed",function(t,e){ts(),Cc=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var l=o[s];l!==void 0&&!(s in n)&&(l.d(),o[s]=void 0)}else r.U=o={};for(var u in n){var h=o[u],g=n[u];h===void 0?(h=sh(r,u,g,i),o[u]=h):h.o(g,i)}}}t(e)});function sh(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=Vt(r);return{o:function(s,l){o.value=s,n=l},d:mt(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}Fn("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var l=s.__$u;l&&(s.__$u=void 0,l.d())}}t(e)});Fn("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});sr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function ah(t){return vc(function(){return Vt(t)},[])}var rs=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var ns=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var xc=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}},cr=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 rs(r))??[],this.link=e.link,this.price=new ns(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=Vt(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=Vt(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new xc(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}};function Tc(t,e){for(let r of t){let n=e.get(r.attr),i=Array.isArray(n),o=typeof n=="string",s=typeof n=="number"&&typeof r.value=="number",l=Array.isArray(r.value),u=!0;switch(r.op){case"contains":{u=(i||o)&&n.includes(r.value);break}case"notContains":{u=(i||o)&&!n.includes(r.value);break}case"eq":{u=n===r.value;break}case"ne":{u=n!==r.value;break}case"gt":{u=s&&n>r.value;break}case"gte":{u=s&&n>=r.value;break}case"lt":{u=s&&n<r.value;break}case"lte":{u=s&&n<=r.value;break}case"in":{u=l&&r.value.includes(n);break}case"nin":{u=l&&!r.value.includes(n);break}case"between":{u=s&&l&&r.value.length===2&&n>=r.value[0]&&n<=r.value[1];break}case"all":{u=i&&l&&r.value.every(h=>n.includes(h));break}default:{u=!1;break}}if(!u)return!1}return!0}var st=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=Vt(!0);_showAddToCartButton;constructor(e){this.update(e),this.selectedOrFirstVariant=Vt(this.selectedVariant),this._showAddToCartButton=this.evaluateShowATCFlag()}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}get showAddToCartButton(){return this._showAddToCartButton}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 cr(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new bt({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,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,l=this.tags?.join(",")??"",u=this.reviews?.rating,h=this.reviews?.totalReviews,g=r.cmp&&r.cmp>r.d,y=Re(B({name:n},Et("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:u,reviews:h,tags:l});if(e.hasEffectivePrice()){let b=Et("effective_price",e.effectivePrice.value,!0);Object.assign(y,b)}if(g){let b=r.cmp-r.d,I={discount_percent:(b/r.cmp*100).toFixed(0)};Object.assign(y,I),Object.assign(y,Et("compare_price",r.cmp)),Object.assign(y,Et("discount_price",b))}let E={name:e.name,quantity:e.quantity};return{product:y,variant:E}}evaluateShowATCFlag(){let e=He.get().widgetCustomisation?.atcButton?.showWhen;if(!e?.predicates?.length)return!0;let r=e.predicates,n=this.getValueMap(r);return e.op==="or"?r.some(i=>Tc([i],n)):Tc(r,n)}getValueMap(e){let r=new Map;for(let n of e){let i=n.attr.split(".");switch(i[1]){case"tags":{r.set(n.attr,this.tags);break}case"type":case"category":{r.set(n.attr,this.category);break}case"meta":case"metafield":{let s=i[2];if(!s)continue;r.set(n.attr,this.meta?.[s]);break}}}return r}};var is=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 st(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 os=class{videos;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(e={}){this.videos=e.videos?.map(r=>new is(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.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM",this.playlistConfig={videoSwiper:e.playlistConfig?.videoSwiper??void 0,itemCardClickBehavior:e.playlistConfig?.itemCardClickBehavior??"OPEN_VIDEO_DETAIL"},this.itemDetailConfig={template:e.itemDetailConfig?.template??"CLASSIC"}}showItems(){return this.footerContent==="FIRST_ITEM"||this.footerContent==="ITEM_SWIPER"}};var yt=br(Ic());yt.filters.define("default",function(t){return typeof t>"u"||t==null?"":lh(t)});+yt.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});yt.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});yt.filters.define("fallback",(t,e)=>t==null||t===""?e:t);yt.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return v.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});yt.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return v.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return v.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)});yt.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(v.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));yt.filters.define("currency",t=>(t=+t,isNaN(t)?(v.error("Need value as a number for `currency` filter"),NaN):ic(t)));yt.filters.define("split",(t,e,r)=>{if(typeof t!="string")return v.error("Need value as a string for `split` filter"),"";if(e==null)return v.error("Need delimiter for `split` filter"),"";if(r==null||isNaN(Number(r)))return v.error("Need a valid index for `split` filter"),"";let n=t.split(String(e)),i=Number(r),o=i<0?n.length+i:i;return n[o].trim()??""});yt.defaultConfig.defaultFilter="default";yt.defaultConfig.useWith=!0;yt.defaultConfig.autoEscape=!1;var ch={'"':""","\\":"\","\n":"\\n"," ":"\\t"};function lh(t){return String(t).replace(/["\\\n\t]/g,e=>ch[e])}function uh(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var Hn=(t,e,r)=>{e=B({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return yt.render(uh(t),e)}catch(n){throw ie(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},sn=(t,e,r)=>{let n=JSON.stringify(t),i=Hn(n,e,r);try{return JSON.parse(i)}catch(o){throw ie(o,"variable-replacement",{extra:{before:t,after:i},triggerContext:r}),o}};function ki(){return!!window.Shopify}function as(){if(ki())return window.Shopify.shop?.split(".")?.[0]}function cf(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Vn(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function cs(t){return Vn(t+"?from=cooee")}var le=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 fh(e)}getCooeeCart(){return Rc()}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,ce().currencyCode=this.currency,v.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function fh(t){let e=le.getCurrent();await mh(e,t);let r=lf(e);return t&&await je.set("cart",r),r}function Rc(){return lf(le.getCurrent())}function lf(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:ph(t.items),token:t.token}}function ph(t){if(!t)return v.error("No item received to be sent"),[];Array.isArray(t)||(t=[t]);let e=[];for(let r of t){if(!r.id||!r.title){v.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},i=r.selling_plan_allocation?.selling_plan;if(!i){e.push(n);continue}n.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:i.fixed_selling_plan,id:i.id,name:i.name,recurringDeliveries:i.recurring_deliveries}},e.push(n)}return e}async function mh(t,e){if(!e&&t.token){v.verbose("Not fetching cart");return}v.verbose("Fetching cart");let r=cs("/cart.js");try{let n=(await Cr(r)).data;t.update(n)}catch(n){v.error("Unable to fetch the cart",n)}}var ls=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 Dc=class{enabled;constructor(e){this.enabled=e.enabled}},Oc=class extends Dc{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},us=class{productQuantity;constructor(e){e??={},this.productQuantity=new Oc(e.productQuantity)}};var Ot=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new rn(e.bg)),e.br&&(this.br=new _r(e.br)),e.shd&&(this.shd=new Ai(e.shd)),e.spc&&(this.spc=new Sr(e.spc)),this.trf=new nn(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 Ve[this.t]}get click(){return this.clc}},Ve=(P=>(P[P.IMAGE=1]="IMAGE",P[P.TEXT=2]="TEXT",P[P.BUTTON=3]="BUTTON",P[P.FLEXBOX=4]="FLEXBOX",P[P.MULTI_COLUMN=5]="MULTI_COLUMN",P[P.CHECKBOX=6]="CHECKBOX",P[P.PRODUCTS=11]="PRODUCTS",P[P.PRODUCT=12]="PRODUCT",P[P.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",P[P.PRODUCT_TITLE=14]="PRODUCT_TITLE",P[P.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",P[P.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",P[P.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",P[P.PRODUCT_RATING=19]="PRODUCT_RATING",P[P.EMAIL_INPUT=51]="EMAIL_INPUT",P[P.PHONE_INPUT=52]="PHONE_INPUT",P[P.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",P[P.CAROUSEL=62]="CAROUSEL",P[P.SHAPE=100]="SHAPE",P))(Ve||{});var an=class extends Ot{constructor(e){super(e)}};var Tr=class extends Ot{src;constructor(e){super(e),this.src=e.src}};var lr=class extends Ot{typo;constructor(e){super(e);let r=B(B({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new rt(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Fr=class extends lr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var fs=class extends Ot{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 $n=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let l=Math.floor(s/(1e3*60*60*24)),u=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),h=Math.floor(s%(1e3*60*60)/(1e3*60)),g=Math.floor(s%(1e3*60)/1e3);r({days:l,hours:u,minutes:h,seconds:g})},1e3);return i}};var Wn=class extends lr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new $n(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var ps=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new Fe(e.c??{})}get text(){return this.txt}get color(){return this.c}};var Hr=class extends lr{ph;constructor(e){super(e),this.ph=new ps(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var jn=class extends Hr{constructor(e){e??={},super(e)}};var Gn=class extends Hr{};var qn=class extends Hr{};var zn=class extends Tr{};var ms=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 ds=15,Fi=class extends Ot{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 ms(e.anim),this.spc||(this.spc=new Sr({pl:ds,pr:ds,pt:ds,pb:ds}))}};var hs=class extends Fi{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new fs(e.cont),this.mob=new Fi(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new Tr(r)):r.t===2?this.elems.push(new Fr(r)):r.t===3?this.elems.push(new Fr(r)):r.t===100?this.elems.push(new an(r)):r.t===51?this.elems.push(new Gn(r)):r.t===52?this.elems.push(new qn(r)):r.t===61?this.elems.push(new Wn(r)):r.t===15||r.t===16?this.elems.push(new jn(r)):r.t===13&&this.elems.push(new zn(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 Yn=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 gs=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 ys=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 vs=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Sr(e.spc),e.size&&(this.size=new ys(e.size)),e.bg&&(this.bg=new rn(e.bg)),e.br&&(this.br=new _r(e.br)),e.typo&&(this.typo=new rt(e.typo)),e.lout&&(this.lout=new gs(e.lout)),e.flex&&(this.flex=new Yn(e.flex))}},Kn=class{sm;lg;constructor(e){e??={},this.sm=new vs(e.sm),this.lg=new vs(e.lg)}};var at=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new Kn(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 Ve[this.t]}};var ct=class extends at{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 cn=class extends ct{constructor(e,r){super(e,r??3)}};var Xn=class extends at{value;constructor(e){super(6,e),e??={},this.value=e.value}};var Jn=class extends ct{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var ws=class extends at{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new Fe(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var uf=br(Oo());var Pc=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new Fe(e.color)}},Ac=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new Fe(e.color)}},Nc=class{enabled;delay;constructor(e={}){this.enabled=e.enabled,e.delay&&(this.delay=e.delay>100?e.delay:e.delay*1e3)}},Qn=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(e){e??={},this.navigation=new Ac(e.navigation),this.pagination=new Pc(e.pagination),this.autoplay=new Nc(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 bs=class extends at{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Pt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new Qn(e.conf),this.allowedTypes=e.allowedTypes}};var Es=class extends ct{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new $n(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Vr=class extends at{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Pt.getParsedElement(r);n&&this.elems.push(n)})}};var ln=class extends at{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 Pt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new ct(e);case 3:return new cn(e);case 6:return new Xn(e);case 11:return new _s(e);case 12:return new $r(e);case 61:return new Es(e);case 4:return new Vr(e);case 1:return new ln(e);case 13:return new ln(e,13);case 14:return new ct(e,14);case 15:case 16:return new Jn(e.t,e);case 18:return new cn(e,18);case 62:return new bs(e);case 19:return new ws(e);default:uf.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 $r=class extends at{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=Pt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new Xn(e.cBox)),this.elems.push(new ln(e.img,13));let r=new ct(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new ct(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new ct(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new Kn(n.style),i.style.lg.typo=new rt(Re(B({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new rt(Re(B({},i.style.sm.typo),{td:"line-through"})));let o=new Vr({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Pt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new Jn(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let l=new cn(e.btn,18);l.hide=!e.show?.btn,this.elems.push(l)}}e.symbol&&(this.symbol=new ct(e.symbol))}};var _s=class extends at{conf;prod;constructor(e){super(11,e),e??={},this.conf=new Lc(e.conf),this.prod=new $r(e.prod)}};var Ss=class extends Qn{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},Lc=class{lg;sm;constructor(e){e??={},this.lg=new Ss(e.lg),this.sm=new Ss(e.sm)}};var Cs=class extends Vr{constructor(e){super(e)}};var Zn=class{cont;elems=[];constructor(e){e=e??{},this.cont=new Cs(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Pt.getParsedElement(e);return r&&this.elems.push(r),r}};function xs(t,e){return dh(t,e,0,5)}function dh(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=xs(t,o);if(s)return s}}}}var Ts=class{title;subtitle;template;refreshPage;options;constructor(e={}){this.template=e.template??"IMAGE",this.refreshPage=e.refreshPage??!1,this.options=e.options??[],this.title=e.title,this.subtitle=e.subtitle}};var Bc=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===Ii.EXCLUSION}isABTesting(){return this.contentType===Ii.ABTESTING}isSingleContent(){return this.contentType===Ii.SINGLE}},Hi=class{videoConfig;savingsBarConfig;collectionFilterConfig;afterDeleteJS;afterRenderJS;innerCSS;outerCSS;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new os(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new Fo(e.savingsBarConfig)),e.collectionFilterConfig&&(this.collectionFilterConfig=new Ts(e.collectionFilterConfig)),this.afterDeleteJS=e.afterDeleteJS,this.afterRenderJS=e.afterRenderJS,this.innerCSS=e.innerCSS,this.outerCSS=e.outerCSS}},dt=class extends Bc{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=Vt({});constructor(e){if(super(e),this.id=e.id,this.currency=ce().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Zn(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 bt(r)),this.items=e.items?.map(r=>new st(r))??[],this.nonMutableItems=e.items?.map(r=>new st(r))??[],this.collections=e.collections?.map(r=>new ls(r))??[],this.discount=e.discount,this.placement=e.placement,e.customerData?.name){let r=e.customerData.name.split(" ");this.customerData={name:e.customerData.name,full_name:e.customerData.name,first_name:r[0],last_name:r[1]}}this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new us(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 Mo(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new ko(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new No(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new st(e.bundleFrom)),e.content&&(this.content=new Hi(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===Ft.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Ri.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Ri.PAGE_EMBED}isProgressBar(){return this.objective===Ft.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Ft.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Ft.CART_RECOVERY}isProductPromotion(){return this.objective===Ft.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Ka.COLLECTION}isBYOB(){return this.objective===Ft.BYOB}isStickyATC(){return this.objective===Ft.STICKY_ATC}isShoppableVideo(){return this.objective===Ft.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===Ft.SAVINGS_BAR}isCollectionFilter(){return this.objective===Ft.COLLECTION_FILTER}processPopup(e){let r=this.items[0],n={},i={};if(r){let l=r.selectedOrFirstVariant.value;n=Re(B(B({name:r.name,id:r.mID,link:r.link,vID:l.mID,image:r.variantImage},Et("price",l.price.d)),Et("comparePrice",l.price.cmp)),{quantity:r.quantity}),i={quantity:l.quantity}}let o={productCount:le.getCurrent().item_count},s=Hn(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new ir(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 hs(JSON.parse(s))}calculateDiscountData(e,r){let n=Er.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=Er.sum(e,s=>{let l=s.selectedOrFirstVariant.value.price;return l.cmp??l.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(Ut.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Er.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([Ut.STATIC,Ut.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(Ut.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType==="fixed_amount"?(o.discountAmount=this.discount.values[0],o.discountPercentage=o.actualPrice>0?o.discountAmount*100/o.actualPrice:0):(o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100),this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Ut.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===Ut.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((l,u)=>u.selectedOrFirstVariant.value.price.d-l.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return He.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return He.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(xs(62,this.widget?.elems))return!0;let r=xs(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===Ri.POPUP?e="Popup":e=mu.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=le.getCurrent(),r=Er.sum(e.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return B(B(B(B({productCount:e.item_count,product_count:e.item_count},Et("amount",e.total_price/100)),Et("originalAmount",e.original_total_price/100)),Et("total_line_items_discount",r/100)),Et("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.alwaysHaveVariations()}shouldSkipVariation(){return this.isSingleContent()||this.alwaysHaveVariations()?!0:!!this.variation}alwaysHaveVariations(){return this.isProgressBar()||this.isSavingsBar()}updateEffectivePrice(e,r,n=!1){let i=ce().currentItem;e.forEach(o=>{let s=o.selectedOrFirstVariant.value,l=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=l.d;else{let u=l.d*r/100;s.effectivePrice.value=l.d-u}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:xu(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Et(n,e[n]))}),r}};function gh(t,e){return e={exports:{}},t(e,e.exports),e.exports}var yh=Eh,vh=Sh,wh=Th,fr=[],Wt=[],bh=typeof Uint8Array<"u"?Uint8Array:Array,Mc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(un=0,ff=Mc.length;un<ff;++un)fr[un]=Mc[un],Wt[Mc.charCodeAt(un)]=un;var un,ff;Wt[45]=62;Wt[95]=63;function If(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 Eh(t){var e=If(t),r=e[0],n=e[1];return(r+n)*3/4-n}function _h(t,e,r){return(e+r)*3/4-r}function Sh(t){var e,r=If(t),n=r[0],i=r[1],o=new bh(_h(t,n,i)),s=0,l=i>0?n-4:n,u;for(u=0;u<l;u+=4)e=Wt[t.charCodeAt(u)]<<18|Wt[t.charCodeAt(u+1)]<<12|Wt[t.charCodeAt(u+2)]<<6|Wt[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Wt[t.charCodeAt(u)]<<2|Wt[t.charCodeAt(u+1)]>>4,o[s++]=e&255),i===1&&(e=Wt[t.charCodeAt(u)]<<10|Wt[t.charCodeAt(u+1)]<<4|Wt[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Ch(t){return fr[t>>18&63]+fr[t>>12&63]+fr[t>>6&63]+fr[t&63]}function xh(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Ch(n));return i.join("")}function Th(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,l=r-n;s<l;s+=o)i.push(xh(t,s,s+o>l?l:s+o));return n===1?(e=t[r-1],i.push(fr[e>>2]+fr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(fr[e>>10]+fr[e>>4&63]+fr[e<<2&63]+"=")),i.join("")}var Uc={byteLength:yh,toByteArray:vh,fromByteArray:wh};var Ih=function(e,r,n,i,o){var s,l,u=o*8-i-1,h=(1<<u)-1,g=h>>1,y=-7,E=n?o-1:0,b=n?-1:1,I=e[r+E];for(E+=b,s=I&(1<<-y)-1,I>>=-y,y+=u;y>0;s=s*256+e[r+E],E+=b,y-=8);for(l=s&(1<<-y)-1,s>>=-y,y+=i;y>0;l=l*256+e[r+E],E+=b,y-=8);if(s===0)s=1-g;else{if(s===h)return l?NaN:(I?-1:1)*(1/0);l=l+Math.pow(2,i),s=s-g}return(I?-1:1)*l*Math.pow(2,s-i)},Rh=function(e,r,n,i,o,s){var l,u,h,g=s*8-o-1,y=(1<<g)-1,E=y>>1,b=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=i?0:s-1,L=i?1:-1,D=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,l=y):(l=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-l))<1&&(l--,h*=2),l+E>=1?r+=b/h:r+=b*Math.pow(2,1-E),r*h>=2&&(l++,h/=2),l+E>=y?(u=0,l=y):l+E>=1?(u=(r*h-1)*Math.pow(2,o),l=l+E):(u=r*Math.pow(2,E-1)*Math.pow(2,o),l=0));o>=8;e[n+I]=u&255,I+=L,u/=256,o-=8);for(l=l<<o|u,g+=o;g>0;e[n+I]=l&255,I+=L,l/=256,g-=8);e[n+I-L]|=D*128},ei={read:Ih,write:Rh},Ds=gh(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=U,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var p=new Uint8Array(1),a={foo:function(){return 42}};return Object.setPrototypeOf(a,Uint8Array.prototype),Object.setPrototypeOf(p,a),p.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>n)throw new RangeError('The value "'+p+'" is invalid for option "size"');var a=new Uint8Array(p);return Object.setPrototypeOf(a,s.prototype),a}function s(p,a,c){if(typeof p=="number"){if(typeof a=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(p)}return l(p,a,c)}s.poolSize=8192;function l(p,a,c){if(typeof p=="string")return y(p,a);if(ArrayBuffer.isView(p))return b(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(p));if(ke(p,ArrayBuffer)||p&&ke(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ke(p,SharedArrayBuffer)||p&&ke(p.buffer,SharedArrayBuffer)))return I(p,a,c);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var d=p.valueOf&&p.valueOf();if(d!=null&&d!==p)return s.from(d,a,c);var x=L(p);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return s.from(p[Symbol.toPrimitive]("string"),a,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(p))}s.from=function(p,a,c){return l(p,a,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function u(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function h(p,a,c){return u(p),p<=0?o(p):a!==void 0?typeof c=="string"?o(p).fill(a,c):o(p).fill(a):o(p)}s.alloc=function(p,a,c){return h(p,a,c)};function g(p){return u(p),o(p<0?0:D(p)|0)}s.allocUnsafe=function(p){return g(p)},s.allocUnsafeSlow=function(p){return g(p)};function y(p,a){if((typeof a!="string"||a==="")&&(a="utf8"),!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a);var c=q(p,a)|0,d=o(c),x=d.write(p,a);return x!==c&&(d=d.slice(0,x)),d}function E(p){for(var a=p.length<0?0:D(p.length)|0,c=o(a),d=0;d<a;d+=1)c[d]=p[d]&255;return c}function b(p){if(ke(p,Uint8Array)){var a=new Uint8Array(p);return I(a.buffer,a.byteOffset,a.byteLength)}return E(p)}function I(p,a,c){if(a<0||p.byteLength<a)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<a+(c||0))throw new RangeError('"length" is outside of buffer bounds');var d;return a===void 0&&c===void 0?d=new Uint8Array(p):c===void 0?d=new Uint8Array(p,a):d=new Uint8Array(p,a,c),Object.setPrototypeOf(d,s.prototype),d}function L(p){if(s.isBuffer(p)){var a=D(p.length)|0,c=o(a);return c.length===0||p.copy(c,0,0,a),c}if(p.length!==void 0)return typeof p.length!="number"||Te(p.length)?o(0):E(p);if(p.type==="Buffer"&&Array.isArray(p.data))return E(p.data)}function D(p){if(p>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return p|0}function U(p){return+p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==s.prototype},s.compare=function(a,c){if(ke(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),ke(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(a)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===c)return 0;for(var d=a.length,x=c.length,O=0,W=Math.min(d,x);O<W;++O)if(a[O]!==c[O]){d=a[O],x=c[O];break}return d<x?-1:x<d?1:0},s.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(a,c){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return s.alloc(0);var d;if(c===void 0)for(c=0,d=0;d<a.length;++d)c+=a[d].length;var x=s.allocUnsafe(c),O=0;for(d=0;d<a.length;++d){var W=a[d];if(ke(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 q(p,a){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||ke(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(p));var c=p.length,d=arguments.length>2&&arguments[2]===!0;if(!d&&c===0)return 0;for(var x=!1;;)switch(a){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return ft(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return Ue(p).length;default:if(x)return d?-1:ft(p).length;a=(""+a).toLowerCase(),x=!0}}s.byteLength=q;function P(p,a,c){var d=!1;if((a===void 0||a<0)&&(a=0),a>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,a>>>=0,c<=a))return"";for(p||(p="utf8");;)switch(p){case"hex":return $(this,a,c);case"utf8":case"utf-8":return $e(this,a,c);case"ascii":return R(this,a,c);case"latin1":case"binary":return T(this,a,c);case"base64":return Ce(this,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,a,c);default:if(d)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),d=!0}}s.prototype._isBuffer=!0;function Q(p,a,c){var d=p[a];p[a]=p[c],p[c]=d}s.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<a;c+=2)Q(this,c,c+1);return this},s.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<a;c+=4)Q(this,c,c+3),Q(this,c+1,c+2);return this},s.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<a;c+=8)Q(this,c,c+7),Q(this,c+1,c+6),Q(this,c+2,c+5),Q(this,c+3,c+4);return this},s.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?$e(this,0,a):P.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(a){if(!s.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:s.compare(this,a)===0},s.prototype.inspect=function(){var a="",c=e.INSPECT_MAX_BYTES;return a=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(a+=" ... "),"<Buffer "+a+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(a,c,d,x,O){if(ke(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),!s.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(c===void 0&&(c=0),d===void 0&&(d=a?a.length:0),x===void 0&&(x=0),O===void 0&&(O=this.length),c<0||d>a.length||x<0||O>this.length)throw new RangeError("out of range index");if(x>=O&&c>=d)return 0;if(x>=O)return-1;if(c>=d)return 1;if(c>>>=0,d>>>=0,x>>>=0,O>>>=0,this===a)return 0;for(var W=O-x,ae=d-c,ye=Math.min(W,ae),pe=this.slice(x,O),Ae=a.slice(c,d),Be=0;Be<ye;++Be)if(pe[Be]!==Ae[Be]){W=pe[Be],ae=Ae[Be];break}return W<ae?-1:ae<W?1:0};function ge(p,a,c,d,x){if(p.length===0)return-1;if(typeof c=="string"?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,Te(c)&&(c=x?0:p.length-1),c<0&&(c=p.length+c),c>=p.length){if(x)return-1;c=p.length-1}else if(c<0)if(x)c=0;else return-1;if(typeof a=="string"&&(a=s.from(a,d)),s.isBuffer(a))return a.length===0?-1:X(p,a,c,d,x);if(typeof a=="number")return a=a&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(p,a,c):Uint8Array.prototype.lastIndexOf.call(p,a,c):X(p,[a],c,d,x);throw new TypeError("val must be string, number or Buffer")}function X(p,a,c,d,x){var O=1,W=p.length,ae=a.length;if(d!==void 0&&(d=String(d).toLowerCase(),d==="ucs2"||d==="ucs-2"||d==="utf16le"||d==="utf-16le")){if(p.length<2||a.length<2)return-1;O=2,W/=2,ae/=2,c/=2}function ye(Kt,wr){return O===1?Kt[wr]:Kt.readUInt16BE(wr*O)}var pe;if(x){var Ae=-1;for(pe=c;pe<W;pe++)if(ye(p,pe)===ye(a,Ae===-1?0:pe-Ae)){if(Ae===-1&&(Ae=pe),pe-Ae+1===ae)return Ae*O}else Ae!==-1&&(pe-=pe-Ae),Ae=-1}else for(c+ae>W&&(c=W-ae),pe=c;pe>=0;pe--){for(var Be=!0,Je=0;Je<ae;Je++)if(ye(p,pe+Je)!==ye(a,Je)){Be=!1;break}if(Be)return pe}return-1}s.prototype.includes=function(a,c,d){return this.indexOf(a,c,d)!==-1},s.prototype.indexOf=function(a,c,d){return ge(this,a,c,d,!0)},s.prototype.lastIndexOf=function(a,c,d){return ge(this,a,c,d,!1)};function oe(p,a,c,d){c=Number(c)||0;var x=p.length-c;d?(d=Number(d),d>x&&(d=x)):d=x;var O=a.length;d>O/2&&(d=O/2);for(var W=0;W<d;++W){var ae=parseInt(a.substr(W*2,2),16);if(Te(ae))return W;p[c+W]=ae}return W}function ne(p,a,c,d){return xe(ft(a,p.length-c),p,c,d)}function ue(p,a,c,d){return xe(tt(a),p,c,d)}function Pe(p,a,c,d){return xe(Ue(a),p,c,d)}function be(p,a,c,d){return xe(ve(a,p.length-c),p,c,d)}s.prototype.write=function(a,c,d,x){if(c===void 0)x="utf8",d=this.length,c=0;else if(d===void 0&&typeof c=="string")x=c,d=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(d)?(d=d>>>0,x===void 0&&(x="utf8")):(x=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var O=this.length-c;if((d===void 0||d>O)&&(d=O),a.length>0&&(d<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");for(var W=!1;;)switch(x){case"hex":return oe(this,a,c,d);case"utf8":case"utf-8":return ne(this,a,c,d);case"ascii":case"latin1":case"binary":return ue(this,a,c,d);case"base64":return Pe(this,a,c,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be(this,a,c,d);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 Ce(p,a,c){return a===0&&c===p.length?Uc.fromByteArray(p):Uc.fromByteArray(p.slice(a,c))}function $e(p,a,c){c=Math.min(p.length,c);for(var d=[],x=a;x<c;){var O=p[x],W=null,ae=O>239?4:O>223?3:O>191?2:1;if(x+ae<=c){var ye,pe,Ae,Be;switch(ae){case 1:O<128&&(W=O);break;case 2:ye=p[x+1],(ye&192)===128&&(Be=(O&31)<<6|ye&63,Be>127&&(W=Be));break;case 3:ye=p[x+1],pe=p[x+2],(ye&192)===128&&(pe&192)===128&&(Be=(O&15)<<12|(ye&63)<<6|pe&63,Be>2047&&(Be<55296||Be>57343)&&(W=Be));break;case 4:ye=p[x+1],pe=p[x+2],Ae=p[x+3],(ye&192)===128&&(pe&192)===128&&(Ae&192)===128&&(Be=(O&15)<<18|(ye&63)<<12|(pe&63)<<6|Ae&63,Be>65535&&Be<1114112&&(W=Be))}}W===null?(W=65533,ae=1):W>65535&&(W-=65536,d.push(W>>>10&1023|55296),W=56320|W&1023),d.push(W),x+=ae}return St(d)}var ze=4096;function St(p){var a=p.length;if(a<=ze)return String.fromCharCode.apply(String,p);for(var c="",d=0;d<a;)c+=String.fromCharCode.apply(String,p.slice(d,d+=ze));return c}function R(p,a,c){var d="";c=Math.min(p.length,c);for(var x=a;x<c;++x)d+=String.fromCharCode(p[x]&127);return d}function T(p,a,c){var d="";c=Math.min(p.length,c);for(var x=a;x<c;++x)d+=String.fromCharCode(p[x]);return d}function $(p,a,c){var d=p.length;(!a||a<0)&&(a=0),(!c||c<0||c>d)&&(c=d);for(var x="",O=a;O<c;++O)x+=It[p[O]];return x}function k(p,a,c){for(var d=p.slice(a,c),x="",O=0;O<d.length-1;O+=2)x+=String.fromCharCode(d[O]+d[O+1]*256);return x}s.prototype.slice=function(a,c){var d=this.length;a=~~a,c=c===void 0?d:~~c,a<0?(a+=d,a<0&&(a=0)):a>d&&(a=d),c<0?(c+=d,c<0&&(c=0)):c>d&&(c=d),c<a&&(c=a);var x=this.subarray(a,c);return Object.setPrototypeOf(x,s.prototype),x};function H(p,a,c){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+a>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(a,c,d){a=a>>>0,c=c>>>0,d||H(a,c,this.length);for(var x=this[a],O=1,W=0;++W<c&&(O*=256);)x+=this[a+W]*O;return x},s.prototype.readUintBE=s.prototype.readUIntBE=function(a,c,d){a=a>>>0,c=c>>>0,d||H(a,c,this.length);for(var x=this[a+--c],O=1;c>0&&(O*=256);)x+=this[a+--c]*O;return x},s.prototype.readUint8=s.prototype.readUInt8=function(a,c){return a=a>>>0,c||H(a,1,this.length),this[a]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(a,c){return a=a>>>0,c||H(a,2,this.length),this[a]|this[a+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(a,c){return a=a>>>0,c||H(a,2,this.length),this[a]<<8|this[a+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(a,c){return a=a>>>0,c||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(a,c){return a=a>>>0,c||H(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},s.prototype.readIntLE=function(a,c,d){a=a>>>0,c=c>>>0,d||H(a,c,this.length);for(var x=this[a],O=1,W=0;++W<c&&(O*=256);)x+=this[a+W]*O;return O*=128,x>=O&&(x-=Math.pow(2,8*c)),x},s.prototype.readIntBE=function(a,c,d){a=a>>>0,c=c>>>0,d||H(a,c,this.length);for(var x=c,O=1,W=this[a+--x];x>0&&(O*=256);)W+=this[a+--x]*O;return O*=128,W>=O&&(W-=Math.pow(2,8*c)),W},s.prototype.readInt8=function(a,c){return a=a>>>0,c||H(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},s.prototype.readInt16LE=function(a,c){a=a>>>0,c||H(a,2,this.length);var d=this[a]|this[a+1]<<8;return d&32768?d|4294901760:d},s.prototype.readInt16BE=function(a,c){a=a>>>0,c||H(a,2,this.length);var d=this[a+1]|this[a]<<8;return d&32768?d|4294901760:d},s.prototype.readInt32LE=function(a,c){return a=a>>>0,c||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},s.prototype.readInt32BE=function(a,c){return a=a>>>0,c||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},s.prototype.readFloatLE=function(a,c){return a=a>>>0,c||H(a,4,this.length),ei.read(this,a,!0,23,4)},s.prototype.readFloatBE=function(a,c){return a=a>>>0,c||H(a,4,this.length),ei.read(this,a,!1,23,4)},s.prototype.readDoubleLE=function(a,c){return a=a>>>0,c||H(a,8,this.length),ei.read(this,a,!0,52,8)},s.prototype.readDoubleBE=function(a,c){return a=a>>>0,c||H(a,8,this.length),ei.read(this,a,!1,52,8)};function te(p,a,c,d,x,O){if(!s.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>x||a<O)throw new RangeError('"value" argument is out of bounds');if(c+d>p.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(a,c,d,x){if(a=+a,c=c>>>0,d=d>>>0,!x){var O=Math.pow(2,8*d)-1;te(this,a,c,d,O,0)}var W=1,ae=0;for(this[c]=a&255;++ae<d&&(W*=256);)this[c+ae]=a/W&255;return c+d},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(a,c,d,x){if(a=+a,c=c>>>0,d=d>>>0,!x){var O=Math.pow(2,8*d)-1;te(this,a,c,d,O,0)}var W=d-1,ae=1;for(this[c+W]=a&255;--W>=0&&(ae*=256);)this[c+W]=a/ae&255;return c+d},s.prototype.writeUint8=s.prototype.writeUInt8=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,1,255,0),this[c]=a&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,2,65535,0),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,2,65535,0),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,4,4294967295,0),this[c+3]=a>>>24,this[c+2]=a>>>16,this[c+1]=a>>>8,this[c]=a&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,4,4294967295,0),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4},s.prototype.writeIntLE=function(a,c,d,x){if(a=+a,c=c>>>0,!x){var O=Math.pow(2,8*d-1);te(this,a,c,d,O-1,-O)}var W=0,ae=1,ye=0;for(this[c]=a&255;++W<d&&(ae*=256);)a<0&&ye===0&&this[c+W-1]!==0&&(ye=1),this[c+W]=(a/ae>>0)-ye&255;return c+d},s.prototype.writeIntBE=function(a,c,d,x){if(a=+a,c=c>>>0,!x){var O=Math.pow(2,8*d-1);te(this,a,c,d,O-1,-O)}var W=d-1,ae=1,ye=0;for(this[c+W]=a&255;--W>=0&&(ae*=256);)a<0&&ye===0&&this[c+W+1]!==0&&(ye=1),this[c+W]=(a/ae>>0)-ye&255;return c+d},s.prototype.writeInt8=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,1,127,-128),a<0&&(a=255+a+1),this[c]=a&255,c+1},s.prototype.writeInt16LE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,2,32767,-32768),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeInt16BE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,2,32767,-32768),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeInt32LE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,4,2147483647,-2147483648),this[c]=a&255,this[c+1]=a>>>8,this[c+2]=a>>>16,this[c+3]=a>>>24,c+4},s.prototype.writeInt32BE=function(a,c,d){return a=+a,c=c>>>0,d||te(this,a,c,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4};function fe(p,a,c,d,x,O){if(c+d>p.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function We(p,a,c,d,x){return a=+a,c=c>>>0,x||fe(p,a,c,4),ei.write(p,a,c,d,23,4),c+4}s.prototype.writeFloatLE=function(a,c,d){return We(this,a,c,!0,d)},s.prototype.writeFloatBE=function(a,c,d){return We(this,a,c,!1,d)};function Ke(p,a,c,d,x){return a=+a,c=c>>>0,x||fe(p,a,c,8),ei.write(p,a,c,d,52,8),c+8}s.prototype.writeDoubleLE=function(a,c,d){return Ke(this,a,c,!0,d)},s.prototype.writeDoubleBE=function(a,c,d){return Ke(this,a,c,!1,d)},s.prototype.copy=function(a,c,d,x){if(!s.isBuffer(a))throw new TypeError("argument should be a Buffer");if(d||(d=0),!x&&x!==0&&(x=this.length),c>=a.length&&(c=a.length),c||(c=0),x>0&&x<d&&(x=d),x===d||a.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=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),a.length-c<x-d&&(x=a.length-c+d);var O=x-d;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,d,x):Uint8Array.prototype.set.call(a,this.subarray(d,x),c),O},s.prototype.fill=function(a,c,d,x){if(typeof a=="string"){if(typeof c=="string"?(x=c,c=0,d=this.length):typeof d=="string"&&(x=d,d=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(a.length===1){var O=a.charCodeAt(0);(x==="utf8"&&O<128||x==="latin1")&&(a=O)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(c<0||this.length<c||this.length<d)throw new RangeError("Out of range index");if(d<=c)return this;c=c>>>0,d=d===void 0?this.length:d>>>0,a||(a=0);var W;if(typeof a=="number")for(W=c;W<d;++W)this[W]=a;else{var ae=s.isBuffer(a)?a:s.from(a,x),ye=ae.length;if(ye===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(W=0;W<d-c;++W)this[W+c]=ae[W%ye]}return this};var Xe=/[^+/0-9A-Za-z-_]/g;function ut(p){if(p=p.split("=")[0],p=p.trim().replace(Xe,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function ft(p,a){a=a||1/0;for(var c,d=p.length,x=null,O=[],W=0;W<d;++W){if(c=p.charCodeAt(W),c>55295&&c<57344){if(!x){if(c>56319){(a-=3)>-1&&O.push(239,191,189);continue}else if(W+1===d){(a-=3)>-1&&O.push(239,191,189);continue}x=c;continue}if(c<56320){(a-=3)>-1&&O.push(239,191,189),x=c;continue}c=(x-55296<<10|c-56320)+65536}else x&&(a-=3)>-1&&O.push(239,191,189);if(x=null,c<128){if((a-=1)<0)break;O.push(c)}else if(c<2048){if((a-=2)<0)break;O.push(c>>6|192,c&63|128)}else if(c<65536){if((a-=3)<0)break;O.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((a-=4)<0)break;O.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return O}function tt(p){for(var a=[],c=0;c<p.length;++c)a.push(p.charCodeAt(c)&255);return a}function ve(p,a){for(var c,d,x,O=[],W=0;W<p.length&&!((a-=2)<0);++W)c=p.charCodeAt(W),d=c>>8,x=c%256,O.push(x),O.push(d);return O}function Ue(p){return Uc.toByteArray(ut(p))}function xe(p,a,c,d){for(var x=0;x<d&&!(x+c>=a.length||x>=p.length);++x)a[x+c]=p[x];return x}function ke(p,a){return p instanceof a||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===a.name}function Te(p){return p!==p}var It=(function(){for(var p="0123456789abcdef",a=new Array(256),c=0;c<16;++c)for(var d=c*16,x=0;x<16;++x)a[d+x]=p[c]+p[x];return a})()}),_e=Ds.Buffer;Ds.SlowBuffer;Ds.INSPECT_MAX_BYTES;Ds.kMaxLength;var $c=function(e,r){return $c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},$c(e,r)};function Os(t,e){$c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var pn=(function(t){Os(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),Ge=(function(t){Os(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 Is(t){return t&&t.Math==Math&&t}function Rf(){return Is(typeof globalThis=="object"&&globalThis)||Is(typeof window=="object"&&window)||Is(typeof self=="object"&&self)||Is(typeof global=="object"&&global)||Function("return this")()}function Dh(){var t=Rf();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Oh=function(e){var r=Dh()?"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=_e.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},Ph=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(_e.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(_e.alloc(e))}:Oh}},Df=Ph();function Ah(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function jc(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Nh(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Lh(t){return ji(t)&&Object.prototype.toString.call(t)==="[object Date]"}function ji(t){return typeof t=="object"&&t!==null}function Ps(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Rs(t){if(ArrayBuffer.isView(t))return _e.from(t.buffer,t.byteOffset,t.byteLength);if(Ah(t))return _e.from(t);throw new Ge("Must use either Buffer or TypedArray")}var Bh=/^(?:[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,Of=function(t){return typeof t=="string"&&Bh.test(t)},Wc=function(t){if(!Of(t))throw new Ge('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 _e.from(e,"hex")},pf=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 lS=Math.pow(2,63)-1,uS=-Math.pow(2,63),Mh=Math.pow(2,53),Uh=-Math.pow(2,53);var Pf=4;var mn=(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 Ge("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=_e.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=_e.from(e,"binary"):Array.isArray(e)?this.buffer=_e.from(e):this.buffer=Rs(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Ge("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Ge("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 Ge("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=_e.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=_e.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Rs(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 mf(this.buffer.slice(0,this.position));throw new pn('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=_e.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=_e.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=Wc(e.$uuid)),!n)throw new Ge("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Pf?new mf(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t})();Object.defineProperty(mn.prototype,"_bsontype",{value:"Binary"});var kc=16,mf=(function(t){Os(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=_e.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===kc)i=Rs(r);else if(typeof r=="string")i=Wc(r);else throw new Ge("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,Pf)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=pf(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=pf(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 mn(this.id,mn.SUBTYPE_UUID)},e.generate=function(){var r=Df(kc);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,_e.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?Of(r):jc(r)?r.length!==kc?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=Wc(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})(mn),As=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t})();Object.defineProperty(As.prototype,"_bsontype",{value:"Code"});function kh(t){return ji(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var $i=(function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t})();Object.defineProperty($i.prototype,"_bsontype",{value:"DBRef"});var $t=void 0;try{$t=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 df=65536,Fh=1<<24,ri=df*df,Af=ri*ri,hf=Af/2,gf={},yf={},re=(function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=yf[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(yf[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=gf[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(gf[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>=Af)return t.MAX_UNSIGNED_VALUE}else{if(e<=-hf)return t.MIN_VALUE;if(e+1>=hf)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%ri|0,e/ri|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,l=0;l<e.length;l+=8){var u=Math.min(8,e.length-l),h=parseInt(e.substring(l,l+u),n);if(u<8){var g=t.fromNumber(Math.pow(n,u));s=s.mul(g).add(t.fromNumber(h))}else s=s.mul(o),s=s.add(t.fromNumber(h))}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 ji(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,l=e.high&65535,u=e.low>>>16,h=e.low&65535,g=0,y=0,E=0,b=0;return b+=o+h,E+=b>>>16,b&=65535,E+=i+u,y+=E>>>16,E&=65535,y+=n+l,g+=y>>>16,y&=65535,g+=r+s,g&=65535,t.fromBits(E<<16|b,g<<16|y,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($t){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?$t.div_u:$t.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,$t.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var l=Math.ceil(Math.log(n)/Math.LN2),u=l<=48?1:Math.pow(2,l-48),h=t.fromNumber(n),g=h.mul(e);g.isNegative()||g.gt(i);)n-=u,h=t.fromNumber(n,this.unsigned),g=h.mul(e);h.isZero()&&(h=t.ONE),o=o.add(h),i=i.sub(g)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),$t){var r=(this.unsigned?$t.rem_u:$t.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,$t.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)),$t){var r=$t.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,$t.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,l=e.high>>>16,u=e.high&65535,h=e.low>>>16,g=e.low&65535,y=0,E=0,b=0,I=0;return I+=s*g,b+=I>>>16,I&=65535,b+=o*g,E+=b>>>16,b&=65535,b+=s*h,E+=b>>>16,b&=65535,E+=i*g,y+=E>>>16,E&=65535,E+=o*h,y+=E>>>16,E&=65535,E+=s*u,y+=E>>>16,E&=65535,y+=n*g+i*h+o*u+s*l,y&=65535,t.fromBits(b<<16|I,y<<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)*ri+(this.low>>>0):this.high*ri+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,l="";;){var u=s.div(o),h=s.sub(u.mul(o)).toInt()>>>0,g=h.toString(e);if(s=u,s.isZero())return g+l;for(;g.length<6;)g="0"+g;l=""+g+l}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(Fh),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(re.prototype,"__isLong__",{value:!0});Object.defineProperty(re.prototype,"_bsontype",{value:"Long"});var Hh=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Vh=/^(\+|-)?(Infinity|inf)$/i,$h=/^(\+|-)?NaN$/i,Vi=6111,Fc=-6176,vf=6176,Wh=34,Hc=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),wf=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),bf=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),jh=/^([-+])?(\d+)?$/,Gh=31,Ef=16383,qh=30,zh=31;function _f(t){return!isNaN(parseInt(t,10))}function Yh(t){var e=re.fromNumber(1e9),r=re.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 re(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function Kh(t,e){if(!t&&!e)return{high:re.fromNumber(0),low:re.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new re(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new re(e.getLowBits(),0),s=r.multiply(i),l=r.multiply(o),u=n.multiply(i),h=n.multiply(o);return s=s.add(l.shiftRightUnsigned(32)),l=new re(l.getLowBits(),0).add(u).add(h.shiftRightUnsigned(32)),s=s.add(l.shiftRightUnsigned(32)),h=l.shiftLeft(32).add(new re(h.getLowBits(),0)),{high:s,low:h}}function Xh(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function ti(t,e){throw new Ge('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Gc=(function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(jc(e)){if(e.byteLength!==16)throw new Ge("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Ge("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,l=0,u=0,h=0,g=[0],y=0,E=0,b=0,I=0,L=0,D=0,U=new re(0,0),q=new re(0,0),P=0,Q=0;if(e.length>=7e3)throw new Ge(""+e+" not a valid Decimal128 string");var ge=e.match(Hh),X=e.match(Vh),oe=e.match($h);if(!ge&&!X&&!oe||e.length===0)throw new Ge(""+e+" not a valid Decimal128 string");if(ge){var ne=ge[2],ue=ge[4],Pe=ge[5],be=ge[6];ue&&be===void 0&&ti(e,"missing exponent power"),ue&&ne===void 0&&ti(e,"missing exponent base"),ue===void 0&&(Pe||be)&&ti(e,"missing e before exponent")}if((e[Q]==="+"||e[Q]==="-")&&(r=e[Q++]==="-"),!_f(e[Q])&&e[Q]!=="."){if(e[Q]==="i"||e[Q]==="I")return new t(_e.from(r?wf:bf));if(e[Q]==="N")return new t(_e.from(Hc))}for(;_f(e[Q])||e[Q]===".";){if(e[Q]==="."){n&&ti(e,"contains multiple periods"),n=!0,Q=Q+1;continue}y<34&&(e[Q]!=="0"||i)&&(i||(h=s),i=!0,g[E++]=parseInt(e[Q],10),y=y+1),i&&(l=l+1),n&&(u=u+1),s=s+1,Q=Q+1}if(n&&!s)throw new Ge(""+e+" not a valid Decimal128 string");if(e[Q]==="e"||e[Q]==="E"){var Ce=e.substr(++Q).match(jh);if(!Ce||!Ce[2])return new t(_e.from(Hc));L=parseInt(Ce[0],10),Q=Q+Ce[0].length}if(e[Q])return new t(_e.from(Hc));if(b=0,!y)b=0,I=0,g[0]=0,l=1,y=1,o=0;else if(I=y-1,o=l,o!==1)for(;g[h+o-1]===0;)o=o-1;for(L<=u&&u-L>16384?L=Fc:L=L-u;L>Vi;){if(I=I+1,I-b>Wh){var $e=g.join("");if($e.match(/^0+$/)){L=Vi;break}ti(e,"overflow")}L=L-1}for(;L<Fc||y<l;){if(I===0&&o<y){L=Fc,o=0;break}if(y<l?l=l-1:I=I-1,L<Vi)L=L+1;else{var $e=g.join("");if($e.match(/^0+$/)){L=Vi;break}ti(e,"overflow")}}if(I-b+1<o){var ze=s;n&&(h=h+1,ze=ze+1),r&&(h=h+1,ze=ze+1);var St=parseInt(e[h+I+1],10),R=0;if(St>=5&&(R=1,St===5)){for(R=g[I]%2===1?1:0,D=h+I+2;D<ze;D++)if(parseInt(e[D],10)){R=1;break}}if(R){for(var T=I;T>=0;T--)if(++g[T]>9&&(g[T]=0,T===0))if(L<Vi)L=L+1,g[T]=1;else return new t(_e.from(r?wf:bf))}}if(U=re.fromNumber(0),q=re.fromNumber(0),o===0)U=re.fromNumber(0),q=re.fromNumber(0);else if(I-b<17){var T=b;for(q=re.fromNumber(g[T++]),U=new re(0,0);T<=I;T++)q=q.multiply(re.fromNumber(10)),q=q.add(re.fromNumber(g[T]))}else{var T=b;for(U=re.fromNumber(g[T++]);T<=I-17;T++)U=U.multiply(re.fromNumber(10)),U=U.add(re.fromNumber(g[T]));for(q=re.fromNumber(g[T++]);T<=I;T++)q=q.multiply(re.fromNumber(10)),q=q.add(re.fromNumber(g[T]))}var $=Kh(U,re.fromString("100000000000000000"));$.low=$.low.add(q),Xh($.low,q)&&($.high=$.high.add(re.fromNumber(1))),P=L+vf;var k={low:re.fromNumber(0),high:re.fromNumber(0)};$.high.shiftRightUnsigned(49).and(re.fromNumber(1)).equals(re.fromNumber(1))?(k.high=k.high.or(re.fromNumber(3).shiftLeft(61)),k.high=k.high.or(re.fromNumber(P).and(re.fromNumber(16383).shiftLeft(47))),k.high=k.high.or($.high.and(re.fromNumber(0x7fffffffffff)))):(k.high=k.high.or(re.fromNumber(P&16383).shiftLeft(49)),k.high=k.high.or($.high.and(re.fromNumber(562949953421311)))),k.low=$.low,r&&(k.high=k.high.or(re.fromString("9223372036854775808")));var H=_e.alloc(16);return Q=0,H[Q++]=k.low.low&255,H[Q++]=k.low.low>>8&255,H[Q++]=k.low.low>>16&255,H[Q++]=k.low.low>>24&255,H[Q++]=k.low.high&255,H[Q++]=k.low.high>>8&255,H[Q++]=k.low.high>>16&255,H[Q++]=k.low.high>>24&255,H[Q++]=k.high.low&255,H[Q++]=k.high.low>>8&255,H[Q++]=k.high.low>>16&255,H[Q++]=k.high.low>>24&255,H[Q++]=k.high.high&255,H[Q++]=k.high.high>>8&255,H[Q++]=k.high.high>>16&255,H[Q++]=k.high.high>>24&255,new t(H)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,l,u={parts:[0,0,0,0]},h,g,y=[];o=0;var E=this.bytes,b=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,I=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,L=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,D=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var U={low:new re(b,I),high:new re(L,D)};U.high.lessThan(re.ZERO)&&y.push("-");var q=D>>26&Gh;if(q>>3===3){if(q===qh)return y.join("")+"Infinity";if(q===zh)return"NaN";e=D>>15&Ef,l=8+(D>>14&1)}else l=D>>14&7,e=D>>17&Ef;var P=e-vf;if(u.parts[0]=(D&16383)+((l&15)<<14),u.parts[1]=L,u.parts[2]=I,u.parts[3]=b,u.parts[0]===0&&u.parts[1]===0&&u.parts[2]===0&&u.parts[3]===0)s=!0;else for(g=3;g>=0;g--){var Q=0,ge=Yh(u);if(u=ge.quotient,Q=ge.rem.low,!!Q)for(h=8;h>=0;h--)n[g*9+h]=Q%10,Q=Math.floor(Q/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var X=r-1+P;if(X>=34||X<=-7||P>0){if(r>34)return y.push("".concat(0)),P>0?y.push("E+".concat(P)):P<0&&y.push("E".concat(P)),y.join("");y.push("".concat(n[o++])),r=r-1,r&&y.push(".");for(var i=0;i<r;i++)y.push("".concat(n[o++]));y.push("E"),X>0?y.push("+".concat(X)):y.push("".concat(X))}else if(P>=0)for(var i=0;i<r;i++)y.push("".concat(n[o++]));else{var oe=r+P;if(oe>0)for(var i=0;i<oe;i++)y.push("".concat(n[o++]));else y.push("0");for(y.push(".");oe++<0;)y.push("0");for(var i=0;i<r-Math.max(oe-1,0);i++)y.push("".concat(n[o++]))}return y.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(Gc.prototype,"_bsontype",{value:"Decimal128"});var Ns=(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(Ns.prototype,"_bsontype",{value:"Double"});var Ls=(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(Ls.prototype,"_bsontype",{value:"Int32"});var qc=(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(qc.prototype,"_bsontype",{value:"MaxKey"});var zc=(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(zc.prototype,"_bsontype",{value:"MinKey"});var Jh=new RegExp("^[0-9a-fA-F]{24}$"),fn=null,ur=Symbol("id"),lt=(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 Ge("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=_e.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[ur]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[ur]=r instanceof _e?r:Rs(r);else if(typeof r=="string")if(r.length===12){var n=_e.from(r);if(n.byteLength===12)this[ur]=n;else throw new Ge("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Jh.test(r))this[ur]=_e.from(r,"hex");else throw new Ge("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Ge("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[ur]},set:function(e){this[ur]=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=_e.alloc(12);return n.writeUInt32BE(e,0),fn===null&&(fn=Df(5)),n[4]=fn[0],n[5]=fn[1],n[6]=fn[2],n[7]=fn[3],n[8]=fn[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[ur][11]===e[ur][11]&&this[ur].equals(e[ur]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&jc(this.id))return e===_e.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 _e.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=_e.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 Ge("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(_e.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(lt.prototype,"generate",{value:Ps(function(t){return lt.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(lt.prototype,"getInc",{value:Ps(function(){return lt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(lt.prototype,"get_inc",{value:Ps(function(){return lt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(lt,"get_inc",{value:Ps(function(){return lt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(lt.prototype,"_bsontype",{value:"ObjectID"});function Qh(t){return t.split("").sort().join("")}var Wi=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=Qh(r??""),this.pattern.indexOf("\0")!==-1)throw new pn("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new pn("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 pn("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 Ge("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t})();Object.defineProperty(Wi.prototype,"_bsontype",{value:"BSONRegExp"});var Yc=(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(Yc.prototype,"_bsontype",{value:"Symbol"});var Zh=re,Nf=(function(t){Os(e,t);function e(r,n){var i=this;return i instanceof e?(re.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:ji(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(re.fromInt(r,!0))},e.fromNumber=function(r){return new e(re.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(re.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=re.MAX_UNSIGNED_VALUE,e})(Zh);function eg(t){return ji(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Lf=2147483647,Bf=-2147483648,Mf=9223372036854776e3,Uf=-9223372036854776e3,tg={$oid:lt,$binary:mn,$uuid:mn,$symbol:Yc,$numberInt:Ls,$numberDecimal:Gc,$numberDouble:Ns,$numberLong:re,$minKey:zc,$maxKey:qc,$regex:Wi,$regularExpression:Wi,$timestamp:Nf};function kf(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Bf&&t<=Lf)return new Ls(t);if(t>=Uf&&t<=Mf)return re.fromNumber(t)}return new Ns(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(y){return y.startsWith("$")&&t[y]!=null}),n=0;n<r.length;n++){var i=tg[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):re.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var l=Object.assign({},t);return t.$scope&&(l.$scope=kf(t.$scope)),As.fromExtendedJSON(t)}if(kh(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof $i)return u;var h=Object.keys(u).filter(function(y){return y.startsWith("$")}),g=!0;if(h.forEach(function(y){["$ref","$id","$db"].indexOf(y)===-1&&(g=!1)}),g)return $i.fromExtendedJSON(u)}return t}function rg(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Wr(r,e)}finally{e.seenObjects.pop()}})}function Sf(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function Wr(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(U){return U.obj===t});if(r!==-1){var n=e.seenObjects.map(function(U){return U.propertyName}),i=n.slice(0,r).map(function(U){return"".concat(U," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(U){return"".concat(U," -> ")}).join(""),l=n[n.length-1],u=" ".repeat(i.length+o.length/2),h="-".repeat(s.length+(o.length+l.length)/2-1);throw new Ge(`Converting circular structure to EJSON:
|
|
11
|
-
`+" ".concat(i).concat(o).concat(s).concat(l,`
|
|
12
|
-
`)+" ".concat(u,"\\").concat(h,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return rg(t,e);if(t===void 0)return null;if(t instanceof Date||Lh(t)){var g=t.getTime(),y=g>-1&&g<2534023188e5;return e.legacy?e.relaxed&&y?{$date:t.getTime()}:{$date:Sf(t)}:e.relaxed&&y?{$date:Sf(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=Bf&&t<=Lf,b=t>=Uf&&t<=Mf;if(E)return{$numberInt:t.toString()};if(b)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Nh(t)){var I=t.flags;if(I===void 0){var L=t.toString().match(/[gimuy]*$/);L&&(I=L[0])}var D=new Wi(t.source,I);return D.toExtendedJSON(e)}return t!=null&&typeof t=="object"?ig(t,e):t}var ng={Binary:function(t){return new mn(t.value(),t.sub_type)},Code:function(t){return new As(t.code,t.scope)},DBRef:function(t){return new $i(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Gc(t.bytes)},Double:function(t){return new Ns(t.value)},Int32:function(t){return new Ls(t.value)},Long:function(t){return re.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 qc},MinKey:function(){return new zc},ObjectID:function(t){return new lt(t)},ObjectId:function(t){return new lt(t)},BSONRegExp:function(t){return new Wi(t.pattern,t.options)},Symbol:function(t){return new Yc(t.value)},Timestamp:function(t){return Nf.fromBits(t.low,t.high)}};function ig(t,e){if(t==null||typeof t!="object")throw new pn("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=Wr(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(eg(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var l=ng[t._bsontype];if(!l)throw new Ge("Unrecognized or invalid _bsontype: "+t._bsontype);s=l(s)}return r==="Code"&&s.scope?s=new As(s.code,Wr(s.scope,e)):r==="DBRef"&&s.oid&&(s=new $i(Wr(s.collection,e),Wr(s.oid,e),Wr(s.db,e),Wr(s.fields,e))),s.toExtendedJSON(e)}else throw new pn("_bsontype must be a string, but was: "+typeof r)}var Cf;(function(t){function e(o,s){var l=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof l.relaxed=="boolean"&&(l.strict=!l.relaxed),typeof l.strict=="boolean"&&(l.relaxed=!l.strict),JSON.parse(o,function(u,h){if(u.indexOf("\0")!==-1)throw new pn("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(u)));return kf(h,l)})}t.parse=e;function r(o,s,l,u){l!=null&&typeof l=="object"&&(u=l,l=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(u=s,s=void 0,l=0);var h=Object.assign({relaxed:!0,legacy:!1},u,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=Wr(o,h);return JSON.stringify(g,s,l)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(Cf||(Cf={}));var xf,Tf=Rf();Tf.Map?xf=Tf.Map:xf=(function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t})();var fS=re.fromNumber(Mh),pS=re.fromNumber(Uh);var Vc=new Uint8Array(8),mS=new DataView(Vc.buffer,Vc.byteOffset,Vc.byteLength);var og=1024*1024*17,dS=_e.alloc(og);var jr=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 Se=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new lt(i):new lt,this.occurred=new Date,n&&(this.trigger=new jr(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(e){e&&(this.videos=[e.id],this.properties.current??={videoID:e.id})}};var Ff=0;function Hf(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}function Kc(t=document.head){return Vf(Rt.styleURL,t,"cooee-global-styles")}function sg(t=document.head){return Vf(Rt.swiperStyleURL,t,"cooee-swiper-styles")}function Vf(t,e=document.head,r){return new Promise(n=>{if(e.querySelector(`#${r}`)){n();return}let o=document.createElement("link");o.rel="stylesheet",o.href=t,o.id=r,o.onload=()=>{n()},o.onerror=()=>{console.error("Failed to load stylesheet:",t),n()},e.appendChild(o)})}function Ir(t,e=document.head){if(!t)return;Ff++;let r=document.createElement("style");r.id=`cooee-app-css-${Ff}`,r.textContent=t,e.appendChild(r)}function $f(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}function Xc(t){if(t)try{(0,eval)(t)}catch(e){console.error("Failed to execute script:",e)}}async function Bs(){let t=(await import(`${nu}/swiper-bundle.min.mjs`)).Swiper;return window.CooeeSDK.Swiper=t}async function Jc(t,e=!0){if(!t)return;let r=[];e&&r.push(sg(t)),r.push(Kc(t)),await Promise.all(r);let n=He.get().website.commonCSS;Ir(n,t)}var Ms=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 ag=" daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\bperl\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",cg=/bot|crawl|http|lighthouse|scan|search|spider/i,Gi;function lg(){if(Gi instanceof RegExp)return Gi;try{Gi=new RegExp(ag,"i")}catch{Gi=cg}return Gi}function Wf(t){return!!t&&lg().test(t)}var ug="2.0.4",ll=500,jf="user-agent",ai="",Gf="?",$s="function",zr="undefined",ci="object",ul="string",Ct="browser",Rr="cpu",dr="device",Zt="engine",jt="os",oi="result",V="name",A="type",F="vendor",j="version",xt="architecture",to="major",M="model",Zi="console",se="mobile",Ne="tablet",Ze="smarttv",pr="wearable",Us="xr",eo="embedded",qi="inapp",ml="brands",hn="formFactors",dl="fullVersionList",si="platform",hl="platformVersion",Gs="bitness",Yr="sec-ch-ua",fg=Yr+"-full-version-list",pg=Yr+"-arch",mg=Yr+"-"+Gs,dg=Yr+"-form-factors",hg=Yr+"-"+se,gg=Yr+"-"+M,op=Yr+"-"+si,yg=op+"-version",sp=[ml,dl,se,M,si,hl,xt,hn,Gs],ks="Amazon",ni="Apple",qf="ASUS",zf="BlackBerry",dn="Google",Yf="Huawei",Qc="Lenovo",Kf="Honor",Fs="LG",Zc="Microsoft",el="Motorola",tl="Nvidia",Xf="OnePlus",rl="OPPO",zi="Samsung",Jf="Sharp",Yi="Sony",nl="Xiaomi",il="Zebra",Qf="Chrome",Zf="Chromium",Gr="Chromecast",Vs="Edge",Ki="Firefox",Xi="Opera",ol="Facebook",ep="Sogou",ii="Mobile ",Ji=" Browser",fl="Windows",vg=typeof window!==zr,Tt=vg&&window.navigator?window.navigator:void 0,qr=Tt&&Tt.userAgentData?Tt.userAgentData:void 0,wg=function(t,e){var r={},n=e;if(!Ws(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},qs=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},pl=function(t,e){if(typeof t===ci&&t.length>0){for(var r in t)if(Dr(e)==Dr(t[r]))return!0;return!1}return ui(t)?Dr(e)==Dr(t):!1},Ws=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Ws(t[r]):!1)},ui=function(t){return typeof t===ul},sl=function(t){if(t){for(var e=[],r=li(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=js(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=js(r[n]);return e}},Dr=function(t){return ui(t)?t.toLowerCase():t},al=function(t){return ui(t)?li(/[^\d\.]/g,t).split(".")[0]:void 0},Or=function(t){for(var e in t){var r=t[e];typeof r==ci&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},li=function(t,e){return ui(e)?e.replace(t,ai):e},Qi=function(t){return li(/\\?\"/g,t)},js=function(t,e){if(ui(t))return t=li(/^\s\s*/,t),typeof e===zr?t:t.substring(0,ll)},cl=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,l,u;r<e.length&&!l;){var h=e[r],g=e[r+1];for(n=i=0;n<h.length&&!l&&h[n];)if(l=h[n++].exec(t),l)for(o=0;o<g.length;o++)u=l[++i],s=g[o],typeof s===ci&&s.length>0?s.length===2?typeof s[1]==$s?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===$s&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=u?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=u?s[1].call(this,u,s[2]):void 0:s.length==3?this[s[0]]=u?u.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=u?s[3].apply(this,[u.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=u||void 0;r+=2}},mr=function(t,e){for(var r in e)if(typeof e[r]===ci&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(pl(e[r][n],t))return r===Gf?void 0:r}else if(pl(e[r],t))return r===Gf?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},tp={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:""},rp={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},bg={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"},np={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[j,[V,ii+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[j,[V,Vs+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[j,[V,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[V,j],[/opios[\/ ]+([\w\.]+)/i],[j,[V,Xi+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[j,[V,Xi+" GX"]],[/\bopr\/([\w\.]+)/i],[j,[V,Xi]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[j,[V,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[j,[V,"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],[V,j],[/quark(?:pc)?\/([-\w\.]+)/i],[j,[V,"Quark"]],[/\bddg\/([\w\.]+)/i],[j,[V,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[j,[V,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[j,[V,"WeChat"]],[/konqueror\/([\w\.]+)/i],[j,[V,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[j,[V,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[j,[V,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[j,[V,"Smart "+Qc+Ji]],[/(avast|avg)\/([\w\.]+)/i],[[V,/(.+)/,"$1 Secure"+Ji],j],[/\bfocus\/([\w\.]+)/i],[j,[V,Ki+" Focus"]],[/\bopt\/([\w\.]+)/i],[j,[V,Xi+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[j,[V,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[j,[V,"Dolphin"]],[/coast\/([\w\.]+)/i],[j,[V,Xi+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[j,[V,"MIUI"+Ji]],[/fxios\/([\w\.-]+)/i],[j,[V,ii+Ki]],[/\bqihoobrowser\/?([\w\.]*)/i],[j,[V,"360"]],[/\b(qq)\/([\w\.]+)/i],[[V,/(.+)/,"$1Browser"],j],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[V,/(.+)/,"$1"+Ji],j],[/samsungbrowser\/([\w\.]+)/i],[j,[V,zi+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[j,[V,ep+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[V,ep+" Mobile"],j],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[V,j],[/(lbbrowser|rekonq)/i],[V],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[j,V],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[V,ol],j,[A,qi]],[/(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],[V,j,[A,qi]],[/\bgsa\/([\w\.]+) .*safari\//i],[j,[V,"GSA"],[A,qi]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[j,[V,"TikTok"],[A,qi]],[/\[(linkedin)app\]/i],[V,[A,qi]],[/(chromium)[\/ ]([-\w\.]+)/i],[V,j],[/headlesschrome(?:\/([\w\.]+)| )/i],[j,[V,Qf+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[j,[V,Vs+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[V,Qf+" WebView"],j],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[j,[V,"Android"+Ji]],[/chrome\/([\w\.]+) mobile/i],[j,[V,ii+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[V,j],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[j,[V,ii+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[V,ii+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[j,V],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[V,[j,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[V,j],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[V,ii+Ki],j],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[V,"Netscape"],j],[/(wolvic|librewolf)\/([\w\.]+)/i],[V,j],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[j,[V,Ki+" 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],[V,[j,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[V,[j,/[^\d\.]+./,ai]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[xt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[xt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[xt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[xt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[xt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[xt,/ower/,ai,Dr]],[/ sun4\w[;\)]/i],[[xt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[xt,Dr]]],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,zi],[A,Ne]],[/\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,zi],[A,se]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[M,[F,ni],[A,se]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[M,[F,ni],[A,Ne]],[/(macintosh);/i],[M,[F,ni]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[M,[F,Jf],[A,se]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[M,[F,Kf],[A,Ne]],[/honor([-\w ]+)[;\)]/i],[M,[F,Kf],[A,se]],[/\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,Yf],[A,Ne]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[M,[F,Yf],[A,se]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[M,/_/g," "],[F,nl],[A,Ne]],[/\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,nl],[A,se]],[/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,Xf],[A,se]],[/; (\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,rl],[A,se]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[M,[F,mr,{OnePlus:["203","304","403","404","413","415"],"*":rl}],[A,Ne]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[M,[F,"BLU"],[A,se]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[M,[F,"Vivo"],[A,se]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[M,[F,"Realme"],[A,se]],[/(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,Qc],[A,Ne]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[M,[F,Qc],[A,se]],[/\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,el],[A,se]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[M,[F,el],[A,Ne]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[M,[F,Fs],[A,Ne]],[/(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,Fs],[A,se]],[/(nokia) (t[12][01])/i],[F,M,[A,Ne]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[M,/_/g," "],[A,se],[F,"Nokia"]],[/(pixel (c|tablet))\b/i],[M,[F,dn],[A,Ne]],[/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,dn],[A,se]],[/(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,Yi],[A,se]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[M,"Xperia Tablet"],[F,Yi],[A,Ne]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[M,[F,ks],[A,Ne]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[M,/(.+)/g,"Fire Phone $1"],[F,ks],[A,se]],[/(playbook);[-\w\),; ]+(rim)/i],[M,F,[A,Ne]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[M,[F,zf],[A,se]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[M,[F,qf],[A,Ne]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[M,[F,qf],[A,se]],[/(nexus 9)/i],[M,[F,"HTC"],[A,Ne]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[F,[M,/_/g," "],[A,se]],[/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"],[A,Ne]],[/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"],[A,se]],[/(itel) ((\w+))/i],[[F,Dr],M,[A,mr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[M,[F,"Acer"],[A,Ne]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[M,[F,"Meizu"],[A,se]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[M,[F,"Ulefone"],[A,se]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[M,[F,"Energizer"],[A,se]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[M,[F,"Cat"],[A,se]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[M,[F,"Smartfren"],[A,se]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[M,[F,"Nothing"],[A,se]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[M,[F,"Archos"],[A,Ne]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[M,[F,"Archos"],[A,se]],[/; (n159v)/i],[M,[F,"HMD"],[A,se]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[F,M,[A,Ne]],[/(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,[A,se]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[F,M,[A,Ne]],[/(surface duo)/i],[M,[F,Zc],[A,Ne]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[M,[F,"Fairphone"],[A,se]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[M,[F,tl],[A,Ne]],[/(sprint) (\w+)/i],[F,M,[A,se]],[/(kin\.[onetw]{3})/i],[[M,/\./g," "],[F,Zc],[A,se]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[M,[F,il],[A,Ne]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[M,[F,il],[A,se]],[/smart-tv.+(samsung)/i],[F,[A,Ze]],[/hbbtv.+maple;(\d+)/i],[[M,/^/,"SmartTV"],[F,zi],[A,Ze]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[F,M,[A,Ze]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[F,Fs],[A,Ze]],[/(apple) ?tv/i],[F,[M,ni+" TV"],[A,Ze]],[/crkey.*devicetype\/chromecast/i],[[M,Gr+" Third Generation"],[F,dn],[A,Ze]],[/crkey.*devicetype\/([^/]*)/i],[[M,/^/,"Chromecast "],[F,dn],[A,Ze]],[/fuchsia.*crkey/i],[[M,Gr+" Nest Hub"],[F,dn],[A,Ze]],[/crkey/i],[[M,Gr],[F,dn],[A,Ze]],[/(portaltv)/i],[M,[F,ol],[A,Ze]],[/droid.+aft(\w+)( bui|\))/i],[M,[F,ks],[A,Ze]],[/(shield \w+ tv)/i],[M,[F,tl],[A,Ze]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[M,[F,Jf],[A,Ze]],[/(bravia[\w ]+)( bui|\))/i],[M,[F,Yi],[A,Ze]],[/(mi(tv|box)-?\w+) bui/i],[M,[F,nl],[A,Ze]],[/Hbbtv.*(technisat) (.*);/i],[F,M,[A,Ze]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[F,/.+\/(\w+)/,"$1",mr,{LG:"lge"}],[M,js],[A,Ze]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[M,[A,Ze]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[A,Ze]],[/(playstation \w+)/i],[M,[F,Yi],[A,Zi]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[M,[F,Zc],[A,Zi]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[F,M,[A,Zi]],[/droid.+; (shield)( bui|\))/i],[M,[F,tl],[A,Zi]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[M,[F,zi],[A,pr]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[F,M,[A,pr]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[M,[F,rl],[A,pr]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[M,[F,ni],[A,pr]],[/(opwwe\d{3})/i],[M,[F,Xf],[A,pr]],[/(moto 360)/i],[M,[F,el],[A,pr]],[/(smartwatch 3)/i],[M,[F,Yi],[A,pr]],[/(g watch r)/i],[M,[F,Fs],[A,pr]],[/droid.+; (wt63?0{2,3})\)/i],[M,[F,il],[A,pr]],[/droid.+; (glass) \d/i],[M,[F,dn],[A,Us]],[/(pico) (4|neo3(?: link|pro)?)/i],[F,M,[A,Us]],[/(quest( \d| pro)?s?).+vr/i],[M,[F,ol],[A,Us]],[/mobile vr; rv.+firefox/i],[[A,Us]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[F,[A,eo]],[/(aeobc)\b/i],[M,[F,ks],[A,eo]],[/(homepod).+mac os/i],[M,[F,ni],[A,eo]],[/windows iot/i],[[A,eo]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[M,[A,mr,{mobile:"Mobile",xr:"VR","*":Ne}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[A,Ne]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[A,se]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[M,[F,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[j,[V,Vs+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[V,j],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[j,[V,"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],[V,j],[/ladybird\//i],[[V,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[j,V]],os:[[/(windows nt) (6\.[23]); arm/i],[[V,/N/,"R"],[j,mr,tp]],[/(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],[V,j],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[j,/(;|\))/g,"",mr,tp],[V,fl]],[/(windows ce)\/?([\d\.]*)/i],[V,j],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[j,/_/g,"."],[V,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[V,"macOS"],[j,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[j,[V,Gr+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[j,[V,Gr+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[j,[V,Gr+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[j,[V,Gr+" Linux"]],[/crkey\/([\d\.]+)/i],[j,[V,Gr]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[j,V],[/(ubuntu) ([\w\.]+) like android/i],[[V,/(.+)/,"$1 Touch"],j],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[V,j],[/\(bb(10);/i],[j,[V,zf]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[j,[V,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[j,[V,Ki+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[j,[V,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[j,mr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[V,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[j,[V,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[V,"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],[V,j],[/(sunos) ?([\d\.]*)/i],[[V,"Solaris"],j],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[V,j]]},Hs=(function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Or.call(t.init,[[Ct,[V,j,to,A]],[Rr,[xt]],[dr,[A,M,F]],[Zt,[V,j]],[jt,[V,j]]]),Or.call(t.isIgnore,[[Ct,[j,to]],[Zt,[j]],[jt,[j]]]),Or.call(t.isIgnoreRgx,[[Ct,/ ?browser$/i],[jt,/ ?os$/i]]),Or.call(t.toString,[[Ct,[V,j]],[Rr,[xt]],[dr,[F,M]],[Zt,[V,j]],[jt,[V,j]]]),t})(),Eg=function(t,e){var r=Hs.init[e],n=Hs.isIgnore[e]||0,i=Hs.isIgnoreRgx[e]||0,o=Hs.toString[e]||0;function s(){Or.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return qr?qr.getHighEntropyValues(sp).then(function(l){return t.setCH(new ap(l,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=oi&&(s.prototype.is=function(l){var u=!1;for(var h in this)if(this.hasOwnProperty(h)&&!pl(n,h)&&Dr(i?li(i,this[h]):this[h])==Dr(i?li(i,l):l)){if(u=!0,l!=zr)break}else if(l==zr&&u){u=!u;break}return u},s.prototype.toString=function(){var l=ai;for(var u in o)typeof this[o[u]]!==zr&&(l+=(l?" ":ai)+this[o[u]]);return l||zr}),qr||(s.prototype.then=function(l){var u=this,h=function(){for(var y in u)u.hasOwnProperty(y)&&(this[y]=u[y])};h.prototype={is:s.prototype.is,toString:s.prototype.toString};var g=new h;return l(g),g}),new s};function ap(t,e){if(t=t||{},Or.call(this,sp),e)Or.call(this,[[ml,sl(t[Yr])],[dl,sl(t[fg])],[se,/\?1/.test(t[hg])],[M,Qi(t[gg])],[si,Qi(t[op])],[hl,Qi(t[yg])],[xt,Qi(t[pg])],[hn,sl(t[dg])],[Gs,Qi(t[mg])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==zr&&(this[r]=t[r])}function ip(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Tt&&Tt.userAgent==this.ua)switch(this.itemType){case Ct:Tt.brave&&typeof Tt.brave.isBrave==$s&&this.set(V,"Brave");break;case dr:!this.get(A)&&qr&&qr[se]&&this.set(A,se),this.get(M)=="Macintosh"&&Tt&&typeof Tt.standalone!==zr&&Tt.maxTouchPoints&&Tt.maxTouchPoints>2&&this.set(M,"iPad").set(A,Ne);break;case jt:!this.get(V)&&qr&&qr[si]&&this.set(V,qr[si]);break;case oi:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Ct,o(Ct)).set(Rr,o(Rr)).set(dr,o(dr)).set(Zt,o(Zt)).set(jt,o(jt))}return this},this.parseUA=function(){return this.itemType!=oi&&cl.call(this.data,this.ua,this.rgxMap),this.itemType==Ct&&this.set(to,al(this.get(j))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Ct:case Zt:var s=i[dl]||i[ml],l;if(s)for(var u in s){var h=s[u].brand||s[u],g=s[u].version;this.itemType==Ct&&!/not.a.brand/i.test(h)&&(!l||/Chrom/.test(l)&&h!=Zf||l==Vs&&/WebView2/.test(h))&&(h=mr(h,bg),l=this.get(V),l&&!/Chrom/.test(l)&&/Chrom/.test(h)||this.set(V,h).set(j,g).set(to,al(g)),l=h),this.itemType==Zt&&h==Zf&&this.set(j,g)}break;case Rr:var y=i[xt];y&&(y&&i[Gs]=="64"&&(y+="64"),cl.call(this.data,y+";",o));break;case dr:if(i[se]&&this.set(A,se),i[M]&&(this.set(M,i[M]),!this.get(A)||!this.get(F))){var E={};cl.call(E,"droid 9; "+i[M]+")",o),!this.get(A)&&E.type&&this.set(A,E.type),!this.get(F)&&E.vendor&&this.set(F,E.vendor)}if(i[hn]){var b;if(typeof i[hn]!="string")for(var I=0;!b&&I<i[hn].length;)b=mr(i[hn][I++],rp);else b=mr(i[hn],rp);this.set(A,b)}break;case jt:var L=i[si];if(L){var D=i[hl];L==fl&&(D=parseInt(al(D),10)>=13?"11":"10"),this.set(V,L).set(j,D)}this.get(V)==fl&&i[M]=="Xbox"&&this.set(V,"Xbox").set(j,void 0);break;case oi:var U=this.data,q=function(P){return U[P].getItem().setCH(i).parseCH().get()};this.set(Ct,q(Ct)).set(Rr,q(Rr)).set(dr,q(dr)).set(Zt,q(Zt)).set(jt,q(jt))}return this},Or.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",Eg(this,t)]]),this}function er(t,e,r){if(typeof t===ci?(Ws(t,!0)?(typeof e===ci&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===ul&&!Ws(e,!0)&&(r=e,e=void 0),r&&typeof r.append===$s){var n={};r.forEach(function(u,h){n[h]=u}),r=n}if(!(this instanceof er))return new er(t,e,r).getResult();var i=typeof t===ul?t:r&&r[jf]?r[jf]:Tt&&Tt.userAgent?Tt.userAgent:ai,o=new ap(r,!0),s=e?wg(np,e):np,l=function(u){return u==oi?function(){return new ip(u,i,s,o).set("ua",i).set(Ct,this.getBrowser()).set(Rr,this.getCPU()).set(dr,this.getDevice()).set(Zt,this.getEngine()).set(jt,this.getOS()).get()}:function(){return new ip(u,i,s[u],o).parseUA().get()}};return Or.call(this,[["getBrowser",l(Ct)],["getCPU",l(Rr)],["getDevice",l(dr)],["getEngine",l(Zt)],["getOS",l(jt)],["getResult",l(oi)],["getUA",function(){return i}],["setUA",function(u){return ui(u)&&(i=u.length>ll?js(u,ll):u),this}]]).setUA(i),this}er.VERSION=ug;er.BROWSER=qs([V,j,to,A]);er.CPU=qs([xt]);er.DEVICE=qs([M,F,A,Zi,se,Ze,Ne,pr,eo]);er.ENGINE=er.OS=qs([V,j]);function zs(){let t=ce();return Re(B(Re(B({},t.customContext),{page:Ao(),locale:t.locale,currentItem:t.currentItem,previewIDs:t.previewIDs,previewVariant:t.previewVariant,engagementIDs:Sg(),cart:Rc()}),_g()),{host:window.location.host})}function _g(){let t=window.CooeeSDK.uaParser.getResult();return{os:t.os,device:t.device,browser:t.browser}}function Sg(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}function me(t){return typeof t=="function"}function fi(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 Ys=fi(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
13
|
-
${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
|
|
14
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function gn(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Gt=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(me(n))try{n()}catch(o){e=o instanceof Ys?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{cp(o)}catch(s){e=e??[],s instanceof Ys?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Ys(e)}}add(e){var r;if(e&&e!==this)if(this.closed)cp(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&gn(r,e)}remove(e){let{_finalizers:r}=this;r&&gn(r,e),e instanceof t&&e._removeParent(this)}};Gt.EMPTY=(()=>{let t=new Gt;return t.closed=!0,t})();var gl=Gt.EMPTY;function Ks(t){return t instanceof Gt||t&&"closed"in t&&me(t.remove)&&me(t.add)&&me(t.unsubscribe)}function cp(t){me(t)?t():t.unsubscribe()}var tr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var pi={setTimeout(t,e,...r){let{delegate:n}=pi;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=pi;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Xs(t){pi.setTimeout(()=>{let{onUnhandledError:e}=tr;if(e)e(t);else throw t})}function yl(){}var lp=vl("C",void 0,void 0);function up(t){return vl("E",void 0,t)}function fp(t){return vl("N",t,void 0)}function vl(t,e,r){return{kind:t,value:e,error:r}}var yn=null;function mi(t){if(tr.useDeprecatedSynchronousErrorHandling){let e=!yn;if(e&&(yn={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=yn;if(yn=null,r)throw n}}else t()}function pp(t){tr.useDeprecatedSynchronousErrorHandling&&yn&&(yn.errorThrown=!0,yn.error=t)}var vn=class extends Gt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Ks(e)&&e.add(this)):this.destination=Tg}static create(e,r,n){return new Kr(e,r,n)}next(e){this.isStopped?bl(fp(e),this):this._next(e)}error(e){this.isStopped?bl(up(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?bl(lp,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},Cg=Function.prototype.bind;function wl(t,e){return Cg.call(t,e)}var El=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){Js(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){Js(n)}else Js(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){Js(r)}}},Kr=class extends vn{constructor(e,r,n){super();let i;if(me(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&tr.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&wl(e.next,o),error:e.error&&wl(e.error,o),complete:e.complete&&wl(e.complete,o)}):i=e}this.destination=new El(i)}};function Js(t){tr.useDeprecatedSynchronousErrorHandling?pp(t):Xs(t)}function xg(t){throw t}function bl(t,e){let{onStoppedNotification:r}=tr;r&&pi.setTimeout(()=>r(t,e))}var Tg={closed:!0,next:yl,error:xg,complete:yl};var di=typeof Symbol=="function"&&Symbol.observable||"@@observable";function mp(t){return t}function dp(t){return t.length===0?mp:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var vt=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=Rg(r)?r:new Kr(r,n,i);return mi(()=>{let{operator:s,source:l}=this;o.add(s?s.call(o,l):l?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=hp(n),new n((i,o)=>{let s=new Kr({next:l=>{try{r(l)}catch(u){o(u),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[di](){return this}pipe(...r){return dp(r)(this)}toPromise(r){return r=hp(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function hp(t){var e;return(e=t??tr.Promise)!==null&&e!==void 0?e:Promise}function Ig(t){return t&&me(t.next)&&me(t.error)&&me(t.complete)}function Rg(t){return t&&t instanceof vn||Ig(t)&&Ks(t)}function Dg(t){return me(t?.lift)}function hr(t){return e=>{if(Dg(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function qt(t,e,r,n,i){return new _l(t,e,r,n,i)}var _l=class extends vn{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(l){try{r(l)}catch(u){e.error(u)}}:super._next,this._error=i?function(l){try{i(l)}catch(u){e.error(u)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(l){e.error(l)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var gp=fi(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var At=(()=>{class t extends vt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new Qs(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new gp}next(r){mi(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){mi(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){mi(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?gl:(this.currentObservers=null,o.push(r),new Gt(()=>{this.currentObservers=null,gn(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new vt;return r.source=this,r}}return t.create=(e,r)=>new Qs(e,r),t})(),Qs=class extends At{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:gl}};var ro=class extends At{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var no={now(){return(no.delegate||Date).now()},delegate:void 0};var io=class extends At{constructor(e=1/0,r=1/0,n=no){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),l=0;for(let u=1;u<n.length&&n[u]<=s;u+=2)l=u;l&&n.splice(0,l+1)}}};var Zs=class extends Gt{constructor(e,r){super()}schedule(e,r=0){return this}};var oo={setInterval(t,e,...r){let{delegate:n}=oo;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=oo;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var ea=class extends Zs{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return oo.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&oo.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,gn(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var hi=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};hi.now=no.now;var ta=class extends hi{constructor(e,r=hi.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var so=new ta(ea),yp=so;function vp(t){return t&&me(t.schedule)}function bp(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(g){try{h(n.next(g))}catch(y){s(y)}}function u(g){try{h(n.throw(g))}catch(y){s(y)}}function h(g){g.done?o(g.value):i(g.value).then(l,u)}h((n=n.apply(t,e||[])).next())})}function wp(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function wn(t){return this instanceof wn?(this.v=t,this):new wn(t)}function Ep(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(b){return function(I){return Promise.resolve(I).then(b,y)}}function l(b,I){n[b]&&(i[b]=function(L){return new Promise(function(D,U){o.push([b,L,D,U])>1||u(b,L)})},I&&(i[b]=I(i[b])))}function u(b,I){try{h(n[b](I))}catch(L){E(o[0][3],L)}}function h(b){b.value instanceof wn?Promise.resolve(b.value.v).then(g,y):E(o[0][2],b)}function g(b){u("next",b)}function y(b){u("throw",b)}function E(b,I){b(I),o.shift(),o.length&&u(o[0][0],o[0][1])}}function _p(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof wp=="function"?wp(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(l,u){s=t[o](s),i(l,u,s.done,s.value)})}}function i(o,s,l,u){Promise.resolve(u).then(function(h){o({value:h,done:l})},s)}}var ra=t=>t&&typeof t.length=="number"&&typeof t!="function";function Sp(t){return me(t?.then)}function Cp(t){return me(t[di])}function xp(t){return Symbol.asyncIterator&&me(t?.[Symbol.asyncIterator])}function Tp(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Og(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ip=Og();function Rp(t){return me(t?.[Ip])}function Dp(t){return Ep(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield wn(r.read());if(i)return yield wn(void 0);yield yield wn(n)}}finally{r.releaseLock()}})}function Op(t){return me(t?.getReader)}function Xr(t){if(t instanceof vt)return t;if(t!=null){if(Cp(t))return Pg(t);if(ra(t))return Ag(t);if(Sp(t))return Ng(t);if(xp(t))return Pp(t);if(Rp(t))return Lg(t);if(Op(t))return Bg(t)}throw Tp(t)}function Pg(t){return new vt(e=>{let r=t[di]();if(me(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ag(t){return new vt(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function Ng(t){return new vt(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Xs)})}function Lg(t){return new vt(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Pp(t){return new vt(e=>{Mg(t,e).catch(r=>e.error(r))})}function Bg(t){return Pp(Dp(t))}function Mg(t,e){var r,n,i,o;return bp(this,void 0,void 0,function*(){try{for(r=_p(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function Ap(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}var Np=fi(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function rr(t,e){let r=typeof e=="object";return new Promise((n,i)=>{let o=new Kr({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(e.defaultValue):i(new Np)}});t.subscribe(o)})}function Lp(t){return t instanceof Date&&!isNaN(t)}function Pr(t,e){return hr((r,n)=>{let i=0;r.subscribe(qt(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:Ug}=Array;function kg(t,e){return Ug(e)?t(...e):t(e)}function na(t){return Pr(e=>kg(t,e))}function Bp(t,e,r,n,i,o,s,l){let u=[],h=0,g=0,y=!1,E=()=>{y&&!u.length&&!h&&e.complete()},b=L=>h<n?I(L):u.push(L),I=L=>{o&&e.next(L),h++;let D=!1;Xr(r(L,g++)).subscribe(qt(e,U=>{i?.(U),o?b(U):e.next(U)},()=>{D=!0},void 0,()=>{if(D)try{for(h--;u.length&&h<n;){let U=u.shift();s?Ap(e,s,()=>I(U)):I(U)}E()}catch(U){e.error(U)}}))};return t.subscribe(qt(e,b,()=>{y=!0,E()})),()=>{l?.()}}function Sl(t,e,r=1/0){return me(e)?Sl((n,i)=>Pr((o,s)=>e(n,o,i,s))(Xr(t(n,i))),r):(typeof e=="number"&&(r=e),hr((n,i)=>Bp(n,i,t,r)))}var Fg=["addListener","removeListener"],Hg=["addEventListener","removeEventListener"],Vg=["on","off"];function bn(t,e,r,n){if(me(r)&&(n=r,r=void 0),n)return bn(t,e,r).pipe(na(n));let[i,o]=jg(t)?Hg.map(s=>l=>t[s](e,l,r)):$g(t)?Fg.map(Mp(t,e)):Wg(t)?Vg.map(Mp(t,e)):[];if(!i&&ra(t))return Sl(s=>bn(s,e,r))(Xr(t));if(!i)throw new TypeError("Invalid event target");return new vt(s=>{let l=(...u)=>s.next(1<u.length?u:u[0]);return i(l),()=>o(l)})}function Mp(t,e){return r=>n=>t[r](e,n)}function $g(t){return me(t.addListener)&&me(t.removeListener)}function Wg(t){return me(t.on)&&me(t.off)}function jg(t){return me(t.addEventListener)&&me(t.removeEventListener)}function ia(t,e,r){return r?ia(t,e).pipe(na(r)):new vt(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return me(e)?()=>e(i,o):void 0})}function Up(t=0,e,r=yp){let n=-1;return e!=null&&(vp(e)?r=e:n=e),new vt(i=>{let o=Lp(t)?+t-r.now():t;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function Cl(t,e){return hr((r,n)=>{let i=0;r.subscribe(qt(n,o=>t.call(e,o,i++)&&n.next(o)))})}function Nt(t,e=so){return hr((r,n)=>{let i=null,o=null,s=null,l=()=>{if(i){i.unsubscribe(),i=null;let h=o;o=null,n.next(h)}};function u(){let h=s+t,g=e.now();if(g<h){i=this.schedule(void 0,h-g),n.add(i);return}l()}r.subscribe(qt(n,h=>{o=h,s=e.now(),i||(i=e.schedule(u,t),n.add(i))},()=>{l(),n.complete()},void 0,()=>{o=i=null}))})}function kp(t,e){return hr((r,n)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,l=null,u=null,h=!1,g=()=>{u?.unsubscribe(),u=null,o&&(b(),h&&n.complete())},y=()=>{u=null,h&&n.complete()},E=I=>u=Xr(t(I)).subscribe(qt(n,g,y)),b=()=>{if(s){s=!1;let I=l;l=null,n.next(I),!h&&E(I)}};r.subscribe(qt(n,I=>{s=!0,l=I,!(u&&!u.closed)&&(i?b():E(I))},()=>{h=!0,!(o&&s&&u&&!u.closed)&&n.complete()}))})}function xl(t,e=so,r){let n=Up(t,e);return kp(()=>n,r)}var Fp=br(za()),oa=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new Fp.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};var sa=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},aa=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!qg())try{return await Gg(e,r,this.LOCK_TIMEOUT)}catch(s){v.verbose(`Web Locks API failed, falling back to localStorage: ${s}`)}let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(v.verbose(`Lock retry ${i} for ${e}`),n=await this.acquire(e,o,i),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static async acquire(e,r,n){let i=Date.now(),o=localStorage.getItem(e),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let l={owner:r,expiry:i+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(l)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(v.verbose(`${r}: Lock acquired for ${e} after ${n} attempts!`),!0):(v.verbose(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),v.verbose(`${r}: Lock released`)):v.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};async function Gg(t,e,r){return new Promise((n,i)=>{let o=setTimeout(()=>{i(new Error(`Web Locks API timeout after ${r}ms`))},r);navigator.locks.request(t,async()=>{try{let s=await e();return clearTimeout(o),n(s),s}catch(s){throw clearTimeout(o),i(s),s}}).catch(s=>{clearTimeout(o),i(s)})})}function qg(){let t=navigator.userAgent||"";return/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)||/iPhone|iPad|iPod/i.test(t)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(t)||!window.safari?.pushNotificaTion)||/Macintosh/.test(t)&&/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)&&!window.safari?.pushNotification?!0:zg()}function zg(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()==="[object SafariRemoteNotification]":!window.indexedDB||!window.localStorage}catch{return!0}}var Tl={d:(t,e)=>{for(var r in e)Tl.o(e,r)&&!Tl.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},Il={};Tl.d(Il,{A:()=>Yg,k:()=>Rl});var ao=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(h){try{u(n.next(h))}catch(g){o(g)}}function l(h){try{u(n.throw(h))}catch(g){o(g)}}function u(h){var g;h.done?i(h.value):(g=h.value,g instanceof r?g:new r(function(y){y(g)})).then(s,l)}u((n=n.apply(t,e||[])).next())})},co=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(h){return(function(g){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,g[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return s.label++,{value:g[1],done:!1};case 5:s.label++,n=g[1],g=[0];continue;case 7:g=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){s=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){s.label=g[1];break}if(g[0]===6&&s.label<i[1]){s.label=i[1],i=g;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(g);break}i[2]&&s.ops.pop(),s.trys.pop();continue}g=e.call(t,s)}catch(y){g=[6,y],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}})([u,h])}}};function Rl(){return ao(this,void 0,Promise,function(){return co(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(b){i||(i=!0,e({isPrivate:b,browserName:n}))}function s(){var b=0,I=parseInt("-1");try{I.toFixed(I)}catch(L){b=L.message.length}return b}function l(){return navigator.msSaveBlob!==void 0&&(function(b){try{return b===eval.toString().length}catch{return!1}})(39)}function u(){var b;return ao(this,void 0,void 0,function(){var I,L;return co(this,function(D){switch(D.label){case 0:return D.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return D.sent(),o(!1),[3,3];case 2:return I=D.sent(),L=I,I instanceof Error&&(L=(b=I.message)!==null&&b!==void 0?b:I),typeof L!="string"?(o(!1),[2]):(o(!!L.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function h(){var b;return ao(this,void 0,Promise,function(){return co(this,function(I){switch(I.label){case 0:return((b=navigator.storage)===null||b===void 0?void 0:b.getDirectory)===void 0?[3,2]:[4,u()];case 1:return I.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var L=String(Math.random());try{var D=indexedDB.open(L,1);D.onupgradeneeded=function(U){var q=U.target.result,P=function(Q){o(Q)};try{q.createObjectStore("t",{autoIncrement:!0}).put(new Blob),P(!1)}catch(Q){(Q.message||"").includes("are not yet supported")?P(!0):P(!1)}finally{q.close(),indexedDB.deleteDatabase(L)}},D.onerror=function(){return o(!1)}}catch{o(!1)}})():(function(){var L=window.openDatabase,D=window.localStorage;try{L(null,null,null,null)}catch{return void o(!0)}try{D.setItem("test","1"),D.removeItem("test")}catch{return void o(!0)}o(!1)})(),I.label=3;case 3:return[2]}})})}function g(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(b,I){var L;o(Math.round(I/1048576)<2*Math.round(((L=window).performance!==void 0&&L.performance.memory!==void 0&&L.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(b){r(new Error("detectIncognito somehow failed to query storage quota: "+b.message))})}function y(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?g():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return ao(this,void 0,Promise,function(){var b,I;return co(this,function(L){switch(L.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];L.label=1;case 1:return L.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return L.sent(),o(!1),[3,4];case 3:return b=L.sent(),typeof(I=b instanceof Error&&typeof b.message=="string"?b.message:String(b))!="string"?(o(!1),[2]):(o(I.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return ao(this,void 0,Promise,function(){return co(this,function(b){switch(b.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,h()]);case 1:return b.sent(),[3,6];case 2:return s()!==51?[3,3]:(I=navigator.userAgent,n=I.match(/Chrome/)?navigator.brave!==void 0?"Brave":I.match(/Edg/)?"Edge":I.match(/OPR/)?"Opera":"Chrome":"Chromium",y(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return b.sent(),[3,6];case 5:l()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),b.label=6;case 6:return[2]}var I})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Rl);var Yg=Rl,Hp=Il.A,$T=Il.k;var Vp=br(Oo()),$p=async()=>{let t={};try{return await Kg(t)}catch(e){return ie(e,"device-properties"),t}},Kg=async t=>{let e=window.CooeeSDK.uaParser;Xg(t),Jg(t),Qg(t),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Zg()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0,Nn({headless:!0}));let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([ry(t),ey(t),ny(t)]),t},Xg=t=>{let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;t.mem={tot:r*1024}},Jg=t=>{let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(t.net={type:r.effectiveType})},Qg=t=>{let e=screen.orientation?.type;e&&(t.orientation=e)},Zg=()=>{if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r},ey=async t=>{try{await ty(t)}catch(e){v.error("Unable to get location",e)}},ty=async t=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{t.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})},ry=async t=>{if("getBattery"in navigator)try{let r=await navigator.getBattery();t.bat={l:r.level*100,c:r.charging},Nn({"battery.level":t.bat.l,"battery.charging":t.bat.c})}catch{}},ny=async t=>{try{(await Hp())?.isPrivate&&(t.incognito=!0,Nn({incognito:!0}))}catch(e){Vp.default.error("Unable to detect private/incognito window",e)}};var En=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(En||{});function Wp(t){Gp()}function jp(t){if(!Gp())return;let e=En[t]?.toLowerCase();e&&(v.verbose(`Sending ${e} intent to MS Clarity`),window.clarity("set","Cooee Intent",e))}function Gp(){return window.clarity&&typeof window.clarity=="function"}var zt=new io(1),zp="App ID or Shopify shop is not set",Dl="",Jr="",Ol="",ca;function Yp(t){Dl=t.appID,Ol=t.shopifyShop,iy().then(async()=>{zt.next(!0),zt.complete()}).catch(e=>{e?.message?.includes(zp)&&ie(e,"initiate-session",{extra:t}),v.error("Unable to initiate session",e)})}async function Kp(){return await Jp(),ca}async function Xp(){let t=Date.now();await aa.request("gen_did",async()=>{Jr=await je.get("did"),Jr||(Jr=new lt().toHexString(),await je.set("did",Jr)),v.info("Device ID:",Jr),Zp(Jr)}),v.info(`Device ID set/get done in \u23F0 ${nr(Date.now()-t)}`)}async function qp(){if(ca)return;let[t,e,r]=await Promise.all([gt.get("id",""),je.get("sessionNumber",1),gt.get("landing",{})]);Qp(t,e,r)}async function iy(){await Jp()}async function Jp(){let t=!1;await sy()?(await oy(),t=!0):await ay()?(await qp(),t=!0):await qp(),t&&await ly()}async function oy(){v.info("Starting new session"),await gt.clear(),v.verbose("Cleared SessionStorage before starting new session");let t=new Date,e=new lt().toHexString(),r=await je.get("sessionNumber",0)+1;v.info(`New session number ${r}`);let n=Ao();await Promise.all([je.set("sessionNumber",r),gt.set("id",e),gt.set("lastUsedTime",t.getTime()),gt.set("landing",n)]),Qp(e,r,n)}async function sy(){let t=await gt.get("lastUsedTime",0);return t?(new Date().getTime()-t)/1e3>1800:!0}async function ay(){return!await gt.get("synced",!1)}async function cy(){if(!Dl&&!Ol)throw new Error(zp);let t=await $p(),e=zs();return Re(B(B({deviceID:Jr,deviceProps:t,appID:Dl,shopifyShop:Ol},ca),e),{sdk:Ro,ad:oa.getAdParams(),occurred:fy(ce().jsLoadTime),properties:{},uuid:await je.get("uuid")})}async function ly(){v.info("Ensuring session on server"),await uy();let t=await cy();v.verbose("Request data",t);try{let e=await Lt("/v1/event/validate-session",t);v.info(`Auth finished in \u23F0 ${nr(e.timeTakenMs)}`),Ti("/v1/event/validate-session"),await gt.set("synced",!0),e.data.deviceID&&(await je.set("did",Jr),Zp(e.data.deviceID))}catch(e){throw v.error(e),e}}async function uy(){let t=await je.get("firstSeen"),e=t?new Date(t):new Date;t||await je.set("firstSeen",e.toISOString()),tm(e),jo("Visitor Info",{first_seen:e.toISOString()})}function Qp(t,e,r){Nn({"cooee_session.number":e}),jo("Visitor Session",{id:t,number:e,landing_page:r}),v.info(`Session number: ${e}, id: ${t}`),ca={sessionID:t,sessionNumber:e,landingPage:r}}function Zp(t){Wp(t),em(t);let e=`device_id_${Math.floor(Math.random()*1e4)}`;jo("Visitor Info",{device_id:t,[e]:t}),Eu({id:t})}function fy(t){return(new Date().getTime()-t.getTime())/1e3>1800?new Date:t}var py="2024-10",my=`/api/${py}/graphql.json`,rm={"Content-Type":"application/json"};async function la(t,e,r,n){let i=He.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers(rm);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:t,variables:e});try{return await Cr(my,{method:"POST",headers:o,body:s})}catch(l){throw ie(l,r,{engagementTrigger:n}),l}}function _n(t,e){return dy(cs(t),e)}async function dy(t,e){let r={body:JSON.stringify(e),method:"POST",headers:rm};return Cr(t,r)}var Pl=new sa;function nm(){hy().catch(t=>{v.error("Fail to add attributes in cart",t)})}async function hy(){await Pl.acquire();let t=le.getCurrent(),e=await sc();if(t.attributes?.letscooee_did===e.letscooee_did&&t.attributes?.letscooee_sn===e.letscooee_sn){v.verbose("Not calling Shopify update.js API.","Current attributes:",t.attributes),Pl.release();return}try{let r=await _n("/cart/update.js",{attributes:e});v.verbose("Updated cart attributes",JSON.stringify(r.data)),t.update(r.data)}catch(r){v.error("Failed to add cart attributes",r)}Pl.release()}function im(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?gy():document.visibilityState==="hidden"&&yy()}}async function gy(){}async function yy(){let t=await vy();if(t===0){v.info("Not sending duration as user was inactive on website");return}sm(t)}async function vy(){let t=ce();return t.inInactive?0:(t.inInactive=!0,t.lastEnterInactive=new Date,Math.max(t.lastEnterInactive.getTime()-t.lastEnterActive.getTime(),0))}function om(){let t=ce();return t.inInactive?(t.inInactive=!1,t.lastEnterActive=new Date,Math.max((t.lastEnterActive.getTime()-t.lastEnterInactive.getTime())/1e3,0)):0}function gr(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function Sn(t,e){Object.assign(t.style,e)}function ee(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}function Al(t){if(!t)return!1;if(t.tagName.toLowerCase()==="cart-drawer"&&t.hasAttribute("open"))return!0;let r=t.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(t);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||t.hidden||!(t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0))return!1;let h=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),g=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),y=h*g,E=r.width*r.height;if(!(E>0&&y/E>=.1))return!1;let I=r.top<=n&&r.bottom>=0,L=r.left<=i&&r.right>=0,D=I&&L,U=o.transform.match(/matrix\(([^)]+)\)/),q=0,P=0;if(U){let ge=U[1].split(", ").map(parseFloat);q=ge[4],P=ge[5]}let Q=q+r.left>i||q+r.right<0||P+r.top>n||P+r.bottom<0;return D||!Q}var am=t=>new Promise((e,r)=>{let n=new Image;n.onload=()=>{e({width:n.width,height:n.height})},n.onerror=r,n.src=t,n.style.display="none"});var ua=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof lr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace("cooee"+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var dm=br(Oo());var lm=new At,um=new At;function fm(){return um.asObservable()}function fa(){lm.next()}lm.pipe(Nt(100)).subscribe(Sy.bind(void 0));function pm(){fa(),wy(),by()}function wy(){let t=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){mm(this._url).catch(e=>v.error("Unable to process cart change in XMLHttpRequest",e))}),t.apply(this,arguments)},v.verbose("Securely overwritten window.XMLHttpRequest.send method")}function by(){let t=window.fetch;try{window.fetch=async function(e,r){return t(e,r).then(n=>{let i="";try{i=typeof e=="string"||e instanceof URL?e.toString():e?.url??n?.url??""}catch{}return mm(i).catch(o=>v.error("Unable to process cart change in fetch",o)),n})},v.verbose("Securely overwritten window.fetch method")}catch(e){console.warn("Fail to override fetch.",`Cooee won't be able to track "Add To Cart" and "Remove From Cart" KPI.`),v.error(e)}}async function mm(t){Ey(t)&&fa()}function Ey(t){return/\/cart\/(add|change|update|clear)/.test(t)}function _y(t,e){let r=t?.items,n=e.items,i=[],o=[];if(v.verbose(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(s=>{let l=r?.find(u=>u.vID===s.vID);if(l){if(l.quantity!==s.quantity){let u=l.quantity<s.quantity,h=Math.abs(l.quantity-s.quantity),g=Re(B({},s),{quantity:h});u?i.push(g):o.push(g)}r&&Cu(r,l)}else i.push(s)}),r)for(let s of r)o.push(s);v.verbose(`Cart delta: added: ${i.length}, removed: ${o.length}`),i.length&&cm("Add To Cart",{items:i}),o.length&&t.token===e.token&&cm("Remove From Cart",{items:o}),(o.length||i.length)&&um.next({itemsAdded:i,itemsRemoved:o,cart:e})}function cm(t,e){let r=new Se(t,e);ht(r)}async function Sy(){let t=await je.get("cart",{}),e=await le.getCurrent().getNormalisedCart(!0);_y(t,e)}var qe=class t{static cartDrawerToggle$=new ro({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=He.get().website??{};currentState=!1;mutationSubscription;mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static initialize(){t.get()}isOpen(){if(window.cooeeIsCartDrawerVisible)return window.cooeeIsCartDrawerVisible();if(this.cartDrawerElement?.id==="rebuy-cart")return!!window.Rebuy?.SmartCart?.visible;let e=this.inShadow?this.isPresent():Al(this.cartDrawerElement);return v.info(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){v.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent("letscooee:outbound:open-cart"));let e=document.querySelector(this.iconSelector);if(!e){v.verbose("No clickable cart icon found with selector",this.iconSelector);return}e.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){ie(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer&&typeof window.theme?.CartDrawer=="function")window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?le.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(le.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+""):(v.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent("letscooee:outbound:refresh-ui",{detail:{responseJSON:e,currentCart:le.getCurrent()}})),r&&fa()}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(":shadow");r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!ki())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await kr(e),!this.cartDrawerElement){dm.default.warn("Max attempts exhausted to find cart drawer");return}v.verbose("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await kr(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new At;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(xl(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,t.cartDrawerToggle$.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return!1;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?Al(e):!1}async updateBubble(){let e=(await le.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push(["Open Cart"])}};var gi=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var Cy=`
|
|
15
|
-
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
16
|
-
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
17
|
-
cart {
|
|
18
|
-
id
|
|
19
|
-
}
|
|
20
|
-
userErrors {
|
|
21
|
-
field
|
|
22
|
-
message
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`,Qr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(v.log(`Applying discount code ${e}`,r,n),r){case kt.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case kt.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#open-cart-drawer=1`;break;case kt.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case kt.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){let n=qe.get();switch(e){case kt.CART_PAGE:location.href="/cart";break;case kt.SHOPIFY_CHECKOUT:location.href="/checkout";break;case kt.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods("/cart#initiate-checkout=1");break;case kt.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(e){let r={cartId:`gid://shopify/Cart/${le.getCurrent().token}`,discountCodes:e};v.verbose(`Applying ${e.length} coupons on cart`),await la(Cy,r,"storefront-apply-discount")}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e}};var wm=br(Ic());var Nl=new Map,pa=async t=>{for(let o of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(o,t)}catch(s){v.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let s=(await le.getCurrent().getNormalisedCart()).items.map(l=>l.mID);t.items=t.items.filter(l=>!s.includes(l.mID))}if(t.items=hm(t),He.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await xy(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(o=>gm(o,t)),i=(await Promise.all(r)).filter(o=>o!=null);if(e&&!i.length){let o="Failed to fetch any product from Ajax API",s=new Se("CE Campaign Failed",{reason:o,currency:t.currency},t);throw _t(s),new Error(o)}return hm(t,i)},hm=(t,e=t.items)=>{if(!t.isCartRecovery())return e;let r=le.getCurrent().items,n=[];for(let i of e)for(let o of i.vars){if(!o.isAvailable)continue;let s=r.find(h=>h.variant_id.toString()===o.mID);if(!s)continue;let l=new st(i);l.name=s.title;let u=new cr(o);u.name=s.variant_title,u.price.d=s.discounted_price/100,l.variants=[u],n.push(l)}return n},xy=async(t,e)=>{await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let i=await gm(n,e);return i||n}))}))},gm=async(t,e)=>{if(Nl.has(t.mID))return Nl.get(t.mID);let r,n=`/products/${t.slug}.js`;try{r=(await Cr(n)).data}catch(i){return i instanceof Ht&&i.response?.status===404||ie(i,"fetch-shopify-product",{extra:{item:t,path:n},engagementTrigger:e}),null}return r?Ty(t,r):(v.error("Item not found after AJAX call for:",t),null)},Ty=(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 i=e.variants.find(o=>o.id===+n.mID);i!=null&&(n.name=i.title,n.isAvailable=i.available,n.price.d=i.price?i.price/100:i.price,n.price.effective=n.price.d,n.price.cmp=i.compare_at_price?i.compare_at_price/100:i.compare_at_price,+r.mID===i.id&&(r.effectivePrice.value=n.price.d))}),Nl.set(t.mID,t),t};var lo=t=>{let e=t instanceof st?t.selectedOrFirstVariant.value.mID:t.vID,r=t instanceof st?t.selectedOrFirstVariant.value.name:t.vName;return{product_id:t.mID,product_name:t.name,variant_id:e,variant_name:r}};var ym=br(Oo());var Ar=class{constructor(e){this.triggerContext=e}async execute(e){let r=ce().currentItem,n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=new yi,l=o.triggerData.redirectBehaviour,u=!!o.triggerData.discount?.type&&!!n?.applyDiscount,h={selectedVariants:o.triggerData.nonMutableItems.map(D=>({itemMID:D.mID,mID:D.selectedOrFirstVariant.value.mID,variantID:D.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},g="",y=[],E=[];if(i?E=[i.toEmbed()]:e.embeddedItem&&(E=[e.embeddedItem]),n.at===he.ADD_BUNDLE){let D=o.selectedItems;if(E=e.embeddedItems??D.map(U=>U.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let U;e.embeddedItems?U=e.embeddedItems.map(P=>({itemMID:P.mID,mID:P.vID,variantID:P.vID,quantity:P.quantity})):U=D.map(P=>({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,variantID:P.selectedOrFirstVariant.value.mID}));let q=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&q&&(U.push({itemMID:q.mID,mID:q.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(q.toEmbed())),h.selectedVariants=U,o.triggerData.isBundleOnPDP()&&h.selectedVariants.forEach(P=>{P.mID===r.vID&&(P.isPrimary=!0)})}else h=void 0;y=e.embeddedItems??D}else if(n.at===he.INITIATE_CHECKOUT){let D=await le.getCurrent().getNormalisedCart();E=D.items,h.selectedVariants=D.items.map(U=>({itemMID:U.mID,mID:U.vID}))}else if(n.at===he.ADD_TO_CART)y=i?[i]:[e.embeddedItem];else if(n.at===he.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,i),this.sendTriggerClicked(E,{from:"button"},e.video);return}else if(n.at===he.GO_TO_PRODUCT)g=i?Vn("/products/"+i.slug):e.embeddedItem?.link;else if(n.at===he.GO_TO_URL){let D=Bn(n.gu?.u);window.CooeeSDK.allowExternalURL?D&&(g=D.href):D&&(g=D.pathname+D.search+D.hash)}else if(n.at===he.UPGRADE_TO_SUBSCRIPTION){let D=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),qe.get().refreshUI(D)}else if(n.at===he.GO_TO_COLLECTION){let D=this.triggerContext.triggerData.collections?.[0];D&&(g="collections/"+D.handle)}if(this.sendTriggerClicked(E,{from:"button"},e.video),v.verbose({redirectPath:g,redirectBehaviour:l,hasDiscount:u}),!u&&g){uo(n.at,{redirectTo:g}),location.href=g;return}let b,I=!1;try{b=await this.getOrGenerateDiscountCode(h),v.verbose("Discount code (if any) to apply",b)}catch(D){if(!this.triggerContext.triggerData.isBYOB()){ym.default.error("Unable to get a discount code",D);return}}if(b&&n.at===he.COPY_COUPON_CODE)await s.copyDiscountCode(b);else if(n.at===he.BUY_NOW){let D=await s.createNewCart(r,b,o.triggerData);D&&(uo(n.at,{products:[lo(r)],redirectTo:D}),location.href=D);return}try{b&&await Qr.applyWithStorefront([b])}catch(D){v.error(D),I=!0}let L;if(y?.length&&(L=await s.addToCart(y,o.triggerData)),uo(n.at,{products:y.map(lo),redirectTo:g,discountCode:b}),I&&b){Qr.navigate(b,l,g);return}if(g){location.href=g;return}Qr.navigateWithoutDiscount(l,L)}sendTriggerClicked(e,r,n){let i=new Se("CE Trigger Clicked",r,this.triggerContext.triggerData);i.items=e,i.setVideos(n),_t(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===Ut.STATIC){if(!r.code)throw Wo("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await Iy(e,this.triggerContext),!n)throw v.error("No discount code found",e),new Error("Discount code not found or generated");return n}}};function uo(t,e){document.dispatchEvent(new CustomEvent("letscooee:outbound:cta-executed",{detail:B({action:he[t]},e)}))}async function Iy(t,e){try{return(await vm(t)).data.code}catch(r){throw Qt("Failed to generate a discount code"),ie(r,"backend-generate-discount",{triggerContext:e}),r}}var Ry=`
|
|
27
|
-
mutation cartCreate($input: CartInput) {
|
|
28
|
-
cartCreate(input: $input) {
|
|
29
|
-
cart {
|
|
30
|
-
id
|
|
31
|
-
checkoutUrl
|
|
32
|
-
}
|
|
33
|
-
userErrors {
|
|
34
|
-
field
|
|
35
|
-
message
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;function bm(t){let e=qe.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{return{sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(r){ie(r,"execute-cooeeGetCartSections",{engagementTrigger:t})}else{if(e.isMiniCart())return{sections:["mini-cart"]};if(e.isShopifyDefaultDrawer())return{sections:e.element.getSectionsToRender?.().map((r=>r.section??r.id))}}return{}}async function Em(t,e){if(!pt.hasKeys(t)){v.warn("No update fields provided");return}let r=bm(e),n=B(B({},t),r);try{let i=await _n("/cart/update.js",n);return v.log("Updated cart",t),le.getCurrent().update(i.data),i.data}catch(i){ie(i,"cart-update"),Qt("Failed to update item in cart")}}var yi=class{async addToCart(e,r){if(!e.length)return;let n=e.map(s=>{let{vID:l,vName:u,quantity:h}=this.getVariantDetails(s),g=r.getPrivateAttributesForLineItem();if(pt.hasKeys(window.CooeeSDK.customItemProperties)){let y={name:u},E={templateSuffix:s.templateSuffix},b=wm.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:y,product:E});g=B(B({},JSON.parse(b)),g)}return{id:l?+l:+s.mID,quantity:h,properties:g}}),i=bm(r),o=B({items:n},i);try{let s=await _n("/cart/add.js",o);return v.log(`Added ${e.length} items to Cart`),Qt("Product added to your cart"),s.data}catch(s){ie(s,"cart-item-add",{engagementTrigger:r});let l=["Failed to add product in cart."];if(s instanceof Ht&&s.is40x()&&s.responseText){let u=s.responseText;u.description&&l.push(`Reason: ${u.description}`)}l.push("Please try again later."),Qt(l.join(" "))}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),v.log(`Code-${e} copied`),Qt("Discount code copied")}catch(r){v.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=cf(e.link);if(r)return Vn("/products/"+r)}async upgradeToSubscription(e,r){if(!e){v.warn("Trying to upgrade to subscription with no item");return}let n=await le.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(u=>u.vID===i.mID),s=i.selectedSellingPlan.value,l={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let u=await _n("/cart/change.js",l);return v.log(`Upgraded ${e} selling plan`),Qt("Line item updated"),le.getCurrent().update(u.data),u.data}catch(u){ie(u,"cart-switch-subscription",{engagementTrigger:r}),Qt("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){v.error("No variant ID found to perform Buy now",e);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await zo("Buy Now");return(await la(Ry,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;v.log(`Performing ${JSON.stringify(s)} action`);let l={};if(s.at===he.GO_TO_PRODUCT)o=this.getProductURL(n[0]);else if(s.at===he.ADD_TO_CART)n?.length&&await this.addToCart(n,i);else if(s.at===he.COPY_COUPON_CODE)await this.copyDiscountCode(i.discount?.code),l.discountCode=i.discount?.code;else if(s.at===he.OPEN_CART)qe.get().open();else if(s.at===he.GO_TO_COLLECTION){let u=e.collections;if(!u?.length)return;o=Vn("/collections/"+u[0].handle)}l.products=n.map(lo),l.redirectTo=o,uo(s.at,l)}r.applyDiscount&&i.discount?.code?Qr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVariantDetails(e){let r,n,i;if(e instanceof bt)r=e.vID,n=e.vName,i=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=e.selectedOrFirstVariant.value.name,i=1}return{vID:r,quantity:i,vName:n}}};async function _m(t,e){if(!pt.hasKeys(e)){v.warn("No update fields provided");return}let r=B({id:t.key},e);try{let n=await _n("/cart/change.js",r);v.log("Updated line-item",t),le.getCurrent().update(n.data)}catch(n){ie(n,"cart-item-update")}}var ma=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),v.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var da=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!==he.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case he.ACCEPT_POPUP:break;case he.GO_TO_URL:this.gotoURLAction();break;case he.SHARE:this.shareAction();break;case he.SUBMIT_FORM:await this.collectFormData();break;case void 0:case he.OPEN_CART:break;default:v.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;Bn(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){v.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!==he.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 i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent("CE Form Submitted",{form:e}),this.action.applyDiscount&&Qt("Coupon applied on cart"),ma.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 yi().process(r);let n={action:this.containsCTA()?"CLICKED":"CLOSED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}};var Yt=class{renderer=Zr.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new gi(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=Re(B(B(B(B({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});Sn(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&ee(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&ee(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)};Sn(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);ee(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?ee(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):ee(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new nn(this.inappElement.trf);e&&e.rotate&&ee(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 da(e,this.triggerContext).execute()}),ee(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var yr=class extends Yt{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),Sn(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"),ee(e,"font-weight",r.b?"bold":"normal"),ee(e,"font-style",r.i?"italic":"normal"),ee(e,"text-decoration",n.join(" ")),ee(e,"color",r.c??"inherit"),ee(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Pn[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),ee(this.inappHTMLEl,"text-align",r)}};var fo=class extends yr{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 po=class extends Yt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var Cn=class extends Yt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),ee(this.inappHTMLEl,"max-width","none"),ee(this.inappHTMLEl,"max-height","none"),ee(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var mo=class t extends Yt{constructor(r,n,i){super(r,n,i);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),ee(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()?(ee(this.inappHTMLEl,"width","100%"),ee(this.inappHTMLEl,"height","100%")):(ee(this.inappHTMLEl,"width","100vw"),ee(this.inappHTMLEl,"height","100vh")),ee(this.inappHTMLEl,"top","0"),ee(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();ee(this.inappHTMLEl,"width",i+"px"),ee(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return B(B({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?ee(this.inappHTMLEl,"position","absolute"):ee(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var Dy="cooee-container",ha=class extends Yt{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),ee(this.inappHTMLEl,"position","relative"),ee(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(Dy),this}};var ga=class t extends yr{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=Re(B(B(B({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>Sn(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"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,ee(i,"font-size","0.5em"),ee(i,"text-align","center"),ee(i,"font-family","inherit"),ee(n,"text-align","center"),ee(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),ee(r,"display","flex"),ee(r,"flex-direction",this.inappElement.horizontal?"":"column"),ee(r,"justify-content","center"),ee(r,"align-items","center"),ee(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 ya=class extends yr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){ee(this.inappHTMLEl,"background","#ffffff00"),ee(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 cr(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var vi=class extends yr{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),ee(this.inappHTMLEl,"background","#ffffff00"),ee(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 va=class t extends vi{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)?(ee(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(ee(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var wa=class t extends vi{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)?(ee(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(ee(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var ba=class extends Cn{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var Zr=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 dt(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),l=this.getHeight();r&&(s=s?Math.min(s,r):r,l=l?Math.min(l,r):r),l&&(s-=o.getHorizontal(),l-=o.getVertical(),s/l<n/i?this.scalingFactor=s/n:this.scalingFactor=l/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&ee(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 ir(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(gr()||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){ie(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),gr()||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 jr(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(ce().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=eu.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 mo(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw v.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Se("CE Trigger Displayed",e,this.triggerContext.triggerData);_t(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 Se(r,e,this.triggerContext.triggerData);n.name==="CE Trigger Clicked"&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),_t(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof Gn?new va(e,r,n).render():r instanceof qn?new wa(e,r,n).render():r instanceof Fr?new fo(e,r,n).render():r instanceof zn?new ba(e,r,n).render():r instanceof Tr?new Cn(e,r,n).render():r instanceof an?new po(e,r,n).render():r instanceof Wn?new ga(e,r,n).render():r instanceof jn?new ya(e,r,n).render():v.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new ha(this.rootContainer,r,e).render().getHTMLElement(),new ua().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 Se("CE Campaign Rejected",r,e);_t(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(o),i.t===1){let s=i.src;if(!s)return;n.push(s)}}),r.bg?.img?.src&&n.push(r.bg.img.src),r.cont.bg?.img?.src&&n.push(r.cont.bg.img.src),await Promise.all(n.map(i=>am(i)))}};var Ea=class{triggerData;render(e){e.contentSource===Di.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){v.warn("Received invalid trigger callback");return}switch(r.type){case"open":_t(new Se("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);_t(new Se("CE Form Submitted",{form:n},this.triggerData)),wi(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),_t(new Se("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(pt.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(l=>{i.includes(l)||(r[l]=n[l])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};function Sm(t){if(!Oy()||!He.get().pixelPush)return;let r=En[t.intent]?.toLowerCase();r&&(v.verbose(`Sending ${r} intent to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:r}))}function Oy(){return window.fbq&&typeof window.fbq=="function"}var Ll="/v1/event/track-page-unload";function ht(t){v.verbose(`Waiting for auth to send event ${t.name}`),rr(zt).then(()=>_t(t))}function sm(t){rr(zt).then(()=>{Py(t)})}async function Py(t){let e=ce().currentPageViewEvent;if(!e){v.warn("No page view event was stored previously");return}let r={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:t};v.verbose("Sending page unload",r);try{await Lt(Ll,r)}catch(n){throw v.error(`Error sending page unload for ${e} to server`,n),n}}function _t(t){Ay(t)}async function Ay(t){if(v.verbose(`Sending event: ${t.name}`,t),ky(t)){v.warn(`Rejecting event ${t.name}`);return}nm();let e=await en();Object.assign(t,e),om(),gt.set("lastUsedTime",new Date().getTime());let r=Uy(t.name),n=r.toLowerCase().replace(/\s+/g,"-");try{let i=await Lt(`/v1/event/track/${n}`,t);v.info("Event tracked:",r),Ny(t)&&(ce().currentPageViewEvent={id:t.id,name:t.name}),Ly(t,i.data)}catch(i){throw v.error(`Error sending event ${t.name} to server`,i),i}}function Ny(t){return ru.includes(t.name)?t.name==="View Cart"?!t.properties.drawer:!0:!1}function Ly(t,e){By(t,e).catch(r=>{ie(r,"process-popup-response",{extra:{event:t,response:e}})}),My(e)}async function By(t,e){if(!e.triggerData)return;let r=new dt(e.triggerData);r.occurred=t.occurred,v.log(`${r} will be shown`);let n;try{n=await pa(r)}catch(i){v.error("Failed to refresh the products",i);return}if(r.items=n,r.contentSource===Di.KLAVIYO){new Ea().render(r);return}new Zr().renderEngagement(r).catch(i=>{ie(i,"render-popup",{extra:{event:t},engagementTrigger:r})})}function My(t){t.intent&&(jp(t.intent),Sm(t),v.info(`Intent is ${En[t.intent]}`))}function Uy(t){return t.replace("CE ","").replace("Trigger","Campaign").replace("Screen","Page").replace("App ","")}function ky(t){return t.trigger?.triggerID==="test"||t.trigger?.triggerID==="preview"?(v.warn("Not sending event as this is a test trigger"),!0):!1}var Fy="keepalive"in new Request(""),vr=new Headers;Wy();async function en(){let[t]=await Promise.all([Kp()]);return B(B({},zs()),t)}function wi(t){rr(zt).then(()=>Hy(t??{}))}function Hy(t){Cm("/v1/user/update",t).then(()=>{v.verbose("Updated user profile")}).catch(e=>{v.error("Error saving user profile",e)})}function vm(t){return Lt("/v1/event/generate-discount",t)}function _a(t){rr(zt).then(()=>Vy({props:t}))}function Vy(t){Cm("/v1/device/update",t).then(()=>{v.verbose("Updated device properties")}).catch(async e=>{v.error("Error saving device property",e)})}function em(t){t&&vr.set("cooee-device-id",t)}function tm(t){t&&vr.set("cooee-first-seen",t.toUTCString())}function Lt(t,e){return xm("POST",t,e)}function Cm(t,e){return xm("PUT",t,e)}function xm(t,e,r){if(!ki()&&!ce().flags?.allowEvents)return v.log(`Rejecting ${t} ${e} as this is not e-commerce app`),Promise.reject();if(e.startsWith("http")||(e=Rt.apiURL+e),r&&!Fy&&e.includes(Ll))return $y(e,vr,r);let n={method:t,headers:vr,keepalive:!1};return r&&(n.body=JSON.stringify(r)),Cr(e,n)}function $y(t,e,r){return new Promise((n,i)=>{let o=new XMLHttpRequest;o.open("POST",t,!0),e.forEach((s,l)=>{o.setRequestHeader(l,s)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{if(o.getResponseHeader("Content-Type")?.includes("application/json")){let l=JSON.parse(o.responseText);n({data:l,headers:e,request:o,status:o.status,statusText:o.statusText})}else i(new Error("Content-Type of response header is not json"))}catch(s){i(s)}else i(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{i(new Error("Network error occurred during the request."))},o.send(JSON.stringify(r))})}function Wy(){vr.set("Content-Type","application/json; charset=utf-8"),vr.set("cooee-sdk",Ro),vr.set("cooee-sdk-code",Ql.toString()),vr.set("cooee-sdk-version",Do),vr.set("cooee-shop-name",as()??"");let t=localStorage.getItem("cooeeDebugTill");(Rt.debug||t&&new Date(t)>new Date)&&vr.set("cooee-sdk-debug","true")}var Sa=class{modifications=[];constructor(){Ir(`.lc-hide {display: none !important;height: 0 !important;}
|
|
1
|
+
import{$ as bi,H as si,I as ai,J as li,K as ci,L as mi,M as pi,N as $,O as di,P as D,Q as gi,R as Ct,S as yt,T as Et,U as ui,V as hi,W as Q,X as St,Y as fi,Z as vi,_ as wi,a as Jr,aa as Ce,b as Qr,c as L,d as Zr,e as J,ea as Ci,f as ei,fa as yi,g as ti,ga as q,ha as Ei,ia as ye,j as me,ja as Si,k as Ge,l as wt,la as xi,m as rr,ma as A,n as ri,na as Ti,o as De,oa as Le,p as bt,pa as xt,q as ii,qa as Ii,r as H,ra as Ee,s as oi,t as Ae,u as ir,v as be,w as ni,x as P}from"./chunk-JAIJ74CO.js";import{A as tr,C as zr,F as Pe,H as $r,I as je,K as qr,L as Y,M as jr,O as d,P as Gr,Q as Kr,R as Xr,S as Yr,d as Mr,f as Wr,h as Nr,i as fe,j as ve,k as we,l as Fr,m as Hr,o as er,p as Br,r as I,s as Vr,w as qe,x as R,y as ke,z as Ur}from"./chunk-MHKDPBHM.js";import{a as f,b as X,h as Or}from"./chunk-U4XWPFUW.js";var Ri=0;function ki(r,e){if(!r)return;let t=document.createElement("script");t.id=e??"",t.src=r,t.type="module",document.head.appendChild(t)}function or(r=document.head){return Pi(fe.styleURL,r,"cooee-global-styles")}function So(r=document.head){return Pi(fe.swiperStyleURL,r,"cooee-swiper-styles")}function Pi(r,e=document.head,t){return new Promise(i=>{if(e.querySelector(`#${t}`)){i();return}let s=document.createElement("link");s.rel="stylesheet",s.href=r,s.id=t,s.onload=()=>{i()},s.onerror=()=>{console.error("Failed to load stylesheet:",r),i()},e.appendChild(s)})}function re(r,e=document.head){if(!r)return;Ri++;let t=document.createElement("style");t.id=`cooee-app-css-${Ri}`,t.textContent=r,e.appendChild(t)}function Di(r){if(!r)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=r,document.head.appendChild(e)}function nr(r){if(r)try{(0,eval)(r)}catch(e){console.error("Failed to execute script:",e)}}async function Tt(){let r=(await import(`${Nr}/swiper-bundle.min.mjs`)).Swiper;return window.CooeeSDK.Swiper=r}async function sr(r,e=!0){if(!r)return;let t=[];e&&t.push(So(r)),t.push(or(r)),await Promise.all(t);let i=we.get().website.commonCSS;re(i,r)}var It=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,t=window.innerHeight;(t!==this.lastHeight||e!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=e,this.lastHeight=t)}};var xo=" daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\bperl\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",To=/bot|crawl|http|lighthouse|scan|search|spider/i,Ke;function Io(){if(Ke instanceof RegExp)return Ke;try{Ke=new RegExp(xo,"i")}catch{Ke=To}return Ke}function Ai(r){return!!r&&Io().test(r)}var Ro="2.0.4",wr=500,Li="user-agent",Ne="",_i="?",Lt="function",ge="undefined",Fe="object",br="string",_="browser",ie="cpu",te="device",j="engine",B="os",Me="result",m="name",n="type",c="vendor",p="version",O="architecture",ot="major",l="model",rt="console",v="mobile",C="tablet",x="smarttv",Z="wearable",Rt="xr",it="embedded",Xe="inapp",Er="brands",xe="formFactors",Sr="fullVersionList",We="platform",xr="platformVersion",Mt="bitness",ue="sec-ch-ua",ko=ue+"-full-version-list",Po=ue+"-arch",Do=ue+"-"+Mt,Ao=ue+"-form-factors",Lo=ue+"-"+v,_o=ue+"-"+l,Gi=ue+"-"+We,Oo=Gi+"-version",Ki=[Er,Sr,v,l,We,xr,O,xe,Mt],kt="Amazon",_e="Apple",Oi="ASUS",Mi="BlackBerry",Se="Google",Wi="Huawei",ar="Lenovo",Ni="Honor",Pt="LG",lr="Microsoft",cr="Motorola",mr="Nvidia",Fi="OnePlus",pr="OPPO",Ye="Samsung",Hi="Sharp",Je="Sony",dr="Xiaomi",gr="Zebra",Bi="Chrome",Vi="Chromium",pe="Chromecast",At="Edge",Qe="Firefox",Ze="Opera",ur="Facebook",Ui="Sogou",Oe="Mobile ",et=" Browser",Cr="Windows",Mo=typeof window!==ge,M=Mo&&window.navigator?window.navigator:void 0,de=M&&M.userAgentData?M.userAgentData:void 0,Wo=function(r,e){var t={},i=e;if(!_t(e)){i={};for(var o in e)for(var s in e[o])i[s]=e[o][s].concat(i[s]?i[s]:[])}for(var a in r)t[a]=i[a]&&i[a].length%2===0?i[a].concat(r[a]):r[a];return t},Wt=function(r){for(var e={},t=0;t<r.length;t++)e[r[t].toUpperCase()]=r[t];return e},yr=function(r,e){if(typeof r===Fe&&r.length>0){for(var t in r)if(oe(e)==oe(r[t]))return!0;return!1}return Be(r)?oe(e)==oe(r):!1},_t=function(r,e){for(var t in r)return/^(browser|cpu|device|engine|os)$/.test(t)||(e?_t(r[t]):!1)},Be=function(r){return typeof r===br},hr=function(r){if(r){for(var e=[],t=He(/\\?\"/g,r).split(","),i=0;i<t.length;i++)if(t[i].indexOf(";")>-1){var o=Ot(t[i]).split(";v=");e[i]={brand:o[0],version:o[1]}}else e[i]=Ot(t[i]);return e}},oe=function(r){return Be(r)?r.toLowerCase():r},fr=function(r){return Be(r)?He(/[^\d\.]/g,r).split(".")[0]:void 0},ne=function(r){for(var e in r){var t=r[e];typeof t==Fe&&t.length==2?this[t[0]]=t[1]:this[t]=void 0}return this},He=function(r,e){return Be(e)?e.replace(r,Ne):e},tt=function(r){return He(/\\?\"/g,r)},Ot=function(r,e){if(Be(r))return r=He(/^\s\s*/,r),typeof e===ge?r:r.substring(0,wr)},vr=function(r,e){if(!(!r||!e))for(var t=0,i,o,s,a,h,u;t<e.length&&!h;){var b=e[t],S=e[t+1];for(i=o=0;i<b.length&&!h&&b[i];)if(h=b[i++].exec(r),h)for(s=0;s<S.length;s++)u=h[++o],a=S[s],typeof a===Fe&&a.length>0?a.length===2?typeof a[1]==Lt?this[a[0]]=a[1].call(this,u):this[a[0]]=a[1]:a.length>=3&&(typeof a[1]===Lt&&!(a[1].exec&&a[1].test)?a.length>3?this[a[0]]=u?a[1].apply(this,a.slice(2)):void 0:this[a[0]]=u?a[1].call(this,u,a[2]):void 0:a.length==3?this[a[0]]=u?u.replace(a[1],a[2]):void 0:a.length==4?this[a[0]]=u?a[3].call(this,u.replace(a[1],a[2])):void 0:a.length>4&&(this[a[0]]=u?a[3].apply(this,[u.replace(a[1],a[2])].concat(a.slice(4))):void 0)):this[a]=u||void 0;t+=2}},ee=function(r,e){for(var t in e)if(typeof e[t]===Fe&&e[t].length>0){for(var i=0;i<e[t].length;i++)if(yr(e[t][i],r))return t===_i?void 0:t}else if(yr(e[t],r))return t===_i?void 0:t;return e.hasOwnProperty("*")?e["*"]:r},zi={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:""},$i={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},No={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"},qi={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[m,Oe+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[p,[m,At+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[m,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[m,p],[/opios[\/ ]+([\w\.]+)/i],[p,[m,Ze+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[p,[m,Ze+" GX"]],[/\bopr\/([\w\.]+)/i],[p,[m,Ze]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[m,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[p,[m,"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],[m,p],[/quark(?:pc)?\/([-\w\.]+)/i],[p,[m,"Quark"]],[/\bddg\/([\w\.]+)/i],[p,[m,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[m,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[m,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[m,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[m,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[m,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[m,"Smart "+ar+et]],[/(avast|avg)\/([\w\.]+)/i],[[m,/(.+)/,"$1 Secure"+et],p],[/\bfocus\/([\w\.]+)/i],[p,[m,Qe+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[m,Ze+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[m,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[m,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[m,Ze+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[m,"MIUI"+et]],[/fxios\/([\w\.-]+)/i],[p,[m,Oe+Qe]],[/\bqihoobrowser\/?([\w\.]*)/i],[p,[m,"360"]],[/\b(qq)\/([\w\.]+)/i],[[m,/(.+)/,"$1Browser"],p],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[m,/(.+)/,"$1"+et],p],[/samsungbrowser\/([\w\.]+)/i],[p,[m,Ye+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[p,[m,Ui+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[m,Ui+" Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[m,p],[/(lbbrowser|rekonq)/i],[m],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[p,m],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[m,ur],p,[n,Xe]],[/(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],[m,p,[n,Xe]],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[m,"GSA"],[n,Xe]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[m,"TikTok"],[n,Xe]],[/\[(linkedin)app\]/i],[m,[n,Xe]],[/(chromium)[\/ ]([-\w\.]+)/i],[m,p],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[m,Bi+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[p,[m,At+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[m,Bi+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[m,"Android"+et]],[/chrome\/([\w\.]+) mobile/i],[p,[m,Oe+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[m,p],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[p,[m,Oe+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[m,Oe+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[p,m],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[m,[p,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[m,p],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[m,Oe+Qe],p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[m,"Netscape"],p],[/(wolvic|librewolf)\/([\w\.]+)/i],[m,p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[m,Qe+" 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],[m,[p,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[m,[p,/[^\d\.]+./,Ne]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[O,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[O,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[O,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[O,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[O,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[O,/ower/,Ne,oe]],[/ sun4\w[;\)]/i],[[O,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[O,oe]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[c,Ye],[n,C]],[/\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],[l,[c,Ye],[n,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[c,_e],[n,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[c,_e],[n,C]],[/(macintosh);/i],[l,[c,_e]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[c,Hi],[n,v]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[l,[c,Ni],[n,C]],[/honor([-\w ]+)[;\)]/i],[l,[c,Ni],[n,v]],[/\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],[l,[c,Wi],[n,C]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[c,Wi],[n,v]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[l,/_/g," "],[c,dr],[n,C]],[/\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],[[l,/_/g," "],[c,dr],[n,v]],[/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],[l,[c,Fi],[n,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[c,pr],[n,v]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[l,[c,ee,{OnePlus:["203","304","403","404","413","415"],"*":pr}],[n,C]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[l,[c,"BLU"],[n,v]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[c,"Vivo"],[n,v]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[c,"Realme"],[n,v]],[/(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],[l,[c,ar],[n,C]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[l,[c,ar],[n,v]],[/\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],[l,[c,cr],[n,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[c,cr],[n,C]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[c,Pt],[n,C]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[c,Pt],[n,v]],[/(nokia) (t[12][01])/i],[c,l,[n,C]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[l,/_/g," "],[n,v],[c,"Nokia"]],[/(pixel (c|tablet))\b/i],[l,[c,Se],[n,C]],[/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],[l,[c,Se],[n,v]],[/(google) (pixelbook( go)?)/i],[c,l],[/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],[l,[c,Je],[n,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[c,Je],[n,C]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[c,kt],[n,C]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[c,kt],[n,v]],[/(playbook);[-\w\),; ]+(rim)/i],[l,c,[n,C]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[c,Mi],[n,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[c,Oi],[n,C]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[c,Oi],[n,v]],[/(nexus 9)/i],[l,[c,"HTC"],[n,C]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[l,/_/g," "],[n,v]],[/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],[l,[c,"TCL"],[n,C]],[/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],[l,[c,"TCL"],[n,v]],[/(itel) ((\w+))/i],[[c,oe],l,[n,ee,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[c,"Acer"],[n,C]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[c,"Meizu"],[n,v]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[c,"Ulefone"],[n,v]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[l,[c,"Energizer"],[n,v]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[l,[c,"Cat"],[n,v]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[l,[c,"Smartfren"],[n,v]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[l,[c,"Nothing"],[n,v]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[l,[c,"Archos"],[n,C]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[l,[c,"Archos"],[n,v]],[/; (n159v)/i],[l,[c,"HMD"],[n,v]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[c,l,[n,C]],[/(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],[c,l,[n,v]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[c,l,[n,C]],[/(surface duo)/i],[l,[c,lr],[n,C]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[c,"Fairphone"],[n,v]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[l,[c,mr],[n,C]],[/(sprint) (\w+)/i],[c,l,[n,v]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[c,lr],[n,v]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[c,gr],[n,C]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[c,gr],[n,v]],[/smart-tv.+(samsung)/i],[c,[n,x]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[c,Ye],[n,x]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[c,l,[n,x]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,Pt],[n,x]],[/(apple) ?tv/i],[c,[l,_e+" TV"],[n,x]],[/crkey.*devicetype\/chromecast/i],[[l,pe+" Third Generation"],[c,Se],[n,x]],[/crkey.*devicetype\/([^/]*)/i],[[l,/^/,"Chromecast "],[c,Se],[n,x]],[/fuchsia.*crkey/i],[[l,pe+" Nest Hub"],[c,Se],[n,x]],[/crkey/i],[[l,pe],[c,Se],[n,x]],[/(portaltv)/i],[l,[c,ur],[n,x]],[/droid.+aft(\w+)( bui|\))/i],[l,[c,kt],[n,x]],[/(shield \w+ tv)/i],[l,[c,mr],[n,x]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[c,Hi],[n,x]],[/(bravia[\w ]+)( bui|\))/i],[l,[c,Je],[n,x]],[/(mi(tv|box)-?\w+) bui/i],[l,[c,dr],[n,x]],[/Hbbtv.*(technisat) (.*);/i],[c,l,[n,x]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[c,/.+\/(\w+)/,"$1",ee,{LG:"lge"}],[l,Ot],[n,x]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[l,[n,x]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[n,x]],[/(playstation \w+)/i],[l,[c,Je],[n,rt]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[c,lr],[n,rt]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[c,l,[n,rt]],[/droid.+; (shield)( bui|\))/i],[l,[c,mr],[n,rt]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[l,[c,Ye],[n,Z]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[c,l,[n,Z]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[l,[c,pr],[n,Z]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[c,_e],[n,Z]],[/(opwwe\d{3})/i],[l,[c,Fi],[n,Z]],[/(moto 360)/i],[l,[c,cr],[n,Z]],[/(smartwatch 3)/i],[l,[c,Je],[n,Z]],[/(g watch r)/i],[l,[c,Pt],[n,Z]],[/droid.+; (wt63?0{2,3})\)/i],[l,[c,gr],[n,Z]],[/droid.+; (glass) \d/i],[l,[c,Se],[n,Rt]],[/(pico) (4|neo3(?: link|pro)?)/i],[c,l,[n,Rt]],[/(quest( \d| pro)?s?).+vr/i],[l,[c,ur],[n,Rt]],[/mobile vr; rv.+firefox/i],[[n,Rt]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[n,it]],[/(aeobc)\b/i],[l,[c,kt],[n,it]],[/(homepod).+mac os/i],[l,[c,_e],[n,it]],[/windows iot/i],[[n,it]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[l,[n,ee,{mobile:"Mobile",xr:"VR","*":C}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[n,C]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[n,v]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[l,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[m,At+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[m,p],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[m,"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],[m,p],[/ladybird\//i],[[m,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,m]],os:[[/(windows nt) (6\.[23]); arm/i],[[m,/N/,"R"],[p,ee,zi]],[/(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],[m,p],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[p,/(;|\))/g,"",ee,zi],[m,Cr]],[/(windows ce)\/?([\d\.]*)/i],[m,p],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[m,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[m,"macOS"],[p,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[p,[m,pe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[p,[m,pe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[p,[m,pe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[p,[m,pe+" Linux"]],[/crkey\/([\d\.]+)/i],[p,[m,pe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[p,m],[/(ubuntu) ([\w\.]+) like android/i],[[m,/(.+)/,"$1 Touch"],p],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[m,p],[/\(bb(10);/i],[p,[m,Mi]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[p,[m,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[m,Qe+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[p,[m,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[p,ee,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[m,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[m,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[m,"Chrome OS"],p],[/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],[m,p],[/(sunos) ?([\d\.]*)/i],[[m,"Solaris"],p],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[m,p]]},Dt=(function(){var r={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return ne.call(r.init,[[_,[m,p,ot,n]],[ie,[O]],[te,[n,l,c]],[j,[m,p]],[B,[m,p]]]),ne.call(r.isIgnore,[[_,[p,ot]],[j,[p]],[B,[p]]]),ne.call(r.isIgnoreRgx,[[_,/ ?browser$/i],[B,/ ?os$/i]]),ne.call(r.toString,[[_,[m,p]],[ie,[O]],[te,[c,l]],[j,[m,p]],[B,[m,p]]]),r})(),Fo=function(r,e){var t=Dt.init[e],i=Dt.isIgnore[e]||0,o=Dt.isIgnoreRgx[e]||0,s=Dt.toString[e]||0;function a(){ne.call(this,t)}return a.prototype.getItem=function(){return r},a.prototype.withClientHints=function(){return de?de.getHighEntropyValues(Ki).then(function(h){return r.setCH(new Xi(h,!1)).parseCH().get()}):r.parseCH().get()},a.prototype.withFeatureCheck=function(){return r.detectFeature().get()},e!=Me&&(a.prototype.is=function(h){var u=!1;for(var b in this)if(this.hasOwnProperty(b)&&!yr(i,b)&&oe(o?He(o,this[b]):this[b])==oe(o?He(o,h):h)){if(u=!0,h!=ge)break}else if(h==ge&&u){u=!u;break}return u},a.prototype.toString=function(){var h=Ne;for(var u in s)typeof this[s[u]]!==ge&&(h+=(h?" ":Ne)+this[s[u]]);return h||ge}),de||(a.prototype.then=function(h){var u=this,b=function(){for(var U in u)u.hasOwnProperty(U)&&(this[U]=u[U])};b.prototype={is:a.prototype.is,toString:a.prototype.toString};var S=new b;return h(S),S}),new a};function Xi(r,e){if(r=r||{},ne.call(this,Ki),e)ne.call(this,[[Er,hr(r[ue])],[Sr,hr(r[ko])],[v,/\?1/.test(r[Lo])],[l,tt(r[_o])],[We,tt(r[Gi])],[xr,tt(r[Oo])],[O,tt(r[Po])],[xe,hr(r[Ao])],[Mt,tt(r[Do])]]);else for(var t in r)this.hasOwnProperty(t)&&typeof r[t]!==ge&&(this[t]=r[t])}function ji(r,e,t,i){return this.get=function(o){return o?this.data.hasOwnProperty(o)?this.data[o]:void 0:this.data},this.set=function(o,s){return this.data[o]=s,this},this.setCH=function(o){return this.uaCH=o,this},this.detectFeature=function(){if(M&&M.userAgent==this.ua)switch(this.itemType){case _:M.brave&&typeof M.brave.isBrave==Lt&&this.set(m,"Brave");break;case te:!this.get(n)&&de&&de[v]&&this.set(n,v),this.get(l)=="Macintosh"&&M&&typeof M.standalone!==ge&&M.maxTouchPoints&&M.maxTouchPoints>2&&this.set(l,"iPad").set(n,C);break;case B:!this.get(m)&&de&&de[We]&&this.set(m,de[We]);break;case Me:var o=this.data,s=function(a){return o[a].getItem().detectFeature().get()};this.set(_,s(_)).set(ie,s(ie)).set(te,s(te)).set(j,s(j)).set(B,s(B))}return this},this.parseUA=function(){return this.itemType!=Me&&vr.call(this.data,this.ua,this.rgxMap),this.itemType==_&&this.set(ot,fr(this.get(p))),this},this.parseCH=function(){var o=this.uaCH,s=this.rgxMap;switch(this.itemType){case _:case j:var a=o[Sr]||o[Er],h;if(a)for(var u in a){var b=a[u].brand||a[u],S=a[u].version;this.itemType==_&&!/not.a.brand/i.test(b)&&(!h||/Chrom/.test(h)&&b!=Vi||h==At&&/WebView2/.test(b))&&(b=ee(b,No),h=this.get(m),h&&!/Chrom/.test(h)&&/Chrom/.test(b)||this.set(m,b).set(p,S).set(ot,fr(S)),h=b),this.itemType==j&&b==Vi&&this.set(p,S)}break;case ie:var U=o[O];U&&(U&&o[Mt]=="64"&&(U+="64"),vr.call(this.data,U+";",s));break;case te:if(o[v]&&this.set(n,v),o[l]&&(this.set(l,o[l]),!this.get(n)||!this.get(c))){var z={};vr.call(z,"droid 9; "+o[l]+")",s),!this.get(n)&&z.type&&this.set(n,z.type),!this.get(c)&&z.vendor&&this.set(c,z.vendor)}if(o[xe]){var le;if(typeof o[xe]!="string")for(var vt=0;!le&&vt<o[xe].length;)le=ee(o[xe][vt++],$i);else le=ee(o[xe],$i);this.set(n,le)}break;case B:var ce=o[We];if(ce){var E=o[xr];ce==Cr&&(E=parseInt(fr(E),10)>=13?"11":"10"),this.set(m,ce).set(p,E)}this.get(m)==Cr&&o[l]=="Xbox"&&this.set(m,"Xbox").set(p,void 0);break;case Me:var K=this.data,T=function(N){return K[N].getItem().setCH(o).parseCH().get()};this.set(_,T(_)).set(ie,T(ie)).set(te,T(te)).set(j,T(j)).set(B,T(B))}return this},ne.call(this,[["itemType",r],["ua",e],["uaCH",i],["rgxMap",t],["data",Fo(this,r)]]),this}function G(r,e,t){if(typeof r===Fe?(_t(r,!0)?(typeof e===Fe&&(t=e),e=r):(t=r,e=void 0),r=void 0):typeof r===br&&!_t(e,!0)&&(t=e,e=void 0),t&&typeof t.append===Lt){var i={};t.forEach(function(u,b){i[b]=u}),t=i}if(!(this instanceof G))return new G(r,e,t).getResult();var o=typeof r===br?r:t&&t[Li]?t[Li]:M&&M.userAgent?M.userAgent:Ne,s=new Xi(t,!0),a=e?Wo(qi,e):qi,h=function(u){return u==Me?function(){return new ji(u,o,a,s).set("ua",o).set(_,this.getBrowser()).set(ie,this.getCPU()).set(te,this.getDevice()).set(j,this.getEngine()).set(B,this.getOS()).get()}:function(){return new ji(u,o,a[u],s).parseUA().get()}};return ne.call(this,[["getBrowser",h(_)],["getCPU",h(ie)],["getDevice",h(te)],["getEngine",h(j)],["getOS",h(B)],["getResult",h(Me)],["getUA",function(){return o}],["setUA",function(u){return Be(u)&&(o=u.length>wr?Ot(u,wr):u),this}]]).setUA(o),this}G.VERSION=Ro;G.BROWSER=Wt([m,p,ot,n]);G.CPU=Wt([O]);G.DEVICE=Wt([l,c,n,rt,v,x,C,Z,it]);G.ENGINE=G.OS=Wt([m,p]);var Nt=class{modifications=[];constructor(){re(`.lc-hide {display: none !important;height: 0 !important;}
|
|
40
2
|
.lc-display-block {display: block !important;}
|
|
41
|
-
.lc-display-inline {display: inline !important;}`,document.body)}execute(e){for(let
|
|
42
|
-
<span class="${
|
|
3
|
+
.lc-display-inline {display: inline !important;}`,document.body)}execute(e){for(let t of e){if(!t.experimentConfig)continue;this.executeExperiment(t)&&this.trackExperimentRan(t)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){Vr("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let t=e.experimentConfig?.modifications;if(!t?.length)return d.log("Nothing to experiment",e.toString()),!0;let i=!1;for(let o of t){if(!o.cssSelector){d.verbose("No CSS Selector available",e?.toString());continue}this.modifications.push(o);let s=Array.from(document.querySelectorAll(o.cssSelector));s?.length&&(this.executeSingleModification(o,s),i=!0)}return i}executeSingleModification(e,t){if(t?.length)for(let i of t)Object.assign(i.style,e.style),e.display==="HIDE"?i.classList.add("lc-hide"):e.display==="BLOCK"?i.classList.add("lc-display-block"):e.display==="INLINE"&&i.classList.add("lc-display-inline"),e.type==="TEXT"&&e.text?i.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,i),e.moveTo?.selector&&this.changePlacement(e,i).catch(console.error)}async changePlacement(e,t){let i=await je(e.moveTo.selector);if(i)switch(e.moveTo.position){case L.BEFORE1:{t.nextElementSibling!==i&&i.parentElement?.insertBefore(t,i);break}case L.INSIDE_FIRST1:{i.firstChild!==t&&i.insertBefore(t,i.firstChild);break}case L.INSIDE_LAST1:{i.lastChild!==t&&i.appendChild(t);break}case L.AFTER1:default:t.previousElementSibling!==i&&i.parentElement?.insertBefore(t,i.nextSibling)}}trackExperimentRan(e){if(e.id==="preview"){d.warn("Skipping experiment attribution as its preview",e.toString());return}Yi({name:"CE Experiment Start",experiment:new di(e)}).catch(t=>{d.error("Fail to track experiment",t)})}setupMutationObserver(){new MutationObserver(t=>{t.forEach(i=>{i.addedNodes.forEach(o=>{o instanceof HTMLElement&&this.modifications.forEach(s=>{if(o.matches&&o.matches(s.cssSelector))d.verbose("1. Re-applying experiment",s.toString()),this.executeSingleModification(s,[o]);else if(o.querySelectorAll){let a=Array.from(o.querySelectorAll(s.cssSelector));if(!a.length)return;d.verbose("2. Re-applying experiment",s.toString()),this.executeSingleModification(s,a)}})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,t){let i=e.image?.lg?.src,o=e.image?.sm?.src;!i&&!o||(t instanceof HTMLPictureElement?this.updatePictureElement({desktop:i,mobile:o},t):this.updateImageElement({desktop:i,mobile:o},t))}updateImageElement(e,t){Ce()&&e.mobile?(t.setAttribute("src",e.mobile),t.removeAttribute("srcset")):e.desktop&&(t.setAttribute("src",e.desktop),t.removeAttribute("srcset"))}updatePictureElement(e,t){if(t.innerHTML="",e.mobile){let o=document.createElement("source");o.srcset=e.mobile,o.media="(max-width: 767px)",t.append(o)}if(e.desktop){let o=document.createElement("source");o.srcset=e.desktop,o.media="(min-width: 768px)",t.append(o)}let i=document.createElement("img");i.src=e.desktop??e.mobile??"",t.append(i)}};async function Yi(r){let e=await Le(),t=f(f({},r),e);await Ee("/v1/event/experiment",t)}function Ft(){Ho().catch(r=>I(r,"fetch-experiments"))}async function Ho(){R().activeExperiments&&(await Ct(St),await Bo())}async function Bo(){d.info("Fetch experiments after \u23F0",ke()+" of SDK load");let r=await Le(),e=f({},r);Ee("/v1/engagement/experiments",e).then(async t=>{d.info(`Experiments fetched in \u23F0 ${qe(t.timeTakenMs)}`);let i=t.data.experiments.map(o=>new $(o));new Nt().execute(i)}).catch(t=>{d.error("Error sending experiment getter",t)})}var Vo=r=>r,Ji=r=>r.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Qi(r,e={childList:!0,subtree:!0},t=500,i=Vo){return ui(o=>{let s=new MutationObserver(a=>o(a));return s.observe(r,e),s},(o,s)=>s.disconnect()).pipe(yt(o=>i(o)),hi(o=>o.length>0),Q(t))}var y=class extends bt{stylesConverter=new Ei(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=Ce()?"sm":"lg",this.clickExecutor=new ye(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),f(f(X(f(f(f(f(f(f({},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:t,rhs:i}=e;switch(e.op){case"eq":return t===i;case"gt":return+t>+i;case"gte":return+t>=+i;case"lt":return+t<+i;case"lte":return+t<=+i;case"ne":return t!==i;case"null":return t==null;case"empty":return t.trim()==="";case"in":return new RegExp(`\\b${i}\\b`).test(t);case"nin":return!new RegExp(`\\b${i}\\b`).test(t);default:return d.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,Ce()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=f(f({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,t){this.clickExecutor.sendTriggerClicked(e,t)}async onClick(e,t){e.stopPropagation(),t.clickAction||(t.clickAction=this.props.element.clc),t.clickAction?.at&&await this.clickExecutor.execute(t)}};var Uo=0,is=Array.isArray;function g(r,e,t,i,o,s){e||(e={});var a,h,u=e;if("ref"in u)for(h in u={},e)h=="ref"?a=e[h]:u[h]=e[h];var b={type:r,props:u,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Uo,__i:-1,__u:0,__source:o,__self:s};if(typeof r=="function"&&(a=r.defaultProps))for(h in a)u[h]===void 0&&(u[h]=a[h]);return rr.vnode&&rr.vnode(b),b}var F=class extends y{componentDidMount(){this.setState(()=>({text:this.props.element.text})),H(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),t=this.state.text;return t||(e.display="none",t=""),g("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:g("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:t}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,t={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},i=be(this.props.element,t,this.props.triggerContext),o=new ai(i);if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:o.text}))}getTypoStyles(){let e={},t=this.mediaStyle.typo??new me;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+"px",e.lineHeight=t.lh,e.fontFamily=t.fam.name||"inherit",e.textAlign=t.alignment,e.fontWeight=t.fw,e.textDecoration=t.td??"none",this.stylesConverter.getColourStyles(t.tc,"color",e),e}getComponentStyles(){return f({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var Te=class extends F{render(){return g("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:g("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return X(f({},super.getComponentStyles()),{cursor:"pointer"})}};var Tr=class extends bt{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?g("div",{style:f(f({},this.getElementStyle()),this.props.styles),children:[g("span",{children:this.props.time}),g("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):g("div",{style:f(f({},this.getElementStyle()),this.props.styles),children:[g("span",{style:this.getTimeLabelStyle(),children:this.props.label}),g("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}},nt=class extends F{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>f({},this.labels)),this.processAndStartTimer()}render(){return g("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>g(Tr,{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 f(f({},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(()=>f({},this.labels))})}};function Ht(r,e){if(!r)return;let t={loop:e.loop,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:r.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(o,s)=>`
|
|
4
|
+
<span class="${s}"
|
|
43
5
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
44
|
-
`,renderProgressbar:
|
|
45
|
-
<span class="${
|
|
6
|
+
`,renderProgressbar:o=>`
|
|
7
|
+
<span class="${o}"
|
|
46
8
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
47
9
|
</span>
|
|
48
|
-
`},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 Ta(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),K("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[K("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&K("div",{class:"swiper-button-next",style:n,children:K("span",{})}),t.navigation.enabled&&K("div",{class:"swiper-button-prev",style:n,children:K("span",{})}),t.pagination.enabled&&K("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var go=class extends Le{componentDidMount(){mt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return K("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:K("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 rt;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Re(B({},this.getTypoStyles()),{display:"flex"})}};var Nr=class extends Le{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 K("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===he.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 Lr=class extends Le{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Yn,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 yo=class extends Lr{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(bi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var vo=class extends Le{render(){return K("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(){mt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new rt;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"),B(B({},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(K("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(K("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 zy=new RegExp('fill="#[a-zA-Z0-9]+"'),wo=class extends Le{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),K("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=Hn(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Hn(this.props.element.halfStart,{svg:e},this.props.triggerContext),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,l=`${i.rating}`.split(".");for(let u=0;u<+l[0];u++)o+=r,s--;l[1]&&(o+=n,s--);for(let u=0;u<s;u++)o+=r.replace(zy,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var bo=class extends Le{render(){return K("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(){mt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new rt;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"),B(B({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(K("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(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var Im=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id},Ml=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 bi=class extends Le{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:K(yo,{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()?K(go,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=Ml(n.variantImage??n.firstImageURL),o=Ml(n.variantSecondaryImage??n.secondaryImageURL);r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=K(Nr,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:K("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?K("cooee-product-options-picker",{item:this.props.item}):K(bo,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?K(vo,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?K(wo,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?K(xn,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):K(tn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=K(Bt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:K("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"}))}attachListener(){document.addEventListener("letscooee:variant-change",e=>{let r=e;if(!r.detail||this.props.item.mID!==r.detail.productID)return;let n=r.detail.variantID;this.props.item.setSelectedVariantByID(n)})}};var Tn=class extends Le{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=sn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new $r(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return K("div",{style:B({},this.getCompiledStyles()),class:"lc-single-product",children:K(bi,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let 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 i=this.props.triggerContext.triggerData.discount?.type===Ut.BXGY;return!r.hasEffectivePrice()&&i&&(n.product=Re(B(B({},n.product),Et("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 Eo=class extends Le{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=gr()?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&&Bs().then(()=>{this.swiperInstance=xa(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>K("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=K("div",{style:Re(B({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Ta(this.configuration,n,i)})}else r=K("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return K(ar,{children:[K(Tn,{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&&K("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:K(Bt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var _o=class extends Le{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Bs().then(()=>{this.swiperInstance=xa(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>{let i=e.values?.map(l=>K("div",{class:"swiper-slide",onClick:u=>this.onClick(u,{clickAction:this.getClickAction(l)}),children:this.renderElement(l)}));if(!i?.length)return[];let o=e.conf,s=i.length;if(o.marquee&&s<=Number(o.maxInRow)){let l=Number(o.maxInRow)-s+1;for(let u=0;u<l;u++)i.push(i[u%s])}return i};return Ta(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return K(Nr,{element:r,triggerContext:this.props.triggerContext});case 4:return K(Lr,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:v.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=sn(e,{form:r},this.props.triggerContext);return Pt.getParsedElement(n)}getClickAction(e){return sn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var tn=class extends Le{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),mt(()=>{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 K(Lr,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return K(ho,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?K(xn,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return K(Bt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return K(Nr,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return K(Eo,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return K(Tn,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return K(_o,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var So=class extends Le{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he.GO_TO_URL&&!!Bn(this.clickAction.gu?.u)||this.clickAction?.at===he.OPEN_CART||this.clickAction?.at===he.INITIATE_CHECKOUT}componentDidMount(){mt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return K(ar,{children:[K("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:K(tn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&K("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 et=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new ir(new Date,this.engagementTrigger)}static currentEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=!1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ie(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){v.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Xc(this.engagementTrigger.content?.afterDeleteJS)}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){v.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,Xc(this.engagementTrigger.content?.afterRenderJS)}async updateAndReRender(e){if(!this.acquireProcessingLock())try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}finally{this.releaseProcessingLock()}}async update(e){this.engagementTrigger.variation=e.variation}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){v.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render()}finally{this.releaseProcessingLock()}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),!0):!1}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}acquireProcessingLock(){return this.isProcessing?(v.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),!0):(v.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=!0,!1)}releaseProcessingLock(){v.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=!1}afterRootContainerCreated(){}isAllOkToRender(){return!!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){v.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){if(!e)return;let r=this.engagementTrigger;v.log(`${r} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(r.items=e.items.map(n=>new st(n)),r.nonMutableItems=e.items.map(n=>new st(n))),e.bundleFrom&&(r.bundleFrom=new st(e.bundleFrom)),e.discount&&(r.discount=e.discount),e.placement&&(r.placement=e.placement),e.props&&pt.hasKeys(e.props)&&(r.props=B(B({},r.props),e.props)),e.content&&(r.content=new Hi(e.content)),r.widget=new Zn(e.widget),r.contentID=e.contentID,r.variation=e.variation,r.placement=e.placement,r.manipulation=e.manipulation,r.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=r.isExclusionTesting()&&r.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px")}addToRendered(){this.renderedCount++,v.info(`${this.engagementTrigger} rendered \u2705 ${Iu(this.renderedCount)} time`)}removeFromRendered(){this instanceof ot?ot.currentEngagements.delete(this):t.currentEngagements.delete(this)}async getVariation(){v.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await Rm(e)).data}catch(r){if(r instanceof Ht&&r.response?.status===400)return;ie(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){v.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 i=new IntersectionObserver((o,s)=>{o.forEach(async l=>{if(l.isIntersecting){v.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let u=await this.getVariation();n(u),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=bn(window,"scroll").pipe(Nt(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 i=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",o=new Se(i,n,this.engagementTrigger);o.name==="CE Campaign Holdout"&&(o.trigger.holdout=!0),_t(o),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=le.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),this.injectOuterCSSOnly(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}async startRendering(){let e=this.rootContainer,r=this.triggerContext.triggerData.hasSwiperElement();r&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),Jc(e)),this.injectCampaignCSS(r,e);let n=this.engagementTrigger.widget;Wu(pc(So,{element:n.cont,triggerContext:this.triggerContext,elements:n.elems}),e),this.addToRendered()}injectCampaignCSS(e,r){let n=this.engagementTrigger.content?.outerCSS?.trim()??"",i=this.engagementTrigger.content?.innerCSS?.trim()??"";if(!n&&!i)return;let o=this.rootContainer.id;if(e){Ir(i,r),this.injectOuterCSSOnly();return}let s=n+`
|
|
49
|
-
${i}`;Ir(`#${o} { ${s} }`)}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let r=this.rootContainer.id;Ir(`#${r} { ${e} }`)}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return v.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(":shadow")){let u=n.split(":shadow");i=(await kr(u[0].trim()))?.shadowRoot,n=u[1].trim(),i&&Jc(i,!1)}v.verbose(`${this.engagementTrigger} attempt to render "${r.position}" "${n}"`);let o=await kr(n,3,i??document);if(!o)return v.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),l=this.getParentElement(s);if(!e)return l;switch(r.position){case wt.BEFORE1:case wt.BEFORE:{o.parentElement?.insertBefore(l,o);break}case wt.INSIDE_FIRST1:case wt.INSIDE_FIRST:{o.insertBefore(l,o.firstChild);break}case wt.INSIDE_LAST1:case wt.INSIDE_LAST:{o.appendChild(l);break}case wt.AFTER1:case wt.AFTER:default:o.parentElement?.insertBefore(l,o.nextSibling)}return l}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){v.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}v.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await pa(this.engagementTrigger)}catch(r){v.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){v.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)Er.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var ot=class extends et{static currentEngagements=new Set;constructor(e){super(e)}rerenderAfterCartOpened(){this.rerenderIfDeleted(),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()&&ce().pageName!=="cart"){v.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var Yy=t=>t,Dm=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Om(t,e={childList:!0,subtree:!0},r=500,n=Yy){return ia(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(Pr(i=>n(i)),Cl(i=>i.length>0),Nt(r))}var Ia=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=le.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){v.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){v.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(g=>g.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(g=>g.mID===e.id.toString());if(!n)return;let i=new cr(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let g of i.sellingPlans??[])g.mID===o.id.toString()&&(g.isSelected=!0,i.changeSellingPlan(g));let s=new st(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let l=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(l);let u=new dt(this.engagementTrigger);u.placement.selector=`.${l}`,u.items=[s];let h=new ot(u);h.renderSilently(),this.watchForCartItemDeletion(h,l)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(v.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 Ra=class extends ot{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}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),await this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ie(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await le.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n=[],i=[],o=[],s,l,u=[...r.milestones];for(let D of u){if(D.rewardType!==Ja.FREE_AUTO_GIFT)continue;if(D.isUIOnly&&!D.allowATC){v.verbose(`Skipping milestone ${D.label} as it is UI only and does not allow ATC`);continue}let U=D.items[0],q=D.reached,P=e.items.find(Q=>(Q.vID===U.vID||Q.mID===U.mID)&&Q.properties._letscooee_campaign===this.engagementTrigger.shortID);q&&(s=D,l=P),P&&n.push(P),!q&&P&&r.removeIneligibleItem?(v.verbose(`Removing free gift ${P.vID} from cart`),o.push(P)):q&&!P&&(v.verbose(`Adding free gift ${U.vID} to cart`),i.push(U))}r.restrictToLatestFreebie&&s&&(l?(n=n.filter(D=>D.vID!==l.vID),i=[]):i=[s.items[0]],o.push(...n));let h={},g={};o.length&&o.forEach(D=>g[D.key??D.vID]=0),i.length&&i.forEach(D=>g[D.vID]=1);let y=r.coupons,E=[];if(y?.length){E=y.map(q=>q.couponCode);let D=le.getCurrent().discount_codes?.map(q=>q.code)??[];E.every(q=>D.some(P=>P===q))||(h.discount=E.join(","))}if(pt.hasKeys(g)&&(h.updates=g),!pt.hasKeys(h))return;let b=await Em(h,this.engagementTrigger),I=b?.items,L=[];for(let D of i){let U=I?.find(q=>E?.length?q.id+""===D.vID&&q.discounts?.some(P=>E.includes(P.title)):q.id+""===D.vID);U&&L.push(U)}if(!L.length){qe.get().refreshUI(b,!1);return}try{await Promise.all(L.map(D=>_m(D,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})))}catch(D){ie(D,"add-private-attribute",{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:L}})}finally{qe.get().refreshUI(b,!1)}}};var Co=class extends ot{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.content}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Da=class extends et{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}async 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 Oa=class extends et{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Pa=class extends et{constructor(e){super(e)}isAllOkToRender(){return!0}async 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})`,i=e.detail;if(!pt.hasKeys(i)){v.error(`No detail received for ${n}`);return}v.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){v.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let l=s.map(u=>new bt({mID:u.product_id,vID:u.variant_id,quantity:u.quantity||1}));await new Ar(this.triggerContext).execute({embeddedItems:l,clickAction:{at:he.ADD_BUNDLE,applyDiscount:!0}})}};var Aa=class extends et{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-collection-filter")}};var Ul=!1,kl=!1,Na=null,La=null,Pm=!1;function Am(){Pm||(Pm=!0,Ur(()=>{Om(document.body,{childList:!0,subtree:!0},500,Dm).subscribe(()=>{et.currentEngagements.forEach(t=>t.rerenderIfDeleted()),ot.currentEngagements.forEach(t=>t.rerenderIfDeleted())})}))}function Fl(t){if(Am(),Ul){v.verbose("Cart widget processing in progress, queuing latest triggers"),Na=t;return}Ul=!0;try{Ky(t)}finally{if(Ul=!1,Na){let e=Na;Na=null,v.verbose("Processing queued cart triggers"),Fl(e)}}}function Hl(t){if(Am(),kl){v.verbose("Page widget processing in progress, queuing latest triggers"),La=t;return}kl=!0;try{Xy(t)}finally{if(kl=!1,La){let e=La;La=null,v.verbose("Processing queued page triggers"),Hl(e)}}}function Ky(t){Lm(ot.currentEngagements,t);for(let e of t){v.info(`${e} received as cart embed`);let r=Nm(ot.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(i=>{ie(i,"update-and-re-render",{engagementTrigger:e})});continue}v.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new Ra(e);else if(e.isSubscriptionUpsell()){Ia.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Co(e):n=new ot(e);ot.currentEngagements.add(n),n.renderSilently()}}function Xy(t){Lm(et.currentEngagements,t);for(let e of t){v.info(`${e} received as page embed`);let r=Nm(et.currentEngagements,e);if(r){r.updateAndReRender(e).catch(i=>{ie(i,"update-and-re-render",{engagementTrigger:e})});continue}v.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Da(e):e.isBYOB()?n=new Pa(e):e.isStickyATC()?n=new Oa(e):e.isSavingsBar()?n=new Co(e):e.isCollectionFilter()?n=new Aa(e):n=new et(e),et.currentEngagements.add(n),n.renderSilently()}}function Nm(t,e){for(let r of t)if(r.matches(e))return r}function Lm(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var Bm="/v1/engagement/page-widgets",Mm="/v1/engagement/cart-widgets",km=new At,Um=0;km.pipe(Nt(50)).subscribe(async t=>{let e=await en();Jy(e).catch(r=>{ie(r,"load-page-widgets",{extra:{firstLoad:t}})}),Qy(e).catch(r=>{ie(r,"load-cart-widgets",{extra:{firstLoad:t}})})});function xo(t=!1){rr(zt).then(()=>{km.next(t)})}function Fm(){ot.currentEngagements.forEach(t=>t.rerenderAfterCartOpened())}async function Rm(t){let e=await en();return Object.assign(t,e),Lt("/v1/engagement/get-variant",t)}function Hm(t,e){return Rt.mode==="local"||!e?t:e+t}async function Jy(t){Um++,Um===1?v.info("Fetch page widgets (after \u23F0",On()+" of SDK load)"):v.info("Fetch page widgets");let e=B({},t),r=Hm(Bm,we.globalRef.apiURLs?.pageWidget);try{let n=await Lt(r,e);v.info(`Page widgets loaded in \u23F0 ${nr(n.timeTakenMs)}`),Ti(Bm);let i=n.data.widgets.map(o=>new dt(o));Hl(i)}catch(n){v.error("Error sending widget getter",n)}}async function Qy(t){v.info("Fetch cart widgets");let e=B({},t),r=Hm(Mm,we.globalRef.apiURLs?.cartWidget);try{let n=await Lt(r,e);v.info(`Cart widgets loaded in \u23F0 ${nr(n.timeTakenMs)}`),Ti(Mm);let i=n.data.widgets.map(o=>new dt(o));Fl(i)}catch(n){v.error("Error sending widget getter",n)}}function Vm(){let t=He.get();!t.gaMeasurementID||!t.gaEnabled||ev()}async function Zy(){let t=await je.get("gacid"),e=await tv();if(t!==e)return await je.set("gacid",e),e}async function ev(){let t=await Zy();t&&_a({gaClientID:t})}async function tv(){let e=He.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(r=>{window.gtag("get",e,"client_id",n=>{r(n)})})}async function $m(t){v.verbose("Received app configuration",t),t.currencyCount=t.currencies?.length;let e=we.globalRef.config.update(t);Vm(),qe.initialize(),e.website&&($f(e.website.commonJS),Ir(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Nt(10)).subscribe(async({open:r})=>{v.info("Cart drawer is now",r?"open":"closed"),r&&(Fm(),await rv())})}function Wm(t){we.globalRef.apiURLs=t}async function rv(){let t=await le.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},r={items:t.items,amount:e,drawer:!0};ht(new Se("View Cart",r))}var Ba=class{runtimeData=ce();meddle(){let e=we.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=we.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{xo()},e.loadExperiments=()=>{Ca()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=we.previewWidget.bind(we),e.previewPopup=we.previewPopup.bind(we),e.executeCTA=(r,n)=>{new Ar(r).execute(n)},e.sendEvent=r=>{ht(r)}}overwritePush(e,r){or(e,"push",r)}meddleAccount(){this.overwritePush(we.globalRef.account,(...e)=>{this.processAccount(e[0])}),we.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(we.globalRef.events,(...e)=>{this.processEvent(e[0])}),we.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(we.globalRef.profile,(...e)=>{this.processProfile(e[0])}),we.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&we.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(tu.includes(e[0])?we.sendEvent(e[0],e[1],B({occurred:this.runtimeData.jsLoadTime},e[2])):we.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&we.updateProfile(e)}processPageName(e){e&&we.setPageName(e)}meddlePage(){this.overwritePush(we.globalRef.page,(...e)=>{this.processPage(e[0])}),we.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&nv(e.currentItem),e.currency&&(ce().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&&we.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&le.getCurrent().update(e.cart),e.configurations&&$m(e.configurations),e.apiURLs&&Wm(e.apiURLs),e.customContext&&(this.runtimeData.customContext=B(B({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(ce().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=Im();if(e||(e=ce().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new dt({id:"preview",shortID:"1",redirectBehaviour:kt.CART_DRAWER});await new Ar(new ir(new Date,r)).execute({clickAction:{at:he.ADD_TO_CART},embeddedItem:new bt({vID:e})})}};function nv(t){let e=ce();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(r)}e.currentItem=new bt(t)}var Ei=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 iv=1e3,ov=10,Vl=0,$l=new Date;function Wl(t){Ei.remove("sleid"),$l=t??new Date}function jm(){if(window.scrollY){let t=zm();Gm(t)&&qm(t)}Ur(()=>{sv()})}function sv(){bn(window,"scroll").pipe(Nt(iv),Pr(()=>{let t=zm();if(t>100){v.warn("Received scroll percent is more than 100",t);return}if(Gm(t))return t})).subscribe(t=>{qm(t)})}function Gm(t){return Math.abs(Vl-t)>=ov||Vl!==t&&t===100}function qm(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-$l.getTime()};Vl=t;let r=Ei.getString("sleid",""),n=new Se("CE Scroll",e,null,r);ht(n),Ei.setString("sleid",n.id.toHexString()),$l=new Date(n.occurred)}function zm(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Ym(){av()}function av(){let t=window.fetch;try{window.fetch=async function(e,r){try{await cv(e,r)}catch(n){ie(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)}}catch(e){console.warn("Fail to override fetch.",`Cooee won't be able to track "Buy Now Clicked" KPI.`),v.error(e)}v.verbose("Securely overwritten window.fetch method for graphql query")}async function cv(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&&(v.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await lv(n),uv()))}async function lv(t){let e=t.variables.input.attributes??[],r=await zo("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function uv(){let t=ce().currentItem;if(!t)return;let e=new Se("Buy Now Clicked",{items:[t]});ht(e)}var _i=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 Se(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});ht(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>v.error(e))}async listen(){this.elements=await oc(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Ma=class t extends _i{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 Ua=class t extends _i{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 fv=[".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 Km(){Ur(()=>{v.verbose("Execution order:","document ready"),pv()})}function pv(){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(fv);if(!e){v.verbose("No clickable cart checkout button found");return}v.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&qe.get().open()}function Jm(){window.addEventListener("kp-modal:opened",()=>{ce().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&wi({goKwikToken:e})}),window.gokwikSdk?Xm():window.addEventListener("gokwikLoaded",Xm)}function Xm(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await le.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new Se("Checkout Started",e);ht(r)})}var ka=class{static watch(){let e=localStorage.getItem("cooeeDebugTill"),r=su();if(r==="1"||r==="on"){let n=this.getDebugMillis();_a({debugTill:n}),e||(e=n.toString(),localStorage.setItem("cooeeDebugTill",e))}r==="on"?sessionStorage.cooeeDebug="1":r==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar(),e&&new Date(+e)<new Date&&localStorage.removeItem("cooeeDebugTill")}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,Ur(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var To=class To extends Mr{};Dn(To,"storeName","app"),To.storage=An(To.storeName);var Fa=To;var we=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(v.info("Initialising SDK"),Wf(navigator.userAgent)){v.info("This seems to be a bot. Disabling SDK");return}this.initGlobalReference(e),await Xp(),this.autoAuthenticate(),new Ba().meddle(),pu(),xo(!0),Ca(),mv(),im(),pm(),Ym(),Km(),jm(),Ua.getInstance().listenSilently(),Ma.getInstance().listenSilently(),Jm(),dv(),ka.watch(),Fa.remove("conf").catch(r=>{v.error("Fail to remove App Config from local storage",r)})}}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||or(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,or(this.globalRef,"config",new He),or(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),or(this.globalRef,"uaParser",new er,!0),or(this.globalRef,"cart",le.getCurrent()),or(this.globalRef,"cartChange$",fm()),or(this.globalRef,"cartDrawerToggle$",qe.cartDrawerToggle$.asObservable()),v.verbose("Global reference initialised"),new Ms(()=>{this.globalRef.uaParser=new er})}static injectWidgetAssets(){Hf(Rt.widgetURL,"cooee-widget-sdk"),Kc()}static autoAuthenticate(){let e=as();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;v.info("Begin auth after \u23F0",On(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((nc(r)||r.length!==24)&&nc(n)){v.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,Yp(e)}static sendEvent(e,r,n){let i=new Se(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),ht(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");wi(e)}static setPageName(e){if(!e)return;let r=ce(),n=r.pageName;if(e===n)return;if(r.pageName=e,Zl.some(s=>e.includes(s))){Wl();return}let i={};n&&(i.ps=n);let o=new Se("CE Screen View",i);o.occurred=r.jsLoadTime,ht(o),Wl(o.occurred)}static previewPopup(e,r){new Zr(r).render(e)}static previewWidget(e){new et(new dt(e)).renderSilently()}};function mv(){window.CooeeSDK.cartChange$.subscribe(()=>{xo()})}function dv(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){v.error(t)}window.addEventListener("message",t=>{if(v.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"?(we.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(we.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}performance.mark("cooee-sdk-start");var Qm=new Date;iu();au();v.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(v.verbose("Execution order:","IIFE start"),await we.initForMerchantWebsiteOnly(Qm),await we.initForAll(),performance.measure("cooee-sdk-init","cooee-sdk-start"),hv(),v.verbose("Execution order:","IIFE end")))());v.verbose("Execution order:","bottom");function hv(){ou()&&import("./debug-logs-J2VHCTDA.js").then(({printAllDebugLogs:t})=>t(Qm))}
|
|
10
|
+
`},navigation:{nextEl:r.querySelector(".swiper-button-next"),prevEl:r.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0};e.marquee&&t.autoplay&&typeof t.autoplay=="object"&&(t.speed=e.speed,t.autoplay.pauseOnMouseEnter=!0,r.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let i=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),i}function Bt(r,e,t){let i={color:r.navigation.color?.rgba};return r.pagination.enabled&&(i.transform="translateY(-25%)"),g("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[g("div",{class:"swiper-wrapper",children:t()}),r.navigation.enabled&&g("div",{class:"swiper-button-next",style:i,children:g("span",{})}),r.navigation.enabled&&g("div",{class:"swiper-button-prev",style:i,children:g("span",{})}),r.pagination.enabled&&g("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:r.pagination.color?.rgba}})]})}var st=class extends y{componentDidMount(){H(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return g("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:g("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:t}=e.target;this.props.item.selected.value=t}getTypoStyles(){let e={},t=this.mediaStyle.typo??new me;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return X(f({},this.getTypoStyles()),{display:"flex"})}};var se=class extends y{constructor(e,t){super(e,t)}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return g("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:t,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===J.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 t={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(t.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(t.height=this.mediaStyle.size.h),t}handleMouseEnter(e){let t=this.props.element[this.deviceTypeKey]?.secondarySrc;t&&(e.currentTarget.src=t)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var ae=class extends y{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return g("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:g(he,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new si,t={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"?t["overflow-y"]="auto":t["overflow-x"]="auto"),t}};var at=class extends ae{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return g("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:g(Ve,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var lt=class extends y{render(){return g("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(){H(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},t=this.mediaStyle.typo??new me;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+"px",e.lineHeight=t.lh,e.fontFamily="inherit",e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),f(f({},e),this.getTypoStyles())}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=!0,t.changeSellingPlan(t.sellingPlans[0])):e.push(g("option",{value:"",selected:!t.selectedSellingPlan,children:"One time purchase"}));for(let i of t.sellingPlans??[])e.push(g("option",{value:i.mID,selected:i.isSelected,children:i.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(i=>i.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var zo=new RegExp('fill="#[a-zA-Z0-9]+"'),ct=class extends y{constructor(){super()}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display="none",t=""),g("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:t}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},t=ir(this.props.element.fullStar,{svg:e},this.props.triggerContext),i=ir(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return"";let s="";if(this.props.element.showSingleStar)s=t;else{let a=5,h=`${o.rating}`.split(".");for(let u=0;u<+h[0];u++)s+=t,a--;h[1]&&(s+=i,a--);for(let u=0;u<a;u++)s+=t.replace(zo,'fill="#f1f1f1"')}return s}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var mt=class extends y{render(){return g("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(){H(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},t=this.mediaStyle.typo??new me;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+"px",e.lineHeight=t.lh,e.fontFamily="inherit",e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.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"),f(f({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(g("option",{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,i=this.props.item.vars.find(o=>o.mID===t);this.props.item.setSelectedVariant(i)}};var Zi=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Ir=r=>{if(!r)return;let e;try{e=new URL(r)}catch{return}if(e.hostname!=="cdn.shopify.com")return r;let t=e.pathname.split(".");return t.length!==2?r:(e.pathname=t[0]+"_large."+t[1],e.toString())};var Ve=class extends y{constructor(e,t){super(e,t),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return t.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:g(at,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?g(st,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let t=e,i=this.props.item,o=Ir(i.variantImage??i.firstImageURL),s=Ir(i.variantSecondaryImage??i.secondaryImageURL);t.lg=t.sm={src:o,name:i.name,secondarySrc:s};let a=g(se,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?a:g("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:a})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let t=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:t.showChips?g("cooee-product-options-picker",{item:this.props.item}):g(mt,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?g(lt,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?g(ct,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?g(Te,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):g(he,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let t=g(F,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:g("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:t})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}attachListener(){document.addEventListener("letscooee:variant-change",e=>{let t=e;if(!t.detail||this.props.item.mID!==t.detail.productID)return;let i=t.detail.variantID;this.props.item.setSelectedVariantByID(i)})}};var Ie=class extends y{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:"unset"}))}render(){let e=be(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new ci(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return g("div",{style:f({},this.getCompiledStyles()),class:"lc-single-product",children:g(Ve,{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,t=e.selectedOrFirstVariant.value,i=e.getTemplateVariables();i.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===Qr.BXGY;return!t.hasEffectivePrice()&&o&&(i.product=X(f(f({},i.product),zr("effective_price",t.effectivePrice.value)),{price:""})),i.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity,{product:i.product,variant:i.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var pt=class extends y{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=Ce()?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&&Tt().then(()=>{this.swiperInstance=Ht(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 t;if(this.configuration.disp===2){let i=s=>{this.swiperRef=s},o=()=>e?.map(s=>g("div",{class:"swiper-slide",children:this.getProductFragment(s)}));t=g("div",{style:X(f({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Bt(this.configuration,i,o)})}else t=g("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((i,o)=>this.getProductFragment(i,o!==e.length-1))});return t}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),t={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(t.flexDirection==="row"){if(e)t.maxWidth="100%",t.overflowY="auto";else if(this.configuration.disp===1){let i=this.props.triggerContext.triggerData,o=i.items.length,s;i.isBundle()?s=this.props.element.prod.symbol?.hide!==!0?o*2-1:o:s=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${s}, auto)`}}return t}getProductFragment(e,t=!1){return g(De,{children:[g(Ie,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&t&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:g(F,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var dt=class extends y{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t)}componentDidMount(){Tt().then(()=>{this.swiperInstance=Ht(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,t=o=>{this.swiperRef=o},i=()=>{let o=e.values?.map(h=>g("div",{class:"swiper-slide",onClick:u=>this.onClick(u,{clickAction:this.getClickAction(h)}),children:this.renderElement(h)}));if(!o?.length)return[];let s=e.conf,a=o.length;if(s.marquee&&a<=Number(s.maxInRow)){let h=Number(s.maxInRow)-a+1;for(let u=0;u<h;u++)o.push(o[u%a])}return o};return Bt(e.conf,t,i)}getComponentStyles(){return{}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return g(se,{element:t,triggerContext:this.props.triggerContext});case 4:return g(ae,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:d.warn("Unknown slide type for carousal")}}valueAddedSlide(e,t){let i=be(e,{form:t},this.props.triggerContext);return li.getParsedElement(i)}getClickAction(e){return be(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var he=class extends y{constructor(e,t){super(e,t),this.setState(()=>({decoration:"unset"})),H(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return g(ae,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return g(nt,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?g(Te,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return g(F,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return g(se,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return g(pt,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return g(Ie,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return g(dt,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var gt=class extends y{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===J.GO_TO_URL&&!!Ur(this.clickAction.gu?.u)||this.clickAction?.at===J.OPEN_CART||this.clickAction?.at===J.INITIATE_CHECKOUT}componentDidMount(){H(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return g(De,{children:[g("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:g(he,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&g("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 k=class r{constructor(e){this.engagementTrigger=e;this.triggerContext=new wt(new Date,this.engagementTrigger)}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=!1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{I(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){d.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),nr(this.engagementTrigger.content?.afterDeleteJS)}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){d.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,nr(this.engagementTrigger.content?.afterRenderJS)}async updateAndReRender(e){if(!this.acquireProcessingLock())try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}finally{this.releaseProcessingLock()}}async update(e){this.engagementTrigger.variation=e.variation}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){d.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render()}finally{this.releaseProcessingLock()}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),!0):!1}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}acquireProcessingLock(){return this.isProcessing?(d.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),!0):(d.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=!0,!1)}releaseProcessingLock(){d.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=!1}afterRootContainerCreated(){}isAllOkToRender(){return!!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){d.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){if(!e)return;let t=this.engagementTrigger;d.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(i=>new Ae(i)),t.nonMutableItems=e.items.map(i=>new Ae(i))),e.bundleFrom&&(t.bundleFrom=new Ae(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),e.props&&ve.hasKeys(e.props)&&(t.props=f(f({},t.props),e.props)),e.content&&(t.content=new pi(e.content)),t.widget=new mi(e.widget),t.contentID=e.contentID,t.variation=e.variation,t.placement=e.placement,t.manipulation=e.manipulation,t.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=t.isExclusionTesting()&&t.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px")}addToRendered(){this.renderedCount++,d.info(`${this.engagementTrigger} rendered \u2705 ${jr(this.renderedCount)} time`)}removeFromRendered(){this instanceof V?Re.delete(this):Ue.delete(this)}async getVariation(){d.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await to(e)).data}catch(t){if(t instanceof Br&&t.response?.status===400)return;I(t,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){d.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,t={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(i=>{let o=new IntersectionObserver((s,a)=>{s.forEach(async h=>{if(h.isIntersecting){d.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let u=await this.getVariation();i(u),a.unobserve(this.rootContainer)}})},t);o.observe(this.rootContainer),this.observers.push(o)})}attachScroll(){this.scrollSubscription=Et(window,"scroll").pipe(Q(r.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let i={};this.triggerContext.triggerData.items?.length&&(i.promotedMIDs=this.engagementTrigger.items?.map(a=>a.mID));let o=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",s=new D(o,i,this.engagementTrigger);s.name==="CE Campaign Holdout"&&(s.trigger.holdout=!0),Ti(s),r.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=P.getCurrent(),t.triggerContext=this.triggerContext,t.engagementTrigger=this.engagementTrigger,t.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered(),this.injectOuterCSSOnly(),t}getParentElement(e,t=document){let i=t.getElementById(e);if(i)return i;let o=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),s=this.engagementTrigger.shortID;return i=document.createElement("div"),i.id=e,i.className=`letscooee letscooee-engagement engagement-${s} lc-${o}`,i.dataset.engagementId=s,this.engagementTrigger.id==="preview"&&(i.className+=" letscooee-preview"),i.style.display="block",i.style.minHeight="0.5px",i.style.minWidth="0.5px",i}async startRendering(){let e=this.rootContainer,t=this.triggerContext.triggerData.hasSwiperElement();t&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),sr(e)),this.injectCampaignCSS(t,e);let i=this.engagementTrigger.widget;ii(ri(gt,{element:i.cont,triggerContext:this.triggerContext,elements:i.elems}),e),this.addToRendered()}injectCampaignCSS(e,t){let i=this.engagementTrigger.content?.outerCSS?.trim()??"",o=this.engagementTrigger.content?.innerCSS?.trim()??"";if(!i&&!o)return;let s=this.rootContainer.id;if(e){re(o,t),this.injectOuterCSSOnly();return}let a=i+`
|
|
11
|
+
${o}`;re(`#${s} { ${a} }`)}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;re(`#${t} { ${e} }`)}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let t=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width,s=e.width*e.height,a=o/s*100;return this.engagementTrigger.isAnySplit()?a>0:a>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let t=await this.createParentElementWithPlacement(e);if(t)return t;let i=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(i)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return d.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let i=t.selector,o;if(i.includes(":shadow")){let u=i.split(":shadow");o=(await je(u[0].trim()))?.shadowRoot,i=u[1].trim(),o&&sr(o,!1)}d.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${i}"`);let s=await je(i,3,o??document);if(!s)return d.warn(`${this.engagementTrigger} no placement found with ${i}`),null;let a=this.generateParentElementID(),h=this.getParentElement(a);if(!e)return h;switch(t.position){case L.BEFORE1:case L.BEFORE:{s.parentElement?.insertBefore(h,s);break}case L.INSIDE_FIRST1:case L.INSIDE_FIRST:{s.insertBefore(h,s.firstChild);break}case L.INSIDE_LAST1:case L.INSIDE_LAST:{s.appendChild(h);break}case L.AFTER1:case L.AFTER:default:s.parentElement?.insertBefore(h,s.nextSibling)}return h}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){d.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}d.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await bi(this.engagementTrigger)}catch(t){d.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){d.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering()}updateItems(e,t){let i=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...i);for(let s of o)ti.remove(t,s)}getItemDiff(e,t){return e.filter(i=>!t.some(o=>o.selectedOrFirstVariant.value.mID===i.selectedOrFirstVariant.value.mID))}};var V=class extends k{constructor(e){super(e)}rerenderAfterCartOpened(){this.rerenderIfDeleted(),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(!q.get().isOpen()&&R().pageName!=="cart"){d.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var Vt=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=P.getCurrent().items}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){d.warn(`No placement available for ${e.objective}`,e.shortID);return}let i=Array.from(document.querySelectorAll(t.selector));if(!i?.length){d.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of i)new r(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(S=>S.mID===e.product_id.toString());if(!t)return;let i=t.vars.find(S=>S.mID===e.id.toString());if(!i)return;let o=new oi(i),s=e.selling_plan_allocation?.selling_plan;if(s)for(let S of o.sellingPlans??[])S.mID===s.id.toString()&&(S.isSelected=!0,o.changeSellingPlan(S));let a=new Ae(t);a.vars=[o],a.selectedOrFirstVariant.value=o;let h=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(h);let u=new $(this.engagementTrigger);u.placement.selector=`.${h}`,u.items=[a];let b=new V(u);b.renderSilently(),this.watchForCartItemDeletion(b,h)}watchForCartItemDeletion(e,t){let i=new MutationObserver(o=>{o.forEach(s=>{s.removedNodes.forEach(a=>{a===this.element&&(d.verbose(`${t} has been removed`),e.destroy(),i.disconnect())})})});i.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(t=>{if(!(e.includes(t.url)||e.includes(t.variant_id))&&(!e.includes(t.product_title)||t.variant_title&&!e.includes(t.variant_title)))return!1;let i=t.selling_plan_allocation?.selling_plan?.name;return!(i&&!e.includes(i))})}};var Ut=class extends V{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}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),await this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){I(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await P.getCurrent().getNormalisedCart(),t=this.engagementTrigger.progressBarConfig,i=[],o=[],s=[],a,h,u=[...t.milestones];for(let E of u){if(E.rewardType!==ei.FREE_AUTO_GIFT)continue;if(E.isUIOnly&&!E.allowATC){d.verbose(`Skipping milestone ${E.label} as it is UI only and does not allow ATC`);continue}let K=E.items[0],T=E.reached,N=e.items.find(Zt=>(Zt.vID===K.vID||Zt.mID===K.mID)&&Zt.properties._letscooee_campaign===this.engagementTrigger.shortID);T&&(a=E,h=N),N&&i.push(N),!T&&N&&t.removeIneligibleItem?(d.verbose(`Removing free gift ${N.vID} from cart`),s.push(N)):T&&!N&&(d.verbose(`Adding free gift ${K.vID} to cart`),o.push(K))}t.restrictToLatestFreebie&&a&&(h?(i=i.filter(E=>E.vID!==h.vID),o=[]):o=[a.items[0]],s.push(...i));let b={},S={};s.length&&s.forEach(E=>S[E.key??E.vID]=0),o.length&&o.forEach(E=>S[E.vID]=1);let U=t.coupons,z=[];if(U?.length){z=U.map(T=>T.couponCode);let E=P.getCurrent().discount_codes?.map(T=>T.code)??[];z.every(T=>E.some(N=>N===T))||(b.discount=z.join(","))}if(ve.hasKeys(S)&&(b.updates=S),!ve.hasKeys(b))return;let le=await Si(b,this.engagementTrigger),vt=le?.items,ce=[];for(let E of o){let K=vt?.find(T=>z?.length?T.id+""===E.vID&&T.discounts?.some(N=>z.includes(N.title)):T.id+""===E.vID);K&&ce.push(K)}if(!ce.length){q.get().refreshUI(le,!1);return}try{await Promise.all(ce.map(E=>xi(E,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})))}catch(E){I(E,"add-private-attribute",{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:ce}})}finally{q.get().refreshUI(le,!1)}}};var ut=class extends V{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.content}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var zt=class extends k{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,t=this.engagementTrigger.content.videoConfig;t.template==="FLOATING_POPUP"?e="cooee-video-popup":t.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var $t=class extends k{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var qt=class extends k{constructor(e){super(e)}isAllOkToRender(){return!0}async 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 t=this.engagementTrigger,i=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!ve.hasKeys(o)){d.error(`No detail received for ${i}`);return}d.log("Detail received for BYOB",o);let s=o.campaignID??o.campaignId??o.campaign_id;if(s!==t.shortID&&s!==t.engagementID){d.warn(`Current ${i} is not BYOB. Received: ${s}`);return}let a=o.items;if(!a?.length)return;let h=a.map(u=>new Ge({mID:u.product_id,vID:u.variant_id,quantity:u.quantity||1}));await new ye(this.triggerContext).execute({embeddedItems:h,clickAction:{at:J.ADD_BUNDLE,applyDiscount:!0}})}};var jt=class extends k{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-collection-filter")}};var Rr=!1,kr=!1,Gt=null,Kt=null,ro=!1,Re=new Set,Ue=new Set;function io(){ro||(ro=!0,Pe(()=>{Qi(document.body,{childList:!0,subtree:!0},500,Ji).subscribe(()=>{Ue.forEach(r=>r.rerenderIfDeleted()),Re.forEach(r=>r.rerenderIfDeleted())})}))}function Pr(r){if(io(),Rr){d.verbose("Cart widget processing in progress, queuing latest triggers"),Gt=r;return}Rr=!0;try{$o(r)}finally{if(Rr=!1,Gt){let e=Gt;Gt=null,d.verbose("Processing queued cart triggers"),Pr(e)}}}function Dr(r){if(io(),kr){d.verbose("Page widget processing in progress, queuing latest triggers"),Kt=r;return}kr=!0;try{qo(r)}finally{if(kr=!1,Kt){let e=Kt;Kt=null,d.verbose("Processing queued page triggers"),Dr(e)}}}function oo(){Re.forEach(r=>r.rerenderAfterCartOpened())}function $o(r){so(Re,r);for(let e of r){d.info(`${e} received as cart embed`);let t=no(Re,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{I(o,"update-and-re-render",{engagementTrigger:e})});continue}d.verbose(`${e} is new`);let i;if(e.isProgressBar())i=new Ut(e);else if(e.isSubscriptionUpsell()){Vt.renderCartUpsell(e);continue}else e.isSavingsBar()?i=new ut(e):i=new V(e);Re.add(i),i.renderSilently()}}function qo(r){so(Ue,r);for(let e of r){d.info(`${e} received as page embed`);let t=no(Ue,e);if(t){t.updateAndReRender(e).catch(o=>{I(o,"update-and-re-render",{engagementTrigger:e})});continue}d.verbose(`${e} is new`);let i;e.isShoppableVideo()?i=new zt(e):e.isBYOB()?i=new qt(e):e.isStickyATC()?i=new $t(e):e.isSavingsBar()?i=new ut(e):e.isCollectionFilter()?i=new jt(e):i=new k(e),Ue.add(i),i.renderSilently()}}function no(r,e){for(let t of r)if(t.matches(e))return t}function so(r,e){let t=new Set(e.map(i=>i.shortID));for(let i of r)t.has(i.engagementTrigger.shortID)||i.destroy()}var jo="/v1/engagement/page-widgets",Go="/v1/engagement/cart-widgets",lo=new gi,ao=0;lo.pipe(Q(50)).subscribe(async r=>{let e=await Le();Ko(e).catch(t=>{I(t,"load-page-widgets",{extra:{firstLoad:r}})}),Xo(e).catch(t=>{I(t,"load-cart-widgets",{extra:{firstLoad:r}})})});function ht(r=!1){Ct(St).then(()=>{lo.next(r)})}async function to(r){let e=await Le();return Object.assign(r,e),Ee("/v1/engagement/get-variant",r)}function co(r,e){return fe.mode==="local"||!e?r:e+r}async function Ko(r){ao++,ao===1?d.info("Fetch page widgets (after \u23F0",ke()+" of SDK load)"):d.info("Fetch page widgets");let e=f({},r),t=co(jo,w.globalRef.apiURLs?.pageWidget);try{let i=await Ee(t,e);d.info(`Page widgets loaded in \u23F0 ${qe(i.timeTakenMs)}`);let o=i.data.widgets.map(s=>new $(s));Dr(o)}catch(i){d.error("Error sending widget getter",i)}}async function Xo(r){d.info("Fetch cart widgets");let e=f({},r),t=co(Go,w.globalRef.apiURLs?.cartWidget);try{let i=await Ee(t,e);d.info(`Cart widgets loaded in \u23F0 ${qe(i.timeTakenMs)}`);let o=i.data.widgets.map(s=>new $(s));Pr(o)}catch(i){d.error("Error sending widget getter",i)}}function mo(){let r=we.get();!r.gaMeasurementID||!r.gaEnabled||Qo()}async function Jo(){let r=await er.get("gacid"),e=await Zo();if(r!==e)return await er.set("gacid",e),e}async function Qo(){let r=await Jo();r&&Ii({gaClientID:r})}async function Zo(){let e=we.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag("get",e,"client_id",i=>{t(i)})})}async function po(r){d.verbose("Received app configuration",r),r.currencyCount=r.currencies?.length;let e=w.globalRef.config.update(r);mo(),q.initialize(),e.website&&(Di(e.website.commonJS),re(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Q(10)).subscribe(async({open:t})=>{d.info("Cart drawer is now",t?"open":"closed"),t&&(oo(),await en())})}function go(r){w.globalRef.apiURLs=r}async function en(){let r=await P.getCurrent().getNormalisedCart(),e={value:r.amount,currency:r.currency},t={items:r.items,amount:e,drawer:!0};A(new D("View Cart",t))}var Xt=class{runtimeData=R();meddle(){let e=w.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=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{ht()},e.loadExperiments=()=>{Ft()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(t,i)=>{new ye(t).execute(i)},e.sendEvent=t=>{A(t)}}overwritePush(e,t){Y(e,"push",t)}meddleAccount(){this.overwritePush(w.globalRef.account,(...e)=>{this.processAccount(e[0])}),w.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0])}),w.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0])}),w.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&w.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(Wr.includes(e[0])?w.sendEvent(e[0],e[1],f({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&w.updateProfile(e)}processPageName(e){e&&w.setPageName(e)}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0])}),w.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&tn(e.currentItem),e.currency&&(R().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&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&P.getCurrent().update(e.cart),e.configurations&&po(e.configurations),e.apiURLs&&go(e.apiURLs),e.customContext&&(this.runtimeData.customContext=f(f({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(R().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=Zi();if(e||(e=R().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let t=new $({id:"preview",shortID:"1",redirectBehaviour:Zr.CART_DRAWER});await new ye(new wt(new Date,t)).execute({clickAction:{at:J.ADD_TO_CART},embeddedItem:new Ge({vID:e})})}};function tn(r){let e=R();if(e.currentItem&&e.currentItem.vID!==r.vID){let t=new CustomEvent("letscooee:variant-change",{detail:{variantID:r.vID,productID:r.mID}});document.dispatchEvent(t)}e.currentItem=new Ge(r)}var ze=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,t){return this.getItem(e)||t}static setString(e,t){this.setItem(e,t)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,t){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),t)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var rn=1e3,on=10,Ar=0,Lr=new Date;function _r(r){ze.remove("sleid"),Lr=r??new Date}function uo(){if(window.scrollY){let r=vo();ho(r)&&fo(r)}Pe(()=>{nn()})}function nn(){Et(window,"scroll").pipe(Q(rn),yt(()=>{let r=vo();if(r>100){d.warn("Received scroll percent is more than 100",r);return}if(ho(r))return r})).subscribe(r=>{fo(r)})}function ho(r){return Math.abs(Ar-r)>=on||Ar!==r&&r===100}function fo(r){if(r==null)return;let e={percent:r,timeMS:new Date().getTime()-Lr.getTime()};Ar=r;let t=ze.getString("sleid",""),i=new D("CE Scroll",e,null,t);A(i),ze.setString("sleid",i.id.toHexString()),Lr=new Date(i.occurred)}function vo(){let r=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/r*100)}function wo(){sn()}function sn(){let r=window.fetch;try{window.fetch=async function(e,t){try{await an(e,t)}catch(i){I(i,"modify-graphql-request",{extra:{body:JSON.stringify(t?.body)}})}return r(e,t)}}catch(e){console.warn("Fail to override fetch.",`Cooee won't be able to track "Buy Now Clicked" KPI.`),d.error(e)}d.verbose("Securely overwritten window.fetch method for graphql query")}async function an(r,e){let t=typeof r=="string"?r:r instanceof Request?r.url:"";if(!(t.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let i;if(typeof e.body=="string")try{i=JSON.parse(e.body)}catch{return}else i=e.body;i?.variables?.input&&(d.verbose("Intercepted fetch request of:",t),i?.query.includes("cartCreate")&&(e.body=await ln(i),cn()))}async function ln(r){let e=r.variables.input.attributes??[],t=await qr("Buy Now");return r.variables.input.attributes=[...e,...t],JSON.stringify(r)}function cn(){let r=R().currentItem;if(!r)return;let e=new D("Buy Now Clicked",{items:[r]});A(e)}var $e=class{constructor(e,t){this.selectors=e;this.eventName=t;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let t=e.currentTarget,i=new D(this.eventName,{class:t.className||void 0,tagName:t.tagName||void 0,id:t.id||void 0});A(i),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>d.error(e))}async listen(){this.elements=await $r(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener("click",e)})}};var Yt=class r extends $e{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(r.selectors,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new r),this.INSTANCE}};var Jt=class r extends $e{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(r.selectors,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new r),this.INSTANCE}};var mn=[".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 bo(){Pe(()=>{d.verbose("Execution order:","document ready"),pn()})}function pn(){let r=window.location.hash?.substring(1);if(r)if(r.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let e=document.querySelector(mn);if(!e){d.verbose("No clickable cart checkout button found");return}d.verbose("Clickable cart checkout button found",e),e.click()}else r.includes("open-cart-drawer")&&q.get().open()}function yo(){window.addEventListener("kp-modal:opened",()=>{R().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:e}=r.detail;e&&xt({goKwikToken:e})}),window.gokwikSdk?Co():window.addEventListener("gokwikLoaded",Co)}function Co(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let r=await P.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:r.items,cartToken:r.token,amount:{value:r.amount,currency:r.currency}},t=new D("Checkout Started",e);A(t)})}var ft=class ft extends Hr{};Or(ft,"storeName","app"),ft.storage=Fr(ft.storeName);var Qt=ft;var w=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(d.info("Initialising SDK"),Ai(navigator.userAgent)){d.info("This seems to be a bot. Disabling SDK");return}this.initGlobalReference(e),await vi(),this.autoAuthenticate(),new Xt().meddle(),Jr(),ht(!0),Ft(),dn(),wi(),yi(),wo(),bo(),uo(),Jt.getInstance().listenSilently(),Yt.getInstance().listenSilently(),yo(),gn(),Yr(),Qt.remove("conf").catch(t=>{d.error("Fail to remove App Config from local storage",t)})}}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Y(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Y(this.globalRef,"config",new we),Y(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Y(this.globalRef,"uaParser",new G,!0),Y(this.globalRef,"cart",P.getCurrent()),Y(this.globalRef,"cartChange$",Ci()),Y(this.globalRef,"cartDrawerToggle$",q.cartDrawerToggle$.asObservable()),d.verbose("Global reference initialised"),new It(()=>{this.globalRef.uaParser=new G})}static injectWidgetAssets(){ki(fe.widgetURL,"cooee-widget-sdk"),or()}static autoAuthenticate(){let e=ni();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;d.info("Begin auth after \u23F0",ke(),"of SDK load");let t=e.appID?.trim(),i=e.shopifyShop;if((tr(t)||t.length!==24)&&tr(i)){d.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,fi(e)}static sendEvent(e,t,i){let o=new D(e,t,i?.triggerData);i?.occurred&&(o.occurred=i.occurred),A(o)}static updateProfile(e){for(let t in e)if(t.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");xt(e)}static setPageName(e){if(!e)return;let t=R(),i=t.pageName;if(e===i)return;if(t.pageName=e,Mr.some(a=>e.includes(a))){_r();return}let o={};i&&(o.ps=i);let s=new D("CE Screen View",o);s.occurred=t.jsLoadTime,A(s),_r(s.occurred)}static previewPopup(e,t){import("./renderer-7THALERZ.js").then(({FreeformRenderer:i})=>{new i(t).render(e)})}static previewWidget(e){new k(new $(e)).renderSilently()}};function dn(){window.CooeeSDK.cartChange$.subscribe(()=>{ht()})}function gn(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(r){d.error(r)}window.addEventListener("message",r=>{if(d.verbose("Received event",r),!r.origin.includes("letscooee.com")&&!r.origin.includes("localhost"))return;let e=r.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(w.previewPopup(e.engagementTrigger),r.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},r.origin)):e.action==="WIDGET_PREVIEW"&&(w.previewWidget(e.engagementTrigger),r.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},r.origin)))})}}performance.mark("cooee-sdk-start");var Eo=new Date;Gr();Xr();d.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(d.verbose("Execution order:","IIFE start"),await w.initForMerchantWebsiteOnly(Eo),await w.initForAll(),performance.measure("cooee-sdk-init","cooee-sdk-start"),un(),d.verbose("Execution order:","IIFE end")))());d.verbose("Execution order:","bottom");function un(){Kr()&&import("./sdk-debug-logs-PG5BE6E3.js").then(({printAllDebugLogs:r})=>r(Eo))}
|