@letscooee/web-sdk 13.1.13 → 13.1.14
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-BIEFC1bG-O9o-0wf6.js → chunk-C_cBbkTf-CTSBF1Lh.js} +2 -2
- package/dist/{debugger.component-BNl5T8Oq-CCsu6jm4.js → debugger.component-DGenGFsu-BT4w6ZSR.js} +3 -3
- package/dist/{esm-DKhFdjmg-vxI_Qn9S.js → esm-DKhFdjmg-Dag-xV2C.js} +1 -1
- package/dist/main.min.js +4 -4
- package/dist/{renderer-BZ_aYsz_-DBEn5kf6.js → renderer-v4JpDv8Y-BMksDEdR.js} +2 -2
- package/dist/{share-dialog.component-C0AjtP26-CmZTeB2B.js → share-dialog.component-D46Z7qqm-CCcMnhK7.js} +4 -4
- package/dist/{video-detail-dialog.component-mG6ikv4x-DowKli6K.js → video-detail-dialog.component-Bxg20OFh-eyH-mp7f.js} +6 -6
- package/dist/{widgets-B3EF6aEn-B8-8vMIl.js → widgets-CeQB31bn-JEgjqW5I.js} +6 -6
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var __require=(x=>typeof require!==`undefined`?require:typeof Proxy!==`undefined`?new Proxy(x,{get:(a,b)=>(typeof require!==`undefined`?require:a)[b]}):x)(function(x){if(typeof require!==`undefined`)return require.apply(this,arguments);throw Error('Calling `require` for "'+x+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});var k=Object.create;var g=Object.defineProperty,l$1=Object.defineProperties,m=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,p=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var i=(a,b,c)=>b in a?g(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c,r=(a,b)=>{for(var c in b||={})h.call(b,c)&&i(a,c,b[c]);if(f)for(var c of f(b))j.call(b,c)&&i(a,c,b[c]);return a},s$1=(a,b)=>l$1(a,n(b));var t=(a=>typeof __require<`u`?__require:typeof Proxy<`u`?new Proxy(a,{get:(b,c)=>(typeof __require<`u`?__require:b)[c]}):a)(function(a){if(typeof __require<`u`)return __require.apply(this,arguments);throw Error(`Dynamic require of "`+a+`" is not supported`)});var u=(a,b)=>{var c={};for(var d in a)h.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&f)for(var d of f(a))b.indexOf(d)<0&&j.call(a,d)&&(c[d]=a[d]);return c};var v=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),w=(a,b)=>{for(var c in b)g(a,c,{get:b[c],enumerable:true});},q=(a,b,c,d)=>{if(b&&typeof b==`object`||typeof b==`function`)for(let e of o(b))!h.call(a,e)&&e!==c&&g(a,e,{get:()=>b[e],enumerable:!(d=m(b,e))||d.enumerable});return a};var x=(a,b,c)=>(c=a!=null?k(p(a)):{},q(!a||!a.__esModule?g(c,`default`,{value:a,enumerable:true}):c,a));
|
|
2
2
|
|
|
3
|
-
var mt=v((dt,Be)=>{(function(s){if(typeof dt==`object`&&typeof Be<`u`)Be.exports=s();else if(typeof define==`function`&&define.amd)define([],s);else {var n;typeof window<`u`?n=window:typeof global<`u`?n=global:typeof self<`u`?n=self:n=this,n.localforage=s();}})(function(){return (function c(v,I,w){function R(T,V){if(!I[T]){if(!v[T]){var p=typeof t==`function`&&t;if(!V&&p)return p(T,true);if(b)return b(T,true);var _=new Error(`Cannot find module '`+T+`'`);throw _.code=`MODULE_NOT_FOUND`,_}var C=I[T]={exports:{}};v[T][0].call(C.exports,function(O){var j=v[T][1][O];return R(j||O)},C,C.exports,c,v,I,w);}return I[T].exports}for(var b=typeof t==`function`&&t,m=0;m<w.length;m++)R(w[m]);return R})({1:[function(c,v,I){(function(w){var R=w.MutationObserver||w.WebKitMutationObserver,b;if(R){var m=0,T=new R(O),V=w.document.createTextNode(``);T.observe(V,{characterData:true}),b=function(){V.data=m=++m%2;};}else if(!w.setImmediate&&typeof w.MessageChannel<`u`){var p=new w.MessageChannel;p.port1.onmessage=O,b=function(){p.port2.postMessage(0);};}else `document`in w&&`onreadystatechange`in w.document.createElement(`script`)?b=function(){var B=w.document.createElement(`script`);B.onreadystatechange=function(){O(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null;},w.document.documentElement.appendChild(B);}:b=function(){setTimeout(O,0);};var _,C=[];function O(){_=true;for(var B,z,F=C.length;F;){for(z=C,C=[],B=-1;++B<F;)z[B]();F=C.length;}_=false;}v.exports=j;function j(B){C.push(B)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(c,v,I){var w=c(1);function R(){}var b={},m=[`REJECTED`],T=[`FULFILLED`],V=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=V,this.queue=[],this.outcome=void 0,y!==R&&j(this,y);}p.prototype.catch=function(y){return this.then(null,y)},p.prototype.then=function(y,A){if(typeof y!=`function`&&this.state===T||typeof A!=`function`&&this.state===m)return this;var D=new this.constructor(R);if(this.state!==V)C(D,this.state===T?y:A,this.outcome);else this.queue.push(new _(D,y,A));return D};function _(y,A,D){this.promise=y,typeof A==`function`&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof D==`function`&&(this.onRejected=D,this.callRejected=this.otherCallRejected);}_.prototype.callFulfilled=function(y){b.resolve(this.promise,y);},_.prototype.otherCallFulfilled=function(y){C(this.promise,this.onFulfilled,y);},_.prototype.callRejected=function(y){b.reject(this.promise,y);},_.prototype.otherCallRejected=function(y){C(this.promise,this.onRejected,y);};function C(y,A,D){w(function(){var L;try{L=A(D);}catch(U){return b.reject(y,U)}L===y?b.reject(y,new TypeError(`Cannot resolve promise with itself`)):b.resolve(y,L);});}b.resolve=function(y,A){var D=B(O,A);if(D.status===`error`)return b.reject(y,D.value);var L=D.value;if(L)j(y,L);else {y.state=T,y.outcome=A;for(var U=-1,k=y.queue.length;++U<k;)y.queue[U].callFulfilled(A);}return y},b.reject=function(y,A){y.state=m,y.outcome=A;for(var D=-1,L=y.queue.length;++D<L;)y.queue[D].callRejected(A);return y};function O(y){var A=y&&y.then;if(y&&(typeof y==`object`||typeof y==`function`)&&typeof A==`function`)return function(){A.apply(y,arguments);}}function j(y,A){var D=false;function L(G){D||(D=true,b.reject(y,G));}function U(G){D||(D=true,b.resolve(y,G));}function k(){A(U,L);}var $=B(k);$.status===`error`&&L($.value);}function B(y,A){var D={};try{D.value=y(A),D.status=`success`;}catch(L){D.status=`error`,D.value=L;}return D}p.resolve=z;function z(y){return y instanceof this?y:b.resolve(new this(R),y)}p.reject=F;function F(y){var A=new this(R);return b.reject(A,y)}p.all=Ie;function Ie(y){var A=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var U=new Array(D),k=0,$=-1,G=new this(R);++$<D;)q(y[$],$);return G;function q(ae,le){A.resolve(ae).then(Se,function(re){L||(L=true,b.reject(G,re));});function Se(re){U[le]=re,++k===D&&!L&&(L=true,b.resolve(G,U));}}}p.race=Z;function Z(y){var A=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var U=-1,k=new this(R);++U<D;)$(y[U]);return k;function $(G){A.resolve(G).then(function(q){L||(L=true,b.resolve(k,q));},function(q){L||(L=true,b.reject(k,q));});}}},{1:1}],3:[function(c,v,I){(function(w){typeof w.Promise!=`function`&&(w.Promise=c(2));}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{2:2}],4:[function(c,v,I){var w=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e};function R(e,r){if(!(e instanceof r))throw new TypeError(`Cannot call a class as a function`)}function b(){try{if(typeof indexedDB<`u`)return indexedDB;if(typeof webkitIndexedDB<`u`)return webkitIndexedDB;if(typeof mozIndexedDB<`u`)return mozIndexedDB;if(typeof OIndexedDB<`u`)return OIndexedDB;if(typeof msIndexedDB<`u`)return msIndexedDB}catch{return}}var m=b();function T(){try{if(!m||!m.open)return !1;var e=typeof openDatabase<`u`&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch==`function`&&fetch.toString().indexOf(`[native code`)!==-1;return (!e||r)&&typeof indexedDB<`u`&&typeof IDBKeyRange<`u`}catch{return false}}function V(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(o){if(o.name!==`TypeError`)throw o;for(var i=new(typeof BlobBuilder<`u`?BlobBuilder:typeof MSBlobBuilder<`u`?MSBlobBuilder:typeof MozBlobBuilder<`u`?MozBlobBuilder:WebKitBlobBuilder),a=0;a<e.length;a+=1)i.append(e[a]);return i.getBlob(r.type)}}typeof Promise>`u`&&c(3);var p=Promise;function _(e,r){r&&e.then(function(t){r(null,t);},function(t){r(t);});}function C(e,r,t){typeof r==`function`&&e.then(r),typeof t==`function`&&e.catch(t);}function O(e){return typeof e!=`string`&&(console.warn(e+` used as a key, but it is not a string.`),e=String(e)),e}function j(){if(arguments.length&&typeof arguments[arguments.length-1]==`function`)return arguments[arguments.length-1]}var B=`local-forage-detect-blob-support`,z=void 0,F={},Ie=Object.prototype.toString,Z=`readonly`,y=`readwrite`;function A(e){for(var r=e.length,t=new ArrayBuffer(r),i=new Uint8Array(t),a=0;a<r;a++)i[a]=e.charCodeAt(a);return t}function D(e){return new p(function(r){var t=e.transaction(B,y),i=V([``]);t.objectStore(B).put(i,`key`),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(false);},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/);r(navigator.userAgent.match(/Edge\//)||!a||parseInt(a[1],10)>=43);};}).catch(function(){return false})}function L(e){return typeof z==`boolean`?p.resolve(z):D(e).then(function(r){return z=r,z})}function U(e){var r=F[e.name],t={};t.promise=new p(function(i,a){t.resolve=i,t.reject=a;}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise;}function k(e){var t=F[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function $(e,r){var i=F[e.name].deferredOperations.pop();if(i)return i.reject(r),i.promise}function G(e,r){return new p(function(t,i){if(F[e.name]=F[e.name]||We(),e.db)if(r)U(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var o=m.open.apply(m,a);r&&(o.onupgradeneeded=function(u){var f=o.result;try{f.createObjectStore(e.storeName),u.oldVersion<=1&&f.createObjectStore(B);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+u.oldVersion+` to version `+u.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(u){u.preventDefault(),i(o.error);},o.onsuccess=function(){var u=o.result;u.onversionchange=function(f){f.target.close();},t(u),k(e);};})}function q(e){return G(e,false)}function ae(e){return G(e,true)}function le(e,r){if(!e.db)return true;var t=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,a=e.version>e.db.version;if(i&&(e.version!==r&&console.warn(`The database "`+e.name+`" can't be downgraded from version `+e.db.version+` to version `+e.version+`.`),e.version=e.db.version),a||t){if(t){var o=e.db.version+1;o>e.version&&(e.version=o);}return true}return false}function Se(e){return new p(function(r,t){var i=new FileReader;i.onerror=t,i.onloadend=function(a){r({__local_forage_encoded_blob:true,data:btoa(a.target.result||``),type:e.type});},i.readAsBinaryString(e);})}function re(e){return V([A(atob(e.data))],{type:e.type})}function ke(e){return e&&e.__local_forage_encoded_blob}function Ct(e){var r=this,t=r._initReady().then(function(){var i=F[r._dbInfo.name];if(i&&i.dbReady)return i.dbReady});return C(t,e,e),t}function At(e){U(e);for(var r=F[e.name],t=r.forages,i=0;i<t.length;i++){var a=t[i];a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null);}return e.db=null,q(e).then(function(o){return e.db=o,le(e)?ae(e):o}).then(function(o){e.db=r.db=o;for(var u=0;u<t.length;u++)t[u]._dbInfo.db=o;}).catch(function(o){throw $(e,o),o})}function K(e,r,t,i){i===void 0&&(i=1);try{t(null,e.db.transaction(e.storeName,r));}catch(o){if(i>0&&(!e.db||o.name===`InvalidStateError`||o.name===`NotFoundError`))return p.resolve().then(function(){if(!e.db||o.name===`NotFoundError`&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ae(e)}).then(function(){return At(e).then(function(){K(e,r,t,i-1);})}).catch(t);t(o);}}function We(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function xt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=e[i];var a=F[t.name];a||(a=We(),F[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=Ct);var o=[];function u(){return p.resolve()}for(var f=0;f<a.forages.length;f++){var l=a.forages[f];l!==r&&o.push(l._initReady().catch(u));}var d=a.forages.slice(0);return p.all(o).then(function(){return t.db=a.db,q(t)}).then(function(g){return t.db=g,le(t,r._defaultConfig.version)?ae(t):g}).then(function(g){t.db=a.db=g,r._dbInfo=t;for(var E=0;E<d.length;E++){var S=d[E];S!==r&&(S._dbInfo.db=t.db,S._dbInfo.version=t.version);}})}function Nt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,Z,function(u,f){if(u)return o(u);try{var d=f.objectStore(t._dbInfo.storeName).get(e);d.onsuccess=function(){var g=d.result;g===void 0&&(g=null),ke(g)&&(g=re(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Lt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,Z,function(u,f){if(u)return o(u);try{var d=f.objectStore(t._dbInfo.storeName).openCursor(),g=1;d.onsuccess=function(){var E=d.result;if(E){var S=E.value;ke(S)&&(S=re(S));var x=e(S,E.key,g++);x!==void 0?a(x):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ot(e,r,t){var i=this;e=O(e);var a=new p(function(o,u){var f;i.ready().then(function(){return f=i._dbInfo,Ie.call(r)===`[object Blob]`?L(f.db).then(function(l){return l?r:Se(r)}):r}).then(function(l){K(i._dbInfo,y,function(d,g){if(d)return u(d);try{var E=g.objectStore(i._dbInfo.storeName);l===null&&(l=void 0);var S=E.put(l,e);g.oncomplete=function(){l===void 0&&(l=null),o(l);},g.onabort=g.onerror=function(){u(S.error?S.error:S.transaction.error);};}catch(x){u(x);}});}).catch(u);});return _(a,t),a}function Pt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,y,function(u,f){if(u)return o(u);try{var d=f.objectStore(t._dbInfo.storeName).delete(e);f.oncomplete=function(){a();},f.onerror=function(){o(d.error);},f.onabort=function(){o(d.error?d.error:d.transaction.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,y,function(o,u){if(o)return a(o);try{var l=u.objectStore(r._dbInfo.storeName).clear();u.oncomplete=function(){i();},u.onabort=u.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Mt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,u){if(o)return a(o);try{var l=u.objectStore(r._dbInfo.storeName).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Bt(e,r){var t=this,i=new p(function(a,o){if(e<0){a(null);return}t.ready().then(function(){K(t._dbInfo,Z,function(u,f){if(u)return o(u);try{var l=f.objectStore(t._dbInfo.storeName),d=!1,g=l.openKeyCursor();g.onsuccess=function(){var E=g.result;if(!E){a(null);return}e===0||d?a(E.key):(d=!0,E.advance(e));},g.onerror=function(){o(g.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ft(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,u){if(o)return a(o);try{var l=u.objectStore(r._dbInfo.storeName).openKeyCursor(),d=[];l.onsuccess=function(){var g=l.result;if(!g){i(d);return}d.push(g.key),g.continue();},l.onerror=function(){a(l.error);};}catch(g){a(g);}});}).catch(a);});return _(t,e),t}function Ut(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;if(!e.name)a=p.reject(`Invalid arguments`);else {var u=e.name===t.name&&i._dbInfo.db?p.resolve(i._dbInfo.db):q(e).then(function(f){var l=F[e.name],d=l.forages;l.db=f;for(var g=0;g<d.length;g++)d[g]._dbInfo.db=f;return f});e.storeName?a=u.then(function(f){if(f.objectStoreNames.contains(e.storeName)){var l=f.version+1;U(e);var d=F[e.name],g=d.forages;f.close();for(var E=0;E<g.length;E++){var S=g[E];S._dbInfo.db=null,S._dbInfo.version=l;}return new p(function(N,M){var P=m.open(e.name,l);P.onerror=function(H){P.result.close(),M(H);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var H=P.result;H.close(),N(H);};}).then(function(N){d.db=N;for(var M=0;M<g.length;M++){var P=g[M];P._dbInfo.db=N,k(P._dbInfo);}}).catch(function(N){throw ($(e,N)||p.resolve()).catch(function(){}),N})}}):a=u.then(function(f){U(e);var l=F[e.name],d=l.forages;f.close();for(var g=0;g<d.length;g++){var E=d[g];E._dbInfo.db=null;}return new p(function(x,N){var M=m.deleteDatabase(e.name);M.onerror=function(){var P=M.result;P&&P.close(),N(M.error);},M.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},M.onsuccess=function(){var P=M.result;P&&P.close(),x(P);};}).then(function(x){l.db=x;for(var N=0;N<d.length;N++){var M=d[N];k(M._dbInfo);}}).catch(function(x){throw ($(e,x)||p.resolve()).catch(function(){}),x})});}return _(a,r),a}var kt={_driver:`asyncStorage`,_initStorage:xt,_support:T(),iterate:Lt,getItem:Nt,setItem:Ot,removeItem:Pt,clear:Vt,length:Mt,key:Bt,keys:Ft,dropInstance:Ut};function Wt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,$t=`~~local_forage_type~`,$e=/^~~local_forage_type~([^~]+)~/,de=`__lfsc__:`,De=de.length,Re=`arbf`,Ce=`blob`,Ge=`si08`,He=`ui08`,Ye=`uic8`,je=`si16`,ze=`si32`,qe=`ur16`,Ke=`ui32`,Xe=`fl32`,Je=`fl64`,Qe=De+Re.length,Ze=Object.prototype.toString;function et(e){var r=e.length*.75,t=e.length,i,a=0,o,u,f,l;e[e.length-1]===`=`&&(r--,e[e.length-2]===`=`&&r--);var d=new ArrayBuffer(r),g=new Uint8Array(d);for(i=0;i<t;i+=4)o=X.indexOf(e[i]),u=X.indexOf(e[i+1]),f=X.indexOf(e[i+2]),l=X.indexOf(e[i+3]),g[a++]=o<<2|u>>4,g[a++]=(u&15)<<4|f>>2,g[a++]=(f&3)<<6|l&63;return d}function Ae(e){var r=new Uint8Array(e),t=``,i;for(i=0;i<r.length;i+=3)t+=X[r[i]>>2],t+=X[(r[i]&3)<<4|r[i+1]>>4],t+=X[(r[i+1]&15)<<2|r[i+2]>>6],t+=X[r[i+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+`=`:r.length%3===1&&(t=t.substring(0,t.length-2)+`==`),t}function Gt(e,r){var t=``;if(e&&(t=Ze.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&Ze.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=de;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=Ge:t===`[object Uint8Array]`?a+=He:t===`[object Uint8ClampedArray]`?a+=Ye:t===`[object Int16Array]`?a+=je:t===`[object Uint16Array]`?a+=qe:t===`[object Int32Array]`?a+=ze:t===`[object Uint32Array]`?a+=Ke:t===`[object Float32Array]`?a+=Xe:t===`[object Float64Array]`?a+=Je:r(new Error(`Failed to get type for BinaryArray`))),r(a+Ae(i));}else if(t===`[object Blob]`){var o=new FileReader;o.onload=function(){var u=$t+e.type+`~`+Ae(this.result);r(de+Ce+u);},o.readAsArrayBuffer(e);}else try{r(JSON.stringify(e));}catch(u){console.error(`Couldn't convert value into a JSON string: `,e),r(null,u);}}function Ht(e){if(e.substring(0,De)!==de)return JSON.parse(e);var r=e.substring(Qe),t=e.substring(De,Qe),i;if(t===Ce&&$e.test(r)){var a=r.match($e);i=a[1],r=r.substring(a[0].length);}var o=et(r);switch(t){case Re:return o;case Ce:return V([o],{type:i});case Ge:return new Int8Array(o);case He:return new Uint8Array(o);case Ye:return new Uint8ClampedArray(o);case je:return new Int16Array(o);case qe:return new Uint16Array(o);case ze:return new Int32Array(o);case Ke:return new Uint32Array(o);case Xe:return new Float32Array(o);case Je:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var xe={serialize:Gt,deserialize:Ht,stringToBuffer:et,bufferToString:Ae};function tt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Yt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=typeof e[i]!=`string`?e[i].toString():e[i];var a=new p(function(o,u){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return u(f)}t.db.transaction(function(f){tt(f,t,function(){r._dbInfo=t,o();},function(l,d){u(d);});},u);});return t.serializer=xe,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(u,f){f.code===f.SYNTAX_ERR?u.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):tt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(u,f);},o);}function jt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`SELECT * FROM `+u.storeName+` WHERE key = ? LIMIT 1`,[e],function(l,d){var g=d.rows.length?d.rows.item(0).value:null;g&&(g=u.serializer.deserialize(g)),a(g);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function zt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`SELECT * FROM `+u.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var x=g.item(S),N=x.value;if(N&&(N=u.serializer.deserialize(N)),N=e(N,x.key,S+1),N!==void 0){a(N);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function rt(e,r,t,i){var a=this;e=O(e);var o=new p(function(u,f){a.ready().then(function(){r===void 0&&(r=null);var l=r,d=a._dbInfo;d.serializer.serialize(r,function(g,E){E?f(E):d.db.transaction(function(S){J(S,d,`INSERT OR REPLACE INTO `+d.storeName+` (key, value) VALUES (?, ?)`,[e,g],function(){u(l);},function(x,N){f(N);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){u(rt.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function qt(e,r,t){return rt.apply(this,[e,r,t,1])}function Kt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`DELETE FROM `+u.storeName+` WHERE key = ?`,[e],function(){a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Xt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(u){J(u,o,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Jt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(u){J(u,o,`SELECT COUNT(key) as c FROM `+o.storeName,[],function(f,l){var d=l.rows.item(0).c;i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Qt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`SELECT key FROM `+u.storeName+` WHERE id = ? LIMIT 1`,[e+1],function(l,d){a(d.rows.length?d.rows.item(0).key:null);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Zt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(u){J(u,o,`SELECT key FROM `+o.storeName,[],function(f,l){for(var d=[],g=0;g<l.rows.length;g++)d.push(l.rows.item(g).key);i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function er(e){return new p(function(r,t){e.transaction(function(i){i.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'`,[],function(a,o){for(var u=[],f=0;f<o.rows.length;f++)u.push(o.rows.item(f).name);r({db:e,storeNames:u});},function(a,o){t(o);});},function(i){t(i);});})}function tr(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;return e.name?a=new p(function(o){var u;e.name===t.name?u=i._dbInfo.db:u=openDatabase(e.name,``,``,0),e.storeName?o({db:u,storeNames:[e.storeName]}):o(er(u));}).then(function(o){return new p(function(u,f){o.db.transaction(function(l){function d(x){return new p(function(N,M){l.executeSql(`DROP TABLE IF EXISTS `+x,[],function(){N();},function(P,H){M(H);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){u();}).catch(function(x){f(x);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var rr={_driver:`webSQLStorage`,_initStorage:Yt,_support:Wt(),iterate:zt,getItem:jt,setItem:qt,removeItem:Kt,clear:Xt,length:Jt,key:Qt,keys:Zt,dropInstance:tr};function nr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function nt(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function or(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function ir(){return !or()||localStorage.length>0}function ar(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=nt(e,r._defaultConfig),ir()?(r._dbInfo=t,t.serializer=xe,p.resolve()):p.reject()}function sr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var o=localStorage.key(a);o.indexOf(i)===0&&localStorage.removeItem(o);}});return _(t,e),t}function ur(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo,o=localStorage.getItem(a.keyPrefix+e);return o&&(o=a.serializer.deserialize(o)),o});return _(i,r),i}function cr(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,u=o.length,f=localStorage.length,l=1,d=0;d<f;d++){var g=localStorage.key(d);if(g.indexOf(o)===0){var E=localStorage.getItem(g);if(E&&(E=a.serializer.deserialize(E)),E=e(E,g.substring(u),l++),E!==void 0)return E}}});return _(i,r),i}function fr(e,r){var t=this,i=t.ready().then(function(){var a=t._dbInfo,o;try{o=localStorage.key(e);}catch{o=null;}return o&&(o=o.substring(a.keyPrefix.length)),o});return _(i,r),i}function lr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],u=0;u<a;u++){var f=localStorage.key(u);f.indexOf(i.keyPrefix)===0&&o.push(f.substring(i.keyPrefix.length));}return o});return _(t,e),t}function dr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function mr(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e);});return _(i,r),i}function gr(e,r,t){var i=this;e=O(e);var a=i.ready().then(function(){r===void 0&&(r=null);var o=r;return new p(function(u,f){var l=i._dbInfo;l.serializer.serialize(r,function(d,g){if(g)f(g);else try{localStorage.setItem(l.keyPrefix+e,d),u(o);}catch(E){(E.name===`QuotaExceededError`||E.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&f(E),f(E);}});})});return _(a,t),a}function pr(e,r){if(r=j.apply(this,arguments),e=typeof e!=`function`&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName;}var i=this,a;return e.name?a=new p(function(o){e.storeName?o(nt(e,i._defaultConfig)):o(e.name+`/`);}).then(function(o){for(var u=localStorage.length-1;u>=0;u--){var f=localStorage.key(u);f.indexOf(o)===0&&localStorage.removeItem(f);}}):a=p.reject(`Invalid arguments`),_(a,r),a}var hr={_driver:`localStorageWrapper`,_initStorage:ar,_support:nr(),iterate:cr,getItem:ur,setItem:gr,removeItem:mr,clear:sr,length:dr,key:fr,keys:lr,dropInstance:pr},vr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},yr=function(r,t){for(var i=r.length,a=0;a<i;){if(vr(r[a],t))return true;a++;}return false},ot=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},se={},it={},ne={INDEXEDDB:kt,WEBSQL:rr,LOCALSTORAGE:hr},Er=[ne.INDEXEDDB._driver,ne.WEBSQL._driver,ne.LOCALSTORAGE._driver],me=[`dropInstance`],Ne=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(me),_r={description:``,driver:Er.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function br(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})};}function Le(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(ot(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t]);}return arguments[0]}v.exports=new((function(){function e(r){R(this,e);for(var t in ne)if(ne.hasOwnProperty(t)){var i=ne[t],a=i._driver;this[t]=a,se[a]||this.defineDriver(i);}this._defaultConfig=Le({},_r),this._config=Le({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){});}return e.prototype.config=function(t){if((typeof t>`u`?`undefined`:w(t))===`object`){if(this._ready)return new Error(`Can't call config() after localforage has been used.`);for(var i in t){if(i===`storeName`&&(t[i]=t[i].replace(/\W/g,`_`)),i===`version`&&typeof t[i]!=`number`)return new Error(`Database version must be a number.`);this._config[i]=t[i];}return `driver`in t&&t.driver?this.setDriver(this._config.driver):true}else return typeof t==`string`?this._config[t]:this._config},e.prototype.defineDriver=function(t,i,a){var o=new p(function(u,f){try{var l=t._driver,d=new Error(`Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver`);if(!t._driver){f(d);return}for(var g=Ne.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var x=g[E];if((!yr(me,x)||t[x])&&typeof t[x]!=`function`){f(d);return}}var M=function(){for(var ue=function(Sr){return function(){var Dr=new Error(`Method `+Sr+` is not implemented by the current driver`),at=p.reject(Dr);return _(at,arguments[arguments.length-1]),at}},Oe=0,Ir=me.length;Oe<Ir;Oe++){var Pe=me[Oe];t[Pe]||(t[Pe]=ue(Pe));}};M();var P=function(ue){se[l]&&console.info(`Redefining LocalForage driver: `+l),se[l]=t,it[l]=ue,u();};`_support`in t?t._support&&typeof t._support==`function`?t._support().then(P,f):P(!!t._support):P(!0);}catch(H){f(H);}});return C(o,i,a),o},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(t,i,a){var o=se[t]?p.resolve(se[t]):p.reject(new Error(`Driver not found.`));return C(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(xe);return C(i,t),i},e.prototype.ready=function(t){var i=this,a=i._driverSet.then(function(){return i._ready===null&&(i._ready=i._initDriver()),i._ready});return C(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;ot(t)||(t=[t]);var u=this._getSupportedDrivers(t);function f(){o._config.driver=o.driver();}function l(E){return o._extend(E),f(),o._ready=o._initStorage(o._config),o._ready}function d(E){return function(){var S=0;function x(){for(;S<E.length;){var N=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(N).then(l).catch(x)}f();var M=new Error(`No available storage method found.`);return o._driverSet=p.reject(M),o._driverSet}return x()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=u[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(u);})}).catch(function(){f();var E=new Error(`No available storage method found.`);return o._driverSet=p.reject(E),o._driverSet}),C(this._driverSet,i,a),this._driverSet},e.prototype.supports=function(t){return !!it[t]},e.prototype._extend=function(t){Le(this,t);},e.prototype._getSupportedDrivers=function(t){for(var i=[],a=0,o=t.length;a<o;a++){var u=t[a];this.supports(u)&&i.push(u);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=Ne.length;t<i;t++)br(this,Ne[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var Et=v((yt,_e)=>{(function(s){var n={};n.VERSION=`1.6.1`;var h,c={},v=function(m,T){return function(){return T.apply(m,arguments)}},I=function(){var m=arguments,T=m[0],V,p;for(p=1;p<m.length;p++)for(V in m[p])!(V in T)&&m[p].hasOwnProperty(V)&&(T[V]=m[p][V]);return T},w=function(m,T){return {value:m,name:T}};n.TRACE=w(1,`TRACE`),n.DEBUG=w(2,`DEBUG`),n.INFO=w(3,`INFO`),n.TIME=w(4,`TIME`),n.WARN=w(5,`WARN`),n.ERROR=w(8,`ERROR`),n.OFF=w(99,`OFF`);var R=function(m){this.context=m,this.setLevel(m.filterLevel),this.log=this.info;};R.prototype={setLevel:function(m){m&&`value`in m&&(this.context.filterLevel=m);},getLevel:function(){return this.context.filterLevel},enabledFor:function(m){var T=this.context.filterLevel;return m.value>=T.value},trace:function(){this.invoke(n.TRACE,arguments);},debug:function(){this.invoke(n.DEBUG,arguments);},info:function(){this.invoke(n.INFO,arguments);},warn:function(){this.invoke(n.WARN,arguments);},error:function(){this.invoke(n.ERROR,arguments);},time:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`start`]);},timeEnd:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`end`]);},invoke:function(m,T){h&&this.enabledFor(m)&&h(T,I({level:m},this.context));}};var b=new R({filterLevel:n.OFF});((function(){var m=n;m.enabledFor=v(b,b.enabledFor),m.trace=v(b,b.trace),m.debug=v(b,b.debug),m.time=v(b,b.time),m.timeEnd=v(b,b.timeEnd),m.info=v(b,b.info),m.warn=v(b,b.warn),m.error=v(b,b.error),m.log=m.info;}))(),n.setHandler=function(m){h=m;},n.setLevel=function(m){b.setLevel(m);for(var T in c)c.hasOwnProperty(T)&&c[T].setLevel(m);},n.getLevel=function(){return b.getLevel()},n.get=function(m){return c[m]||(c[m]=new R(I({name:m},b.context)))},n.createDefaultHandler=function(m){m=m||{},m.formatter=m.formatter||function(_,C){C.name&&_.unshift(`[`+C.name+`]`);};var T={},V=function(p,_){Function.prototype.apply.call(p,console,_);};return typeof console>`u`?function(){}:function(p,_){p=Array.prototype.slice.call(p);var C=console.log,O;_.level===n.TIME?(O=(_.name?`[`+_.name+`] `:``)+p[0],p[1]===`start`?console.time?console.time(O):T[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):V(C,[O+`: `+(new Date().getTime()-T[O])+`ms`])):(_.level===n.WARN&&console.warn?C=console.warn:_.level===n.ERROR&&console.error?C=console.error:_.level===n.INFO&&console.info?C=console.info:_.level===n.DEBUG&&console.debug?C=console.debug:_.level===n.TRACE&&console.trace&&(C=console.trace),m.formatter(p,_),V(C,p));}},n.useDefaults=function(m){n.setLevel(m&&m.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(m));},n.setDefaults=n.useDefaults,typeof define==`function`&&define.amd?define(n):typeof _e<`u`&&_e.exports?_e.exports=n:(n._prevLogger=s.Logger,n.noConflict=function(){return s.Logger=n._prevLogger,n},s.Logger=n);})(yt);});var Ve=`13.1.13`;var Cr=Ve.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),Hr=`WEB`,ft=`CooeeSDK`,Q=Ve,Yr=parseInt(Cr,10);var jr=[`collection`,`product`,`cart`],zr=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],qr=[`View Item`,`View Cart`,`View Collection`],Kr=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],Xr=`https://cdn.jsdelivr.net/npm/swiper@11`;function lt(s){if(s<0)return `${s}ms`;let n=new Date(Date.UTC(0,0,0,0,0,0,s)),h=[];return n.getUTCMinutes()&&h.push(n.getUTCMinutes()+`m`),n.getUTCSeconds()&&h.push(n.getUTCSeconds()+`s`),n.getUTCMilliseconds()&&h.push(n.getUTCMilliseconds()+`ms`),h.length||h.push(`0ms`),h.join(` `)}function Me(){return window.CooeeSDK.runtimeData}function en(){return lt(Date.now()-Me().sdkLoadTime.getTime())}var Fe=x(mt());function ge(s){return Fe.default.createInstance({name:`lc`,storeName:s,driver:Fe.default.LOCALSTORAGE})}var oe=class{static storage;static async get(n,h){return await this.storage?.getItem(n)??h}static set(n,h){return this.storage?.setItem(n,h)}static remove(n){return this.storage?.removeItem(n)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var fe=class extends oe{static storeName=`usr`;static{this.storage=ge(this.storeName);}};var gt=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Q}/dist`,te={apiURL:`https://api.sdk.letscooee.com`,debug:false,mode:`production`,baseURL:gt,styleURL:`${gt}/styles.min.css`};var pe=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(n){return typeof n==`object`&&!Array.isArray(n)&&n!==null}static parseToAny(n){try{return JSON.parse(n.toString())}catch{}return n.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(n.toString()):n}static async sleep(n){return new Promise(h=>setTimeout(h,n))}static hasKeys(n){return n?Object.keys(n).length>=1:false}static convertObjectToArray(n,h){return h.reduce((c,v)=>(n.hasOwnProperty(v)&&n[v]!=null&&c.push({[v]:n[v]}),c),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((h,c)=>(n[c]!==null&&n[c]!==void 0&&(h[c]=n[c]),h),{})}static stringify(n){return JSON.stringify(n,function(h,c){return c===void 0?null:c})}};var he=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;widgetCustomisation;currency;static get(){return window.CooeeSDK.config}update(n){return n??={},this.gaEnabled=n.gaEnabled,this.gaMeasurementID=n.gaMeasurementID,this.pixelPush=n.pixelPush,this.website=n.website??{},this.currencyCount=n.currencyCount??0,this.money=n.money,this.currency=n.currency,this.storefrontToken=n.storefrontToken,this.skipItemAttribute=n.skipItemAttribute,this.widgetCustomisation=n.widgetCustomisation,this}};var ve=class extends oe{static storeName=`ses`;static{this.storage=ge(this.storeName);}};var ye=class{static format(n,h){return h.replace(/{{\s*(\w+)\s*}}/,(v,I)=>{switch(I){case `amount`:return this.formatWithDelimiters(n,2);case `amount_no_decimals`:return this.formatWithDelimiters(n,0);case `amount_with_comma_separator`:return this.formatWithDelimiters(n,2,`.`,`,`);case `amount_no_decimals_with_comma_separator`:return this.formatWithDelimiters(n,0,`.`,`,`);case `amount_with_apostrophe_separator`:return this.formatWithDelimiters(n,2,`'`,`.`);case `amount_no_decimals_with_space_separator`:return this.formatWithDelimiters(n,0,` `);case `amount_with_space_separator`:return this.formatWithDelimiters(n,2,` `,`,`);case `amount_with_period_and_space_separator`:return this.formatWithDelimiters(n,2,` `,`.`);default:return v}})}static formatWithDelimiters(n,h=2,c=`,`,v=`.`){if(isNaN(n)||n==null)return `0`;let w=(n/100).toFixed(h).split(`.`);return w[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1`+c)+(w[1]?v+w[1]:``)}};function Dn(s){try{return new URL(s)}catch{return}}function Rn(s){return !s||s===`null`||s===`undefined`}function Cn(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function An(s,n,h){return {[s]:Ar(n,h),[s+`_wo_currency`]:n}}function Ar(s,n){if(s==0&&n)return `Free`;let h=Me(),c=he.get(),v=h.shopCurrencyCode||c.currency,I=h.currencyCode;I||Y.warn(`Currency code is not set in RuntimeData`);let w=c.money?.format??h.moneyFormat,R;if(w&&v===I)R=ye.format(s*100,w);else {let b;try{b=new Intl.NumberFormat(pt(),{style:`currency`,currency:I||v,minimumFractionDigits:0,maximumFractionDigits:2});}catch(m){return Ue(m,`format-currency`,{extra:{currentCurrency:I,shopCurrency:v}}),``}R=b.format(s),R=R.replace(`₹`,`Rs. `),c.money?.showCurrency&&I!==`INR`&&(R=R.concat(` ${I}`));}return R}function xn(s){let n=pt();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return Ue(h,`format-number`,{extra:{lang:n,value:s}}),s.toString()}}function pt(){let s=`en`;return typeof navigator<`u`&&(navigator.languages!==void 0&&navigator.languages.length>0?s=navigator.languages[0]:navigator.language&&(s=navigator.language)),s=s.split(`;`)[0],s=s.split(`-`)[0],s||`en`}var Ee;function ht(){if(Ee)return Ee;try{return Ee=Intl.DateTimeFormat().resolvedOptions().timeZone,Ee}catch{return ``}}function vt(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function Nn(s){let n=document.createElement(`span`);n.id=`snackbar`,n.innerText=s,document.body.appendChild(n),n.className=`show`,setTimeout(()=>{n.classList.remove(`show`),document.body.removeChild(n);},5e3);}async function xr(s,n=7,h=document){let c=1,v=document.querySelectorAll(`nonexistent-tag`);for(;c<=n;){let I=Math.min(50*2**c,1e3);if(c>1&&await pe.sleep(I),v=h.querySelectorAll(s),v.length)return Y.verbose(`Attempt ${c}: ${v.length} elements found with ${s}`),v;Y.verbose(`Attempt ${c}: Elements not found with ${s}. Will retry after ${I}ms.`),c++;}return Y.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${s}.`),v}async function Ln(s,n=10,h=document){return (await xr(s,n,h)).item(0)}async function Nr(s){let[n,h,c]=await Promise.all([fe.get(`did`),ve.get(`id`,``),fe.get(`sessionNumber`,1)]),v={letscooee_did:n,letscooee_sid:h,letscooee_sn:`${c}`,__letscooee_time:new Date().toLocaleString()};return s&&(v.__letscooee_via=s),v}async function On(s){let n=await Nr(s);return Object.entries(n).map(([h,c])=>({key:h,value:c.toString()}))}function Pn(s,n,h,c=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:c,value:h});}function Vn(s){if(s%100>=11&&s%100<=13)return s+`th`;switch(s%10){case 1:return s+`st`;case 2:return s+`nd`;case 3:return s+`rd`;default:return s+`th`}}function Mn(s,n){return !n?s:n+s}var W=x(Et());var Y=class{static debuggerEl;static infoLogs=[];static log(...n){W.default.info(...n);}static verbose(...n){W.default.debug(...n);}static error(...n){W.default.error(...n);}static warn(...n){W.default.warn(...n);}static info(...n){W.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W.default.trace(...n);}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector(`cooee-debugger`),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]));}};function Wn(s=ft){W.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q}):`);}}),Lr()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W.default.setLevel(W.default[localStorage.cooeeLogLevel]):W.default.setLevel(W.default.OFF);}function Lr(){let s=_t();return s===`1`||s===`on`}function _t(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function $n(){let s=[`display: inline-block;`,`font-size: 14px;`,`background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);`,`color: white;`,`padding: 4px;`,`border-radius: 4px;`].join(` `),n=`
|
|
3
|
+
var mt=v((dt,Be)=>{(function(s){if(typeof dt==`object`&&typeof Be<`u`)Be.exports=s();else if(typeof define==`function`&&define.amd)define([],s);else {var n;typeof window<`u`?n=window:typeof global<`u`?n=global:typeof self<`u`?n=self:n=this,n.localforage=s();}})(function(){return (function c(v,I,w){function R(T,V){if(!I[T]){if(!v[T]){var p=typeof t==`function`&&t;if(!V&&p)return p(T,true);if(b)return b(T,true);var _=new Error(`Cannot find module '`+T+`'`);throw _.code=`MODULE_NOT_FOUND`,_}var C=I[T]={exports:{}};v[T][0].call(C.exports,function(O){var j=v[T][1][O];return R(j||O)},C,C.exports,c,v,I,w);}return I[T].exports}for(var b=typeof t==`function`&&t,m=0;m<w.length;m++)R(w[m]);return R})({1:[function(c,v,I){(function(w){var R=w.MutationObserver||w.WebKitMutationObserver,b;if(R){var m=0,T=new R(O),V=w.document.createTextNode(``);T.observe(V,{characterData:true}),b=function(){V.data=m=++m%2;};}else if(!w.setImmediate&&typeof w.MessageChannel<`u`){var p=new w.MessageChannel;p.port1.onmessage=O,b=function(){p.port2.postMessage(0);};}else `document`in w&&`onreadystatechange`in w.document.createElement(`script`)?b=function(){var B=w.document.createElement(`script`);B.onreadystatechange=function(){O(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null;},w.document.documentElement.appendChild(B);}:b=function(){setTimeout(O,0);};var _,C=[];function O(){_=true;for(var B,z,F=C.length;F;){for(z=C,C=[],B=-1;++B<F;)z[B]();F=C.length;}_=false;}v.exports=j;function j(B){C.push(B)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(c,v,I){var w=c(1);function R(){}var b={},m=[`REJECTED`],T=[`FULFILLED`],V=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=V,this.queue=[],this.outcome=void 0,y!==R&&j(this,y);}p.prototype.catch=function(y){return this.then(null,y)},p.prototype.then=function(y,A){if(typeof y!=`function`&&this.state===T||typeof A!=`function`&&this.state===m)return this;var D=new this.constructor(R);if(this.state!==V)C(D,this.state===T?y:A,this.outcome);else this.queue.push(new _(D,y,A));return D};function _(y,A,D){this.promise=y,typeof A==`function`&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof D==`function`&&(this.onRejected=D,this.callRejected=this.otherCallRejected);}_.prototype.callFulfilled=function(y){b.resolve(this.promise,y);},_.prototype.otherCallFulfilled=function(y){C(this.promise,this.onFulfilled,y);},_.prototype.callRejected=function(y){b.reject(this.promise,y);},_.prototype.otherCallRejected=function(y){C(this.promise,this.onRejected,y);};function C(y,A,D){w(function(){var L;try{L=A(D);}catch(U){return b.reject(y,U)}L===y?b.reject(y,new TypeError(`Cannot resolve promise with itself`)):b.resolve(y,L);});}b.resolve=function(y,A){var D=B(O,A);if(D.status===`error`)return b.reject(y,D.value);var L=D.value;if(L)j(y,L);else {y.state=T,y.outcome=A;for(var U=-1,k=y.queue.length;++U<k;)y.queue[U].callFulfilled(A);}return y},b.reject=function(y,A){y.state=m,y.outcome=A;for(var D=-1,L=y.queue.length;++D<L;)y.queue[D].callRejected(A);return y};function O(y){var A=y&&y.then;if(y&&(typeof y==`object`||typeof y==`function`)&&typeof A==`function`)return function(){A.apply(y,arguments);}}function j(y,A){var D=false;function L(G){D||(D=true,b.reject(y,G));}function U(G){D||(D=true,b.resolve(y,G));}function k(){A(U,L);}var $=B(k);$.status===`error`&&L($.value);}function B(y,A){var D={};try{D.value=y(A),D.status=`success`;}catch(L){D.status=`error`,D.value=L;}return D}p.resolve=z;function z(y){return y instanceof this?y:b.resolve(new this(R),y)}p.reject=F;function F(y){var A=new this(R);return b.reject(A,y)}p.all=Ie;function Ie(y){var A=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var U=new Array(D),k=0,$=-1,G=new this(R);++$<D;)q(y[$],$);return G;function q(ae,le){A.resolve(ae).then(Se,function(re){L||(L=true,b.reject(G,re));});function Se(re){U[le]=re,++k===D&&!L&&(L=true,b.resolve(G,U));}}}p.race=Z;function Z(y){var A=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var U=-1,k=new this(R);++U<D;)$(y[U]);return k;function $(G){A.resolve(G).then(function(q){L||(L=true,b.resolve(k,q));},function(q){L||(L=true,b.reject(k,q));});}}},{1:1}],3:[function(c,v,I){(function(w){typeof w.Promise!=`function`&&(w.Promise=c(2));}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{2:2}],4:[function(c,v,I){var w=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e};function R(e,r){if(!(e instanceof r))throw new TypeError(`Cannot call a class as a function`)}function b(){try{if(typeof indexedDB<`u`)return indexedDB;if(typeof webkitIndexedDB<`u`)return webkitIndexedDB;if(typeof mozIndexedDB<`u`)return mozIndexedDB;if(typeof OIndexedDB<`u`)return OIndexedDB;if(typeof msIndexedDB<`u`)return msIndexedDB}catch{return}}var m=b();function T(){try{if(!m||!m.open)return !1;var e=typeof openDatabase<`u`&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch==`function`&&fetch.toString().indexOf(`[native code`)!==-1;return (!e||r)&&typeof indexedDB<`u`&&typeof IDBKeyRange<`u`}catch{return false}}function V(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(o){if(o.name!==`TypeError`)throw o;for(var i=new(typeof BlobBuilder<`u`?BlobBuilder:typeof MSBlobBuilder<`u`?MSBlobBuilder:typeof MozBlobBuilder<`u`?MozBlobBuilder:WebKitBlobBuilder),a=0;a<e.length;a+=1)i.append(e[a]);return i.getBlob(r.type)}}typeof Promise>`u`&&c(3);var p=Promise;function _(e,r){r&&e.then(function(t){r(null,t);},function(t){r(t);});}function C(e,r,t){typeof r==`function`&&e.then(r),typeof t==`function`&&e.catch(t);}function O(e){return typeof e!=`string`&&(console.warn(e+` used as a key, but it is not a string.`),e=String(e)),e}function j(){if(arguments.length&&typeof arguments[arguments.length-1]==`function`)return arguments[arguments.length-1]}var B=`local-forage-detect-blob-support`,z=void 0,F={},Ie=Object.prototype.toString,Z=`readonly`,y=`readwrite`;function A(e){for(var r=e.length,t=new ArrayBuffer(r),i=new Uint8Array(t),a=0;a<r;a++)i[a]=e.charCodeAt(a);return t}function D(e){return new p(function(r){var t=e.transaction(B,y),i=V([``]);t.objectStore(B).put(i,`key`),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(false);},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/);r(navigator.userAgent.match(/Edge\//)||!a||parseInt(a[1],10)>=43);};}).catch(function(){return false})}function L(e){return typeof z==`boolean`?p.resolve(z):D(e).then(function(r){return z=r,z})}function U(e){var r=F[e.name],t={};t.promise=new p(function(i,a){t.resolve=i,t.reject=a;}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise;}function k(e){var t=F[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function $(e,r){var i=F[e.name].deferredOperations.pop();if(i)return i.reject(r),i.promise}function G(e,r){return new p(function(t,i){if(F[e.name]=F[e.name]||We(),e.db)if(r)U(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var o=m.open.apply(m,a);r&&(o.onupgradeneeded=function(u){var f=o.result;try{f.createObjectStore(e.storeName),u.oldVersion<=1&&f.createObjectStore(B);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+u.oldVersion+` to version `+u.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(u){u.preventDefault(),i(o.error);},o.onsuccess=function(){var u=o.result;u.onversionchange=function(f){f.target.close();},t(u),k(e);};})}function q(e){return G(e,false)}function ae(e){return G(e,true)}function le(e,r){if(!e.db)return true;var t=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,a=e.version>e.db.version;if(i&&(e.version!==r&&console.warn(`The database "`+e.name+`" can't be downgraded from version `+e.db.version+` to version `+e.version+`.`),e.version=e.db.version),a||t){if(t){var o=e.db.version+1;o>e.version&&(e.version=o);}return true}return false}function Se(e){return new p(function(r,t){var i=new FileReader;i.onerror=t,i.onloadend=function(a){r({__local_forage_encoded_blob:true,data:btoa(a.target.result||``),type:e.type});},i.readAsBinaryString(e);})}function re(e){return V([A(atob(e.data))],{type:e.type})}function ke(e){return e&&e.__local_forage_encoded_blob}function Ct(e){var r=this,t=r._initReady().then(function(){var i=F[r._dbInfo.name];if(i&&i.dbReady)return i.dbReady});return C(t,e,e),t}function At(e){U(e);for(var r=F[e.name],t=r.forages,i=0;i<t.length;i++){var a=t[i];a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null);}return e.db=null,q(e).then(function(o){return e.db=o,le(e)?ae(e):o}).then(function(o){e.db=r.db=o;for(var u=0;u<t.length;u++)t[u]._dbInfo.db=o;}).catch(function(o){throw $(e,o),o})}function K(e,r,t,i){i===void 0&&(i=1);try{t(null,e.db.transaction(e.storeName,r));}catch(o){if(i>0&&(!e.db||o.name===`InvalidStateError`||o.name===`NotFoundError`))return p.resolve().then(function(){if(!e.db||o.name===`NotFoundError`&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ae(e)}).then(function(){return At(e).then(function(){K(e,r,t,i-1);})}).catch(t);t(o);}}function We(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function xt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=e[i];var a=F[t.name];a||(a=We(),F[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=Ct);var o=[];function u(){return p.resolve()}for(var f=0;f<a.forages.length;f++){var l=a.forages[f];l!==r&&o.push(l._initReady().catch(u));}var d=a.forages.slice(0);return p.all(o).then(function(){return t.db=a.db,q(t)}).then(function(g){return t.db=g,le(t,r._defaultConfig.version)?ae(t):g}).then(function(g){t.db=a.db=g,r._dbInfo=t;for(var E=0;E<d.length;E++){var S=d[E];S!==r&&(S._dbInfo.db=t.db,S._dbInfo.version=t.version);}})}function Nt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,Z,function(u,f){if(u)return o(u);try{var d=f.objectStore(t._dbInfo.storeName).get(e);d.onsuccess=function(){var g=d.result;g===void 0&&(g=null),ke(g)&&(g=re(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Lt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,Z,function(u,f){if(u)return o(u);try{var d=f.objectStore(t._dbInfo.storeName).openCursor(),g=1;d.onsuccess=function(){var E=d.result;if(E){var S=E.value;ke(S)&&(S=re(S));var x=e(S,E.key,g++);x!==void 0?a(x):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ot(e,r,t){var i=this;e=O(e);var a=new p(function(o,u){var f;i.ready().then(function(){return f=i._dbInfo,Ie.call(r)===`[object Blob]`?L(f.db).then(function(l){return l?r:Se(r)}):r}).then(function(l){K(i._dbInfo,y,function(d,g){if(d)return u(d);try{var E=g.objectStore(i._dbInfo.storeName);l===null&&(l=void 0);var S=E.put(l,e);g.oncomplete=function(){l===void 0&&(l=null),o(l);},g.onabort=g.onerror=function(){u(S.error?S.error:S.transaction.error);};}catch(x){u(x);}});}).catch(u);});return _(a,t),a}function Pt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,y,function(u,f){if(u)return o(u);try{var d=f.objectStore(t._dbInfo.storeName).delete(e);f.oncomplete=function(){a();},f.onerror=function(){o(d.error);},f.onabort=function(){o(d.error?d.error:d.transaction.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,y,function(o,u){if(o)return a(o);try{var l=u.objectStore(r._dbInfo.storeName).clear();u.oncomplete=function(){i();},u.onabort=u.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Mt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,u){if(o)return a(o);try{var l=u.objectStore(r._dbInfo.storeName).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Bt(e,r){var t=this,i=new p(function(a,o){if(e<0){a(null);return}t.ready().then(function(){K(t._dbInfo,Z,function(u,f){if(u)return o(u);try{var l=f.objectStore(t._dbInfo.storeName),d=!1,g=l.openKeyCursor();g.onsuccess=function(){var E=g.result;if(!E){a(null);return}e===0||d?a(E.key):(d=!0,E.advance(e));},g.onerror=function(){o(g.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ft(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,u){if(o)return a(o);try{var l=u.objectStore(r._dbInfo.storeName).openKeyCursor(),d=[];l.onsuccess=function(){var g=l.result;if(!g){i(d);return}d.push(g.key),g.continue();},l.onerror=function(){a(l.error);};}catch(g){a(g);}});}).catch(a);});return _(t,e),t}function Ut(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;if(!e.name)a=p.reject(`Invalid arguments`);else {var u=e.name===t.name&&i._dbInfo.db?p.resolve(i._dbInfo.db):q(e).then(function(f){var l=F[e.name],d=l.forages;l.db=f;for(var g=0;g<d.length;g++)d[g]._dbInfo.db=f;return f});e.storeName?a=u.then(function(f){if(f.objectStoreNames.contains(e.storeName)){var l=f.version+1;U(e);var d=F[e.name],g=d.forages;f.close();for(var E=0;E<g.length;E++){var S=g[E];S._dbInfo.db=null,S._dbInfo.version=l;}return new p(function(N,M){var P=m.open(e.name,l);P.onerror=function(H){P.result.close(),M(H);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var H=P.result;H.close(),N(H);};}).then(function(N){d.db=N;for(var M=0;M<g.length;M++){var P=g[M];P._dbInfo.db=N,k(P._dbInfo);}}).catch(function(N){throw ($(e,N)||p.resolve()).catch(function(){}),N})}}):a=u.then(function(f){U(e);var l=F[e.name],d=l.forages;f.close();for(var g=0;g<d.length;g++){var E=d[g];E._dbInfo.db=null;}return new p(function(x,N){var M=m.deleteDatabase(e.name);M.onerror=function(){var P=M.result;P&&P.close(),N(M.error);},M.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},M.onsuccess=function(){var P=M.result;P&&P.close(),x(P);};}).then(function(x){l.db=x;for(var N=0;N<d.length;N++){var M=d[N];k(M._dbInfo);}}).catch(function(x){throw ($(e,x)||p.resolve()).catch(function(){}),x})});}return _(a,r),a}var kt={_driver:`asyncStorage`,_initStorage:xt,_support:T(),iterate:Lt,getItem:Nt,setItem:Ot,removeItem:Pt,clear:Vt,length:Mt,key:Bt,keys:Ft,dropInstance:Ut};function Wt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,$t=`~~local_forage_type~`,$e=/^~~local_forage_type~([^~]+)~/,de=`__lfsc__:`,De=de.length,Re=`arbf`,Ce=`blob`,Ge=`si08`,He=`ui08`,Ye=`uic8`,je=`si16`,ze=`si32`,qe=`ur16`,Ke=`ui32`,Xe=`fl32`,Je=`fl64`,Qe=De+Re.length,Ze=Object.prototype.toString;function et(e){var r=e.length*.75,t=e.length,i,a=0,o,u,f,l;e[e.length-1]===`=`&&(r--,e[e.length-2]===`=`&&r--);var d=new ArrayBuffer(r),g=new Uint8Array(d);for(i=0;i<t;i+=4)o=X.indexOf(e[i]),u=X.indexOf(e[i+1]),f=X.indexOf(e[i+2]),l=X.indexOf(e[i+3]),g[a++]=o<<2|u>>4,g[a++]=(u&15)<<4|f>>2,g[a++]=(f&3)<<6|l&63;return d}function Ae(e){var r=new Uint8Array(e),t=``,i;for(i=0;i<r.length;i+=3)t+=X[r[i]>>2],t+=X[(r[i]&3)<<4|r[i+1]>>4],t+=X[(r[i+1]&15)<<2|r[i+2]>>6],t+=X[r[i+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+`=`:r.length%3===1&&(t=t.substring(0,t.length-2)+`==`),t}function Gt(e,r){var t=``;if(e&&(t=Ze.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&Ze.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=de;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=Ge:t===`[object Uint8Array]`?a+=He:t===`[object Uint8ClampedArray]`?a+=Ye:t===`[object Int16Array]`?a+=je:t===`[object Uint16Array]`?a+=qe:t===`[object Int32Array]`?a+=ze:t===`[object Uint32Array]`?a+=Ke:t===`[object Float32Array]`?a+=Xe:t===`[object Float64Array]`?a+=Je:r(new Error(`Failed to get type for BinaryArray`))),r(a+Ae(i));}else if(t===`[object Blob]`){var o=new FileReader;o.onload=function(){var u=$t+e.type+`~`+Ae(this.result);r(de+Ce+u);},o.readAsArrayBuffer(e);}else try{r(JSON.stringify(e));}catch(u){console.error(`Couldn't convert value into a JSON string: `,e),r(null,u);}}function Ht(e){if(e.substring(0,De)!==de)return JSON.parse(e);var r=e.substring(Qe),t=e.substring(De,Qe),i;if(t===Ce&&$e.test(r)){var a=r.match($e);i=a[1],r=r.substring(a[0].length);}var o=et(r);switch(t){case Re:return o;case Ce:return V([o],{type:i});case Ge:return new Int8Array(o);case He:return new Uint8Array(o);case Ye:return new Uint8ClampedArray(o);case je:return new Int16Array(o);case qe:return new Uint16Array(o);case ze:return new Int32Array(o);case Ke:return new Uint32Array(o);case Xe:return new Float32Array(o);case Je:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var xe={serialize:Gt,deserialize:Ht,stringToBuffer:et,bufferToString:Ae};function tt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Yt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=typeof e[i]!=`string`?e[i].toString():e[i];var a=new p(function(o,u){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return u(f)}t.db.transaction(function(f){tt(f,t,function(){r._dbInfo=t,o();},function(l,d){u(d);});},u);});return t.serializer=xe,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(u,f){f.code===f.SYNTAX_ERR?u.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):tt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(u,f);},o);}function jt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`SELECT * FROM `+u.storeName+` WHERE key = ? LIMIT 1`,[e],function(l,d){var g=d.rows.length?d.rows.item(0).value:null;g&&(g=u.serializer.deserialize(g)),a(g);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function zt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`SELECT * FROM `+u.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var x=g.item(S),N=x.value;if(N&&(N=u.serializer.deserialize(N)),N=e(N,x.key,S+1),N!==void 0){a(N);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function rt(e,r,t,i){var a=this;e=O(e);var o=new p(function(u,f){a.ready().then(function(){r===void 0&&(r=null);var l=r,d=a._dbInfo;d.serializer.serialize(r,function(g,E){E?f(E):d.db.transaction(function(S){J(S,d,`INSERT OR REPLACE INTO `+d.storeName+` (key, value) VALUES (?, ?)`,[e,g],function(){u(l);},function(x,N){f(N);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){u(rt.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function qt(e,r,t){return rt.apply(this,[e,r,t,1])}function Kt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`DELETE FROM `+u.storeName+` WHERE key = ?`,[e],function(){a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Xt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(u){J(u,o,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Jt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(u){J(u,o,`SELECT COUNT(key) as c FROM `+o.storeName,[],function(f,l){var d=l.rows.item(0).c;i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Qt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(f){J(f,u,`SELECT key FROM `+u.storeName+` WHERE id = ? LIMIT 1`,[e+1],function(l,d){a(d.rows.length?d.rows.item(0).key:null);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Zt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(u){J(u,o,`SELECT key FROM `+o.storeName,[],function(f,l){for(var d=[],g=0;g<l.rows.length;g++)d.push(l.rows.item(g).key);i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function er(e){return new p(function(r,t){e.transaction(function(i){i.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'`,[],function(a,o){for(var u=[],f=0;f<o.rows.length;f++)u.push(o.rows.item(f).name);r({db:e,storeNames:u});},function(a,o){t(o);});},function(i){t(i);});})}function tr(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;return e.name?a=new p(function(o){var u;e.name===t.name?u=i._dbInfo.db:u=openDatabase(e.name,``,``,0),e.storeName?o({db:u,storeNames:[e.storeName]}):o(er(u));}).then(function(o){return new p(function(u,f){o.db.transaction(function(l){function d(x){return new p(function(N,M){l.executeSql(`DROP TABLE IF EXISTS `+x,[],function(){N();},function(P,H){M(H);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){u();}).catch(function(x){f(x);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var rr={_driver:`webSQLStorage`,_initStorage:Yt,_support:Wt(),iterate:zt,getItem:jt,setItem:qt,removeItem:Kt,clear:Xt,length:Jt,key:Qt,keys:Zt,dropInstance:tr};function nr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function nt(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function or(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function ir(){return !or()||localStorage.length>0}function ar(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=nt(e,r._defaultConfig),ir()?(r._dbInfo=t,t.serializer=xe,p.resolve()):p.reject()}function sr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var o=localStorage.key(a);o.indexOf(i)===0&&localStorage.removeItem(o);}});return _(t,e),t}function ur(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo,o=localStorage.getItem(a.keyPrefix+e);return o&&(o=a.serializer.deserialize(o)),o});return _(i,r),i}function cr(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,u=o.length,f=localStorage.length,l=1,d=0;d<f;d++){var g=localStorage.key(d);if(g.indexOf(o)===0){var E=localStorage.getItem(g);if(E&&(E=a.serializer.deserialize(E)),E=e(E,g.substring(u),l++),E!==void 0)return E}}});return _(i,r),i}function fr(e,r){var t=this,i=t.ready().then(function(){var a=t._dbInfo,o;try{o=localStorage.key(e);}catch{o=null;}return o&&(o=o.substring(a.keyPrefix.length)),o});return _(i,r),i}function lr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],u=0;u<a;u++){var f=localStorage.key(u);f.indexOf(i.keyPrefix)===0&&o.push(f.substring(i.keyPrefix.length));}return o});return _(t,e),t}function dr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function mr(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e);});return _(i,r),i}function gr(e,r,t){var i=this;e=O(e);var a=i.ready().then(function(){r===void 0&&(r=null);var o=r;return new p(function(u,f){var l=i._dbInfo;l.serializer.serialize(r,function(d,g){if(g)f(g);else try{localStorage.setItem(l.keyPrefix+e,d),u(o);}catch(E){(E.name===`QuotaExceededError`||E.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&f(E),f(E);}});})});return _(a,t),a}function pr(e,r){if(r=j.apply(this,arguments),e=typeof e!=`function`&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName;}var i=this,a;return e.name?a=new p(function(o){e.storeName?o(nt(e,i._defaultConfig)):o(e.name+`/`);}).then(function(o){for(var u=localStorage.length-1;u>=0;u--){var f=localStorage.key(u);f.indexOf(o)===0&&localStorage.removeItem(f);}}):a=p.reject(`Invalid arguments`),_(a,r),a}var hr={_driver:`localStorageWrapper`,_initStorage:ar,_support:nr(),iterate:cr,getItem:ur,setItem:gr,removeItem:mr,clear:sr,length:dr,key:fr,keys:lr,dropInstance:pr},vr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},yr=function(r,t){for(var i=r.length,a=0;a<i;){if(vr(r[a],t))return true;a++;}return false},ot=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},se={},it={},ne={INDEXEDDB:kt,WEBSQL:rr,LOCALSTORAGE:hr},Er=[ne.INDEXEDDB._driver,ne.WEBSQL._driver,ne.LOCALSTORAGE._driver],me=[`dropInstance`],Ne=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(me),_r={description:``,driver:Er.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function br(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})};}function Le(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(ot(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t]);}return arguments[0]}v.exports=new((function(){function e(r){R(this,e);for(var t in ne)if(ne.hasOwnProperty(t)){var i=ne[t],a=i._driver;this[t]=a,se[a]||this.defineDriver(i);}this._defaultConfig=Le({},_r),this._config=Le({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){});}return e.prototype.config=function(t){if((typeof t>`u`?`undefined`:w(t))===`object`){if(this._ready)return new Error(`Can't call config() after localforage has been used.`);for(var i in t){if(i===`storeName`&&(t[i]=t[i].replace(/\W/g,`_`)),i===`version`&&typeof t[i]!=`number`)return new Error(`Database version must be a number.`);this._config[i]=t[i];}return `driver`in t&&t.driver?this.setDriver(this._config.driver):true}else return typeof t==`string`?this._config[t]:this._config},e.prototype.defineDriver=function(t,i,a){var o=new p(function(u,f){try{var l=t._driver,d=new Error(`Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver`);if(!t._driver){f(d);return}for(var g=Ne.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var x=g[E];if((!yr(me,x)||t[x])&&typeof t[x]!=`function`){f(d);return}}var M=function(){for(var ue=function(Sr){return function(){var Dr=new Error(`Method `+Sr+` is not implemented by the current driver`),at=p.reject(Dr);return _(at,arguments[arguments.length-1]),at}},Oe=0,Ir=me.length;Oe<Ir;Oe++){var Pe=me[Oe];t[Pe]||(t[Pe]=ue(Pe));}};M();var P=function(ue){se[l]&&console.info(`Redefining LocalForage driver: `+l),se[l]=t,it[l]=ue,u();};`_support`in t?t._support&&typeof t._support==`function`?t._support().then(P,f):P(!!t._support):P(!0);}catch(H){f(H);}});return C(o,i,a),o},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(t,i,a){var o=se[t]?p.resolve(se[t]):p.reject(new Error(`Driver not found.`));return C(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(xe);return C(i,t),i},e.prototype.ready=function(t){var i=this,a=i._driverSet.then(function(){return i._ready===null&&(i._ready=i._initDriver()),i._ready});return C(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;ot(t)||(t=[t]);var u=this._getSupportedDrivers(t);function f(){o._config.driver=o.driver();}function l(E){return o._extend(E),f(),o._ready=o._initStorage(o._config),o._ready}function d(E){return function(){var S=0;function x(){for(;S<E.length;){var N=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(N).then(l).catch(x)}f();var M=new Error(`No available storage method found.`);return o._driverSet=p.reject(M),o._driverSet}return x()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=u[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(u);})}).catch(function(){f();var E=new Error(`No available storage method found.`);return o._driverSet=p.reject(E),o._driverSet}),C(this._driverSet,i,a),this._driverSet},e.prototype.supports=function(t){return !!it[t]},e.prototype._extend=function(t){Le(this,t);},e.prototype._getSupportedDrivers=function(t){for(var i=[],a=0,o=t.length;a<o;a++){var u=t[a];this.supports(u)&&i.push(u);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=Ne.length;t<i;t++)br(this,Ne[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var Et=v((yt,_e)=>{(function(s){var n={};n.VERSION=`1.6.1`;var h,c={},v=function(m,T){return function(){return T.apply(m,arguments)}},I=function(){var m=arguments,T=m[0],V,p;for(p=1;p<m.length;p++)for(V in m[p])!(V in T)&&m[p].hasOwnProperty(V)&&(T[V]=m[p][V]);return T},w=function(m,T){return {value:m,name:T}};n.TRACE=w(1,`TRACE`),n.DEBUG=w(2,`DEBUG`),n.INFO=w(3,`INFO`),n.TIME=w(4,`TIME`),n.WARN=w(5,`WARN`),n.ERROR=w(8,`ERROR`),n.OFF=w(99,`OFF`);var R=function(m){this.context=m,this.setLevel(m.filterLevel),this.log=this.info;};R.prototype={setLevel:function(m){m&&`value`in m&&(this.context.filterLevel=m);},getLevel:function(){return this.context.filterLevel},enabledFor:function(m){var T=this.context.filterLevel;return m.value>=T.value},trace:function(){this.invoke(n.TRACE,arguments);},debug:function(){this.invoke(n.DEBUG,arguments);},info:function(){this.invoke(n.INFO,arguments);},warn:function(){this.invoke(n.WARN,arguments);},error:function(){this.invoke(n.ERROR,arguments);},time:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`start`]);},timeEnd:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`end`]);},invoke:function(m,T){h&&this.enabledFor(m)&&h(T,I({level:m},this.context));}};var b=new R({filterLevel:n.OFF});((function(){var m=n;m.enabledFor=v(b,b.enabledFor),m.trace=v(b,b.trace),m.debug=v(b,b.debug),m.time=v(b,b.time),m.timeEnd=v(b,b.timeEnd),m.info=v(b,b.info),m.warn=v(b,b.warn),m.error=v(b,b.error),m.log=m.info;}))(),n.setHandler=function(m){h=m;},n.setLevel=function(m){b.setLevel(m);for(var T in c)c.hasOwnProperty(T)&&c[T].setLevel(m);},n.getLevel=function(){return b.getLevel()},n.get=function(m){return c[m]||(c[m]=new R(I({name:m},b.context)))},n.createDefaultHandler=function(m){m=m||{},m.formatter=m.formatter||function(_,C){C.name&&_.unshift(`[`+C.name+`]`);};var T={},V=function(p,_){Function.prototype.apply.call(p,console,_);};return typeof console>`u`?function(){}:function(p,_){p=Array.prototype.slice.call(p);var C=console.log,O;_.level===n.TIME?(O=(_.name?`[`+_.name+`] `:``)+p[0],p[1]===`start`?console.time?console.time(O):T[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):V(C,[O+`: `+(new Date().getTime()-T[O])+`ms`])):(_.level===n.WARN&&console.warn?C=console.warn:_.level===n.ERROR&&console.error?C=console.error:_.level===n.INFO&&console.info?C=console.info:_.level===n.DEBUG&&console.debug?C=console.debug:_.level===n.TRACE&&console.trace&&(C=console.trace),m.formatter(p,_),V(C,p));}},n.useDefaults=function(m){n.setLevel(m&&m.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(m));},n.setDefaults=n.useDefaults,typeof define==`function`&&define.amd?define(n):typeof _e<`u`&&_e.exports?_e.exports=n:(n._prevLogger=s.Logger,n.noConflict=function(){return s.Logger=n._prevLogger,n},s.Logger=n);})(yt);});var Ve=`13.1.14`;var Cr=Ve.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),Hr=`WEB`,ft=`CooeeSDK`,Q=Ve,Yr=parseInt(Cr,10);var jr=[`collection`,`product`,`cart`],zr=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],qr=[`View Item`,`View Cart`,`View Collection`],Kr=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],Xr=`https://cdn.jsdelivr.net/npm/swiper@11`;function lt(s){if(s<0)return `${s}ms`;let n=new Date(Date.UTC(0,0,0,0,0,0,s)),h=[];return n.getUTCMinutes()&&h.push(n.getUTCMinutes()+`m`),n.getUTCSeconds()&&h.push(n.getUTCSeconds()+`s`),n.getUTCMilliseconds()&&h.push(n.getUTCMilliseconds()+`ms`),h.length||h.push(`0ms`),h.join(` `)}function Me(){return window.CooeeSDK.runtimeData}function en(){return lt(Date.now()-Me().sdkLoadTime.getTime())}var Fe=x(mt());function ge(s){return Fe.default.createInstance({name:`lc`,storeName:s,driver:Fe.default.LOCALSTORAGE})}var oe=class{static storage;static async get(n,h){return await this.storage?.getItem(n)??h}static set(n,h){return this.storage?.setItem(n,h)}static remove(n){return this.storage?.removeItem(n)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var fe=class extends oe{static storeName=`usr`;static{this.storage=ge(this.storeName);}};var gt=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Q}/dist`,te={apiURL:`https://api.sdk.letscooee.com`,debug:false,mode:`production`,baseURL:gt,styleURL:`${gt}/styles.min.css`};var pe=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(n){return typeof n==`object`&&!Array.isArray(n)&&n!==null}static parseToAny(n){try{return JSON.parse(n.toString())}catch{}return n.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(n.toString()):n}static async sleep(n){return new Promise(h=>setTimeout(h,n))}static hasKeys(n){return n?Object.keys(n).length>=1:false}static convertObjectToArray(n,h){return h.reduce((c,v)=>(n.hasOwnProperty(v)&&n[v]!=null&&c.push({[v]:n[v]}),c),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((h,c)=>(n[c]!==null&&n[c]!==void 0&&(h[c]=n[c]),h),{})}static stringify(n){return JSON.stringify(n,function(h,c){return c===void 0?null:c})}};var he=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;widgetCustomisation;currency;static get(){return window.CooeeSDK.config}update(n){return n??={},this.gaEnabled=n.gaEnabled,this.gaMeasurementID=n.gaMeasurementID,this.pixelPush=n.pixelPush,this.website=n.website??{},this.currencyCount=n.currencyCount??0,this.money=n.money,this.currency=n.currency,this.storefrontToken=n.storefrontToken,this.skipItemAttribute=n.skipItemAttribute,this.widgetCustomisation=n.widgetCustomisation,this}};var ve=class extends oe{static storeName=`ses`;static{this.storage=ge(this.storeName);}};var ye=class{static format(n,h){return h.replace(/{{\s*(\w+)\s*}}/,(v,I)=>{switch(I){case `amount`:return this.formatWithDelimiters(n,2);case `amount_no_decimals`:return this.formatWithDelimiters(n,0);case `amount_with_comma_separator`:return this.formatWithDelimiters(n,2,`.`,`,`);case `amount_no_decimals_with_comma_separator`:return this.formatWithDelimiters(n,0,`.`,`,`);case `amount_with_apostrophe_separator`:return this.formatWithDelimiters(n,2,`'`,`.`);case `amount_no_decimals_with_space_separator`:return this.formatWithDelimiters(n,0,` `);case `amount_with_space_separator`:return this.formatWithDelimiters(n,2,` `,`,`);case `amount_with_period_and_space_separator`:return this.formatWithDelimiters(n,2,` `,`.`);default:return v}})}static formatWithDelimiters(n,h=2,c=`,`,v=`.`){if(isNaN(n)||n==null)return `0`;let w=(n/100).toFixed(h).split(`.`);return w[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1`+c)+(w[1]?v+w[1]:``)}};function Dn(s){try{return new URL(s)}catch{return}}function Rn(s){return !s||s===`null`||s===`undefined`}function Cn(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function An(s,n,h){return {[s]:Ar(n,h),[s+`_wo_currency`]:n}}function Ar(s,n){if(s==0&&n)return `Free`;let h=Me(),c=he.get(),v=h.shopCurrencyCode||c.currency,I=h.currencyCode;I||Y.warn(`Currency code is not set in RuntimeData`);let w=c.money?.format??h.moneyFormat,R;if(w&&v===I)R=ye.format(s*100,w);else {let b;try{b=new Intl.NumberFormat(pt(),{style:`currency`,currency:I||v,minimumFractionDigits:0,maximumFractionDigits:2});}catch(m){return Ue(m,`format-currency`,{extra:{currentCurrency:I,shopCurrency:v}}),``}R=b.format(s),R=R.replace(`₹`,`Rs. `),c.money?.showCurrency&&I!==`INR`&&(R=R.concat(` ${I}`));}return R}function xn(s){let n=pt();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return Ue(h,`format-number`,{extra:{lang:n,value:s}}),s.toString()}}function pt(){let s=`en`;return typeof navigator<`u`&&(navigator.languages!==void 0&&navigator.languages.length>0?s=navigator.languages[0]:navigator.language&&(s=navigator.language)),s=s.split(`;`)[0],s=s.split(`-`)[0],s||`en`}var Ee;function ht(){if(Ee)return Ee;try{return Ee=Intl.DateTimeFormat().resolvedOptions().timeZone,Ee}catch{return ``}}function vt(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function Nn(s){let n=document.createElement(`span`);n.id=`snackbar`,n.innerText=s,document.body.appendChild(n),n.className=`show`,setTimeout(()=>{n.classList.remove(`show`),document.body.removeChild(n);},5e3);}async function xr(s,n=7,h=document){let c=1,v=document.querySelectorAll(`nonexistent-tag`);for(;c<=n;){let I=Math.min(50*2**c,1e3);if(c>1&&await pe.sleep(I),v=h.querySelectorAll(s),v.length)return Y.verbose(`Attempt ${c}: ${v.length} elements found with ${s}`),v;Y.verbose(`Attempt ${c}: Elements not found with ${s}. Will retry after ${I}ms.`),c++;}return Y.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${s}.`),v}async function Ln(s,n=10,h=document){return (await xr(s,n,h)).item(0)}async function Nr(s){let[n,h,c]=await Promise.all([fe.get(`did`),ve.get(`id`,``),fe.get(`sessionNumber`,1)]),v={letscooee_did:n,letscooee_sid:h,letscooee_sn:`${c}`,__letscooee_time:new Date().toLocaleString()};return s&&(v.__letscooee_via=s),v}async function On(s){let n=await Nr(s);return Object.entries(n).map(([h,c])=>({key:h,value:c.toString()}))}function Pn(s,n,h,c=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:c,value:h});}function Vn(s){if(s%100>=11&&s%100<=13)return s+`th`;switch(s%10){case 1:return s+`st`;case 2:return s+`nd`;case 3:return s+`rd`;default:return s+`th`}}function Mn(s,n){return !n?s:n+s}var W=x(Et());var Y=class{static debuggerEl;static infoLogs=[];static log(...n){W.default.info(...n);}static verbose(...n){W.default.debug(...n);}static error(...n){W.default.error(...n);}static warn(...n){W.default.warn(...n);}static info(...n){W.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W.default.trace(...n);}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector(`cooee-debugger`),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]));}};function Wn(s=ft){W.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q}):`);}}),Lr()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W.default.setLevel(W.default[localStorage.cooeeLogLevel]):W.default.setLevel(W.default.OFF);}function Lr(){let s=_t();return s===`1`||s===`on`}function _t(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function $n(){let s=[`display: inline-block;`,`font-size: 14px;`,`background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);`,`color: white;`,`padding: 4px;`,`border-radius: 4px;`].join(` `),n=`
|
|
4
4
|
`;n+=`\u{1F4E3} Drive higher conversions with AI-powered onsite engagement
|
|
5
5
|
`,n+=`\u{1F50D} Track real-time visitor intent & optimize engagement
|
|
6
6
|
`,n+=`\u{1F4CA} Improve Meta Ads ROAS with intent-driven campaigns
|
|
7
7
|
`,n+=`\u{1F6CD}\uFE0F Boost purchases & repeat sales effortlessly
|
|
8
8
|
`,n+=`
|
|
9
9
|
|
|
10
|
-
`,n+=`Learn more: https://www.letscooee.com`,console.group(`%c Elevate your ecommerce experience with Cooee 🚀 `,s),console.log(`%c${n}`,`font-size: 13px; line-height: 1.8;`),console.log(`SDK v${Q}`),console.groupEnd(),Y.info(`SDK v${Q} loaded`);}function Gn(){let s=localStorage.getItem(`cooeeDebugTill`),n=_t();if(n===`1`||n===`on`){let h=Pr();s||(s=h.toString(),localStorage.setItem(`cooeeDebugTill`,s));}n===`on`?sessionStorage.cooeeDebug=`1`:n===`off`&&sessionStorage.removeItem(`cooeeDebug`),sessionStorage.cooeeDebug&&Or(),s&&new Date(+s)<new Date&&localStorage.removeItem(`cooeeDebugTill`);}function Or(){let s=document.createElement(`cooee-debugger`);vt(()=>{document.body.appendChild(s);});}function Pr(){return new Date().getTime()+360*60*1e3}var bt=5,Vr=500,ie=class extends Error{request;response;status;requestBody;responseText;constructor(n){super(n),this.name=`FetchError`,Object.setPrototypeOf(this,new.target.prototype);}is40x(){return !!this.response&&this.response.status>=400&&this.response.status<500}};async function jn(s,n){let h=Date.now(),c;try{c=await Mr(s,n);}catch{}let v=c?new Request(c.url,{method:n?.method||`GET`}):new Request(s,n);if(!c||!c.ok){let m=`Failed to fetch`;c?.statusText&&(m+=`: ${c.statusText}`);let T=new ie(m);throw T.request=v,T.response=c?.clone(),T.status=c?.status,T.requestBody=n?.body,T.responseText=await Tt(c),T}let I,w=(c.headers.get(`content-type`)||``).toLowerCase(),R=c.headers.get(`content-length`),b=n?.method?.toUpperCase()||`GET`;if(c.status===204||c.status===205||b===`HEAD`||R===`0`)I=void 0;else if(w.includes(`application/json`)||w.includes(`application/problem+json`)||w.includes(`text/javascript`))try{I=await c.clone().json();}catch(m){let T=new ie(`Failed to parse JSON response: ${m?.message}`);throw T.request=v,T.response=c.clone(),T.status=c.status,T.requestBody=n?.body,T.responseText=await Tt(c),T}else w.includes(`text/`)||w.includes(`image/svg+xml`)?I=await c.text():I=await c.arrayBuffer();return {data:I,status:c.status,statusText:c.statusText,headers:c.headers,timeTakenMs:Date.now()-h,options:n,request:v}}async function Mr(s$1$1,n){let h=null,c;for(let v=0;v<=bt;v++){try{let I=new Headers(n?.headers);(s$1$1.includes(`letscooee.com`)||s$1$1.includes(`localhost`))&&I.set(`Cooee-Retry-Attempt`,v.toString());let w=s$1(r({},n),{headers:I});if(c=await fetch(s$1$1,w),c.ok||c.status>=400&&c.status<500)return c;h=new Error(`Server error: ${c.status} ${c.statusText}`);}catch(I){h=I instanceof Error?I:new Error(String(I));}if(v<bt){let I=Math.pow(2,v)*Vr;Y.info(`Request to ${s$1$1} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(c&&!c.ok)return c;throw h||new Error(`Request failed after retries`)}async function Tt(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var be={},Te,we,It,St,wt;async function Dt(){if(!we)return wt??=Br(),wt}async function Br(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:c,makeFetchTransport:v}=await import('./esm-DKhFdjmg-
|
|
10
|
+
`,n+=`Learn more: https://www.letscooee.com`,console.group(`%c Elevate your ecommerce experience with Cooee 🚀 `,s),console.log(`%c${n}`,`font-size: 13px; line-height: 1.8;`),console.log(`SDK v${Q}`),console.groupEnd(),Y.info(`SDK v${Q} loaded`);}function Gn(){let s=localStorage.getItem(`cooeeDebugTill`),n=_t();if(n===`1`||n===`on`){let h=Pr();s||(s=h.toString(),localStorage.setItem(`cooeeDebugTill`,s));}n===`on`?sessionStorage.cooeeDebug=`1`:n===`off`&&sessionStorage.removeItem(`cooeeDebug`),sessionStorage.cooeeDebug&&Or(),s&&new Date(+s)<new Date&&localStorage.removeItem(`cooeeDebugTill`);}function Or(){let s=document.createElement(`cooee-debugger`);vt(()=>{document.body.appendChild(s);});}function Pr(){return new Date().getTime()+360*60*1e3}var bt=5,Vr=500,ie=class extends Error{request;response;status;requestBody;responseText;constructor(n){super(n),this.name=`FetchError`,Object.setPrototypeOf(this,new.target.prototype);}is40x(){return !!this.response&&this.response.status>=400&&this.response.status<500}};async function jn(s,n){let h=Date.now(),c;try{c=await Mr(s,n);}catch{}let v=c?new Request(c.url,{method:n?.method||`GET`}):new Request(s,n);if(!c||!c.ok){let m=`Failed to fetch`;c?.statusText&&(m+=`: ${c.statusText}`);let T=new ie(m);throw T.request=v,T.response=c?.clone(),T.status=c?.status,T.requestBody=n?.body,T.responseText=await Tt(c),T}let I,w=(c.headers.get(`content-type`)||``).toLowerCase(),R=c.headers.get(`content-length`),b=n?.method?.toUpperCase()||`GET`;if(c.status===204||c.status===205||b===`HEAD`||R===`0`)I=void 0;else if(w.includes(`application/json`)||w.includes(`application/problem+json`)||w.includes(`text/javascript`))try{I=await c.clone().json();}catch(m){let T=new ie(`Failed to parse JSON response: ${m?.message}`);throw T.request=v,T.response=c.clone(),T.status=c.status,T.requestBody=n?.body,T.responseText=await Tt(c),T}else w.includes(`text/`)||w.includes(`image/svg+xml`)?I=await c.text():I=await c.arrayBuffer();return {data:I,status:c.status,statusText:c.statusText,headers:c.headers,timeTakenMs:Date.now()-h,options:n,request:v}}async function Mr(s$1$1,n){let h=null,c;for(let v=0;v<=bt;v++){try{let I=new Headers(n?.headers);(s$1$1.includes(`letscooee.com`)||s$1$1.includes(`localhost`))&&I.set(`Cooee-Retry-Attempt`,v.toString());let w=s$1(r({},n),{headers:I});if(c=await fetch(s$1$1,w),c.ok||c.status>=400&&c.status<500)return c;h=new Error(`Server error: ${c.status} ${c.statusText}`);}catch(I){h=I instanceof Error?I:new Error(String(I));}if(v<bt){let I=Math.pow(2,v)*Vr;Y.info(`Request to ${s$1$1} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(c&&!c.ok)return c;throw h||new Error(`Request failed after retries`)}async function Tt(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var be={},Te,we,It,St,wt;async function Dt(){if(!we)return wt??=Br(),wt}async function Br(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:c,makeFetchTransport:v}=await import('./esm-DKhFdjmg-Dag-xV2C.js');St=n;we=new s({dsn:`https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520`,transport:v,stackParser:h,integrations:c({}).filter(w=>![`BrowserApiErrors`,`Breadcrumbs`,`GlobalHandlers`].includes(w.name)),environment:te.mode,release:`web-sdk@${Q}`,debug:te.debug,sampleRate:.5}),we.init();}function Ue(s,n,h){Y.error(`${n}:`,s),Dt().then(()=>{let c=Rt(h);if(c.setTag(`operation`,n),s instanceof ie){Fr(c,s,n);return}c.captureException(s);});}function eo(s,n,h){Dt().then(()=>{Rt(h).captureMessage(s,n??`error`);});}function Fr(s,n,h){if(Ur(s,n),n.response){let c=n.response,v=n.responseText;s.setTag(`error.message`,n.message),c.status!=null&&s.setTag(`http.status_code`,c.status),c.statusText&&s.setTag(`http.status_text`,c.statusText),v&&typeof v==`object`&&`error`in v&&(s.setTag(`http.error_code`,v.error.code),s.setTag(`http.error_message`,v.error.message)),s.setExtras({responseText:n.responseText,statusText:c.statusText,responseType:c.type,redirected:c.redirected,responseUrl:c.url,originalError:n.message}),s.captureMessage(`${h} failed with ${c.status}`,`error`);return}if(n.request){s.captureMessage(`No response was received for ${h}`,`error`);return}}function Ur(s,n){let h=n.request;if(!h)return;s.setExtras({body:n.requestBody,headers:h.headers,method:h.method,url:h.url});let c=h.headers?.get(`Cooee-Retry-Attempt`);c!==null&&s.setTag(`retry.attempt`,c);}function to(s){It=s;}function ro(s,n){be[s]=r(r({},be[s]),n);}function no(s){Te=r(r({},Te),s);}function Rt(s){s??={};let{extra:n,tags:h}=s,c=new St;if(c.setClient(we),c.setUser(It),s.triggerContext&&!s.engagementTrigger&&(s.engagementTrigger=s.triggerContext.triggerData),s.engagementTrigger){let v=s.engagementTrigger;c.setTags({"engagement.id":v.engagementID,"engagement.short_id":v.shortID,"engagement.objective":v.objective,"engagement.delivery_type":v.onsiteDeliveryType,"engagement.content_id":v.contentID,"engagement.variation":v.variation,"engagement.currency":v.currency});}return n&&c.setExtras(n),h&&c.setTags(h),Te&&c.setTags(Te),Object.keys(be).forEach(v=>{c.setContext(v,be[v]);}),c.setTag(`language`,navigator.language),c.setTag(`timezone`,ht()),kr(c),c}function kr(s){window.Shopify&&(s.setTag(`shopify.shop`,window.Shopify.shop),s.setTag(`shopify.currency`,window.Shopify.currency?.active),s.setTag(`shopify.locale`,window.Shopify.locale),s.setTag(`theme.schema_name`,window.Shopify.theme?.schema_name),s.setTag(`theme.schema_version`,window.Shopify.theme?.schema_version));}
|
|
11
11
|
|
|
12
12
|
var s=`\xA0\xA0\xA0`,l=[`/v1/engagement/cart-widgets`,`/v1/engagement/page-widgets`,`/v1/event/validate-session`];function d(e){if(e===0)return `0 B`;let i=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(i));return `${(e/Math.pow(i,r)).toFixed(2)} ${n[r]}`}function E(e){let i=performance.getEntriesByType?.(`resource`);if(i)return i.filter(n=>n.name.includes(e)).pop()}function R(){let e=performance.getEntriesByType?.(`resource`);return e?e.filter(i=>l.some(n=>i.name.includes(n))):[]}function S(e,i){if(!e){Y.info(`\u{1F4E6} API Resource Metrics for ${i}: Not available`);return}Y.info(`📦 ═══════════ API Resource Metrics ═══════════`),Y.info(`URL: ${i}`),Y.info(`Duration: ${lt(e.duration)}`);let n=e.transferSize===0;if(Y.info(`Served from: ${n?`💾 Cache (disk/memory)`:`🌐 Network`}`),!n){Y.info(`Transfer size: ${d(e.transferSize)}`),Y.info(`Encoded size: ${d(e.encodedBodySize)}`),Y.info(`Decoded size: ${d(e.decodedBodySize)}`);let c=(1-e.encodedBodySize/e.decodedBodySize)*100;c>0&&Y.info(`Compression ratio: ${c.toFixed(1)}%`);}let r=e.redirectEnd-e.redirectStart,f=e.fetchStart-e.startTime,a=e.domainLookupEnd-e.domainLookupStart,u=e.connectEnd-e.connectStart,m=e.secureConnectionStart>0?e.connectEnd-e.secureConnectionStart:0,g=e.connectEnd===e.connectStart?e.requestStart-e.fetchStart-a:e.requestStart-e.connectEnd,T=e.responseStart-e.requestStart,P=e.responseEnd-e.responseStart;Y.info(`Timing breakdown (${lt(e.duration)} total):`),r>0&&Y.info(`${s}Redirect: ${lt(r)}`),f>0&&Y.info(`${s}Queued: ${lt(f)}`),g>0&&Y.info(`${s}Stalled: ${lt(g)}`),a>0&&Y.info(`${s}DNS lookup: ${lt(a)}`),u>0&&Y.info(`${s}TCP connect: ${lt(u)}`),m>0&&Y.info(`${s}SSL handshake: ${lt(m)}`),Y.info(`${s}Server waiting (TTFB): ${lt(T)}`),Y.info(`${s}Content download: ${lt(P)}`);let $=e.serverTiming;if($?.length){Y.info(`Server-Timing:`);for(let c of $){let p=c.description||c.name;c.duration>0?Y.info(`${s}${p}: ${lt(c.duration)}`):Y.info(`${s}${p}: ${c.duration}`);}}Y.info(`📦 ═════════════════════════════════════════════`);}function B(){let e=R();return e.length?e.map(n=>JSON.stringify(n.toJSON())).join(`
|
|
13
13
|
`):``}function z(){let e=new Set;for(let n of l){let r=E(n);r?S(r,n):e.add(n);}if(!e.size||typeof PerformanceObserver>`u`)return;let i=new PerformanceObserver(n=>{for(let r of n.getEntries())for(let f of e)if(r.name.includes(f)){S(r,f),e.delete(f);break}e.size||i.disconnect();});i.observe({type:`resource`,buffered:false});}
|
package/dist/{debugger.component-BNl5T8Oq-CCsu6jm4.js → debugger.component-DGenGFsu-BT4w6ZSR.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B, N as Nn } from './chunk-
|
|
2
|
-
import { M } from './main.js';
|
|
3
|
-
import { $ as $b, o as of, a, b as bE, B as Bo, w as wD, I as ID, V as Vo, M as Mf, u as uv, c as ud, _ as _D, i as iD, g as ge, d as Iv, X as Xa, W as Wf, T as Tv, e as _f, f as _v, Y as Yg } from './widgets-
|
|
1
|
+
import { B, N as Nn } from './chunk-C_cBbkTf-CTSBF1Lh.js';
|
|
2
|
+
import { M } from './main.min.js';
|
|
3
|
+
import { $ as $b, o as of, a, b as bE, B as Bo, w as wD, I as ID, V as Vo, M as Mf, u as uv, c as ud, _ as _D, i as iD, g as ge, d as Iv, X as Xa, W as Wf, T as Tv, e as _f, f as _v, Y as Yg } from './widgets-CeQB31bn-JEgjqW5I.js';
|
|
4
4
|
|
|
5
5
|
function P(i,t){if(i&1&&(Bo(0,`li`)(1,`span`,1),uv(2),Iv(3,`date`),Vo(),uv(4,`\xA0 `),Xa(5,`span`,2),Iv(6,`safeHtml`),Vo()),i&2){let e=t.$implicit;ud(2),Wf(Tv(3,2,e.time,`hh:mm:ss a`)),ud(3),_f(`innerHTML`,_v(6,5,e.message),Yg);}}var _=class i{logs=$b.required();constructor(){}async shareLogs(){let t=this.logs().map(o=>`[${new Date(o.time).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`})}] ${o.message}`).join(`
|
|
6
6
|
`);t=t.replaceAll(`\xA0`,` `);let e=B();if(e&&(t+=`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r, s, u, w } from './chunk-
|
|
1
|
+
import { r, s, u, w } from './chunk-C_cBbkTf-CTSBF1Lh.js';
|
|
2
2
|
|
|
3
3
|
var T=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;var x=globalThis;var ut=`9.42.0`;function Ve(){return fn(x),x}function fn(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||ut,t[ut]=t[ut]||{}}function Qt(e,t,n=x){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[ut]=r[ut]||{};return o[e]||(o[e]=t())}var Mn=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],tg=`Sentry Logger `,ar={};function Be(e){if(!(`console`in x))return e();let t=x.console,n={},r=Object.keys(ar);r.forEach(o=>{let i=ar[o];n[o]=t[o],t[o]=i;});try{return e()}finally{r.forEach(o=>{t[o]=n[o];});}}function ng(){ma().enabled=true;}function rg(){ma().enabled=false;}function Tl(){return ma().enabled}function og(...e){pa(`log`,...e);}function ig(...e){pa(`warn`,...e);}function sg(...e){pa(`error`,...e);}function pa(e,...t){T&&Tl()&&Be(()=>{x.console[e](`${tg}[${e}]:`,...t);});}function ma(){return T?Qt(`loggerSettings`,()=>({enabled:false})):{enabled:false}}var g={enable:ng,disable:rg,isEnabled:Tl,log:og,warn:ig,error:sg};var Il=/\(error: (.*)\)/,vl=/captureMessage|captureException/;function ti(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return (n,r=0,o=0)=>{let i=[],s=n.split(`
|
|
4
4
|
`);for(let a=r;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let u=Il.test(c)?c.replace(Il,`$1`):c;if(!u.match(/\S*Error: /)){for(let d of t){let l=d(u);if(l){i.push(l);break}}if(i.length>=50+o)break}}return wl(i.slice(o))}}function wl(e){if(!e.length)return [];let t=Array.from(e);return /sentryWrapped/.test(ei(t).function||``)&&t.pop(),t.reverse(),vl.test(ei(t).function||``)&&(t.pop(),vl.test(ei(t).function||``)&&t.pop()),t.slice(0,50).map(n=>s(r({},n),{filename:n.filename||ei(t).filename,function:n.function||`?`}))}function ei(e){return e[e.length-1]||{}}var ha=`<anonymous>`;function tt(e){try{return !e||typeof e!=`function`?ha:e.name||ha}catch{return ha}}function cr(e){let t=e.exception;if(t){let n=[];try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames);}),n}catch{return}}}var ni={},Rl={};function He(e,t){ni[e]=ni[e]||[],ni[e].push(t);}function $e(e,t){if(!Rl[e]){Rl[e]=true;try{t();}catch(n){T&&g.error(`Error while instrumenting ${e}`,n);}}}function xe(e,t){let n=e&&ni[e];if(n)for(let r of n)try{r(t);}catch(o){T&&g.error(`Error while triggering instrumentation handler.
|
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s, r, a as An$1, h as he$3, X as Xr$3, t as te$3, x as x$3, Y as Y$1, A as Ar$1, v as v$1, U as Ue$2, E as Et$3, H as Hr$3, b as Yr$3, Q as Q$4, o as oe$4, g as ge$3, e as en, c as Mn$1, l as lt$3, G as Gn$1, P as Pn$1, R as Rn$1, M as Me$2, d as jr$2, f as fe$4, i as ve$2, k as ro$1, n as no$1, m as to, K as Kr$3, L as Ln$1, p as xn, q as qr$3, y as vt$2, C as pe$4, V as Vn$1, F as ie$4, I as Cn, j as jn, D as Dn, J as eo, O as xr$1, S as Nr$2, N as Nn$2, T as On$1, W as z$3, Z as d$3, _ as Wn$1, $ as $n$1, a0 as Lr$1 } from './chunk-
|
|
1
|
+
import { s, r, a as An$1, h as he$3, X as Xr$3, t as te$3, x as x$3, Y as Y$1, A as Ar$1, v as v$1, U as Ue$2, E as Et$3, H as Hr$3, b as Yr$3, Q as Q$4, o as oe$4, g as ge$3, e as en, c as Mn$1, l as lt$3, G as Gn$1, P as Pn$1, R as Rn$1, M as Me$2, d as jr$2, f as fe$4, i as ve$2, k as ro$1, n as no$1, m as to, K as Kr$3, L as Ln$1, p as xn, q as qr$3, y as vt$2, C as pe$4, V as Vn$1, F as ie$4, I as Cn, j as jn, D as Dn, J as eo, O as xr$1, S as Nr$2, N as Nn$2, T as On$1, W as z$3, Z as d$3, _ as Wn$1, $ as $n$1, a0 as Lr$1 } from './chunk-C_cBbkTf-CTSBF1Lh.js';
|
|
2
2
|
|
|
3
3
|
var o=`a-f\\d`,I$1=`#?[${o}]{3}[${o}]?`,S$3=`#?[${o}]{6}([${o}]{2})?`,R$1=new RegExp(`[^#${o}]`,`gi`),A$4=new RegExp(`^${I$1}$|^${S$3}$`,`i`);function c(e,r={}){if(typeof e!=`string`||R$1.test(e)||!A$4.test(e))throw new TypeError(`Expected a valid hex string`);e=e.replace(/^#/,``);let t=1;e.length===8&&(t=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(t=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let l=Number.parseInt(e,16),u=l>>16,p=l>>8&255,m=l&255,s=typeof r.alpha==`number`?r.alpha:t;if(r.format===`array`)return [u,p,m,s];if(r.format===`css`)return `rgb(${u} ${p} ${m}${s===1?``:` / ${Number((s*100).toFixed(2))}%`})`;return {red:u,green:p,blue:m,alpha:s}}var n$1=class n{h;a=100;g;constructor(r){r??={},this.h=r.h,this.a=r.a,this.g=r.g;}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return ``;try{return c(this.hex,{format:`css`,alpha:this.getAlpha()})}catch(r){return console.error(`Invalid hex`,r),`#000000`}}getAlpha(){return (this.a??100)/100}};var h$3=class h{s;g;i;constructor(r){r.s&&(this.s=new n$1(r.s)),r.g&&(this.g=new i(r.g)),this.i=r.i;}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var a$2=class a{s;r;w;c;constructor(r){this.s=r.s,this.r=r.r,this.w=r.w,r.c&&(this.c=new n$1(r.c));}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return w$2[this.s??1]}},w$2=(t=>(t[t.SOLID=1]=`SOLID`,t[t.DASHED=2]=`DASHED`,t))(w$2||{});var i=class e{static DEFAULT_FALLBACK=new n$1({h:`#000000`,a:50});r;c;fb;constructor(r){this.r=r.r,r.c&&(this.c=new n$1(r.c)),r.fb&&(this.fb=new n$1(r.fb));}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??e.DEFAULT_FALLBACK}};var g$2=class g{blur;spr;clr;x;y;constructor(r){r=r??{},this.blur=r.blur??0,this.spr=r.spr??0,this.x=r.x??0,this.y=r.y??0,this.clr=new n$1(r.clr);}getStyle(r){return `${this.x*r}px ${this.y*r}px ${this.blur*r}px ${this.spr*r}px ${this.clr.rgba}`}};var b$2=class b{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(r){r=r??{},this.pl=r.pl??0,this.pr=r.pr??0,this.pt=r.pt??0,this.pb=r.pb??0,this.ml=r.ml??0,this.mr=r.mr??0,this.mt=r.mt??0,this.mb=r.mb??0,this.cent=r.cent??false;}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 f=class{rot;constructor(r){r?.rot&&(this.rot=r.rot);}get rotate(){return this.rot}};var y$1=class y{enabled;type;color;constructor(r){r??={},this.enabled=r.enabled,this.type=r.type,this.color=new n$1(r.color);}},d$2=class d{size;enabled;color;constructor(r){r??={},this.enabled=r.enabled,this.size=r.size,this.color=new n$1(r.color);}},x$2=class x{enabled;delay;constructor(r={}){this.enabled=r.enabled,r.delay&&(this.delay=r.delay>100?r.delay:r.delay*1e3);}},C$4=class C{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(r){r??={},this.navigation=new d$2(r.navigation),this.pagination=new y$1(r.pagination),this.autoplay=new x$2(r.autoplay),this.loop=r.loop??false,this.maxInRow=r.maxInRow??4,this.gap=r.gap??0,this.maxInRowSm=r.maxInRowSm??this.maxInRow,this.gapSm=r.gapSm??this.gap,r.speed&&(this.speed=r.speed*1e3),this.marquee=r.marquee;}};
|
|
4
4
|
|
|
@@ -60,15 +60,15 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
60
60
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
61
61
|
</span>
|
|
62
62
|
`},navigation:{nextEl:r.querySelector(`.swiper-button-next`),prevEl:r.querySelector(`.swiper-button-prev`)},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:false,pauseOnMouseEnter:false}:false,autoHeight:true};e.marquee&&t.autoplay&&typeof t.autoplay==`object`&&(t.speed=e.speed,t.autoplay.pauseOnMouseEnter=true,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 Li(r,e,t){let i={color:r.navigation.color?.rgba};return r.pagination.enabled&&(i.transform=`translateY(-25%)`),h(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[h(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&h(`div`,{class:`swiper-button-next`,style:i,children:h(`span`,{})}),r.navigation.enabled&&h(`div`,{class:`swiper-button-prev`,style:i,children:h(`span`,{})}),r.pagination.enabled&&h(`div`,{className:`swiper-pagination`,style:{bottom:0,top:`unset`,position:`relative`,color:r.pagination.color?.rgba}})]})}var mr=class extends A{componentDidMount(){W$2(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return h(`div`,{style:this.getCompiledStyles(),className:`lc-checkbox`,children:h(`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 H;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s(r({},this.getTypoStyles()),{display:`flex`})}};var Ne=class extends A{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 h(`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===He$3.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 Ue=class extends A{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return h(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:h(Je,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new It,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 pr=class extends Ue{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return h(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:h(Ft,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var dr=class extends A{render(){return h(`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(){W$2(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;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`),r(r({},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=true,t.changeSellingPlan(t.sellingPlans[0])):e.push(h(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let i of t.sellingPlans??[])e.push(h(`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 mc=new RegExp(`fill="#[a-zA-Z0-9]+"`),ur=class extends A{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),h(`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=qe$1(this.props.element.fullStar,{svg:e},this.props.triggerContext),i=qe$1(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return ``;let n=``;if(this.props.element.showSingleStar)n=t;else {let s=5,c=`${o.rating}`.split(`.`);for(let m=0;m<+c[0];m++)n+=t,s--;c[1]&&(n+=i,s--);for(let m=0;m<s;m++)n+=t.replace(mc,`fill="#f1f1f1"`);}return n}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var gr=class extends A{render(){return h(`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(){W$2(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;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`),r(r({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(h(`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 Is=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},No=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 Ft=class extends A{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:h(pr,{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()?h(mr,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let t=e,i=this.props.item,o=No(i.variantImage??i.firstImageURL),n=No(i.variantSecondaryImage??i.secondaryImageURL);t.lg=t.sm={src:o,name:i.name,secondarySrc:n};let s=h(Ne,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:h(`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 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?h(`cooee-product-options-picker`,{item:this.props.item}):h(gr,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?h(dr,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?h(ur,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?h(lt,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):h(Je,{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=h(ne,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:h(`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 mt=class extends A{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){if(this.productElement=new qe(Ve$2(this.props.element,this.getProductData(),this.props.triggerContext)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return h(`div`,{style:r({},this.getCompiledStyles()),class:`lc-single-product`,children:h(Ft,{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===le.BXGY;return !t.hasEffectivePrice()&&o&&(i.product=s(r(r({},i.product),An$1(`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 fr=class extends A{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$1()?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&&Vi$1().then(()=>{this.swiperInstance=Oi(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=n=>{this.swiperRef=n;},o=()=>e?.map(n=>h(`div`,{class:`swiper-slide`,children:this.getProductFragment(n)}));t=h(`div`,{style:s(r({},this.getCompiledStyles()),{display:`block`}),class:`lc-product-swiper-list`,children:Li(this.configuration,i,o)});}else t=h(`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,n;i.isBundle()?n=this.props.element.prod.symbol?.hide!==true?o*2-1:o:n=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${n}, auto)`;}}return t}getProductFragment(e,t=false){return h(j$2,{children:[h(mt,{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&&h(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:h(ne,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var hr=class extends A{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$1().then(()=>{this.swiperInstance=Oi(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(c=>h(`div`,{class:`swiper-slide`,onClick:m=>this.onClick(m,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!o?.length)return [];let n=e.conf,s=o.length;if(n.marquee&&s<=Number(n.maxInRow)){let c=Number(n.maxInRow)-s+1;for(let m=0;m<c;m++)o.push(o[m%s]);}return o};return Li(e.conf,t,i)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return h(Ne,{element:t,triggerContext:this.props.triggerContext});case 4:return h(Ue,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$1.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let i=Ve$2(e,{form:t},this.props.triggerContext);return ie.getParsedElement(i)}getClickAction(e){return Ve$2(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Je=class extends A{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),W$2(()=>{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 h(Ue,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return h(lr,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?h(lt,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return h(ne,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return h(Ne,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return h(fr,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return h(mt,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return h(hr,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var wr=class extends A{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===He$3.GO_TO_URL&&!!Dn(this.clickAction.gu?.u)||this.clickAction?.at===He$3.OPEN_CART||this.clickAction?.at===He$3.INITIATE_CHECKOUT;}componentDidMount(){W$2(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return h(j$2,{children:[h(`div`,{style:this.getCompiledStyles(),class:`lc-container`,onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:h(Je,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&h(`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$8{constructor(e){this.engagementTrigger=e;this.triggerContext=new Ve(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{Ue$2(e,`render-widget`,{triggerContext:this.triggerContext});});}destroy(){Y$1.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$8.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),xi$1(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(true),!this.rootContainer){Y$1.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,xi$1(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()){Y$1.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(),true):false}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect();});}acquireProcessingLock(){return this.isProcessing?(Y$1.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$1.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$1.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false;}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$1.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;Y$1.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(i=>new ot$2(i)),t.nonMutableItems=e.items.map(i=>new ot$2(i))),e.bundleFrom&&(t.bundleFrom=new ot$2(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),e.props&&pe$4.hasKeys(e.props)&&(t.props=r(r({},t.props),e.props)),e.content&&(t.content=new zt(e.content)),t.widget=new Pt(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++,Y$1.info(`${this.engagementTrigger} rendered \u2705 ${Vn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof de?pt.delete(this):Bt.delete(this);}async getVariation(){Y$1.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await Ts(e)).data}catch(t){if(t instanceof ie$4&&t.response?.status===400)return;Ue$2(t,`get-variation`,{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){Y$1.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((n,s)=>{n.forEach(async c=>{if(c.isIntersecting){Y$1.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);i(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);o.observe(this.rootContainer),this.observers.push(o);})}attachScroll(){this.scrollSubscription=Tr(window,`scroll`).pipe(Fe(r$8.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent();});}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r$8.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let i={};this.triggerContext.triggerData.items?.length&&(i.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=new Ir$1(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,i,this.engagementTrigger);n.name===`CE Campaign Holdout`&&(n.trigger.holdout=true),we(n),r$8.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe();}generateParentElementID(){return `letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=S.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(`_`,`-`),n=this.engagementTrigger.shortID;return i=document.createElement(`div`),i.id=e,i.className=`letscooee letscooee-engagement engagement-${n} lc-${o}`,i.dataset.engagementId=n,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`}),Mi$1(e)),this.injectCampaignCSS(t,e);let i=this.engagementTrigger.widget;ze$1(pe$3(wr,{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 n=this.rootContainer.id;if(e){Ce$1(o,t),this.injectOuterCSSOnly();return}Ce$1(`#${n} { ${i+`
|
|
63
|
-
${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;Ce$1(`#${t} { ${e} }`);}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return false;let t=window.innerHeight||document.documentElement.clientHeight,s=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width/(e.width*e.height)*100;return this.engagementTrigger.isAnySplit()?s>0:s>=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 Y$1.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let i=t.selector,o;if(i.includes(`:shadow`)){let m=i.split(`:shadow`);o=(await Ln$1(m[0].trim()))?.shadowRoot,i=m[1].trim(),o&&Mi$1(o,false);}Y$1.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${i}"`);let n=await Ln$1(i,3,o??document);if(!n)return Y$1.warn(`${this.engagementTrigger} no placement found with ${i}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case Ve$3.BEFORE1:case Ve$3.BEFORE:n.parentElement?.insertBefore(c,n);break;case Ve$3.INSIDE_FIRST1:case Ve$3.INSIDE_FIRST:n.insertBefore(c,n.firstChild);break;case Ve$3.INSIDE_LAST1:case Ve$3.INSIDE_LAST:n.appendChild(c);break;case Ve$3.AFTER1:case Ve$3.AFTER:default:n.parentElement?.insertBefore(c,n.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$1.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$1.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await _i(this.engagementTrigger);}catch(t){Y$1.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){Y$1.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 n of o)_e.remove(t,n);}getItemDiff(e,t){return e.filter(i=>!t.some(o=>o.selectedOrFirstVariant.value.mID===i.selectedOrFirstVariant.value.mID))}};var de=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(!W.get().isOpen()&&Me$2().pageName!==`cart`){Y$1.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var Ni=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=S.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$1.warn(`No placement available for ${e.objective}`,e.shortID);return}let i=Array.from(document.querySelectorAll(t.selector));if(!i?.length){Y$1.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(w=>w.mID===e.product_id.toString());if(!t)return;let i=t.vars.find(w=>w.mID===e.id.toString());if(!i)return;let o=new nt$1(i),n=e.selling_plan_allocation?.selling_plan;if(n)for(let w of o.sellingPlans??[])w.mID===n.id.toString()&&(w.isSelected=true,o.changeSellingPlan(w));let s=new ot$2(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let m=new X(this.engagementTrigger);m.placement.selector=`.${c}`,m.items=[s];let C=new de(m);C.renderSilently(),this.watchForCartItemDeletion(C,c);}watchForCartItemDeletion(e,t){let i=new MutationObserver(o=>{o.forEach(n=>{n.removedNodes.forEach(s=>{s===this.element&&(Y$1.verbose(`${t} has been removed`),e.destroy(),i.disconnect());});});});i.observe(this.element.parentElement,{childList:true,subtree:true});}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 false;let i=t.selling_plan_allocation?.selling_plan?.name;return !(i&&!e.includes(i))})}};var Ui=class extends K{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var Mi=class extends de{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){Ue$2(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await S.getCurrent().getNormalisedCart(),t=this.engagementTrigger.progressBarConfig,i=[],o=[],n=[],s,c,m=[...t.milestones];for(let v of m){if(v.rewardType!==Fe$1.FREE_AUTO_GIFT)continue;if(v.isUIOnly&&!v.allowATC){Y$1.verbose(`Skipping milestone ${v.label} as it is UI only and does not allow ATC`);continue}let L=v.items[0],k=v.reached,b=e.items.find(Ze=>(Ze.vID===L.vID||Ze.mID===L.mID)&&Ze.properties._letscooee_campaign===this.engagementTrigger.shortID);k&&(s=v,c=b),b&&i.push(b),!k&&b&&t.removeIneligibleItem?(Y$1.verbose(`Removing free gift ${b.vID} from cart`),n.push(b)):k&&!b&&(Y$1.verbose(`Adding free gift ${L.vID} to cart`),o.push(L));}t.restrictToLatestFreebie&&s&&(c?(i=i.filter(v=>v.vID!==c.vID),o=[]):o=[s.items[0]],n.push(...i));let C={},w={};n.length&&n.forEach(v=>w[v.key??v.vID]=0),o.length&&o.forEach(v=>w[v.vID]=1);let O=t.coupons,M=[];if(O?.length){M=O.map(k=>k.couponCode);let v=S.getCurrent().discount_codes?.map(k=>k.code)??[];M.every(k=>v.some(b=>b===k))||(C.discount=M.join(`,`));}if(pe$4.hasKeys(w)&&(C.updates=w),!pe$4.hasKeys(C))return;let y=await ys(C,this.engagementTrigger),P=y?.items,D=[];for(let v of o){let L=P?.find(k=>M?.length?k.id+``===v.vID&&k.discounts?.some(b=>M.includes(b.title)):k.id+``===v.vID);L&&D.push(L);}if(!D.length){W.get().refreshUI(y,false);return}try{await Promise.all(D.map(v=>Es(v,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(v){Ue$2(v,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:D}});}finally{W.get().refreshUI(y,false);}}};var vr=class extends de{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 Fi=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 Bi=class extends K{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var Vi=class extends K{constructor(e){super(e);}isAllOkToRender(){return true}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),false);}async inboundCTAListener(e){let t=this.engagementTrigger,i=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$1.error(`No detail received for ${i}`);return}Y$1.log(`Detail received for BYOB`,o);let n=o.campaignID??o.campaignId??o.campaign_id;if(n!==t.shortID&&n!==t.engagementID){Y$1.warn(`Current ${i} is not BYOB. Received: ${n}`);return}let s=o.items;if(!s?.length)return;let c=s.map(m=>new et({mID:m.product_id,vID:m.variant_id,quantity:m.quantity||1}));await new Le(this.triggerContext).execute({embeddedItems:c,clickAction:{at:He$3.ADD_BUNDLE,applyDiscount:true}});}};var Uo=false,Mo=false,Wi=null,Hi=null,xs=false,pt=new Set,Bt=new Set;function Ds(){xs||(xs=true,vt$2(()=>{hs(document.body,{childList:true,subtree:true},500,fs).subscribe(()=>{Bt.forEach(r=>r.rerenderIfDeleted()),pt.forEach(r=>r.rerenderIfDeleted());});}));}function Fo(r){if(r.length>0&&As(),Ds(),Uo){Y$1.verbose(`Cart widget processing in progress, queuing latest triggers`),Wi=r;return}Uo=true;try{pc(r);}finally{if(Uo=false,Wi){let e=Wi;Wi=null,Y$1.verbose(`Processing queued cart triggers`),Fo(e);}}}function Bo(r){if(r.length>0&&As(),Ds(),Mo){Y$1.verbose(`Page widget processing in progress, queuing latest triggers`),Hi=r;return}Mo=true;try{dc(r);}finally{if(Mo=false,Hi){let e=Hi;Hi=null,Y$1.verbose(`Processing queued page triggers`),Bo(e);}}}function Ps(){pt.forEach(r=>r.rerenderAfterCartOpened());}function pc(r){_s(pt,r);for(let e of r){Y$1.info(`${e} received as cart embed`);let t=Rs(pt,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{Ue$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;if(e.isProgressBar())i=new Mi(e);else if(e.isSubscriptionUpsell()){Ni.renderCartUpsell(e);continue}else e.isSavingsBar()?i=new vr(e):i=new de(e);pt.add(i),i.renderSilently();}}function dc(r){_s(Bt,r);for(let e of r){Y$1.info(`${e} received as page embed`);let t=Rs(Bt,e);if(t){t.updateAndReRender(e).catch(o=>{Ue$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;e.isShoppableVideo()?i=new Fi(e):e.isBYOB()?i=new Vi(e):e.isStickyATC()?i=new Bi(e):e.isSavingsBar()?i=new vr(e):e.isCollectionFilter()?i=new Ui(e):i=new K(e),Bt.add(i),i.renderSilently();}}function Rs(r,e){for(let t of r)if(t.matches(e))return t}function _s(r,e){let t=new Set(e.map(i=>i.shortID));for(let i of r)t.has(i.engagementTrigger.shortID)||i.destroy();}function As(){import('./widgets-B3EF6aEn-B8-8vMIl.js').then(function (n) { return n.ad; }).then(({loadAngularWidgets:r})=>{r();});}var uc=`/v1/engagement/page-widgets`,gc=`/v1/engagement/cart-widgets`,Os=new U,ks=0;Os.pipe(Fe(50)).subscribe(async r=>{let e=await Ge();fc(e).catch(t=>{Ue$2(t,`load-page-widgets`,{extra:{firstLoad:r}});}),hc(e).catch(t=>{Ue$2(t,`load-cart-widgets`,{extra:{firstLoad:r}});});});function br(r=false){le$1(me).then(()=>{Os.next(r);});}async function Ts(r){let e=await Ge();return Object.assign(r,e),oe(`/v1/engagement/get-variant`,r)}async function fc(r$9){ks++,ks===1?Y$1.info(`Fetch page widgets (after ⏰`,en()+` of SDK load)`):Y$1.info(`Fetch page widgets`);let e=r({},r$9),t=Mn$1(uc,x$1.globalRef.apiURLs?.pageWidgetURL);try{let i=await oe(t,e);Y$1.info(`Page widgets loaded in \u23F0 ${lt$3(i.timeTakenMs)}`);Bo(i.data.widgets.map(n=>new X(n)));}catch(i){Y$1.error(`Error sending widget getter`,i);}}async function hc(r$10){Y$1.info(`Fetch cart widgets`);let e=r({},r$10),t=Mn$1(gc,x$1.globalRef.apiURLs?.cartWidgetURL);try{let i=await oe(t,e);Y$1.info(`Cart widgets loaded in \u23F0 ${lt$3(i.timeTakenMs)}`);Fo(i.data.widgets.map(n=>new X(n)));}catch(i){Y$1.error(`Error sending widget getter`,i);}}function Ls(){let r=he$3.get();!r.gaMeasurementID||!r.gaEnabled||vc();}async function wc(){let r=await fe$4.get(`gacid`),e=await bc();if(r!==e)return await fe$4.set(`gacid`,e),e}async function vc(){let r=await wc();r&&Fn({gaClientID:r});}async function bc(){let e=he$3.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag(`get`,e,`client_id`,i=>{t(i);});})}async function Ns(r){Y$1.verbose(`Received app configuration`,r),r.currencyCount=r.currencies?.length;let e=x$1.globalRef.config.update(r);Ls(),W.initialize(),e.website&&(Ui$1(e.website.commonJS),Ce$1(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe(10)).subscribe(async({open:t})=>{Y$1.info(`Cart drawer is now`,t?`open`:`closed`),t&&(Ps(),await Cc());});}function Us(r){x$1.globalRef.apiURLs=r;}async function Cc(){let r=await S.getCurrent().getNormalisedCart(),e={value:r.amount,currency:r.currency};j(new Ir$1(`View Cart`,{items:r.items,amount:e,drawer:true}));}var $i=class{runtimeData=Me$2();meddle(){let e=x$1.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=x$1.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{br();},e.loadExperiments=()=>{Ri();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=x$1.previewWidget.bind(x$1),e.previewPopup=x$1.previewPopup.bind(x$1),e.executeCTA=(t,i)=>{new Le(t).execute(i);},e.sendEvent=t=>{j(t);};}overwritePush(e,t){Pn$1(e,`push`,t);}meddleAccount(){this.overwritePush(x$1.globalRef.account,(...e)=>{this.processAccount(e[0]);}),x$1.globalRef.account.forEach(this.processAccount.bind(this));}meddleEvents(){this.overwritePush(x$1.globalRef.events,(...e)=>{this.processEvent(e[0]);}),x$1.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(x$1.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),x$1.globalRef.profile.forEach(this.processProfile.bind(this));}processAccount(e){e&&(e.appID&&x$1.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags));}processEvent(e){e&&(qr$3.includes(e[0])?x$1.sendEvent(e[0],e[1],r({occurred:this.runtimeData.jsLoadTime},e[2])):x$1.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&x$1.updateProfile(e);}processPageName(e){e&&x$1.setPageName(e);}meddlePage(){this.overwritePush(x$1.globalRef.page,(...e)=>{this.processPage(e[0]);}),x$1.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.currentItem&&yc(e.currentItem),e.currency&&(Me$2().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&&x$1.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&S.getCurrent().update(e.cart),e.configurations&&Ns(e.configurations),e.apiURLs&&Us(e.apiURLs),e.customContext&&(this.runtimeData.customContext=r(r({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(Me$2().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=Is();if(e||(e=Me$2().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let t=new X({id:`preview`,shortID:`1`,redirectBehaviour:Me$1.CART_DRAWER});await new Le(new Ve(new Date,t)).execute({clickAction:{at:He$3.ADD_TO_CART},embeddedItem:new et({vID:e})});}};function yc(r){let e=Me$2();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 et(r);}var Vt=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 Ec=1e3,Sc=10,Vo=0,Wo=new Date;function Ho(r){Vt.remove(`sleid`),Wo=r??new Date;}function Ms(){if(window.scrollY){let r=Vs();Fs(r)&&Bs(r);}vt$2(()=>{Ic();});}function Ic(){Tr(window,`scroll`).pipe(Fe(Ec),q$1(()=>{let r=Vs();if(r>100){Y$1.warn(`Received scroll percent is more than 100`,r);return}if(Fs(r))return r})).subscribe(r=>{Bs(r);});}function Fs(r){return Math.abs(Vo-r)>=Sc||Vo!==r&&r===100}function Bs(r){if(r==null)return;let e={percent:r,timeMS:new Date().getTime()-Wo.getTime()};Vo=r;let i=new Ir$1(`CE Scroll`,e,null,Vt.getString(`sleid`,``));j(i),Vt.setString(`sleid`,i.id.toHexString()),Wo=new Date(i.occurred);}function Vs(){let r=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/r*100)}function Ws(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Tc():document.visibilityState===`hidden`&&xc();};}async function Tc(){}async function xc(){let r=await Dc();if(r===0){Y$1.info(`Not sending duration as user was inactive on website`);return}$s(r);}async function Dc(){let r=Me$2();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function Hs(){let r=Me$2();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function qs(){Pc();}function Pc(){let r=window.fetch;try{window.fetch=async function(e,t){try{await Rc(e,t);}catch(i){Ue$2(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.`),Y$1.error(e);}Y$1.verbose(`Securely overwritten window.fetch method for graphql query`);}async function Rc(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&&(Y$1.verbose(`Intercepted fetch request of:`,t),i?.query.includes(`cartCreate`)&&(e.body=await _c(i),Ac()));}async function _c(r){let e=r.variables.input.attributes??[],t=await On$1(`Buy Now`);return r.variables.input.attributes=[...e,...t],JSON.stringify(r)}function Ac(){let r=Me$2().currentItem;if(!r)return;j(new Ir$1(`Buy Now Clicked`,{items:[r]}));}var Wt=class{constructor(e,t){this.selectors=e;this.eventName=t;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let t=e.currentTarget;j(new Ir$1(this.eventName,{class:t.className||void 0,tagName:t.tagName||void 0,id:t.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$1.error(e));}async listen(){this.elements=await xr$1(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener(`click`,e);});}};var qi=class r extends Wt{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 Gi=class r extends Wt{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 kc=[`.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 Gs(){vt$2(()=>{Y$1.verbose(`Execution order:`,`document ready`),Oc();});}function Oc(){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(kc);if(!e){Y$1.verbose(`No clickable cart checkout button found`);return}Y$1.verbose(`Clickable cart checkout button found`,e),e.click();}else r.includes(`open-cart-drawer`)&&W.get().open();}function zs(){window.addEventListener(`kp-modal:opened`,()=>{Me$2().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,r=>{let{token:e}=r.detail;e&&Rt({goKwikToken:e});}),window.gokwikSdk?js():window.addEventListener(`gokwikLoaded`,js);}function js(){window.gokwikSdk&&window.gokwikSdk.on(`checkout_initiated`,async()=>{let r=await S.getCurrent().getNormalisedCart();j(new Ir$1(`Checkout Started`,{via:`GoKwik`,items:r.items,cartToken:r.token,amount:{value:r.amount,currency:r.currency}}));});}var x$1=class x{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(Y$1.info(`Initialising SDK`),Xn(navigator.userAgent)){Y$1.info(`This seems to be a bot. Disabling SDK`);return}this.initGlobalReference(e),await Xs(),this.autoAuthenticate(),new $i().meddle(),Nn(),br(true),Ri(),Lc(),Ws(),Js(),qs(),Gs(),Ms(),Gi.getInstance().listenSilently(),qi.getInstance().listenSilently(),zs(),Nc(),Gn$1(),wi.remove(`conf`).catch(t=>{Y$1.error(`Fail to remove App Config from local storage`,t);});}}static initGlobalReference(e){window.CooeeSDK||Pn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Pn$1(this.globalRef,`config`,new he$3),Pn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Pn$1(this.globalRef,`uaParser`,new he,true),Pn$1(this.globalRef,`cart`,S.getCurrent()),Pn$1(this.globalRef,`cartChange$`,Ys()),Pn$1(this.globalRef,`cartDrawerToggle$`,W.cartDrawerToggle$.asObservable()),Y$1.verbose(`Global reference initialised`),new le$3(()=>{this.globalRef.uaParser=new he;});}static autoAuthenticate(){let e=zr();e&&this.authenticate({shopifyShop:e});}static authenticate(e){if(this.authenticated)return;Y$1.info(`Begin auth after ⏰`,en(),`of SDK load`);let t=e.appID?.trim(),i=e.shopifyShop;if((Rn$1(t)||t.length!==24)&&Rn$1(i)){Y$1.warn(`Cooee App ID or Shop name is not configured`);return}this.authenticated=true,Ks(e);}static sendEvent(e,t,i){let o=new Ir$1(e,t,i?.triggerData);i?.occurred&&(o.occurred=i.occurred),j(o);}static updateProfile(e){for(let t in e)if(t.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Rt(e);}static setPageName(e){if(!e)return;let t=Me$2(),i=t.pageName;if(e===i)return;if(t.pageName=e,jr$2.some(s=>e.includes(s))){Ho();return}let o={};i&&(o.ps=i);let n=new Ir$1(`CE Screen View`,o);n.occurred=t.jsLoadTime,j(n),Ho(n.occurred);}static previewPopup(e,t){import('./renderer-BZ_aYsz_-DBEn5kf6.js').then(({FreeformRenderer:i})=>{new i(t).render(e);});}static previewWidget(e){new K(new X(e)).renderSilently();}};function Lc(){window.CooeeSDK.cartChange$.subscribe(()=>{br();});}function Nc(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(r){Y$1.error(r);}window.addEventListener(`message`,r=>{if(Y$1.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`?(x$1.previewPopup(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)):e.action===`WIDGET_PREVIEW`&&(x$1.previewWidget(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)));});}}var me=new gr$1(1),Zs=`App ID or Shopify shop is not set`,$o=``,Qe=``,qo=``,ji;function Ks(r){$o=r.appID,qo=r.shopifyShop,Uc().then(async()=>{me.next(true),me.complete();}).catch(e=>{e?.message?.includes(Zs)&&Ue$2(e,`initiate-session`,{extra:r}),Y$1.error(`Unable to initiate session`,e);});}async function Un(){return await ea(),ji}async function Xs(){let r=Date.now();await ui.request(`gen_did`,async()=>{Qe=await fe$4.get(`did`),Qe||(Qe=new $$2().toHexString(),await fe$4.set(`did`,Qe)),Y$1.info(`Device ID:`,Qe),ra(Qe);}),Y$1.info(`Device ID set/get done in \u23F0 ${lt$3(Date.now()-r)}`);}async function Qs(){if(ji)return;let[r,e,t]=await Promise.all([ve$2.get(`id`,``),fe$4.get(`sessionNumber`,1),ve$2.get(`landing`,{})]);ta(r,e,t);}async function Uc(){await ea();}async function ea(){let r=false;await Fc()?(await Mc(),r=true):await Bc()?(await Qs(),r=true):await Qs(),r&&await Wc();}async function Mc(){Y$1.info(`Starting new session`),await ve$2.clear();let r=new Date,e=new $$2().toHexString(),t=await fe$4.get(`sessionNumber`,0)+1,i=fi();await Promise.all([fe$4.set(`sessionNumber`,t),ve$2.set(`id`,e),ve$2.set(`lastUsedTime`,r.getTime()),ve$2.set(`landing`,i)]),ta(e,t,i);}async function Fc(){let r=await ve$2.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Bc(){return !await ve$2.get(`synced`,false)}async function Vc(){if(!$o&&!qo)throw new Error(Zs);let r$11=await Gn(),e=hi();return s(r(r({deviceID:Qe,deviceProps:r$11,appID:$o,shopifyShop:qo},ji),e),{sdk:Hr$3,ad:gi.getAdParams(),occurred:$c(Me$2().jsLoadTime),properties:{},uuid:await fe$4.get(`uuid`)})}async function Wc(){Y$1.info(`Ensuring session on server`),await Hc();let r=Date.now(),e=await Vc();Y$1.info(`Session data fetched in \u23F0 ${lt$3(Date.now()-r)}`);let t=Mn$1(`/v1/event/validate-session`,x$1.globalRef.apiURLs?.baseURL);try{let i=await oe(t,e);Y$1.info(`Auth finished in \u23F0 ${lt$3(i.timeTakenMs)}`),await ve$2.set(`synced`,!0),i.data.deviceID&&(await fe$4.set(`did`,Qe),ra(i.data.deviceID));}catch(i){throw Y$1.error(i),i}}async function Hc(){let r=await fe$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await fe$4.set(`firstSeen`,e.toISOString()),Vn(e),ro$1(`Visitor Info`,{first_seen:e.toISOString()});}function ta(r,e,t){no$1({"cooee_session.number":e}),ro$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$1.info(`Session number: ${e}, id: ${r}`),ji={sessionID:r,sessionNumber:e,landingPage:t};}function ra(r){Bn(r);ro$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),to({id:r});}function $c(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}var zi=class{triggerData;render(e){e.contentSource===Be$1.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 t=e.detail;if(t.formId!==this.triggerData.klaviyoFormID){Y$1.warn(`Received invalid trigger callback`);return}switch(t.type){case `open`:we(new Ir$1(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let i=this.getFormDetails(t);we(new Ir$1(`CE Form Submitted`,{form:i},this.triggerData)),Rt(i);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),we(new Ir$1(`CE Trigger Closed`,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},i=e.metaData;if(pe$4.hasKeys(i)){let o=[`email`,`phone_number`,`first_name`,`last_name`,`$email`,`$phone_number`,`$first_name`,`$last_name`];Object.keys(i).forEach(c=>{o.includes(c)||(t[c]=i[c]);}),t.email=i.$email??i.email,t.mobile=i.$phone_number??i.phone_number;let n=i.$first_name??i.first_name,s=i.$last_name??i.last_name;(n?.length||s?.length)&&(t.name=n+` `+s);}return t}};function ia(r){if(!qc()||!he$3.get().pixelPush)return;let t=Ye$2[r.intent]?.toLowerCase();t&&(Y$1.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function qc(){return window.fbq&&typeof window.fbq==`function`}var mo=`/v1/event/track-page-unload`;function j(r){Y$1.verbose(`Waiting for auth to send event ${r.name}`),le$1(me).then(()=>we(r));}function $s(r){le$1(me).then(()=>{Gc(r);});}async function Gc(r){let e=Me$2().currentPageViewEvent;if(!e){Y$1.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$1.verbose(`Sending page unload`,t);let i=Mn$1(mo,x$1.globalRef.apiURLs?.eventURL);try{await oe(i,t);}catch(o){throw Y$1.error(`Error sending page unload for ${e} to server`,o),o}}function we(r){jc(r);}async function jc(r){if(Y$1.verbose(`Sending event: ${r.name}`,r),Qc(r)){Y$1.warn(`Rejecting event ${r.name}`);return}On();let e=await Ge();Object.assign(r,e),Hs(),ve$2.set(`lastUsedTime`,new Date().getTime());let t=Jc(r.name),o=Mn$1(`/v1/event/track/${t.toLowerCase().replace(/\s+/g,`-`)}`,x$1.globalRef.apiURLs?.eventURL);try{let n=await oe(o,r);Y$1.info(`Event tracked:`,t),zc(r)&&(Me$2().currentPageViewEvent={id:r.id,name:r.name}),Kc(r,n.data);}catch(n){throw Y$1.error(`Error sending event ${r.name} to server`,n),n}}function zc(r){return Kr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Kc(r,e){Xc(r,e).catch(t=>{Ue$2(t,`process-popup-response`,{extra:{event:r,response:e}});}),Yc(e);}async function Xc(r,e){if(!e.triggerData)return;let t=new X(e.triggerData);t.occurred=r.occurred,Y$1.log(`${t} will be shown`);let i;try{i=await _i(t);}catch(n){Y$1.error(`Failed to refresh the products`,n);return}if(t.items=i,t.contentSource===Be$1.KLAVIYO){new zi().render(t);return}new(await(import('./renderer-BZ_aYsz_-DBEn5kf6.js'))).FreeformRenderer().renderEngagement(t).catch(n=>{Ue$2(n,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Yc(r){r.intent&&(zn(r.intent),ia(r),Y$1.info(`Intent is ${Ye$2[r.intent]}`));}function Jc(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Qc(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$1.warn(`Not sending event as this is a test trigger`),true):false}var na=new U,sa=new U;function Ys(){return sa.asObservable()}function Ki(){na.next();}na.pipe(Fe(100)).subscribe(il.bind(void 0));function Js(){Ki(),Zc(),el();}function Zc(){let r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener(`load`,function(){aa(this._url).catch(e=>Y$1.error(`Unable to process cart change in XMLHttpRequest`,e));}),r.apply(this,arguments)},Y$1.verbose(`Securely overwritten window.XMLHttpRequest.send method`);}function el(){let r=window.fetch;try{window.fetch=async function(e,t){return r(e,t).then(i=>{let o=``;try{o=typeof e==`string`||e instanceof URL?e.toString():e?.url??i?.url??``;}catch{}return aa(o).catch(n=>Y$1.error(`Unable to process cart change in fetch`,n)),i})},Y$1.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.`),Y$1.error(e);}}async function aa(r){tl(r)&&Ki();}function tl(r){return /\/cart\/(add|change|update|clear)/.test(r)}function rl(r$12,e){let t=r$12?.items,i=e.items,o=[],n=[];if(Y$1.verbose(`Comparing cart change with old count ${t?.length} to new count ${i.length}`),i?.forEach(s$3=>{let c=t?.find(m=>m.vID===s$3.vID);if(c){if(c.quantity!==s$3.quantity){let m=c.quantity<s$3.quantity,C=Math.abs(c.quantity-s$3.quantity),w=s(r({},s$3),{quantity:C});m?o.push(w):n.push(w);}t&&Cn(t,c);}else o.push(s$3);}),t)for(let s of t)n.push(s);Y$1.verbose(`Cart delta: added: ${o.length}, removed: ${n.length}`),o.length&&oa(`Add To Cart`,{items:o}),n.length&&r$12.token===e.token&&oa(`Remove From Cart`,{items:n}),(n.length||o.length)&&sa.next({itemsAdded:o,itemsRemoved:n,cart:e});}function oa(r,e){j(new Ir$1(r,e));}async function il(){rl(await fe$4.get(`cart`,{}),await S.getCurrent().getNormalisedCart(true));}var W=class r{static cartDrawerToggle$=new Sr({open:false,firstOpen:false});static DEFAULT_SELECTOR=`cart-drawer`;static _instance;inShadow=false;cartDrawerElement;cartDrawerShadowElement;configWebsite=he$3.get().website??{};currentState=false;mutationSubscription;mutationObserver;firstOpen=true;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=[r.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:true,passive:true});}get element(){return this.cartDrawerElement}static get(){return r._instance||(r._instance=new r),r._instance}static initialize(){r.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():C$1(this.cartDrawerElement);return Y$1.info(`Cart drawer is currently ${e?`open`:`close`}`),e}open(){if(this.isOpen()){Y$1.log(`Drawer is already open`);return}document.dispatchEvent(new CustomEvent(`letscooee:outbound:open-cart`));let e=document.querySelector(this.iconSelector);if(!e){Y$1.verbose(`No clickable cart icon found with selector`,this.iconSelector);return}e.click();}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===r.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id===`mini-cart`}refreshUI(e,t=true){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e);}catch(i){Ue$2(i,`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 i=e.items[0].id,o=e.items[0].quantity,n=e.items[0].price;window.cartGiftUpdate(i,n,o,``,`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:true,detail:{}}));else if(this.element?.id===`quick-cart`){let i=document.querySelector(`a[href="/cart"]`);i&&i.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?S.getCurrent().getNormalisedCart(true).then(()=>{window.refreshCart(S.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+``):(Y$1.info(`No method found to update the cart drawer. Blindly firing some events to try`),document.dispatchEvent(new CustomEvent(`cart:refresh`,{bubbles:true})));document.dispatchEvent(new CustomEvent(`letscooee:outbound:refresh-ui`,{detail:{responseJSON:e,currentCart:S.getCurrent()}})),t&&Ki();}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let t=e.split(`:shadow`);t.length===1?(this.selector=t[0],await this.findCartDrawer()):(this.inShadow=true,this.shadowParentElementSelector=t[0]?.trim(),this.selector=t[1]?.trim(),await this.findCartDrawerWithShadow());}async findCartDrawer(){if(!qt())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Ln$1(e),!this.cartDrawerElement){ca.default.warn(`Max attempts exhausted to find cart drawer`);return}Y$1.verbose(`Found`,this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers();}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let t=(await Ln$1(this.shadowParentElementSelector))?.shadowRoot;t?.mode===`open`&&(this.cartDrawerShadowElement=t,this.createMutationObservers());}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle();}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,t=new U;this.mutationObserver=new MutationObserver(()=>{t.next();}),this.mutationObserver.observe(e,{attributes:true,subtree:true,childList:this.inShadow}),this.mutationSubscription=t.pipe(we$1(800,void 0,{leading:false,trailing:true})).subscribe(()=>{let i=this.isOpen();this.currentState!==i&&(this.currentState=i,r.cartDrawerToggle$.next({open:i,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=false));});}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return false;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?C$1(e):false}async updateBubble(){let e=(await S.getCurrent().getNormalisedCart(true)).itemCount,t=document.querySelector(`.cart-link__bubble`);t&&(t.innerText=e+``);}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([`Open Cart`]);}};
|
|
63
|
+
${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;Ce$1(`#${t} { ${e} }`);}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return false;let t=window.innerHeight||document.documentElement.clientHeight,s=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width/(e.width*e.height)*100;return this.engagementTrigger.isAnySplit()?s>0:s>=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 Y$1.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let i=t.selector,o;if(i.includes(`:shadow`)){let m=i.split(`:shadow`);o=(await Ln$1(m[0].trim()))?.shadowRoot,i=m[1].trim(),o&&Mi$1(o,false);}Y$1.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${i}"`);let n=await Ln$1(i,3,o??document);if(!n)return Y$1.warn(`${this.engagementTrigger} no placement found with ${i}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case Ve$3.BEFORE1:case Ve$3.BEFORE:n.parentElement?.insertBefore(c,n);break;case Ve$3.INSIDE_FIRST1:case Ve$3.INSIDE_FIRST:n.insertBefore(c,n.firstChild);break;case Ve$3.INSIDE_LAST1:case Ve$3.INSIDE_LAST:n.appendChild(c);break;case Ve$3.AFTER1:case Ve$3.AFTER:default:n.parentElement?.insertBefore(c,n.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$1.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$1.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await _i(this.engagementTrigger);}catch(t){Y$1.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){Y$1.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 n of o)_e.remove(t,n);}getItemDiff(e,t){return e.filter(i=>!t.some(o=>o.selectedOrFirstVariant.value.mID===i.selectedOrFirstVariant.value.mID))}};var de=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(!W.get().isOpen()&&Me$2().pageName!==`cart`){Y$1.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var Ni=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=S.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$1.warn(`No placement available for ${e.objective}`,e.shortID);return}let i=Array.from(document.querySelectorAll(t.selector));if(!i?.length){Y$1.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(w=>w.mID===e.product_id.toString());if(!t)return;let i=t.vars.find(w=>w.mID===e.id.toString());if(!i)return;let o=new nt$1(i),n=e.selling_plan_allocation?.selling_plan;if(n)for(let w of o.sellingPlans??[])w.mID===n.id.toString()&&(w.isSelected=true,o.changeSellingPlan(w));let s=new ot$2(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let m=new X(this.engagementTrigger);m.placement.selector=`.${c}`,m.items=[s];let C=new de(m);C.renderSilently(),this.watchForCartItemDeletion(C,c);}watchForCartItemDeletion(e,t){let i=new MutationObserver(o=>{o.forEach(n=>{n.removedNodes.forEach(s=>{s===this.element&&(Y$1.verbose(`${t} has been removed`),e.destroy(),i.disconnect());});});});i.observe(this.element.parentElement,{childList:true,subtree:true});}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 false;let i=t.selling_plan_allocation?.selling_plan?.name;return !(i&&!e.includes(i))})}};var Ui=class extends K{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var Mi=class extends de{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){Ue$2(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await S.getCurrent().getNormalisedCart(),t=this.engagementTrigger.progressBarConfig,i=[],o=[],n=[],s,c,m=[...t.milestones];for(let v of m){if(v.rewardType!==Fe$1.FREE_AUTO_GIFT)continue;if(v.isUIOnly&&!v.allowATC){Y$1.verbose(`Skipping milestone ${v.label} as it is UI only and does not allow ATC`);continue}let L=v.items[0],k=v.reached,b=e.items.find(Ze=>(Ze.vID===L.vID||Ze.mID===L.mID)&&Ze.properties._letscooee_campaign===this.engagementTrigger.shortID);k&&(s=v,c=b),b&&i.push(b),!k&&b&&t.removeIneligibleItem?(Y$1.verbose(`Removing free gift ${b.vID} from cart`),n.push(b)):k&&!b&&(Y$1.verbose(`Adding free gift ${L.vID} to cart`),o.push(L));}t.restrictToLatestFreebie&&s&&(c?(i=i.filter(v=>v.vID!==c.vID),o=[]):o=[s.items[0]],n.push(...i));let C={},w={};n.length&&n.forEach(v=>w[v.key??v.vID]=0),o.length&&o.forEach(v=>w[v.vID]=1);let O=t.coupons,M=[];if(O?.length){M=O.map(k=>k.couponCode);let v=S.getCurrent().discount_codes?.map(k=>k.code)??[];M.every(k=>v.some(b=>b===k))||(C.discount=M.join(`,`));}if(pe$4.hasKeys(w)&&(C.updates=w),!pe$4.hasKeys(C))return;let y=await ys(C,this.engagementTrigger),P=y?.items,D=[];for(let v of o){let L=P?.find(k=>M?.length?k.id+``===v.vID&&k.discounts?.some(b=>M.includes(b.title)):k.id+``===v.vID);L&&D.push(L);}if(!D.length){W.get().refreshUI(y,false);return}try{await Promise.all(D.map(v=>Es(v,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(v){Ue$2(v,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:D}});}finally{W.get().refreshUI(y,false);}}};var vr=class extends de{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 Fi=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 Bi=class extends K{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var Vi=class extends K{constructor(e){super(e);}isAllOkToRender(){return true}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),false);}async inboundCTAListener(e){let t=this.engagementTrigger,i=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$1.error(`No detail received for ${i}`);return}Y$1.log(`Detail received for BYOB`,o);let n=o.campaignID??o.campaignId??o.campaign_id;if(n!==t.shortID&&n!==t.engagementID){Y$1.warn(`Current ${i} is not BYOB. Received: ${n}`);return}let s=o.items;if(!s?.length)return;let c=s.map(m=>new et({mID:m.product_id,vID:m.variant_id,quantity:m.quantity||1}));await new Le(this.triggerContext).execute({embeddedItems:c,clickAction:{at:He$3.ADD_BUNDLE,applyDiscount:true}});}};var Uo=false,Mo=false,Wi=null,Hi=null,xs=false,pt=new Set,Bt=new Set;function Ds(){xs||(xs=true,vt$2(()=>{hs(document.body,{childList:true,subtree:true},500,fs).subscribe(()=>{Bt.forEach(r=>r.rerenderIfDeleted()),pt.forEach(r=>r.rerenderIfDeleted());});}));}function Fo(r){if(r.length>0&&As(),Ds(),Uo){Y$1.verbose(`Cart widget processing in progress, queuing latest triggers`),Wi=r;return}Uo=true;try{pc(r);}finally{if(Uo=false,Wi){let e=Wi;Wi=null,Y$1.verbose(`Processing queued cart triggers`),Fo(e);}}}function Bo(r){if(r.length>0&&As(),Ds(),Mo){Y$1.verbose(`Page widget processing in progress, queuing latest triggers`),Hi=r;return}Mo=true;try{dc(r);}finally{if(Mo=false,Hi){let e=Hi;Hi=null,Y$1.verbose(`Processing queued page triggers`),Bo(e);}}}function Ps(){pt.forEach(r=>r.rerenderAfterCartOpened());}function pc(r){_s(pt,r);for(let e of r){Y$1.info(`${e} received as cart embed`);let t=Rs(pt,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{Ue$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;if(e.isProgressBar())i=new Mi(e);else if(e.isSubscriptionUpsell()){Ni.renderCartUpsell(e);continue}else e.isSavingsBar()?i=new vr(e):i=new de(e);pt.add(i),i.renderSilently();}}function dc(r){_s(Bt,r);for(let e of r){Y$1.info(`${e} received as page embed`);let t=Rs(Bt,e);if(t){t.updateAndReRender(e).catch(o=>{Ue$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;e.isShoppableVideo()?i=new Fi(e):e.isBYOB()?i=new Vi(e):e.isStickyATC()?i=new Bi(e):e.isSavingsBar()?i=new vr(e):e.isCollectionFilter()?i=new Ui(e):i=new K(e),Bt.add(i),i.renderSilently();}}function Rs(r,e){for(let t of r)if(t.matches(e))return t}function _s(r,e){let t=new Set(e.map(i=>i.shortID));for(let i of r)t.has(i.engagementTrigger.shortID)||i.destroy();}function As(){import('./widgets-CeQB31bn-JEgjqW5I.js').then(function (n) { return n.ad; }).then(({loadAngularWidgets:r})=>{r();});}var uc=`/v1/engagement/page-widgets`,gc=`/v1/engagement/cart-widgets`,Os=new U,ks=0;Os.pipe(Fe(50)).subscribe(async r=>{let e=await Ge();fc(e).catch(t=>{Ue$2(t,`load-page-widgets`,{extra:{firstLoad:r}});}),hc(e).catch(t=>{Ue$2(t,`load-cart-widgets`,{extra:{firstLoad:r}});});});function br(r=false){le$1(me).then(()=>{Os.next(r);});}async function Ts(r){let e=await Ge();return Object.assign(r,e),oe(`/v1/engagement/get-variant`,r)}async function fc(r$9){ks++,ks===1?Y$1.info(`Fetch page widgets (after ⏰`,en()+` of SDK load)`):Y$1.info(`Fetch page widgets`);let e=r({},r$9),t=Mn$1(uc,x$1.globalRef.apiURLs?.pageWidgetURL);try{let i=await oe(t,e);Y$1.info(`Page widgets loaded in \u23F0 ${lt$3(i.timeTakenMs)}`);Bo(i.data.widgets.map(n=>new X(n)));}catch(i){Y$1.error(`Error sending widget getter`,i);}}async function hc(r$10){Y$1.info(`Fetch cart widgets`);let e=r({},r$10),t=Mn$1(gc,x$1.globalRef.apiURLs?.cartWidgetURL);try{let i=await oe(t,e);Y$1.info(`Cart widgets loaded in \u23F0 ${lt$3(i.timeTakenMs)}`);Fo(i.data.widgets.map(n=>new X(n)));}catch(i){Y$1.error(`Error sending widget getter`,i);}}function Ls(){let r=he$3.get();!r.gaMeasurementID||!r.gaEnabled||vc();}async function wc(){let r=await fe$4.get(`gacid`),e=await bc();if(r!==e)return await fe$4.set(`gacid`,e),e}async function vc(){let r=await wc();r&&Fn({gaClientID:r});}async function bc(){let e=he$3.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag(`get`,e,`client_id`,i=>{t(i);});})}async function Ns(r){Y$1.verbose(`Received app configuration`,r),r.currencyCount=r.currencies?.length;let e=x$1.globalRef.config.update(r);Ls(),W.initialize(),e.website&&(Ui$1(e.website.commonJS),Ce$1(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe(10)).subscribe(async({open:t})=>{Y$1.info(`Cart drawer is now`,t?`open`:`closed`),t&&(Ps(),await Cc());});}function Us(r){x$1.globalRef.apiURLs=r;}async function Cc(){let r=await S.getCurrent().getNormalisedCart(),e={value:r.amount,currency:r.currency};j(new Ir$1(`View Cart`,{items:r.items,amount:e,drawer:true}));}var $i=class{runtimeData=Me$2();meddle(){let e=x$1.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=x$1.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{br();},e.loadExperiments=()=>{Ri();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=x$1.previewWidget.bind(x$1),e.previewPopup=x$1.previewPopup.bind(x$1),e.executeCTA=(t,i)=>{new Le(t).execute(i);},e.sendEvent=t=>{j(t);};}overwritePush(e,t){Pn$1(e,`push`,t);}meddleAccount(){this.overwritePush(x$1.globalRef.account,(...e)=>{this.processAccount(e[0]);}),x$1.globalRef.account.forEach(this.processAccount.bind(this));}meddleEvents(){this.overwritePush(x$1.globalRef.events,(...e)=>{this.processEvent(e[0]);}),x$1.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(x$1.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),x$1.globalRef.profile.forEach(this.processProfile.bind(this));}processAccount(e){e&&(e.appID&&x$1.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags));}processEvent(e){e&&(qr$3.includes(e[0])?x$1.sendEvent(e[0],e[1],r({occurred:this.runtimeData.jsLoadTime},e[2])):x$1.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&x$1.updateProfile(e);}processPageName(e){e&&x$1.setPageName(e);}meddlePage(){this.overwritePush(x$1.globalRef.page,(...e)=>{this.processPage(e[0]);}),x$1.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.currentItem&&yc(e.currentItem),e.currency&&(Me$2().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&&x$1.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&S.getCurrent().update(e.cart),e.configurations&&Ns(e.configurations),e.apiURLs&&Us(e.apiURLs),e.customContext&&(this.runtimeData.customContext=r(r({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(Me$2().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=Is();if(e||(e=Me$2().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let t=new X({id:`preview`,shortID:`1`,redirectBehaviour:Me$1.CART_DRAWER});await new Le(new Ve(new Date,t)).execute({clickAction:{at:He$3.ADD_TO_CART},embeddedItem:new et({vID:e})});}};function yc(r){let e=Me$2();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 et(r);}var Vt=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 Ec=1e3,Sc=10,Vo=0,Wo=new Date;function Ho(r){Vt.remove(`sleid`),Wo=r??new Date;}function Ms(){if(window.scrollY){let r=Vs();Fs(r)&&Bs(r);}vt$2(()=>{Ic();});}function Ic(){Tr(window,`scroll`).pipe(Fe(Ec),q$1(()=>{let r=Vs();if(r>100){Y$1.warn(`Received scroll percent is more than 100`,r);return}if(Fs(r))return r})).subscribe(r=>{Bs(r);});}function Fs(r){return Math.abs(Vo-r)>=Sc||Vo!==r&&r===100}function Bs(r){if(r==null)return;let e={percent:r,timeMS:new Date().getTime()-Wo.getTime()};Vo=r;let i=new Ir$1(`CE Scroll`,e,null,Vt.getString(`sleid`,``));j(i),Vt.setString(`sleid`,i.id.toHexString()),Wo=new Date(i.occurred);}function Vs(){let r=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/r*100)}function Ws(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Tc():document.visibilityState===`hidden`&&xc();};}async function Tc(){}async function xc(){let r=await Dc();if(r===0){Y$1.info(`Not sending duration as user was inactive on website`);return}$s(r);}async function Dc(){let r=Me$2();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function Hs(){let r=Me$2();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function qs(){Pc();}function Pc(){let r=window.fetch;try{window.fetch=async function(e,t){try{await Rc(e,t);}catch(i){Ue$2(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.`),Y$1.error(e);}Y$1.verbose(`Securely overwritten window.fetch method for graphql query`);}async function Rc(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&&(Y$1.verbose(`Intercepted fetch request of:`,t),i?.query.includes(`cartCreate`)&&(e.body=await _c(i),Ac()));}async function _c(r){let e=r.variables.input.attributes??[],t=await On$1(`Buy Now`);return r.variables.input.attributes=[...e,...t],JSON.stringify(r)}function Ac(){let r=Me$2().currentItem;if(!r)return;j(new Ir$1(`Buy Now Clicked`,{items:[r]}));}var Wt=class{constructor(e,t){this.selectors=e;this.eventName=t;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let t=e.currentTarget;j(new Ir$1(this.eventName,{class:t.className||void 0,tagName:t.tagName||void 0,id:t.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$1.error(e));}async listen(){this.elements=await xr$1(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener(`click`,e);});}};var qi=class r extends Wt{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 Gi=class r extends Wt{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 kc=[`.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 Gs(){vt$2(()=>{Y$1.verbose(`Execution order:`,`document ready`),Oc();});}function Oc(){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(kc);if(!e){Y$1.verbose(`No clickable cart checkout button found`);return}Y$1.verbose(`Clickable cart checkout button found`,e),e.click();}else r.includes(`open-cart-drawer`)&&W.get().open();}function zs(){window.addEventListener(`kp-modal:opened`,()=>{Me$2().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,r=>{let{token:e}=r.detail;e&&Rt({goKwikToken:e});}),window.gokwikSdk?js():window.addEventListener(`gokwikLoaded`,js);}function js(){window.gokwikSdk&&window.gokwikSdk.on(`checkout_initiated`,async()=>{let r=await S.getCurrent().getNormalisedCart();j(new Ir$1(`Checkout Started`,{via:`GoKwik`,items:r.items,cartToken:r.token,amount:{value:r.amount,currency:r.currency}}));});}var x$1=class x{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(Y$1.info(`Initialising SDK`),Xn(navigator.userAgent)){Y$1.info(`This seems to be a bot. Disabling SDK`);return}this.initGlobalReference(e),await Xs(),this.autoAuthenticate(),new $i().meddle(),Nn(),br(true),Ri(),Lc(),Ws(),Js(),qs(),Gs(),Ms(),Gi.getInstance().listenSilently(),qi.getInstance().listenSilently(),zs(),Nc(),Gn$1(),wi.remove(`conf`).catch(t=>{Y$1.error(`Fail to remove App Config from local storage`,t);});}}static initGlobalReference(e){window.CooeeSDK||Pn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Pn$1(this.globalRef,`config`,new he$3),Pn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Pn$1(this.globalRef,`uaParser`,new he,true),Pn$1(this.globalRef,`cart`,S.getCurrent()),Pn$1(this.globalRef,`cartChange$`,Ys()),Pn$1(this.globalRef,`cartDrawerToggle$`,W.cartDrawerToggle$.asObservable()),Y$1.verbose(`Global reference initialised`),new le$3(()=>{this.globalRef.uaParser=new he;});}static autoAuthenticate(){let e=zr();e&&this.authenticate({shopifyShop:e});}static authenticate(e){if(this.authenticated)return;Y$1.info(`Begin auth after ⏰`,en(),`of SDK load`);let t=e.appID?.trim(),i=e.shopifyShop;if((Rn$1(t)||t.length!==24)&&Rn$1(i)){Y$1.warn(`Cooee App ID or Shop name is not configured`);return}this.authenticated=true,Ks(e);}static sendEvent(e,t,i){let o=new Ir$1(e,t,i?.triggerData);i?.occurred&&(o.occurred=i.occurred),j(o);}static updateProfile(e){for(let t in e)if(t.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Rt(e);}static setPageName(e){if(!e)return;let t=Me$2(),i=t.pageName;if(e===i)return;if(t.pageName=e,jr$2.some(s=>e.includes(s))){Ho();return}let o={};i&&(o.ps=i);let n=new Ir$1(`CE Screen View`,o);n.occurred=t.jsLoadTime,j(n),Ho(n.occurred);}static previewPopup(e,t){import('./renderer-v4JpDv8Y-BMksDEdR.js').then(({FreeformRenderer:i})=>{new i(t).render(e);});}static previewWidget(e){new K(new X(e)).renderSilently();}};function Lc(){window.CooeeSDK.cartChange$.subscribe(()=>{br();});}function Nc(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(r){Y$1.error(r);}window.addEventListener(`message`,r=>{if(Y$1.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`?(x$1.previewPopup(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)):e.action===`WIDGET_PREVIEW`&&(x$1.previewWidget(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)));});}}var me=new gr$1(1),Zs=`App ID or Shopify shop is not set`,$o=``,Qe=``,qo=``,ji;function Ks(r){$o=r.appID,qo=r.shopifyShop,Uc().then(async()=>{me.next(true),me.complete();}).catch(e=>{e?.message?.includes(Zs)&&Ue$2(e,`initiate-session`,{extra:r}),Y$1.error(`Unable to initiate session`,e);});}async function Un(){return await ea(),ji}async function Xs(){let r=Date.now();await ui.request(`gen_did`,async()=>{Qe=await fe$4.get(`did`),Qe||(Qe=new $$2().toHexString(),await fe$4.set(`did`,Qe)),Y$1.info(`Device ID:`,Qe),ra(Qe);}),Y$1.info(`Device ID set/get done in \u23F0 ${lt$3(Date.now()-r)}`);}async function Qs(){if(ji)return;let[r,e,t]=await Promise.all([ve$2.get(`id`,``),fe$4.get(`sessionNumber`,1),ve$2.get(`landing`,{})]);ta(r,e,t);}async function Uc(){await ea();}async function ea(){let r=false;await Fc()?(await Mc(),r=true):await Bc()?(await Qs(),r=true):await Qs(),r&&await Wc();}async function Mc(){Y$1.info(`Starting new session`),await ve$2.clear();let r=new Date,e=new $$2().toHexString(),t=await fe$4.get(`sessionNumber`,0)+1,i=fi();await Promise.all([fe$4.set(`sessionNumber`,t),ve$2.set(`id`,e),ve$2.set(`lastUsedTime`,r.getTime()),ve$2.set(`landing`,i)]),ta(e,t,i);}async function Fc(){let r=await ve$2.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Bc(){return !await ve$2.get(`synced`,false)}async function Vc(){if(!$o&&!qo)throw new Error(Zs);let r$11=await Gn(),e=hi();return s(r(r({deviceID:Qe,deviceProps:r$11,appID:$o,shopifyShop:qo},ji),e),{sdk:Hr$3,ad:gi.getAdParams(),occurred:$c(Me$2().jsLoadTime),properties:{},uuid:await fe$4.get(`uuid`)})}async function Wc(){Y$1.info(`Ensuring session on server`),await Hc();let r=Date.now(),e=await Vc();Y$1.info(`Session data fetched in \u23F0 ${lt$3(Date.now()-r)}`);let t=Mn$1(`/v1/event/validate-session`,x$1.globalRef.apiURLs?.baseURL);try{let i=await oe(t,e);Y$1.info(`Auth finished in \u23F0 ${lt$3(i.timeTakenMs)}`),await ve$2.set(`synced`,!0),i.data.deviceID&&(await fe$4.set(`did`,Qe),ra(i.data.deviceID));}catch(i){throw Y$1.error(i),i}}async function Hc(){let r=await fe$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await fe$4.set(`firstSeen`,e.toISOString()),Vn(e),ro$1(`Visitor Info`,{first_seen:e.toISOString()});}function ta(r,e,t){no$1({"cooee_session.number":e}),ro$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$1.info(`Session number: ${e}, id: ${r}`),ji={sessionID:r,sessionNumber:e,landingPage:t};}function ra(r){Bn(r);ro$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),to({id:r});}function $c(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}var zi=class{triggerData;render(e){e.contentSource===Be$1.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 t=e.detail;if(t.formId!==this.triggerData.klaviyoFormID){Y$1.warn(`Received invalid trigger callback`);return}switch(t.type){case `open`:we(new Ir$1(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let i=this.getFormDetails(t);we(new Ir$1(`CE Form Submitted`,{form:i},this.triggerData)),Rt(i);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),we(new Ir$1(`CE Trigger Closed`,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},i=e.metaData;if(pe$4.hasKeys(i)){let o=[`email`,`phone_number`,`first_name`,`last_name`,`$email`,`$phone_number`,`$first_name`,`$last_name`];Object.keys(i).forEach(c=>{o.includes(c)||(t[c]=i[c]);}),t.email=i.$email??i.email,t.mobile=i.$phone_number??i.phone_number;let n=i.$first_name??i.first_name,s=i.$last_name??i.last_name;(n?.length||s?.length)&&(t.name=n+` `+s);}return t}};function ia(r){if(!qc()||!he$3.get().pixelPush)return;let t=Ye$2[r.intent]?.toLowerCase();t&&(Y$1.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function qc(){return window.fbq&&typeof window.fbq==`function`}var mo=`/v1/event/track-page-unload`;function j(r){Y$1.verbose(`Waiting for auth to send event ${r.name}`),le$1(me).then(()=>we(r));}function $s(r){le$1(me).then(()=>{Gc(r);});}async function Gc(r){let e=Me$2().currentPageViewEvent;if(!e){Y$1.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$1.verbose(`Sending page unload`,t);let i=Mn$1(mo,x$1.globalRef.apiURLs?.eventURL);try{await oe(i,t);}catch(o){throw Y$1.error(`Error sending page unload for ${e} to server`,o),o}}function we(r){jc(r);}async function jc(r){if(Y$1.verbose(`Sending event: ${r.name}`,r),Qc(r)){Y$1.warn(`Rejecting event ${r.name}`);return}On();let e=await Ge();Object.assign(r,e),Hs(),ve$2.set(`lastUsedTime`,new Date().getTime());let t=Jc(r.name),o=Mn$1(`/v1/event/track/${t.toLowerCase().replace(/\s+/g,`-`)}`,x$1.globalRef.apiURLs?.eventURL);try{let n=await oe(o,r);Y$1.info(`Event tracked:`,t),zc(r)&&(Me$2().currentPageViewEvent={id:r.id,name:r.name}),Kc(r,n.data);}catch(n){throw Y$1.error(`Error sending event ${r.name} to server`,n),n}}function zc(r){return Kr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Kc(r,e){Xc(r,e).catch(t=>{Ue$2(t,`process-popup-response`,{extra:{event:r,response:e}});}),Yc(e);}async function Xc(r,e){if(!e.triggerData)return;let t=new X(e.triggerData);t.occurred=r.occurred,Y$1.log(`${t} will be shown`);let i;try{i=await _i(t);}catch(n){Y$1.error(`Failed to refresh the products`,n);return}if(t.items=i,t.contentSource===Be$1.KLAVIYO){new zi().render(t);return}new(await(import('./renderer-v4JpDv8Y-BMksDEdR.js'))).FreeformRenderer().renderEngagement(t).catch(n=>{Ue$2(n,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Yc(r){r.intent&&(zn(r.intent),ia(r),Y$1.info(`Intent is ${Ye$2[r.intent]}`));}function Jc(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Qc(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$1.warn(`Not sending event as this is a test trigger`),true):false}var na=new U,sa=new U;function Ys(){return sa.asObservable()}function Ki(){na.next();}na.pipe(Fe(100)).subscribe(il.bind(void 0));function Js(){Ki(),Zc(),el();}function Zc(){let r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener(`load`,function(){aa(this._url).catch(e=>Y$1.error(`Unable to process cart change in XMLHttpRequest`,e));}),r.apply(this,arguments)},Y$1.verbose(`Securely overwritten window.XMLHttpRequest.send method`);}function el(){let r=window.fetch;try{window.fetch=async function(e,t){return r(e,t).then(i=>{let o=``;try{o=typeof e==`string`||e instanceof URL?e.toString():e?.url??i?.url??``;}catch{}return aa(o).catch(n=>Y$1.error(`Unable to process cart change in fetch`,n)),i})},Y$1.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.`),Y$1.error(e);}}async function aa(r){tl(r)&&Ki();}function tl(r){return /\/cart\/(add|change|update|clear)/.test(r)}function rl(r$12,e){let t=r$12?.items,i=e.items,o=[],n=[];if(Y$1.verbose(`Comparing cart change with old count ${t?.length} to new count ${i.length}`),i?.forEach(s$3=>{let c=t?.find(m=>m.vID===s$3.vID);if(c){if(c.quantity!==s$3.quantity){let m=c.quantity<s$3.quantity,C=Math.abs(c.quantity-s$3.quantity),w=s(r({},s$3),{quantity:C});m?o.push(w):n.push(w);}t&&Cn(t,c);}else o.push(s$3);}),t)for(let s of t)n.push(s);Y$1.verbose(`Cart delta: added: ${o.length}, removed: ${n.length}`),o.length&&oa(`Add To Cart`,{items:o}),n.length&&r$12.token===e.token&&oa(`Remove From Cart`,{items:n}),(n.length||o.length)&&sa.next({itemsAdded:o,itemsRemoved:n,cart:e});}function oa(r,e){j(new Ir$1(r,e));}async function il(){rl(await fe$4.get(`cart`,{}),await S.getCurrent().getNormalisedCart(true));}var W=class r{static cartDrawerToggle$=new Sr({open:false,firstOpen:false});static DEFAULT_SELECTOR=`cart-drawer`;static _instance;inShadow=false;cartDrawerElement;cartDrawerShadowElement;configWebsite=he$3.get().website??{};currentState=false;mutationSubscription;mutationObserver;firstOpen=true;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=[r.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:true,passive:true});}get element(){return this.cartDrawerElement}static get(){return r._instance||(r._instance=new r),r._instance}static initialize(){r.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():C$1(this.cartDrawerElement);return Y$1.info(`Cart drawer is currently ${e?`open`:`close`}`),e}open(){if(this.isOpen()){Y$1.log(`Drawer is already open`);return}document.dispatchEvent(new CustomEvent(`letscooee:outbound:open-cart`));let e=document.querySelector(this.iconSelector);if(!e){Y$1.verbose(`No clickable cart icon found with selector`,this.iconSelector);return}e.click();}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===r.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id===`mini-cart`}refreshUI(e,t=true){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e);}catch(i){Ue$2(i,`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 i=e.items[0].id,o=e.items[0].quantity,n=e.items[0].price;window.cartGiftUpdate(i,n,o,``,`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:true,detail:{}}));else if(this.element?.id===`quick-cart`){let i=document.querySelector(`a[href="/cart"]`);i&&i.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?S.getCurrent().getNormalisedCart(true).then(()=>{window.refreshCart(S.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+``):(Y$1.info(`No method found to update the cart drawer. Blindly firing some events to try`),document.dispatchEvent(new CustomEvent(`cart:refresh`,{bubbles:true})));document.dispatchEvent(new CustomEvent(`letscooee:outbound:refresh-ui`,{detail:{responseJSON:e,currentCart:S.getCurrent()}})),t&&Ki();}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let t=e.split(`:shadow`);t.length===1?(this.selector=t[0],await this.findCartDrawer()):(this.inShadow=true,this.shadowParentElementSelector=t[0]?.trim(),this.selector=t[1]?.trim(),await this.findCartDrawerWithShadow());}async findCartDrawer(){if(!qt())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Ln$1(e),!this.cartDrawerElement){ca.default.warn(`Max attempts exhausted to find cart drawer`);return}Y$1.verbose(`Found`,this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers();}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let t=(await Ln$1(this.shadowParentElementSelector))?.shadowRoot;t?.mode===`open`&&(this.cartDrawerShadowElement=t,this.createMutationObservers());}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle();}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,t=new U;this.mutationObserver=new MutationObserver(()=>{t.next();}),this.mutationObserver.observe(e,{attributes:true,subtree:true,childList:this.inShadow}),this.mutationSubscription=t.pipe(we$1(800,void 0,{leading:false,trailing:true})).subscribe(()=>{let i=this.isOpen();this.currentState!==i&&(this.currentState=i,r.cartDrawerToggle$.next({open:i,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=false));});}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return false;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?C$1(e):false}async updateBubble(){let e=(await S.getCurrent().getNormalisedCart(true)).itemCount,t=document.querySelector(`.cart-link__bubble`);t&&(t.innerText=e+``);}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([`Open Cart`]);}};
|
|
64
64
|
|
|
65
65
|
function a(i){return i?new Date(i).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`}):`N/A`}function M(){let i=performance.getEntriesByType?.(`resource`);if(i)return i.find(o=>o.name.includes(`@letscooee/web-sdk`)&&o.name.includes(`main.min.js`))}function x(i){window.cooeeSDKPreview||(document.readyState===`complete`?setTimeout(()=>L(i),100):window.addEventListener(`load`,()=>{setTimeout(()=>L(i),100);}));}function L(i){try{N(i),z$3();}catch(o){console.error(`Failed to print debugging logs`,o);}}function N(i){let o=performance.getEntriesByType?.(`navigation`)?.[0],f=window.CooeeSDK?.pageLoadTime,l=M(),s=performance.timeOrigin||0,n=o?.responseEnd?s+o.responseEnd:void 0,d=s,c=o?.domContentLoadedEventEnd||0,m=o?.loadEventEnd||0,u=n&&n>0?n:f?f.getTime():0,T=n&&n>0?`HTML download complete`:`inline script execution`,S=c>0?d+c:void 0,$=m>0?d+m:void 0;Y$1.info(`⏱️ ═══════════════ Performance Timing Report ═══════════════`),Y$1.info(`📅 Absolute Timestamps (Local Time):`),Y$1.info(` Note: Inline script can execute during HTML download (incremental parsing)`),Y$1.info(``),Y$1.info(` 1. Navigation started: ${a(d)}`);let r=f?f.getTime():0;if(n&&n>0&&r?r<n?(Y$1.info(` 2. Inline script executed: ${a(r)} (during HTML parsing)`),Y$1.info(` 3. HTML download complete: ${a(n)}`)):(Y$1.info(` 2. HTML download complete: ${a(n)}`),Y$1.info(` 3. Inline script executed: ${a(r)}`)):n&&n>0?Y$1.info(` 2. HTML download complete: ${a(n)}`):r&&Y$1.info(` 2. Inline script executed: ${a(r)}`),Y$1.info(` 4. SDK module loaded: ${a(i.getTime())} (from CDN)`),S&&Y$1.info(` 5. DOMContentLoaded: ${a(S)}`),$&&Y$1.info(` 6. Page fully loaded: ${a($)}`),Y$1.info(``),Y$1.info(`⏱️ Relative Timings:`),n&&n>0&&d){let g=n-d;Y$1.info(` Shopify backend + HTML download: ${lt$3(g)} (not Cooee SDK)`);}if(u){let g=i.getTime()-u;if(g<0){let w=r>0?r:d,b=r>0?`inline script execution`:`navigation start`,K=i.getTime()-w;Y$1.info(` SDK module load time: ${lt$3(K)} after ${b}`),Y$1.info(` (Note: Using earlier baseline because SDK loaded before ${T})`);}else Y$1.info(` SDK module load time: ${lt$3(g)} after ${T}`),Y$1.info(` (Baseline: ${T} at ${a(u)})`);let v=i.getTime()-d;Y$1.info(` \u{1F3AF} Total SDK load time: ${lt$3(v)} (from navigation start to SDK ready)`);}c&&c>0&&Y$1.info(` DOMContentLoaded: ${lt$3(c)} after navigation start`),m&&m>0&&Y$1.info(` Page fully loaded: ${lt$3(m)} after navigation start`),C(l),Y$1.info(`⏱️ ═══════════════════════════════════════════════════════`);}function C(i){if(!i){Y$1.info(``),Y$1.info(`📦 SDK Resource Metrics: Not available`);return}Y$1.info(``),Y$1.info(`📦 SDK Resource Metrics:`),Y$1.info(` URL: ${i.name}`),Y$1.info(` Download duration: ${lt$3(i.duration)}`);let o=i.transferSize===0;if(Y$1.info(` Served from: ${o?`💾 Cache (disk/memory)`:`🌐 Network`}`),!o){Y$1.info(` Transfer size: ${d$3(i.transferSize)}`),Y$1.info(` Encoded size: ${d$3(i.encodedBodySize)}`),Y$1.info(` Decoded size: ${d$3(i.decodedBodySize)}`);let f=(1-i.encodedBodySize/i.decodedBodySize)*100;f>0&&Y$1.info(` Compression ratio: ${f.toFixed(1)}%`);}if(i.domainLookupEnd>0){let f=i.domainLookupEnd-i.domainLookupStart,l=i.connectEnd-i.connectStart,s=i.responseStart-i.requestStart,n=i.responseEnd-i.responseStart;Y$1.info(` Timing breakdown:`),f>0&&Y$1.info(` DNS lookup: ${lt$3(f)}`),l>0&&Y$1.info(` TCP connect: ${lt$3(l)}`),s>0&&Y$1.info(` Request: ${lt$3(s)}`),n>0&&Y$1.info(` Response: ${lt$3(n)}`);}}
|
|
66
66
|
|
|
67
|
-
var
|
|
67
|
+
var sdkDebugLogsD56SQjLs = /*#__PURE__*/Object.freeze({
|
|
68
68
|
__proto__: null,
|
|
69
69
|
printAllDebugLogs: x
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
performance.mark(`cooee-sdk-start`);var n=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Wn$1(),$n$1(),await x$1.initForMerchantWebsiteOnly(n),be$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Lr$1()&&Promise.resolve().then(function () { return
|
|
72
|
+
performance.mark(`cooee-sdk-start`);var n=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Wn$1(),$n$1(),await x$1.initForMerchantWebsiteOnly(n),be$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Lr$1()&&Promise.resolve().then(function () { return sdkDebugLogsD56SQjLs; }).then(({printAllDebugLogs:a})=>a(n)));
|
|
73
73
|
|
|
74
74
|
export { $r as $, A$1 as A, Sr as B, m as C, vs$1 as D, ve as E, Fr as F, pi$1 as G, He$1 as H, Ir$1 as I, bi$1 as J, ii$1 as K, Fs$1 as L, M$1 as M, Nn$1 as N, Se$1 as O, Ps$1 as P, ye$1 as Q, Ce$1 as R, S$1 as S, Me$1 as T, Ur as U, Ve$1 as V, W, X, De as Y, Vi$1 as Z, _e$1 as _, Mi$1 as a, $e$1 as a0, gr$1 as a1, He$2 as a2, qe$1 as a3, Re as a4, Fe$1 as a5, We$1 as a6, Je$1 as a7, Ae$2 as a8, ge$2 as a9, V$1 as b, H$1 as c, d$2 as d, Ve as e, Wr as f, Hr as g, yt as h, it as i, $t as j, Vr as k, le$3 as l, mt$1 as m, n$1 as n, nt$1 as o, We as p, Ai as q, f as r, He$3 as s, ki as t, ue$2 as u, v, we as w, U as x, ye$3 as y, q$1 as z };
|