@letscooee/web-sdk 14.5.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{debugger.component-VAKjYJ75-mISle5ta.js → debugger.component-G5BVxkMJ-DuUui40D.js} +1 -1
- package/dist/main.min.js +8 -8
- package/dist/{share-dialog.component-TtFJUngF-BpwQviBl.js → share-dialog.component-DcW7MDEd-CPumWlPJ.js} +2 -2
- package/dist/styles.min.css +1 -1
- package/dist/video-detail-dialog.component-4RQUemT7-D8d1eR9b.js +14 -0
- package/dist/widgets-ZT4wIqHS-C2ijp0OQ.js +45 -0
- package/package.json +1 -1
- package/dist/video-detail-dialog.component-DS3E5MCH-DpR4zZfn.js +0 -14
- package/dist/widgets-DlajwKJ4-DkCWbIFl.js +0 -45
- /package/dist/{renderer-DmvuOrY2-CoYiU0Ni.js → renderer-XxQ20sXb-CoYiU0Ni.js} +0 -0
package/dist/main.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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$4=Object.create;var g=Object.defineProperty,l$3=Object.defineProperties,m$2=Object.getOwnPropertyDescriptor,n$1=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,p$2=Object.getPrototypeOf,h$3=Object.prototype.hasOwnProperty,j$4=Object.prototype.propertyIsEnumerable;var i$1=(a,b,c)=>b in a?g(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c,r$2=(a,b)=>{for(var c in b||={})h$3.call(b,c)&&i$1(a,c,b[c]);if(f)for(var c of f(b))j$4.call(b,c)&&i$1(a,c,b[c]);return a},s$3=(a,b)=>l$3(a,n$1(b));var t$1=(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$1=(a,b)=>{var c={};for(var d in a)h$3.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$4.call(a,d)&&(c[d]=a[d]);return c};var v$1=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),w$4=(a,b)=>{for(var c in b)g(a,c,{get:b[c],enumerable:true});},q$3=(a,b,c,d)=>{if(b&&typeof b==`object`||typeof b==`function`)for(let e of o(b))!h$3.call(a,e)&&e!==c&&g(a,e,{get:()=>b[e],enumerable:!(d=m$2(b,e))||d.enumerable});return a};var x$3=(a,b,c)=>(c=a!=null?k$4(p$2(a)):{},q$3(!a||!a.__esModule?g(c,`default`,{value:a,enumerable:true}):c,a));
|
|
2
2
|
|
|
3
|
-
var lt$4=v$1((ft,Ve)=>{(function(s){if(typeof ft==`object`&&typeof Ve<`u`)Ve.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 u(v,I,w){function R(T,V){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;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,u,v,I,w);}return I[T].exports}for(var b=typeof t$1==`function`&&t$1,m=0;m<w.length;m++)R(w[m]);return R})({1:[function(u,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(u,v,I){var w=u(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(oe,le){A.resolve(oe).then(Se,function(ee){L||(L=true,b.reject(G,ee));});function Se(ee){U[le]=ee,++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(u,v,I){(function(w){typeof w.Promise!=`function`&&(w.Promise=u(2));}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{2:2}],4:[function(u,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`&&u(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]||$e(),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(c){var f=o.result;try{f.createObjectStore(e.storeName),c.oldVersion<=1&&f.createObjectStore(B);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+c.oldVersion+` to version `+c.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(c){c.preventDefault(),i(o.error);},o.onsuccess=function(){var c=o.result;c.onversionchange=function(f){f.target.close();},t(c),k(e);};})}function q(e){return G(e,false)}function oe(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 ee(e){return V([A(atob(e.data))],{type:e.type})}function We(e){return e&&e.__local_forage_encoded_blob}function Rt(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 Ct(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)?oe(e):o}).then(function(o){e.db=r.db=o;for(var c=0;c<t.length;c++)t[c]._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),oe(e)}).then(function(){return Ct(e).then(function(){K(e,r,t,i-1);})}).catch(t);t(o);}}function $e(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function At(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=$e(),F[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=Rt);var o=[];function c(){return p.resolve()}for(var f=0;f<a.forages.length;f++){var l=a.forages[f];l!==r&&o.push(l._initReady().catch(c));}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)?oe(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(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).get(e);d.onsuccess=function(){var g=d.result;g===void 0&&(g=null),We(g)&&(g=ee(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function xt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).openCursor(),g=1;d.onsuccess=function(){var E=d.result;if(E){var S=E.value;We(S)&&(S=ee(S));var N=e(S,E.key,g++);N!==void 0?a(N):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Lt(e,r,t){var i=this;e=O(e);var a=new p(function(o,c){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 c(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(){c(S.error?S.error:S.transaction.error);};}catch(N){c(N);}});}).catch(c);});return _(a,t),a}function Ot(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,y,function(c,f){if(c)return o(c);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 Pt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,y,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).clear();c.oncomplete=function(){i();},c.onabort=c.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.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 Mt(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(c,f){if(c)return o(c);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 Bt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.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 Ft(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 c=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=c.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(x,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(),x(H);};}).then(function(x){d.db=x;for(var M=0;M<g.length;M++){var P=g[M];P._dbInfo.db=x,k(P._dbInfo);}}).catch(function(x){throw ($(e,x)||p.resolve()).catch(function(){}),x})}}):a=c.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(N,x){var M=m.deleteDatabase(e.name);M.onerror=function(){var P=M.result;P&&P.close(),x(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(),N(P);};}).then(function(N){l.db=N;for(var x=0;x<d.length;x++){var M=d[x];k(M._dbInfo);}}).catch(function(N){throw ($(e,N)||p.resolve()).catch(function(){}),N})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:At,_support:T(),iterate:xt,getItem:Nt,setItem:Lt,removeItem:Ot,clear:Pt,length:Vt,key:Mt,keys:Bt,dropInstance:Ft};function kt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Wt=`~~local_forage_type~`,Ge=/^~~local_forage_type~([^~]+)~/,de=`__lfsc__:`,De=de.length,Re=`arbf`,Ce=`blob`,He=`si08`,Ye=`ui08`,je=`uic8`,ze=`si16`,qe=`si32`,Ke=`ur16`,Xe=`ui32`,Je=`fl32`,Qe=`fl64`,Ze=De+Re.length,et=Object.prototype.toString;function tt(e){var r=e.length*.75,t=e.length,i,a=0,o,c,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]),c=X.indexOf(e[i+1]),f=X.indexOf(e[i+2]),l=X.indexOf(e[i+3]),g[a++]=o<<2|c>>4,g[a++]=(c&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 $t(e,r){var t=``;if(e&&(t=et.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&et.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=de;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=He:t===`[object Uint8Array]`?a+=Ye:t===`[object Uint8ClampedArray]`?a+=je:t===`[object Int16Array]`?a+=ze:t===`[object Uint16Array]`?a+=Ke:t===`[object Int32Array]`?a+=qe:t===`[object Uint32Array]`?a+=Xe:t===`[object Float32Array]`?a+=Je:t===`[object Float64Array]`?a+=Qe: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 c=Wt+e.type+`~`+Ae(this.result);r(de+Ce+c);},o.readAsArrayBuffer(e);}else try{r(JSON.stringify(e));}catch(c){console.error(`Couldn't convert value into a JSON string: `,e),r(null,c);}}function Gt(e){if(e.substring(0,De)!==de)return JSON.parse(e);var r=e.substring(Ze),t=e.substring(De,Ze),i;if(t===Ce&&Ge.test(r)){var a=r.match(Ge);i=a[1],r=r.substring(a[0].length);}var o=tt(r);switch(t){case Re:return o;case Ce:return V([o],{type:i});case He:return new Int8Array(o);case Ye:return new Uint8Array(o);case je:return new Uint8ClampedArray(o);case ze:return new Int16Array(o);case Ke:return new Uint16Array(o);case qe:return new Int32Array(o);case Xe:return new Uint32Array(o);case Je:return new Float32Array(o);case Qe:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var Ne={serialize:$t,deserialize:Gt,stringToBuffer:tt,bufferToString:Ae};function rt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Ht(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,c){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return c(f)}t.db.transaction(function(f){rt(f,t,function(){r._dbInfo=t,o();},function(l,d){c(d);});},c);});return t.serializer=Ne,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(c,f){f.code===f.SYNTAX_ERR?c.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):rt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(c,f);},o);}function Yt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName+` WHERE key = ? LIMIT 1`,[e],function(l,d){var g=d.rows.length?d.rows.item(0).value:null;g&&(g=c.serializer.deserialize(g)),a(g);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function jt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var N=g.item(S),x=N.value;if(x&&(x=c.serializer.deserialize(x)),x=e(x,N.key,S+1),x!==void 0){a(x);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function nt(e,r,t,i){var a=this;e=O(e);var o=new p(function(c,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(){c(l);},function(N,x){f(x);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){c(nt.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function zt(e,r,t){return nt.apply(this,[e,r,t,1])}function qt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`DELETE FROM `+c.storeName+` WHERE key = ?`,[e],function(){a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Kt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Xt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,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 Jt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT key FROM `+c.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 Qt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,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 Zt(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 c=[],f=0;f<o.rows.length;f++)c.push(o.rows.item(f).name);r({db:e,storeNames:c});},function(a,o){t(o);});},function(i){t(i);});})}function er(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 c;e.name===t.name?c=i._dbInfo.db:c=openDatabase(e.name,``,``,0),e.storeName?o({db:c,storeNames:[e.storeName]}):o(Zt(c));}).then(function(o){return new p(function(c,f){o.db.transaction(function(l){function d(N){return new p(function(x,M){l.executeSql(`DROP TABLE IF EXISTS `+N,[],function(){x();},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(){c();}).catch(function(N){f(N);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var tr={_driver:`webSQLStorage`,_initStorage:Ht,_support:kt(),iterate:jt,getItem:Yt,setItem:zt,removeItem:qt,clear:Kt,length:Xt,key:Jt,keys:Qt,dropInstance:er};function rr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function ot(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function nr(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function or(){return !nr()||localStorage.length>0}function ir(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=ot(e,r._defaultConfig),or()?(r._dbInfo=t,t.serializer=Ne,p.resolve()):p.reject()}function ar(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 sr(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 ur(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,c=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(c),l++),E!==void 0)return E}}});return _(i,r),i}function cr(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 fr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],c=0;c<a;c++){var f=localStorage.key(c);f.indexOf(i.keyPrefix)===0&&o.push(f.substring(i.keyPrefix.length));}return o});return _(t,e),t}function lr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function dr(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 mr(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(c,f){var l=i._dbInfo;l.serializer.serialize(r,function(d,g){if(g)f(g);else try{localStorage.setItem(l.keyPrefix+e,d),c(o);}catch(E){(E.name===`QuotaExceededError`||E.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&f(E),f(E);}});})});return _(a,t),a}function gr(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(ot(e,i._defaultConfig)):o(e.name+`/`);}).then(function(o){for(var c=localStorage.length-1;c>=0;c--){var f=localStorage.key(c);f.indexOf(o)===0&&localStorage.removeItem(f);}}):a=p.reject(`Invalid arguments`),_(a,r),a}var pr={_driver:`localStorageWrapper`,_initStorage:ir,_support:rr(),iterate:ur,getItem:sr,setItem:mr,removeItem:dr,clear:ar,length:lr,key:cr,keys:fr,dropInstance:gr},hr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},vr=function(r,t){for(var i=r.length,a=0;a<i;){if(hr(r[a],t))return true;a++;}return false},it=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},ie={},at={},te={INDEXEDDB:Ut,WEBSQL:tr,LOCALSTORAGE:pr},yr=[te.INDEXEDDB._driver,te.WEBSQL._driver,te.LOCALSTORAGE._driver],me=[`dropInstance`],xe=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(me),Er={description:``,driver:yr.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function _r(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)&&(it(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 te)if(te.hasOwnProperty(t)){var i=te[t],a=i._driver;this[t]=a,ie[a]||this.defineDriver(i);}this._defaultConfig=Le({},Er),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(c,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=xe.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var N=g[E];if((!vr(me,N)||t[N])&&typeof t[N]!=`function`){f(d);return}}var M=function(){for(var ae=function(Ir){return function(){var Sr=new Error(`Method `+Ir+` is not implemented by the current driver`),st=p.reject(Sr);return _(st,arguments[arguments.length-1]),st}},Oe=0,wr=me.length;Oe<wr;Oe++){var Pe=me[Oe];t[Pe]||(t[Pe]=ae(Pe));}};M();var P=function(ae){ie[l]&&console.info(`Redefining LocalForage driver: `+l),ie[l]=t,at[l]=ae,c();};`_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=ie[t]?p.resolve(ie[t]):p.reject(new Error(`Driver not found.`));return C(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(Ne);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;it(t)||(t=[t]);var c=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 N(){for(;S<E.length;){var x=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(x).then(l).catch(N)}f();var M=new Error(`No available storage method found.`);return o._driverSet=p.reject(M),o._driverSet}return N()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=c[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(c);})}).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 !!at[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 c=t[a];this.supports(c)&&i.push(c);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=xe.length;t<i;t++)_r(this,xe[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var St$3=v$1((It,we)=>{(function(s){var n={};n.VERSION=`1.6.1`;var h,u={},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 u)u.hasOwnProperty(T)&&u[T].setLevel(m);},n.getLevel=function(){return b.getLevel()},n.get=function(m){return u[m]||(u[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 we<`u`&&we.exports?we.exports=n:(n._prevLogger=s.Logger,n.noConflict=function(){return s.Logger=n._prevLogger,n},s.Logger=n);})(It);});var Me$2=x$3(lt$4());function ge$4(s){return Me$2.default.createInstance({name:`lc`,storeName:s,driver:Me$2.default.LOCALSTORAGE})}var re$4=class re{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 ce$4=class ce extends re$4{static storeName=`usr`;static{this.storage=ge$4(this.storeName);}};var Be$3=`14.5.0`;var Rr$4=Be$3.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),qr$4=`WEB`,dt$3=`CooeeSDK`,Q$3=Be$3,Kr$4=parseInt(Rr$4,10);var Xr$3=[`collection`,`product`,`cart`],Jr$3=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],Qr$3=[`View Item`,`View Cart`,`View Collection`],Zr$3=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],en=`https://cdn.jsdelivr.net/npm/swiper@11`;var mt$4=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Q$3}/dist`,fe$3={apiURL:`https://api.sdk.letscooee.com`,cdnApiURL:`https://cdn.sdk1.api.letscooee.com`,debug:false,mode:`production`,baseURL:mt$4,styleURL:`${mt$4}/styles.min.css`};var pe$4=class pe{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((u,v)=>(n.hasOwnProperty(v)&&n[v]!=null&&u.push({[v]:n[v]}),u),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((h,u)=>(n[u]!==null&&n[u]!==void 0&&(h[u]=n[u]),h),{})}static stringify(n){return JSON.stringify(n,function(h,u){return u===void 0?null:u})}};var he$4=class he{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;checkoutProvider;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.checkoutProvider=n.checkoutProvider,this.widgetCustomisation=n.widgetCustomisation,this}};var ve$4=class ve extends re$4{static storeName=`ses`;static{this.storage=ge$4(this.storeName);}};var gt$3=5,Cr$4=500,ne$3=class ne 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 fn(s,n){let h=Date.now(),u;try{u=await Ar$4(s,n);}catch{}let v=u?new Request(u.url,{method:n?.method||`GET`}):new Request(s,n);if(!u||!u.ok){let m=`Failed to fetch`;u?.statusText&&(m+=`: ${u.statusText}`);let T=new ne$3(m);throw T.request=v,T.response=u?.clone(),T.status=u?.status,T.requestBody=n?.body,T.responseText=await pt$3(u),T}let I,w=(u.headers.get(`content-type`)||``).toLowerCase(),R=u.headers.get(`content-length`),b=n?.method?.toUpperCase()||`GET`;if(u.status===204||u.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 u.clone().json();}catch(m){let T=new ne$3(`Failed to parse JSON response: ${m?.message}`);throw T.request=v,T.response=u.clone(),T.status=u.status,T.requestBody=n?.body,T.responseText=await pt$3(u),T}else w.includes(`text/`)||w.includes(`image/svg+xml`)?I=await u.text():I=await u.arrayBuffer();return {data:I,status:u.status,statusText:u.statusText,headers:u.headers,timeTakenMs:Date.now()-h,options:n,request:v}}async function Ar$4(s,n){let h=null,u;for(let v=0;v<=gt$3;v++){try{if(u=await fetch(s,n),u.ok||u.status>=400&&u.status<500)return u;h=new Error(`Server error: ${u.status} ${u.statusText}`);}catch(I){h=I instanceof Error?I:new Error(String(I));}if(v<gt$3){let I=Math.pow(2,v)*Cr$4;Y$2.info(`Request to ${s} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(u&&!u.ok)return u;throw h||new Error(`Request failed after retries`)}async function pt$3(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var ye$4={},Ee$5,_e$3,vt$3,yt$2,ht$4;async function Et$3(){if(!_e$3)return ht$4??=Nr$4(),ht$4}async function Nr$4(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-CsOBIwiB.js');yt$2=n;_e$3=new s({dsn:`https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520`,transport:v,stackParser:h,integrations:u({}).filter(w=>![`BrowserApiErrors`,`Breadcrumbs`,`GlobalHandlers`].includes(w.name)),environment:fe$3.mode,release:`web-sdk@${Q$3}`,debug:fe$3.debug,sampleRate:.5}),_e$3.init();}function Fe$4(s,n,h){Y$2.error(`${n}:`,s),Et$3().then(()=>{let u=_t$4(h);if(u.setTag(`operation`,n),s instanceof ne$3){xr$4(u,s,n);return}u.captureException(s);});}function vn$1(s,n,h){Et$3().then(()=>{_t$4(h).captureMessage(s,n??`error`);});}function xr$4(s,n,h){if(Lr$3(s,n),n.response){let u=n.response,v=n.responseText;s.setTag(`error.message`,n.message),u.status!=null&&s.setTag(`http.status_code`,u.status),u.statusText&&s.setTag(`http.status_text`,u.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:u.statusText,responseType:u.type,redirected:u.redirected,responseUrl:u.url,originalError:n.message}),s.captureMessage(`${h} failed with ${u.status}`,`error`);return}if(n.request){s.captureMessage(`No response was received for ${h}`,`error`);return}}function Lr$3(s,n){let h=n.request;if(!h)return;s.setExtras({body:n.requestBody,headers:h.headers,method:h.method,url:h.url});let u=h.headers?.get(`Cooee-Retry-Attempt`);u!==null&&s.setTag(`retry.attempt`,u);}function yn(s){vt$3=s;}function En$1(s,n){ye$4[s]=r$2(r$2({},ye$4[s]),n);}function _n(s){Ee$5=r$2(r$2({},Ee$5),s);}function _t$4(s){s??={};let{extra:n,tags:h}=s,u=new yt$2;if(u.setClient(_e$3),u.setUser(vt$3),s.triggerContext&&!s.engagementTrigger&&(s.engagementTrigger=s.triggerContext.triggerData),s.engagementTrigger){let v=s.engagementTrigger;u.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&&u.setExtras(n),h&&u.setTags(h),Ee$5&&u.setTags(Ee$5),Object.keys(ye$4).forEach(v=>{u.setContext(v,ye$4[v]);}),u.setTag(`language`,navigator.language),u.setTag(`timezone`,bt$2()),Or$4(u),u}function Or$4(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));}var be$4=class be{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,u=`,`,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`+u)+(w[1]?v+w[1]:``)}};function In$1(s){return `(\u23F0 took: ${Ue$1(s)})`}function Ue$1(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 ke$1(){return window.CooeeSDK.runtimeData}function Rn(){return Ue$1(Date.now()-ke$1().sdkLoadTime.getTime())}function Un$1(s){try{return new URL(s)}catch{return}}function kn(s){return !s||s===`null`||s===`undefined`}function Wn$1(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function $n$1(s,n,h){return {[s]:Pr$4(n,h),[s+`_wo_currency`]:n}}function Pr$4(s,n){if(s==0&&n)return `Free`;let h=ke$1(),u=he$4.get(),v=h.shopCurrencyCode||u.currency,I=h.currencyCode;I||Y$2.warn(`Currency code is not set in RuntimeData`);let w=u.money?.format??h.moneyFormat,R;if(w&&v===I&&!u.money?.auto)R=be$4.format(s*100,w);else {let b={style:`currency`,currency:I||v,minimumFractionDigits:2,maximumFractionDigits:2,trailingZeroDisplay:`stripIfInteger`},m;try{m=new Intl.NumberFormat(Tt$1(),b);}catch(T){return Fe$4(T,`format-currency`,{extra:{currentCurrency:I,shopCurrency:v}}),``}R=m.format(s),R=R.replace(`₹`,`Rs. `),u.money?.showCurrency&&I!==`INR`&&(R=R.concat(` ${I}`));}return R}function Gn$1(s){let n=Tt$1();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return Fe$4(h,`format-number`,{extra:{lang:n,value:s}}),s.toString()}}function Tt$1(){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 Te$2;function bt$2(){if(Te$2)return Te$2;try{return Te$2=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$2}catch{return ``}}function wt$2(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function Hn$1(s){let n=document.createElement(`span`);n.id=`snackbar`,n.innerText=s,document.body.appendChild(n),n.className=`cooee-snackbar show`,setTimeout(()=>{n.classList.remove(`show`),document.body.removeChild(n);},5e3);}async function Vr$4(s,n=7,h=document){let u=1,v=document.querySelectorAll(`nonexistent-tag`);for(;u<=n;){let I=Math.min(50*2**u,1e3);if(u>1&&await pe$4.sleep(I),v=h.querySelectorAll(s),v.length)return Y$2.verbose(`Attempt ${u}: ${v.length} elements found with ${s}`),v;Y$2.verbose(`Attempt ${u}: Elements not found with ${s}. Will retry after ${I}ms.`),u++;}return Y$2.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${s}.`),v}async function Yn$1(s,n=10,h=document){return (await Vr$4(s,n,h)).item(0)}async function Mr$4(s){let[n,h,u]=await Promise.all([ce$4.get(`did`),ve$4.get(`id`,``),ce$4.get(`sessionNumber`,1)]),v={letscooee_did:n,letscooee_sid:h,letscooee_sn:`${u}`,__letscooee_time:new Date().toLocaleString()};return s&&(v.__letscooee_via=s),v}async function jn$1(s){let n=await Mr$4(s);return Object.entries(n).map(([h,u])=>({key:h,value:u.toString()}))}function zn$1(s,n,h,u=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:u,value:h});}function qn$1(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`}}var W$2=x$3(St$3());var Y$2=class Y{static debuggerEl;static infoLogs=[];static log(...n){W$2.default.info(...n);}static verbose(...n){W$2.default.debug(...n);}static error(...n){W$2.default.error(...n);}static warn(...n){W$2.default.warn(...n);}static info(...n){W$2.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W$2.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 Zn$1(s=dt$3){W$2.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q$3}):`);}}),Br$4()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W$2.default.setLevel(W$2.default[localStorage.cooeeLogLevel]):W$2.default.setLevel(W$2.default.OFF);}function Br$4(){let s=Dt$2();return s===`1`||s===`on`}function Dt$2(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function eo$1(){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 lt$4=v$1((ft,Ve)=>{(function(s){if(typeof ft==`object`&&typeof Ve<`u`)Ve.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 u(v,I,w){function R(T,V){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;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,u,v,I,w);}return I[T].exports}for(var b=typeof t$1==`function`&&t$1,m=0;m<w.length;m++)R(w[m]);return R})({1:[function(u,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 M=w.document.createElement(`script`);M.onreadystatechange=function(){O(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null;},w.document.documentElement.appendChild(M);}:b=function(){setTimeout(O,0);};var _,C=[];function O(){_=true;for(var M,z,F=C.length;F;){for(z=C,C=[],M=-1;++M<F;)z[M]();F=C.length;}_=false;}v.exports=j;function j(M){C.push(M)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(u,v,I){var w=u(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=M(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 $=M(k);$.status===`error`&&L($.value);}function M(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(oe,le){A.resolve(oe).then(Se,function(ee){L||(L=true,b.reject(G,ee));});function Se(ee){U[le]=ee,++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(u,v,I){(function(w){typeof w.Promise!=`function`&&(w.Promise=u(2));}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{2:2}],4:[function(u,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`&&u(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 M=`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(M,y),i=V([``]);t.objectStore(M).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]||$e(),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(c){var f=o.result;try{f.createObjectStore(e.storeName),c.oldVersion<=1&&f.createObjectStore(M);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+c.oldVersion+` to version `+c.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(c){c.preventDefault(),i(o.error);},o.onsuccess=function(){var c=o.result;c.onversionchange=function(f){f.target.close();},t(c),k(e);};})}function q(e){return G(e,false)}function oe(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 ee(e){return V([A(atob(e.data))],{type:e.type})}function We(e){return e&&e.__local_forage_encoded_blob}function Rt(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 Ct(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)?oe(e):o}).then(function(o){e.db=r.db=o;for(var c=0;c<t.length;c++)t[c]._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),oe(e)}).then(function(){return Ct(e).then(function(){K(e,r,t,i-1);})}).catch(t);t(o);}}function $e(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function At(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=$e(),F[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=Rt);var o=[];function c(){return p.resolve()}for(var f=0;f<a.forages.length;f++){var l=a.forages[f];l!==r&&o.push(l._initReady().catch(c));}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)?oe(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(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).get(e);d.onsuccess=function(){var g=d.result;g===void 0&&(g=null),We(g)&&(g=ee(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function xt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).openCursor(),g=1;d.onsuccess=function(){var E=d.result;if(E){var S=E.value;We(S)&&(S=ee(S));var N=e(S,E.key,g++);N!==void 0?a(N):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Lt(e,r,t){var i=this;e=O(e);var a=new p(function(o,c){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 c(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(){c(S.error?S.error:S.transaction.error);};}catch(N){c(N);}});}).catch(c);});return _(a,t),a}function Ot(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){K(t._dbInfo,y,function(c,f){if(c)return o(c);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 Pt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,y,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).clear();c.oncomplete=function(){i();},c.onabort=c.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.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(c,f){if(c)return o(c);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 Mt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){K(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.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 Ft(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 c=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=c.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(x,B){var P=m.open(e.name,l);P.onerror=function(H){P.result.close(),B(H);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var H=P.result;H.close(),x(H);};}).then(function(x){d.db=x;for(var B=0;B<g.length;B++){var P=g[B];P._dbInfo.db=x,k(P._dbInfo);}}).catch(function(x){throw ($(e,x)||p.resolve()).catch(function(){}),x})}}):a=c.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(N,x){var B=m.deleteDatabase(e.name);B.onerror=function(){var P=B.result;P&&P.close(),x(B.error);},B.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},B.onsuccess=function(){var P=B.result;P&&P.close(),N(P);};}).then(function(N){l.db=N;for(var x=0;x<d.length;x++){var B=d[x];k(B._dbInfo);}}).catch(function(N){throw ($(e,N)||p.resolve()).catch(function(){}),N})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:At,_support:T(),iterate:xt,getItem:Nt,setItem:Lt,removeItem:Ot,clear:Pt,length:Vt,key:Bt,keys:Mt,dropInstance:Ft};function kt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Wt=`~~local_forage_type~`,Ge=/^~~local_forage_type~([^~]+)~/,de=`__lfsc__:`,De=de.length,Re=`arbf`,Ce=`blob`,He=`si08`,Ye=`ui08`,je=`uic8`,ze=`si16`,qe=`si32`,Ke=`ur16`,Xe=`ui32`,Je=`fl32`,Qe=`fl64`,Ze=De+Re.length,et=Object.prototype.toString;function tt(e){var r=e.length*.75,t=e.length,i,a=0,o,c,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]),c=X.indexOf(e[i+1]),f=X.indexOf(e[i+2]),l=X.indexOf(e[i+3]),g[a++]=o<<2|c>>4,g[a++]=(c&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 $t(e,r){var t=``;if(e&&(t=et.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&et.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=de;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=He:t===`[object Uint8Array]`?a+=Ye:t===`[object Uint8ClampedArray]`?a+=je:t===`[object Int16Array]`?a+=ze:t===`[object Uint16Array]`?a+=Ke:t===`[object Int32Array]`?a+=qe:t===`[object Uint32Array]`?a+=Xe:t===`[object Float32Array]`?a+=Je:t===`[object Float64Array]`?a+=Qe: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 c=Wt+e.type+`~`+Ae(this.result);r(de+Ce+c);},o.readAsArrayBuffer(e);}else try{r(JSON.stringify(e));}catch(c){console.error(`Couldn't convert value into a JSON string: `,e),r(null,c);}}function Gt(e){if(e.substring(0,De)!==de)return JSON.parse(e);var r=e.substring(Ze),t=e.substring(De,Ze),i;if(t===Ce&&Ge.test(r)){var a=r.match(Ge);i=a[1],r=r.substring(a[0].length);}var o=tt(r);switch(t){case Re:return o;case Ce:return V([o],{type:i});case He:return new Int8Array(o);case Ye:return new Uint8Array(o);case je:return new Uint8ClampedArray(o);case ze:return new Int16Array(o);case Ke:return new Uint16Array(o);case qe:return new Int32Array(o);case Xe:return new Uint32Array(o);case Je:return new Float32Array(o);case Qe:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var Ne={serialize:$t,deserialize:Gt,stringToBuffer:tt,bufferToString:Ae};function rt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Ht(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,c){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return c(f)}t.db.transaction(function(f){rt(f,t,function(){r._dbInfo=t,o();},function(l,d){c(d);});},c);});return t.serializer=Ne,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(c,f){f.code===f.SYNTAX_ERR?c.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):rt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(c,f);},o);}function Yt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName+` WHERE key = ? LIMIT 1`,[e],function(l,d){var g=d.rows.length?d.rows.item(0).value:null;g&&(g=c.serializer.deserialize(g)),a(g);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function jt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var N=g.item(S),x=N.value;if(x&&(x=c.serializer.deserialize(x)),x=e(x,N.key,S+1),x!==void 0){a(x);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function nt(e,r,t,i){var a=this;e=O(e);var o=new p(function(c,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(){c(l);},function(N,x){f(x);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){c(nt.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function zt(e,r,t){return nt.apply(this,[e,r,t,1])}function qt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`DELETE FROM `+c.storeName+` WHERE key = ?`,[e],function(){a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Kt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Xt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,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 Jt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT key FROM `+c.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 Qt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,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 Zt(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 c=[],f=0;f<o.rows.length;f++)c.push(o.rows.item(f).name);r({db:e,storeNames:c});},function(a,o){t(o);});},function(i){t(i);});})}function er(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 c;e.name===t.name?c=i._dbInfo.db:c=openDatabase(e.name,``,``,0),e.storeName?o({db:c,storeNames:[e.storeName]}):o(Zt(c));}).then(function(o){return new p(function(c,f){o.db.transaction(function(l){function d(N){return new p(function(x,B){l.executeSql(`DROP TABLE IF EXISTS `+N,[],function(){x();},function(P,H){B(H);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){c();}).catch(function(N){f(N);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var tr={_driver:`webSQLStorage`,_initStorage:Ht,_support:kt(),iterate:jt,getItem:Yt,setItem:zt,removeItem:qt,clear:Kt,length:Xt,key:Jt,keys:Qt,dropInstance:er};function rr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function ot(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function nr(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function or(){return !nr()||localStorage.length>0}function ir(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=ot(e,r._defaultConfig),or()?(r._dbInfo=t,t.serializer=Ne,p.resolve()):p.reject()}function ar(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 sr(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 ur(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,c=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(c),l++),E!==void 0)return E}}});return _(i,r),i}function cr(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 fr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],c=0;c<a;c++){var f=localStorage.key(c);f.indexOf(i.keyPrefix)===0&&o.push(f.substring(i.keyPrefix.length));}return o});return _(t,e),t}function lr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function dr(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 mr(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(c,f){var l=i._dbInfo;l.serializer.serialize(r,function(d,g){if(g)f(g);else try{localStorage.setItem(l.keyPrefix+e,d),c(o);}catch(E){(E.name===`QuotaExceededError`||E.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&f(E),f(E);}});})});return _(a,t),a}function gr(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(ot(e,i._defaultConfig)):o(e.name+`/`);}).then(function(o){for(var c=localStorage.length-1;c>=0;c--){var f=localStorage.key(c);f.indexOf(o)===0&&localStorage.removeItem(f);}}):a=p.reject(`Invalid arguments`),_(a,r),a}var pr={_driver:`localStorageWrapper`,_initStorage:ir,_support:rr(),iterate:ur,getItem:sr,setItem:mr,removeItem:dr,clear:ar,length:lr,key:cr,keys:fr,dropInstance:gr},hr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},vr=function(r,t){for(var i=r.length,a=0;a<i;){if(hr(r[a],t))return true;a++;}return false},it=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},ie={},at={},te={INDEXEDDB:Ut,WEBSQL:tr,LOCALSTORAGE:pr},yr=[te.INDEXEDDB._driver,te.WEBSQL._driver,te.LOCALSTORAGE._driver],me=[`dropInstance`],xe=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(me),Er={description:``,driver:yr.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function _r(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)&&(it(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 te)if(te.hasOwnProperty(t)){var i=te[t],a=i._driver;this[t]=a,ie[a]||this.defineDriver(i);}this._defaultConfig=Le({},Er),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(c,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=xe.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var N=g[E];if((!vr(me,N)||t[N])&&typeof t[N]!=`function`){f(d);return}}var B=function(){for(var ae=function(Ir){return function(){var Sr=new Error(`Method `+Ir+` is not implemented by the current driver`),st=p.reject(Sr);return _(st,arguments[arguments.length-1]),st}},Oe=0,wr=me.length;Oe<wr;Oe++){var Pe=me[Oe];t[Pe]||(t[Pe]=ae(Pe));}};B();var P=function(ae){ie[l]&&console.info(`Redefining LocalForage driver: `+l),ie[l]=t,at[l]=ae,c();};`_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=ie[t]?p.resolve(ie[t]):p.reject(new Error(`Driver not found.`));return C(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(Ne);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;it(t)||(t=[t]);var c=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 N(){for(;S<E.length;){var x=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(x).then(l).catch(N)}f();var B=new Error(`No available storage method found.`);return o._driverSet=p.reject(B),o._driverSet}return N()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=c[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(c);})}).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 !!at[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 c=t[a];this.supports(c)&&i.push(c);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=xe.length;t<i;t++)_r(this,xe[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var St$3=v$1((It,we)=>{(function(s){var n={};n.VERSION=`1.6.1`;var h,u={},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 u)u.hasOwnProperty(T)&&u[T].setLevel(m);},n.getLevel=function(){return b.getLevel()},n.get=function(m){return u[m]||(u[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 we<`u`&&we.exports?we.exports=n:(n._prevLogger=s.Logger,n.noConflict=function(){return s.Logger=n._prevLogger,n},s.Logger=n);})(It);});var Be$3=x$3(lt$4());function ge$4(s){return Be$3.default.createInstance({name:`lc`,storeName:s,driver:Be$3.default.LOCALSTORAGE})}var re$4=class re{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 ce$4=class ce extends re$4{static storeName=`usr`;static{this.storage=ge$4(this.storeName);}};var Me$2=`14.7.0`;var Rr$4=Me$2.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),qr$4=`WEB`,dt$3=`CooeeSDK`,Q$3=Me$2,Kr$4=parseInt(Rr$4,10);var Xr$3=[`collection`,`product`,`cart`],Jr$3=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],Qr$3=[`View Item`,`View Cart`,`View Collection`],Zr$3=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],en=`https://cdn.jsdelivr.net/npm/swiper@11`;var mt$4=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Q$3}/dist`,fe$3={apiURL:`https://api.sdk.letscooee.com`,cdnApiURL:`https://cdn.sdk1.api.letscooee.com`,debug:false,mode:`production`,baseURL:mt$4,styleURL:`${mt$4}/styles.min.css`};var pe$4=class pe{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((u,v)=>(n.hasOwnProperty(v)&&n[v]!=null&&u.push({[v]:n[v]}),u),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((h,u)=>(n[u]!==null&&n[u]!==void 0&&(h[u]=n[u]),h),{})}static stringify(n){return JSON.stringify(n,function(h,u){return u===void 0?null:u})}};var he$4=class he{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;checkoutProvider;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.checkoutProvider=n.checkoutProvider,this.widgetCustomisation=n.widgetCustomisation,this}};var ve$4=class ve extends re$4{static storeName=`ses`;static{this.storage=ge$4(this.storeName);}};var gt$3=5,Cr$4=500,ne$3=class ne 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 fn(s,n){let h=Date.now(),u;try{u=await Ar$4(s,n);}catch{}let v=u?new Request(u.url,{method:n?.method||`GET`}):new Request(s,n);if(!u||!u.ok){let m=`Failed to fetch`;u?.statusText&&(m+=`: ${u.statusText}`);let T=new ne$3(m);throw T.request=v,T.response=u?.clone(),T.status=u?.status,T.requestBody=n?.body,T.responseText=await pt$3(u),T}let I,w=(u.headers.get(`content-type`)||``).toLowerCase(),R=u.headers.get(`content-length`),b=n?.method?.toUpperCase()||`GET`;if(u.status===204||u.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 u.clone().json();}catch(m){let T=new ne$3(`Failed to parse JSON response: ${m?.message}`);throw T.request=v,T.response=u.clone(),T.status=u.status,T.requestBody=n?.body,T.responseText=await pt$3(u),T}else w.includes(`text/`)||w.includes(`image/svg+xml`)?I=await u.text():I=await u.arrayBuffer();return {data:I,status:u.status,statusText:u.statusText,headers:u.headers,timeTakenMs:Date.now()-h,options:n,request:v}}async function Ar$4(s,n){let h=null,u;for(let v=0;v<=gt$3;v++){try{if(u=await fetch(s,n),u.ok||u.status>=400&&u.status<500)return u;h=new Error(`Server error: ${u.status} ${u.statusText}`);}catch(I){h=I instanceof Error?I:new Error(String(I));}if(v<gt$3){let I=Math.pow(2,v)*Cr$4;Y$2.info(`Request to ${s} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(u&&!u.ok)return u;throw h||new Error(`Request failed after retries`)}async function pt$3(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var ye$4={},Ee$5,_e$3,vt$3,yt$2,ht$4;async function Et$3(){if(!_e$3)return ht$4??=Nr$4(),ht$4}async function Nr$4(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-CsOBIwiB.js');yt$2=n;_e$3=new s({dsn:`https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520`,transport:v,stackParser:h,integrations:u({}).filter(w=>![`BrowserApiErrors`,`Breadcrumbs`,`GlobalHandlers`].includes(w.name)),environment:fe$3.mode,release:`web-sdk@${Q$3}`,debug:fe$3.debug,sampleRate:.5}),_e$3.init();}function Fe$4(s,n,h){Y$2.error(`${n}:`,s),Et$3().then(()=>{let u=_t$4(h);if(u.setTag(`operation`,n),s instanceof ne$3){xr$4(u,s,n);return}u.captureException(s);});}function vn$1(s,n,h){Et$3().then(()=>{_t$4(h).captureMessage(s,n??`error`);});}function xr$4(s,n,h){if(Lr$3(s,n),n.response){let u=n.response,v=n.responseText;s.setTag(`error.message`,n.message),u.status!=null&&s.setTag(`http.status_code`,u.status),u.statusText&&s.setTag(`http.status_text`,u.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:u.statusText,responseType:u.type,redirected:u.redirected,responseUrl:u.url,originalError:n.message}),s.captureMessage(`${h} failed with ${u.status}`,`error`);return}if(n.request){s.captureMessage(`No response was received for ${h}`,`error`);return}}function Lr$3(s,n){let h=n.request;if(!h)return;s.setExtras({body:n.requestBody,headers:h.headers,method:h.method,url:h.url});let u=h.headers?.get(`Cooee-Retry-Attempt`);u!==null&&s.setTag(`retry.attempt`,u);}function yn(s){vt$3=s;}function En$1(s,n){ye$4[s]=r$2(r$2({},ye$4[s]),n);}function _n(s){Ee$5=r$2(r$2({},Ee$5),s);}function _t$4(s){s??={};let{extra:n,tags:h}=s,u=new yt$2;if(u.setClient(_e$3),u.setUser(vt$3),s.triggerContext&&!s.engagementTrigger&&(s.engagementTrigger=s.triggerContext.triggerData),s.engagementTrigger){let v=s.engagementTrigger;u.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&&u.setExtras(n),h&&u.setTags(h),Ee$5&&u.setTags(Ee$5),Object.keys(ye$4).forEach(v=>{u.setContext(v,ye$4[v]);}),u.setTag(`language`,navigator.language),u.setTag(`timezone`,bt$2()),Or$4(u),u}function Or$4(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));}var be$4=class be{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,u=`,`,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`+u)+(w[1]?v+w[1]:``)}};function In$1(s){return `(\u23F0 took: ${Ue$1(s)})`}function Ue$1(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 ke$1(){return window.CooeeSDK.runtimeData}function Rn(){return Ue$1(Date.now()-ke$1().sdkLoadTime.getTime())}function Un$1(s){try{return new URL(s)}catch{return}}function kn(s){return !s||s===`null`||s===`undefined`}function Wn$1(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function $n$1(s,n,h){return {[s]:Pr$4(n,h),[s+`_wo_currency`]:n}}function Pr$4(s,n){if(s==0&&n)return `Free`;let h=ke$1(),u=he$4.get(),v=h.shopCurrencyCode||u.currency,I=h.currencyCode;I||Y$2.warn(`Currency code is not set in RuntimeData`);let w=u.money?.format??h.moneyFormat,R;if(w&&v===I&&!u.money?.auto)R=be$4.format(s*100,w);else {let b={style:`currency`,currency:I||v,minimumFractionDigits:2,maximumFractionDigits:2,trailingZeroDisplay:`stripIfInteger`},m;try{m=new Intl.NumberFormat(Tt$1(),b);}catch(T){return Fe$4(T,`format-currency`,{extra:{currentCurrency:I,shopCurrency:v}}),``}R=m.format(s),R=R.replace(`₹`,`Rs. `),u.money?.showCurrency&&I!==`INR`&&(R=R.concat(` ${I}`));}return R}function Gn$1(s){let n=Tt$1();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return Fe$4(h,`format-number`,{extra:{lang:n,value:s}}),s.toString()}}function Tt$1(){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 Te$2;function bt$2(){if(Te$2)return Te$2;try{return Te$2=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$2}catch{return ``}}function wt$2(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function Hn$1(s){let n=document.createElement(`span`);n.id=`snackbar`,n.innerText=s,document.body.appendChild(n),n.className=`cooee-snackbar show`,setTimeout(()=>{n.classList.remove(`show`),document.body.removeChild(n);},5e3);}async function Vr$4(s,n=7,h=document){let u=1,v=document.querySelectorAll(`nonexistent-tag`);for(;u<=n;){let I=Math.min(50*2**u,1e3);if(u>1&&await pe$4.sleep(I),v=h.querySelectorAll(s),v.length)return Y$2.verbose(`Attempt ${u}: ${v.length} elements found with ${s}`),v;Y$2.verbose(`Attempt ${u}: Elements not found with ${s}. Will retry after ${I}ms.`),u++;}return Y$2.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${s}.`),v}async function Yn$1(s,n=10,h=document){return (await Vr$4(s,n,h)).item(0)}async function Br$4(s){let[n,h,u]=await Promise.all([ce$4.get(`did`),ve$4.get(`id`,``),ce$4.get(`sessionNumber`,1)]),v={letscooee_did:n,letscooee_sid:h,letscooee_sn:`${u}`,__letscooee_time:new Date().toLocaleString()};return s&&(v.__letscooee_via=s),v}async function jn$1(s){let n=await Br$4(s);return Object.entries(n).map(([h,u])=>({key:h,value:u.toString()}))}function zn$1(s,n,h,u=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:u,value:h});}function qn$1(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`}}var W$2=x$3(St$3());var Y$2=class Y{static debuggerEl;static infoLogs=[];static log(...n){W$2.default.info(...n);}static verbose(...n){W$2.default.debug(...n);}static error(...n){W$2.default.error(...n);}static warn(...n){W$2.default.warn(...n);}static info(...n){W$2.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W$2.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 Zn$1(s=dt$3){W$2.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q$3}):`);}}),Mr$4()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W$2.default.setLevel(W$2.default[localStorage.cooeeLogLevel]):W$2.default.setLevel(W$2.default.OFF);}function Mr$4(){let s=Dt$2();return s===`1`||s===`on`}function Dt$2(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function eo$1(){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
|
|
@@ -9,7 +9,7 @@ var lt$4=v$1((ft,Ve)=>{(function(s){if(typeof ft==`object`&&typeof Ve<`u`)Ve.exp
|
|
|
9
9
|
|
|
10
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$3}`),console.groupEnd(),Y$2.info(`SDK v${Q$3} loaded`);}function to$1(){let s=localStorage.getItem(`cooeeDebugTill`),n=Dt$2();if(n===`1`||n===`on`){let h=Ur$3();s||(s=h.toString(),localStorage.setItem(`cooeeDebugTill`,s));}n===`on`?sessionStorage.cooeeDebug=`1`:n===`off`&&sessionStorage.removeItem(`cooeeDebug`),sessionStorage.cooeeDebug&&Fr$2(),s&&new Date(+s)<new Date&&localStorage.removeItem(`cooeeDebugTill`);}function Fr$2(){let s=document.createElement(`cooee-debugger`);wt$2(()=>{document.body.appendChild(s);});}function Ur$3(){return new Date().getTime()+360*60*1e3}
|
|
11
11
|
|
|
12
|
-
var K$3=`a-f\\d`,kr$4=`#?[${K$3}]{3}[${K$3}]?`,Gr$3=`#?[${K$3}]{6}([${K$3}]{2})?`,Br$3=new RegExp(`[^#${K$3}]`,`gi`),Wr$3=new RegExp(`^${kr$4}$|^${Gr$3}$`,`i`);function xt$1(r,t={}){if(typeof r!=`string`||Br$3.test(r)||!Wr$3.test(r))throw new TypeError(`Expected a valid hex string`);r=r.replace(/^#/,``);let e=1;r.length===8&&(e=Number.parseInt(r.slice(6,8),16)/255,r=r.slice(0,6)),r.length===4&&(e=Number.parseInt(r.slice(3,4).repeat(2),16)/255,r=r.slice(0,3)),r.length===3&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]);let i=Number.parseInt(r,16),n=i>>16,o=i>>8&255,_=i&255,u=typeof t.alpha==`number`?t.alpha:e;if(t.format===`array`)return [n,o,_,u];if(t.format===`css`)return `rgb(${n} ${o} ${_}${u===1?``:` / ${Number((u*100).toFixed(2))}%`})`;return {red:n,green:o,blue:_,alpha:u}}var I$2=class I{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g;}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return ``;try{return xt$1(this.hex,{format:`css`,alpha:this.getAlpha()})}catch(t){return console.error(`Invalid hex`,t),`#000000`}}getAlpha(){return (this.a??100)/100}};var P$2=class P{s;g;i;constructor(t){t.s&&(this.s=new I$2(t.s)),t.g&&(this.g=new z$5(t.g)),this.i=t.i;}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var C$4=class C{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new I$2(t.c));}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return rr$4[this.s??1]}},rr$4=(e=>(e[e.SOLID=1]=`SOLID`,e[e.DASHED=2]=`DASHED`,e))(rr$4||{});var z$5=class r{static DEFAULT_FALLBACK=new I$2({h:`#000000`,a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new I$2(t.c)),t.fb&&(this.fb=new I$2(t.fb));}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??r.DEFAULT_FALLBACK}};var Q$2=class Q{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new I$2(t.clr);}getStyle(t){return `${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}};var T$1=class T{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??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 X$3=class X{rot;constructor(t){t?.rot&&(this.rot=t.rot);}get rotate(){return this.rot}},st$2,p$1,sr$3,Ct$2,w$3,er$4,_r$4,ur$4,lr$4,Tt,At$1,Pt$1,j$3={},fr$3=[],Fr$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_t$3=Array.isArray;function A$3(r,t){for(var e in t)r[e]=t[e];return r}function wt$1(r){r&&r.parentNode&&r.parentNode.removeChild(r);}function Yr$2(r,t,e){var i,n,o,_={};for(o in t)o==`key`?i=t[o]:o==`ref`?n=t[o]:_[o]=t[o];if(arguments.length>2&&(_.children=arguments.length>3?st$2.call(arguments,2):e),typeof r==`function`&&r.defaultProps!=null)for(o in r.defaultProps)_[o]===void 0&&(_[o]=r.defaultProps[o]);return nt$1(r,_,i,n,null)}function nt$1(r,t,e,i,n){var o={type:r,props:t,key:e,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++sr$3,__i:-1,__u:0};return n==null&&p$1.vnode!=null&&p$1.vnode(o),o}function ut$3(r){return r.children}function D$1(r,t){this.props=r,this.context=t;}function U$1(r,t){if(t==null)return r.__?U$1(r.__,r.__i+1):null;for(var e;t<r.__k.length;t++)if((e=r.__k[t])!=null&&e.__e!=null)return e.__e;return typeof r.type==`function`?U$1(r):null}function cr$3(r){var t,e;if((r=r.__)!=null&&r.__c!=null){for(r.__e=r.__c.base=null,t=0;t<r.__k.length;t++)if((e=r.__k[t])!=null&&e.__e!=null){r.__e=r.__c.base=e.__e;break}return cr$3(r)}}function ir$4(r){(!r.__d&&(r.__d=true)&&w$3.push(r)&&!ot$2.__r++||er$4!=p$1.debounceRendering)&&((er$4=p$1.debounceRendering)||_r$4)(ot$2);}function ot$2(){for(var r,t,e,i,n,o,_,u=1;w$3.length;)w$3.length>u&&w$3.sort(ur$4),r=w$3.shift(),u=w$3.length,r.__d&&(e=void 0,n=(i=(t=r).__v).__e,o=[],_=[],t.__P&&((e=A$3({},i)).__v=i.__v+1,p$1.vnode&&p$1.vnode(e),Dt$1(t.__P,e,i,t.__n,t.__P.namespaceURI,32&i.__u?[n]:null,o,n??U$1(i),!!(32&i.__u),_),e.__v=i.__v,e.__.__k[e.__i]=e,pr$4(o,e,_),e.__e!=n&&cr$3(e)));ot$2.__r=0;}function ar$4(r,t,e,i,n,o,_,u,l,f,h){var s,E,a,g,b,O,m=i&&i.__k||fr$3,v=t.length;for(l=Kr$3(e,t,m,l,v),s=0;s<v;s++)(a=e.__k[s])!=null&&(E=a.__i==-1?j$3:m[a.__i]||j$3,a.__i=s,O=Dt$1(r,a,E,n,o,_,u,l,f,h),g=a.__e,a.ref&&E.ref!=a.ref&&(E.ref&&Ut$1(E.ref,null,a),h.push(a.ref,a.__c||g,a)),b==null&&g!=null&&(b=g),4&a.__u||E.__k===a.__k?l=hr$4(a,l,r):typeof a.type==`function`&&O!==void 0?l=O:g&&(l=g.nextSibling),a.__u&=-7);return e.__e=b,l}function Kr$3(r,t,e,i,n){var o,_,u,l,f,h=e.length,s=h,E=0;for(r.__k=new Array(n),o=0;o<n;o++)(_=t[o])!=null&&typeof _!=`boolean`&&typeof _!=`function`?(l=o+E,(_=r.__k[o]=typeof _==`string`||typeof _==`number`||typeof _==`bigint`||_.constructor==String?nt$1(null,_,null,null,null):_t$3(_)?nt$1(ut$3,{children:_},null,null,null):_.constructor==null&&_.__b>0?nt$1(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_).__=r,_.__b=r.__b+1,u=null,(f=_.__i=zr$2(_,e,l,s))!=-1&&(s--,(u=e[f])&&(u.__u|=2)),u==null||u.__v==null?(f==-1&&(n>h?E--:n<h&&E++),typeof _.type!=`function`&&(_.__u|=4)):f!=l&&(f==l-1?E--:f==l+1?E++:(f>l?E--:E++,_.__u|=4))):r.__k[o]=null;if(s)for(o=0;o<h;o++)(u=e[o])!=null&&!(2&u.__u)&&(u.__e==i&&(i=U$1(u)),mr$4(u,u));return i}function hr$4(r,t,e){var i,n;if(typeof r.type==`function`){for(i=r.__k,n=0;i&&n<i.length;n++)i[n]&&(i[n].__=r,t=hr$4(i[n],t,e));return t}r.__e!=t&&(t&&r.type&&!e.contains(t)&&(t=U$1(r)),e.insertBefore(r.__e,t||null),t=r.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function zr$2(r,t,e,i){var n,o,_=r.key,u=r.type,l=t[e];if(l===null&&r.key==null||l&&_==l.key&&u==l.type&&(2&l.__u)==0)return e;if(i>(l!=null&&(2&l.__u)==0?1:0))for(n=e-1,o=e+1;n>=0||o<t.length;){if(n>=0){if((l=t[n])&&(2&l.__u)==0&&_==l.key&&u==l.type)return n;n--;}if(o<t.length){if((l=t[o])&&(2&l.__u)==0&&_==l.key&&u==l.type)return o;o++;}}return -1}function nr$4(r,t,e){t[0]==`-`?r.setProperty(t,e??``):r[t]=e==null?``:typeof e!=`number`||Fr$1.test(t)?e:e+`px`;}function it$1(r,t,e,i,n){var o,_;t:if(t==`style`)if(typeof e==`string`)r.style.cssText=e;else {if(typeof i==`string`&&(r.style.cssText=i=``),i)for(t in i)e&&t in e||nr$4(r.style,t,``);if(e)for(t in e)i&&e[t]==i[t]||nr$4(r.style,t,e[t]);}else if(t[0]==`o`&&t[1]==`n`)o=t!=(t=t.replace(lr$4,`$1`)),_=t.toLowerCase(),t=_ in r||t==`onFocusOut`||t==`onFocusIn`?_.slice(2):t.slice(2),r.l||(r.l={}),r.l[t+o]=e,e?i?e.u=i.u:(e.u=Tt,r.addEventListener(t,o?Pt$1:At$1,o)):r.removeEventListener(t,o?Pt$1:At$1,o);else {if(n==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in r)try{r[t]=e??``;break t}catch{}typeof e==`function`||(e==null||e===false&&t[4]!=`-`?r.removeAttribute(t):r.setAttribute(t,t==`popover`&&e==1?``:e));}}function or$4(r){return function(t){if(this.l){var e=this.l[t.type+r];if(t.t==null)t.t=Tt++;else if(t.t<e.u)return;return e(p$1.event?p$1.event(t):t)}}}function Dt$1(r,t,e,i,n,o,_,u,l,f){var h,s,E,a,g,b,O,m,v,B,c,tt,W,qt,rt,$,Rt,L=t.type;if(t.constructor!=null)return null;128&e.__u&&(l=!!(32&e.__u),o=[u=t.__e=e.__e]),(h=p$1.__b)&&h(t);t:if(typeof L==`function`)try{if(m=t.props,v=`prototype`in L&&L.prototype.render,B=(h=L.contextType)&&i[h.__c],c=h?B?B.props.value:h.__:i,e.__c?O=(s=t.__c=e.__c).__=s.__E:(v?t.__c=s=new L(m,c):(t.__c=s=new D$1(m,c),s.constructor=L,s.render=Xr$2),B&&B.sub(s),s.props=m,s.state||(s.state={}),s.context=c,s.__n=i,E=s.__d=!0,s.__h=[],s._sb=[]),v&&s.__s==null&&(s.__s=s.state),v&&L.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=A$3({},s.__s)),A$3(s.__s,L.getDerivedStateFromProps(m,s.__s))),a=s.props,g=s.state,s.__v=t,E)v&&L.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),v&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else {if(v&&L.getDerivedStateFromProps==null&&m!==a&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(m,c),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(m,s.__s,c)===!1||t.__v==e.__v){for(t.__v!=e.__v&&(s.props=m,s.state=s.__s,s.__d=!1),t.__e=e.__e,t.__k=e.__k,t.__k.some(function(F){F&&(F.__=t);}),tt=0;tt<s._sb.length;tt++)s.__h.push(s._sb[tt]);s._sb=[],s.__h.length&&_.push(s);break t}s.componentWillUpdate!=null&&s.componentWillUpdate(m,s.__s,c),v&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(a,g,b);});}if(s.context=c,s.props=m,s.__P=r,s.__e=!1,W=p$1.__r,qt=0,v){for(s.state=s.__s,s.__d=!1,W&&W(t),h=s.render(s.props,s.state,s.context),rt=0;rt<s._sb.length;rt++)s.__h.push(s._sb[rt]);s._sb=[];}else do s.__d=!1,W&&W(t),h=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++qt<25);s.state=s.__s,s.getChildContext!=null&&(i=A$3(A$3({},i),s.getChildContext())),v&&!E&&s.getSnapshotBeforeUpdate!=null&&(b=s.getSnapshotBeforeUpdate(a,g)),$=h,h!=null&&h.type===ut$3&&h.key==null&&($=dr$4(h.props.children)),u=ar$4(r,_t$3($)?$:[$],t,e,i,n,o,_,u,l,f),s.base=t.__e,t.__u&=-161,s.__h.length&&_.push(s),O&&(s.__E=s.__=null);}catch(F){if(t.__v=null,l||o!=null)if(F.then){for(t.__u|=l?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;o[o.indexOf(u)]=null,t.__e=u;}else for(Rt=o.length;Rt--;)wt$1(o[Rt]);else t.__e=e.__e,t.__k=e.__k;p$1.__e(F,t,e);}else o==null&&t.__v==e.__v?(t.__k=e.__k,t.__e=e.__e):u=t.__e=Qr$2(e.__e,t,e,i,n,o,_,l,f);return (h=p$1.diffed)&&h(t),128&t.__u?void 0:u}function pr$4(r,t,e){for(var i=0;i<e.length;i++)Ut$1(e[i],e[++i],e[++i]);p$1.__c&&p$1.__c(t,r),r.some(function(n){try{r=n.__h,n.__h=[],r.some(function(o){o.call(n);});}catch(o){p$1.__e(o,n.__v);}});}function dr$4(r){return typeof r!=`object`||r==null||r.__b&&r.__b>0?r:_t$3(r)?r.map(dr$4):A$3({},r)}function Qr$2(r,t,e,i,n,o,_,u,l){var f,h,s,E,a,g,b,O=e.props,m=t.props,v=t.type;if(v==`svg`?n=`http://www.w3.org/2000/svg`:v==`math`?n=`http://www.w3.org/1998/Math/MathML`:n||(n=`http://www.w3.org/1999/xhtml`),o!=null){for(f=0;f<o.length;f++)if((a=o[f])&&`setAttribute`in a==!!v&&(v?a.localName==v:a.nodeType==3)){r=a,o[f]=null;break}}if(r==null){if(v==null)return document.createTextNode(m);r=document.createElementNS(n,v,m.is&&m),u&&(p$1.__m&&p$1.__m(t,o),u=false),o=null;}if(v==null)O===m||u&&r.data==m||(r.data=m);else {if(o=o&&st$2.call(r.childNodes),O=e.props||j$3,!u&&o!=null)for(O={},f=0;f<r.attributes.length;f++)O[(a=r.attributes[f]).name]=a.value;for(f in O)if(a=O[f],f!=`children`){if(f==`dangerouslySetInnerHTML`)s=a;else if(!(f in m)){if(f==`value`&&`defaultValue`in m||f==`checked`&&`defaultChecked`in m)continue;it$1(r,f,null,a,n);}}for(f in m)a=m[f],f==`children`?E=a:f==`dangerouslySetInnerHTML`?h=a:f==`value`?g=a:f==`checked`?b=a:u&&typeof a!=`function`||O[f]===a||it$1(r,f,a,O[f],n);if(h)u||s&&(h.__html==s.__html||h.__html==r.innerHTML)||(r.innerHTML=h.__html),t.__k=[];else if(s&&(r.innerHTML=``),ar$4(t.type==`template`?r.content:r,_t$3(E)?E:[E],t,e,i,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:n,o,_,o?o[0]:e.__k&&U$1(e,0),u,l),o!=null)for(f=o.length;f--;)wt$1(o[f]);u||(f=`value`,v==`progress`&&g==null?r.removeAttribute(`value`):g!=null&&(g!==r[f]||v==`progress`&&!g||v==`option`&&g!=O[f])&&it$1(r,f,g,O[f],n),f=`checked`,b!=null&&b!=r[f]&&it$1(r,f,b,O[f],n));}return r}function Ut$1(r,t,e){try{if(typeof r==`function`){var i=typeof r.__u==`function`;i&&r.__u(),i&&t==null||(r.__u=r(t));}else r.current=t;}catch(n){p$1.__e(n,e);}}function mr$4(r,t,e){var i,n;if(p$1.unmount&&p$1.unmount(r),(i=r.ref)&&(i.current&&i.current!=r.__e||Ut$1(i,null,t)),(i=r.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(o){p$1.__e(o,t);}i.base=i.__P=null;}if(i=r.__k)for(n=0;n<i.length;n++)i[n]&&mr$4(i[n],t,e||typeof r.type!=`function`);e||wt$1(r.__e),r.__c=r.__=r.__e=void 0;}function Xr$2(r,t,e){return this.constructor(r,e)}function Ye$3(r,t,e){var i,n,o,_;t==document&&(t=document.documentElement),p$1.__&&p$1.__(r,t),n=(i="undefined"==`function`)?null:t.__k,o=[],_=[],Dt$1(t,r=(t).__k=Yr$2(ut$3,null,[r]),n||j$3,j$3,t.namespaceURI,n?null:t.firstChild?st$2.call(t.childNodes):null,o,n?n.__e:t.firstChild,i,_),pr$4(o,r,_);}st$2=fr$3.slice,p$1={__e:function(r,t,e,i){for(var n,o,_;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&o.getDerivedStateFromError!=null&&(n.setState(o.getDerivedStateFromError(r)),_=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(r,i||{}),_=n.__d),_)return n.__E=n}catch(u){r=u;}throw r}},sr$3=0,Ct$2=function(r){return r!=null&&r.constructor==null},D$1.prototype.setState=function(r,t){var e=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A$3({},this.state);typeof r==`function`&&(r=r(A$3({},e),this.props)),r&&A$3(e,r),r!=null&&this.__v&&(t&&this._sb.push(t),ir$4(this));},D$1.prototype.forceUpdate=function(r){this.__v&&(this.__e=true,r&&this.__h.push(r),ir$4(this));},D$1.prototype.render=ut$3,w$3=[],_r$4=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ur$4=function(r,t){return r.__v.__b-t.__v.__b},ot$2.__r=0,lr$4=/(PointerCapture)$|Capture$/i,Tt=0,At$1=or$4(false),Pt$1=or$4(true);var Vt$2,y$1,Mt$2,vr$3,Er$3=0,Rr$3=[],N$3=p$1,gr$4=N$3.__b,Nr$3=N$3.__r,Sr$3=N$3.diffed,Or$3=N$3.__c,Ir$3=N$3.unmount,yr$3=N$3.__;function jr$2(r,t){N$3.__h&&N$3.__h(y$1,r,Er$3||t),Er$3=0;var e=y$1.__H||(y$1.__H={__:[],__h:[]});return r>=e.__.length&&e.__.push({}),e.__[r]}function kt$3(r,t){var e=jr$2(Vt$2++,7);return Zr$2(e.__H,t)&&(e.__=r(),e.__H=t,e.__h=r),e.__}function qr$3(){for(var r;r=Rr$3.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(lt$3),r.__H.__h.forEach(Ht$2),r.__H.__h=[];}catch(t){r.__H.__h=[],N$3.__e(t,r.__v);}}N$3.__b=function(r){y$1=null,gr$4&&gr$4(r);},N$3.__=function(r,t){r&&t.__k&&t.__k.__m&&(r.__m=t.__k.__m),yr$3&&yr$3(r,t);},N$3.__r=function(r){Nr$3&&Nr$3(r),Vt$2=0;var t=(y$1=r.__c).__H;t&&(Mt$2===y$1?(t.__h=[],y$1.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0;})):(t.__h.forEach(lt$3),t.__h.forEach(Ht$2),t.__h=[],Vt$2=0)),Mt$2=y$1;},N$3.diffed=function(r){Sr$3&&Sr$3(r);var t=r.__c;t&&t.__H&&(t.__H.__h.length&&(Rr$3.push(t)!==1&&vr$3===N$3.requestAnimationFrame||((vr$3=N$3.requestAnimationFrame)||Jr$2)(qr$3)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0;})),Mt$2=y$1=null;},N$3.__c=function(r,t){t.some(function(e){try{e.__h.forEach(lt$3),e.__h=e.__h.filter(function(i){return !i.__||Ht$2(i)});}catch(i){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],N$3.__e(i,e.__v);}}),Or$3&&Or$3(r,t);},N$3.unmount=function(r){Ir$3&&Ir$3(r);var t,e=r.__c;e&&e.__H&&(e.__H.__.forEach(function(i){try{lt$3(i);}catch(n){t=n;}}),e.__H=void 0,t&&N$3.__e(t,e.__v));};var br$3=typeof requestAnimationFrame==`function`;function Jr$2(r){var t,e=function(){clearTimeout(i),br$3&&cancelAnimationFrame(t),setTimeout(r);},i=setTimeout(e,35);br$3&&(t=requestAnimationFrame(e));}function lt$3(r){var t=y$1,e=r.__c;typeof e==`function`&&(r.__c=void 0,e()),y$1=t;}function Ht$2(r){var t=y$1;r.__c=r.__(),y$1=t;}function Zr$2(r,t){return !r||r.length!==t.length||t.some(function(e,i){return e!==r[i]})}var te$3=Symbol.for(`preact-signals`);function Bt$2(){if(M$5>1)M$5--;else {for(var r,t=false;q$2!==void 0;){var e=q$2;for(q$2=void 0,Gt$1++;e!==void 0;){var i=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&xr$3(e))try{e.c();}catch(n){t||(r=n,t=true);}e=i;}}if(Gt$1=0,M$5--,t)throw r}}var d$1=void 0;var q$2=void 0,M$5=0,Gt$1=0,ft$3=0;function Lr$2(r){if(d$1!==void 0){var t=r.n;if(t===void 0||t.t!==d$1)return t={i:0,S:r,p:d$1.s,n:void 0,t:d$1,e:void 0,x:void 0,r:t},d$1.s!==void 0&&(d$1.s.n=t),d$1.s=t,r.n=t,32&d$1.f&&r.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=d$1.s,t.n=void 0,d$1.s.n=t,d$1.s=t),t}}function S$2(r){this.v=r,this.i=0,this.n=void 0,this.t=void 0;}S$2.prototype.brand=te$3;S$2.prototype.h=function(){return true};S$2.prototype.S=function(r){this.t!==r&&r.e===void 0&&(r.x=this.t,this.t!==void 0&&(this.t.e=r),this.t=r);};S$2.prototype.U=function(r){if(this.t!==void 0){var t=r.e,e=r.x;t!==void 0&&(t.x=e,r.e=void 0),e!==void 0&&(e.e=t,r.x=void 0),r===this.t&&(this.t=e);}};S$2.prototype.subscribe=function(r){var t=this;return Z$1(function(){var e=t.value,i=d$1;d$1=void 0;try{r(e);}finally{d$1=i;}})};S$2.prototype.valueOf=function(){return this.value};S$2.prototype.toString=function(){return this.value+``};S$2.prototype.toJSON=function(){return this.value};S$2.prototype.peek=function(){var r=d$1;d$1=void 0;try{return this.value}finally{d$1=r;}};Object.defineProperty(S$2.prototype,`value`,{get:function(){var r=Lr$2(this);return r!==void 0&&(r.i=this.i),this.v},set:function(r){if(r!==this.v){if(Gt$1>100)throw new Error(`Cycle detected`);this.v=r,this.i++,ft$3++,M$5++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N();}finally{Bt$2();}}}});function R$2(r){return new S$2(r)}function xr$3(r){for(var t=r.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return true;return false}function Ar$3(r){for(var t=r.s;t!==void 0;t=t.n){var e=t.S.n;if(e!==void 0&&(t.r=e),t.S.n=t,t.i=-1,t.n===void 0){r.s=t;break}}}function Pr$3(r){for(var t=r.s,e=void 0;t!==void 0;){var i=t.p;t.i===-1?(t.S.U(t),i!==void 0&&(i.n=t.n),t.n!==void 0&&(t.n.p=i)):e=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=i;}r.s=e;}function V$3(r){S$2.call(this,void 0),this.x=r,this.s=void 0,this.g=ft$3-1,this.f=4;}(V$3.prototype=new S$2).h=function(){if(this.f&=-3,1&this.f)return false;if((36&this.f)==32||(this.f&=-5,this.g===ft$3))return true;if(this.g=ft$3,this.f|=1,this.i>0&&!xr$3(this))return this.f&=-2,true;var r=d$1;try{Ar$3(this),d$1=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++);}catch(e){this.v=e,this.f|=16,this.i++;}return d$1=r,Pr$3(this),this.f&=-2,true};V$3.prototype.S=function(r){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t);}S$2.prototype.S.call(this,r);};V$3.prototype.U=function(r){if(this.t!==void 0&&(S$2.prototype.U.call(this,r),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t);}};V$3.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var r=this.t;r!==void 0;r=r.x)r.t.N();}};Object.defineProperty(V$3.prototype,`value`,{get:function(){if(1&this.f)throw new Error(`Cycle detected`);var r=Lr$2(this);if(this.h(),r!==void 0&&(r.i=this.i),16&this.f)throw this.v;return this.v}});function Wt$1(r){return new V$3(r)}function Cr$3(r){var t=r.u;if(r.u=void 0,typeof t==`function`){M$5++;var e=d$1;d$1=void 0;try{t();}catch(i){throw r.f&=-2,r.f|=8,$t$2(r),i}finally{d$1=e,Bt$2();}}}function $t$2(r){for(var t=r.s;t!==void 0;t=t.n)t.S.U(t);r.x=void 0,r.s=void 0,Cr$3(r);}function re$3(r){if(d$1!==this)throw new Error(`Out-of-order effect`);Pr$3(this),d$1=r,this.f&=-2,8&this.f&&$t$2(this),Bt$2();}function J$2(r){this.x=r,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32;}J$2.prototype.c=function(){var r=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.u=t);}finally{r();}};J$2.prototype.S=function(){if(1&this.f)throw new Error(`Cycle detected`);this.f|=1,this.f&=-9,Cr$3(this),Ar$3(this),M$5++;var r=d$1;return d$1=this,re$3.bind(this,r)};J$2.prototype.N=function(){2&this.f||(this.f|=2,this.o=q$2,q$2=this);};J$2.prototype.d=function(){this.f|=8,1&this.f||$t$2(this);};function Z$1(r){var t=new J$2(r);try{t.c();}catch(e){throw t.d(),e}return t.d.bind(t)}var Ft$2;function H$4(r,t){p$1[r]=t.bind(null,p$1[r]||function(){});}function ct$3(r){Ft$2&&Ft$2(),Ft$2=r&&r.S();}function Tr$2(r){var t=this,e=r.data,i=ie$4(e);i.value=e;var n=kt$3(function(){for(var o=t.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return t.__$u.c=function(){var _,u=t.__$u.S(),l=n.value;u(),Ct$2(l)||((_=t.base)==null?void 0:_.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=l;},Wt$1(function(){var _=i.value.value;return _===0?0:_===true?``:_||``})},[]);return n.value}Tr$2.displayName=`_st`;Object.defineProperties(S$2.prototype,{constructor:{configurable:true,value:void 0},type:{configurable:true,value:Tr$2},props:{configurable:true,get:function(){return {data:this}}},__b:{configurable:true,value:1}});H$4(`__b`,function(r,t){if(typeof t.type==`string`){var e,i=t.props;for(var n in i)if(n!==`children`){var o=i[n];o instanceof S$2&&(e||(t.__np=e={}),e[n]=o,i[n]=o.peek());}}r(t);});H$4(`__r`,function(r,t){ct$3();var e,i=t.__c;i&&(i.__$f&=-2,(e=i.__$u)===void 0&&(i.__$u=e=(function(n){var o;return Z$1(function(){o=this;}),o.c=function(){i.__$f|=1,i.setState({});},o})())),ct$3(e),r(t);});H$4(`__e`,function(r,t,e,i){ct$3(),r(t,e,i);});H$4(`diffed`,function(r,t){ct$3();var e;if(typeof t.type==`string`&&(e=t.__e)){var i=t.__np,n=t.props;if(i){var o=e.U;if(o)for(var _ in o){var u=o[_];u!==void 0&&!(_ in i)&&(u.d(),o[_]=void 0);}else e.U=o={};for(var l in i){var f=o[l],h=i[l];f===void 0?(f=ee$2(e,l,h,n),o[l]=f):f.o(h,n);}}}r(t);});function ee$2(r,t,e,i){var n=t in r&&r.ownerSVGElement===void 0,o=R$2(e);return {o:function(_,u){o.value=_,i=u;},d:Z$1(function(){var _=o.value.value;i[t]!==_&&(i[t]=_,n?r[t]=_:_?r.setAttribute(t,_):r.removeAttribute(t));})}}H$4(`unmount`,function(r,t){if(typeof t.type==`string`){var e=t.__e;if(e){var i=e.U;if(i){e.U=void 0;for(var n in i){var o=i[n];o&&o.d();}}}}else {var _=t.__c;if(_){var u=_.__$u;u&&(_.__$u=void 0,u.d());}}r(t);});H$4(`__h`,function(r,t,e,i){(i<3||i===9)&&(t.__$f|=2),r(t,e,i);});D$1.prototype.shouldComponentUpdate=function(r,t){var e=this.__$u,i=e&&e.s!==void 0;for(var n in t)return true;if(this.__f||typeof this.u==`boolean`&&this.u===true){if(!(i||2&this.__$f||4&this.__$f)||1&this.__$f)return true}else if(!(i||4&this.__$f)||3&this.__$f)return true;for(var o in r)if(o!==`__source`&&r[o]!==this.props[o])return true;for(var _ in this.props)if(!(_ in r))return true;return false};function ie$4(r){return kt$3(function(){return R$2(r)},[])}var at$2=class at{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price;}};var ht$3=class ht{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url;}};var pt$2=class pt{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d;}};var Kt$2=class Kt{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??false;}},dt$2=class dt{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new ht$3(e))??[],this.link=t.link,this.price=new pt$2(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=R$2(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=R$2(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let i=new Kt$2(e);return i.isSelected&&(this.selectedSellingPlan.value=i),i});}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t;}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};function zt$1(r,t){for(let e of r){let i=t.get(e.attr),n=Array.isArray(i),o=typeof i==`string`,_=typeof i==`number`&&typeof e.value==`number`,u=Array.isArray(e.value),l=true;switch(e.op){case `contains`:l=(n||o)&&i.includes(e.value);break;case `notContains`:l=(n||o)&&!i.includes(e.value);break;case `eq`:l=i===e.value;break;case `ne`:l=i!==e.value;break;case `gt`:l=_&&i>e.value;break;case `gte`:l=_&&i>=e.value;break;case `lt`:l=_&&i<e.value;break;case `lte`:l=_&&i<=e.value;break;case `in`:l=u&&e.value.includes(i);break;case `nin`:l=u&&!e.value.includes(i);break;case `between`:l=_&&u&&e.value.length===2&&i>=e.value[0]&&i<=e.value[1];break;case `all`:l=n&&u&&e.value.every(f=>i.includes(f));break;default:l=false;break}if(!l)return false}return true}var mt$3=class mt{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=R$2(true);selectedQty=R$2(1);_showAddToCartButton;constructor(t){this.update(t),this.selectedOrFirstVariant=R$2(this.selectedVariant),this._showAddToCartButton=this.evaluateShowATCFlag();}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get showAddToCartButton(){return this._showAddToCartButton}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant;}set selectedQuantity(t){this.selectedQty.value=Math.max(1,t);}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(t){this.selectedOrFirstVariant.value=t;}setSelectedVariantByID(t){if(!t)return;let e=this.vars.find(i=>i.mID===t.toString());e&&this.setSelectedVariant(e);}update(t){return this.id=t.id??this.id,this.mID=t.mID??this.mID,this.name=t.name??this.name,this.imgs=t.imgs??this.imgs,this.desc=t.desc??this.desc,this.link=t.link??this.link,this.slug=t.slug??this.slug,this.quantity=t.quantity??this.quantity,this.meta=t.meta??this.meta,this.category=t.category??this.category,this.reviews=t.reviews??this.reviews,this.options=t.options??this.options,this.tags=t.tags??this.tags,this.templateSuffix=t.templateSuffix??this.templateSuffix,t.vars&&(this.vars=t.vars.map(e=>new dt$2(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new at$2({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,i=this.name,n=this.category,o=this.variantImage??this.firstImageURL,_=this.meta,u=this.tags?.join(`,`)??``,l=this.reviews?.rating,f=this.reviews?.totalReviews,h=e.cmp&&e.cmp>e.d,s$1=s$3(r$2({name:i},$n$1(`price`,e.d,true)),{image_url:o,meta:_,category:n,rating:l,reviews:f,tags:u,variant_count:this.vars?.length??0});if(t.hasEffectivePrice()){let a=$n$1(`effective_price`,t.effectivePrice.value,true);Object.assign(s$1,a);}if(h){let a=e.cmp-e.d,g={discount_percent:(a/e.cmp*100).toFixed(0)};Object.assign(s$1,g),Object.assign(s$1,$n$1(`compare_price`,e.cmp)),Object.assign(s$1,$n$1(`discount_price`,a));}return {product:s$1,variant:{name:t.name,quantity:t.quantity}}}evaluateShowATCFlag(){let t=he$4.get().widgetCustomisation?.atcButton?.showWhen;if(!t?.predicates?.length)return true;let e=t.predicates,i=this.getValueMap(e);return t.op===`or`?e.some(n=>zt$1([n],i)):zt$1(e,i)}getValueMap(t){let e=new Map;for(let i of t){let n=i.attr.split(`.`);switch(n[1]){case `tags`:e.set(i.attr,this.tags);break;case `type`:case `category`:e.set(i.attr,this.category);break;case `meta`:case `metafield`:{let _=n[2];if(!_)continue;e.set(i.attr,this.meta?.[_]);break}}}return e}};var vt$2=class vt{id;alt;shortID;sources;items;durationMS;thumbnail;card;bestSource;highSource;goodSource;lowSource;m3u8Source;constructor(t={}){if(this.id=t.id,this.alt=t.alt,this.shortID=t.shortID,this.sources=t.sources?.sort((e,i)=>i.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new mt$3(e)):[],this.card=t.card,this.sources){let e=[];for(let i of this.sources)i.format===`mp4`?e.push(i):i.format===`m3u8`&&!this.m3u8Source&&(this.m3u8Source=i);e.length>0&&(this.bestSource=e[0],this.highSource=e.length>1?e[1]:e[0],this.lowSource=e.length>2?e[e.length-1]:e[0]);}}};var ne$2=(e=>(e.CLASSIC=`CLASSIC`,e.ITEM_CARD_HEADER=`ITEM_CARD_HEADER`,e))(ne$2||{});var oe$5=(i=>(i.ON=`ON`,i.OFF=`OFF`,i.ON_HOVER=`ON_HOVER`,i))(oe$5||{}),se$4=(n=>(n.FIRST_ITEM=`FIRST_ITEM`,n.ITEM_SWIPER=`ITEM_SWIPER`,n.CARD=`CARD`,n.NONE=`NONE`,n))(se$4||{});var wr$3=class wr{videoEntries;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(t={}){this.videoEntries=t.videoEntries?.map(e=>({video:new vt$2(e.video),title:e.title}))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:`VIDEO_ONLY_VIEW`},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.autoPlay=t.autoPlay??`ON`,this.footerContent=t.footerContent??`FIRST_ITEM`,this.playlistConfig={videoSwiper:t.playlistConfig?.videoSwiper??void 0,itemCardClickBehavior:t.playlistConfig?.itemCardClickBehavior??`OPEN_VIDEO_DETAIL`},this.itemDetailConfig={template:t.itemDetailConfig?.template??`CLASSIC`};}showItems(){return this.footerContent===`FIRST_ITEM`||this.footerContent===`ITEM_SWIPER`}};var Dr$2=class Dr{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new P$2(t.bg)),t.br&&(this.br=new C$4(t.br)),t.shd&&(this.shd=new Q$2(t.shd)),t.spc&&(this.spc=new T$1(t.spc)),this.trf=new X$3(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a;}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return k$3[this.t]}get click(){return this.clc}},k$3=(c=>(c[c.IMAGE=1]=`IMAGE`,c[c.TEXT=2]=`TEXT`,c[c.BUTTON=3]=`BUTTON`,c[c.FLEXBOX=4]=`FLEXBOX`,c[c.MULTI_COLUMN=5]=`MULTI_COLUMN`,c[c.CHECKBOX=6]=`CHECKBOX`,c[c.PARTIAL=8]=`PARTIAL`,c[c.PRODUCTS=11]=`PRODUCTS`,c[c.PRODUCT=12]=`PRODUCT`,c[c.PRODUCT_IMAGE=13]=`PRODUCT_IMAGE`,c[c.PRODUCT_TITLE=14]=`PRODUCT_TITLE`,c[c.PRODUCT_VARIATIONS=15]=`PRODUCT_VARIATIONS`,c[c.PRODUCT_VARIATIONS_SELLING_PLANS=16]=`PRODUCT_VARIATIONS_SELLING_PLANS`,c[c.PRODUCT_BUTTON=18]=`PRODUCT_BUTTON`,c[c.PRODUCT_RATING=19]=`PRODUCT_RATING`,c[c.EMAIL_INPUT=51]=`EMAIL_INPUT`,c[c.PHONE_INPUT=52]=`PHONE_INPUT`,c[c.COUNTDOWN_TIMER=61]=`COUNTDOWN_TIMER`,c[c.CAROUSEL=62]=`CAROUSEL`,c[c.SHAPE=100]=`SHAPE`,c))(k$3||{});var Ur$2=0;function _e$2(r=document.head){return Mr$3(fe$3.styleURL,r,`cooee-global-styles`)}function ue$3(r=document.head){return Mr$3(`${en}/swiper-bundle.min.css`,r,`swiper-styles`)}function Mr$3(r,t=document.head,e){return new Promise(i=>{if(t.querySelector(`#${e}`)){i();return}let o=document.createElement(`link`);o.rel=`stylesheet`,o.href=r,o.id=e,o.onload=()=>{i();},o.onerror=()=>{console.error(`Failed to load stylesheet:`,r),i();},t.appendChild(o);})}function le$4(r,t=document.head){if(!r)return;Ur$2++;let e=document.createElement(`style`);e.id=`cooee-app-css-${Ur$2}`,e.textContent=r,t.appendChild(e);}function Ui$2(r){if(!r)return;let t=document.createElement(`script`);t.id=`cooee-app-script`,t.innerHTML=r,document.head.appendChild(t);}function Mi$2(r){if(r)try{(0,eval)(r);}catch(t){console.error(`Failed to execute script:`,t);}}async function Vi$2(){let r=(await import(`${en}/swiper-bundle.min.mjs`)).Swiper;return window.CooeeSDK.Swiper=r}async function Hi$2(r,t=true){if(!r)return;let e=[];t&&e.push(ue$3(r)),e.push(_e$2(r)),await Promise.all(e);let i=he$4.get().website.commonCSS;le$4(i,r);}var fe$2=(function(r){return r[r.SINGLE=1]=`SINGLE`,r[r.EXCLUSION=2]=`EXCLUSION`,r[r.ABTESTING=3]=`ABTESTING`,r[r.GLOBAL_AB=4]=`GLOBAL_AB`,r})(fe$2||{});var ce$3=(function(r){return r.BEFORE=`before`,r.AFTER=`after`,r.INSIDE_FIRST=`insideFirst`,r.INSIDE_LAST=`insideLast`,r.BEFORE1=`BEFORE`,r.AFTER1=`AFTER`,r.INSIDE_FIRST1=`INSIDE_FIRST`,r.INSIDE_LAST1=`INSIDE_LAST`,r})(ce$3||{}),ae$4=(function(r){return r.SHOPIFY_CHECKOUT=`shopify_checkout`,r.THIRD_PARTY_CHECKOUT=`third_party_checkout`,r.CART_PAGE=`cart_page`,r.CART_DRAWER=`cart_drawer`,r})(ae$4||{});var he$3=(function(r){return r[r.NONE=0]=`NONE`,r[r.REJECT_POPUP=1]=`REJECT_POPUP`,r[r.ACCEPT_POPUP=2]=`ACCEPT_POPUP`,r[r.GO_TO_URL=4]=`GO_TO_URL`,r[r.SHARE=5]=`SHARE`,r[r.KEY_VALUE=100]=`KEY_VALUE`,r[r.GO_TO_PRODUCT=101]=`GO_TO_PRODUCT`,r[r.ADD_TO_CART=102]=`ADD_TO_CART`,r[r.COPY_COUPON_CODE=103]=`COPY_COUPON_CODE`,r[r.GO_TO_COLLECTION=104]=`GO_TO_COLLECTION`,r[r.OPEN_CART=105]=`OPEN_CART`,r[r.SUBMIT_FORM=106]=`SUBMIT_FORM`,r[r.INITIATE_CHECKOUT=107]=`INITIATE_CHECKOUT`,r[r.ADD_BUNDLE=108]=`ADD_BUNDLE`,r[r.UPGRADE_TO_SUBSCRIPTION=109]=`UPGRADE_TO_SUBSCRIPTION`,r[r.BUY_NOW=110]=`BUY_NOW`,r[r.QUICK_VIEW=111]=`QUICK_VIEW`,r})(he$3||{}),pe$3=(function(r){return r.POPUP=`POPUP`,r.PAGE_EMBED=`PAGE_EMBED`,r.CART_EMBED=`CART_EMBED`,r.ANNOUNCEMENT_BAR=`ANNOUNCEMENT_BAR`,r})(pe$3||{}),de$3=(function(r){return r.PRODUCT_PROMOTION=`PRODUCT_PROMOTION`,r.BUNDLE_AND_UPSELL=`BUNDLE_AND_UPSELL`,r.CART_RECOVERY=`CART_RECOVERY`,r.ANNOUNCEMENT=`ANNOUNCEMENT`,r.LEAD_GENERATION=`LEAD_GENERATION`,r.DATA_COLLECTION=`DATA_COLLECTION`,r.SALE_PROMOTION=`SALE_PROMOTION`,r.SUBSCRIPTION_UPSELL=`SUBSCRIPTION_UPSELL`,r.SHOPPABLE_VIDEO=`SHOPPABLE_VIDEO`,r.BYOB=`BYOB`,r.PROGRESS_BAR=`PROGRESS_BAR`,r.BUY_NOW=`BUY_NOW`,r.STICKY_ATC=`STICKY_ATC`,r.EXPERIMENT=`EXPERIMENT`,r.SAVINGS_BAR=`SAVINGS_BAR`,r.COLLECTION_FILTER=`COLLECTION_FILTER`,r.COLLECTION_PROMOTION=`COLLECTION_PROMOTION`,r})(de$3||{}),me$3=(function(r){return r.COOEE=`COOEE`,r.KLAVIYO=`KLAVIYO`,r})(me$3||{}),ve$3=(function(r){return r.ICONS=`ICONS`,r.TILES=`TILES`,r})(ve$3||{}),Ee$4=(function(r){return r.FREE_SHIPPING=`FREE_SHIPPING`,r.DISCOUNT=`DISCOUNT`,r.FREE_AUTO_GIFT=`FREE_AUTO_GIFT`,r.FREE_GIFT_SELECT=`FREE_GIFT_SELECT`,r.UI_ONLY=`UI_ONLY`,r})(Ee$4||{});var Et$2=class Et{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??`row`,this.wrap=t.wrap??`nowrap`,this.jc=t.jc??`flex-start`,this.ai=t.ai??`flex-start`,this.scroll=t.scroll;}};var gt$2=class gt{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex;}};var Nt$2=class Nt{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??`100%`,this.h=t.h??`auto`,this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH;}};var Qt$2=(n=>(n[n.START=0]=`START`,n[n.CENTER=1]=`CENTER`,n[n.END=2]=`END`,n[n.JUSTIFY=3]=`JUSTIFY`,n))(Qt$2||{});var St$2=class St{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!==`Arial`?t.name:``),this.name=t.name,this.fonts=t.fonts?.map(e=>new Xt$1(e));}},Xt$1=class Xt{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url;}getFontDescriptor(){return {style:this.style===2||this.style===4?`italic`:`normal`,weight:this.style===4||this.style===3?`700`:`400`}}getURL(){return `url('${this.url}') format('truetype')`}};var G$2=class G{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t);}get alignment(){return Qt$2[this.ta]}get letterSpacing(){return this.ls?this.ls+`px`:`normal`}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new I$2(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new I$2(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??=`#000000`,this.fam=new St$2(t.fam??t.fmly);}resize(t){this.s*=t,this.ls*=t;}};var Ot$2=class Ot{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new T$1(t.spc),t.size&&(this.size=new Nt$2(t.size)),t.bg&&(this.bg=new P$2(t.bg)),t.br&&(this.br=new C$4(t.br)),t.typo&&(this.typo=new G$2(t.typo)),t.lout&&(this.lout=new gt$2(t.lout)),t.flex&&(this.flex=new Et$2(t.flex));}},It$2=class It{sm;lg;constructor(t){t??={},this.sm=new Ot$2(t.sm),this.lg=new Ot$2(t.lg);}};var yt$1=class yt{t;classes;style;hide;when;clc;l;constructor(t,e){e??={},this.t=t,this.classes=e.classes??``,this.style=new It$2(e.style),this.hide=e.hide,this.l=e.l,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc);}get stringType(){return k$3[this.t]}};var bt$1=class bt extends yt$1{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text;}};var ge$3=(i=>(i.SINGLE=`SINGLE`,i.MULTIPLE=`MULTIPLE`,i.CHIPS=`CHIPS`,i))(ge$3||{}),Vr$3=class Vr extends bt$1{showChips;optionsConfig;type;horizontal;constructor(t=15,e){super(e,t),e??={},this.showChips=e.showChips??false,this.optionsConfig=e.optionsConfig??{},this.horizontal=e.horizontal,e.type?this.type=e.type:e.showChips?this.type=`CHIPS`:this.type=`SINGLE`;}};var Ne$3=(i=>(i[i.LOW=1]=`LOW`,i[i.MEDIUM=2]=`MEDIUM`,i[i.HIGH=3]=`HIGH`,i))(Ne$3||{}),Se$5=(e=>(e.SINGLE_PANE=`SINGLE_PANE`,e.TWO_PANE=`TWO_PANE`,e))(Se$5||{});function vn(r){if(!r)return {display:`block`};let t={display:r.disp};return r.of&&(t.objectFit=r.of),r.pos===`absolute`&&(t.width=`auto !important`,t.position=`absolute`,t.right=r.right+`px`,t.left=r.left+`px`,t.top=r.top+`px`,t.bottom=r.bottom+`px`),t}function En(r){return r?{gap:r.gap+`px`,flexWrap:r.wrap,flexDirection:r.dir,justifyContent:r.jc,alignItems:r.ai,width:`100%`}:{}}function Hr$3(r,t,e){if(e??={},r.type===`LINEAR`){let i=`linear-gradient(${r.ang}deg, ${r.c1}, ${r.c2}`;r.c3&&(i+=`, ${r.c3}`),i+=`)`,e[t]=i;}return e}function jt$2(r,t=`color`,e){return e??={},r?r.grad?Hr$3(r.grad,t,e):(r.hex&&(e[t]=r.rgba),e):e}function x$2(r,t){return Oe$2(r,t)+`px`}function Oe$2(r,t=1){return (r??0)*t}function gn(r){let t={};return r?.w&&(t.width=r.w),r?.h&&(t.height=r.h),r?.maxW&&(t.maxWidth=r.maxW),r?.maxH&&(t.maxHeight=r.maxH),r?.minW&&(t.minWidth=r.minW),r?.minH&&(t.minHeight=r.minH),t}function Nn$1(r,t){if(!r)return {};let e={};return r.radius&&r.radius>0&&(e.borderRadius=x$2(r.radius,t)),r.width&&r.width>0&&(e.borderWidth=x$2(r.width,t),e.borderStyle=r.style?.toLowerCase(),r.color?jt$2(r.color,`border-color`,e):e.borderColor=`black`),e}function Sn(r,t){let e={};return r?(e.paddingTop=x$2(r.pt,t),e.paddingBottom=x$2(r.pb,t),e.paddingLeft=x$2(r.pl,t),e.paddingRight=x$2(r.pr,t),e.marginTop=x$2(r.mt,t),e.marginBottom=x$2(r.mb,t),e.marginLeft=r.cent?`auto`:x$2(r.ml,t),e.marginRight=r.cent?`auto`:x$2(r.mr,t),e):(e.margin=`0 !important`,e.padding=`unset`,e)}function On(r){if(!r)return {};let t={};if(r.glossy){let e=`backdrop-filter`,i=`-webkit-`+e,n=`blur(${r.glossy.radius}px)`;if(!CSS.supports(i,n)&&!CSS.supports(e,n))return {background:r.glossy.fallback.rgba};if(t[i]=n,t[e]=n,r.glossy.color)return jt$2(r.glossy.color,`background`,t)}else if(r.solid){if(r.solid.grad)return Hr$3(r.solid.grad,`background`,t);if(r.solid.hex)return {backgroundColor:r.solid.rgba}}else if(r.img){if(!r.img.src)return {};let e=(r.img.a??0)/100;t.background=`linear-gradient(rgba(0, 0, 0, ${e}), rgba(0, 0, 0, ${e})),url("${r.img.src}") no-repeat center`,t.backgroundSize=`cover`,r.img.a&&(t[`-webkit-backdrop-filter`]=`opacity(${r.img.a})`,t.backdropFilter=`opacity(${r.img.a})`);}return t}function In(r=new G$2){let t={};return t.letterSpacing=r.letterSpacing,t.fontSize=r.fs+`px`,t.lineHeight=r.lh,t.fontFamily=r.fam.name||`inherit`,t.textAlign=r.alignment,t.fontWeight=r.fw,t.textDecoration=r.td??`none`,jt$2(r.tc,`color`,t),t.boxShadow=`none`,t}
|
|
12
|
+
var K$3=`a-f\\d`,kr$4=`#?[${K$3}]{3}[${K$3}]?`,Gr$3=`#?[${K$3}]{6}([${K$3}]{2})?`,Br$3=new RegExp(`[^#${K$3}]`,`gi`),Wr$3=new RegExp(`^${kr$4}$|^${Gr$3}$`,`i`);function xt$1(r,t={}){if(typeof r!=`string`||Br$3.test(r)||!Wr$3.test(r))throw new TypeError(`Expected a valid hex string`);r=r.replace(/^#/,``);let e=1;r.length===8&&(e=Number.parseInt(r.slice(6,8),16)/255,r=r.slice(0,6)),r.length===4&&(e=Number.parseInt(r.slice(3,4).repeat(2),16)/255,r=r.slice(0,3)),r.length===3&&(r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2]);let i=Number.parseInt(r,16),n=i>>16,o=i>>8&255,_=i&255,u=typeof t.alpha==`number`?t.alpha:e;if(t.format===`array`)return [n,o,_,u];if(t.format===`css`)return `rgb(${n} ${o} ${_}${u===1?``:` / ${Number((u*100).toFixed(2))}%`})`;return {red:n,green:o,blue:_,alpha:u}}var I$2=class I{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g;}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return ``;try{return xt$1(this.hex,{format:`css`,alpha:this.getAlpha()})}catch(t){return console.error(`Invalid hex`,t),`#000000`}}getAlpha(){return (this.a??100)/100}};var P$2=class P{s;g;i;constructor(t){t.s&&(this.s=new I$2(t.s)),t.g&&(this.g=new z$5(t.g)),this.i=t.i;}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var C$4=class C{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new I$2(t.c));}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return rr$4[this.s??1]}},rr$4=(e=>(e[e.SOLID=1]=`SOLID`,e[e.DASHED=2]=`DASHED`,e))(rr$4||{});var z$5=class r{static DEFAULT_FALLBACK=new I$2({h:`#000000`,a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new I$2(t.c)),t.fb&&(this.fb=new I$2(t.fb));}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??r.DEFAULT_FALLBACK}};var Q$2=class Q{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new I$2(t.clr);}getStyle(t){return `${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}};var T$1=class T{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??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 X$3=class X{rot;constructor(t){t?.rot&&(this.rot=t.rot);}get rotate(){return this.rot}},st$2,p$1,sr$3,Ct$2,w$3,er$4,_r$4,ur$4,lr$4,Tt,At$1,Pt$1,j$3={},fr$3=[],Fr$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_t$3=Array.isArray;function A$3(r,t){for(var e in t)r[e]=t[e];return r}function wt$1(r){r&&r.parentNode&&r.parentNode.removeChild(r);}function Yr$2(r,t,e){var i,n,o,_={};for(o in t)o==`key`?i=t[o]:o==`ref`?n=t[o]:_[o]=t[o];if(arguments.length>2&&(_.children=arguments.length>3?st$2.call(arguments,2):e),typeof r==`function`&&r.defaultProps!=null)for(o in r.defaultProps)_[o]===void 0&&(_[o]=r.defaultProps[o]);return nt$1(r,_,i,n,null)}function nt$1(r,t,e,i,n){var o={type:r,props:t,key:e,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++sr$3,__i:-1,__u:0};return n==null&&p$1.vnode!=null&&p$1.vnode(o),o}function ut$3(r){return r.children}function D$1(r,t){this.props=r,this.context=t;}function U$1(r,t){if(t==null)return r.__?U$1(r.__,r.__i+1):null;for(var e;t<r.__k.length;t++)if((e=r.__k[t])!=null&&e.__e!=null)return e.__e;return typeof r.type==`function`?U$1(r):null}function cr$3(r){var t,e;if((r=r.__)!=null&&r.__c!=null){for(r.__e=r.__c.base=null,t=0;t<r.__k.length;t++)if((e=r.__k[t])!=null&&e.__e!=null){r.__e=r.__c.base=e.__e;break}return cr$3(r)}}function ir$4(r){(!r.__d&&(r.__d=true)&&w$3.push(r)&&!ot$2.__r++||er$4!=p$1.debounceRendering)&&((er$4=p$1.debounceRendering)||_r$4)(ot$2);}function ot$2(){for(var r,t,e,i,n,o,_,u=1;w$3.length;)w$3.length>u&&w$3.sort(ur$4),r=w$3.shift(),u=w$3.length,r.__d&&(e=void 0,n=(i=(t=r).__v).__e,o=[],_=[],t.__P&&((e=A$3({},i)).__v=i.__v+1,p$1.vnode&&p$1.vnode(e),Dt$1(t.__P,e,i,t.__n,t.__P.namespaceURI,32&i.__u?[n]:null,o,n??U$1(i),!!(32&i.__u),_),e.__v=i.__v,e.__.__k[e.__i]=e,pr$4(o,e,_),e.__e!=n&&cr$3(e)));ot$2.__r=0;}function ar$4(r,t,e,i,n,o,_,u,l,f,h){var s,E,a,g,b,O,m=i&&i.__k||fr$3,v=t.length;for(l=Kr$3(e,t,m,l,v),s=0;s<v;s++)(a=e.__k[s])!=null&&(E=a.__i==-1?j$3:m[a.__i]||j$3,a.__i=s,O=Dt$1(r,a,E,n,o,_,u,l,f,h),g=a.__e,a.ref&&E.ref!=a.ref&&(E.ref&&Ut$1(E.ref,null,a),h.push(a.ref,a.__c||g,a)),b==null&&g!=null&&(b=g),4&a.__u||E.__k===a.__k?l=hr$4(a,l,r):typeof a.type==`function`&&O!==void 0?l=O:g&&(l=g.nextSibling),a.__u&=-7);return e.__e=b,l}function Kr$3(r,t,e,i,n){var o,_,u,l,f,h=e.length,s=h,E=0;for(r.__k=new Array(n),o=0;o<n;o++)(_=t[o])!=null&&typeof _!=`boolean`&&typeof _!=`function`?(l=o+E,(_=r.__k[o]=typeof _==`string`||typeof _==`number`||typeof _==`bigint`||_.constructor==String?nt$1(null,_,null,null,null):_t$3(_)?nt$1(ut$3,{children:_},null,null,null):_.constructor==null&&_.__b>0?nt$1(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_).__=r,_.__b=r.__b+1,u=null,(f=_.__i=zr$2(_,e,l,s))!=-1&&(s--,(u=e[f])&&(u.__u|=2)),u==null||u.__v==null?(f==-1&&(n>h?E--:n<h&&E++),typeof _.type!=`function`&&(_.__u|=4)):f!=l&&(f==l-1?E--:f==l+1?E++:(f>l?E--:E++,_.__u|=4))):r.__k[o]=null;if(s)for(o=0;o<h;o++)(u=e[o])!=null&&!(2&u.__u)&&(u.__e==i&&(i=U$1(u)),mr$4(u,u));return i}function hr$4(r,t,e){var i,n;if(typeof r.type==`function`){for(i=r.__k,n=0;i&&n<i.length;n++)i[n]&&(i[n].__=r,t=hr$4(i[n],t,e));return t}r.__e!=t&&(t&&r.type&&!e.contains(t)&&(t=U$1(r)),e.insertBefore(r.__e,t||null),t=r.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function zr$2(r,t,e,i){var n,o,_=r.key,u=r.type,l=t[e];if(l===null&&r.key==null||l&&_==l.key&&u==l.type&&(2&l.__u)==0)return e;if(i>(l!=null&&(2&l.__u)==0?1:0))for(n=e-1,o=e+1;n>=0||o<t.length;){if(n>=0){if((l=t[n])&&(2&l.__u)==0&&_==l.key&&u==l.type)return n;n--;}if(o<t.length){if((l=t[o])&&(2&l.__u)==0&&_==l.key&&u==l.type)return o;o++;}}return -1}function nr$4(r,t,e){t[0]==`-`?r.setProperty(t,e??``):r[t]=e==null?``:typeof e!=`number`||Fr$1.test(t)?e:e+`px`;}function it$1(r,t,e,i,n){var o,_;t:if(t==`style`)if(typeof e==`string`)r.style.cssText=e;else {if(typeof i==`string`&&(r.style.cssText=i=``),i)for(t in i)e&&t in e||nr$4(r.style,t,``);if(e)for(t in e)i&&e[t]==i[t]||nr$4(r.style,t,e[t]);}else if(t[0]==`o`&&t[1]==`n`)o=t!=(t=t.replace(lr$4,`$1`)),_=t.toLowerCase(),t=_ in r||t==`onFocusOut`||t==`onFocusIn`?_.slice(2):t.slice(2),r.l||(r.l={}),r.l[t+o]=e,e?i?e.u=i.u:(e.u=Tt,r.addEventListener(t,o?Pt$1:At$1,o)):r.removeEventListener(t,o?Pt$1:At$1,o);else {if(n==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in r)try{r[t]=e??``;break t}catch{}typeof e==`function`||(e==null||e===false&&t[4]!=`-`?r.removeAttribute(t):r.setAttribute(t,t==`popover`&&e==1?``:e));}}function or$4(r){return function(t){if(this.l){var e=this.l[t.type+r];if(t.t==null)t.t=Tt++;else if(t.t<e.u)return;return e(p$1.event?p$1.event(t):t)}}}function Dt$1(r,t,e,i,n,o,_,u,l,f){var h,s,E,a,g,b,O,m,v,B,c,tt,W,qt,rt,$,Rt,L=t.type;if(t.constructor!=null)return null;128&e.__u&&(l=!!(32&e.__u),o=[u=t.__e=e.__e]),(h=p$1.__b)&&h(t);t:if(typeof L==`function`)try{if(m=t.props,v=`prototype`in L&&L.prototype.render,B=(h=L.contextType)&&i[h.__c],c=h?B?B.props.value:h.__:i,e.__c?O=(s=t.__c=e.__c).__=s.__E:(v?t.__c=s=new L(m,c):(t.__c=s=new D$1(m,c),s.constructor=L,s.render=Xr$2),B&&B.sub(s),s.props=m,s.state||(s.state={}),s.context=c,s.__n=i,E=s.__d=!0,s.__h=[],s._sb=[]),v&&s.__s==null&&(s.__s=s.state),v&&L.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=A$3({},s.__s)),A$3(s.__s,L.getDerivedStateFromProps(m,s.__s))),a=s.props,g=s.state,s.__v=t,E)v&&L.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),v&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else {if(v&&L.getDerivedStateFromProps==null&&m!==a&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(m,c),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(m,s.__s,c)===!1||t.__v==e.__v){for(t.__v!=e.__v&&(s.props=m,s.state=s.__s,s.__d=!1),t.__e=e.__e,t.__k=e.__k,t.__k.some(function(F){F&&(F.__=t);}),tt=0;tt<s._sb.length;tt++)s.__h.push(s._sb[tt]);s._sb=[],s.__h.length&&_.push(s);break t}s.componentWillUpdate!=null&&s.componentWillUpdate(m,s.__s,c),v&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(a,g,b);});}if(s.context=c,s.props=m,s.__P=r,s.__e=!1,W=p$1.__r,qt=0,v){for(s.state=s.__s,s.__d=!1,W&&W(t),h=s.render(s.props,s.state,s.context),rt=0;rt<s._sb.length;rt++)s.__h.push(s._sb[rt]);s._sb=[];}else do s.__d=!1,W&&W(t),h=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++qt<25);s.state=s.__s,s.getChildContext!=null&&(i=A$3(A$3({},i),s.getChildContext())),v&&!E&&s.getSnapshotBeforeUpdate!=null&&(b=s.getSnapshotBeforeUpdate(a,g)),$=h,h!=null&&h.type===ut$3&&h.key==null&&($=dr$4(h.props.children)),u=ar$4(r,_t$3($)?$:[$],t,e,i,n,o,_,u,l,f),s.base=t.__e,t.__u&=-161,s.__h.length&&_.push(s),O&&(s.__E=s.__=null);}catch(F){if(t.__v=null,l||o!=null)if(F.then){for(t.__u|=l?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;o[o.indexOf(u)]=null,t.__e=u;}else for(Rt=o.length;Rt--;)wt$1(o[Rt]);else t.__e=e.__e,t.__k=e.__k;p$1.__e(F,t,e);}else o==null&&t.__v==e.__v?(t.__k=e.__k,t.__e=e.__e):u=t.__e=Qr$2(e.__e,t,e,i,n,o,_,l,f);return (h=p$1.diffed)&&h(t),128&t.__u?void 0:u}function pr$4(r,t,e){for(var i=0;i<e.length;i++)Ut$1(e[i],e[++i],e[++i]);p$1.__c&&p$1.__c(t,r),r.some(function(n){try{r=n.__h,n.__h=[],r.some(function(o){o.call(n);});}catch(o){p$1.__e(o,n.__v);}});}function dr$4(r){return typeof r!=`object`||r==null||r.__b&&r.__b>0?r:_t$3(r)?r.map(dr$4):A$3({},r)}function Qr$2(r,t,e,i,n,o,_,u,l){var f,h,s,E,a,g,b,O=e.props,m=t.props,v=t.type;if(v==`svg`?n=`http://www.w3.org/2000/svg`:v==`math`?n=`http://www.w3.org/1998/Math/MathML`:n||(n=`http://www.w3.org/1999/xhtml`),o!=null){for(f=0;f<o.length;f++)if((a=o[f])&&`setAttribute`in a==!!v&&(v?a.localName==v:a.nodeType==3)){r=a,o[f]=null;break}}if(r==null){if(v==null)return document.createTextNode(m);r=document.createElementNS(n,v,m.is&&m),u&&(p$1.__m&&p$1.__m(t,o),u=false),o=null;}if(v==null)O===m||u&&r.data==m||(r.data=m);else {if(o=o&&st$2.call(r.childNodes),O=e.props||j$3,!u&&o!=null)for(O={},f=0;f<r.attributes.length;f++)O[(a=r.attributes[f]).name]=a.value;for(f in O)if(a=O[f],f!=`children`){if(f==`dangerouslySetInnerHTML`)s=a;else if(!(f in m)){if(f==`value`&&`defaultValue`in m||f==`checked`&&`defaultChecked`in m)continue;it$1(r,f,null,a,n);}}for(f in m)a=m[f],f==`children`?E=a:f==`dangerouslySetInnerHTML`?h=a:f==`value`?g=a:f==`checked`?b=a:u&&typeof a!=`function`||O[f]===a||it$1(r,f,a,O[f],n);if(h)u||s&&(h.__html==s.__html||h.__html==r.innerHTML)||(r.innerHTML=h.__html),t.__k=[];else if(s&&(r.innerHTML=``),ar$4(t.type==`template`?r.content:r,_t$3(E)?E:[E],t,e,i,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:n,o,_,o?o[0]:e.__k&&U$1(e,0),u,l),o!=null)for(f=o.length;f--;)wt$1(o[f]);u||(f=`value`,v==`progress`&&g==null?r.removeAttribute(`value`):g!=null&&(g!==r[f]||v==`progress`&&!g||v==`option`&&g!=O[f])&&it$1(r,f,g,O[f],n),f=`checked`,b!=null&&b!=r[f]&&it$1(r,f,b,O[f],n));}return r}function Ut$1(r,t,e){try{if(typeof r==`function`){var i=typeof r.__u==`function`;i&&r.__u(),i&&t==null||(r.__u=r(t));}else r.current=t;}catch(n){p$1.__e(n,e);}}function mr$4(r,t,e){var i,n;if(p$1.unmount&&p$1.unmount(r),(i=r.ref)&&(i.current&&i.current!=r.__e||Ut$1(i,null,t)),(i=r.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(o){p$1.__e(o,t);}i.base=i.__P=null;}if(i=r.__k)for(n=0;n<i.length;n++)i[n]&&mr$4(i[n],t,e||typeof r.type!=`function`);e||wt$1(r.__e),r.__c=r.__=r.__e=void 0;}function Xr$2(r,t,e){return this.constructor(r,e)}function Ye$3(r,t,e){var i,n,o,_;t==document&&(t=document.documentElement),p$1.__&&p$1.__(r,t),n=(i="undefined"==`function`)?null:t.__k,o=[],_=[],Dt$1(t,r=(t).__k=Yr$2(ut$3,null,[r]),n||j$3,j$3,t.namespaceURI,n?null:t.firstChild?st$2.call(t.childNodes):null,o,n?n.__e:t.firstChild,i,_),pr$4(o,r,_);}st$2=fr$3.slice,p$1={__e:function(r,t,e,i){for(var n,o,_;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&o.getDerivedStateFromError!=null&&(n.setState(o.getDerivedStateFromError(r)),_=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(r,i||{}),_=n.__d),_)return n.__E=n}catch(u){r=u;}throw r}},sr$3=0,Ct$2=function(r){return r!=null&&r.constructor==null},D$1.prototype.setState=function(r,t){var e=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A$3({},this.state);typeof r==`function`&&(r=r(A$3({},e),this.props)),r&&A$3(e,r),r!=null&&this.__v&&(t&&this._sb.push(t),ir$4(this));},D$1.prototype.forceUpdate=function(r){this.__v&&(this.__e=true,r&&this.__h.push(r),ir$4(this));},D$1.prototype.render=ut$3,w$3=[],_r$4=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ur$4=function(r,t){return r.__v.__b-t.__v.__b},ot$2.__r=0,lr$4=/(PointerCapture)$|Capture$/i,Tt=0,At$1=or$4(false),Pt$1=or$4(true);var Vt$2,y$1,Mt$2,vr$3,Er$3=0,Rr$3=[],N$3=p$1,gr$4=N$3.__b,Nr$3=N$3.__r,Sr$3=N$3.diffed,Or$3=N$3.__c,Ir$3=N$3.unmount,yr$3=N$3.__;function jr$2(r,t){N$3.__h&&N$3.__h(y$1,r,Er$3||t),Er$3=0;var e=y$1.__H||(y$1.__H={__:[],__h:[]});return r>=e.__.length&&e.__.push({}),e.__[r]}function kt$3(r,t){var e=jr$2(Vt$2++,7);return Zr$2(e.__H,t)&&(e.__=r(),e.__H=t,e.__h=r),e.__}function qr$3(){for(var r;r=Rr$3.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(lt$3),r.__H.__h.forEach(Ht$2),r.__H.__h=[];}catch(t){r.__H.__h=[],N$3.__e(t,r.__v);}}N$3.__b=function(r){y$1=null,gr$4&&gr$4(r);},N$3.__=function(r,t){r&&t.__k&&t.__k.__m&&(r.__m=t.__k.__m),yr$3&&yr$3(r,t);},N$3.__r=function(r){Nr$3&&Nr$3(r),Vt$2=0;var t=(y$1=r.__c).__H;t&&(Mt$2===y$1?(t.__h=[],y$1.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0;})):(t.__h.forEach(lt$3),t.__h.forEach(Ht$2),t.__h=[],Vt$2=0)),Mt$2=y$1;},N$3.diffed=function(r){Sr$3&&Sr$3(r);var t=r.__c;t&&t.__H&&(t.__H.__h.length&&(Rr$3.push(t)!==1&&vr$3===N$3.requestAnimationFrame||((vr$3=N$3.requestAnimationFrame)||Jr$2)(qr$3)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0;})),Mt$2=y$1=null;},N$3.__c=function(r,t){t.some(function(e){try{e.__h.forEach(lt$3),e.__h=e.__h.filter(function(i){return !i.__||Ht$2(i)});}catch(i){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],N$3.__e(i,e.__v);}}),Or$3&&Or$3(r,t);},N$3.unmount=function(r){Ir$3&&Ir$3(r);var t,e=r.__c;e&&e.__H&&(e.__H.__.forEach(function(i){try{lt$3(i);}catch(n){t=n;}}),e.__H=void 0,t&&N$3.__e(t,e.__v));};var br$3=typeof requestAnimationFrame==`function`;function Jr$2(r){var t,e=function(){clearTimeout(i),br$3&&cancelAnimationFrame(t),setTimeout(r);},i=setTimeout(e,35);br$3&&(t=requestAnimationFrame(e));}function lt$3(r){var t=y$1,e=r.__c;typeof e==`function`&&(r.__c=void 0,e()),y$1=t;}function Ht$2(r){var t=y$1;r.__c=r.__(),y$1=t;}function Zr$2(r,t){return !r||r.length!==t.length||t.some(function(e,i){return e!==r[i]})}var te$3=Symbol.for(`preact-signals`);function Bt$2(){if(M$5>1)M$5--;else {for(var r,t=false;q$2!==void 0;){var e=q$2;for(q$2=void 0,Gt$1++;e!==void 0;){var i=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&xr$3(e))try{e.c();}catch(n){t||(r=n,t=true);}e=i;}}if(Gt$1=0,M$5--,t)throw r}}var d$1=void 0;var q$2=void 0,M$5=0,Gt$1=0,ft$3=0;function Lr$2(r){if(d$1!==void 0){var t=r.n;if(t===void 0||t.t!==d$1)return t={i:0,S:r,p:d$1.s,n:void 0,t:d$1,e:void 0,x:void 0,r:t},d$1.s!==void 0&&(d$1.s.n=t),d$1.s=t,r.n=t,32&d$1.f&&r.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=d$1.s,t.n=void 0,d$1.s.n=t,d$1.s=t),t}}function S$2(r){this.v=r,this.i=0,this.n=void 0,this.t=void 0;}S$2.prototype.brand=te$3;S$2.prototype.h=function(){return true};S$2.prototype.S=function(r){this.t!==r&&r.e===void 0&&(r.x=this.t,this.t!==void 0&&(this.t.e=r),this.t=r);};S$2.prototype.U=function(r){if(this.t!==void 0){var t=r.e,e=r.x;t!==void 0&&(t.x=e,r.e=void 0),e!==void 0&&(e.e=t,r.x=void 0),r===this.t&&(this.t=e);}};S$2.prototype.subscribe=function(r){var t=this;return Z$1(function(){var e=t.value,i=d$1;d$1=void 0;try{r(e);}finally{d$1=i;}})};S$2.prototype.valueOf=function(){return this.value};S$2.prototype.toString=function(){return this.value+``};S$2.prototype.toJSON=function(){return this.value};S$2.prototype.peek=function(){var r=d$1;d$1=void 0;try{return this.value}finally{d$1=r;}};Object.defineProperty(S$2.prototype,`value`,{get:function(){var r=Lr$2(this);return r!==void 0&&(r.i=this.i),this.v},set:function(r){if(r!==this.v){if(Gt$1>100)throw new Error(`Cycle detected`);this.v=r,this.i++,ft$3++,M$5++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N();}finally{Bt$2();}}}});function R$2(r){return new S$2(r)}function xr$3(r){for(var t=r.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return true;return false}function Ar$3(r){for(var t=r.s;t!==void 0;t=t.n){var e=t.S.n;if(e!==void 0&&(t.r=e),t.S.n=t,t.i=-1,t.n===void 0){r.s=t;break}}}function Pr$3(r){for(var t=r.s,e=void 0;t!==void 0;){var i=t.p;t.i===-1?(t.S.U(t),i!==void 0&&(i.n=t.n),t.n!==void 0&&(t.n.p=i)):e=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=i;}r.s=e;}function V$3(r){S$2.call(this,void 0),this.x=r,this.s=void 0,this.g=ft$3-1,this.f=4;}(V$3.prototype=new S$2).h=function(){if(this.f&=-3,1&this.f)return false;if((36&this.f)==32||(this.f&=-5,this.g===ft$3))return true;if(this.g=ft$3,this.f|=1,this.i>0&&!xr$3(this))return this.f&=-2,true;var r=d$1;try{Ar$3(this),d$1=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++);}catch(e){this.v=e,this.f|=16,this.i++;}return d$1=r,Pr$3(this),this.f&=-2,true};V$3.prototype.S=function(r){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t);}S$2.prototype.S.call(this,r);};V$3.prototype.U=function(r){if(this.t!==void 0&&(S$2.prototype.U.call(this,r),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t);}};V$3.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var r=this.t;r!==void 0;r=r.x)r.t.N();}};Object.defineProperty(V$3.prototype,`value`,{get:function(){if(1&this.f)throw new Error(`Cycle detected`);var r=Lr$2(this);if(this.h(),r!==void 0&&(r.i=this.i),16&this.f)throw this.v;return this.v}});function Wt$1(r){return new V$3(r)}function Cr$3(r){var t=r.u;if(r.u=void 0,typeof t==`function`){M$5++;var e=d$1;d$1=void 0;try{t();}catch(i){throw r.f&=-2,r.f|=8,$t$2(r),i}finally{d$1=e,Bt$2();}}}function $t$2(r){for(var t=r.s;t!==void 0;t=t.n)t.S.U(t);r.x=void 0,r.s=void 0,Cr$3(r);}function re$3(r){if(d$1!==this)throw new Error(`Out-of-order effect`);Pr$3(this),d$1=r,this.f&=-2,8&this.f&&$t$2(this),Bt$2();}function J$2(r){this.x=r,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32;}J$2.prototype.c=function(){var r=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.u=t);}finally{r();}};J$2.prototype.S=function(){if(1&this.f)throw new Error(`Cycle detected`);this.f|=1,this.f&=-9,Cr$3(this),Ar$3(this),M$5++;var r=d$1;return d$1=this,re$3.bind(this,r)};J$2.prototype.N=function(){2&this.f||(this.f|=2,this.o=q$2,q$2=this);};J$2.prototype.d=function(){this.f|=8,1&this.f||$t$2(this);};function Z$1(r){var t=new J$2(r);try{t.c();}catch(e){throw t.d(),e}return t.d.bind(t)}var Ft$2;function H$4(r,t){p$1[r]=t.bind(null,p$1[r]||function(){});}function ct$3(r){Ft$2&&Ft$2(),Ft$2=r&&r.S();}function Tr$2(r){var t=this,e=r.data,i=ie$4(e);i.value=e;var n=kt$3(function(){for(var o=t.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return t.__$u.c=function(){var _,u=t.__$u.S(),l=n.value;u(),Ct$2(l)||((_=t.base)==null?void 0:_.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=l;},Wt$1(function(){var _=i.value.value;return _===0?0:_===true?``:_||``})},[]);return n.value}Tr$2.displayName=`_st`;Object.defineProperties(S$2.prototype,{constructor:{configurable:true,value:void 0},type:{configurable:true,value:Tr$2},props:{configurable:true,get:function(){return {data:this}}},__b:{configurable:true,value:1}});H$4(`__b`,function(r,t){if(typeof t.type==`string`){var e,i=t.props;for(var n in i)if(n!==`children`){var o=i[n];o instanceof S$2&&(e||(t.__np=e={}),e[n]=o,i[n]=o.peek());}}r(t);});H$4(`__r`,function(r,t){ct$3();var e,i=t.__c;i&&(i.__$f&=-2,(e=i.__$u)===void 0&&(i.__$u=e=(function(n){var o;return Z$1(function(){o=this;}),o.c=function(){i.__$f|=1,i.setState({});},o})())),ct$3(e),r(t);});H$4(`__e`,function(r,t,e,i){ct$3(),r(t,e,i);});H$4(`diffed`,function(r,t){ct$3();var e;if(typeof t.type==`string`&&(e=t.__e)){var i=t.__np,n=t.props;if(i){var o=e.U;if(o)for(var _ in o){var u=o[_];u!==void 0&&!(_ in i)&&(u.d(),o[_]=void 0);}else e.U=o={};for(var l in i){var f=o[l],h=i[l];f===void 0?(f=ee$2(e,l,h,n),o[l]=f):f.o(h,n);}}}r(t);});function ee$2(r,t,e,i){var n=t in r&&r.ownerSVGElement===void 0,o=R$2(e);return {o:function(_,u){o.value=_,i=u;},d:Z$1(function(){var _=o.value.value;i[t]!==_&&(i[t]=_,n?r[t]=_:_?r.setAttribute(t,_):r.removeAttribute(t));})}}H$4(`unmount`,function(r,t){if(typeof t.type==`string`){var e=t.__e;if(e){var i=e.U;if(i){e.U=void 0;for(var n in i){var o=i[n];o&&o.d();}}}}else {var _=t.__c;if(_){var u=_.__$u;u&&(_.__$u=void 0,u.d());}}r(t);});H$4(`__h`,function(r,t,e,i){(i<3||i===9)&&(t.__$f|=2),r(t,e,i);});D$1.prototype.shouldComponentUpdate=function(r,t){var e=this.__$u,i=e&&e.s!==void 0;for(var n in t)return true;if(this.__f||typeof this.u==`boolean`&&this.u===true){if(!(i||2&this.__$f||4&this.__$f)||1&this.__$f)return true}else if(!(i||4&this.__$f)||3&this.__$f)return true;for(var o in r)if(o!==`__source`&&r[o]!==this.props[o])return true;for(var _ in this.props)if(!(_ in r))return true;return false};function ie$4(r){return kt$3(function(){return R$2(r)},[])}var at$2=class at{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price;}};var ht$3=class ht{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url;}};var pt$2=class pt{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d;}};var Kt$2=class Kt{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??false;}},dt$2=class dt{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(e=>new ht$3(e))??[],this.link=t.link,this.price=new pt$2(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=R$2(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=R$2(void 0)),this.sellingPlans=t.sellingPlans?.map(e=>{let i=new Kt$2(e);return i.isSelected&&(this.selectedSellingPlan.value=i),i});}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t;}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};function zt$1(r,t){for(let e of r){let i=t.get(e.attr),n=Array.isArray(i),o=typeof i==`string`,_=typeof i==`number`&&typeof e.value==`number`,u=Array.isArray(e.value),l=true;switch(e.op){case `contains`:l=(n||o)&&i.includes(e.value);break;case `notContains`:l=(n||o)&&!i.includes(e.value);break;case `eq`:l=i===e.value;break;case `ne`:l=i!==e.value;break;case `gt`:l=_&&i>e.value;break;case `gte`:l=_&&i>=e.value;break;case `lt`:l=_&&i<e.value;break;case `lte`:l=_&&i<=e.value;break;case `in`:l=u&&e.value.includes(i);break;case `nin`:l=u&&!e.value.includes(i);break;case `between`:l=_&&u&&e.value.length===2&&i>=e.value[0]&&i<=e.value[1];break;case `all`:l=n&&u&&e.value.every(f=>i.includes(f));break;default:l=false;break}if(!l)return false}return true}var mt$3=class mt{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;cardClasses;selectedOrFirstVariant;selected=R$2(true);selectedQty=R$2(1);_showAddToCartButton;constructor(t){this.update(t),this.selectedOrFirstVariant=R$2(this.selectedVariant),this._showAddToCartButton=this.evaluateShowATCFlag();}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get showAddToCartButton(){return this._showAddToCartButton}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant;}set selectedQuantity(t){this.selectedQty.value=Math.max(1,t);}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(t){this.selectedOrFirstVariant.value=t;}setSelectedVariantByID(t){if(!t)return;let e=this.vars.find(i=>i.mID===t.toString());e&&this.setSelectedVariant(e);}update(t){return this.id=t.id??this.id,this.mID=t.mID??this.mID,this.name=t.name??this.name,this.imgs=t.imgs??this.imgs,this.desc=t.desc??this.desc,this.link=t.link??this.link,this.slug=t.slug??this.slug,this.quantity=t.quantity??this.quantity,this.meta=t.meta??this.meta,this.category=t.category??this.category,this.reviews=t.reviews??this.reviews,this.options=t.options??this.options,this.tags=t.tags??this.tags,this.templateSuffix=t.templateSuffix??this.templateSuffix,t.vars&&(this.vars=t.vars.map(e=>new dt$2(e))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new at$2({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,e=t.price,i=this.name,n=this.category,o=this.variantImage??this.firstImageURL,_=this.meta,u=this.tags?.join(`,`)??``,l=this.reviews?.rating,f=this.reviews?.totalReviews,h=e.cmp&&e.cmp>e.d,s$1=s$3(r$2({name:i},$n$1(`price`,e.d,true)),{image_url:o,meta:_,category:n,rating:l,reviews:f,tags:u,variant_count:this.vars?.length??0});if(t.hasEffectivePrice()){let a=$n$1(`effective_price`,t.effectivePrice.value,true);Object.assign(s$1,a);}if(h){let a=e.cmp-e.d,g={discount_percent:(a/e.cmp*100).toFixed(0)};Object.assign(s$1,g),Object.assign(s$1,$n$1(`compare_price`,e.cmp)),Object.assign(s$1,$n$1(`discount_price`,a));}return {product:s$1,variant:{name:t.name,quantity:t.quantity}}}evaluateShowATCFlag(){let t=he$4.get().widgetCustomisation?.atcButton?.showWhen;if(!t?.predicates?.length)return true;let e=t.predicates,i=this.getValueMap(e);return t.op===`or`?e.some(n=>zt$1([n],i)):zt$1(e,i)}getValueMap(t){let e=new Map;for(let i of t){let n=i.attr.split(`.`);switch(n[1]){case `tags`:e.set(i.attr,this.tags);break;case `type`:case `category`:e.set(i.attr,this.category);break;case `meta`:case `metafield`:{let _=n[2];if(!_)continue;e.set(i.attr,this.meta?.[_]);break}}}return e}};var vt$2=class vt{id;alt;shortID;sources;items;durationMS;thumbnail;card;bestSource;highSource;goodSource;lowSource;m3u8Source;constructor(t={}){if(this.id=t.id,this.alt=t.alt,this.shortID=t.shortID,this.sources=t.sources?.sort((e,i)=>i.height-e.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(e=>new mt$3(e)):[],this.card=t.card,this.sources){let e=[];for(let i of this.sources)i.format===`mp4`?e.push(i):i.format===`m3u8`&&!this.m3u8Source&&(this.m3u8Source=i);e.length>0&&(this.bestSource=e[0],this.highSource=e.length>1?e[1]:e[0],this.lowSource=e.length>2?e[e.length-1]:e[0]);}}};var ne$2=(e=>(e.CLASSIC=`CLASSIC`,e.ITEM_CARD_HEADER=`ITEM_CARD_HEADER`,e))(ne$2||{});var oe$5=(i=>(i.ON=`ON`,i.OFF=`OFF`,i.ON_HOVER=`ON_HOVER`,i))(oe$5||{}),se$4=(n=>(n.FIRST_ITEM=`FIRST_ITEM`,n.ITEM_SWIPER=`ITEM_SWIPER`,n.CARD=`CARD`,n.NONE=`NONE`,n))(se$4||{});var wr$3=class wr{videoEntries;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(t={}){this.videoEntries=t.videoEntries?.map(e=>({video:new vt$2(e.video),title:e.title}))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:`VIDEO_ONLY_VIEW`},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.autoPlay=t.autoPlay??`ON`,this.footerContent=t.footerContent??`FIRST_ITEM`,this.playlistConfig={videoSwiper:t.playlistConfig?.videoSwiper??void 0,itemCardClickBehavior:t.playlistConfig?.itemCardClickBehavior??`OPEN_VIDEO_DETAIL`},this.itemDetailConfig={template:t.itemDetailConfig?.template??`CLASSIC`};}showItems(){return this.footerContent===`FIRST_ITEM`||this.footerContent===`ITEM_SWIPER`}};var Dr$2=class Dr{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new P$2(t.bg)),t.br&&(this.br=new C$4(t.br)),t.shd&&(this.shd=new Q$2(t.shd)),t.spc&&(this.spc=new T$1(t.spc)),this.trf=new X$3(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a;}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return k$3[this.t]}get click(){return this.clc}},k$3=(c=>(c[c.IMAGE=1]=`IMAGE`,c[c.TEXT=2]=`TEXT`,c[c.BUTTON=3]=`BUTTON`,c[c.FLEXBOX=4]=`FLEXBOX`,c[c.MULTI_COLUMN=5]=`MULTI_COLUMN`,c[c.CHECKBOX=6]=`CHECKBOX`,c[c.PARTIAL=8]=`PARTIAL`,c[c.PRODUCTS=11]=`PRODUCTS`,c[c.PRODUCT=12]=`PRODUCT`,c[c.PRODUCT_IMAGE=13]=`PRODUCT_IMAGE`,c[c.PRODUCT_TITLE=14]=`PRODUCT_TITLE`,c[c.PRODUCT_VARIATIONS=15]=`PRODUCT_VARIATIONS`,c[c.PRODUCT_VARIATIONS_SELLING_PLANS=16]=`PRODUCT_VARIATIONS_SELLING_PLANS`,c[c.PRODUCT_BUTTON=18]=`PRODUCT_BUTTON`,c[c.PRODUCT_RATING=19]=`PRODUCT_RATING`,c[c.EMAIL_INPUT=51]=`EMAIL_INPUT`,c[c.PHONE_INPUT=52]=`PHONE_INPUT`,c[c.COUNTDOWN_TIMER=61]=`COUNTDOWN_TIMER`,c[c.CAROUSEL=62]=`CAROUSEL`,c[c.SHAPE=100]=`SHAPE`,c))(k$3||{});var Ur$2=0;function _e$2(r=document.head){return Mr$3(fe$3.styleURL,r,`cooee-global-styles`)}function ue$3(r=document.head){return Mr$3(`${en}/swiper-bundle.min.css`,r,`swiper-styles`)}function Mr$3(r,t=document.head,e){return new Promise(i=>{if(t.querySelector(`#${e}`)){i();return}let o=document.createElement(`link`);o.rel=`stylesheet`,o.href=r,o.id=e,o.onload=()=>{i();},o.onerror=()=>{console.error(`Failed to load stylesheet:`,r),i();},t.appendChild(o);})}function le$4(r,t=document.head){if(!r)return;Ur$2++;let e=document.createElement(`style`);e.id=`cooee-app-css-${Ur$2}`,e.textContent=r,t.appendChild(e);}function Ui$2(r){if(!r)return;let t=document.createElement(`script`);t.id=`cooee-app-script`,t.innerHTML=r,document.head.appendChild(t);}function Mi$2(r){if(r)try{(0,eval)(r);}catch(t){console.error(`Failed to execute script:`,t);}}async function Vi$2(){let r=(await import(`${en}/swiper-bundle.min.mjs`)).Swiper;return window.CooeeSDK.Swiper=r}async function Hi$2(r,t=true){if(!r)return;let e=[];t&&e.push(ue$3(r)),e.push(_e$2(r)),await Promise.all(e);let i=he$4.get().website.commonCSS;le$4(i,r);}var fe$2=(function(r){return r[r.SINGLE=1]=`SINGLE`,r[r.EXCLUSION=2]=`EXCLUSION`,r[r.ABTESTING=3]=`ABTESTING`,r[r.GLOBAL_AB=4]=`GLOBAL_AB`,r})(fe$2||{});var ce$3=(function(r){return r.BEFORE=`before`,r.AFTER=`after`,r.INSIDE_FIRST=`insideFirst`,r.INSIDE_LAST=`insideLast`,r.BEFORE1=`BEFORE`,r.AFTER1=`AFTER`,r.INSIDE_FIRST1=`INSIDE_FIRST`,r.INSIDE_LAST1=`INSIDE_LAST`,r})(ce$3||{}),ae$4=(function(r){return r.SHOPIFY_CHECKOUT=`shopify_checkout`,r.THIRD_PARTY_CHECKOUT=`third_party_checkout`,r.CART_PAGE=`cart_page`,r.CART_DRAWER=`cart_drawer`,r})(ae$4||{});var he$3=(function(r){return r[r.NONE=0]=`NONE`,r[r.REJECT_POPUP=1]=`REJECT_POPUP`,r[r.ACCEPT_POPUP=2]=`ACCEPT_POPUP`,r[r.GO_TO_URL=4]=`GO_TO_URL`,r[r.SHARE=5]=`SHARE`,r[r.KEY_VALUE=100]=`KEY_VALUE`,r[r.GO_TO_PRODUCT=101]=`GO_TO_PRODUCT`,r[r.ADD_TO_CART=102]=`ADD_TO_CART`,r[r.COPY_COUPON_CODE=103]=`COPY_COUPON_CODE`,r[r.GO_TO_COLLECTION=104]=`GO_TO_COLLECTION`,r[r.OPEN_CART=105]=`OPEN_CART`,r[r.SUBMIT_FORM=106]=`SUBMIT_FORM`,r[r.INITIATE_CHECKOUT=107]=`INITIATE_CHECKOUT`,r[r.ADD_BUNDLE=108]=`ADD_BUNDLE`,r[r.UPGRADE_TO_SUBSCRIPTION=109]=`UPGRADE_TO_SUBSCRIPTION`,r[r.BUY_NOW=110]=`BUY_NOW`,r[r.QUICK_VIEW=111]=`QUICK_VIEW`,r})(he$3||{}),pe$3=(function(r){return r.POPUP=`POPUP`,r.PAGE_EMBED=`PAGE_EMBED`,r.CART_EMBED=`CART_EMBED`,r.ANNOUNCEMENT_BAR=`ANNOUNCEMENT_BAR`,r})(pe$3||{}),de$3=(function(r){return r.PRODUCT_PROMOTION=`PRODUCT_PROMOTION`,r.BUNDLE_AND_UPSELL=`BUNDLE_AND_UPSELL`,r.CART_RECOVERY=`CART_RECOVERY`,r.ANNOUNCEMENT=`ANNOUNCEMENT`,r.LEAD_GENERATION=`LEAD_GENERATION`,r.DATA_COLLECTION=`DATA_COLLECTION`,r.SALE_PROMOTION=`SALE_PROMOTION`,r.SUBSCRIPTION_UPSELL=`SUBSCRIPTION_UPSELL`,r.SHOPPABLE_VIDEO=`SHOPPABLE_VIDEO`,r.BYOB=`BYOB`,r.PROGRESS_BAR=`PROGRESS_BAR`,r.BUY_NOW=`BUY_NOW`,r.STICKY_ATC=`STICKY_ATC`,r.EXPERIMENT=`EXPERIMENT`,r.SAVINGS_BAR=`SAVINGS_BAR`,r.COLLECTION_FILTER=`COLLECTION_FILTER`,r.COLLECTION_PROMOTION=`COLLECTION_PROMOTION`,r})(de$3||{}),me$3=(function(r){return r.COOEE=`COOEE`,r.KLAVIYO=`KLAVIYO`,r})(me$3||{}),ve$3=(function(r){return r.ICONS=`ICONS`,r.TILES=`TILES`,r})(ve$3||{}),Ee$4=(function(r){return r.FREE_SHIPPING=`FREE_SHIPPING`,r.DISCOUNT=`DISCOUNT`,r.FREE_AUTO_GIFT=`FREE_AUTO_GIFT`,r.FREE_GIFT_SELECT=`FREE_GIFT_SELECT`,r.UI_ONLY=`UI_ONLY`,r})(Ee$4||{});var Et$2=class Et{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??`row`,this.wrap=t.wrap??`nowrap`,this.jc=t.jc??`flex-start`,this.ai=t.ai??`flex-start`,this.scroll=t.scroll;}};var gt$2=class gt{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex;}};var Nt$2=class Nt{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??`100%`,this.h=t.h??`auto`,this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH;}};var Qt$2=(n=>(n[n.START=0]=`START`,n[n.CENTER=1]=`CENTER`,n[n.END=2]=`END`,n[n.JUSTIFY=3]=`JUSTIFY`,n))(Qt$2||{});var St$2=class St{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!==`Arial`?t.name:``),this.name=t.name,this.fonts=t.fonts?.map(e=>new Xt$1(e));}},Xt$1=class Xt{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url;}getFontDescriptor(){return {style:this.style===2||this.style===4?`italic`:`normal`,weight:this.style===4||this.style===3?`700`:`400`}}getURL(){return `url('${this.url}') format('truetype')`}};var G$2=class G{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t);}get alignment(){return Qt$2[this.ta]}get letterSpacing(){return this.ls?this.ls+`px`:`normal`}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new I$2(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new I$2(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??=`#000000`,this.fam=new St$2(t.fam??t.fmly);}resize(t){this.s*=t,this.ls*=t;}};var Ot$2=class Ot{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new T$1(t.spc),t.size&&(this.size=new Nt$2(t.size)),t.bg&&(this.bg=new P$2(t.bg)),t.br&&(this.br=new C$4(t.br)),t.typo&&(this.typo=new G$2(t.typo)),t.lout&&(this.lout=new gt$2(t.lout)),t.flex&&(this.flex=new Et$2(t.flex));}},It$2=class It{sm;lg;constructor(t){t??={},this.sm=new Ot$2(t.sm),this.lg=new Ot$2(t.lg);}};var yt$1=class yt{t;classes;style;hide;when;clc;l;constructor(t,e){e??={},this.t=t,this.classes=e.classes??``,this.style=new It$2(e.style),this.hide=e.hide,this.l=e.l,e.when?.op&&(this.when=e.when),e.clc&&(this.clc=e.clc);}get stringType(){return k$3[this.t]}};var bt$1=class bt extends yt$1{text;constructor(t,e){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(e??2,t),t??={},this.text=t.text;}};var ge$3=(i=>(i.SINGLE=`SINGLE`,i.MULTIPLE=`MULTIPLE`,i.CHIPS=`CHIPS`,i))(ge$3||{}),Vr$3=class Vr extends bt$1{showChips;optionsConfig;type;horizontal;constructor(t=15,e){super(e,t),e??={},this.showChips=e.showChips??false,this.optionsConfig=e.optionsConfig??{},this.horizontal=e.horizontal,e.type?this.type=e.type:e.showChips?this.type=`CHIPS`:this.type=`SINGLE`;}};var Ne$3=(i=>(i[i.LOW=1]=`LOW`,i[i.MEDIUM=2]=`MEDIUM`,i[i.HIGH=3]=`HIGH`,i))(Ne$3||{}),Se$5=(e=>(e.SINGLE_PANE=`SINGLE_PANE`,e.TWO_PANE=`TWO_PANE`,e))(Se$5||{});function vn(r){if(!r)return {display:`block`};let t={display:r.disp};return r.of&&(t.objectFit=r.of),r.pos===`absolute`&&(t.width=`auto !important`,t.position=`absolute`,t.right=r.right+`px`,t.left=r.left+`px`,t.top=r.top+`px`,t.bottom=r.bottom+`px`),t}function En(r){return r?{gap:r.gap+`px`,flexWrap:r.wrap,flexDirection:r.dir,justifyContent:r.jc,alignItems:r.ai,width:`100%`}:{}}function Hr$3(r,t,e){if(e??={},r.type===`LINEAR`){let i=`linear-gradient(${r.ang}deg, ${r.c1}, ${r.c2}`;r.c3&&(i+=`, ${r.c3}`),i+=`)`,e[t]=i;}return e}function jt$2(r,t=`color`,e){return e??={},r?r.grad?Hr$3(r.grad,t,e):(r.hex&&(e[t]=r.rgba),e):e}function x$2(r,t){return Oe$2(r,t)+`px`}function Oe$2(r,t=1){return (r??0)*t}function gn(r){let t={};return r?.w&&(t.width=r.w),r?.h&&(t.height=r.h),r?.maxW&&(t.maxWidth=r.maxW),r?.maxH&&(t.maxHeight=r.maxH),r?.minW&&(t.minWidth=r.minW),r?.minH&&(t.minHeight=r.minH),t}function Nn$1(r,t){if(!r)return {};let e={};return r.radius&&r.radius>0&&(e.borderRadius=x$2(r.radius,t)),r.width&&r.width>0&&(e.borderWidth=x$2(r.width,t),e.borderStyle=r.style?.toLowerCase(),r.color?jt$2(r.color,`border-color`,e):e.borderColor=`black`),e}function Sn(r,t){let e={};return r?(e.paddingTop=x$2(r.pt,t),e.paddingBottom=x$2(r.pb,t),e.paddingLeft=x$2(r.pl,t),e.paddingRight=x$2(r.pr,t),e.marginTop=x$2(r.mt,t),e.marginBottom=x$2(r.mb,t),e.marginLeft=r.cent?`auto`:x$2(r.ml,t),e.marginRight=r.cent?`auto`:x$2(r.mr,t),e):(e.margin=`0 !important`,e.padding=`unset`,e)}function On(r){if(!r)return {};let t={};if(r.glossy){let e=`backdrop-filter`,i=`-webkit-`+e,n=`blur(${r.glossy.radius}px)`;if(!CSS.supports(i,n)&&!CSS.supports(e,n))return {background:r.glossy.fallback.rgba};if(t[i]=n,t[e]=n,r.glossy.color)return jt$2(r.glossy.color,`background`,t)}else if(r.solid){if(r.solid.grad)return Hr$3(r.solid.grad,`background`,t);if(r.solid.hex)return {backgroundColor:r.solid.rgba}}else if(r.img){if(!r.img.src)return {};let e=(r.img.a??0)/100;t.background=`linear-gradient(rgba(0, 0, 0, ${e}), rgba(0, 0, 0, ${e})),url("${r.img.src}") no-repeat center`,t.backgroundSize=`cover`,r.img.a&&(t[`-webkit-backdrop-filter`]=`opacity(${r.img.a})`,t.backdropFilter=`opacity(${r.img.a})`);}return t}function In(r=new G$2){let t={};return t.letterSpacing=r.letterSpacing,t.fontSize=r.fs+`px`,t.lineHeight=r.lh,t.fontFamily=r.fam.name||`inherit`,t.textAlign=r.alignment,t.fontWeight=r.fw,t.textDecoration=r.td??`none`,jt$2(r.tc,`color`,t),t.boxShadow=`none`,t}
|
|
13
13
|
|
|
14
14
|
var i=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new I$2(e.color);}},l$2=class l{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new I$2(e.color);}},r$1=class r{enabled;delay;constructor(e={}){this.enabled=e.enabled,e.delay&&(this.delay=e.delay>100?e.delay:e.delay*1e3);}},s$2=class s{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(e){e??={},this.navigation=new l$2(e.navigation),this.pagination=new i(e.pagination),this.autoplay=new r$1(e.autoplay),this.loop=e.loop??false,this.maxInRow=e.maxInRow??4,this.gap=e.gap??0,this.maxInRowSm=e.maxInRowSm??this.maxInRow,this.gapSm=e.gapSm??this.gap,e.speed&&(this.speed=e.speed*1e3),this.marquee=e.marquee;}};
|
|
15
15
|
|
|
@@ -48,7 +48,7 @@ var Me=class{constructor(e,t){this._startTime=e;this._triggerData=t;}intervals=[
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
`;function $n(){Zo().catch(r=>{Y$2.error(`Fail to add attributes in cart`,r);});}async function Jo(){let e=await(await fetch(window.Shopify.routes.root+`browsing_context_suggestions.json?country[enabled]=true&country[exclude]=${window.Shopify.country}&language[enabled]=true&language[exclude]=${window.Shopify.language}`)).json(),t=he$4.get().storefrontToken,n=new Headers;n.append(`x-shopify-storefront-access-token`,t),n.append(`Content-Type`,`application/json`),await He$1(Yo,{metafields:[{key:`currentCountry`,ownerId:`gid://shopify/Cart/${h.getCurrent().token}`,type:`single_line_text_field`,value:e.detected_values.country.handle}]},`add-cart-metafields-set`);}function Qo(){h.getCurrent().token?Jo().catch(r=>{Y$2.error(`Fail to update cart metafields`,r);}):setTimeout(Qo,500);}async function Zo(){await Or.acquire();let r=h.getCurrent(),e=await Mr$4();if(r.attributes?.letscooee_did===e.letscooee_did&&r.attributes?.letscooee_sn===e.letscooee_sn){Y$2.verbose(`Not calling Shopify update.js API.`,`Current attributes:`,r.attributes),Or.release();return}try{let t=await we$1(`/cart/update.js`,{attributes:e});Y$2.verbose(`Updated cart attributes`,JSON.stringify(t.data)),r.update(t.data);}catch(t){Y$2.error(`Failed to add cart attributes`,t);}Or.release();}var ei=r=>r,Hn=r=>r.filter(e=>e.removedNodes&&e.removedNodes.length>0);function qn(r,e={childList:true,subtree:true},t=500,n=ei){return te$1(o=>{let i=new MutationObserver(s=>o(s));return i.observe(r,e),i},(o,i)=>i.disconnect()).pipe(q$1(o=>n(o)),Ir$1(o=>o.length>0),Fe$2(t))}var Yn=x$3(St$3());var Kn=new U,Xn=new U;function Kl(){return Xn.asObservable()}function rr$1(){Kn.next();}Kn.pipe(Fe$2(100)).subscribe(ii.bind(void 0));function Xl(){rr$1(),ti(),ri();}function ti(){let r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener(`load`,function(){zn(this._url).catch(e=>Y$2.error(`Unable to process cart change in XMLHttpRequest`,e));}),r.apply(this,arguments)},Y$2.verbose(`Securely overwritten window.XMLHttpRequest.send method`);}function ri(){let r=window.fetch;try{window.fetch=async function(e,t){return r(e,t).then(n=>{let o=``;try{o=typeof e==`string`||e instanceof URL?e.toString():e?.url??n?.url??``;}catch{}return zn(o).catch(i=>Y$2.error(`Unable to process cart change in fetch`,i)),n})},Y$2.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$2.error(e);}}async function zn(r){ni(r)&&rr$1();}function ni(r){return /\/cart\/(add|change|update|clear)/.test(r)}function oi(r$1,e){let t=r$1?.items,n=e.items,o=[],i=[];if(Y$2.verbose(`Comparing cart change with old count ${t?.length} to new count ${n.length}`),n?.forEach(s$4=>{let c=t?.find(p=>p.vID===s$4.vID);if(c){if(c.quantity!==s$4.quantity){let p=c.quantity<s$4.quantity,u=Math.abs(c.quantity-s$4.quantity),d=s$3(r$2({},s$4),{quantity:u});p?o.push(d):i.push(d);}t&&Wn$1(t,c);}else o.push(s$4);}),t)for(let s of t)i.push(s);Y$2.verbose(`Cart delta: added: ${o.length}, removed: ${i.length}`),o.length&&Gn(`Add To Cart`,{items:o}),i.length&&r$1.token===e.token&&Gn(`Remove From Cart`,{items:i}),(i.length||o.length)&&Xn.next({itemsAdded:o,itemsRemoved:i,cart:e});}function Gn(r,e){jn(new Ir$2(r,e));}async function ii(){oi(await ce$4.get(`cart`,{}),await h.getCurrent().getNormalisedCart(true));}var _=class r{static cartDrawerToggle$=new Sr$1({open:false,firstOpen:false});static DEFAULT_SELECTOR=`cart-drawer`;static _instance;inShadow=false;cartDrawerElement;cartDrawerShadowElement;configWebsite=he$4.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$3(this.cartDrawerElement);return Y$2.info(`Cart drawer is currently ${e?`open`:`close`}`),e}open(){if(this.isOpen()){Y$2.log(`Drawer is already open`);return}document.dispatchEvent(new CustomEvent(`letscooee:outbound:open-cart`));let e=document.querySelector(this.iconSelector);if(!e){Y$2.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(n){Fe$4(n,`execute-cooeeUpdateCartDrawer`);}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove(`is-empty`),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,o=e.items[0].quantity,i=e.items[0].price;window.cartGiftUpdate(n,i,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 n=document.querySelector(`a[href="/cart"]`);n&&n.click();}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?h.getCurrent().getNormalisedCart(true).then(()=>{window.refreshCart(h.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$2.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:h.getCurrent()}})),t&&rr$1();}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(!Je$1())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Yn$1(e),!this.cartDrawerElement){Yn.default.warn(`Max attempts exhausted to find cart drawer`);return}Y$2.verbose(`Found`,this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers();}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let t=(await Yn$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$2(800,void 0,{leading:false,trailing:true})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,r.cartDrawerToggle$.next({open:n,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$3(e):false}async updateBubble(){let e=(await h.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`]);}};var Lr=new Map,nr$1=async r=>{for(let i of r.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(i,r);}catch(s){Y$2.error(s);}if(r.isCartEmbed()&&!r.isSubscriptionUpsell()){let s=(await h.getCurrent().getNormalisedCart()).items.map(c=>c.mID);r.items=r.items.filter(c=>!s.includes(c.mID));}if(r.items=Jn(r),he$4.get().currencyCount<=1)return r.items;if(r.isShoppableVideo())return await si(r.content.videoConfig,r),r.items;let e=r.items.length,t=r.items.map(i=>Qn(i,r)),o=(await Promise.all(t)).filter(i=>i!=null);if(e&&!o.length){let i=`Failed to fetch any product from Ajax API`;throw X(new Ir$2(`CE Campaign Failed`,{reason:i,currency:r.currency},r)),new Error(i)}return Jn(r,o)},Jn=(r,e=r.items)=>{if(!r.isCartRecovery())return e;let t=h.getCurrent().items,n=[];for(let o of e)for(let i of o.vars){if(!i.isAvailable)continue;let s=t.find(u=>u.variant_id.toString()===i.mID);if(!s)continue;let c=new mt$3(o);c.name=s.title;let p=new dt$2(i);p.name=s.variant_title,p.price.d=s.discounted_price/100,c.variants=[p],n.push(c);}return n},si=async(r,e)=>{await Promise.all(r.videoEntries.map(async t=>{t.video.items=await Promise.all(t.video.items.map(async n=>{return await Qn(n,e)||n}));}));},Qn=async(r,e)=>{if(Lr.has(r.mID))return Lr.get(r.mID);let t,n=`/products/${r.slug}.js`;try{t=(await fn(n)).data;}catch(o){return o instanceof ne$3&&o.response?.status===404||Fe$4(o,`fetch-shopify-product`,{extra:{item:r,path:n},engagementTrigger:e}),null}return t?ai(r,t):(Y$2.error(`Item not found after AJAX call for:`,r),null)},ai=(r,e)=>{if(!r||!e)return r;r.name=e.title,r.tags=e.tags,r.slug=e.handle;let t=r.selectedOrFirstVariant.value;return r.vars.map(n=>{let o=e.variants.find(i=>i.id===+n.mID);o!=null&&(n.name=o.title,n.isAvailable=o.available,n.price.d=o.price?o.price/100:o.price,n.price.effective=n.price.d,n.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price,+t.mID===o.id&&(t.effectivePrice.value=n.price.d));}),Lr.set(r.mID,r),r};var et=r=>{let e=r instanceof mt$3?r.selectedOrFirstVariant.value.mID:r.vID,t=r instanceof mt$3?r.selectedOrFirstVariant.value.name:r.vName;return {product_id:r.mID,product_name:r.name,variant_id:e,variant_name:t}};var kr$1=(function(r){return r.NONE=``,r.SHOPIFY=`shopify`,r.THIRD_PARTY=`third_party`,r})(kr$1||{});function Zn(r,e,t){let n=_.get();if(r===he$3.OPEN_CART||e===ae$4.CART_DRAWER){n.open(),t&&n.refreshUI(t);return}if(r===he$3.INITIATE_CHECKOUT){ci();return}if(e===ae$4.CART_PAGE){location.href=`/cart`;return}if(e===ae$4.SHOPIFY_CHECKOUT){location.href=`/checkout`;return}if(e===ae$4.THIRD_PARTY_CHECKOUT){eo(`/cart#initiate-checkout=1`);return}t&&n.refreshUI(t);}function ci(){he$4.get().checkoutProvider===kr$1.THIRD_PARTY?eo(`/cart#initiate-checkout=1`):location.href=`/checkout`;}function eo(r){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=r;}var po=x$3(St$3());var Nr=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content;}};function or$1(){let r$2$1=location.pathname===`/`?location.pathname:location.pathname.replace(/\/+$/,``);return new Nr(r$2({origin:location.origin,path:r$2$1,qs:location.search,referrer:Ye$2(),name:ke$1().pageName},Je$2()))}function Rm(){let r=ke$1(),e=new URLSearchParams(location.search),t=e.get(`cooee-preview`),n=e.get(`cooee-exp-preview`);if(t){let i=t.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));i.length&&(r.previewIDs=i);}if(n){let i=n.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));i.length&&(r.previewIDs??=[],r.previewIDs.push(...i),r.activeExperiments=true);}let o=e.get(`cooee-variant`)?.trim();o&&(r.previewVariant=o);}function ir$1(){let r$3=ke$1();return s$3(r$2(s$3(r$2({},r$3.customContext),{page:or$1(),locale:r$3.locale,currentItem:r$3.currentItem,previewIDs:r$3.previewIDs,previewVariant:r$3.previewVariant,engagementIDs:mi(),cart:Dr()}),li()),{host:window.location.host})}function li(){let r=window.CooeeSDK.uaParser.getResult();return {os:r.os,device:r.device,browser:r.browser}}function mi(){let r=document.querySelectorAll(`.letscooee-engagement`),e=[];return r.forEach(t=>{let n=t.dataset.engagementId;n&&+n&&e.push(n);}),e}var pi=`keepalive`in new Request(``),Ur=new Headers,sr={type:qr$4,code:Kr$4,version:Q$3,shopName:Mn()??``};fi();async function tt(){let[r$4]=await Promise.all([ao()]);return r$2(r$2({},ir$1()),r$4)}function to(r){le$2(z$2).then(()=>di(r??{})).catch(e=>Y$2.error(`Session not established, skipping updateProfile`,e));}function di(r){io(`/v1/user/update`,r).then(()=>{Y$2.verbose(`Updated user profile`);}).catch(e=>{Y$2.error(`Error saving user profile`,e);});}function ro(r){return ie$1(`/v1/event/generate-discount`,r)}function zm(r){le$2(z$2).then(()=>gi$1({props:r})).catch(e=>Y$2.error(`Session not established, skipping updateDeviceProps`,e));}function gi$1(r){io(`/v1/device/update`,r).then(()=>{Y$2.verbose(`Updated device properties`);}).catch(async e=>{Y$2.error(`Error saving device property`,e);});}function no(r){r&&(sr.deviceId=r);}function oo(r){r&&(sr.firstSeen=r.toUTCString());}function ie$1(r,e){return so(`POST`,r,e)}function io(r,e){return so(`PUT`,r,e)}function so(r$5,e,t){if(!Je$1())return Y$2.log(`Rejecting ${r$5} ${e} as this is not e-commerce app`),Promise.reject();e.startsWith(`http`)||(e.includes(`/event/track`)?e=(window.CooeeSDK.apiURLs?.eventURL||fe$3.apiURL)+e:e=(window.CooeeSDK.apiURLs?.baseURL||fe$3.cdnApiURL)+e);let n=t?s$3(r$2({},t),{sdkMeta:sr}):void 0;if(n&&!pi&&e.includes(Mr))return ui(e,Ur,n);let o={method:r$5,headers:Ur,keepalive:false};return n&&(o.body=JSON.stringify(n)),fn(e,o)}function ui(r,e,t){return new Promise((n,o)=>{let i=new XMLHttpRequest;i.open(`POST`,r,true),e.forEach((s,c)=>{i.setRequestHeader(c,s);}),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(i.status>=200&&i.status<300)try{if(i.getResponseHeader(`Content-Type`)?.includes(`application/json`))n({data:JSON.parse(i.responseText),headers:e,request:i,status:i.status,statusText:i.statusText});else o(new Error(`Content-Type of response header is not json`));}catch(s){o(s);}else o(new Error(`Received status - ${i.status}(${i.statusText})`));},i.onerror=()=>{o(new Error(`Network error occurred during the request.`));},i.send(JSON.stringify(t));})}function fi(){Ur.set(`Content-Type`,`text/plain; charset=utf-8`);let r=localStorage.getItem(`cooeeDebugTill`);(r&&new Date(+r)>new Date)&&(sr.debug=true);}var hi$1=`
|
|
51
|
+
`;function $n(){Zo().catch(r=>{Y$2.error(`Fail to add attributes in cart`,r);});}async function Jo(){let e=await(await fetch(window.Shopify.routes.root+`browsing_context_suggestions.json?country[enabled]=true&country[exclude]=${window.Shopify.country}&language[enabled]=true&language[exclude]=${window.Shopify.language}`)).json(),t=he$4.get().storefrontToken,n=new Headers;n.append(`x-shopify-storefront-access-token`,t),n.append(`Content-Type`,`application/json`),await He$1(Yo,{metafields:[{key:`currentCountry`,ownerId:`gid://shopify/Cart/${h.getCurrent().token}`,type:`single_line_text_field`,value:e.detected_values.country.handle}]},`add-cart-metafields-set`);}function Qo(){h.getCurrent().token?Jo().catch(r=>{Y$2.error(`Fail to update cart metafields`,r);}):setTimeout(Qo,500);}async function Zo(){await Or.acquire();let r=h.getCurrent(),e=await Br$4();if(r.attributes?.letscooee_did===e.letscooee_did&&r.attributes?.letscooee_sn===e.letscooee_sn){Y$2.verbose(`Not calling Shopify update.js API.`,`Current attributes:`,r.attributes),Or.release();return}try{let t=await we$1(`/cart/update.js`,{attributes:e});Y$2.verbose(`Updated cart attributes`,JSON.stringify(t.data)),r.update(t.data);}catch(t){Y$2.error(`Failed to add cart attributes`,t);}Or.release();}var ei=r=>r,Hn=r=>r.filter(e=>e.removedNodes&&e.removedNodes.length>0);function qn(r,e={childList:true,subtree:true},t=500,n=ei){return te$1(o=>{let i=new MutationObserver(s=>o(s));return i.observe(r,e),i},(o,i)=>i.disconnect()).pipe(q$1(o=>n(o)),Ir$1(o=>o.length>0),Fe$2(t))}var Yn=x$3(St$3());var Kn=new U,Xn=new U;function Kl(){return Xn.asObservable()}function rr$1(){Kn.next();}Kn.pipe(Fe$2(100)).subscribe(ii.bind(void 0));function Xl(){rr$1(),ti(),ri();}function ti(){let r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener(`load`,function(){zn(this._url).catch(e=>Y$2.error(`Unable to process cart change in XMLHttpRequest`,e));}),r.apply(this,arguments)},Y$2.verbose(`Securely overwritten window.XMLHttpRequest.send method`);}function ri(){let r=window.fetch;try{window.fetch=async function(e,t){return r(e,t).then(n=>{let o=``;try{o=typeof e==`string`||e instanceof URL?e.toString():e?.url??n?.url??``;}catch{}return zn(o).catch(i=>Y$2.error(`Unable to process cart change in fetch`,i)),n})},Y$2.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$2.error(e);}}async function zn(r){ni(r)&&rr$1();}function ni(r){return /\/cart\/(add|change|update|clear)/.test(r)}function oi(r$1,e){let t=r$1?.items,n=e.items,o=[],i=[];if(Y$2.verbose(`Comparing cart change with old count ${t?.length} to new count ${n.length}`),n?.forEach(s$4=>{let c=t?.find(p=>p.vID===s$4.vID);if(c){if(c.quantity!==s$4.quantity){let p=c.quantity<s$4.quantity,u=Math.abs(c.quantity-s$4.quantity),d=s$3(r$2({},s$4),{quantity:u});p?o.push(d):i.push(d);}t&&Wn$1(t,c);}else o.push(s$4);}),t)for(let s of t)i.push(s);Y$2.verbose(`Cart delta: added: ${o.length}, removed: ${i.length}`),o.length&&Gn(`Add To Cart`,{items:o}),i.length&&r$1.token===e.token&&Gn(`Remove From Cart`,{items:i}),(i.length||o.length)&&Xn.next({itemsAdded:o,itemsRemoved:i,cart:e});}function Gn(r,e){jn(new Ir$2(r,e));}async function ii(){oi(await ce$4.get(`cart`,{}),await h.getCurrent().getNormalisedCart(true));}var _=class r{static cartDrawerToggle$=new Sr$1({open:false,firstOpen:false});static DEFAULT_SELECTOR=`cart-drawer`;static _instance;inShadow=false;cartDrawerElement;cartDrawerShadowElement;configWebsite=he$4.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$3(this.cartDrawerElement);return Y$2.info(`Cart drawer is currently ${e?`open`:`close`}`),e}open(){if(this.isOpen()){Y$2.log(`Drawer is already open`);return}document.dispatchEvent(new CustomEvent(`letscooee:outbound:open-cart`));let e=document.querySelector(this.iconSelector);if(!e){Y$2.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(n){Fe$4(n,`execute-cooeeUpdateCartDrawer`);}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove(`is-empty`),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,o=e.items[0].quantity,i=e.items[0].price;window.cartGiftUpdate(n,i,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 n=document.querySelector(`a[href="/cart"]`);n&&n.click();}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?h.getCurrent().getNormalisedCart(true).then(()=>{window.refreshCart(h.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$2.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:h.getCurrent()}})),t&&rr$1();}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(!Je$1())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Yn$1(e),!this.cartDrawerElement){Yn.default.warn(`Max attempts exhausted to find cart drawer`);return}Y$2.verbose(`Found`,this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers();}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let t=(await Yn$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$2(800,void 0,{leading:false,trailing:true})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,r.cartDrawerToggle$.next({open:n,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$3(e):false}async updateBubble(){let e=(await h.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`]);}};var Lr=new Map,nr$1=async r=>{for(let i of r.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(i,r);}catch(s){Y$2.error(s);}if(r.isCartEmbed()&&!r.isSubscriptionUpsell()){let s=(await h.getCurrent().getNormalisedCart()).items.map(c=>c.mID);r.items=r.items.filter(c=>!s.includes(c.mID));}if(r.items=Jn(r),he$4.get().currencyCount<=1)return r.items;if(r.isShoppableVideo())return await si(r.content.videoConfig,r),r.items;let e=r.items.length,t=r.items.map(i=>Qn(i,r)),o=(await Promise.all(t)).filter(i=>i!=null);if(e&&!o.length){let i=`Failed to fetch any product from Ajax API`;throw X(new Ir$2(`CE Campaign Failed`,{reason:i,currency:r.currency},r)),new Error(i)}return Jn(r,o)},Jn=(r,e=r.items)=>{if(!r.isCartRecovery())return e;let t=h.getCurrent().items,n=[];for(let o of e)for(let i of o.vars){if(!i.isAvailable)continue;let s=t.find(u=>u.variant_id.toString()===i.mID);if(!s)continue;let c=new mt$3(o);c.name=s.title;let p=new dt$2(i);p.name=s.variant_title,p.price.d=s.discounted_price/100,c.variants=[p],n.push(c);}return n},si=async(r,e)=>{await Promise.all(r.videoEntries.map(async t=>{t.video.items=await Promise.all(t.video.items.map(async n=>{return await Qn(n,e)||n}));}));},Qn=async(r,e)=>{if(Lr.has(r.mID))return Lr.get(r.mID);let t,n=`/products/${r.slug}.js`;try{t=(await fn(n)).data;}catch(o){return o instanceof ne$3&&o.response?.status===404||Fe$4(o,`fetch-shopify-product`,{extra:{item:r,path:n},engagementTrigger:e}),null}return t?ai(r,t):(Y$2.error(`Item not found after AJAX call for:`,r),null)},ai=(r,e)=>{if(!r||!e)return r;r.name=e.title,r.tags=e.tags,r.slug=e.handle;let t=r.selectedOrFirstVariant.value;return r.vars.map(n=>{let o=e.variants.find(i=>i.id===+n.mID);o!=null&&(n.name=o.title,n.isAvailable=o.available,n.price.d=o.price?o.price/100:o.price,n.price.effective=n.price.d,n.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price,+t.mID===o.id&&(t.effectivePrice.value=n.price.d));}),Lr.set(r.mID,r),r};var et=r=>{let e=r instanceof mt$3?r.selectedOrFirstVariant.value.mID:r.vID,t=r instanceof mt$3?r.selectedOrFirstVariant.value.name:r.vName;return {product_id:r.mID,product_name:r.name,variant_id:e,variant_name:t}};var kr$1=(function(r){return r.NONE=``,r.SHOPIFY=`shopify`,r.THIRD_PARTY=`third_party`,r})(kr$1||{});function Zn(r,e,t){let n=_.get();if(r===he$3.OPEN_CART||e===ae$4.CART_DRAWER){n.open(),t&&n.refreshUI(t);return}if(r===he$3.INITIATE_CHECKOUT){ci();return}if(e===ae$4.CART_PAGE){location.href=`/cart`;return}if(e===ae$4.SHOPIFY_CHECKOUT){location.href=`/checkout`;return}if(e===ae$4.THIRD_PARTY_CHECKOUT){eo(`/cart#initiate-checkout=1`);return}t&&n.refreshUI(t);}function ci(){he$4.get().checkoutProvider===kr$1.THIRD_PARTY?eo(`/cart#initiate-checkout=1`):location.href=`/checkout`;}function eo(r){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=r;}var po=x$3(St$3());var Nr=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content;}};function or$1(){let r$2$1=location.pathname===`/`?location.pathname:location.pathname.replace(/\/+$/,``);return new Nr(r$2({origin:location.origin,path:r$2$1,qs:location.search,referrer:Ye$2(),name:ke$1().pageName},Je$2()))}function Rm(){let r=ke$1(),e=new URLSearchParams(location.search),t=e.get(`cooee-preview`),n=e.get(`cooee-exp-preview`);if(t){let i=t.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));i.length&&(r.previewIDs=i);}if(n){let i=n.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));i.length&&(r.previewIDs??=[],r.previewIDs.push(...i),r.activeExperiments=true);}let o=e.get(`cooee-variant`)?.trim();o&&(r.previewVariant=o);}function ir$1(){let r$3=ke$1();return s$3(r$2(s$3(r$2({},r$3.customContext),{page:or$1(),locale:r$3.locale,currentItem:r$3.currentItem,previewIDs:r$3.previewIDs,previewVariant:r$3.previewVariant,engagementIDs:mi(),cart:Dr()}),li()),{host:window.location.host})}function li(){let r=window.CooeeSDK.uaParser.getResult();return {os:r.os,device:r.device,browser:r.browser}}function mi(){let r=document.querySelectorAll(`.letscooee-engagement`),e=[];return r.forEach(t=>{let n=t.dataset.engagementId;n&&+n&&e.push(n);}),e}var pi=`keepalive`in new Request(``),Ur=new Headers,sr={type:qr$4,code:Kr$4,version:Q$3,shopName:Mn()??``};fi();async function tt(){let[r$4]=await Promise.all([ao()]);return r$2(r$2({},ir$1()),r$4)}function to(r){le$2(z$2).then(()=>di(r??{})).catch(e=>Y$2.error(`Session not established, skipping updateProfile`,e));}function di(r){io(`/v1/user/update`,r).then(()=>{Y$2.verbose(`Updated user profile`);}).catch(e=>{Y$2.error(`Error saving user profile`,e);});}function ro(r){return ie$1(`/v1/event/generate-discount`,r)}function zm(r){le$2(z$2).then(()=>gi$1({props:r})).catch(e=>Y$2.error(`Session not established, skipping updateDeviceProps`,e));}function gi$1(r){io(`/v1/device/update`,r).then(()=>{Y$2.verbose(`Updated device properties`);}).catch(async e=>{Y$2.error(`Error saving device property`,e);});}function no(r){r&&(sr.deviceId=r);}function oo(r){r&&(sr.firstSeen=r.toUTCString());}function ie$1(r,e){return so(`POST`,r,e)}function io(r,e){return so(`PUT`,r,e)}function so(r$5,e,t){if(!Je$1())return Y$2.log(`Rejecting ${r$5} ${e} as this is not e-commerce app`),Promise.reject();e.startsWith(`http`)||(e.includes(`/event/track`)?e=(window.CooeeSDK.apiURLs?.eventURL||fe$3.apiURL)+e:e=(window.CooeeSDK.apiURLs?.baseURL||fe$3.cdnApiURL)+e);let n=t?s$3(r$2({},t),{sdkMeta:sr}):void 0;if(n&&!pi&&e.includes(Mr))return ui(e,Ur,n);let o={method:r$5,headers:Ur,keepalive:false};return n&&(o.body=JSON.stringify(n)),fn(e,o)}function ui(r,e,t){return new Promise((n,o)=>{let i=new XMLHttpRequest;i.open(`POST`,r,true),e.forEach((s,c)=>{i.setRequestHeader(c,s);}),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE)if(i.status>=200&&i.status<300)try{if(i.getResponseHeader(`Content-Type`)?.includes(`application/json`))n({data:JSON.parse(i.responseText),headers:e,request:i,status:i.status,statusText:i.statusText});else o(new Error(`Content-Type of response header is not json`));}catch(s){o(s);}else o(new Error(`Received status - ${i.status}(${i.statusText})`));},i.onerror=()=>{o(new Error(`Network error occurred during the request.`));},i.send(JSON.stringify(t));})}function fi(){Ur.set(`Content-Type`,`text/plain; charset=utf-8`);let r=localStorage.getItem(`cooeeDebugTill`);(r&&new Date(+r)>new Date)&&(sr.debug=true);}var hi$1=`
|
|
52
52
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {
|
|
53
53
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
54
54
|
cart {
|
|
@@ -73,15 +73,15 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
`;function lo(r){let e=_.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections==`function`)try{return {sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(t){Fe$4(t,`execute-cooeeGetCartSections`,{engagementTrigger:r});}else {if(e.isMiniCart())return {sections:[`mini-cart`]};if(e.isShopifyDefaultDrawer())return {sections:e.element.getSectionsToRender?.().map((t=>t.section??t.id))}}return {}}async function Fr(r$6,e){if(!pe$4.hasKeys(r$6)){Y$2.warn(`No update fields provided`);return}let t=lo(e),n=r$2(r$2({},r$6),t);try{let o=await we$1(`/cart/update.js`,n);return Y$2.log(`Updated cart`,r$6),h.getCurrent().update(o.data),o.data}catch(o){Fe$4(o,`cart-update`),e.content?.showSnackBar!==false&&Hn$1(`Failed to update item in cart`);}}var qe$1=class qe{async addToCart(e,t){if(!e.length)return;let n=e.map(s=>{let{vID:c,vName:p,quantity:u}=this.getVariantDetails(s),d=t.getPrivateAttributesForLineItem();if(pe$4.hasKeys(window.CooeeSDK.customItemProperties)){let S={name:p},g={templateSuffix:s.templateSuffix},v=co.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:S,product:g});d=r$2(r$2({},JSON.parse(v)),d);}let y=s.selectedOrFirstVariant?.value?.selectedSellingPlan?.value;return r$2({id:c?+c:+s.mID,quantity:u,properties:d},y&&{selling_plan:y.mID})}),o=lo(t),i=r$2({items:n},o);try{let s=await we$1(`/cart/add.js`,i);return Y$2.log(`Added ${e.length} items to Cart`),t.content?.showSnackBar!==!1&&Hn$1(`Product added to your cart`),s.data}catch(s){Fe$4(s,`cart-item-add`,{engagementTrigger:t});let c=[`Failed to add product in cart.`];if(s instanceof ne$3&&s.is40x()&&s.responseText){let p=s.responseText;p.description&&c.push(`Reason: ${p.description}`);}c.push(`Please try again later.`),t.content?.showSnackBar!==false&&Hn$1(c.join(` `));}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),Y$2.log(`Code-${e} copied`),Hn$1(`Discount code copied`);}catch(t){Y$2.error(`Failed to copy code`,t);}}getProductURL(e){if(!e?.link)return;let t=Fn(e.link);if(t)return Ve$1(`/products/`+t)}async upgradeToSubscription(e,t){if(!e){Y$2.warn(`Trying to upgrade to subscription with no item`);return}let n=await h.getCurrent().getNormalisedCart(),o=e.selectedOrFirstVariant.value,i=n.items.findIndex(p=>p.vID===o.mID),s=o.selectedSellingPlan.value,c={line:i+1,selling_plan:s?.mID||null,properties:t.getPrivateAttributesForLineItem()};try{let p=await we$1(`/cart/change.js`,c);return Y$2.log(`Upgraded ${e} selling plan`),Hn$1(`Line item updated`),h.getCurrent().update(p.data),p.data}catch(p){Fe$4(p,`cart-switch-subscription`,{engagementTrigger:t}),Hn$1(`Failed to update subscription`);}}async createNewCart(e,t,n){if(!e?.vID){Y$2.error(`No variant ID found to perform Buy now`,e);return}let o=t?[t]:[];return (await He$1(Ci$1,{input:{lines:[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],discountCodes:o,attributes:await jn$1(`Buy Now`)}},`storefront-create-cart`)).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let t=e.clickAction,n=e.items,o=e.triggerData,i;if(t.at){let s=t;Y$2.log(`Performing ${JSON.stringify(s)} action`);let c={};if(s.at===he$3.GO_TO_PRODUCT)i=this.getProductURL(n[0]);else if(s.at===he$3.ADD_TO_CART)n?.length&&await this.addToCart(n,o);else if(s.at===he$3.COPY_COUPON_CODE)await this.copyDiscountCode(o.discount?.code),c.discountCode=o.discount?.code;else if(s.at===he$3.OPEN_CART)_.get().open();else if(s.at===he$3.GO_TO_COLLECTION){let p=e.collections;if(!p?.length)return;i=Ve$1(`/collections/`+p[0].handle);}c.products=n.map(et),c.redirectTo=i,rt(s.at,c);}t.applyDiscount&&o.discount?.code?be$1.applyDiscountUsingRedirect(o.discount.code,o.redirectBehaviour,i):i&&(location.pathname=i);}getVariantDetails(e){let t,n,o;if(e instanceof at$2)t=e.vID,n=e.vName,o=e.quantity??1;else {if(!e.vars?.length)return {};t=e.selectedOrFirstVariant.value.mID,n=e.selectedOrFirstVariant.value.name,o=e.selectedQty.value;}return {vID:t,quantity:o,vName:n}}};async function mo(r$7,e){if(!pe$4.hasKeys(e)){Y$2.warn(`No update fields provided`);return}let t=r$2({id:r$7.key},e);try{let n=await we$1(`/cart/change.js`,t);Y$2.log(`Updated line-item`,r$7),h.getCurrent().update(n.data);}catch(n){Fe$4(n,`cart-item-update`);}}var Ge$1=class Ge{constructor(e){this.triggerContext=e;}async execute(e){let t=ke$1().currentItem,n=e.clickAction;if(!n)return;let o=e.item,i=this.triggerContext,s=new qe$1,c=i.triggerData.redirectBehaviour,p=!!i.triggerData.discount?.type&&!!n?.applyDiscount,u={selectedVariants:i.triggerData.nonMutableItems.map(f=>({itemMID:f.mID,mID:f.selectedOrFirstVariant.value.mID,variantID:f.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},d=``,y=[],S=[];if(o?S=[o.toEmbed()]:e.embeddedItem&&(S=[e.embeddedItem]),n.at===he$3.ADD_BUNDLE){let f=i.selectedItems;if(S=e.embeddedItems??f.map(A=>A.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let A;e.embeddedItems?A=e.embeddedItems.map(D=>({itemMID:D.mID,mID:D.vID,variantID:D.vID,quantity:D.quantity})):A=f.map(D=>({itemMID:D.mID,mID:D.selectedOrFirstVariant.value.mID,variantID:D.selectedOrFirstVariant.value.mID}));let fe=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&fe&&(A.push({itemMID:fe.mID,mID:fe.selectedOrFirstVariant.value.mID,isPrimary:true}),S.unshift(fe.toEmbed())),u.selectedVariants=A,i.triggerData.isBundleOnPDP()&&u.selectedVariants.forEach(D=>{D.mID===t.vID&&(D.isPrimary=true);});}else u=void 0;y=e.embeddedItems??f;}else if(n.at===he$3.INITIATE_CHECKOUT){let f=await h.getCurrent().getNormalisedCart();S=f.items,u.selectedVariants=f.items.map(A=>({itemMID:A.mID,mID:A.vID}));}else if(n.at===he$3.ADD_TO_CART)y=o?[o]:[e.embeddedItem];else if(n.at===he$3.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,o),this.sendTriggerClicked(S,{from:`button`},e.video);return}else if(n.at===he$3.GO_TO_PRODUCT)d=o?Ve$1(`/products/`+o.slug):e.embeddedItem?.link;else if(n.at===he$3.GO_TO_URL){let f=Un$1(n.gu?.u);window.CooeeSDK.allowExternalURL?f&&(d=f.href):f&&(d=f.pathname+f.search+f.hash);}else if(n.at===he$3.UPGRADE_TO_SUBSCRIPTION){let f=await s.upgradeToSubscription(o,i.triggerData);this.triggerContext.triggerData.content?.subsUpgradeConfig?.skipSubscribedItems&&this.triggerContext.renderer.destroy(),_.get().refreshUI(f);}else if(n.at===he$3.GO_TO_COLLECTION){let f=this.triggerContext.triggerData.collections?.[0];f&&(d=`/collections/`+f.handle);}if(this.sendTriggerClicked(S,{from:`button`},e.video),Y$2.verbose({redirectPath:d,afterAtcAction:c,hasDiscount:p}),!p&&d){rt(n.at,{redirectTo:d}),location.href=d;return}let g,v=false;try{g=await this.getOrGenerateDiscountCode(u),Y$2.verbose(`Discount code (if any) to apply`,g);}catch(f){if(!this.triggerContext.triggerData.isBYOB()){po.default.error(`Unable to get a discount code`,f);return}}if(g&&n.at===he$3.COPY_COUPON_CODE)await s.copyDiscountCode(g);else if(n.at===he$3.BUY_NOW){let f=await s.createNewCart(t,g,i.triggerData);f&&(rt(n.at,{products:[et(t)],redirectTo:f}),location.href=f);return}try{g&&await be$1.applyWithStorefront([g]);}catch(f){Y$2.error(f),v=true;}let b;if(y?.length&&(b=await s.addToCart(y,i.triggerData)),rt(n.at,{products:y.map(et),redirectTo:d,discountCode:g}),v&&g){be$1.applyDiscountUsingRedirect(g,c,d,n.at);return}if(d){location.href=d;return}Zn(n.at,c,b);}sendTriggerClicked(e,t,n){let o=new Ir$2(`CE Trigger Clicked`,t,this.triggerContext.triggerData);o.items=e,o.setVideos(n),X(o);}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let n=``;if(t.type===q.STATIC){if(!t.code)throw vn$1(`No discount code found`,`warning`,{triggerContext:this.triggerContext}),new Error(`No discount code found`);return t.code}if(e){if(n=await yi$1(e,this.triggerContext),!n)throw Y$2.error(`No discount code found`,e),new Error(`Discount code not found or generated`);return n}}};function rt(r$8,e){document.dispatchEvent(new CustomEvent(`letscooee:outbound:cta-executed`,{detail:r$2({action:he$3[r$8]},e)}));}async function yi$1(r,e){try{return (await ro(r)).data.code}catch(t){throw Hn$1(`Failed to generate a discount code`),Fe$4(t,`backend-generate-discount`,{triggerContext:e}),t}}var w$1=class w extends D$1{mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=M$4()?`sm`:`lg`,this.clickExecutor=new Ge$1(this.props.triggerContext);}getCompiledStyles(){return this.putStyleAccordingToDevice(),r$2(r$2(s$3(r$2(r$2(r$2(r$2(r$2(r$2({},En(this.mediaStyle.flex)),On(this.mediaStyle.bg)),Nn$1(this.mediaStyle.br)),gn(this.mediaStyle.size)),Sn(this.mediaStyle.spc)),vn(this.mediaStyle.lout)),{boxSizing:`border-box`,outline:`none`}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return true;let{lhs:t,rhs:n}=e;switch(e.op){case `eq`:return t===n;case `gt`:return +t>+n;case `gte`:return +t>=+n;case `lt`:return +t<+n;case `lte`:return +t<=+n;case `ne`:return t!==n;case `null`:return t==null;case `empty`:return t.trim()===``;case `in`:return new RegExp(`\\b${n}\\b`).test(t);case `nin`:return !new RegExp(`\\b${n}\\b`).test(t);default:return Y$2.error(`Invalid operator found for when condition - ${e.op}`),false}}getClasses(e){return this.props.element.classes?(e??=``,e+` `+this.props.element.classes):e??``}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,M$4()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=r$2(r$2({},this.mediaStyle),e.style.sm));}sendTriggerClicked(e,t){this.clickExecutor.sendTriggerClicked(e,t);}async onClick(e,t){e.stopPropagation(),t.clickAction||(t.clickAction=this.props.element.clc),t.clickAction?.at&&await this.clickExecutor.execute(t);}};var vi$1=0;function l$1(r,e,t,n,o,i){e||(e={});var s,c,p$1$1=e;if(`ref`in p$1$1)for(c in p$1$1={},e)c==`ref`?s=e[c]:p$1$1[c]=e[c];var u={type:r,props:p$1$1,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--vi$1,__i:-1,__u:0,__source:o,__self:i};if(typeof r==`function`&&(s=r.defaultProps))for(c in s)p$1$1[c]===void 0&&(p$1$1[c]=s[c]);return p$1.vnode&&p$1.vnode(u),u}var B$2=class B extends w$1{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Z$1(this.onChange.bind(this));}componentWillReceiveProps(e){this.props.element=e.element,this.onChange();}render(){let e=this.getCompiledStyles(),t=this.state.text;return t||(e.display=`none`,t=``),l$1(`div`,{style:e,onClick:this.customOnClick.bind(this),className:this.getClasses(`lc-text`),children:l$1(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:t}})})}customOnClick(){this.props.onClick&&this.props.onClick(`title`);}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,t={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},o=new bt$1(We$3(this.props.element,t,this.props.triggerContext));if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:``}));return}this.setState(()=>({text:o.text}));}getComponentStyles(){return r$2({},In(this.mediaStyle.typo))}getSpanStyle(){return {overflow:`hidden`,display:`-webkit-box`,webkitBoxOrient:`vertical`,webkitLineClamp:2,color:`inherit`,fontSize:`inherit`,fontWeight:`inherit`,fontFamily:`inherit`}}};var Ie$1=class Ie extends B$2{render(){return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-button`),onClick:e=>this.onClick(e,{item:this.props.item}),children:l$1(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return s$3(r$2({},super.getComponentStyles()),{cursor:`pointer`})}};var Br=class extends D$1{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos===`end`?l$1(`div`,{style:r$2(r$2({},this.getElementStyle()),this.props.styles),children:[l$1(`span`,{children:this.props.time}),l$1(`span`,{style:this.getTimeLabelStyle(),children:this.props.label})]}):l$1(`div`,{style:r$2(r$2({},this.getElementStyle()),this.props.styles),children:[l$1(`span`,{style:this.getTimeLabelStyle(),children:this.props.label}),l$1(`span`,{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return {fontSize:`0.5em`,alignContent:`center`}}getElementStyle(){let e={display:`flex`,flexDirection:`column`,placeContent:`center center`,textAlign:`center`};return this.props.element.horizontal&&(e.gridTemplateColumns=`repeat(2, minmax(0, 1fr))`),e}},nt=class extends B$2{labels={Days:`00`,Hours:`00`,Minutes:`00`,Seconds:`00`};componentWillMount(){super.componentWillMount(),this.setState(()=>r$2({},this.labels)),this.processAndStartTimer();}render(){return l$1(`div`,{style:this.getLabelsParentStyle(),className:this.getClasses(),children:Object.keys(this.labels).map(e=>l$1(Br,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return {display:`grid`,justifyContent:`center`,gridTemplateColumns:`repeat(4, auto)`,gap:x$2(this.props.element.gap)}}getDisplayStyles(){return {display:`grid`,placeContent:`center center`}}getComponentStyles(){return r$2(r$2({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,`0`),this.labels.Hours=String(e.hours).padStart(2,`0`),this.labels.Minutes=String(e.minutes).padStart(2,`0`),this.labels.Seconds=String(e.seconds).padStart(2,`0`),this.setState(()=>r$2({},this.labels));});}};function ar$1(r,e){if(!r)return;let t={loop:e.loop,slidesPerView:e.maxInRow,spaceBetween:e.gap+`px`,pagination:{type:e.pagination.type,el:r.querySelector(`.swiper-pagination`),clickable:true,renderBullet:(o,i)=>`
|
|
76
|
+
`;function lo(r){let e=_.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections==`function`)try{return {sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(t){Fe$4(t,`execute-cooeeGetCartSections`,{engagementTrigger:r});}else {if(e.isMiniCart())return {sections:[`mini-cart`]};if(e.isShopifyDefaultDrawer())return {sections:e.element.getSectionsToRender?.().map((t=>t.section??t.id))}}return {}}async function Fr(r$6,e){if(!pe$4.hasKeys(r$6)){Y$2.warn(`No update fields provided`);return}let t=lo(e),n=r$2(r$2({},r$6),t);try{let o=await we$1(`/cart/update.js`,n);return Y$2.log(`Updated cart`,r$6),h.getCurrent().update(o.data),o.data}catch(o){Fe$4(o,`cart-update`),e.content?.showSnackBar!==false&&Hn$1(`Failed to update item in cart`);}}var qe$1=class qe{async addToCart(e,t){if(!e.length)return;let n=e.map(s=>{let{vID:c,vName:p,quantity:u}=this.getVariantDetails(s),d=t.getPrivateAttributesForLineItem();if(pe$4.hasKeys(window.CooeeSDK.customItemProperties)){let S={name:p},g={templateSuffix:s.templateSuffix},v=co.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:S,product:g});d=r$2(r$2({},JSON.parse(v)),d);}let y=s.selectedOrFirstVariant?.value?.selectedSellingPlan?.value;return r$2({id:c?+c:+s.mID,quantity:u,properties:d},y&&{selling_plan:y.mID})}),o=lo(t),i=r$2({items:n},o);try{let s=await we$1(`/cart/add.js`,i);return Y$2.log(`Added ${e.length} items to Cart`),t.content?.showSnackBar!==!1&&Hn$1(`Product added to your cart`),s.data}catch(s){Fe$4(s,`cart-item-add`,{engagementTrigger:t});let c=[`Failed to add product in cart.`];if(s instanceof ne$3&&s.is40x()&&s.responseText){let p=s.responseText;p.description&&c.push(`Reason: ${p.description}`);}c.push(`Please try again later.`),t.content?.showSnackBar!==false&&Hn$1(c.join(` `));}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),Y$2.log(`Code-${e} copied`),Hn$1(`Discount code copied`);}catch(t){Y$2.error(`Failed to copy code`,t);}}getProductURL(e){if(!e?.link)return;let t=Fn(e.link);if(t)return Ve$1(`/products/`+t)}async upgradeToSubscription(e,t){if(!e){Y$2.warn(`Trying to upgrade to subscription with no item`);return}let n=await h.getCurrent().getNormalisedCart(),o=e.selectedOrFirstVariant.value,i=n.items.findIndex(p=>p.vID===o.mID),s=o.selectedSellingPlan.value,c={line:i+1,selling_plan:s?.mID||null,properties:t.getPrivateAttributesForLineItem()};try{let p=await we$1(`/cart/change.js`,c);return Y$2.log(`Upgraded ${e} selling plan`),Hn$1(`Line item updated`),h.getCurrent().update(p.data),p.data}catch(p){Fe$4(p,`cart-switch-subscription`,{engagementTrigger:t}),Hn$1(`Failed to update subscription`);}}async createNewCart(e,t,n){if(!e?.vID){Y$2.error(`No variant ID found to perform Buy now`,e);return}let o=t?[t]:[];return (await He$1(Ci$1,{input:{lines:[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],discountCodes:o,attributes:await jn$1(`Buy Now`)}},`storefront-create-cart`)).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let t=e.clickAction,n=e.items,o=e.triggerData,i;if(t.at){let s=t;Y$2.log(`Performing ${JSON.stringify(s)} action`);let c={};if(s.at===he$3.GO_TO_PRODUCT)i=this.getProductURL(n[0]);else if(s.at===he$3.ADD_TO_CART)n?.length&&await this.addToCart(n,o);else if(s.at===he$3.COPY_COUPON_CODE)await this.copyDiscountCode(o.discount?.code),c.discountCode=o.discount?.code;else if(s.at===he$3.OPEN_CART)_.get().open();else if(s.at===he$3.GO_TO_COLLECTION){let p=e.collections;if(!p?.length)return;i=Ve$1(`/collections/`+p[0].handle);}c.products=n.map(et),c.redirectTo=i,rt(s.at,c);}t.applyDiscount&&o.discount?.code?be$1.applyDiscountUsingRedirect(o.discount.code,o.redirectBehaviour,i):i&&(location.pathname=i);}getVariantDetails(e){let t,n,o;if(e instanceof at$2)t=e.vID,n=e.vName,o=e.quantity??1;else {if(!e.vars?.length)return {};t=e.selectedOrFirstVariant.value.mID,n=e.selectedOrFirstVariant.value.name,o=e.selectedQty.value;}return {vID:t,quantity:o,vName:n}}};async function mo(r$7,e){if(!pe$4.hasKeys(e)){Y$2.warn(`No update fields provided`);return}let t=r$2({id:r$7.key},e);try{let n=await we$1(`/cart/change.js`,t);Y$2.log(`Updated line-item`,r$7),h.getCurrent().update(n.data);}catch(n){Fe$4(n,`cart-item-update`);}}var Ge$1=class Ge{constructor(e){this.triggerContext=e;}async execute(e){let t=ke$1().currentItem,n=e.clickAction;if(!n)return;let o=e.item,i=this.triggerContext,s=new qe$1,c=i.triggerData.redirectBehaviour,p=!!i.triggerData.discount?.type&&!!n?.applyDiscount,u={selectedVariants:i.triggerData.nonMutableItems.map(f=>({itemMID:f.mID,mID:f.selectedOrFirstVariant.value.mID,variantID:f.selectedOrFirstVariant.value.mID})),eID:i.triggerData.engagementID,cID:i.triggerData.contentID},d=``,y=[],S=[];if(o?S=[o.toEmbed()]:e.embeddedItem&&(S=[e.embeddedItem]),n.at===he$3.ADD_BUNDLE){let f=i.selectedItems;if(S=e.embeddedItems??f.map(A=>A.toEmbed()),i.shouldGiveFBTDiscount||e.embeddedItems?.length){let A;e.embeddedItems?A=e.embeddedItems.map(D=>({itemMID:D.mID,mID:D.vID,variantID:D.vID,quantity:D.quantity})):A=f.map(D=>({itemMID:D.mID,mID:D.selectedOrFirstVariant.value.mID,variantID:D.selectedOrFirstVariant.value.mID}));let fe=i.triggerData.bundleFrom;i.triggerData.isBundleOnCartDrawer()&&fe&&(A.push({itemMID:fe.mID,mID:fe.selectedOrFirstVariant.value.mID,isPrimary:true}),S.unshift(fe.toEmbed())),u.selectedVariants=A,i.triggerData.isBundleOnPDP()&&u.selectedVariants.forEach(D=>{D.mID===t.vID&&(D.isPrimary=true);});}else u=void 0;y=e.embeddedItems??f;}else if(n.at===he$3.INITIATE_CHECKOUT){let f=await h.getCurrent().getNormalisedCart();S=f.items,u.selectedVariants=f.items.map(A=>({itemMID:A.mID,mID:A.vID}));}else if(n.at===he$3.ADD_TO_CART)y=o?[o]:[e.embeddedItem];else if(n.at===he$3.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,o),this.sendTriggerClicked(S,{from:`button`},e.video);return}else if(n.at===he$3.GO_TO_PRODUCT)d=o?Ve$1(`/products/`+o.slug):e.embeddedItem?.link;else if(n.at===he$3.GO_TO_URL){let f=Un$1(n.gu?.u);window.CooeeSDK.allowExternalURL?f&&(d=f.href):f&&(d=f.pathname+f.search+f.hash);}else if(n.at===he$3.UPGRADE_TO_SUBSCRIPTION){let f=await s.upgradeToSubscription(o,i.triggerData);this.triggerContext.triggerData.content?.subsUpgradeConfig?.skipSubscribedItems&&this.triggerContext.renderer.destroy(),_.get().refreshUI(f);}else if(n.at===he$3.GO_TO_COLLECTION){let f=this.triggerContext.triggerData.collections?.[0];f&&(d=`/collections/`+f.handle);}if(this.sendTriggerClicked(S,{from:`button`},e.video),Y$2.verbose({redirectPath:d,afterAtcAction:c,hasDiscount:p}),!p&&d){rt(n.at,{redirectTo:d}),location.href=d;return}let g,v=false;try{g=await this.getOrGenerateDiscountCode(u),Y$2.verbose(`Discount code (if any) to apply`,g);}catch(f){if(!this.triggerContext.triggerData.isBYOB()){po.default.error(`Unable to get a discount code`,f);return}}if(g&&n.at===he$3.COPY_COUPON_CODE)await s.copyDiscountCode(g);else if(n.at===he$3.BUY_NOW){let f=await s.createNewCart(t,g,i.triggerData);f&&(rt(n.at,{products:[et(t)],redirectTo:f}),location.href=f);return}try{g&&await be$1.applyWithStorefront([g]);}catch(f){Y$2.error(f),v=true;}let b;if(y?.length&&(b=await s.addToCart(y,i.triggerData)),rt(n.at,{products:y.map(et),redirectTo:d,discountCode:g}),v&&g){be$1.applyDiscountUsingRedirect(g,c,d,n.at);return}if(d){location.href=d;return}Zn(n.at,c,b);}sendTriggerClicked(e,t,n){let o=new Ir$2(`CE Trigger Clicked`,t,this.triggerContext.triggerData);o.items=e,o.setVideos(n),X(o);}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let n=``;if(t.type===q.STATIC){if(!t.code)throw vn$1(`No discount code found`,`warning`,{triggerContext:this.triggerContext}),new Error(`No discount code found`);return t.code}if(e){if(n=await yi$1(e,this.triggerContext),!n)throw Y$2.error(`No discount code found`,e),new Error(`Discount code not found or generated`);return n}}};function rt(r$8,e){document.dispatchEvent(new CustomEvent(`letscooee:outbound:cta-executed`,{detail:r$2({action:he$3[r$8]},e)}));}async function yi$1(r,e){try{return (await ro(r)).data.code}catch(t){throw Hn$1(`Failed to generate a discount code`),Fe$4(t,`backend-generate-discount`,{triggerContext:e}),t}}var w$1=class w extends D$1{mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=M$4()?`sm`:`lg`,this.clickExecutor=new Ge$1(this.props.triggerContext);}getCompiledStyles(){return this.putStyleAccordingToDevice(),r$2(r$2(s$3(r$2(r$2(r$2(r$2(r$2(r$2({},En(this.mediaStyle.flex)),On(this.mediaStyle.bg)),Nn$1(this.mediaStyle.br)),gn(this.mediaStyle.size)),Sn(this.mediaStyle.spc)),vn(this.mediaStyle.lout)),{boxSizing:`border-box`,outline:`none`}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return true;let{lhs:t,rhs:n}=e;switch(e.op){case `eq`:return t===n;case `gt`:return +t>+n;case `gte`:return +t>=+n;case `lt`:return +t<+n;case `lte`:return +t<=+n;case `ne`:return t!==n;case `null`:return t==null;case `empty`:return t.trim()===``;case `in`:return new RegExp(`\\b${n}\\b`).test(t);case `nin`:return !new RegExp(`\\b${n}\\b`).test(t);default:return Y$2.error(`Invalid operator found for when condition - ${e.op}`),false}}getClasses(e){return this.props.element.classes?(e??=``,e+` `+this.props.element.classes):e??``}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,M$4()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=r$2(r$2({},this.mediaStyle),e.style.sm));}sendTriggerClicked(e,t){this.clickExecutor.sendTriggerClicked(e,t);}async onClick(e,t){e.stopPropagation(),t.clickAction||(t.clickAction=this.props.element.clc),t.clickAction?.at&&await this.clickExecutor.execute(t);}};var vi$1=0;function l$1(r,e,t,n,o,i){e||(e={});var s,c,p$1$1=e;if(`ref`in p$1$1)for(c in p$1$1={},e)c==`ref`?s=e[c]:p$1$1[c]=e[c];var u={type:r,props:p$1$1,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--vi$1,__i:-1,__u:0,__source:o,__self:i};if(typeof r==`function`&&(s=r.defaultProps))for(c in s)p$1$1[c]===void 0&&(p$1$1[c]=s[c]);return p$1.vnode&&p$1.vnode(u),u}var B$2=class B extends w$1{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Z$1(this.onChange.bind(this));}componentWillReceiveProps(e){this.props.element=e.element,this.onChange();}render(){let e=this.getCompiledStyles(),t=this.state.text;return t||(e.display=`none`,t=``),l$1(`div`,{style:e,onClick:this.customOnClick.bind(this),className:this.getClasses(`lc-text`),children:l$1(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:t}})})}customOnClick(){this.props.onClick&&this.props.onClick(`title`);}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,t={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},o=new bt$1(We$3(this.props.element,t,this.props.triggerContext));if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:``}));return}this.setState(()=>({text:o.text}));}getComponentStyles(){return r$2({},In(this.mediaStyle.typo))}getSpanStyle(){return {overflow:`hidden`,display:`-webkit-box`,webkitBoxOrient:`vertical`,webkitLineClamp:2,color:`inherit`,fontSize:`inherit`,fontWeight:`inherit`,fontFamily:`inherit`}}};var Ie$1=class Ie extends B$2{render(){let e=this.props.element?.clc,t=e?.at?`lc-button-at-${e.at}`:``;return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-button `+t),onClick:n=>this.onClick(n,{item:this.props.item}),children:l$1(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return s$3(r$2({},super.getComponentStyles()),{cursor:`pointer`})}};var Br=class extends D$1{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos===`end`?l$1(`div`,{style:r$2(r$2({},this.getElementStyle()),this.props.styles),children:[l$1(`span`,{children:this.props.time}),l$1(`span`,{style:this.getTimeLabelStyle(),children:this.props.label})]}):l$1(`div`,{style:r$2(r$2({},this.getElementStyle()),this.props.styles),children:[l$1(`span`,{style:this.getTimeLabelStyle(),children:this.props.label}),l$1(`span`,{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return {fontSize:`0.5em`,alignContent:`center`}}getElementStyle(){let e={display:`flex`,flexDirection:`column`,placeContent:`center center`,textAlign:`center`};return this.props.element.horizontal&&(e.gridTemplateColumns=`repeat(2, minmax(0, 1fr))`),e}},nt=class extends B$2{labels={Days:`00`,Hours:`00`,Minutes:`00`,Seconds:`00`};componentWillMount(){super.componentWillMount(),this.setState(()=>r$2({},this.labels)),this.processAndStartTimer();}render(){return l$1(`div`,{style:this.getLabelsParentStyle(),className:this.getClasses(),children:Object.keys(this.labels).map(e=>l$1(Br,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return {display:`grid`,justifyContent:`center`,gridTemplateColumns:`repeat(4, auto)`,gap:x$2(this.props.element.gap)}}getDisplayStyles(){return {display:`grid`,placeContent:`center center`}}getComponentStyles(){return r$2(r$2({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,`0`),this.labels.Hours=String(e.hours).padStart(2,`0`),this.labels.Minutes=String(e.minutes).padStart(2,`0`),this.labels.Seconds=String(e.seconds).padStart(2,`0`),this.setState(()=>r$2({},this.labels));});}};function ar$1(r,e){if(!r)return;let t={loop:e.loop,slidesPerView:e.maxInRow,spaceBetween:e.gap+`px`,pagination:{type:e.pagination.type,el:r.querySelector(`.swiper-pagination`),clickable:true,renderBullet:(o,i)=>`
|
|
77
77
|
<span class="${i}"
|
|
78
78
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
79
79
|
`,renderProgressbar:o=>`
|
|
80
80
|
<span class="${o}"
|
|
81
81
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
82
82
|
</span>
|
|
83
|
-
`},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 n=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),n}function cr$1(r,e,t){let n={color:r.navigation.color?.rgba};return r.pagination.enabled&&(n.transform=`translateY(-25%)`),l$1(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[l$1(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&l$1(`div`,{class:`swiper-button-next`,style:n,children:l$1(`span`,{})}),r.navigation.enabled&&l$1(`div`,{class:`swiper-button-prev`,style:n,children:l$1(`span`,{})}),r.pagination.enabled&&l$1(`div`,{className:`swiper-pagination`,style:{bottom:0,top:`unset`,position:`relative`,color:r.pagination.color?.rgba}})]})}var vd=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Vr=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 ot=class extends w$1{componentDidMount(){Z$1(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-checkbox`),children:l$1(`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 G$2;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s$3(r$2({},this.getTypoStyles()),{display:`flex`})}};var se$1=class se extends w$1{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 l$1(`img`,{onClick:this.customOnClick.bind(this),alt:e?.name||`Image`,className:this.getClasses(`lc-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 ae$1=class ae extends w$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$1(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Et$2,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 it=class extends ae$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$1(je$1,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var st=class extends w$1{render(){return l$1(`select`,{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??``,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:this.getClasses(`lc-dropdown`),children:this.createSelectItems()})}componentDidMount(){Z$1(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility=`hidden`),r$2(r$2({},e),In(this.mediaStyle.typo))}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return [];this.props.triggerContext.triggerData.content?.subsUpgradeConfig?.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=true,t.changeSellingPlan(t.sellingPlans[0])):e.push(l$1(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let n of t.sellingPlans??[])e.push(l$1(`option`,{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var Ei$1=new RegExp(`fill="#[a-zA-Z0-9]+"`),at$1=class at extends w$1{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),l$1(`div`,{style:e,className:this.getClasses(`lc-star-rating`),dangerouslySetInnerHTML:{__html:t}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},t=Fe$3(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Fe$3(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return ``;let i=``;if(this.props.element.showSingleStar)i=t;else {let s=5,c=`${o.rating}`.split(`.`);for(let p=0;p<+c[0];p++)i+=t,s--;c[1]&&(i+=n,s--);for(let p=0;p<s;p++)i+=t.replace(Ei$1,`fill="#f1f1f1"`);}return i}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var ct$1=class ct extends w$1{render(){return l$1(`select`,{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:this.getClasses(`lc-dropdown`),children:this.createSelectItems()})}componentDidMount(){Z$1(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`&&(e.visibility=`hidden`),r$2(r$2({},e),In(this.mediaStyle.typo))}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(l$1(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,n=this.props.item.vars.find(o=>o.mID===t);this.props.item.setSelectedVariant(n);}};var je$1=class je extends w$1{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:l$1(it,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?l$1(ot,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===8){let t=e;if(!t.templateName)return ``;try{if(!/^[a-zA-Z0-9_-]+$/.test(t.templateName))return Y$2.error(`Invalid partial template name`,t.templateName),``;let n=Fe$3(`{{ @include("${t.templateName}", it) /}}`,this.props.productVariables??{});return l$1(`div`,{className:`lc-partial-`+t.templateName,dangerouslySetInnerHTML:{__html:n}})}catch(n){return Y$2.error(`Failed to render partial element`,t.templateName,this.props.productVariables,n),``}}if(e.t===13){let t=e,n=this.props.item,o=Vr(n.variantImage??n.firstImageURL),i=Vr(n.variantSecondaryImage??n.secondaryImageURL);t.lg=t.sm={src:o,name:n.name,secondarySrc:i};let s=l$1(se$1,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:l$1(`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.type!==`SINGLE`?l$1(`cooee-product-options-picker`,{item:this.props.item,styles:t.style,horizontal:t.horizontal,dropdownType:t.type}):l$1(ct$1,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?l$1(st,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?l$1(at$1,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?l$1(Ie$1,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):l$1(ge,{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=l$1(B$2,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:l$1(`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 n=t.detail.variantID;this.props.item.setSelectedVariantByID(n);});}};var Se$1=class Se extends w$1{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){let e=this.getProductData();if(this.productElement=new de$1(We$3(this.props.element,e,this.props.triggerContext)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return l$1(`div`,{style:r$2({},this.getCompiledStyles()),className:this.getClasses(`lc-single-product`),children:l$1(je$1,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:e,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===q.BXGY;return !t.hasEffectivePrice()&&o&&(n.product=s$3(r$2(r$2({},n.product),$n$1(`effective_price`,t.effectivePrice.value)),{price:``})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity,{product:n.product,variant:n.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var lt$1=class lt extends w$1{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$4()?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$2().then(()=>{this.swiperInstance=ar$1(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 n=i=>{this.swiperRef=i;},o=()=>e?.map(i=>l$1(`div`,{class:`swiper-slide`,children:this.getProductFragment(i)}));t=l$1(`div`,{style:s$3(r$2({},this.getCompiledStyles()),{display:`block`}),className:this.getClasses(`lc-product-swiper-list`),children:cr$1(this.configuration,n,o)});}else t=l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-product-list`),children:e?.map((n,o)=>this.getProductFragment(n,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 n=this.props.triggerContext.triggerData,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==true?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${i}, auto)`;}}return t}getProductFragment(e,t=false){return l$1(ut$3,{children:[l$1(Se$1,{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&&l$1(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:l$1(B$2,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var mt$1=class mt extends w$1{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$2().then(()=>{this.swiperInstance=ar$1(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=o=>{this.swiperRef=o;},n=()=>{let o=e.values?.map(c=>l$1(`div`,{class:`swiper-slide`,onClick:p=>this.onClick(p,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!o?.length)return [];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let c=Number(i.maxInRow)-s+1;for(let p=0;p<c;p++)o.push(o[p%s]);}return o};return cr$1(e.conf,t,n)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return l$1(se$1,{element:t,triggerContext:this.props.triggerContext});case 4:return l$1(ae$1,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$2.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let n=We$3(e,{form:t},this.props.triggerContext);return F$1.getParsedElement(n)}getClickAction(e){return We$3(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var ge=class extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),Z$1(()=>{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 l$1(ae$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return l$1(nt,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?l$1(Ie$1,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return l$1(B$2,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return l$1(se$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return l$1(lt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return l$1(Se$1,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return l$1(mt$1,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var pt$1=class pt extends w$1{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he$3.GO_TO_URL&&!!Un$1(this.clickAction.gu?.u)||this.clickAction?.at===he$3.OPEN_CART||this.clickAction?.at===he$3.INITIATE_CHECKOUT;}componentDidMount(){Z$1(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return l$1(ut$3,{children:[l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-container`),onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:l$1(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&l$1(`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 M$2=class r$9{constructor(e){this.engagementTrigger=e;this.triggerContext=new Me(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;lockReleased$=new U;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{Fe$4(e,`render-widget`,{triggerContext:this.triggerContext});});}destroy(){Y$2.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$9.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Mi$2(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$2.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,Mi$2(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){await this.waitForLockRelease(),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$2.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$2.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$2.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$2.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false,this.lockReleased$.next();}async waitForLockRelease(){this.isProcessing&&await le$2(this.lockReleased$);}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$2.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$2.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(n=>new mt$3(n)),t.nonMutableItems=e.items.map(n=>new mt$3(n))),e.bundleFrom&&(t.bundleFrom=new mt$3(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),pe$4.hasKeys(e.stickyATCConfig)&&(t.stickyATCConfig=e.stickyATCConfig),e.props&&pe$4.hasKeys(e.props)&&(t.props=r$2(r$2({},t.props),e.props)),e.content&&(t.content=new Ze$1(e.content)),t.widget=new $e$1(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$2.info(`${this.engagementTrigger} rendered \u2705 ${qn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof j$1?Te.delete(this):Ke$1.delete(this);}async getVariation(){Y$2.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await go(e)).data}catch(t){if(t instanceof ne$3&&t.response?.status===400)return;Fe$4(t,`get-variation`,{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){Y$2.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(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async c=>{if(c.isIntersecting){Y$2.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);n(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);o.observe(this.rootContainer),this.observers.push(o);})}attachScroll(){this.scrollSubscription=Tr$1(window,`scroll`).pipe(Fe$2(r$9.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent();});}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r$9.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=new Ir$2(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,n,this.engagementTrigger);i.name===`CE Campaign Holdout`&&(i.trigger.holdout=true),X(i),r$9.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe();}generateParentElementID(){return `letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=h.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 n=t.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),i=this.engagementTrigger.shortID;n=document.createElement(`div`),n.id=e;let s=`letscooee letscooee-engagement engagement-${i} lc-${o}`;return this.engagementTrigger.content?.classes&&(s+=` ${this.engagementTrigger.content.classes}`),n.className=s,n.dataset.engagementId=i,this.engagementTrigger.id===`preview`&&(n.className+=` letscooee-preview`),n.style.display=`block`,n.style.minHeight=`0.5px`,n.style.minWidth=`0.5px`,n}async startRendering(){let e=this.rootContainer,t=this.triggerContext.triggerData.hasSwiperElement();t&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:`open`}),Hi$2(e)),this.injectCampaignCSS(t,e);let n=this.engagementTrigger.widget;Ye$3(Yr$2(pt$1,{element:n.cont,triggerContext:this.triggerContext,elements:n.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let n=this.engagementTrigger.content?.outerCSS?.trim()??``,o=this.engagementTrigger.content?.innerCSS?.trim()??``;if(!n&&!o)return;let i=this.rootContainer.id;if(e){le$4(o,t),this.injectOuterCSSOnly();return}le$4(`#${i} { ${n+`
|
|
84
|
-
${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;le$4(`#${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 n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return Y$2.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=t.selector,o;if(n.includes(`:shadow`)){let p=n.split(`:shadow`);o=(await Yn$1(p[0].trim()))?.shadowRoot,n=p[1].trim(),o&&Hi$2(o,false);}Y$2.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${n}"`);let i=await Yn$1(n,3,o??document);if(!i)return Y$2.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case ce$3.BEFORE1:case ce$3.BEFORE:i.parentElement?.insertBefore(c,i);break;case ce$3.INSIDE_FIRST1:case ce$3.INSIDE_FIRST:i.insertBefore(c,i.firstChild);break;case ce$3.INSIDE_LAST1:case ce$3.INSIDE_LAST:i.appendChild(c);break;case ce$3.AFTER1:case ce$3.AFTER:default:i.parentElement?.insertBefore(c,i.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$2.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$2.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await nr$1(this.engagementTrigger);}catch(t){Y$2.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$2.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering();}updateItems(e,t){let n=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...n);for(let i of o)oe$1.remove(t,i);}getItemDiff(e,t){return e.filter(n=>!t.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var j$1=class j extends M$2{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(!_.get().isOpen()&&ke$1().pageName!==`cart`){Y$2.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var lr$1=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=h.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$2.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(t.selector));if(!n?.length){Y$2.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new r(e,o).render();}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.content?.subsUpgradeConfig?.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!t)return;let n=t.vars.find(d=>d.mID===e.id.toString());if(!n)return;let o=new dt$2(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of o.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=true,o.changeSellingPlan(d));let s=new mt$3(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let p=new G(this.engagementTrigger);p.placement.selector=`.${c}`,p.items=[s];let u=new j$1(p);u.renderSilently(),this.watchForCartItemDeletion(u,c);}watchForCartItemDeletion(e,t){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(Y$2.verbose(`${t} has been removed`),e.destroy(),n.disconnect());});});});n.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 n=t.selling_plan_allocation?.selling_plan?.name;return !(n&&!e.includes(n))})}};var mr$1=class mr extends M$2{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var pr$1=class pr extends j$1{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){Fe$4(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await h.getCurrent().getNormalisedCart(true),t=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,c,p=[...t.milestones];for(let u of p){if(u.rewardType!==Ee$4.FREE_AUTO_GIFT)continue;if(u.isUIOnly&&!u.allowATC){Y$2.verbose(`Skipping milestone ${u.label} as it is UI only and does not allow ATC`);continue}let d=u.items[0],y=u.reached,S=e.items.find(g=>(g.vID===d.vID||g.mID===d.mID)&&g.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(s=u,c=S),S&&n.push(S),!y&&S&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${S.vID} from cart`),i.push(S)):y&&!S&&(Y$2.verbose(`Adding free gift ${d.vID} to cart`),o.push(d));}t.restrictToLatestFreebie&&s&&(c?(n=n.filter(u=>u.vID!==c.vID),o=[]):o=[s.items[0]],i.push(...n)),t.treatFreebieAsSeparateLineItem?await this.handleSeparateFreebieLineItems(o,i):await this.handleCombinedCartUpdate(o,i);}async handleSeparateFreebieLineItems(e,t){if(!t.length&&!e.length)return;let n=new qe$1,o=[];if(e.length){let c=this.addFreebiesOperation(e,n);o.push(c);}if(t.length){let c=this.removeFreebiesOperation(t);o.push(c);}if(!o.length)return;let i;try{i=await Promise.all(o),Y$2.log(`All freebie and coupon operations completed`);}catch(c){Fe$4(c,`parallel-freebie-operations`,{engagementTrigger:this.engagementTrigger});}let s;e.length&&i?.length&&(s=i[0]),_.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(n=>t.updates[n.key??n.vID]=n.quantity-1),Fr(t,this.engagementTrigger)}async addFreebiesOperation(e,t){return t.addToCart(e,this.engagementTrigger)}async handleCombinedCartUpdate(e,t){let n=this.engagementTrigger.progressBarConfig,o={},i={};t.length&&t.forEach(y=>i[y.key??y.vID]=0),e.length&&e.forEach(y=>i[y.vID]=1);let s=n.coupons,c=[];if(s?.length){c=s.map(g=>g.couponCode);let y=h.getCurrent().discount_codes?.map(g=>g.code)??[];c.every(g=>y.some(v=>v===g))||(o.discount=c.join(`,`));}if(pe$4.hasKeys(i)&&(o.updates=i),!pe$4.hasKeys(o))return;let p=await Fr(o,this.engagementTrigger),u=p?.items,d=[];for(let y of e){let S=u?.find(g=>c?.length?g.id+``===y.vID&&g.discounts?.some(v=>c.includes(v.title)):g.id+``===y.vID);S&&d.push(S);}if(!d.length){_.get().refreshUI(p,false);return}try{await Promise.all(d.map(y=>mo(y,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(y){Fe$4(y,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{_.get().refreshUI(p,false);}}};var dt$1=class dt extends j$1{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 dr$1=class dr extends M$2{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 gr$1=class gr extends M$2{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var ur$1=class ur extends M$2{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,n=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$2.error(`No detail received for ${n}`);return}Y$2.log(`Detail received for BYOB`,o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==t.shortID&&i!==t.engagementID){Y$2.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let c=s.map(p=>new at$2({mID:p.product_id,vID:p.variant_id,quantity:p.quantity||1}));await new Ge$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$3.ADD_BUNDLE,applyDiscount:true}});}};var Wr=false,$r=false,fr=null,hr$1=null,uo=false,Te=new Set,Ke$1=new Set;function fo(){uo||(uo=true,wt$2(()=>{qn(document.body,{childList:true,subtree:true},500,Hn).subscribe(()=>{Ke$1.forEach(r=>r.rerenderIfDeleted()),Te.forEach(r=>r.rerenderIfDeleted());});}));}async function gt$1(r){if(r.length>0&&await yo(),fo(),Wr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),fr=r;return}Wr=true;try{wi$1(r);}finally{if(Wr=false,fr){let e=fr;fr=null,Y$2.verbose(`Processing queued cart triggers`),gt$1(e);}}}async function ut$1(r){if(r.length>0&&await yo(),fo(),$r){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),hr$1=r;return}$r=true;try{bi$1(r);}finally{if($r=false,hr$1){let e=hr$1;hr$1=null,Y$2.verbose(`Processing queued page triggers`),ut$1(e).catch(console.error);}}}function gh(){Te.forEach(r=>r.rerenderAfterCartOpened());}function wi$1(r){Co(Te,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=ho(Te,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{Fe$4(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new pr$1(e);else if(e.isSubscriptionUpsell()){lr$1.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new dt$1(e):n=new j$1(e);Te.add(n),n.renderSilently();}}function bi$1(r){Co(Ke$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=ho(Ke$1,e);if(t){t.updateAndReRender(e).catch(o=>{Fe$4(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new dr$1(e):e.isBYOB()?n=new ur$1(e):e.isStickyATC()?n=new gr$1(e):e.isSavingsBar()?n=new dt$1(e):e.isCollectionFilter()?n=new mr$1(e):n=new M$2(e),Ke$1.add(n),n.renderSilently();}}function ho(r,e){for(let t of r)if(t.matches(e))return t}function Co(r,e){let t=new Set(e.map(n=>n.shortID));for(let n of r)t.has(n.engagementTrigger.shortID)||n.destroy();}async function yo(){await(await import('./widgets-DlajwKJ4-DkCWbIFl.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var Eo=new U,vo=0;Eo.pipe(Fe$2(50)).subscribe(async r=>{Ii$1(await tt()).catch(t=>{Fe$4(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function wo(r=false){le$2(z$2).then(()=>{Eo.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function go(r){let e=await tt();return Object.assign(r,e),ie$1(`/v1/engagement/get-variant`,r)}async function Ii$1(r$10){vo++,vo===1?Y$2.info(`Fetch widgets (after ⏰`,Rn()+` of SDK load)`):Y$2.info(`Fetch widgets`);let e=r$2({},r$10);try{let t=await ie$1(`/v1/engagement/eligible`,e);Y$2.info(`Widgets fetched ${In$1(t.timeTakenMs)}`);ut$1(t.data.pageWidgets?.map(i=>new G(i))??[]).catch(console.error);gt$1(t.data.cartWidgets?.map(i=>new G(i))??[]).catch(console.error);}catch(t){Y$2.error(`Error sending widget getter`,t);}}var bo=x$3(dr$3()),Cr$1=class r{static META_REQUIRED_FIELDS=[`ad_id`];static GOOGLE_REQUIRED_FIELDS=[`gad_source`,`gclid`];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source;}static getAdParams(){let e;try{e=new bo.URLBuilder(location.href);}catch{return {}}let t={};if(this.META_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`META`,adID:e.getQueryParam(`ad_id`)?.trim(),campaignID:e.getQueryParam(`campaign_id`)?.trim()},new r(t);if(this.GOOGLE_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`GOOGLE`},new r(t)}};var Hr={d:(r,e)=>{for(var t in e)Hr.o(e,t)&&!Hr.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},qr={};Hr.d(qr,{A:()=>Si$1,k:()=>Gr});var ft$1=function(r,e,t,n){return new(t||(t=Promise))(function(o,i){function s(u){try{p(n.next(u));}catch(d){i(d);}}function c(u){try{p(n.throw(u));}catch(d){i(d);}}function p(u){var d;u.done?o(u.value):(d=u.value,d instanceof t?d:new t(function(y){y(d);})).then(s,c);}p((n=n.apply(r,[])).next());})},ht$1=function(r,e){var t,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==`function`&&(i[Symbol.iterator]=function(){return this}),i;function c(p){return function(u){return (function(d){if(t)throw new TypeError(`Generator is already executing.`);for(;i&&(i=0,d[0]&&(s=0)),s;)try{if(t=1,n&&(o=2&d[0]?n.return:d[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,d[1])).done)return o;switch(n=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(r,s);}catch(y){d=[6,y],n=0;}finally{t=o=0;}if(5&d[0])throw d[1];return {value:d[0]?d[1]:void 0,done:true}})([p,u])}}};function Gr(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var n=`Unknown`,o=false;function i(g){o||(o=true,e({isPrivate:g,browserName:n}));}function s(){var g=0,v=parseInt(`-1`);try{v.toFixed(v);}catch(b){g=b.message.length;}return g}function c(){return navigator.msSaveBlob!==void 0&&(function(g){try{return g===eval.toString().length}catch{return false}})(39)}function p(){var g;return ft$1(this,void 0,void 0,function(){var v,b;return ht$1(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return f.sent(),i(false),[3,3];case 2:return v=f.sent(),b=v,v instanceof Error&&(b=(g=v.message)!==null&&g!==void 0?g:v),typeof b!=`string`?(i(false),[2]):(i(!!b.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function u(){var g;return ft$1(this,void 0,Promise,function(){return ht$1(this,function(v){switch(v.label){case 0:return ((g=navigator.storage)===null||g===void 0?void 0:g.getDirectory)===void 0?[3,2]:[4,p()];case 1:return v.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var b=String(Math.random());try{var f=indexedDB.open(b,1);f.onupgradeneeded=function(A){var fe=A.target.result,D=function(Er){i(Er);};try{fe.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),D(!1);}catch(Er){(Er.message||``).includes(`are not yet supported`)?D(!0):D(!1);}finally{fe.close(),indexedDB.deleteDatabase(b);}},f.onerror=function(){return i(!1)};}catch{i(false);}})():(function(){var b=window.openDatabase,f=window.localStorage;try{b(null,null,null,null);}catch{i(true);return}try{f.setItem(`test`,`1`),f.removeItem(`test`);}catch{i(true);return}i(false);})(),v.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(g,v){var b;i(Math.round(v/1048576)<2*Math.round(((b=window).performance!==void 0&&b.performance.memory!==void 0&&b.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576));},function(g){t(new Error(`detectIncognito somehow failed to query storage quota: `+g.message));});}function y(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}function S(){return ft$1(this,void 0,Promise,function(){var g,v;return ht$1(this,function(b){switch(b.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return [3,4];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return b.sent(),i(false),[3,4];case 3:return g=b.sent(),typeof(v=g instanceof Error&&typeof g.message==`string`?g.message:String(g))!=`string`?(i(false),[2]):(i(v.includes(`Security error`)),[2]);case 4:return i(navigator.serviceWorker===void 0),[2]}})})}(function(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(g){switch(g.label){case 0:return s()!==44?[3,2]:(n=`Safari`,[4,u()]);case 1:return g.sent(),[3,6];case 2:return s()!==51?[3,3]:(v=navigator.userAgent,n=v.match(/Chrome/)?navigator.brave!==void 0?`Brave`:v.match(/Edg/)?`Edge`:v.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,y(),[3,6]);case 3:return s()!==25?[3,5]:(n=`Firefox`,[4,S()]);case 4:return g.sent(),[3,6];case 5:c()?(n=`Internet Explorer`,i(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),g.label=6;case 6:return [2]}var v;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=Gr);var Si$1=Gr,Io=qr.A;qr.k;var So=x$3(St$3()),To=async()=>{let r={};try{return await Ti$1(r)}catch(e){return Fe$4(e,`device-properties`),r}},Ti$1=async r=>{let e=window.CooeeSDK.uaParser;Pi$1(r),Di$1(r),xi$1(r),r.referrer=document.referrer,r.host=location.origin,r.path=location.pathname,r.qs=location.search,r.locale=navigator.language,r.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Ri$1()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,_n({headless:true}));let t=e.getResult();return r.browser=t.browser,r.device=t.device,r.engine=t.engine,r.cpu=t.cpu,r.os=t.os,r.navigatorUA=navigator.userAgent,await Promise.all([Oi$1(r),_i$1(r),Li$1(r)]),r},Pi$1=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Di$1=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},xi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},Ri$1=()=>{if(!document.body)return;let r=document.createElement(`div`);r.setAttribute(`style`,`height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;`),document.body.appendChild(r);let e=window.devicePixelRatio||1,t=r.offsetWidth*e;return document.body.removeChild(r),t},_i$1=async r=>{try{await Ai$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},Ai$1=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(n=>{r.coords=[n.coords.latitude,n.coords.longitude],t();},()=>t());})},Oi$1=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},_n({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Li$1=async r=>{try{(await Io())?.isPrivate&&(r.incognito=!0,_n({incognito:!0}));}catch(e){So.default.error(`Unable to detect private/incognito window`,e);}};function Do(r){if(!xo())return;let e=Ne$3[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function xo(){return window.clarity&&typeof window.clarity==`function`}var z$2=new gr$2(1),_o=`App ID or Shopify shop is not set`,jr=``,ue=``,Kr=``,yr$1;async function sC(r){jr=r.appID,Kr=r.shopifyShop;try{await ki$1(),z$2.next(!0),z$2.complete();}catch(e){e?.message?.includes(_o)&&Fe$4(e,`initiate-session`,{extra:r}),Y$2.error(`Unable to initiate session`,e),z$2.error(e);}}async function ao(){return await Ao(false),yr$1}async function aC(){let r=Date.now();await tr$1.request(`gen_did`,async()=>{ue=await ce$4.get(`did`),ue||(ue=new $$1().toHexString(),await ce$4.set(`did`,ue)),Y$2.info(`Device ID:`,ue),Lo(ue);}),Y$2.info(`Device ID set/get done ${In$1(Date.now()-r)}`);}async function Ro(){if(yr$1)return;let[r,e,t]=await Promise.all([ve$4.get(`id`,``),ce$4.get(`sessionNumber`,1),ve$4.get(`landing`,{})]);Oo(r,e,t);}async function ki$1(){await Ao(true);}async function Ao(r){let e=false;return await Ui$1()?(await Ni$1(),e=true):await Mi$1()?(await Ro(),e=true):await Ro(),e?await Bi$1():r&&wo(),e}async function Ni$1(){Y$2.info(`Starting new session`),await ve$4.clear();let r=new Date,e=new $$1().toHexString(),t=await ce$4.get(`sessionNumber`,0)+1,n=or$1();await Promise.all([ce$4.set(`sessionNumber`,t),ve$4.set(`id`,e),ve$4.set(`lastUsedTime`,r.getTime()),ve$4.set(`landing`,n)]),Oo(e,t,n);}async function Ui$1(){let r=await ve$4.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Mi$1(){return !await ve$4.get(`synced`,false)}async function Fi$1(){if(!jr&&!Kr)throw new Error(_o);let r$11=await To(),e=ir$1();return s$3(r$2(r$2({deviceID:ue,deviceProps:r$11,appID:jr,shopifyShop:Kr},yr$1),e),{sdk:qr$4,ad:Cr$1.getAdParams(),occurred:Wi$1(ke$1().jsLoadTime),properties:{},uuid:await ce$4.get(`uuid`)})}async function Bi$1(){Y$2.info(`Ensuring session on server`),await Vi$1();let r=Date.now(),e=await Fi$1();Y$2.info(`Session data generated ${In$1(Date.now()-r)}`);try{let t=await ie$1(`/v1/event/validate-session`,e);Y$2.info(`Auth finished ${In$1(t.timeTakenMs)}`),await ve$4.set(`synced`,!0),t.data.deviceID&&(await ce$4.set(`did`,ue),Lo(t.data.deviceID));ut$1(t.data.pageWidgets?.map(i=>new G(i))??[]).catch(console.error);gt$1(t.data.cartWidgets?.map(i=>new G(i))??[]).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function Vi$1(){let r=await ce$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$4.set(`firstSeen`,e.toISOString()),oo(e),En$1(`Visitor Info`,{first_seen:e.toISOString()});}function Oo(r,e,t){_n({"cooee_session.number":e}),En$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$2.info(`Session number: ${e}, id: ${r}`),yr$1={sessionID:r,sessionNumber:e,landingPage:t};}function Lo(r){no(r);En$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),yn({id:r});}function Wi$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function gC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?$i$1():document.visibilityState===`hidden`&&Hi$1();};}async function $i$1(){}async function Hi$1(){let r=await qi$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}No(r);}async function qi$1(){let r=ke$1();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function ko(){let r=ke$1();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}var vr$1=class vr{triggerData;render(e){e.contentSource===me$3.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$2.warn(`Received invalid trigger callback`);return}switch(t.type){case `open`:X(new Ir$2(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let n=this.getFormDetails(t);X(new Ir$2(`CE Form Submitted`,{form:n},this.triggerData)),to(n);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),X(new Ir$2(`CE Trigger Closed`,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},n=e.metaData;if(pe$4.hasKeys(n)){let o=[`email`,`phone_number`,`first_name`,`last_name`,`$email`,`$phone_number`,`$first_name`,`$last_name`];Object.keys(n).forEach(c=>{o.includes(c)||(t[c]=n[c]);}),t.email=n.$email??n.email,t.mobile=n.$phone_number??n.phone_number;let i=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(i?.length||s?.length)&&(t.name=i+` `+s);}return t}};function Uo(r){if(!Gi$1()||!he$4.get().pixelPush)return;let t=Ne$3[r.intent]?.toLowerCase();t&&(Y$2.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Gi$1(){return window.fbq&&typeof window.fbq==`function`}var Mr=`/v1/event/track-page-unload`;function jn(r){Y$2.verbose(`Waiting for auth to send event ${r.name}`),le$2(z$2).then(()=>X(r)).catch(e=>Y$2.error(`Session not established, skipping trackEvent`,e));}function No(r){le$2(z$2).then(()=>{ji$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function ji$1(r){let e=ke$1().currentPageViewEvent;if(!e){Y$2.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$2.verbose(`Sending page unload`,t);try{await ie$1(Mr,t);}catch(n){throw Y$2.error(`Error sending page unload for ${e} to server`,n),n}}function X(r){Ki$1(r);}async function Ki$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),Zi$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}$n();let e=await tt();Object.assign(r,e),ko(),ve$4.set(`lastUsedTime`,new Date().getTime());let t=Qi$1(r.name),n=t.toLowerCase().replace(/\s+/g,`-`);try{let o=await ie$1(`/v1/event/track/${n}`,r);Y$2.info(`Event tracked:`,t),Xi$1(r)&&(ke$1().currentPageViewEvent={id:r.id,name:r.name}),zi$1(r,o.data);}catch(o){throw Y$2.error(`Error sending event ${r.name} to server`,o),o}}function Xi$1(r){return Zr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function zi$1(r,e){Yi$1(r,e).catch(t=>{Fe$4(t,`process-popup-response`,{extra:{event:r,response:e}});}),Ji$1(e);}async function Yi$1(r,e){if(!e.triggerData)return;let t=new G(e.triggerData);t.occurred=r.occurred,Y$2.log(`${t} will be shown`);let n;try{n=await nr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}if(t.items=n,t.contentSource===me$3.KLAVIYO){new vr$1().render(t);return}new(await(import('./renderer-DmvuOrY2-CoYiU0Ni.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{Fe$4(i,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Ji$1(r){r.intent&&(Do(r.intent),Uo(r),Y$2.info(`Intent is ${Ne$3[r.intent]}`));}function Qi$1(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Zi$1(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$2.warn(`Not sending event as this is a test trigger`),true):false}
|
|
83
|
+
`},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 n=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),n}function cr$1(r,e,t){let n={color:r.navigation.color?.rgba};return r.pagination.enabled&&(n.transform=`translateY(-25%)`),l$1(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[l$1(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&l$1(`div`,{class:`swiper-button-next`,style:n,children:l$1(`span`,{})}),r.navigation.enabled&&l$1(`div`,{class:`swiper-button-prev`,style:n,children:l$1(`span`,{})}),r.pagination.enabled&&l$1(`div`,{className:`swiper-pagination`,style:{bottom:0,top:`unset`,position:`relative`,color:r.pagination.color?.rgba}})]})}var vd=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Vr=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 ot=class extends w$1{componentDidMount(){Z$1(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-checkbox`),children:l$1(`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 G$2;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s$3(r$2({},this.getTypoStyles()),{display:`flex`})}};var se$1=class se extends w$1{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 l$1(`img`,{onClick:this.customOnClick.bind(this),alt:e?.name||`Image`,className:this.getClasses(`lc-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 ae$1=class ae extends w$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$1(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Et$2,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 it=class extends ae$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$1(je$1,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var st=class extends w$1{render(){return l$1(`select`,{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??``,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:this.getClasses(`lc-dropdown`),children:this.createSelectItems()})}componentDidMount(){Z$1(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility=`hidden`),r$2(r$2({},e),In(this.mediaStyle.typo))}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return [];this.props.triggerContext.triggerData.content?.subsUpgradeConfig?.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=true,t.changeSellingPlan(t.sellingPlans[0])):e.push(l$1(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let n of t.sellingPlans??[])e.push(l$1(`option`,{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var Ei$1=new RegExp(`fill="#[a-zA-Z0-9]+"`),at$1=class at extends w$1{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),l$1(`div`,{style:e,className:this.getClasses(`lc-star-rating`),dangerouslySetInnerHTML:{__html:t}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},t=Fe$3(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Fe$3(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return ``;let i=``;if(this.props.element.showSingleStar)i=t;else {let s=5,c=`${o.rating}`.split(`.`);for(let p=0;p<+c[0];p++)i+=t,s--;c[1]&&(i+=n,s--);for(let p=0;p<s;p++)i+=t.replace(Ei$1,`fill="#f1f1f1"`);}return i}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var ct$1=class ct extends w$1{render(){return l$1(`select`,{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:this.getClasses(`lc-dropdown`),children:this.createSelectItems()})}componentDidMount(){Z$1(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`&&(e.visibility=`hidden`),r$2(r$2({},e),In(this.mediaStyle.typo))}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(l$1(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,n=this.props.item.vars.find(o=>o.mID===t);this.props.item.setSelectedVariant(n);}};var je$1=class je extends w$1{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:l$1(it,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?l$1(ot,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===8){let t=e;if(!t.templateName)return ``;try{if(!/^[a-zA-Z0-9_-]+$/.test(t.templateName))return Y$2.error(`Invalid partial template name`,t.templateName),``;let n=Fe$3(`{{ @include("${t.templateName}", it) /}}`,this.props.productVariables??{});return l$1(`div`,{className:`lc-partial-`+t.templateName,dangerouslySetInnerHTML:{__html:n}})}catch(n){return Y$2.error(`Failed to render partial element`,t.templateName,this.props.productVariables,n),``}}if(e.t===13){let t=e,n=this.props.item,o=Vr(n.variantImage??n.firstImageURL),i=Vr(n.variantSecondaryImage??n.secondaryImageURL);t.lg=t.sm={src:o,name:n.name,secondarySrc:i};let s=l$1(se$1,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:l$1(`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.type!==`SINGLE`?l$1(`cooee-product-options-picker`,{item:this.props.item,styles:t.style,horizontal:t.horizontal,dropdownType:t.type}):l$1(ct$1,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?l$1(st,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?l$1(at$1,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?l$1(Ie$1,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):l$1(ge,{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=l$1(B$2,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:l$1(`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 n=t.detail.variantID;this.props.item.setSelectedVariantByID(n);});}};var Se$1=class Se extends w$1{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){let e=this.props.item,t=this.getProductData();if(this.productElement=new de$1(We$3(this.props.element,t,this.props.triggerContext)),this.productElement.hide||!this.matchWhenCondition(this.productElement.when))return;let o=this.getClasses([`lc-single-product`,...e.cardClasses??[]].join(` `));return l$1(`div`,{style:r$2({},this.getCompiledStyles()),className:o,children:l$1(je$1,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:t,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===q.BXGY;return !t.hasEffectivePrice()&&o&&(n.product=s$3(r$2(r$2({},n.product),$n$1(`effective_price`,t.effectivePrice.value)),{price:``})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity,{product:n.product,variant:n.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var lt$1=class lt extends w$1{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$4()?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$2().then(()=>{this.swiperInstance=ar$1(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 n=i=>{this.swiperRef=i;},o=()=>e?.map(i=>l$1(`div`,{class:`swiper-slide`,children:this.getProductFragment(i)}));t=l$1(`div`,{style:s$3(r$2({},this.getCompiledStyles()),{display:`block`}),className:this.getClasses(`lc-product-swiper-list`),children:cr$1(this.configuration,n,o)});}else t=l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-product-list`),children:e?.map((n,o)=>this.getProductFragment(n,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 n=this.props.triggerContext.triggerData,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==true?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${i}, auto)`;}}return t}getProductFragment(e,t=false){return l$1(ut$3,{children:[l$1(Se$1,{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&&l$1(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:l$1(B$2,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var mt$1=class mt extends w$1{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$2().then(()=>{this.swiperInstance=ar$1(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=o=>{this.swiperRef=o;},n=()=>{let o=e.values?.map(c=>l$1(`div`,{class:`swiper-slide`,onClick:p=>this.onClick(p,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!o?.length)return [];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let c=Number(i.maxInRow)-s+1;for(let p=0;p<c;p++)o.push(o[p%s]);}return o};return cr$1(e.conf,t,n)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return l$1(se$1,{element:t,triggerContext:this.props.triggerContext});case 4:return l$1(ae$1,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$2.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let n=We$3(e,{form:t},this.props.triggerContext);return F$1.getParsedElement(n)}getClickAction(e){return We$3(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var ge=class extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),Z$1(()=>{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 l$1(ae$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return l$1(nt,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?l$1(Ie$1,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return l$1(B$2,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return l$1(se$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return l$1(lt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return l$1(Se$1,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return l$1(mt$1,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var pt$1=class pt extends w$1{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he$3.GO_TO_URL&&!!Un$1(this.clickAction.gu?.u)||this.clickAction?.at===he$3.OPEN_CART||this.clickAction?.at===he$3.INITIATE_CHECKOUT;}componentDidMount(){Z$1(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return l$1(ut$3,{children:[l$1(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-container`),onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:l$1(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&l$1(`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 M$2=class r$9{constructor(e){this.engagementTrigger=e;this.triggerContext=new Me(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;lockReleased$=new U;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{Fe$4(e,`render-widget`,{triggerContext:this.triggerContext});});}destroy(){Y$2.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$9.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Mi$2(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$2.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,Mi$2(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){await this.waitForLockRelease(),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$2.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$2.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$2.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$2.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false,this.lockReleased$.next();}async waitForLockRelease(){this.isProcessing&&await le$2(this.lockReleased$);}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$2.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$2.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(n=>new mt$3(n)),t.nonMutableItems=e.items.map(n=>new mt$3(n))),e.bundleFrom&&(t.bundleFrom=new mt$3(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),pe$4.hasKeys(e.stickyATCConfig)&&(t.stickyATCConfig=e.stickyATCConfig),e.props&&pe$4.hasKeys(e.props)&&(t.props=r$2(r$2({},t.props),e.props)),e.content&&(t.content=new Ze$1(e.content)),t.widget=new $e$1(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$2.info(`${this.engagementTrigger} rendered \u2705 ${qn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof j$1?Te.delete(this):Ke$1.delete(this);}async getVariation(){Y$2.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await go(e)).data}catch(t){if(t instanceof ne$3&&t.response?.status===400)return;Fe$4(t,`get-variation`,{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){Y$2.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(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async c=>{if(c.isIntersecting){Y$2.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);n(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);o.observe(this.rootContainer),this.observers.push(o);})}attachScroll(){this.scrollSubscription=Tr$1(window,`scroll`).pipe(Fe$2(r$9.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent();});}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r$9.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=new Ir$2(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,n,this.engagementTrigger);i.name===`CE Campaign Holdout`&&(i.trigger.holdout=true),X(i),r$9.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe();}generateParentElementID(){return `letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=h.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 n=t.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),i=this.engagementTrigger.shortID;n=document.createElement(`div`),n.id=e;let s=`letscooee letscooee-engagement engagement-${i} lc-${o}`;return this.engagementTrigger.content?.classes&&(s+=` ${this.engagementTrigger.content.classes}`),n.className=s,n.dataset.engagementId=i,this.engagementTrigger.id===`preview`&&(n.className+=` letscooee-preview`),n.style.display=`block`,n.style.minHeight=`0.5px`,n.style.minWidth=`0.5px`,n}async startRendering(){let e=this.rootContainer,t=this.triggerContext.triggerData.hasSwiperElement();t&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:`open`}),Hi$2(e)),this.injectCampaignCSS(t,e);let n=this.engagementTrigger.widget;Ye$3(Yr$2(pt$1,{element:n.cont,triggerContext:this.triggerContext,elements:n.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let n=this.engagementTrigger.content?.outerCSS?.trim()??``,o=this.engagementTrigger.content?.innerCSS?.trim()??``;if(!n&&!o)return;let i=this.rootContainer.id;if(e){le$4(o,t),this.injectOuterCSSOnly();return}le$4(`#${i} { ${n+`
|
|
84
|
+
${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;le$4(`#${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 n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return Y$2.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=t.selector,o;if(n.includes(`:shadow`)){let p=n.split(`:shadow`);o=(await Yn$1(p[0].trim()))?.shadowRoot,n=p[1].trim(),o&&Hi$2(o,false);}Y$2.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${n}"`);let i=await Yn$1(n,3,o??document);if(!i)return Y$2.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case ce$3.BEFORE1:case ce$3.BEFORE:i.parentElement?.insertBefore(c,i);break;case ce$3.INSIDE_FIRST1:case ce$3.INSIDE_FIRST:i.insertBefore(c,i.firstChild);break;case ce$3.INSIDE_LAST1:case ce$3.INSIDE_LAST:i.appendChild(c);break;case ce$3.AFTER1:case ce$3.AFTER:default:i.parentElement?.insertBefore(c,i.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$2.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$2.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await nr$1(this.engagementTrigger);}catch(t){Y$2.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$2.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering();}updateItems(e,t){let n=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...n);for(let i of o)oe$1.remove(t,i);}getItemDiff(e,t){return e.filter(n=>!t.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var j$1=class j extends M$2{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(!_.get().isOpen()&&ke$1().pageName!==`cart`){Y$2.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var lr$1=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=h.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$2.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(t.selector));if(!n?.length){Y$2.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new r(e,o).render();}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.content?.subsUpgradeConfig?.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!t)return;let n=t.vars.find(d=>d.mID===e.id.toString());if(!n)return;let o=new dt$2(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of o.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=true,o.changeSellingPlan(d));let s=new mt$3(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let p=new G(this.engagementTrigger);p.placement.selector=`.${c}`,p.items=[s];let u=new j$1(p);u.renderSilently(),this.watchForCartItemDeletion(u,c);}watchForCartItemDeletion(e,t){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(Y$2.verbose(`${t} has been removed`),e.destroy(),n.disconnect());});});});n.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 n=t.selling_plan_allocation?.selling_plan?.name;return !(n&&!e.includes(n))})}};var mr$1=class mr extends M$2{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var pr$1=class pr extends j$1{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){Fe$4(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await h.getCurrent().getNormalisedCart(true),t=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,c,p=[...t.milestones];for(let u of p){if(u.rewardType!==Ee$4.FREE_AUTO_GIFT)continue;if(u.isUIOnly&&!u.allowATC){Y$2.verbose(`Skipping milestone ${u.label} as it is UI only and does not allow ATC`);continue}let d=u.items[0],y=u.reached,S=e.items.find(g=>(g.vID===d.vID||g.mID===d.mID)&&g.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(s=u,c=S),S&&n.push(S),!y&&S&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${S.vID} from cart`),i.push(S)):y&&!S&&(Y$2.verbose(`Adding free gift ${d.vID} to cart`),o.push(d));}t.restrictToLatestFreebie&&s&&(c?(n=n.filter(u=>u.vID!==c.vID),o=[]):o=[s.items[0]],i.push(...n)),t.treatFreebieAsSeparateLineItem?await this.handleSeparateFreebieLineItems(o,i):await this.handleCombinedCartUpdate(o,i);}async handleSeparateFreebieLineItems(e,t){if(!t.length&&!e.length)return;let n=new qe$1,o=[];if(e.length){let c=this.addFreebiesOperation(e,n);o.push(c);}if(t.length){let c=this.removeFreebiesOperation(t);o.push(c);}if(!o.length)return;let i;try{i=await Promise.all(o),Y$2.log(`All freebie and coupon operations completed`);}catch(c){Fe$4(c,`parallel-freebie-operations`,{engagementTrigger:this.engagementTrigger});}let s;e.length&&i?.length&&(s=i[0]),_.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(n=>t.updates[n.key??n.vID]=n.quantity-1),Fr(t,this.engagementTrigger)}async addFreebiesOperation(e,t){return t.addToCart(e,this.engagementTrigger)}async handleCombinedCartUpdate(e,t){let n=this.engagementTrigger.progressBarConfig,o={},i={};t.length&&t.forEach(y=>i[y.key??y.vID]=0),e.length&&e.forEach(y=>i[y.vID]=1);let s=n.coupons,c=[];if(s?.length){c=s.map(g=>g.couponCode);let y=h.getCurrent().discount_codes?.map(g=>g.code)??[];c.every(g=>y.some(v=>v===g))||(o.discount=c.join(`,`));}if(pe$4.hasKeys(i)&&(o.updates=i),!pe$4.hasKeys(o))return;let p=await Fr(o,this.engagementTrigger),u=p?.items,d=[];for(let y of e){let S=u?.find(g=>c?.length?g.id+``===y.vID&&g.discounts?.some(v=>c.includes(v.title)):g.id+``===y.vID);S&&d.push(S);}if(!d.length){_.get().refreshUI(p,false);return}try{await Promise.all(d.map(y=>mo(y,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(y){Fe$4(y,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{_.get().refreshUI(p,false);}}};var dt$1=class dt extends j$1{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 dr$1=class dr extends M$2{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 gr$1=class gr extends M$2{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var ur$1=class ur extends M$2{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,n=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$2.error(`No detail received for ${n}`);return}Y$2.log(`Detail received for BYOB`,o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==t.shortID&&i!==t.engagementID){Y$2.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let c=s.map(p=>new at$2({mID:p.product_id,vID:p.variant_id,quantity:p.quantity||1}));await new Ge$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$3.ADD_BUNDLE,applyDiscount:true}});}};var Wr=false,$r=false,fr=null,hr$1=null,uo=false,Te=new Set,Ke$1=new Set;function fo(){uo||(uo=true,wt$2(()=>{qn(document.body,{childList:true,subtree:true},500,Hn).subscribe(()=>{Ke$1.forEach(r=>r.rerenderIfDeleted()),Te.forEach(r=>r.rerenderIfDeleted());});}));}async function gt$1(r){if(r.length>0&&await yo(),fo(),Wr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),fr=r;return}Wr=true;try{wi$1(r);}finally{if(Wr=false,fr){let e=fr;fr=null,Y$2.verbose(`Processing queued cart triggers`),gt$1(e);}}}async function ut$1(r){if(r.length>0&&await yo(),fo(),$r){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),hr$1=r;return}$r=true;try{bi$1(r);}finally{if($r=false,hr$1){let e=hr$1;hr$1=null,Y$2.verbose(`Processing queued page triggers`),ut$1(e).catch(console.error);}}}function gh(){Te.forEach(r=>r.rerenderAfterCartOpened());}function wi$1(r){Co(Te,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=ho(Te,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{Fe$4(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new pr$1(e);else if(e.isSubscriptionUpsell()){lr$1.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new dt$1(e):n=new j$1(e);Te.add(n),n.renderSilently();}}function bi$1(r){Co(Ke$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=ho(Ke$1,e);if(t){t.updateAndReRender(e).catch(o=>{Fe$4(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new dr$1(e):e.isBYOB()?n=new ur$1(e):e.isStickyATC()?n=new gr$1(e):e.isSavingsBar()?n=new dt$1(e):e.isCollectionFilter()?n=new mr$1(e):n=new M$2(e),Ke$1.add(n),n.renderSilently();}}function ho(r,e){for(let t of r)if(t.matches(e))return t}function Co(r,e){let t=new Set(e.map(n=>n.shortID));for(let n of r)t.has(n.engagementTrigger.shortID)||n.destroy();}async function yo(){await(await import('./widgets-ZT4wIqHS-C2ijp0OQ.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var Eo=new U,vo=0;Eo.pipe(Fe$2(50)).subscribe(async r=>{Ii$1(await tt()).catch(t=>{Fe$4(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function wo(r=false){le$2(z$2).then(()=>{Eo.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function go(r){let e=await tt();return Object.assign(r,e),ie$1(`/v1/engagement/get-variant`,r)}async function Ii$1(r$10){vo++,vo===1?Y$2.info(`Fetch widgets (after ⏰`,Rn()+` of SDK load)`):Y$2.info(`Fetch widgets`);let e=r$2({},r$10);try{let t=await ie$1(`/v1/engagement/eligible`,e);Y$2.info(`Widgets fetched ${In$1(t.timeTakenMs)}`);ut$1(t.data.pageWidgets?.map(i=>new G(i))??[]).catch(console.error);gt$1(t.data.cartWidgets?.map(i=>new G(i))??[]).catch(console.error);}catch(t){Y$2.error(`Error sending widget getter`,t);}}var bo=x$3(dr$3()),Cr$1=class r{static META_REQUIRED_FIELDS=[`ad_id`];static GOOGLE_REQUIRED_FIELDS=[`gad_source`,`gclid`];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source;}static getAdParams(){let e;try{e=new bo.URLBuilder(location.href);}catch{return {}}let t={};if(this.META_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`META`,adID:e.getQueryParam(`ad_id`)?.trim(),campaignID:e.getQueryParam(`campaign_id`)?.trim()},new r(t);if(this.GOOGLE_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`GOOGLE`},new r(t)}};var Hr={d:(r,e)=>{for(var t in e)Hr.o(e,t)&&!Hr.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},qr={};Hr.d(qr,{A:()=>Si$1,k:()=>Gr});var ft$1=function(r,e,t,n){return new(t||(t=Promise))(function(o,i){function s(u){try{p(n.next(u));}catch(d){i(d);}}function c(u){try{p(n.throw(u));}catch(d){i(d);}}function p(u){var d;u.done?o(u.value):(d=u.value,d instanceof t?d:new t(function(y){y(d);})).then(s,c);}p((n=n.apply(r,[])).next());})},ht$1=function(r,e){var t,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==`function`&&(i[Symbol.iterator]=function(){return this}),i;function c(p){return function(u){return (function(d){if(t)throw new TypeError(`Generator is already executing.`);for(;i&&(i=0,d[0]&&(s=0)),s;)try{if(t=1,n&&(o=2&d[0]?n.return:d[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,d[1])).done)return o;switch(n=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(r,s);}catch(y){d=[6,y],n=0;}finally{t=o=0;}if(5&d[0])throw d[1];return {value:d[0]?d[1]:void 0,done:true}})([p,u])}}};function Gr(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var n=`Unknown`,o=false;function i(g){o||(o=true,e({isPrivate:g,browserName:n}));}function s(){var g=0,v=parseInt(`-1`);try{v.toFixed(v);}catch(b){g=b.message.length;}return g}function c(){return navigator.msSaveBlob!==void 0&&(function(g){try{return g===eval.toString().length}catch{return false}})(39)}function p(){var g;return ft$1(this,void 0,void 0,function(){var v,b;return ht$1(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return f.sent(),i(false),[3,3];case 2:return v=f.sent(),b=v,v instanceof Error&&(b=(g=v.message)!==null&&g!==void 0?g:v),typeof b!=`string`?(i(false),[2]):(i(!!b.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function u(){var g;return ft$1(this,void 0,Promise,function(){return ht$1(this,function(v){switch(v.label){case 0:return ((g=navigator.storage)===null||g===void 0?void 0:g.getDirectory)===void 0?[3,2]:[4,p()];case 1:return v.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var b=String(Math.random());try{var f=indexedDB.open(b,1);f.onupgradeneeded=function(A){var fe=A.target.result,D=function(Er){i(Er);};try{fe.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),D(!1);}catch(Er){(Er.message||``).includes(`are not yet supported`)?D(!0):D(!1);}finally{fe.close(),indexedDB.deleteDatabase(b);}},f.onerror=function(){return i(!1)};}catch{i(false);}})():(function(){var b=window.openDatabase,f=window.localStorage;try{b(null,null,null,null);}catch{i(true);return}try{f.setItem(`test`,`1`),f.removeItem(`test`);}catch{i(true);return}i(false);})(),v.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(g,v){var b;i(Math.round(v/1048576)<2*Math.round(((b=window).performance!==void 0&&b.performance.memory!==void 0&&b.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576));},function(g){t(new Error(`detectIncognito somehow failed to query storage quota: `+g.message));});}function y(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}function S(){return ft$1(this,void 0,Promise,function(){var g,v;return ht$1(this,function(b){switch(b.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return [3,4];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return b.sent(),i(false),[3,4];case 3:return g=b.sent(),typeof(v=g instanceof Error&&typeof g.message==`string`?g.message:String(g))!=`string`?(i(false),[2]):(i(v.includes(`Security error`)),[2]);case 4:return i(navigator.serviceWorker===void 0),[2]}})})}(function(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(g){switch(g.label){case 0:return s()!==44?[3,2]:(n=`Safari`,[4,u()]);case 1:return g.sent(),[3,6];case 2:return s()!==51?[3,3]:(v=navigator.userAgent,n=v.match(/Chrome/)?navigator.brave!==void 0?`Brave`:v.match(/Edg/)?`Edge`:v.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,y(),[3,6]);case 3:return s()!==25?[3,5]:(n=`Firefox`,[4,S()]);case 4:return g.sent(),[3,6];case 5:c()?(n=`Internet Explorer`,i(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),g.label=6;case 6:return [2]}var v;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=Gr);var Si$1=Gr,Io=qr.A;qr.k;var So=x$3(St$3()),To=async()=>{let r={};try{return await Ti$1(r)}catch(e){return Fe$4(e,`device-properties`),r}},Ti$1=async r=>{let e=window.CooeeSDK.uaParser;Pi$1(r),Di$1(r),xi$1(r),r.referrer=document.referrer,r.host=location.origin,r.path=location.pathname,r.qs=location.search,r.locale=navigator.language,r.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Ri$1()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,_n({headless:true}));let t=e.getResult();return r.browser=t.browser,r.device=t.device,r.engine=t.engine,r.cpu=t.cpu,r.os=t.os,r.navigatorUA=navigator.userAgent,await Promise.all([Oi$1(r),_i$1(r),Li$1(r)]),r},Pi$1=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Di$1=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},xi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},Ri$1=()=>{if(!document.body)return;let r=document.createElement(`div`);r.setAttribute(`style`,`height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;`),document.body.appendChild(r);let e=window.devicePixelRatio||1,t=r.offsetWidth*e;return document.body.removeChild(r),t},_i$1=async r=>{try{await Ai$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},Ai$1=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(n=>{r.coords=[n.coords.latitude,n.coords.longitude],t();},()=>t());})},Oi$1=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},_n({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Li$1=async r=>{try{(await Io())?.isPrivate&&(r.incognito=!0,_n({incognito:!0}));}catch(e){So.default.error(`Unable to detect private/incognito window`,e);}};function Do(r){if(!xo())return;let e=Ne$3[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function xo(){return window.clarity&&typeof window.clarity==`function`}var z$2=new gr$2(1),_o=`App ID or Shopify shop is not set`,jr=``,ue=``,Kr=``,yr$1;async function sC(r){jr=r.appID,Kr=r.shopifyShop;try{await ki$1(),z$2.next(!0),z$2.complete();}catch(e){e?.message?.includes(_o)&&Fe$4(e,`initiate-session`,{extra:r}),Y$2.error(`Unable to initiate session`,e),z$2.error(e);}}async function ao(){return await Ao(false),yr$1}async function aC(){let r=Date.now();await tr$1.request(`gen_did`,async()=>{ue=await ce$4.get(`did`),ue||(ue=new $$1().toHexString(),await ce$4.set(`did`,ue)),Y$2.info(`Device ID:`,ue),Lo(ue);}),Y$2.info(`Device ID set/get done ${In$1(Date.now()-r)}`);}async function Ro(){if(yr$1)return;let[r,e,t]=await Promise.all([ve$4.get(`id`,``),ce$4.get(`sessionNumber`,1),ve$4.get(`landing`,{})]);Oo(r,e,t);}async function ki$1(){await Ao(true);}async function Ao(r){let e=false;return await Ui$1()?(await Ni$1(),e=true):await Mi$1()?(await Ro(),e=true):await Ro(),e?await Bi$1():r&&wo(),e}async function Ni$1(){Y$2.info(`Starting new session`),await ve$4.clear();let r=new Date,e=new $$1().toHexString(),t=await ce$4.get(`sessionNumber`,0)+1,n=or$1();await Promise.all([ce$4.set(`sessionNumber`,t),ve$4.set(`id`,e),ve$4.set(`lastUsedTime`,r.getTime()),ve$4.set(`landing`,n)]),Oo(e,t,n);}async function Ui$1(){let r=await ve$4.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Mi$1(){return !await ve$4.get(`synced`,false)}async function Fi$1(){if(!jr&&!Kr)throw new Error(_o);let r$11=await To(),e=ir$1();return s$3(r$2(r$2({deviceID:ue,deviceProps:r$11,appID:jr,shopifyShop:Kr},yr$1),e),{sdk:qr$4,ad:Cr$1.getAdParams(),occurred:Wi$1(ke$1().jsLoadTime),properties:{},uuid:await ce$4.get(`uuid`)})}async function Bi$1(){Y$2.info(`Ensuring session on server`),await Vi$1();let r=Date.now(),e=await Fi$1();Y$2.info(`Session data generated ${In$1(Date.now()-r)}`);try{let t=await ie$1(`/v1/event/validate-session`,e);Y$2.info(`Auth finished ${In$1(t.timeTakenMs)}`),await ve$4.set(`synced`,!0),t.data.deviceID&&(await ce$4.set(`did`,ue),Lo(t.data.deviceID));ut$1(t.data.pageWidgets?.map(i=>new G(i))??[]).catch(console.error);gt$1(t.data.cartWidgets?.map(i=>new G(i))??[]).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function Vi$1(){let r=await ce$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$4.set(`firstSeen`,e.toISOString()),oo(e),En$1(`Visitor Info`,{first_seen:e.toISOString()});}function Oo(r,e,t){_n({"cooee_session.number":e}),En$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$2.info(`Session number: ${e}, id: ${r}`),yr$1={sessionID:r,sessionNumber:e,landingPage:t};}function Lo(r){no(r);En$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),yn({id:r});}function Wi$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function gC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?$i$1():document.visibilityState===`hidden`&&Hi$1();};}async function $i$1(){}async function Hi$1(){let r=await qi$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}No(r);}async function qi$1(){let r=ke$1();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function ko(){let r=ke$1();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}var vr$1=class vr{triggerData;render(e){e.contentSource===me$3.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$2.warn(`Received invalid trigger callback`);return}switch(t.type){case `open`:X(new Ir$2(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let n=this.getFormDetails(t);X(new Ir$2(`CE Form Submitted`,{form:n},this.triggerData)),to(n);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),X(new Ir$2(`CE Trigger Closed`,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},n=e.metaData;if(pe$4.hasKeys(n)){let o=[`email`,`phone_number`,`first_name`,`last_name`,`$email`,`$phone_number`,`$first_name`,`$last_name`];Object.keys(n).forEach(c=>{o.includes(c)||(t[c]=n[c]);}),t.email=n.$email??n.email,t.mobile=n.$phone_number??n.phone_number;let i=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(i?.length||s?.length)&&(t.name=i+` `+s);}return t}};function Uo(r){if(!Gi$1()||!he$4.get().pixelPush)return;let t=Ne$3[r.intent]?.toLowerCase();t&&(Y$2.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Gi$1(){return window.fbq&&typeof window.fbq==`function`}var Mr=`/v1/event/track-page-unload`;function jn(r){Y$2.verbose(`Waiting for auth to send event ${r.name}`),le$2(z$2).then(()=>X(r)).catch(e=>Y$2.error(`Session not established, skipping trackEvent`,e));}function No(r){le$2(z$2).then(()=>{ji$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function ji$1(r){let e=ke$1().currentPageViewEvent;if(!e){Y$2.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$2.verbose(`Sending page unload`,t);try{await ie$1(Mr,t);}catch(n){throw Y$2.error(`Error sending page unload for ${e} to server`,n),n}}function X(r){Ki$1(r);}async function Ki$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),Zi$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}$n();let e=await tt();Object.assign(r,e),ko(),ve$4.set(`lastUsedTime`,new Date().getTime());let t=Qi$1(r.name),n=t.toLowerCase().replace(/\s+/g,`-`);try{let o=await ie$1(`/v1/event/track/${n}`,r);Y$2.info(`Event tracked:`,t),Xi$1(r)&&(ke$1().currentPageViewEvent={id:r.id,name:r.name}),zi$1(r,o.data);}catch(o){throw Y$2.error(`Error sending event ${r.name} to server`,o),o}}function Xi$1(r){return Zr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function zi$1(r,e){Yi$1(r,e).catch(t=>{Fe$4(t,`process-popup-response`,{extra:{event:r,response:e}});}),Ji$1(e);}async function Yi$1(r,e){if(!e.triggerData)return;let t=new G(e.triggerData);t.occurred=r.occurred,Y$2.log(`${t} will be shown`);let n;try{n=await nr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}if(t.items=n,t.contentSource===me$3.KLAVIYO){new vr$1().render(t);return}new(await(import('./renderer-XxQ20sXb-CoYiU0Ni.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{Fe$4(i,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Ji$1(r){r.intent&&(Do(r.intent),Uo(r),Y$2.info(`Intent is ${Ne$3[r.intent]}`));}function Qi$1(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Zi$1(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$2.warn(`Not sending event as this is a test trigger`),true):false}
|
|
85
85
|
|
|
86
86
|
var t=class{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(e){this.onResizeCallback=e,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener(`resize`,this.debouncedResize),window.addEventListener(`orientationchange`,this.handleImmediateResize);}destroy(){window.removeEventListener(`resize`,this.debouncedResize),window.removeEventListener(`orientationchange`,this.handleImmediateResize);}handleImmediateResize=()=>{this.triggerResize();};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize();},this.debounceDelay);};triggerResize(){let e=window.innerWidth,i=window.innerHeight;(i!==this.lastHeight||e!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=e,this.lastHeight=i);}};
|
|
87
87
|
|
|
@@ -96,14 +96,14 @@ ${e.map(h=>` ${h};`).join(`
|
|
|
96
96
|
${Te.map(h=>` ${h};`).join(`
|
|
97
97
|
`)}
|
|
98
98
|
}
|
|
99
|
-
}`),Tt}resolvePrimaryButtonColors(e,i){switch(this.buttons.primary.style){case `outline`:return {bg:`0 0 0 / 0`,color:e,border:e};case `ghost`:return {bg:`0 0 0 / 0`,color:e,border:`0 0 0 / 0`};default:return {bg:e,color:i,border:e}}}resolveSecondaryButtonColors(e,i,o,l){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:l,color:e,border:e}:{bg:`0 0 0 / 0`,color:e,border:e};case `inverted`:return {bg:o,color:i,border:`0 0 0 / 0`};default:return this.buttons.secondary.style===`filled`?{bg:l,color:o,border:o}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Xe=class{apply(e){if(!e)return;le$4(new Ye(e).toCSSString());}};function Ni(){let t=he$4.get();!t.gaMeasurementID||!t.gaEnabled||hr();}async function gr(){let t=await ce$4.get(`gacid`),e=await br();if(t!==e)return await ce$4.set(`gacid`,e),e}async function hr(){let t=await gr();t&&zm({gaClientID:t});}async function br(){let e=he$4.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}var Bi=!!new URL(location.href).searchParams?.get(`new-brand`);async function Hi(t){(t?.enabled||Bi)&&new Xe().apply(t);}function wr(t){if(!t)return t;let e=t.match(/:root\s*\{/);if(!e)return t;let i=0,o=-1;for(let l=e.index;l<t.length;l++)if(t[l]===`{`)i++;else if(t[l]===`}`&&--i===0){o=l+1;break}return o===-1?t:(t.slice(0,e.index)+t.slice(o)).trimStart()}async function Ct(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=w.globalRef.config.update(t);Ni(),_.initialize(),e.website&&(Bi&&(e.website.commonCSS=wr(e.website.commonCSS)),Ui$2(e.website.commonJS),le$4(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$2(10)).subscribe(async({open:i})=>{Y$2.info(`Cart drawer is now`,i?`open`:`closed`),i&&(gh(),await vr());});}function $i(t){w.globalRef.apiURLs=t;}function zi(t){t?.length&&t.forEach(e=>{ze$1(e.name,e.template);});}async function vr(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};jn(new Ir$2(`View Cart`,{items:t.items,amount:e,drawer:true}));}var Ie=class{runtimeData=ke$1();meddle(){let e=w.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{wo();},e.loadExperiments=()=>{Ke();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(i,o)=>{new Ge$1(i).execute(o);},e.sendEvent=i=>{jn(i);};}overwritePush(e,i){zn$1(e,`push`,i);}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0]);}),w.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),w.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(Qr$3.includes(e[0])?w.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&w.updateProfile(e);}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0]);}),w.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.appID&&w.authenticate(e),e.currentItem&&yr(e.currentItem),e.currency&&(ke$1().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&Ct(e.configurations),e.storeSettings&&Ct(e.storeSettings),e.storeBrand&&Hi(e.storeBrand),e.apiURLs&&$i(e.apiURLs),e.widgetPartials&&zi(e.widgetPartials),e.customContext&&(this.runtimeData.customContext=r$2(r$2({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(ke$1().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=vd();if(e||(e=ke$1().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let i=new G({id:`preview`,shortID:`1`,redirectBehaviour:ae$4.CART_DRAWER});await new Ge$1(new Me(new Date,i)).execute({clickAction:{at:he$3.ADD_TO_CART},embeddedItem:new at$2({vID:e})});}};function yr(t){let e=ke$1();if(e.currentItem&&e.currentItem.vID!==t.vID){let i=new CustomEvent(`letscooee:variant-change`,{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(i);}e.currentItem=new at$2(t);}var le=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=`cooee`.concat(`-`);static getString(e,i){return this.getItem(e)||i}static setString(e,i){this.setItem(e,i);}static remove(e){this.removeItem(e);}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,i){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),i);}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e));}};var Er=1e3,Sr=10,Rt=0,It=new Date;function _t(t){le.remove(`sleid`),It=t??new Date;}function Ui(){if(window.scrollY){let t=Vi();Fi(t)&&Wi(t);}wt$2(()=>{xr();});}function xr(){Tr$1(window,`scroll`).pipe(Fe$2(Er),q$1(()=>{let t=Vi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(Fi(t))return t})).subscribe(t=>{Wi(t);});}function Fi(t){return Math.abs(Rt-t)>=Sr||Rt!==t&&t===100}function Wi(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-It.getTime()};Rt=t;let o=new Ir$2(`CE Scroll`,e,null,le.getString(`sleid`,``));jn(o),le.setString(`sleid`,o.id.toHexString()),It=new Date(o.occurred);}function Vi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function ji(){kr();}function kr(){let t=window.fetch;try{window.fetch=async function(e,i){try{await Cr(e,i);}catch(o){Fe$4(o,`modify-graphql-request`,{extra:{body:JSON.stringify(i?.body)}});}return t(e,i)};}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Buy Now Clicked" KPI.`),Y$2.error(e);}Y$2.verbose(`Securely overwritten window.fetch method for graphql query`);}async function Cr(t,e){let i=typeof t==`string`?t:t instanceof Request?t.url:``;if(!(i.includes(`graphql.json`)&&e?.method===`POST`)||!e.body)return;let o;if(typeof e.body==`string`)try{o=JSON.parse(e.body);}catch{return}else o=e.body;o?.variables?.input&&(Y$2.verbose(`Intercepted fetch request of:`,i),o?.query.includes(`cartCreate`)&&(e.body=await Rr(o),Ir()));}async function Rr(t){let e=t.variables.input.attributes??[],i=await jn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function Ir(){let t=ke$1().currentItem;if(!t)return;jn(new Ir$2(`Buy Now Clicked`,{items:[t]}));}var de=class{constructor(e,i){this.selectors=e;this.eventName=i;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let i=e.currentTarget;jn(new Ir$2(this.eventName,{class:i.className||void 0,tagName:i.tagName||void 0,id:i.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$2.error(e));}async listen(){this.elements=await Vr$4(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(i=>{i.removeEventListener(`click`,e);});}};var Je=class t extends de{static selectors=[`.product__thumbnail-list-inner > button`,`product-gallery-navigation > button`,`.product-media--thumb-container`,`.product-images-inner > img`,`.m-product-media`,`.swiper-button-control`,`.media__thumb`,`.slick-arrow`,`.productView-img-container.product-single__media`,`.product-gallery__thumbnail_item_inner`];constructor(){super(t.selectors,`Item Thumbnail Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ze=class t extends de{static selectors=[`.jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup`,`reviewsio-product-ratings`,`.ruk_rating_snippet.tracked:not(.hidden)`,`a > .loox-rating`,`.yotpo-reviews-star-ratings-widget`,`.yotpo.lp-hero__reviews`,`.pr-rating > a`,`.rivyoReviewWidget`];constructor(){super(t.selectors,`Review Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var _r=[`.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 qi(){wt$2(()=>{Y$2.verbose(`Execution order:`,`document ready`),Tr();});}function Tr(){let t=window.location.hash?.substring(1);if(t)if(t.includes(`initiate-checkout`)){document.dispatchEvent(new Event(`letscooee:outbound:third-party-initiate-checkout`));let e=document.querySelector(_r);if(!e){Y$2.verbose(`No clickable cart checkout button found`);return}Y$2.verbose(`Clickable cart checkout button found`,e),e.click();}else t.includes(`open-cart-drawer`)&&_.get().open();}function Gi(){window.addEventListener(`kp-modal:opened`,()=>{ke$1().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&to({goKwikToken:e});});}var w=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),gi(navigator.userAgent)){Y$2.info(`This seems to be a bot. Disabling SDK`);return}if(navigator.webdriver){Y$2.info(`This seems to be headless browser. Disabling SDK`);return}if(this.initGlobalReference(e),window.cooeeSDKPreview){new Ie().meddle();return}await aC(),this.autoAuthenticate(),new Ie().meddle(),Rm(),Ke(),Ar(),gC(),Xl(),ji(),qi(),Ui(),Ze.getInstance().listenSilently(),Je.getInstance().listenSilently(),Gi(),Pr(),to$1(),Qo(),Ne.remove(`conf`).catch(i=>{Y$2.error(`Fail to remove App Config from local storage`,i);});}static initGlobalReference(e){window.CooeeSDK||zn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,zn$1(this.globalRef,`config`,new he$4),zn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),zn$1(this.globalRef,`uaParser`,new P,true),zn$1(this.globalRef,`cart`,h.getCurrent()),zn$1(this.globalRef,`cartChange$`,Kl()),zn$1(this.globalRef,`cartDrawerToggle$`,_.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new P;});}static autoAuthenticate(){let e=Mn();e&&this.authenticate({shopifyShop:e});}static authenticate(e){if(this.authenticated)return;Y$2.info(`Begin auth after ⏰`,Rn(),`of SDK load`);let i=e.appID?.trim(),o=e.shopifyShop;if((kn(i)||i.length!==24)&&kn(o)){Y$2.warn(`Cooee App ID or Shop name is not configured`);return}this.authenticated=true,sC(e);}static sendEvent(e,i,o){let l=new Ir$2(e,i,o?.triggerData);o?.occurred&&(l.occurred=o.occurred),jn(l);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);to(e);}static setPageName(e){if(!e)return;let i=ke$1(),o=i.pageName;if(e===o)return;if(i.pageName=e,Xr$3.some(d=>e.includes(d))){_t();return}let l={};o&&(l.ps=o);let p=new Ir$2(`CE Screen View`,l);p.occurred=i.jsLoadTime,jn(p),_t(p.occurred);}static previewPopup(e,i){import('./renderer-DmvuOrY2-CoYiU0Ni.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){if(!e)return;let i=new G(e);i.isPageWidgets()?ut$1([i]).catch(console.error):i.isCartEmbed()?gt$1([i]).catch(console.error):Y$2.error(`Unsupported widget type for preview: `+i.onsiteDeliveryType);}};function Ar(){window.CooeeSDK.cartChange$.subscribe(()=>{wo();});}function Pr(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(t){Y$2.error(t);}window.addEventListener(`message`,t=>{if(Y$2.verbose(`Received event`,t),!t.origin.includes(`letscooee.com`)&&!t.origin.includes(`localhost`))return;let e=t.data;typeof e==`object`&&(e.action===`POPUP_PREVIEW`?(w.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(w.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var Ki=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Zn$1(),eo$1(),await w.initForMerchantWebsiteOnly(Ki),_e$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Br$4()&&Promise.resolve().then(function () { return sdkDebugLogsXn_8lsQA; }).then(({printAllDebugLogs:t})=>t(Ki)));
|
|
99
|
+
}`),Tt}resolvePrimaryButtonColors(e,i){switch(this.buttons.primary.style){case `outline`:return {bg:`0 0 0 / 0`,color:e,border:e};case `ghost`:return {bg:`0 0 0 / 0`,color:e,border:`0 0 0 / 0`};default:return {bg:e,color:i,border:e}}}resolveSecondaryButtonColors(e,i,o,l){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:l,color:e,border:e}:{bg:`0 0 0 / 0`,color:e,border:e};case `inverted`:return {bg:o,color:i,border:`0 0 0 / 0`};default:return this.buttons.secondary.style===`filled`?{bg:l,color:o,border:o}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Xe=class{apply(e){if(!e)return;le$4(new Ye(e).toCSSString());}};function Ni(){let t=he$4.get();!t.gaMeasurementID||!t.gaEnabled||hr();}async function gr(){let t=await ce$4.get(`gacid`),e=await br();if(t!==e)return await ce$4.set(`gacid`,e),e}async function hr(){let t=await gr();t&&zm({gaClientID:t});}async function br(){let e=he$4.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}var Bi=!!new URL(location.href).searchParams?.get(`new-brand`);async function Hi(t){(t?.enabled||Bi)&&new Xe().apply(t);}function wr(t){if(!t)return t;let e=t.match(/:root\s*\{/);if(!e)return t;let i=0,o=-1;for(let l=e.index;l<t.length;l++)if(t[l]===`{`)i++;else if(t[l]===`}`&&--i===0){o=l+1;break}return o===-1?t:(t.slice(0,e.index)+t.slice(o)).trimStart()}async function Ct(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=w.globalRef.config.update(t);Ni(),_.initialize(),e.website&&(Bi&&(e.website.commonCSS=wr(e.website.commonCSS)),Ui$2(e.website.commonJS),le$4(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$2(10)).subscribe(async({open:i})=>{Y$2.info(`Cart drawer is now`,i?`open`:`closed`),i&&(gh(),await vr());});}function $i(t){w.globalRef.apiURLs=t;}function zi(t){t?.length&&t.forEach(e=>{ze$1(e.name,e.template);});}async function vr(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};jn(new Ir$2(`View Cart`,{items:t.items,amount:e,drawer:true}));}var Ie=class{runtimeData=ke$1();meddle(){let e=w.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{wo();},e.loadExperiments=()=>{Ke();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(i,o)=>{new Ge$1(i).execute(o);},e.sendEvent=i=>{jn(i);};}overwritePush(e,i){zn$1(e,`push`,i);}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0]);}),w.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),w.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(Qr$3.includes(e[0])?w.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&w.updateProfile(e);}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0]);}),w.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.appID&&w.authenticate(e),e.currentItem&&yr(e.currentItem),e.currency&&(ke$1().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&Ct(e.configurations),e.storeSettings&&Ct(e.storeSettings),e.storeBrand&&Hi(e.storeBrand),e.apiURLs&&$i(e.apiURLs),e.widgetPartials&&zi(e.widgetPartials),e.customContext&&(this.runtimeData.customContext=r$2(r$2({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(ke$1().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=vd();if(e||(e=ke$1().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let i=new G({id:`preview`,shortID:`1`,redirectBehaviour:ae$4.CART_DRAWER});await new Ge$1(new Me(new Date,i)).execute({clickAction:{at:he$3.ADD_TO_CART},embeddedItem:new at$2({vID:e})});}};function yr(t){let e=ke$1();if(e.currentItem&&e.currentItem.vID!==t.vID){let i=new CustomEvent(`letscooee:variant-change`,{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(i);}e.currentItem=new at$2(t);}var le=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=`cooee`.concat(`-`);static getString(e,i){return this.getItem(e)||i}static setString(e,i){this.setItem(e,i);}static remove(e){this.removeItem(e);}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,i){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),i);}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e));}};var Er=1e3,Sr=10,Rt=0,It=new Date;function _t(t){le.remove(`sleid`),It=t??new Date;}function Ui(){if(window.scrollY){let t=Vi();Fi(t)&&Wi(t);}wt$2(()=>{xr();});}function xr(){Tr$1(window,`scroll`).pipe(Fe$2(Er),q$1(()=>{let t=Vi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(Fi(t))return t})).subscribe(t=>{Wi(t);});}function Fi(t){return Math.abs(Rt-t)>=Sr||Rt!==t&&t===100}function Wi(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-It.getTime()};Rt=t;let o=new Ir$2(`CE Scroll`,e,null,le.getString(`sleid`,``));jn(o),le.setString(`sleid`,o.id.toHexString()),It=new Date(o.occurred);}function Vi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function ji(){kr();}function kr(){let t=window.fetch;try{window.fetch=async function(e,i){try{await Cr(e,i);}catch(o){Fe$4(o,`modify-graphql-request`,{extra:{body:JSON.stringify(i?.body)}});}return t(e,i)};}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Buy Now Clicked" KPI.`),Y$2.error(e);}Y$2.verbose(`Securely overwritten window.fetch method for graphql query`);}async function Cr(t,e){let i=typeof t==`string`?t:t instanceof Request?t.url:``;if(!(i.includes(`graphql.json`)&&e?.method===`POST`)||!e.body)return;let o;if(typeof e.body==`string`)try{o=JSON.parse(e.body);}catch{return}else o=e.body;o?.variables?.input&&(Y$2.verbose(`Intercepted fetch request of:`,i),o?.query.includes(`cartCreate`)&&(e.body=await Rr(o),Ir()));}async function Rr(t){let e=t.variables.input.attributes??[],i=await jn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function Ir(){let t=ke$1().currentItem;if(!t)return;jn(new Ir$2(`Buy Now Clicked`,{items:[t]}));}var de=class{constructor(e,i){this.selectors=e;this.eventName=i;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let i=e.currentTarget;jn(new Ir$2(this.eventName,{class:i.className||void 0,tagName:i.tagName||void 0,id:i.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$2.error(e));}async listen(){this.elements=await Vr$4(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(i=>{i.removeEventListener(`click`,e);});}};var Je=class t extends de{static selectors=[`.product__thumbnail-list-inner > button`,`product-gallery-navigation > button`,`.product-media--thumb-container`,`.product-images-inner > img`,`.m-product-media`,`.swiper-button-control`,`.media__thumb`,`.slick-arrow`,`.productView-img-container.product-single__media`,`.product-gallery__thumbnail_item_inner`];constructor(){super(t.selectors,`Item Thumbnail Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ze=class t extends de{static selectors=[`.jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup`,`reviewsio-product-ratings`,`.ruk_rating_snippet.tracked:not(.hidden)`,`a > .loox-rating`,`.yotpo-reviews-star-ratings-widget`,`.yotpo.lp-hero__reviews`,`.pr-rating > a`,`.rivyoReviewWidget`];constructor(){super(t.selectors,`Review Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var _r=[`.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 qi(){wt$2(()=>{Y$2.verbose(`Execution order:`,`document ready`),Tr();});}function Tr(){let t=window.location.hash?.substring(1);if(t)if(t.includes(`initiate-checkout`)){document.dispatchEvent(new Event(`letscooee:outbound:third-party-initiate-checkout`));let e=document.querySelector(_r);if(!e){Y$2.verbose(`No clickable cart checkout button found`);return}Y$2.verbose(`Clickable cart checkout button found`,e),e.click();}else t.includes(`open-cart-drawer`)&&_.get().open();}function Gi(){window.addEventListener(`kp-modal:opened`,()=>{ke$1().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&to({goKwikToken:e});});}var w=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),gi(navigator.userAgent)){Y$2.info(`This seems to be a bot. Disabling SDK`);return}if(navigator.webdriver){Y$2.info(`This seems to be headless browser. Disabling SDK`);return}if(this.initGlobalReference(e),window.cooeeSDKPreview){new Ie().meddle();return}await aC(),this.autoAuthenticate(),new Ie().meddle(),Rm(),Ke(),Ar(),gC(),Xl(),ji(),qi(),Ui(),Ze.getInstance().listenSilently(),Je.getInstance().listenSilently(),Gi(),Pr(),to$1(),Qo(),Ne.remove(`conf`).catch(i=>{Y$2.error(`Fail to remove App Config from local storage`,i);});}static initGlobalReference(e){window.CooeeSDK||zn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,zn$1(this.globalRef,`config`,new he$4),zn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),zn$1(this.globalRef,`uaParser`,new P,true),zn$1(this.globalRef,`cart`,h.getCurrent()),zn$1(this.globalRef,`cartChange$`,Kl()),zn$1(this.globalRef,`cartDrawerToggle$`,_.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new P;});}static autoAuthenticate(){let e=Mn();e&&this.authenticate({shopifyShop:e});}static authenticate(e){if(this.authenticated)return;Y$2.info(`Begin auth after ⏰`,Rn(),`of SDK load`);let i=e.appID?.trim(),o=e.shopifyShop;if((kn(i)||i.length!==24)&&kn(o)){Y$2.warn(`Cooee App ID or Shop name is not configured`);return}this.authenticated=true,sC(e);}static sendEvent(e,i,o){let l=new Ir$2(e,i,o?.triggerData);o?.occurred&&(l.occurred=o.occurred),jn(l);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);to(e);}static setPageName(e){if(!e)return;let i=ke$1(),o=i.pageName;if(e===o)return;if(i.pageName=e,Xr$3.some(d=>e.includes(d))){_t();return}let l={};o&&(l.ps=o);let p=new Ir$2(`CE Screen View`,l);p.occurred=i.jsLoadTime,jn(p),_t(p.occurred);}static previewPopup(e,i){import('./renderer-XxQ20sXb-CoYiU0Ni.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){if(!e)return;let i=new G(e);i.isPageWidgets()?ut$1([i]).catch(console.error):i.isCartEmbed()?gt$1([i]).catch(console.error):Y$2.error(`Unsupported widget type for preview: `+i.onsiteDeliveryType);}};function Ar(){window.CooeeSDK.cartChange$.subscribe(()=>{wo();});}function Pr(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(t){Y$2.error(t);}window.addEventListener(`message`,t=>{if(Y$2.verbose(`Received event`,t),!t.origin.includes(`letscooee.com`)&&!t.origin.includes(`localhost`))return;let e=t.data;typeof e==`object`&&(e.action===`POPUP_PREVIEW`?(w.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(w.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var Ki=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Zn$1(),eo$1(),await w.initForMerchantWebsiteOnly(Ki),_e$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Mr$4()&&Promise.resolve().then(function () { return sdkDebugLogsB0eIx5Vz; }).then(({printAllDebugLogs:t})=>t(Ki)));
|
|
100
100
|
|
|
101
101
|
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$2.info(`\u{1F4E6} API Resource Metrics for ${i}: Not available`);return}Y$2.info(`📦 ═══════════ API Resource Metrics ═══════════`),Y$2.info(`URL: ${i}`),Y$2.info(`Duration: ${Ue$1(e.duration)}`);let n=e.transferSize===0;if(Y$2.info(`Served from: ${n?`💾 Cache (disk/memory)`:`🌐 Network`}`),!n){Y$2.info(`Transfer size: ${d(e.transferSize)}`),Y$2.info(`Encoded size: ${d(e.encodedBodySize)}`),Y$2.info(`Decoded size: ${d(e.decodedBodySize)}`);let c=(1-e.encodedBodySize/e.decodedBodySize)*100;c>0&&Y$2.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$2.info(`Timing breakdown (${Ue$1(e.duration)} total):`),r>0&&Y$2.info(`${s}Redirect: ${Ue$1(r)}`),f>0&&Y$2.info(`${s}Queued: ${Ue$1(f)}`),g>0&&Y$2.info(`${s}Stalled: ${Ue$1(g)}`),a>0&&Y$2.info(`${s}DNS lookup: ${Ue$1(a)}`),u>0&&Y$2.info(`${s}TCP connect: ${Ue$1(u)}`),m>0&&Y$2.info(`${s}SSL handshake: ${Ue$1(m)}`),Y$2.info(`${s}Server waiting (TTFB): ${Ue$1(T)}`),Y$2.info(`${s}Content download: ${Ue$1(P)}`);let $=e.serverTiming;if($?.length){Y$2.info(`Server-Timing:`);for(let c of $){let p=c.description||c.name;c.duration>0?Y$2.info(`${s}${p}: ${Ue$1(c.duration)}`):Y$2.info(`${s}${p}: ${c.duration}`);}}Y$2.info(`📦 ═════════════════════════════════════════════`);}function B(){let e=R();return e.length?e.map(n=>JSON.stringify(n.toJSON())).join(`
|
|
102
102
|
`):``}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});}
|
|
103
103
|
|
|
104
104
|
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();}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$2.info(`⏱️ ═══════════════ Performance Timing Report ═══════════════`),Y$2.info(`📅 Absolute Timestamps (Local Time):`),Y$2.info(` Note: Inline script can execute during HTML download (incremental parsing)`),Y$2.info(``),Y$2.info(` 1. Navigation started: ${a(d)}`);let r=f?f.getTime():0;if(n&&n>0&&r?r<n?(Y$2.info(` 2. Inline script executed: ${a(r)} (during HTML parsing)`),Y$2.info(` 3. HTML download complete: ${a(n)}`)):(Y$2.info(` 2. HTML download complete: ${a(n)}`),Y$2.info(` 3. Inline script executed: ${a(r)}`)):n&&n>0?Y$2.info(` 2. HTML download complete: ${a(n)}`):r&&Y$2.info(` 2. Inline script executed: ${a(r)}`),Y$2.info(` 4. SDK module loaded: ${a(i.getTime())} (from CDN)`),S&&Y$2.info(` 5. DOMContentLoaded: ${a(S)}`),$&&Y$2.info(` 6. Page fully loaded: ${a($)}`),Y$2.info(``),Y$2.info(`⏱️ Relative Timings:`),n&&n>0&&d){let g=n-d;Y$2.info(` Shopify backend + HTML download: ${Ue$1(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$2.info(` SDK module load time: ${Ue$1(K)} after ${b}`),Y$2.info(` (Note: Using earlier baseline because SDK loaded before ${T})`);}else Y$2.info(` SDK module load time: ${Ue$1(g)} after ${T}`),Y$2.info(` (Baseline: ${T} at ${a(u)})`);let v=i.getTime()-d;Y$2.info(` \u{1F3AF} Total SDK load time: ${Ue$1(v)} (from navigation start to SDK ready)`);}c&&c>0&&Y$2.info(` DOMContentLoaded: ${Ue$1(c)} after navigation start`),m&&m>0&&Y$2.info(` Page fully loaded: ${Ue$1(m)} after navigation start`),C(l),Y$2.info(`⏱️ ═══════════════════════════════════════════════════════`);}function C(i){if(!i){Y$2.info(``),Y$2.info(`📦 SDK Resource Metrics: Not available`);return}Y$2.info(``),Y$2.info(`📦 SDK Resource Metrics:`),Y$2.info(` URL: ${i.name}`),Y$2.info(` Download duration: ${Ue$1(i.duration)}`);let o=i.transferSize===0;if(Y$2.info(` Served from: ${o?`💾 Cache (disk/memory)`:`🌐 Network`}`),!o){Y$2.info(` Transfer size: ${d(i.transferSize)}`),Y$2.info(` Encoded size: ${d(i.encodedBodySize)}`),Y$2.info(` Decoded size: ${d(i.decodedBodySize)}`);let f=(1-i.encodedBodySize/i.decodedBodySize)*100;f>0&&Y$2.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$2.info(` Timing breakdown:`),f>0&&Y$2.info(` DNS lookup: ${Ue$1(f)}`),l>0&&Y$2.info(` TCP connect: ${Ue$1(l)}`),s>0&&Y$2.info(` Request: ${Ue$1(s)}`),n>0&&Y$2.info(` Response: ${Ue$1(n)}`);}}
|
|
105
105
|
|
|
106
|
-
var
|
|
106
|
+
var sdkDebugLogsB0eIx5Vz = /*#__PURE__*/Object.freeze({
|
|
107
107
|
__proto__: null,
|
|
108
108
|
printAllDebugLogs: x
|
|
109
109
|
});
|