@letscooee/web-sdk 14.2.13 → 14.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { B, M, H as Hn } from './main.min.js';
2
- import { U as Ub, o as of, a, b as bE, i as iD, V as Vo, w as wD, I as ID, H as Ho, M as Mf, u as uv, c as ud, _ as _D, g as ge, d as Iv, X as Xa, W as Wf, T as Tv, e as _f, f as _v, Y as Yg } from './widgets-Dv8l0Y8--lKEaTFu_.js';
2
+ import { U as Ub, o as of, a, b as bE, i as iD, V as Vo, w as wD, I as ID, H as Ho, M as Mf, u as uv, c as ud, _ as _D, g as ge, d as Iv, X as Xa, W as Wf, T as Tv, e as _f, f as _v, Y as Yg } from './widgets-CK6j6OOD-CGHrW6pQ.js';
3
3
 
4
4
  function P(i,t){if(i&1&&(Vo(0,`li`)(1,`span`,1),uv(2),Iv(3,`date`),Ho(),uv(4,`\xA0 `),Xa(5,`span`,2),Iv(6,`safeHtml`),Ho()),i&2){let e=t.$implicit;ud(2),Wf(Tv(3,2,e.time,`hh:mm:ss a`)),ud(3),_f(`innerHTML`,_v(6,5,e.message),Yg);}}var _=class i{logs=Ub.required();constructor(){}async shareLogs(){let t=this.logs().map(o=>`[${new Date(o.time).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`})}] ${o.message}`).join(`
5
5
  `);t=t.replaceAll(`\xA0`,` `);let e=B();if(e&&(t+=`
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$1=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$1(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$3=(a,b)=>{for(var c in b)g$1(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$1(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$1(c,`default`,{value:a,enumerable:true}):c,a));
2
2
 
3
- var lt$4=v$1((ft,Me)=>{(function(s){if(typeof ft==`object`&&typeof Me<`u`)Me.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,M){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;if(!M&&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),M=w.document.createTextNode(``);T.observe(M,{characterData:true}),b=function(){M.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`],M=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=M,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!==M)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 M(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=M([``]);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 M([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 xt(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 Nt(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 x=e(S,E.key,g++);x!==void 0?a(x):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function 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(x){c(x);}});}).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 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).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(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(N,V){var P=m.open(e.name,l);P.onerror=function(H){P.result.close(),V(H);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var H=P.result;H.close(),N(H);};}).then(function(N){d.db=N;for(var V=0;V<g.length;V++){var P=g[V];P._dbInfo.db=N,k(P._dbInfo);}}).catch(function(N){throw ($(e,N)||p.resolve()).catch(function(){}),N})}}):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(x,N){var V=m.deleteDatabase(e.name);V.onerror=function(){var P=V.result;P&&P.close(),N(V.error);},V.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},V.onsuccess=function(){var P=V.result;P&&P.close(),x(P);};}).then(function(x){l.db=x;for(var N=0;N<d.length;N++){var V=d[N];k(V._dbInfo);}}).catch(function(x){throw ($(e,x)||p.resolve()).catch(function(){}),x})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:At,_support:T(),iterate:Nt,getItem:xt,setItem:Lt,removeItem:Ot,clear:Pt,length:Mt,key:Vt,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 M([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 xe={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=xe,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 x=g.item(S),N=x.value;if(N&&(N=c.serializer.deserialize(N)),N=e(N,x.key,S+1),N!==void 0){a(N);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function 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(x,N){f(N);});},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(x){return new p(function(N,V){l.executeSql(`DROP TABLE IF EXISTS `+x,[],function(){N();},function(P,H){V(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(x){f(x);});},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=xe,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`],Ne=[`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=Ne.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var x=g[E];if((!vr(me,x)||t[x])&&typeof t[x]!=`function`){f(d);return}}var V=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));}};V();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(xe);return C(i,t),i},e.prototype.ready=function(t){var i=this,a=i._driverSet.then(function(){return i._ready===null&&(i._ready=i._initDriver()),i._ready});return C(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;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 x(){for(;S<E.length;){var N=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(N).then(l).catch(x)}f();var V=new Error(`No available storage method found.`);return o._driverSet=p.reject(V),o._driverSet}return x()}}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=Ne.length;t<i;t++)_r(this,Ne[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],M,p;for(p=1;p<m.length;p++)for(M in m[p])!(M in T)&&m[p].hasOwnProperty(M)&&(T[M]=m[p][M]);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={},M=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):M(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,_),M(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 Ve$3=x$3(lt$4());function ge$5(s){return Ve$3.default.createInstance({name:`lc`,storeName:s,driver:Ve$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$5(this.storeName);}};var Be$3=`14.2.13`;var Rr$3=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$3=parseInt(Rr$3,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$3=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$5(this.storeName);}};var gt$3=5,Cr$3=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$3(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$3(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$3;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??=xr$4(),ht$4}async function xr$4(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-pt51MXr0.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$3(h);if(u.setTag(`operation`,n),s instanceof ne$3){Nr$4(u,s,n);return}u.captureException(s);});}function vn$1(s,n,h){Et$3().then(()=>{_t$3(h).captureMessage(s,n??`error`);});}function Nr$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$3(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$1()),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$2(s)})`}function Ue$2(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$2(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$3.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$1;function bt$1(){if(Te$1)return Te$1;try{return Te$1=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$1}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 Mr$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 Mr$4(s,n,h)).item(0)}async function Vr$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 Vr$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,Me)=>{(function(s){if(typeof ft==`object`&&typeof Me<`u`)Me.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,M){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;if(!M&&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),M=w.document.createTextNode(``);T.observe(M,{characterData:true}),b=function(){M.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`],M=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=M,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!==M)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 M(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=M([``]);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 M([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 xt(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 Nt(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 x=e(S,E.key,g++);x!==void 0?a(x):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function 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(x){c(x);}});}).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 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).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(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(N,V){var P=m.open(e.name,l);P.onerror=function(H){P.result.close(),V(H);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var H=P.result;H.close(),N(H);};}).then(function(N){d.db=N;for(var V=0;V<g.length;V++){var P=g[V];P._dbInfo.db=N,k(P._dbInfo);}}).catch(function(N){throw ($(e,N)||p.resolve()).catch(function(){}),N})}}):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(x,N){var V=m.deleteDatabase(e.name);V.onerror=function(){var P=V.result;P&&P.close(),N(V.error);},V.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},V.onsuccess=function(){var P=V.result;P&&P.close(),x(P);};}).then(function(x){l.db=x;for(var N=0;N<d.length;N++){var V=d[N];k(V._dbInfo);}}).catch(function(x){throw ($(e,x)||p.resolve()).catch(function(){}),x})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:At,_support:T(),iterate:Nt,getItem:xt,setItem:Lt,removeItem:Ot,clear:Pt,length:Mt,key:Vt,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 M([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 xe={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=xe,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 x=g.item(S),N=x.value;if(N&&(N=c.serializer.deserialize(N)),N=e(N,x.key,S+1),N!==void 0){a(N);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function 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(x,N){f(N);});},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(x){return new p(function(N,V){l.executeSql(`DROP TABLE IF EXISTS `+x,[],function(){N();},function(P,H){V(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(x){f(x);});},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=xe,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`],Ne=[`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=Ne.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var x=g[E];if((!vr(me,x)||t[x])&&typeof t[x]!=`function`){f(d);return}}var V=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));}};V();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(xe);return C(i,t),i},e.prototype.ready=function(t){var i=this,a=i._driverSet.then(function(){return i._ready===null&&(i._ready=i._initDriver()),i._ready});return C(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;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 x(){for(;S<E.length;){var N=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(N).then(l).catch(x)}f();var V=new Error(`No available storage method found.`);return o._driverSet=p.reject(V),o._driverSet}return x()}}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=Ne.length;t<i;t++)_r(this,Ne[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],M,p;for(p=1;p<m.length;p++)for(M in m[p])!(M in T)&&m[p].hasOwnProperty(M)&&(T[M]=m[p][M]);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={},M=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):M(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,_),M(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 Ve$3=x$3(lt$4());function ge$5(s){return Ve$3.default.createInstance({name:`lc`,storeName:s,driver:Ve$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$5(this.storeName);}};var Be$3=`14.2.14`;var Rr$3=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$3=parseInt(Rr$3,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$3=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$5(this.storeName);}};var gt$3=5,Cr$3=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$3(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$3(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$3;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??=xr$4(),ht$4}async function xr$4(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-pt51MXr0.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$3(h);if(u.setTag(`operation`,n),s instanceof ne$3){Nr$4(u,s,n);return}u.captureException(s);});}function vn$1(s,n,h){Et$3().then(()=>{_t$3(h).captureMessage(s,n??`error`);});}function Nr$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$3(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$1()),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$2(s)})`}function Ue$2(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$2(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$3.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$1;function bt$1(){if(Te$1)return Te$1;try{return Te$1=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$1}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 Mr$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 Mr$4(s,n,h)).item(0)}async function Vr$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 Vr$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=`
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
@@ -81,7 +81,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {
81
81
  style="background-color: ${e.pagination.color?.rgba};">
82
82
  </span>
83
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 ar$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 ot=class extends w{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 B$3;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{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$2.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{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$1(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:l$1(ge$1,{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(),class:`lc-flexbox`,children:l$1(Ge$1,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var st$1=class st extends w{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 vi$1=new RegExp(`fill="#[a-zA-Z0-9]+"`),at$1=class at extends w{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(vi$1,`fill="#f1f1f1"`);}return i}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var ct$1=class ct extends w{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 rg=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Br=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 Ge$1=class Ge extends w{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,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===13){let t=e,n=this.props.item,o=Br(n.variantImage??n.firstImageURL),i=Br(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$1,{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(be$1,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):l$1(ge$1,{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 Ie$1=class Ie extends w{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){if(this.productElement=new de$1(We$3(this.props.element,this.getProductData(),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(Ge$1,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,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{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&&Mi$2().then(()=>{this.swiperInstance=sr$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:ar$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(Ie$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{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Mi$2().then(()=>{this.swiperInstance=sr$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 ar$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$1=class ge extends w{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$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?l$1(be$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(Ie$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{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he$2.GO_TO_URL&&!!Un$1(this.clickAction.gu?.u)||this.clickAction?.at===he$2.OPEN_CART||this.clickAction?.at===he$2.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$1,{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 Ue$1(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),Vi$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,Vi$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(e.content)),t.widget=new We$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?Se$1.delete(this):je$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 po(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(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$1(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 rr$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(!x$1.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 cr=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 lr$1=class lr 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 mr$1=class mr 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],v=u.reached,S=e.items.find(g=>(g.vID===d.vID||g.mID===d.mID)&&g.properties._letscooee_campaign===this.engagementTrigger.shortID);v&&(s=u,c=S),S&&n.push(S),!v&&S&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${S.vID} from cart`),i.push(S)):v&&!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 He$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]),x$1.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(n=>t.updates[n.key??n.vID]=n.quantity-1),Mr(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(v=>i[v.key??v.vID]=0),e.length&&e.forEach(v=>i[v.vID]=1);let s=n.coupons,c=[];if(s?.length){c=s.map(g=>g.couponCode);let v=h.getCurrent().discount_codes?.map(g=>g.code)??[];c.every(g=>v.some(E=>E===g))||(o.discount=c.join(`,`));}if(pe$4.hasKeys(i)&&(o.updates=i),!pe$4.hasKeys(o))return;let p=await Mr(o,this.engagementTrigger),u=p?.items,d=[];for(let v of e){let S=u?.find(g=>c?.length?g.id+``===v.vID&&g.discounts?.some(E=>c.includes(E.title)):g.id+``===v.vID);S&&d.push(S);}if(!d.length){x$1.get().refreshUI(p,false);return}try{await Promise.all(d.map(v=>lo(v,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(v){Fe$4(v,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{x$1.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 pr$1=class pr 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 dr$1=class dr 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 gr$1=class gr 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 qe$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$2.ADD_BUNDLE,applyDiscount:true}});}};var Vr=false,Wr=false,ur$1=null,fr$1=null,go=false,Se$1=new Set,je$1=new Set;function uo(){go||(go=true,wt$2(()=>{Hn(document.body,{childList:true,subtree:true},500,$n).subscribe(()=>{je$1.forEach(r=>r.rerenderIfDeleted()),Se$1.forEach(r=>r.rerenderIfDeleted());});}));}async function gt$1(r){if(r.length>0&&await Co(),uo(),Vr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),ur$1=r;return}Vr=true;try{Ei$1(r);}finally{if(Vr=false,ur$1){let e=ur$1;ur$1=null,Y$2.verbose(`Processing queued cart triggers`),gt$1(e);}}}async function ut$1(r){if(r.length>0&&await Co(),uo(),Wr){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),fr$1=r;return}Wr=true;try{wi$1(r);}finally{if(Wr=false,fr$1){let e=fr$1;fr$1=null,Y$2.verbose(`Processing queued page triggers`),ut$1(e).catch(console.error);}}}function sh(){Se$1.forEach(r=>r.rerenderAfterCartOpened());}function Ei$1(r){ho(Se$1,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=fo(Se$1,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 mr$1(e);else if(e.isSubscriptionUpsell()){cr.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new dt$1(e):n=new j$1(e);Se$1.add(n),n.renderSilently();}}function wi$1(r){ho(je$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=fo(je$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 pr$1(e):e.isBYOB()?n=new gr$1(e):e.isStickyATC()?n=new dr$1(e):e.isSavingsBar()?n=new dt$1(e):e.isCollectionFilter()?n=new lr$1(e):n=new M$2(e),je$1.add(n),n.renderSilently();}}function fo(r,e){for(let t of r)if(t.matches(e))return t}function ho(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 Co(){await(await import('./widgets-Dv8l0Y8--lKEaTFu_.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var vo=new U,yo=0;vo.pipe(Fe$2(50)).subscribe(async r=>{bi$1(await tt()).catch(t=>{Fe$4(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function Eo(r=false){le$2(z$2).then(()=>{vo.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function po(r){let e=await tt();return Object.assign(r,e),ie$1(`/v1/engagement/get-variant`,r)}async function bi$1(r$10){yo++,yo===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);if(Y$2.info(`Widgets fetched ${In$1(t.timeTakenMs)}`),t.data.pageWidgets?.length)ut$1(t.data.pageWidgets.map(o=>new G(o))).catch(console.error);if(t.data.cartWidgets?.length)gt$1(t.data.cartWidgets.map(o=>new G(o))).catch(console.error);}catch(t){Y$2.error(`Error sending widget getter`,t);}}var wo=x$3(dr$3()),hr$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 wo.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 $r={d:(r,e)=>{for(var t in e)$r.o(e,t)&&!$r.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Hr={};$r.d(Hr,{A:()=>Ii$1,k:()=>qr});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(v){v(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(v){d=[6,v],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 qr(){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,E=parseInt(`-1`);try{E.toFixed(E);}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 E,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 E=f.sent(),b=E,E instanceof Error&&(b=(g=E.message)!==null&&g!==void 0?g:E),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(E){switch(E.label){case 0:return ((g=navigator.storage)===null||g===void 0?void 0:g.getDirectory)===void 0?[3,2]:[4,p()];case 1:return E.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(R){var fe=R.target.result,D=function(vr){i(vr);};try{fe.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),D(!1);}catch(vr){(vr.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);})(),E.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(g,E){var b;i(Math.round(E/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 v(){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,E;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(E=g instanceof Error&&typeof g.message==`string`?g.message:String(g))!=`string`?(i(false),[2]):(i(E.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]:(E=navigator.userAgent,n=E.match(/Chrome/)?navigator.brave!==void 0?`Brave`:E.match(/Edg/)?`Edge`:E.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,v(),[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 E;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=qr);var Ii$1=qr,bo=Hr.A;Hr.k;var Io=x$3(St$3()),So=async()=>{let r={};try{return await Si$1(r)}catch(e){return Fe$4(e,`device-properties`),r}},Si$1=async r=>{let e=window.CooeeSDK.uaParser;Ti$1(r),Di$1(r),Pi$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:xi$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([Ai$1(r),Ri$1(r),Oi$1(r)]),r},Ti$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});},Pi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},xi$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},Ri$1=async r=>{try{await _i$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},_i$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());})},Ai$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{}},Oi$1=async r=>{try{(await bo())?.isPrivate&&(r.incognito=!0,_n({incognito:!0}));}catch(e){Io.default.error(`Unable to detect private/incognito window`,e);}};function Do(r){if(!Po())return;let e=Ne$3[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function Po(){return window.clarity&&typeof window.clarity==`function`}var z$2=new gr$2(1),Ro=`App ID or Shopify shop is not set`,Gr=``,ue=``,jr=``,Cr;async function Zh(r){Gr=r.appID,jr=r.shopifyShop;try{await Li$1(),z$2.next(!0),z$2.complete();}catch(e){e?.message?.includes(Ro)&&Fe$4(e,`initiate-session`,{extra:r}),Y$2.error(`Unable to initiate session`,e),z$2.error(e);}}async function so(){return await _o(false),Cr}async function eC(){let r=Date.now();await er.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),Oo(ue);}),Y$2.info(`Device ID set/get done ${In$1(Date.now()-r)}`);}async function xo(){if(Cr)return;let[r,e,t]=await Promise.all([ve$4.get(`id`,``),ce$4.get(`sessionNumber`,1),ve$4.get(`landing`,{})]);Ao(r,e,t);}async function Li$1(){await _o(true);}async function _o(r){let e=false;return await Ni$1()?(await ki$1(),e=true):await Ui$1()?(await xo(),e=true):await xo(),e?await Fi$1():r&&Eo(),e}async function ki$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=nr$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)]),Ao(e,t,n);}async function Ni$1(){let r=await ve$4.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Ui$1(){return !await ve$4.get(`synced`,false)}async function Mi$1(){if(!Gr&&!jr)throw new Error(Ro);let r$11=await So(),e=or$1();return s$3(r$2(r$2({deviceID:ue,deviceProps:r$11,appID:Gr,shopifyShop:jr},Cr),e),{sdk:qr$4,ad:hr$1.getAdParams(),occurred:Vi$1(ke$1().jsLoadTime),properties:{},uuid:await ce$4.get(`uuid`)})}async function Fi$1(){Y$2.info(`Ensuring session on server`),await Bi$1();let r=Date.now(),e=await Mi$1();Y$2.info(`Session data generated ${In$1(Date.now()-r)}`);try{let t=await ie$1(`/v1/event/validate-session`,e);if(Y$2.info(`Auth finished ${In$1(t.timeTakenMs)}`),await ve$4.set(`synced`,!0),t.data.deviceID&&(await ce$4.set(`did`,ue),Oo(t.data.deviceID)),t.data.pageWidgets?.length)ut$1(t.data.pageWidgets.map(o=>new G(o))).catch(console.error);if(t.data.cartWidgets?.length)gt$1(t.data.cartWidgets.map(o=>new G(o))).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function Bi$1(){let r=await ce$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$4.set(`firstSeen`,e.toISOString()),no(e),En$1(`Visitor Info`,{first_seen:e.toISOString()});}function Ao(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}`),Cr={sessionID:r,sessionNumber:e,landingPage:t};}function Oo(r){ro(r);En$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),yn({id:r});}function Vi$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function sC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Wi$1():document.visibilityState===`hidden`&&$i$1();};}async function Wi$1(){}async function $i$1(){let r=await Hi$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}ko(r);}async function Hi$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 Lo(){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 yr$1=class yr{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$1(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let n=this.getFormDetails(t);X(new Ir$1(`CE Form Submitted`,{form:n},this.triggerData)),eo(n);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),X(new Ir$1(`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 No(r){if(!qi$1()||!he$3.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 qi$1(){return window.fbq&&typeof window.fbq==`function`}var Ur=`/v1/event/track-page-unload`;function Gn(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 ko(r){le$2(z$2).then(()=>{Gi$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function Gi$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(Ur,t);}catch(n){throw Y$2.error(`Error sending page unload for ${e} to server`,n),n}}function X(r){ji$1(r);}async function ji$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),Qi$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}Wn();let e=await tt();Object.assign(r,e),Lo(),ve$4.set(`lastUsedTime`,new Date().getTime());let t=Ji$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),Ki$1(r)&&(ke$1().currentPageViewEvent={id:r.id,name:r.name}),Xi$1(r,o.data);}catch(o){throw Y$2.error(`Error sending event ${r.name} to server`,o),o}}function Ki$1(r){return Zr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Xi$1(r,e){zi$1(r,e).catch(t=>{Fe$4(t,`process-popup-response`,{extra:{event:r,response:e}});}),Yi$1(e);}async function zi$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 rr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}if(t.items=n,t.contentSource===me$3.KLAVIYO){new yr$1().render(t);return}new(await(import('./renderer-CZS8Aqtg-BMgVRtvd.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{Fe$4(i,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Yi$1(r){r.intent&&(Do(r.intent),No(r),Y$2.info(`Intent is ${Ne$3[r.intent]}`));}function Ji$1(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Qi$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}
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 rr$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(!x$1.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 cr=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 lr$1=class lr 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 mr$1=class mr 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],v=u.reached,S=e.items.find(g=>(g.vID===d.vID||g.mID===d.mID)&&g.properties._letscooee_campaign===this.engagementTrigger.shortID);v&&(s=u,c=S),S&&n.push(S),!v&&S&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${S.vID} from cart`),i.push(S)):v&&!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 He$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]),x$1.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(n=>t.updates[n.key??n.vID]=n.quantity-1),Mr(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(v=>i[v.key??v.vID]=0),e.length&&e.forEach(v=>i[v.vID]=1);let s=n.coupons,c=[];if(s?.length){c=s.map(g=>g.couponCode);let v=h.getCurrent().discount_codes?.map(g=>g.code)??[];c.every(g=>v.some(E=>E===g))||(o.discount=c.join(`,`));}if(pe$4.hasKeys(i)&&(o.updates=i),!pe$4.hasKeys(o))return;let p=await Mr(o,this.engagementTrigger),u=p?.items,d=[];for(let v of e){let S=u?.find(g=>c?.length?g.id+``===v.vID&&g.discounts?.some(E=>c.includes(E.title)):g.id+``===v.vID);S&&d.push(S);}if(!d.length){x$1.get().refreshUI(p,false);return}try{await Promise.all(d.map(v=>lo(v,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(v){Fe$4(v,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{x$1.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 pr$1=class pr 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 dr$1=class dr 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 gr$1=class gr 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 qe$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$2.ADD_BUNDLE,applyDiscount:true}});}};var Vr=false,Wr=false,ur$1=null,fr$1=null,go=false,Se$1=new Set,je$1=new Set;function uo(){go||(go=true,wt$2(()=>{Hn(document.body,{childList:true,subtree:true},500,$n).subscribe(()=>{je$1.forEach(r=>r.rerenderIfDeleted()),Se$1.forEach(r=>r.rerenderIfDeleted());});}));}async function gt$1(r){if(r.length>0&&await Co(),uo(),Vr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),ur$1=r;return}Vr=true;try{Ei$1(r);}finally{if(Vr=false,ur$1){let e=ur$1;ur$1=null,Y$2.verbose(`Processing queued cart triggers`),gt$1(e);}}}async function ut$1(r){if(r.length>0&&await Co(),uo(),Wr){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),fr$1=r;return}Wr=true;try{wi$1(r);}finally{if(Wr=false,fr$1){let e=fr$1;fr$1=null,Y$2.verbose(`Processing queued page triggers`),ut$1(e).catch(console.error);}}}function sh(){Se$1.forEach(r=>r.rerenderAfterCartOpened());}function Ei$1(r){ho(Se$1,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=fo(Se$1,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 mr$1(e);else if(e.isSubscriptionUpsell()){cr.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new dt$1(e):n=new j$1(e);Se$1.add(n),n.renderSilently();}}function wi$1(r){ho(je$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=fo(je$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 pr$1(e):e.isBYOB()?n=new gr$1(e):e.isStickyATC()?n=new dr$1(e):e.isSavingsBar()?n=new dt$1(e):e.isCollectionFilter()?n=new lr$1(e):n=new M$2(e),je$1.add(n),n.renderSilently();}}function fo(r,e){for(let t of r)if(t.matches(e))return t}function ho(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 Co(){await(await import('./widgets-CK6j6OOD-CGHrW6pQ.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var vo=new U,yo=0;vo.pipe(Fe$2(50)).subscribe(async r=>{bi$1(await tt()).catch(t=>{Fe$4(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function Eo(r=false){le$2(z$2).then(()=>{vo.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function po(r){let e=await tt();return Object.assign(r,e),ie$1(`/v1/engagement/get-variant`,r)}async function bi$1(r$10){yo++,yo===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 wo=x$3(dr$3()),hr$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 wo.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 $r={d:(r,e)=>{for(var t in e)$r.o(e,t)&&!$r.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Hr={};$r.d(Hr,{A:()=>Ii$1,k:()=>qr});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(v){v(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(v){d=[6,v],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 qr(){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,E=parseInt(`-1`);try{E.toFixed(E);}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 E,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 E=f.sent(),b=E,E instanceof Error&&(b=(g=E.message)!==null&&g!==void 0?g:E),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(E){switch(E.label){case 0:return ((g=navigator.storage)===null||g===void 0?void 0:g.getDirectory)===void 0?[3,2]:[4,p()];case 1:return E.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(R){var fe=R.target.result,D=function(vr){i(vr);};try{fe.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),D(!1);}catch(vr){(vr.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);})(),E.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(g,E){var b;i(Math.round(E/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 v(){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,E;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(E=g instanceof Error&&typeof g.message==`string`?g.message:String(g))!=`string`?(i(false),[2]):(i(E.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]:(E=navigator.userAgent,n=E.match(/Chrome/)?navigator.brave!==void 0?`Brave`:E.match(/Edg/)?`Edge`:E.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,v(),[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 E;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=qr);var Ii$1=qr,bo=Hr.A;Hr.k;var Io=x$3(St$3()),So=async()=>{let r={};try{return await Si$1(r)}catch(e){return Fe$4(e,`device-properties`),r}},Si$1=async r=>{let e=window.CooeeSDK.uaParser;Ti$1(r),Di$1(r),Pi$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:xi$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([Ai$1(r),Ri$1(r),Oi$1(r)]),r},Ti$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});},Pi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},xi$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},Ri$1=async r=>{try{await _i$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},_i$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());})},Ai$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{}},Oi$1=async r=>{try{(await bo())?.isPrivate&&(r.incognito=!0,_n({incognito:!0}));}catch(e){Io.default.error(`Unable to detect private/incognito window`,e);}};function Do(r){if(!Po())return;let e=Ne$3[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function Po(){return window.clarity&&typeof window.clarity==`function`}var z$2=new gr$2(1),Ro=`App ID or Shopify shop is not set`,Gr=``,ue=``,jr=``,Cr;async function Zh(r){Gr=r.appID,jr=r.shopifyShop;try{await Li$1(),z$2.next(!0),z$2.complete();}catch(e){e?.message?.includes(Ro)&&Fe$4(e,`initiate-session`,{extra:r}),Y$2.error(`Unable to initiate session`,e),z$2.error(e);}}async function so(){return await _o(false),Cr}async function eC(){let r=Date.now();await er.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),Oo(ue);}),Y$2.info(`Device ID set/get done ${In$1(Date.now()-r)}`);}async function xo(){if(Cr)return;let[r,e,t]=await Promise.all([ve$4.get(`id`,``),ce$4.get(`sessionNumber`,1),ve$4.get(`landing`,{})]);Ao(r,e,t);}async function Li$1(){await _o(true);}async function _o(r){let e=false;return await Ni$1()?(await ki$1(),e=true):await Ui$1()?(await xo(),e=true):await xo(),e?await Fi$1():r&&Eo(),e}async function ki$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=nr$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)]),Ao(e,t,n);}async function Ni$1(){let r=await ve$4.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Ui$1(){return !await ve$4.get(`synced`,false)}async function Mi$1(){if(!Gr&&!jr)throw new Error(Ro);let r$11=await So(),e=or$1();return s$3(r$2(r$2({deviceID:ue,deviceProps:r$11,appID:Gr,shopifyShop:jr},Cr),e),{sdk:qr$4,ad:hr$1.getAdParams(),occurred:Vi$1(ke$1().jsLoadTime),properties:{},uuid:await ce$4.get(`uuid`)})}async function Fi$1(){Y$2.info(`Ensuring session on server`),await Bi$1();let r=Date.now(),e=await Mi$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),Oo(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 Bi$1(){let r=await ce$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$4.set(`firstSeen`,e.toISOString()),no(e),En$1(`Visitor Info`,{first_seen:e.toISOString()});}function Ao(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}`),Cr={sessionID:r,sessionNumber:e,landingPage:t};}function Oo(r){ro(r);En$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),yn({id:r});}function Vi$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function sC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Wi$1():document.visibilityState===`hidden`&&$i$1();};}async function Wi$1(){}async function $i$1(){let r=await Hi$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}ko(r);}async function Hi$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 Lo(){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 yr$1=class yr{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$1(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let n=this.getFormDetails(t);X(new Ir$1(`CE Form Submitted`,{form:n},this.triggerData)),eo(n);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),X(new Ir$1(`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 No(r){if(!qi$1()||!he$3.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 qi$1(){return window.fbq&&typeof window.fbq==`function`}var Ur=`/v1/event/track-page-unload`;function Gn(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 ko(r){le$2(z$2).then(()=>{Gi$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function Gi$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(Ur,t);}catch(n){throw Y$2.error(`Error sending page unload for ${e} to server`,n),n}}function X(r){ji$1(r);}async function ji$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),Qi$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}Wn();let e=await tt();Object.assign(r,e),Lo(),ve$4.set(`lastUsedTime`,new Date().getTime());let t=Ji$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),Ki$1(r)&&(ke$1().currentPageViewEvent={id:r.id,name:r.name}),Xi$1(r,o.data);}catch(o){throw Y$2.error(`Error sending event ${r.name} to server`,o),o}}function Ki$1(r){return Zr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Xi$1(r,e){zi$1(r,e).catch(t=>{Fe$4(t,`process-popup-response`,{extra:{event:r,response:e}});}),Yi$1(e);}async function zi$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 rr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}if(t.items=n,t.contentSource===me$3.KLAVIYO){new yr$1().render(t);return}new(await(import('./renderer-CGdIupPE-BMgVRtvd.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{Fe$4(i,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Yi$1(r){r.intent&&(Do(r.intent),No(r),Y$2.info(`Intent is ${Ne$3[r.intent]}`));}function Ji$1(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Qi$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
 
@@ -90,14 +90,14 @@ var Me=class extends re$4{static storeName=`app`;static{this.storage=ge$5(this.s
90
90
  .lc-display-inline {display: inline !important;}`,document.body);}execute(e){for(let i of e){if(!i.experimentConfig)continue;this.executeExperiment(i)&&this.trackExperimentRan(i);}if(document.querySelector(`#lc-hide-body`)?.remove(),!document.body){vn$1(`No body element found`,`error`);return}this.setupMutationObserver();}executeExperiment(e){let i=e.experimentConfig?.modifications;if(!i?.length)return Y$2.log(`Nothing to experiment`,e.toString()),true;let o=false;for(let l of i){if(!l.cssSelector){Y$2.verbose(`No CSS Selector available`,e?.toString());continue}this.modifications.push(l);let p=Array.from(document.querySelectorAll(l.cssSelector));p?.length&&(this.executeSingleModification(l,p),o=true);}return o}executeSingleModification(e,i){if(i?.length)for(let o of i)Object.assign(o.style,e.style),e.display===`HIDE`?o.classList.add(`lc-hide`):e.display===`BLOCK`?o.classList.add(`lc-display-block`):e.display===`INLINE`&&o.classList.add(`lc-display-inline`),e.type===`TEXT`&&e.text?o.innerHTML=e.text:e.type===`IMAGE`&&this.updateImage(e,o),e.moveTo?.selector&&this.changePlacement(e,o).catch(console.error);}async changePlacement(e,i){let o=await Yn$1(e.moveTo.selector);if(o)switch(e.moveTo.position){case ce$3.BEFORE1:i.nextElementSibling!==o&&o.parentElement?.insertBefore(i,o);break;case ce$3.INSIDE_FIRST1:o.firstChild!==i&&o.insertBefore(i,o.firstChild);break;case ce$3.INSIDE_LAST1:o.lastChild!==i&&o.appendChild(i);break;case ce$3.AFTER1:default:i.previousElementSibling!==o&&o.parentElement?.insertBefore(i,o.nextSibling);}}trackExperimentRan(e){if(e.id===`preview`){Y$2.warn(`Skipping experiment attribution as its preview`,e.toString());return}Ti({name:`CE Experiment Start`,experiment:new mt$2(e)}).catch(i=>{Y$2.error(`Fail to track experiment`,i);});}setupMutationObserver(){new MutationObserver(i=>{i.forEach(o=>{o.addedNodes.forEach(l=>{l instanceof HTMLElement&&this.modifications.forEach(p=>{if(l.matches&&l.matches(p.cssSelector))Y$2.verbose(`1. Re-applying experiment`,p.toString()),this.executeSingleModification(p,[l]);else if(l.querySelectorAll){let d=Array.from(l.querySelectorAll(p.cssSelector));if(!d.length)return;Y$2.verbose(`2. Re-applying experiment`,p.toString()),this.executeSingleModification(p,d);}});});});}).observe(document.body,{childList:true,subtree:true});}updateImage(e,i){let o=e.image?.lg?.src,l=e.image?.sm?.src;!o&&!l||(i instanceof HTMLPictureElement?this.updatePictureElement({desktop:o,mobile:l},i):this.updateImageElement({desktop:o,mobile:l},i));}updateImageElement(e,i){M$4()&&e.mobile?(i.setAttribute(`src`,e.mobile),i.removeAttribute(`srcset`)):e.desktop&&(i.setAttribute(`src`,e.desktop),i.removeAttribute(`srcset`));}updatePictureElement(e,i){if(i.innerHTML=``,e.mobile){let l=document.createElement(`source`);l.srcset=e.mobile,l.media=`(max-width: 767px)`,i.append(l);}if(e.desktop){let l=document.createElement(`source`);l.srcset=e.desktop,l.media=`(min-width: 768px)`,i.append(l);}let o=document.createElement(`img`);o.src=e.desktop??e.mobile??``,i.append(o);}};async function Ti(t){let e=await tt();await ie$1(`/v1/event/experiment`,r$2(r$2({},t),e));}function Ge(){or().catch(t=>Fe$4(t,`fetch-experiments`));}async function or(){ke$1().activeExperiments&&(await le$2(z$2),await nr());}async function nr(){Y$2.info(`Fetch experiments after ⏰`,Rn()+` of SDK load`);ie$1(`/v1/engagement/experiments`,r$2({},await tt())).then(async i=>{Y$2.info(`Experiments fetched ${In$1(i.timeTakenMs)}`);let o=i.data.experiments.map(l=>new G(l));new qe().execute(o);}).catch(i=>{Y$2.error(`Error sending experiment getter`,i);});}function j(t){let e=t.replace(`#`,``),i,o,l;return e.length===3?(i=parseInt(e[0]+e[0],16),o=parseInt(e[1]+e[1],16),l=parseInt(e[2]+e[2],16)):(i=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),l=parseInt(e.slice(4,6),16)),`${i} ${o} ${l}`}var sr={sharp:`0px`,subtle:`4px`,rounded:`8px`,pill:`9999px`},ar={sharp:`0px`,subtle:`4px`,rounded:`8px`,pill:`12px`},Pi={compact:{xs:`3px`,sm:`6px`,md:`9px`,lg:`12px`,xl:`18px`},comfortable:{xs:`4px`,sm:`8px`,md:`12px`,lg:`16px`,xl:`24px`},spacious:{xs:`6px`,sm:`12px`,md:`18px`,lg:`24px`,xl:`36px`}},Ke=class{colors;body;heading;subheading;density;buttons;card;price;cssVarOverrides;enabled;constructor(e){e&&Object.assign(this,e);}toCSSString(){let e=[],i=j(this.colors.primary),o=j(this.colors.onPrimary),l=j(this.colors.surface),p=j(this.colors.textPrimary),d=j(this.colors.textSecondary),h=j(this.colors.sale??`#dc2626`);e.push(`--lc-primary-color: ${i}`),e.push(`--lc-card-bg-color: ${l}`),e.push(`--lc-text-color: ${p}`),e.push(`--lc-subheading-color: ${p}`),e.push(`--lc-item-cmp-price-color: ${d}`),e.push(`--lc-item-sale-price-color: ${h}`);let u=this.price.showSaleColor?h:p;if(e.push(`--lc-item-price-color: ${u}`),e.push(`--lc-item-cmp-price-display: ${this.price.showComparePrice?`block`:`none`}`),this.price.weight&&e.push(`--lc-item-price-weight: ${this.price.weight}`),e.push(`--lc-text-family: ${this.body.family}`),e.push(`--lc-text-size: ${this.body.size}px`),this.body.weight&&(e.push(`--lc-text-weight: ${this.body.weight}`),e.push(`--lc-item-text-weight: ${this.body.weight}`)),this.heading){let w=this.heading,me=w.color?j(w.color):p;e.push(`--lc-heading-color: ${me}`),w.family&&e.push(`--lc-heading-family: ${w.family}`),w.size&&e.push(`--lc-heading-size: ${w.size}px`),w.weight&&e.push(`--lc-heading-weight: ${w.weight}`),w.align&&e.push(`--lc-heading-align: ${w.align}`);}else e.push(`--lc-heading-color: ${p}`);if(this.subheading){let w=this.subheading,me=w.color?j(w.color):p;e.push(`--lc-subheading-color: ${me}`),w.family&&e.push(`--lc-subheading-family: ${w.family}`),w.size&&e.push(`--lc-subheading-size: ${w.size}px`),w.weight&&e.push(`--lc-subheading-weight: ${w.weight}`),w.align&&e.push(`--lc-subheading-align: ${w.align}`);}let v=sr[this.buttons?.shape??`rounded`]??`8px`,_=ar[this.card?.shape??`rounded`]??`8px`;e.push(`--lc-button-radius: ${v}`),e.push(`--lc-card-radius: ${_}`),e.push(`--lc-badge-radius: ${v}`);let E=Pi[this.density]??Pi.comfortable;e.push(`--lc-spacing-xs: ${E.xs}`),e.push(`--lc-spacing-sm: ${E.sm}`),e.push(`--lc-spacing-md: ${E.md}`),e.push(`--lc-spacing-lg: ${E.lg}`),e.push(`--lc-spacing-xl: ${E.xl}`);let q=this.buttons.family??this.body.family;e.push(`--lc-button-family: ${q}`),e.push(`--lc-primary-button-weight: ${this.buttons.weight}`),e.push(`--lc-secondary-button-weight: ${this.buttons.weight}`),e.push(`--lc-primary-button-transform: ${this.buttons.textTransform}`),e.push(`--lc-secondary-button-transform: ${this.buttons.textTransform}`),this.buttons.size&&e.push(`--lc-button-size: ${this.buttons.size}px`),this.buttons.letterSpacing&&e.push(`--lc-button-letter-spacing: ${this.buttons.letterSpacing}`);let{bg:X,color:_e,border:pe}=this.resolvePrimaryButtonColors(i,o);e.push(`--lc-primary-button-bg-color: ${X}`),e.push(`--lc-primary-button-color: ${_e}`),e.push(`--lc-primary-button-border-color: ${pe}`);let{bg:ue,color:Ze,border:G}=this.resolveSecondaryButtonColors(i,l,p);switch(e.push(`--lc-secondary-button-bg-color: ${ue}`),e.push(`--lc-secondary-button-color: ${Ze}`),e.push(`--lc-secondary-button-border-color: ${G}`),this.card.border){case `subtle`:e.push(`--lc-card-border-width: 1px`),e.push(`--lc-card-border-color: 0 0 0 / 0.06`);break;case `visible`:e.push(`--lc-card-border-width: 1px`),e.push(`--lc-card-border-color: 0 0 0 / 0.15`);break;default:e.push(`--lc-card-border-width: 0px`),e.push(`--lc-card-border-color: transparent`);}switch(this.card.shadow){case `subtle`:e.push(`--lc-card-shadow: 0 1px 3px rgba(0,0,0,0.08)`);break;case `medium`:e.push(`--lc-card-shadow: 0 2px 8px rgba(0,0,0,0.12)`);break;default:e.push(`--lc-card-shadow: none`);}if(e.push(`--lc-badge-bg: ${i}`),e.push(`--lc-badge-color: ${o}`),this.cssVarOverrides)for(let[w,me]of Object.entries(this.cssVarOverrides))e.push(`${w}: ${me}`);return `:root {
91
91
  ${e.map(w=>` ${w};`).join(`
92
92
  `)}
93
- }`}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){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:i,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:i,color:o,border:o}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Ye=class{apply(e){if(!e?.enabled)return;le$4(new Ke(e).toCSSString());}};function Di(){let t=he$3.get();!t.gaMeasurementID||!t.gaEnabled||dr();}async function lr(){let t=await ce$4.get(`gacid`),e=await pr();if(t!==e)return await ce$4.set(`gacid`,e),e}async function dr(){let t=await lr();t&&qm({gaClientID:t});}async function pr(){let e=he$3.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}async function Oi(t){new URL(location.href).searchParams?.get(`new-brand`)&&new Ye().apply(t);}async function St(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=b.globalRef.config.update(t);Di(),x$1.initialize(),e.website&&(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&&(sh(),await ur());});}function Li(t){b.globalRef.apiURLs=t;}async function ur(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};Gn(new Ir$1(`View Cart`,{items:t.items,amount:e,drawer:true}));}var Ie=class{runtimeData=ke$1();meddle(){let e=b.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=b.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{Eo();},e.loadExperiments=()=>{Ge();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=b.previewWidget.bind(b),e.previewPopup=b.previewPopup.bind(b),e.executeCTA=(i,o)=>{new qe$1(i).execute(o);},e.sendEvent=i=>{Gn(i);};}overwritePush(e,i){zn$1(e,`push`,i);}meddleEvents(){this.overwritePush(b.globalRef.events,(...e)=>{this.processEvent(e[0]);}),b.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(b.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),b.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(Qr$3.includes(e[0])?b.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):b.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&b.updateProfile(e);}meddlePage(){this.overwritePush(b.globalRef.page,(...e)=>{this.processPage(e[0]);}),b.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.appID&&b.authenticate(e),e.currentItem&&mr(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&&b.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&St(e.configurations),e.storeSettings&&St(e.storeSettings),e.storeBrand&&Oi(e.storeBrand),e.apiURLs&&Li(e.apiURLs),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=rg();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 qe$1(new Ue$1(new Date,i)).execute({clickAction:{at:he$2.ADD_TO_CART},embeddedItem:new at$2({vID:e})});}};function mr(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 fr=1e3,hr=10,kt=0,Ct=new Date;function Rt(t){le.remove(`sleid`),Ct=t??new Date;}function Mi(){if(window.scrollY){let t=Bi();Ni(t)&&Hi(t);}wt$2(()=>{gr();});}function gr(){Tr(window,`scroll`).pipe(Fe$2(fr),q$1(()=>{let t=Bi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(Ni(t))return t})).subscribe(t=>{Hi(t);});}function Ni(t){return Math.abs(kt-t)>=hr||kt!==t&&t===100}function Hi(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Ct.getTime()};kt=t;let o=new Ir$1(`CE Scroll`,e,null,le.getString(`sleid`,``));Gn(o),le.setString(`sleid`,o.id.toHexString()),Ct=new Date(o.occurred);}function Bi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Ui(){br();}function br(){let t=window.fetch;try{window.fetch=async function(e,i){try{await wr(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 wr(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 vr(o),yr()));}async function vr(t){let e=t.variables.input.attributes??[],i=await jn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function yr(){let t=ke$1().currentItem;if(!t)return;Gn(new Ir$1(`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;Gn(new Ir$1(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 Mr$4(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(i=>{i.removeEventListener(`click`,e);});}};var Xe=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 Je=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 Er=[`.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 $i(){wt$2(()=>{Y$2.verbose(`Execution order:`,`document ready`),xr();});}function xr(){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(Er);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`)&&x$1.get().open();}function zi(){window.addEventListener(`kp-modal:opened`,()=>{ke$1().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&eo({goKwikToken:e});});}var b=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),pi(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 eC(),this.autoAuthenticate(),new Ie().meddle(),Sm(),Ge(),Sr(),sC(),Hl(),Ui(),$i(),Mi(),Je.getInstance().listenSilently(),Xe.getInstance().listenSilently(),zi(),kr(),to$1(),Jo(),Me.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$3),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$`,$l()),zn$1(this.globalRef,`cartDrawerToggle$`,x$1.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new P;});}static autoAuthenticate(){let e=Un();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,Zh(e);}static sendEvent(e,i,o){let l=new Ir$1(e,i,o?.triggerData);o?.occurred&&(l.occurred=o.occurred),Gn(l);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);eo(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))){Rt();return}let l={};o&&(l.ps=o);let p=new Ir$1(`CE Screen View`,l);p.occurred=i.jsLoadTime,Gn(p),Rt(p.occurred);}static previewPopup(e,i){import('./renderer-CZS8Aqtg-BMgVRtvd.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){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 Sr(){window.CooeeSDK.cartChange$.subscribe(()=>{Eo();});}function kr(){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`?(b.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(b.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var Fi=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Zn$1(),eo$1(),await b.initForMerchantWebsiteOnly(Fi),_e$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Br$4()&&Promise.resolve().then(function () { return sdkDebugLogsDEc5dtO; }).then(({printAllDebugLogs:t})=>t(Fi)));
93
+ }`}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){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:i,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:i,color:o,border:o}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Ye=class{apply(e){if(!e?.enabled)return;le$4(new Ke(e).toCSSString());}};function Di(){let t=he$3.get();!t.gaMeasurementID||!t.gaEnabled||dr();}async function lr(){let t=await ce$4.get(`gacid`),e=await pr();if(t!==e)return await ce$4.set(`gacid`,e),e}async function dr(){let t=await lr();t&&qm({gaClientID:t});}async function pr(){let e=he$3.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}async function Oi(t){new URL(location.href).searchParams?.get(`new-brand`)&&new Ye().apply(t);}async function St(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=b.globalRef.config.update(t);Di(),x$1.initialize(),e.website&&(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&&(sh(),await ur());});}function Li(t){b.globalRef.apiURLs=t;}async function ur(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};Gn(new Ir$1(`View Cart`,{items:t.items,amount:e,drawer:true}));}var Ie=class{runtimeData=ke$1();meddle(){let e=b.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=b.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{Eo();},e.loadExperiments=()=>{Ge();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=b.previewWidget.bind(b),e.previewPopup=b.previewPopup.bind(b),e.executeCTA=(i,o)=>{new qe$1(i).execute(o);},e.sendEvent=i=>{Gn(i);};}overwritePush(e,i){zn$1(e,`push`,i);}meddleEvents(){this.overwritePush(b.globalRef.events,(...e)=>{this.processEvent(e[0]);}),b.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(b.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),b.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(Qr$3.includes(e[0])?b.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):b.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&b.updateProfile(e);}meddlePage(){this.overwritePush(b.globalRef.page,(...e)=>{this.processPage(e[0]);}),b.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.appID&&b.authenticate(e),e.currentItem&&mr(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&&b.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&St(e.configurations),e.storeSettings&&St(e.storeSettings),e.storeBrand&&Oi(e.storeBrand),e.apiURLs&&Li(e.apiURLs),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=rg();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 qe$1(new Ue$1(new Date,i)).execute({clickAction:{at:he$2.ADD_TO_CART},embeddedItem:new at$2({vID:e})});}};function mr(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 fr=1e3,hr=10,kt=0,Ct=new Date;function Rt(t){le.remove(`sleid`),Ct=t??new Date;}function Mi(){if(window.scrollY){let t=Bi();Ni(t)&&Hi(t);}wt$2(()=>{gr();});}function gr(){Tr(window,`scroll`).pipe(Fe$2(fr),q$1(()=>{let t=Bi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(Ni(t))return t})).subscribe(t=>{Hi(t);});}function Ni(t){return Math.abs(kt-t)>=hr||kt!==t&&t===100}function Hi(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Ct.getTime()};kt=t;let o=new Ir$1(`CE Scroll`,e,null,le.getString(`sleid`,``));Gn(o),le.setString(`sleid`,o.id.toHexString()),Ct=new Date(o.occurred);}function Bi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Ui(){br();}function br(){let t=window.fetch;try{window.fetch=async function(e,i){try{await wr(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 wr(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 vr(o),yr()));}async function vr(t){let e=t.variables.input.attributes??[],i=await jn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function yr(){let t=ke$1().currentItem;if(!t)return;Gn(new Ir$1(`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;Gn(new Ir$1(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 Mr$4(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(i=>{i.removeEventListener(`click`,e);});}};var Xe=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 Je=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 Er=[`.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 $i(){wt$2(()=>{Y$2.verbose(`Execution order:`,`document ready`),xr();});}function xr(){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(Er);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`)&&x$1.get().open();}function zi(){window.addEventListener(`kp-modal:opened`,()=>{ke$1().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&eo({goKwikToken:e});});}var b=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),pi(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 eC(),this.autoAuthenticate(),new Ie().meddle(),Sm(),Ge(),Sr(),sC(),Hl(),Ui(),$i(),Mi(),Je.getInstance().listenSilently(),Xe.getInstance().listenSilently(),zi(),kr(),to$1(),Jo(),Me.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$3),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$`,$l()),zn$1(this.globalRef,`cartDrawerToggle$`,x$1.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new P;});}static autoAuthenticate(){let e=Un();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,Zh(e);}static sendEvent(e,i,o){let l=new Ir$1(e,i,o?.triggerData);o?.occurred&&(l.occurred=o.occurred),Gn(l);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);eo(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))){Rt();return}let l={};o&&(l.ps=o);let p=new Ir$1(`CE Screen View`,l);p.occurred=i.jsLoadTime,Gn(p),Rt(p.occurred);}static previewPopup(e,i){import('./renderer-CGdIupPE-BMgVRtvd.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 Sr(){window.CooeeSDK.cartChange$.subscribe(()=>{Eo();});}function kr(){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`?(b.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(b.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var Fi=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Zn$1(),eo$1(),await b.initForMerchantWebsiteOnly(Fi),_e$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Br$4()&&Promise.resolve().then(function () { return sdkDebugLogsZZ23xVa; }).then(({printAllDebugLogs:t})=>t(Fi)));
94
94
 
95
95
  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$2(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$2(e.duration)} total):`),r>0&&Y$2.info(`${s}Redirect: ${Ue$2(r)}`),f>0&&Y$2.info(`${s}Queued: ${Ue$2(f)}`),g>0&&Y$2.info(`${s}Stalled: ${Ue$2(g)}`),a>0&&Y$2.info(`${s}DNS lookup: ${Ue$2(a)}`),u>0&&Y$2.info(`${s}TCP connect: ${Ue$2(u)}`),m>0&&Y$2.info(`${s}SSL handshake: ${Ue$2(m)}`),Y$2.info(`${s}Server waiting (TTFB): ${Ue$2(T)}`),Y$2.info(`${s}Content download: ${Ue$2(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$2(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(`
96
96
  `):``}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});}
97
97
 
98
98
  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$2(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$2(K)} after ${b}`),Y$2.info(` (Note: Using earlier baseline because SDK loaded before ${T})`);}else Y$2.info(` SDK module load time: ${Ue$2(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$2(v)} (from navigation start to SDK ready)`);}c&&c>0&&Y$2.info(` DOMContentLoaded: ${Ue$2(c)} after navigation start`),m&&m>0&&Y$2.info(` Page fully loaded: ${Ue$2(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$2(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$2(f)}`),l>0&&Y$2.info(` TCP connect: ${Ue$2(l)}`),s>0&&Y$2.info(` Request: ${Ue$2(s)}`),n>0&&Y$2.info(` Response: ${Ue$2(n)}`);}}
99
99
 
100
- var sdkDebugLogsDEc5dtO = /*#__PURE__*/Object.freeze({
100
+ var sdkDebugLogsZZ23xVa = /*#__PURE__*/Object.freeze({
101
101
  __proto__: null,
102
102
  printAllDebugLogs: x
103
103
  });
@@ -1,6 +1,6 @@
1
1
  import './main.min.js';
2
- import { h as g, j as W, G as Ge, K as Ke, o as of, y as ye, k as Ka, u as uv, J as Ja, S as Sf, D as Df } from './widgets-Dv8l0Y8--lKEaTFu_.js';
3
- import { l, f } from './video-detail-dialog.component-BDbkyOqu-BWBD8wTf.js';
2
+ import { h as g, j as W, G as Ge, K as Ke, o as of, y as ye, k as Ka, u as uv, J as Ja, S as Sf, D as Df } from './widgets-CK6j6OOD-CGHrW6pQ.js';
3
+ import { l, f } from './video-detail-dialog.component-BuBXjML_-D0PUVY5F.js';
4
4
 
5
5
  var _=class d{dialogRef=g(W);eventData=g(Ge);triggerData=g(Ke)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=l(this.triggerData,this.eventData.video,o!==`Clipboard`);switch(o){case `Whatsapp`:window.open(`https://wa.me/?text=${a}%20${t}`,`_blank`,`noopener,noreferrer`);break;case `X(Twitter)`:window.open(`https://x.com/intent/post?text=${a}&url=${t}`,`_blank`,`noopener,noreferrer`);break;case `Clipboard`:navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement(`textarea`);e.value=t,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e);});break;}o&&f(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close();}static ɵfac=function(o){return new(o||d)};static ɵcmp=of({type:d,selectors:[[`cooee-share-dialog`]],decls:19,vars:0,consts:[[1,`share-dialog`],[1,`share-dialog-header`],[`type`,`button`,`aria-label`,`Close`,1,`close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`],[1,`share-options`],[`type`,`button`,`aria-label`,`Share on WhatsApp`,1,`share-option`,3,`click`],[`name`,`whatsapp`,`aria-hidden`,`true`],[`type`,`button`,`aria-label`,`Share on X`,1,`share-option`,3,`click`],[`name`,`x-twitter`,`aria-hidden`,`true`],[`type`,`button`,`aria-label`,`Copy link`,1,`share-option`,3,`click`],[`name`,`copy`,`aria-hidden`,`true`]],template:function(o,t){o&1&&(Ka(0,`div`,0)(1,`div`,1)(2,`h3`),uv(3,`Share`),Ja(),Ka(4,`button`,2),Sf(`click`,function(e){return t.onShareAndClose(e)}),Df(5,`cooee-icon`,3),Ja()(),Ka(6,`div`,4)(7,`button`,5),Sf(`click`,function(e){return t.onShareAndClose(e,`Whatsapp`)}),Df(8,`cooee-icon`,6),Ka(9,`span`),uv(10,`Whatsapp`),Ja()(),Ka(11,`button`,7),Sf(`click`,function(e){return t.onShareAndClose(e,`X(Twitter)`)}),Df(12,`cooee-icon`,8),Ka(13,`span`),uv(14,`X`),Ja()(),Ka(15,`button`,9),Sf(`click`,function(e){return t.onShareAndClose(e,`Clipboard`)}),Df(16,`cooee-icon`,10),Ka(17,`span`),uv(18,`Copy link`),Ja()()()());},dependencies:[ye],styles:[`@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}`]})};
6
6
 
@@ -1,14 +1,14 @@
1
1
  import { I as Ir, V as Ve, a as He, s as se, M, t, w as wr, l as l$1, b as I, c as Hi, d as ce, Y, e as V } from './main.min.js';
2
- import { l as Mt, h as g, m as Ye, n as Se$1, G as Ge, j as W, o as of, L as Lt, N as Nt, B as Bt, p as TE, q as wE, r as jt, R as Rt, y as ye, k as Ka, S as Sf, s as ec, w as wD, $ as $o, J as Ja, t as lf, v as jD, x as yf, c as ud, _ as _D, z as nc, A as Rf, C as xf, E as $b, F as Ro, K as Ke, O as Ft, D as Df, U as Ub, P as Cs, V as Vo, X as Xa, H as Ho, Q as rc, Z as mf, a0 as ND, a1 as vD, a2 as fu, a3 as pu, a4 as kD, a5 as ED, a6 as Ef, a7 as gv, a8 as Zf, a9 as qf, aa as fv, ab as Sv, ac as Kg } from './widgets-Dv8l0Y8--lKEaTFu_.js';
2
+ import { l as Mt, h as g, m as Ye, n as Se$1, G as Ge, j as W, o as of, L as Lt, N as Nt, B as Bt, p as TE, q as wE, r as jt, R as Rt, y as ye, k as Ka, S as Sf, s as ec, w as wD, $ as $o, J as Ja, t as lf, v as jD, x as yf, c as ud, _ as _D, z as nc, A as Rf, C as xf, E as $b, F as Ro, K as Ke, O as Ft, D as Df, U as Ub, P as Cs, V as Vo, X as Xa, H as Ho, Q as rc, Z as mf, a0 as ND, a1 as vD, a2 as fu, a3 as pu, a4 as kD, a5 as ED, a6 as Ef, a7 as gv, a8 as Zf, a9 as qf, aa as fv, ab as Sv, ac as Kg } from './widgets-CK6j6OOD-CGHrW6pQ.js';
3
3
 
4
4
  var f=(t,e,o,r)=>{if(!e)return;let i=new Ir(`CE Video Shared`,{current:{videoID:e.id,videoIndex:o},platform:r},t);window.CooeeSDK.sendEvent(i);},l=(t,e,o=true)=>{let r=o?encodeURIComponent(m(t,e)):m(t,e),n=`Hey! Check out this video for an amazing product -`;return {url:r,text:o?encodeURIComponent(n):n}},m=(t,e)=>{return Ve(He(window.location.href,t),e)};
5
5
 
6
- var S=class n{video=Ub.required();progress=Mt(0);constructor(){Cs(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,i),t(()=>{e.removeEventListener(`timeupdate`,i);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-progress-bar`]],inputs:{video:[1,`video`]},decls:3,vars:3,consts:[[1,`video-untracked-path`],[`role`,`progressbar`,1,`video-tracked-path`]],template:function(e,i){e&1&&(Vo(0,`div`,0)(1,`div`,1),Xa(2,`div`),Ho()()),e&2&&(ud(),rc(`width`,i.progress(),`%`),mf(`aria-valuenow`,i.progress()));},styles:[`[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media(prefers-reduced-motion:reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}`]})};var P=class n{dialogState=$b();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(Ft);async share(t){t.stopPropagation(),t.preventDefault(),M()&&V()?await this.shareNative():await this.shareWithDialog();}async shareNative(){let t=l(this.triggerData,this.eventData.video,false);await navigator.share(t),f(this.triggerData,this.eventData.video,this.eventData.index,`Native`);}async shareWithDialog(){let t=await import('./share-dialog.component-C-N7cv4i-HS6m9q34.js');this.dialogState.emit(true),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(false));}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-share-button`]],outputs:{dialogState:`dialogState`},decls:2,vars:0,consts:[[`type`,`button`,`aria-label`,`Share video`,3,`click`],[`name`,`share`]],template:function(e,i){e&1&&(Ka(0,`button`,0),Sf(`click`,function(r){return i.share(r)}),Df(1,`cooee-icon`,1),Ja());},dependencies:[ye],styles:[`button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}`]})};var Te=[`swiperComp`],Ie=[`videoEl`],Se=(n,t)=>t.video.id,Pe=(n,t)=>t.url;function ke(n,t){n&1&&(Ka(0,`div`,11),Df(1,`div`,15),Ja());}function Me(n,t){if(n&1&&Df(0,`source`,13),n&2){let e=t.$implicit;yf(`type`,gv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&Ef(0);}function Ne(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,24),Sf(`cardClick`,function(o){fu(e);let r=kD(2).$implicit;return pu(kD().productCardClicked(o,r.video))}),Ja();}if(n&2){let e=kD(2).$implicit;yf(`items`,e.video.items);}}function ze(n,t){if(n&1&&Df(0,`cooee-video-card`,23),n&2){let e=kD(2).$implicit;yf(`card`,e.video.card);}}function Fe(n,t){if(n&1){let e=ND();Df(0,`cooee-video-progress-bar`,16),Ka(1,`div`,17)(2,`cooee-mute-toggle`,18),Zf(`mutedChange`,function(o){fu(e);let r=kD(2);return fv(r.muted,o)||(r.muted=o),pu(o)}),Sf(`toggled`,function(){fu(e);return pu(kD(2).muteToggled())}),Ja(),lf(3,Oe,1,0,`ng-container`,8),Ja(),Ka(4,`div`,19)(5,`cooee-share-button`,20),Sf(`dialogState`,function(o){fu(e);return pu(kD(2).shareDialogOpen.set(o))}),Ja()(),Ka(6,`div`,21),vD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,ze,1,1,`cooee-video-card`,23),Ja();}if(n&2){let e=kD().$implicit,i=jD(5),o=kD(),r=jD(9);yf(`video`,i),ud(2),qf(`muted`,o.muted),yf(`videoEl`,i),ud(),yf(`ngTemplateOutlet`,r),ud(4),ED(e.video.items.length&&o.videoConfig.showItems()?7:e.video.card&&o.videoConfig.footerContent===o.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-detail`,25),Sf(`closeClick`,function(){fu(e);return pu(kD(2).productModalClosed())}),Ja();}if(n&2){let e=kD(2);yf(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Re(n,t){if(n&1){let e=ND();Ka(0,`div`,6)(1,`div`,9)(2,`div`,10),vD(3,ke,2,0,`div`,11),Ka(4,`video`,12,2),Sf(`click`,function(){let o=fu(e).$index,r=kD();return pu(r.currentIndex===o&&r.toggleMute())})(`ended`,function(){fu(e);let o=jD(5);return pu(kD().onVideoEnded(o))})(`loadstart`,function(){let o=fu(e).$index;return pu(kD().onVideoLoadStart(o))})(`canplay`,function(){let o=fu(e).$index;return pu(kD().onVideoCanPlay(o))}),wD(6,Me,1,3,`source`,13,Pe),Ja(),vD(8,Fe,9,5),Ja(),vD(9,Le,1,3,`cooee-item-detail`,14),Ja()();}if(n&2){let e=t.$implicit,i=t.$index,o=kD();ud(2),rc(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),ud(),ED(o.shouldShowVideoSpinner(i)?3:-1),ud(),yf(`ngClass`,o.viewTemplateClassName)(`muted`,true),mf(`preload`,o.isVideoVisible(i)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),ud(2),_D(e.video.sources),ud(2),ED(o.currentIndex===i?8:-1),ud(),ED(o.selectedItem&&o.currentIndex===i?9:-1);}}function Ae(n,t){n&1&&Ef(0);}function Be(n,t){if(n&1){let e=ND();Ka(0,`button`,26),Sf(`click`,function(){fu(e);return pu(kD().close())}),Df(1,`cooee-icon`,27),Ja();}}var Ee=class n{swiperComponent;videoElements;VideoConfigFooterContent=se;currentIndex=0;muted=Mt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=Mt(false);data=g(Ye);elementRef=g(Se$1);eventData=g(Ge);dialogRef=g(W);swiperInitialized=Mt(false);swiperOptions=Mt(null);videoEntries=[];videoConfig;triggerContext;engagementTrigger;isMobile=M();navigationConfig;cssLoadedPromise;resizeDebouncer=new t(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videoEntries=this.data.videoEntries,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videoEntries[this.currentIndex]?.video,this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new wr,this.navigationConfig=new l$1({enabled:true,size:50,color:new I({h:`#000000`})}),this.cssLoadedPromise=Hi(this.elementRef.nativeElement.shadowRoot);}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close();}async ngOnInit(){switch(this.muted.set(await ce.get(`muted`,false)),this.videoConfig.detailPopup.template){case `PRODUCT_DETAIL_VIEW`:this.selectItemForDetailView(),this.viewTemplateClassName=`lc-product-detail-view`;break;case `VIDEO_ONLY_VIEW`:this.viewTemplateClassName=`lc-video-only-view`;break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions();}ngOnDestroy(){this.resizeDebouncer?.destroy();}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(false);}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videoEntries[this.currentIndex].video,lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime});}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1);}productModalClosed(){this.selectedItem=null;}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause());}toggleMute(){this.muted.update(t=>!t);}async muteToggled(){await ce.set(`muted`,this.muted());let e=[this.muted()?`CE Video Muted`:`CE Video Unmuted`,{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e);}playActiveVideo(t=true){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e);}playVideo(t){t.currentTime=0,t.play().catch(e=>Y.error(e));}onVideoEnded(t){if(this.currentIndex<this.videoEntries.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else {let i=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t);}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videoEntries[this.currentIndex].video,this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let r=new Ir(`CE Video Changed`,{previous:e,current:this.currentVideoProps()},this.engagementTrigger);r.setVideos(this.videoEntries[this.currentIndex].video),window.CooeeSDK.sendEvent(r);}productCardClicked(t,e){let o=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t;}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===true&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:`auto`,e=0;this.isProductDetailView()&&(t=`auto`,e=10),this.swiperOptions.set({direction:this.isMobile?`vertical`:`horizontal`,effect:this.isMobile?`slide`:`coverflow`,slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:true,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:false},on:{init:i=>{this.swiperInitialized.set(true),setTimeout(()=>{i.update();},100);}},mousewheel:{enabled:!this.isMobile,invert:false,thresholdDelta:20}});}isProductDetailView(){return this.videoConfig.detailPopup.template===`PRODUCT_DETAIL_VIEW`}currentVideoProps(){return {videoID:this.videoEntries[this.currentIndex].video.id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null;}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height);}calculateOptimalVideoDimensions(){let t=this.videoEntries.map(u=>u.video.sources?.[0]).filter(u=>u?.width&&u?.height).map(u=>({width:u.width,height:u.height,aspectRatio:u.width/u.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,k=o/e.height,A=Math.min(r,k);return {width:Math.floor(e.width*A),height:Math.floor(e.height*A)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty(`--video-container-width`,`${t}px`),i.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,i){if(e&1&&nc(Te,7)(Ie,5),e&2){let o;Rf(o=xf())&&(i.swiperComponent=o.first),Rf(o=xf())&&(i.videoElements=o);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,i){e&1&&Sf(`keydown.escape`,function(r){return i.onKeyDown(r)},Kg);},decls:10,vars:4,consts:[[`swiperComp`,``],[`closeButtonTemplate`,``],[`videoEl`,``],[1,`lc-shadow-inner`,3,`ngClass`],[1,`video-swiper`,3,`slideChange`,`options`,`navigationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-slide`],[1,`lc-desktop-controls`],[4,`ngTemplateOutlet`],[1,`lc-video-modal-row`],[1,`lc-video-container`],[1,`video-loading-overlay`],[`playsinline`,``,1,`lc-video-el`,3,`click`,`ended`,`loadstart`,`canplay`,`ngClass`,`muted`],[3,`src`,`type`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`item`,`similarItems`,`template`],[1,`loading-spinner`],[3,`video`],[1,`lc-video-controls`],[3,`mutedChange`,`toggled`,`muted`,`videoEl`],[1,`share-controls`],[3,`dialogState`],[1,`lc-card-container`],[3,`items`],[3,`card`],[3,`cardClick`,`items`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`item`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,i){if(e&1&&(Ka(0,`div`,3)(1,`cooee-swiper`,4,0),Sf(`slideChange`,function(r){return i.onSlideChange(r)}),ec(3,5),wD(4,Re,10,10,`div`,6,Se),$o(),Ja(),Ka(6,`div`,7),lf(7,Ae,1,0,`ng-container`,8),Ja()(),lf(8,Be,2,0,`ng-template`,null,1,Sv)),e&2){let o=jD(9);yf(`ngClass`,i.viewTemplateClassName),ud(),yf(`options`,i.swiperOptions())(`navigationConfig`,i.navigationConfig),ud(3),_D(i.videoEntries),ud(3),yf(`ngTemplateOutlet`,o);}},dependencies:[Lt,Nt,Bt,P,S,TE,wE,jt,Rt,ye],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media(min-width:768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media(min-width:768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%;pointer-events:none}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media(max-width:768px){.video-swiper>.swiper-button-prev{display:none!important}}@media(max-width:768px){.video-swiper>.swiper-button-next{display:var(--lc-next-video-button-display)!important;width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent);color:#fff;inset:auto auto 12px 50%;transform:translate(-50%) rotate(90deg)}.video-swiper>.swiper-button-next:after{color:#fff;font-weight:900}}.video-swiper:has(cooee-item-detail)>.swiper-button-next{display:none!important}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden;pointer-events:auto}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media(min-width:768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media(max-width:768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media(min-width:768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media(min-width:768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media(max-width:768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media(min-width:768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media(min-width:768px){.lc-product-detail-view .lc-video-container{width:50%}}@media(min-width:768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media(max-width:768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media(max-width:768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
6
+ var S=class n{video=Ub.required();progress=Mt(0);constructor(){Cs(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,i),t(()=>{e.removeEventListener(`timeupdate`,i);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-progress-bar`]],inputs:{video:[1,`video`]},decls:3,vars:3,consts:[[1,`video-untracked-path`],[`role`,`progressbar`,1,`video-tracked-path`]],template:function(e,i){e&1&&(Vo(0,`div`,0)(1,`div`,1),Xa(2,`div`),Ho()()),e&2&&(ud(),rc(`width`,i.progress(),`%`),mf(`aria-valuenow`,i.progress()));},styles:[`[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media(prefers-reduced-motion:reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}`]})};var P=class n{dialogState=$b();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(Ft);async share(t){t.stopPropagation(),t.preventDefault(),M()&&V()?await this.shareNative():await this.shareWithDialog();}async shareNative(){let t=l(this.triggerData,this.eventData.video,false);await navigator.share(t),f(this.triggerData,this.eventData.video,this.eventData.index,`Native`);}async shareWithDialog(){let t=await import('./share-dialog.component-B8GNomNd-CqFy957y.js');this.dialogState.emit(true),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(false));}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-share-button`]],outputs:{dialogState:`dialogState`},decls:2,vars:0,consts:[[`type`,`button`,`aria-label`,`Share video`,3,`click`],[`name`,`share`]],template:function(e,i){e&1&&(Ka(0,`button`,0),Sf(`click`,function(r){return i.share(r)}),Df(1,`cooee-icon`,1),Ja());},dependencies:[ye],styles:[`button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}`]})};var Te=[`swiperComp`],Ie=[`videoEl`],Se=(n,t)=>t.video.id,Pe=(n,t)=>t.url;function ke(n,t){n&1&&(Ka(0,`div`,11),Df(1,`div`,15),Ja());}function Me(n,t){if(n&1&&Df(0,`source`,13),n&2){let e=t.$implicit;yf(`type`,gv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&Ef(0);}function Ne(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,24),Sf(`cardClick`,function(o){fu(e);let r=kD(2).$implicit;return pu(kD().productCardClicked(o,r.video))}),Ja();}if(n&2){let e=kD(2).$implicit;yf(`items`,e.video.items);}}function ze(n,t){if(n&1&&Df(0,`cooee-video-card`,23),n&2){let e=kD(2).$implicit;yf(`card`,e.video.card);}}function Fe(n,t){if(n&1){let e=ND();Df(0,`cooee-video-progress-bar`,16),Ka(1,`div`,17)(2,`cooee-mute-toggle`,18),Zf(`mutedChange`,function(o){fu(e);let r=kD(2);return fv(r.muted,o)||(r.muted=o),pu(o)}),Sf(`toggled`,function(){fu(e);return pu(kD(2).muteToggled())}),Ja(),lf(3,Oe,1,0,`ng-container`,8),Ja(),Ka(4,`div`,19)(5,`cooee-share-button`,20),Sf(`dialogState`,function(o){fu(e);return pu(kD(2).shareDialogOpen.set(o))}),Ja()(),Ka(6,`div`,21),vD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,ze,1,1,`cooee-video-card`,23),Ja();}if(n&2){let e=kD().$implicit,i=jD(5),o=kD(),r=jD(9);yf(`video`,i),ud(2),qf(`muted`,o.muted),yf(`videoEl`,i),ud(),yf(`ngTemplateOutlet`,r),ud(4),ED(e.video.items.length&&o.videoConfig.showItems()?7:e.video.card&&o.videoConfig.footerContent===o.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-detail`,25),Sf(`closeClick`,function(){fu(e);return pu(kD(2).productModalClosed())}),Ja();}if(n&2){let e=kD(2);yf(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Re(n,t){if(n&1){let e=ND();Ka(0,`div`,6)(1,`div`,9)(2,`div`,10),vD(3,ke,2,0,`div`,11),Ka(4,`video`,12,2),Sf(`click`,function(){let o=fu(e).$index,r=kD();return pu(r.currentIndex===o&&r.toggleMute())})(`ended`,function(){fu(e);let o=jD(5);return pu(kD().onVideoEnded(o))})(`loadstart`,function(){let o=fu(e).$index;return pu(kD().onVideoLoadStart(o))})(`canplay`,function(){let o=fu(e).$index;return pu(kD().onVideoCanPlay(o))}),wD(6,Me,1,3,`source`,13,Pe),Ja(),vD(8,Fe,9,5),Ja(),vD(9,Le,1,3,`cooee-item-detail`,14),Ja()();}if(n&2){let e=t.$implicit,i=t.$index,o=kD();ud(2),rc(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),ud(),ED(o.shouldShowVideoSpinner(i)?3:-1),ud(),yf(`ngClass`,o.viewTemplateClassName)(`muted`,true),mf(`preload`,o.isVideoVisible(i)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),ud(2),_D(e.video.sources),ud(2),ED(o.currentIndex===i?8:-1),ud(),ED(o.selectedItem&&o.currentIndex===i?9:-1);}}function Ae(n,t){n&1&&Ef(0);}function Be(n,t){if(n&1){let e=ND();Ka(0,`button`,26),Sf(`click`,function(){fu(e);return pu(kD().close())}),Df(1,`cooee-icon`,27),Ja();}}var Ee=class n{swiperComponent;videoElements;VideoConfigFooterContent=se;currentIndex=0;muted=Mt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=Mt(false);data=g(Ye);elementRef=g(Se$1);eventData=g(Ge);dialogRef=g(W);swiperInitialized=Mt(false);swiperOptions=Mt(null);videoEntries=[];videoConfig;triggerContext;engagementTrigger;isMobile=M();navigationConfig;cssLoadedPromise;resizeDebouncer=new t(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videoEntries=this.data.videoEntries,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videoEntries[this.currentIndex]?.video,this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new wr,this.navigationConfig=new l$1({enabled:true,size:50,color:new I({h:`#000000`})}),this.cssLoadedPromise=Hi(this.elementRef.nativeElement.shadowRoot);}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close();}async ngOnInit(){switch(this.muted.set(await ce.get(`muted`,false)),this.videoConfig.detailPopup.template){case `PRODUCT_DETAIL_VIEW`:this.selectItemForDetailView(),this.viewTemplateClassName=`lc-product-detail-view`;break;case `VIDEO_ONLY_VIEW`:this.viewTemplateClassName=`lc-video-only-view`;break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions();}ngOnDestroy(){this.resizeDebouncer?.destroy();}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(false);}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videoEntries[this.currentIndex].video,lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime});}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1);}productModalClosed(){this.selectedItem=null;}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause());}toggleMute(){this.muted.update(t=>!t);}async muteToggled(){await ce.set(`muted`,this.muted());let e=[this.muted()?`CE Video Muted`:`CE Video Unmuted`,{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e);}playActiveVideo(t=true){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e);}playVideo(t){t.currentTime=0,t.play().catch(e=>Y.error(e));}onVideoEnded(t){if(this.currentIndex<this.videoEntries.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else {let i=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t);}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videoEntries[this.currentIndex].video,this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let r=new Ir(`CE Video Changed`,{previous:e,current:this.currentVideoProps()},this.engagementTrigger);r.setVideos(this.videoEntries[this.currentIndex].video),window.CooeeSDK.sendEvent(r);}productCardClicked(t,e){let o=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t;}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===true&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:`auto`,e=0;this.isProductDetailView()&&(t=`auto`,e=10),this.swiperOptions.set({direction:this.isMobile?`vertical`:`horizontal`,effect:this.isMobile?`slide`:`coverflow`,slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:true,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:false},on:{init:i=>{this.swiperInitialized.set(true),setTimeout(()=>{i.update();},100);}},mousewheel:{enabled:!this.isMobile,invert:false,thresholdDelta:20}});}isProductDetailView(){return this.videoConfig.detailPopup.template===`PRODUCT_DETAIL_VIEW`}currentVideoProps(){return {videoID:this.videoEntries[this.currentIndex].video.id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null;}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height);}calculateOptimalVideoDimensions(){let t=this.videoEntries.map(u=>u.video.sources?.[0]).filter(u=>u?.width&&u?.height).map(u=>({width:u.width,height:u.height,aspectRatio:u.width/u.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,k=o/e.height,A=Math.min(r,k);return {width:Math.floor(e.width*A),height:Math.floor(e.height*A)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty(`--video-container-width`,`${t}px`),i.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,i){if(e&1&&nc(Te,7)(Ie,5),e&2){let o;Rf(o=xf())&&(i.swiperComponent=o.first),Rf(o=xf())&&(i.videoElements=o);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,i){e&1&&Sf(`keydown.escape`,function(r){return i.onKeyDown(r)},Kg);},decls:10,vars:4,consts:[[`swiperComp`,``],[`closeButtonTemplate`,``],[`videoEl`,``],[1,`lc-shadow-inner`,3,`ngClass`],[1,`video-swiper`,3,`slideChange`,`options`,`navigationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-slide`],[1,`lc-desktop-controls`],[4,`ngTemplateOutlet`],[1,`lc-video-modal-row`],[1,`lc-video-container`],[1,`video-loading-overlay`],[`playsinline`,``,1,`lc-video-el`,3,`click`,`ended`,`loadstart`,`canplay`,`ngClass`,`muted`],[3,`src`,`type`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`item`,`similarItems`,`template`],[1,`loading-spinner`],[3,`video`],[1,`lc-video-controls`],[3,`mutedChange`,`toggled`,`muted`,`videoEl`],[1,`share-controls`],[3,`dialogState`],[1,`lc-card-container`],[3,`items`],[3,`card`],[3,`cardClick`,`items`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`item`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,i){if(e&1&&(Ka(0,`div`,3)(1,`cooee-swiper`,4,0),Sf(`slideChange`,function(r){return i.onSlideChange(r)}),ec(3,5),wD(4,Re,10,10,`div`,6,Se),$o(),Ja(),Ka(6,`div`,7),lf(7,Ae,1,0,`ng-container`,8),Ja()(),lf(8,Be,2,0,`ng-template`,null,1,Sv)),e&2){let o=jD(9);yf(`ngClass`,i.viewTemplateClassName),ud(),yf(`options`,i.swiperOptions())(`navigationConfig`,i.navigationConfig),ud(3),_D(i.videoEntries),ud(3),yf(`ngTemplateOutlet`,o);}},dependencies:[Lt,Nt,Bt,P,S,TE,wE,jt,Rt,ye],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media(min-width:768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media(min-width:768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%;pointer-events:none}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media(max-width:768px){.video-swiper>.swiper-button-prev{display:none!important}}@media(max-width:768px){.video-swiper>.swiper-button-next{display:var(--lc-next-video-button-display)!important;width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent);color:#fff;inset:auto auto 12px 50%;transform:translate(-50%) rotate(90deg)}.video-swiper>.swiper-button-next:after{color:#fff;font-weight:900}}.video-swiper:has(cooee-item-detail)>.swiper-button-next{display:none!important}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden;pointer-events:auto}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media(min-width:768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media(max-width:768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media(min-width:768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media(min-width:768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media(max-width:768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media(min-width:768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media(min-width:768px){.lc-product-detail-view .lc-video-container{width:50%}}@media(min-width:768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media(max-width:768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media(max-width:768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
7
7
  `],encapsulation:3})};
8
8
 
9
- var videoDetailDialog_componentBDbkyOqu = /*#__PURE__*/Object.freeze({
9
+ var videoDetailDialog_componentBuBXjML_ = /*#__PURE__*/Object.freeze({
10
10
  __proto__: null,
11
11
  VideoDetailDialogComponent: Ee
12
12
  });
13
13
 
14
- export { f, l, videoDetailDialog_componentBDbkyOqu as v };
14
+ export { f, l, videoDetailDialog_componentBuBXjML_ as v };
@@ -31,14 +31,14 @@ var Ui={schedule(n,t){let e=setTimeout(n,t);return ()=>clearTimeout(e)}};functio
31
31
  `],encapsulation:3})};var $e=class n extends Fe{item;data=g(Ye);dialogRef=g(W);ItemDetailLayout=Oe$1;constructor(){super(),this.triggerContext=this.data.triggerContext,this.item=this.data.item;}close(){this.dialogRef.close();}engagementTriggerReceived(t){}update(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-item-quick-view`]],features:[Xf(kt()),za],decls:1,vars:2,consts:[[3,`closeClick`,`item`,`layout`]],template:function(e,i){e&1&&(Ka(0,`cooee-item-detail`,0),Sf(`closeClick`,function(){return i.close()}),Ja()),e&2&&yf(`item`,i.item)(`layout`,i.ItemDetailLayout.TWO_PANE);},dependencies:[Nt],styles:[`:host{display:flex;align-items:center;justify-content:center;height:100%}@media(min-width:768px){cooee-item-detail{max-width:900px;max-height:80vh;border-radius:var(--lc-card-radius)}}
32
32
  `],encapsulation:3})};var Ue=class n{dialog=g(Ro);dialogRef;constructor(){}showItemQuickView(t,e){this.dialogRef=this.dialog.open($e,{width:`100vw`,height:`100dvh`,backdropClass:[`letscooee-backdrop`],data:{item:e,triggerContext:t}});}static ɵfac=function(e){return new(e||n)};static ɵprov=C({token:n,factory:n.ɵfac,providedIn:`root`})};var uo=(n,t)=>({enter:n,exit:t});function fo(n,t){if(n&1&&(Ka(0,`div`,7),uv(1),Ja(),Ka(2,`div`,8),uv(3),Ja()),n&2){let e=kD(2);ud(),ic(` `,e.getCurrency(e.selectedVariant().price.cmp),` `),ud(2),ic(` `,e.getDiscountPercentage(e.selectedVariant().price),`% off `);}}function go(n,t){if(n&1&&(Ka(0,`div`,6),uv(1),Ja()),n&2){let e=kD(2);ud(),ic(` `,e.stickyATCConfig.leftText,` `);}}function vo(n,t){if(n&1&&(Ka(0,`div`,1)(1,`div`,5),uv(2),Ja(),vD(3,fo,4,2),vD(4,go,2,1,`div`,6),Ja()),n&2){let e=kD();ud(2),ic(` `,e.getCurrency(e.selectedVariant().price.d),` `),ud(),ED(e.selectedVariant().price.cmp?3:-1),ud(),ED(e.stickyATCConfig.leftText?4:-1);}}function ho(n,t){if(n&1&&(Ka(0,`div`,9),uv(1),Ja()),n&2){let e=t.$implicit,i=t.$index;kD(2);let a=hv(5);yf(`ngClass`,Cv(2,uo,i===a.currentIndex,i===a.previousIndex)),ud(),ic(` `,e,` `);}}function Co(n,t){if(n&1&&(Ka(0,`div`,4),wD(1,ho,2,5,`div`,9,ID),Ja()),n&2){kD();let e=hv(5);ud(),_D(e.features);}}var Qe=class n extends Fe{currentItem;stickyATCConfig;selectedVariant=Mt$2(void 0);featureSlider=Mt$2({features:[],currentIndex:0});constructor(){super();}onVariantChange(t){this.currentItem&&(this.currentItem.setSelectedVariantByID(t.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value));}engagementTriggerReceived(t){this.stickyATCConfig=t.stickyATCConfig??{},this.currentItem=t.items[0],this.selectedVariant.set(this.currentItem.vars[0]),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation();}update(){}getCurrency(t){return Pr$1(t)}getDiscountPercentage(t){return ((t.cmp-t.d)/t.cmp*100).toFixed(0)}addToCart(){this.engagementService.executeCTA(he$3.ADD_TO_CART,{item:this.currentItem});}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let t=this.stickyATCConfig.rightText.split(`
33
33
  `),e=t.length===1?null:setInterval(()=>{this.featureSlider.update(i=>s(r({},i),{previousIndex:i.currentIndex,currentIndex:(i.currentIndex+1)%i.features.length}));},3e3);this.featureSlider.set({intervalRef:e,currentIndex:0,features:t});}replaceVariables(t){return t?Fe$3(t,this.currentItem.getTemplateVariables(),this.triggerContext):``}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-sticky-atc`]],hostBindings:function(e,i){e&1&&Sf(`letscooee:variant-change`,function(s){return i.onVariantChange(s)},Jg);},features:[Xf(kt()),za],decls:7,vars:3,consts:[[1,`lc-wrapper`],[1,`lc-prices`],[1,`lc-button-wrapper`],[`type`,`button`,1,`lc-button`,`lc-button-atc`,3,`click`],[1,`lc-features`],[1,`lc-sale-price`],[1,`lc-additional-text`],[1,`lc-compare-price`],[1,`lc-discount-label`],[1,`lc-feature`,3,`ngClass`]],template:function(e,i){if(e&1&&(Ka(0,`div`,0),vD(1,vo,5,3,`div`,1),Ka(2,`div`,2)(3,`button`,3),Sf(`click`,function(){return i.addToCart()}),uv(4,`Add To Cart`),Ja(),Qf(5),vD(6,Co,3,0,`div`,4),Ja()()),e&2){ud(),ED(i.selectedVariant()&&i.stickyATCConfig.showProductInfo?1:-1),ud(4);let a=pv(i.featureSlider());ud(),ED(a.features.length?6:-1);}},dependencies:[wE],styles:[`:host{display:flex;justify-content:center;padding:10px;background-color:#fff;width:100%;box-shadow:4px 0 10px #0006;line-height:normal}.lc-wrapper{display:flex;justify-content:space-between;align-items:center;gap:8px;max-width:1100px;width:100%}.lc-prices{flex:1 1 100%;display:flex;flex-wrap:wrap;align-items:center;gap:6px}@media(min-width:768px){.lc-prices{gap:8px}}.lc-sale-price{font-size:24px;font-weight:600}.lc-compare-price{font-size:18px;font-weight:600;color:red;text-decoration:line-through}.lc-discount-label{font-size:12px;font-weight:500;color:green}.lc-button-wrapper{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;align-items:center}.lc-button{background-color:#000;color:#fff;opacity:1;pointer-events:auto;border-radius:4px;min-width:150px;width:100%;padding:8px}.lc-additional-text,.lc-feature{font-size:12px;color:#666}.lc-features{position:relative;overflow:hidden;height:16px;text-align:center;width:100%}.lc-features .lc-feature{position:absolute;width:100%;opacity:0;transform:translateY(100%);transition:transform .5s ease,opacity .5s ease}.lc-features .lc-feature.enter{opacity:1;transform:translateY(0);z-index:2}.lc-features .lc-feature.exit{opacity:0;transform:translateY(-100%);z-index:1}
34
- `],encapsulation:3})};var yo=[`videoEl`];async function hi(){return (await import('./video-detail-dialog.component-BDbkyOqu-BWBD8wTf.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var me=class n extends Fe{videoElements;videoEntries;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),hi();}ngAfterViewInit(){this.checkAndOpenVideoFromUrl();}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect();}engagementTriggerReceived(t){this.videoConfig=t.content?.videoConfig,this.videoEntries=this.videoConfig.videoEntries;}onMuteToggled(t,e){t||this.videoElements.forEach(i=>{i.nativeElement!==e&&(i.nativeElement.muted=true,i.nativeElement.pause());});}sendTriggerClicked(t,e){this.sendEvent(`CE Trigger Clicked`,{},t,e);}async onVideoTap(t,e,i,a,s){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){a&&(a.muted=false,a.play(),this.onMuteToggled(false,a));return}await this.openDialog(e,i,s);}sendEvent(t,e,i,a){let s=new Ir$1(t,e,this.engagementTrigger);s.setVideos(i),a&&(s.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(s);}onDialogClosed(){this.resumePlaylistVideos();}isVideoLoading(t){return this.videoLoadingStates.get(t)??true}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}playVideo(t){t.play().catch(e=>{Y$1.error(`Failed to play video:`,e);});}setupIntersectionObserver(t=.5,e=`50px`){this.intersectionObserver=new IntersectionObserver(i=>{i.forEach(a=>{let s=a.target,l=s.dataset.videoId;l&&(a.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(s,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(s,false)));});},{threshold:t,rootMargin:e}),setTimeout(()=>{this.videoElements.forEach(i=>{this.intersectionObserver?.observe(i.nativeElement);});},100);}handleVideoVisibilityChange(t,e){e?this.onVideoBecameVisible(t):t.pause();}onVideoBecameVisible(t){this.playVideo(t);}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(t=>{let e=t.nativeElement;e.paused||(this.pausedVideos.push(e),e.pause());});}resumePlaylistVideos(){this.pausedVideos.forEach(t=>{t.play().catch(()=>{});}),this.pausedVideos=[];}async checkAndOpenVideoFromUrl(){let t=We$3();if(!t||!this.videoEntries)return;let e=Je$1();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$2)return;let i=this.videoEntries.findIndex(a=>a.video.shortID===+t);if(i!==-1){let a=this.videoEntries[i].video;await ce$3.set(`muted`,true),await this.openDialog(a,i);}}async openDialog(t,e,i){await Mi$1();let a={videoEntries:this.videoEntries,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let s=await hi();this.dialogRef=this.dialog.open(s,{width:`100vw`,height:`100vh`,data:a,providers:Qt(this.triggerContext,{video:t,index:e}),disableClose:true});let l={videoID:t.id,videoIndex:e};this.sendEvent(`CE Video Dialog Opened`,{current:l},t),this.dialogRef.closed.subscribe(d=>{if(this.dialogRef=null,!d)return;let f=d.lastVideoDuration*1e3,A={videoID:d.lastVideo.id,videoIndex:d.lastVideoIndex,playedTillMS:f,playedTillPercent:f/d.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:A},d.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&nc(yo,5),e&2){let a;Rf(a=xf())&&(i.videoElements=a);}},features:[za],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var ue=class n{video=Ub.required({alias:`cooeeVideoSources`});prioritySource=Ub(`high`);elementRef=g(Se$1);constructor(){Cs(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(s=>s.remove()),i===`best`?(this.addSource(e.bestSource),this.addSource(e.highSource),this.addSource(e.lowSource)):i===`low`?(this.addSource(e.lowSource),this.addSource(e.highSource),this.addSource(e.bestSource)):(this.addSource(e.highSource),this.addSource(e.bestSource),this.addSource(e.lowSource)),this.addSource(e.m3u8Source),t.load();}addSource(t){if(!t)return;let e=document.createElement(`source`);e.src=t.url,e.type=t.mimeType,this.elementRef.nativeElement.appendChild(e);}static ɵfac=function(e){return new(e||n)};static ɵdir=hn$1({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var _o=(n,t)=>t.video.id;function xo(n,t){if(n&1&&(Df(0,`div`,1),Iv(1,`safeHtml`)),n&2)yf(`innerHTML`,_v(1,1,kD().videoConfig.heading),Yg);}function bo(n,t){n&1&&(Ka(0,`div`,6),Df(1,`div`,12),Ja());}function wo(n,t){if(n&1){let e=ND();Ka(0,`cooee-mute-toggle`,13),Sf(`toggled`,function(a){fu(e),kD();let s=jD(7);return pu(kD().onMuteToggled(a,s))}),Ja();}if(n&2){kD();let e=jD(7);yf(`muted`,e.muted)(`videoEl`,e);}}function Vo(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,16),Sf(`cardClick`,function(a){fu(e);let s=kD(2).$index,l=jD(7),d=hv(0);return pu(kD().onItemCardClick(a,d,s,l))}),Ja();}if(n&2){kD(2);yf(`items`,hv(0).items)(`centeredSlides`,false);}}function Eo(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-card`,17),Sf(`buttonClick`,function(){fu(e);let a=kD(2).$index,s=jD(7),l=hv(0);return pu(kD().addToCartClicked(null,l,a,s))})(`click`,function(){fu(e);let a=kD(2).$index,s=jD(7),l=hv(0),d=hv(1);return pu(kD().onItemCardClick(d,l,a,s))}),Ja();}if(n&2){kD(2);yf(`item`,hv(1));}}function To(n,t){if(n&1&&vD(0,Vo,1,2,`cooee-video-promoted-items`,14)(1,Eo,1,1,`cooee-item-card`,15),n&2){kD();let e=hv(0),i=kD();ED(hv(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function So(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-card`,18),Sf(`linkClicked`,function(){fu(e),kD();let a=hv(0);return pu(kD().sendTriggerClicked(a))}),Ja();}if(n&2){kD();yf(`card`,hv(2));}}function Io(n,t){if(n&1){let e=ND();Qf(0)(1)(2),Ka(3,`div`,4)(4,`div`,5),Sf(`click`,function(a){let s=fu(e).$index,l=jD(7),d=hv(0);return pu(kD().onVideoTap(a,d,s,l))})(`keydown.enter`,function(a){let s=fu(e).$index,l=jD(7),d=hv(0);return pu(kD().onVideoTap(a,d,s,l))})(`keydown.space`,function(a){let s=fu(e).$index,l=jD(7),d=hv(0);return pu(kD().onVideoTap(a,d,s,l))}),vD(5,bo,2,0,`div`,6),Ka(6,`video`,7,0),Sf(`mouseenter`,function(){fu(e);let a=jD(7);kD();return pu(hv(1)&&a.play())})(`mouseleave`,function(){fu(e);let a=jD(7);kD();return pu(hv(1)&&a.pause())})(`loadstart`,function(){fu(e);let a=hv(0);return pu(kD().onVideoLoadStart(a.id))})(`canplay`,function(){fu(e);let a=hv(0);return pu(kD().onVideoCanPlay(a.id))}),Ja(),Ka(8,`div`,8),vD(9,wo,1,2,`cooee-mute-toggle`,9),Ja()(),Ka(10,`div`,10),vD(11,To,2,1)(12,So,1,1,`cooee-video-card`,11),Ja()();}if(n&2){let e=t.$implicit,i=kD(),a=hv(0),s=hv(2),l=pv(e.video);ud(),pv(l.items[0]),ud();let f=pv(l.card)&&s===i.VideoConfigFooterContent.CARD;ud(2),rc(`background-image`,l.thumbnail?`url(`+l.thumbnail+`)`:null),ud(),ED(i.isVideoLoading(l.id)?5:-1),ud(),yf(`cooeeVideoSources`,l)(`muted`,true),mf(`poster`,l.thumbnail)(`preload`,a?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,l.id),ud(3),ED(i.videoConfig.showMuteButton?9:-1),ud(2),ED(i.videoConfig.showItems()?11:f?12:-1);}}var Ze=class n extends me{VideoConfigFooterContent=se$2;VideoConfigAutoPlay=oe$2;swiperOptions=null;constructor(){super(),this.hasSwiper=true;}ngAfterViewInit(){super.ngAfterViewInit();let t=this.videoConfig.playlistConfig.videoSwiper,e=t?(this.isMobile?t.gapSm:t.gap)+`px`:window.cooeePlaylistGap??24,i=t?this.isMobile?t.maxInRowSm:t.maxInRow:`auto`;this.swiperOptions={direction:`horizontal`,effect:`slide`,loop:t?.loop,freeMode:true,spaceBetween:e,slidesPerView:i,mousewheel:{enabled:true,forceToAxis:true},autoplay:t?.autoplay?.enabled?{delay:t?.autoplay?.delay,disableOnInteraction:false}:false},this.setupIntersectionObserver(),this.playFirstVideo();}ngOnDestroy(){super.ngOnDestroy();}addToCartClicked(t,e,i,a){let s=e.items?.[0],l=he$4.get().website?.canChangeVariantInCart;if(e.items?.length>1||s?.hasVariants()&&!l){this.onItemCardClick(s,e,i,a);return}this.engagementService.executeCTA(he$3.ADD_TO_CART,{item:s,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(he$3.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,a){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,a,t):this.onVideoTap(null,e,i,a);}update(){}onVideoCanPlay(t){if(super.onVideoCanPlay(t),!this.shouldAutoPlay()||this.dialogRef||!this.visibleVideos.has(t))return;let e=this.videoElements.find(i=>i.nativeElement.dataset.videoId===t)?.nativeElement;e&&this.playVideo(e);}onVideoBecameVisible(t){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(t):this.playVideo(t));}shouldAutoPlay(){return this.videoConfig.autoPlay===`ON`||this.videoConfig.autoPlay===`ON_HOVER`&&this.isMobile}playFirstVideo(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-playlist`]],features:[Xf(kt()),za],decls:8,vars:7,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[3,`options`,`navigationConfig`,`paginationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-card`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Play video`,`aria-haspopup`,`dialog`,1,`video-wrapper`,3,`click`,`keydown.enter`,`keydown.space`],[1,`video-loading-overlay`],[`width`,`100%`,`playsinline`,``,`loop`,``,3,`mouseenter`,`mouseleave`,`loadstart`,`canplay`,`cooeeVideoSources`,`muted`],[1,`video-controls`],[3,`muted`,`videoEl`],[`role`,`region`,`aria-label`,`Video details`,1,`video-footer`],[3,`card`],[1,`loading-spinner`],[3,`toggled`,`muted`,`videoEl`],[3,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`item`],[3,`cardClick`,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`buttonClick`,`click`,`item`],[3,`linkClicked`,`card`]],template:function(e,i){if(e&1&&(Qf(0)(1)(2),vD(3,xo,2,3,`div`,1),Ka(4,`cooee-swiper`,2),ec(5,3),wD(6,Io,13,14,`div`,4,_o),$o(),Ja()),e&2){pv(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),ud(),pv(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),ud(),pv(i.videoConfig.footerContent),ud(),ED(i.videoConfig.heading?3:-1);let a=i.videoConfig.playlistConfig.videoSwiper;ud(),yf(`options`,i.swiperOptions)(`navigationConfig`,a==null?null:a.navigation)(`paginationConfig`,a==null?null:a.pagination),ud(2),_D(i.videoEntries);}},dependencies:[Bt,jt,Rt,de,ue,Lt,a],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media(max-width:768px),(prefers-reduced-motion:reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}.video-footer{overflow-x:hidden}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-detail-button{display:none!important}cooee-item-card .item-info{font-size:14px;line-height:normal;margin-right:unset!important}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
34
+ `],encapsulation:3})};var yo=[`videoEl`];async function hi(){return (await import('./video-detail-dialog.component-BuBXjML_-D0PUVY5F.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var me=class n extends Fe{videoElements;videoEntries;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),hi();}ngAfterViewInit(){this.checkAndOpenVideoFromUrl();}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect();}engagementTriggerReceived(t){this.videoConfig=t.content?.videoConfig,this.videoEntries=this.videoConfig.videoEntries;}onMuteToggled(t,e){t||this.videoElements.forEach(i=>{i.nativeElement!==e&&(i.nativeElement.muted=true,i.nativeElement.pause());});}sendTriggerClicked(t,e){this.sendEvent(`CE Trigger Clicked`,{},t,e);}async onVideoTap(t,e,i,a,s){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){a&&(a.muted=false,a.play(),this.onMuteToggled(false,a));return}await this.openDialog(e,i,s);}sendEvent(t,e,i,a){let s=new Ir$1(t,e,this.engagementTrigger);s.setVideos(i),a&&(s.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(s);}onDialogClosed(){this.resumePlaylistVideos();}isVideoLoading(t){return this.videoLoadingStates.get(t)??true}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}playVideo(t){t.play().catch(e=>{Y$1.error(`Failed to play video:`,e);});}setupIntersectionObserver(t=.5,e=`50px`){this.intersectionObserver=new IntersectionObserver(i=>{i.forEach(a=>{let s=a.target,l=s.dataset.videoId;l&&(a.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(s,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(s,false)));});},{threshold:t,rootMargin:e}),setTimeout(()=>{this.videoElements.forEach(i=>{this.intersectionObserver?.observe(i.nativeElement);});},100);}handleVideoVisibilityChange(t,e){e?this.onVideoBecameVisible(t):t.pause();}onVideoBecameVisible(t){this.playVideo(t);}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(t=>{let e=t.nativeElement;e.paused||(this.pausedVideos.push(e),e.pause());});}resumePlaylistVideos(){this.pausedVideos.forEach(t=>{t.play().catch(()=>{});}),this.pausedVideos=[];}async checkAndOpenVideoFromUrl(){let t=We$3();if(!t||!this.videoEntries)return;let e=Je$1();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$2)return;let i=this.videoEntries.findIndex(a=>a.video.shortID===+t);if(i!==-1){let a=this.videoEntries[i].video;await ce$3.set(`muted`,true),await this.openDialog(a,i);}}async openDialog(t,e,i){await Mi$1();let a={videoEntries:this.videoEntries,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let s=await hi();this.dialogRef=this.dialog.open(s,{width:`100vw`,height:`100vh`,data:a,providers:Qt(this.triggerContext,{video:t,index:e}),disableClose:true});let l={videoID:t.id,videoIndex:e};this.sendEvent(`CE Video Dialog Opened`,{current:l},t),this.dialogRef.closed.subscribe(d=>{if(this.dialogRef=null,!d)return;let f=d.lastVideoDuration*1e3,A={videoID:d.lastVideo.id,videoIndex:d.lastVideoIndex,playedTillMS:f,playedTillPercent:f/d.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:A},d.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&nc(yo,5),e&2){let a;Rf(a=xf())&&(i.videoElements=a);}},features:[za],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var ue=class n{video=Ub.required({alias:`cooeeVideoSources`});prioritySource=Ub(`high`);elementRef=g(Se$1);constructor(){Cs(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(s=>s.remove()),i===`best`?(this.addSource(e.bestSource),this.addSource(e.highSource),this.addSource(e.lowSource)):i===`low`?(this.addSource(e.lowSource),this.addSource(e.highSource),this.addSource(e.bestSource)):(this.addSource(e.highSource),this.addSource(e.bestSource),this.addSource(e.lowSource)),this.addSource(e.m3u8Source),t.load();}addSource(t){if(!t)return;let e=document.createElement(`source`);e.src=t.url,e.type=t.mimeType,this.elementRef.nativeElement.appendChild(e);}static ɵfac=function(e){return new(e||n)};static ɵdir=hn$1({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var _o=(n,t)=>t.video.id;function xo(n,t){if(n&1&&(Df(0,`div`,1),Iv(1,`safeHtml`)),n&2)yf(`innerHTML`,_v(1,1,kD().videoConfig.heading),Yg);}function bo(n,t){n&1&&(Ka(0,`div`,6),Df(1,`div`,12),Ja());}function wo(n,t){if(n&1){let e=ND();Ka(0,`cooee-mute-toggle`,13),Sf(`toggled`,function(a){fu(e),kD();let s=jD(7);return pu(kD().onMuteToggled(a,s))}),Ja();}if(n&2){kD();let e=jD(7);yf(`muted`,e.muted)(`videoEl`,e);}}function Vo(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-promoted-items`,16),Sf(`cardClick`,function(a){fu(e);let s=kD(2).$index,l=jD(7),d=hv(0);return pu(kD().onItemCardClick(a,d,s,l))}),Ja();}if(n&2){kD(2);yf(`items`,hv(0).items)(`centeredSlides`,false);}}function Eo(n,t){if(n&1){let e=ND();Ka(0,`cooee-item-card`,17),Sf(`buttonClick`,function(){fu(e);let a=kD(2).$index,s=jD(7),l=hv(0);return pu(kD().addToCartClicked(null,l,a,s))})(`click`,function(){fu(e);let a=kD(2).$index,s=jD(7),l=hv(0),d=hv(1);return pu(kD().onItemCardClick(d,l,a,s))}),Ja();}if(n&2){kD(2);yf(`item`,hv(1));}}function To(n,t){if(n&1&&vD(0,Vo,1,2,`cooee-video-promoted-items`,14)(1,Eo,1,1,`cooee-item-card`,15),n&2){kD();let e=hv(0),i=kD();ED(hv(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function So(n,t){if(n&1){let e=ND();Ka(0,`cooee-video-card`,18),Sf(`linkClicked`,function(){fu(e),kD();let a=hv(0);return pu(kD().sendTriggerClicked(a))}),Ja();}if(n&2){kD();yf(`card`,hv(2));}}function Io(n,t){if(n&1){let e=ND();Qf(0)(1)(2),Ka(3,`div`,4)(4,`div`,5),Sf(`click`,function(a){let s=fu(e).$index,l=jD(7),d=hv(0);return pu(kD().onVideoTap(a,d,s,l))})(`keydown.enter`,function(a){let s=fu(e).$index,l=jD(7),d=hv(0);return pu(kD().onVideoTap(a,d,s,l))})(`keydown.space`,function(a){let s=fu(e).$index,l=jD(7),d=hv(0);return pu(kD().onVideoTap(a,d,s,l))}),vD(5,bo,2,0,`div`,6),Ka(6,`video`,7,0),Sf(`mouseenter`,function(){fu(e);let a=jD(7);kD();return pu(hv(1)&&a.play())})(`mouseleave`,function(){fu(e);let a=jD(7);kD();return pu(hv(1)&&a.pause())})(`loadstart`,function(){fu(e);let a=hv(0);return pu(kD().onVideoLoadStart(a.id))})(`canplay`,function(){fu(e);let a=hv(0);return pu(kD().onVideoCanPlay(a.id))}),Ja(),Ka(8,`div`,8),vD(9,wo,1,2,`cooee-mute-toggle`,9),Ja()(),Ka(10,`div`,10),vD(11,To,2,1)(12,So,1,1,`cooee-video-card`,11),Ja()();}if(n&2){let e=t.$implicit,i=kD(),a=hv(0),s=hv(2),l=pv(e.video);ud(),pv(l.items[0]),ud();let f=pv(l.card)&&s===i.VideoConfigFooterContent.CARD;ud(2),rc(`background-image`,l.thumbnail?`url(`+l.thumbnail+`)`:null),ud(),ED(i.isVideoLoading(l.id)?5:-1),ud(),yf(`cooeeVideoSources`,l)(`muted`,true),mf(`poster`,l.thumbnail)(`preload`,a?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,l.id),ud(3),ED(i.videoConfig.showMuteButton?9:-1),ud(2),ED(i.videoConfig.showItems()?11:f?12:-1);}}var Ze=class n extends me{VideoConfigFooterContent=se$2;VideoConfigAutoPlay=oe$2;swiperOptions=null;constructor(){super(),this.hasSwiper=true;}ngAfterViewInit(){super.ngAfterViewInit();let t=this.videoConfig.playlistConfig.videoSwiper,e=t?(this.isMobile?t.gapSm:t.gap)+`px`:window.cooeePlaylistGap??24,i=t?this.isMobile?t.maxInRowSm:t.maxInRow:`auto`;this.swiperOptions={direction:`horizontal`,effect:`slide`,loop:t?.loop,freeMode:true,spaceBetween:e,slidesPerView:i,mousewheel:{enabled:true,forceToAxis:true},autoplay:t?.autoplay?.enabled?{delay:t?.autoplay?.delay,disableOnInteraction:false}:false},this.setupIntersectionObserver(),this.playFirstVideo();}ngOnDestroy(){super.ngOnDestroy();}addToCartClicked(t,e,i,a){let s=e.items?.[0],l=he$4.get().website?.canChangeVariantInCart;if(e.items?.length>1||s?.hasVariants()&&!l){this.onItemCardClick(s,e,i,a);return}this.engagementService.executeCTA(he$3.ADD_TO_CART,{item:s,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(he$3.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,a){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,a,t):this.onVideoTap(null,e,i,a);}update(){}onVideoCanPlay(t){if(super.onVideoCanPlay(t),!this.shouldAutoPlay()||this.dialogRef||!this.visibleVideos.has(t))return;let e=this.videoElements.find(i=>i.nativeElement.dataset.videoId===t)?.nativeElement;e&&this.playVideo(e);}onVideoBecameVisible(t){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(t):this.playVideo(t));}shouldAutoPlay(){return this.videoConfig.autoPlay===`ON`||this.videoConfig.autoPlay===`ON_HOVER`&&this.isMobile}playFirstVideo(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-playlist`]],features:[Xf(kt()),za],decls:8,vars:7,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[3,`options`,`navigationConfig`,`paginationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-card`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Play video`,`aria-haspopup`,`dialog`,1,`video-wrapper`,3,`click`,`keydown.enter`,`keydown.space`],[1,`video-loading-overlay`],[`width`,`100%`,`playsinline`,``,`loop`,``,3,`mouseenter`,`mouseleave`,`loadstart`,`canplay`,`cooeeVideoSources`,`muted`],[1,`video-controls`],[3,`muted`,`videoEl`],[`role`,`region`,`aria-label`,`Video details`,1,`video-footer`],[3,`card`],[1,`loading-spinner`],[3,`toggled`,`muted`,`videoEl`],[3,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`item`],[3,`cardClick`,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`buttonClick`,`click`,`item`],[3,`linkClicked`,`card`]],template:function(e,i){if(e&1&&(Qf(0)(1)(2),vD(3,xo,2,3,`div`,1),Ka(4,`cooee-swiper`,2),ec(5,3),wD(6,Io,13,14,`div`,4,_o),$o(),Ja()),e&2){pv(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),ud(),pv(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),ud(),pv(i.videoConfig.footerContent),ud(),ED(i.videoConfig.heading?3:-1);let a=i.videoConfig.playlistConfig.videoSwiper;ud(),yf(`options`,i.swiperOptions)(`navigationConfig`,a==null?null:a.navigation)(`paginationConfig`,a==null?null:a.pagination),ud(2),_D(i.videoEntries);}},dependencies:[Bt,jt,Rt,de,ue,Lt,a],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media(max-width:768px),(prefers-reduced-motion:reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}.video-footer{overflow-x:hidden}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-detail-button{display:none!important}cooee-item-card .item-info{font-size:14px;line-height:normal;margin-right:unset!important}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
35
35
  `],encapsulation:3})};var Mo=[`videoElement`],ko=n=>({"cursor-grab":n}),We=class n extends me{videoElement;video;isDragging=false;hidden=false;cdkDrag=g(ge$1,{self:true});untilDestroyed=Pt();constructor(){super();}get popupClasses(){return this.hidden?[`hidden`]:[`visible`]}onClick(t){t.stopPropagation(),t.preventDefault(),this.onVideoClick();}ngOnInit(){super.ngOnInit();let t=this.elementRef.nativeElement.closest(`.letscooee-engagement`);t&&(t.style.zIndex=`10000`),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=true);}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay();},100);}onVideoClick(){if(this.isDragging){this.isDragging=false;return}this.hidden=true,this.onVideoTap(null,this.video,0);}close(){this.hidden=true;let t=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent(`CE Trigger Closed`,{duration:t});}engagementTriggerReceived(t){super.engagementTriggerReceived(t),this.video=this.videoEntries[0].video;}update(){}onDialogClosed(){this.hidden=false;}autoPlay(){let t=this.videoElement.nativeElement;this.hidden||this.playVideo(t);}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-popup`]],viewQuery:function(e,i){if(e&1&&nc(Mo,5),e&2){let a;Rf(a=xf())&&(i.videoElement=a.first);}},hostAttrs:[`role`,`button`,`tabindex`,`0`,`aria-label`,`Open video popup `,`cdkDragBoundary`,`body`],hostVars:2,hostBindings:function(e,i){e&1&&Sf(`keydown.enter`,function(s){return i.onClick(s)})(`keydown.space`,function(s){return i.onClick(s)})(`click`,function(s){return i.onClick(s)}),e&2&&XD(i.popupClasses);},features:[Xf(kt()),iD([{directive:ge$1,inputs:[`cdkDragBoundary`,`cdkDragBoundary`]}]),za],decls:9,vars:5,consts:[[`videoElement`,``],[1,`popup-inner`,3,`ngClass`],[`type`,`button`,`aria-label`,`Close video popup`,1,`close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`],[1,`play-button`],[`name`,`unmute`,`aria-hidden`,`true`],[1,`text`],[`loop`,``,`preload`,`metadata`,`playsinline`,``,3,`muted`,`cooeeVideoSources`]],template:function(e,i){if(e&1){let a=ND();Ka(0,`div`,1)(1,`button`,2),Sf(`click`,function(l){return fu(a),l.stopPropagation(),pu(i.close())}),Df(2,`cooee-icon`,3),Ja(),Ka(3,`div`,4),Df(4,`cooee-icon`,5),Ka(5,`div`,6),uv(6,`Tap to unmute`),Ja()(),Df(7,`video`,7,0),Ja();}e&2&&(yf(`ngClass`,Ev(3,ko,i.isDragging)),ud(7),yf(`muted`,true)(`cooeeVideoSources`,i.video));},dependencies:[wE,ye,ue],styles:[`:host{position:fixed;display:block;right:24px;bottom:24px;min-height:150px;max-width:150px;box-shadow:0 25px 50px -12px #00000040}:host(.hidden){display:none}.popup-inner{display:flex;justify-content:center;align-items:center;position:relative}video{width:100%;border-radius:8px;background-color:#fff}.close-button{position:absolute;top:-14px;right:-14px;background-color:#00000080;border-radius:9999px;width:32px;height:32px;border:none;z-index:10;display:flex;justify-content:center;align-items:center}.play-button{display:flex;justify-content:center;align-items:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(1);transition:all .1s ease-in-out;z-index:999;flex-wrap:wrap;width:100%;max-width:130px;border-radius:5px;padding:5px 10px;background-color:#97979761;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.play-button cooee-icon{width:14px;height:14px}.play-button .text{font-size:11px;line-height:1;color:#fff;font-weight:400;margin-left:5px;text-align:center}
36
36
  `],encapsulation:3})};var Po=(n,t)=>t.video.id;function Fo(n,t){if(n&1&&(Df(0,`div`,1),Iv(1,`safeHtml`)),n&2)yf(`innerHTML`,_v(1,1,kD().videoConfig.heading),Yg);}function Do(n,t){n&1&&(Ka(0,`div`,9),Df(1,`div`,12),Ja());}function Ao(n,t){if(n&1&&(Ka(0,`div`,11),uv(1),Ja()),n&2){let e=kD().$implicit;ud(),Wf(e.title);}}function Lo(n,t){if(n&1){let e=ND();Ka(0,`div`,4),Sf(`click`,function(a){let s=fu(e),l=s.$implicit,d=s.$index;return pu(kD().onVideoTap(a,l.video,d))})(`keydown.enter`,function(a){let s=fu(e),l=s.$implicit,d=s.$index;return pu(kD().onVideoTap(a,l.video,d))})(`keydown.space`,function(a){let s=fu(e),l=s.$implicit,d=s.$index;return pu(kD().onVideoTap(a,l.video,d))}),_u(),Ka(1,`svg`,5),Df(2,`circle`,6)(3,`circle`,7),Ja(),Tu(),Ka(4,`div`,8),vD(5,Do,2,0,`div`,9),Ka(6,`video`,10,0),Sf(`loadstart`,function(){let a=fu(e).$implicit;return pu(kD().onVideoLoadStart(a.video.id))})(`canplay`,function(){let a=fu(e).$implicit;return pu(kD().onVideoCanPlay(a.video.id))}),Ja()(),vD(8,Ao,2,1,`div`,11),Ja();}if(n&2){let e=t.$implicit,i=t.$index,a=kD();mf(`aria-label`,`Open video story `+(i+1)),ud(5),ED(a.isVideoLoading(e.video.id)?5:-1),ud(),yf(`poster`,e.video.thumbnail)(`cooeeVideoSources`,e.video)(`prioritySource`,`low`)(`muted`,true),mf(`data-video-id`,e.video.id),ud(2),ED(e.title?8:-1);}}var qe=class n extends me{constructor(){super();}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver();}ngOnDestroy(){super.ngOnDestroy();}update(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=of({type:n,selectors:[[`cooee-video-stories`]],features:[Xf(kt()),za],decls:4,vars:1,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[1,`video-stories`],[`role`,`button`,`tabindex`,`0`,1,`video-story`],[`role`,`button`,`tabindex`,`0`,1,`video-story`,3,`click`,`keydown.enter`,`keydown.space`],[`viewBox`,`0 0 100 100`],[`cx`,`50`,`cy`,`50`,`r`,`48`,`fill`,`none`,`stroke-width`,`4`],[`cx`,`50`,`cy`,`50`,`r`,`48`,`fill`,`none`,`stroke-width`,`4`,`stroke-linecap`,`round`,`stroke-dasharray`,`301.6`,`stroke-dashoffset`,`301.6`,1,`video-story-circle`],[1,`video-wrapper`],[1,`video-loading-overlay`],[`loop`,``,`playsinline`,``,`preload`,`metadata`,3,`loadstart`,`canplay`,`poster`,`cooeeVideoSources`,`prioritySource`,`muted`],[1,`video-story-title`],[1,`loading-spinner`]],template:function(e,i){e&1&&(vD(0,Fo,2,3,`div`,1),Ka(1,`div`,2),wD(2,Lo,9,8,`div`,3,Po),Ja()),e&2&&(ED(i.videoConfig.heading?0:-1),ud(2),_D(i.videoEntries));},dependencies:[ue,a],styles:[`:host{display:block}.video-stories{display:flex;overflow:auto;margin:.75rem;gap:.75rem;justify-content:center;align-items:center;scrollbar-width:none}.video-stories::-webkit-scrollbar{display:none}@media(max-width:768px){.video-stories{justify-content:start!important}}.video-story{position:relative;width:5rem;cursor:pointer;flex-shrink:0}.video-story .video-story-title{margin-top:.25rem;font-size:.7rem;line-height:1.1;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.video-story svg{position:absolute;top:0;left:0;width:100%;height:100%}.video-story svg circle:first-child{stroke:#d1d5db}.video-story svg circle:last-child{stroke:#3b82f6}.video-story .video-wrapper{position:relative;width:100%;height:100%;border-radius:9999px;overflow:hidden}.video-story .video-wrapper video{width:100%;height:100%;object-fit:cover;border-radius:9999px;position:relative;z-index:1}.video-story .video-wrapper .video-loading-overlay{border-radius:9999px}
37
- `],encapsulation:3})};async function Ha(){let n=await UE(fi),t=(e,i)=>{let a=ui(e,{injector:n.injector});customElements.get(i)||customElements.define(i,a);};t(Qe,`cooee-sticky-atc`),t(ze,`cooee-savings-bar`),t(je,`cooee-progressbar`),t(Ze,`cooee-video-playlist`),t(We,`cooee-video-popup`),t(qe,`cooee-video-stories`),t(ke,`cooee-product-options-picker`),t(Be,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-Qy14WYE1-B1UGGOP6.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Ue).showItemQuickView(e,i);};}
37
+ `],encapsulation:3})};async function Ha(){let n=await UE(fi),t=(e,i)=>{let a=ui(e,{injector:n.injector});customElements.get(i)||customElements.define(i,a);};t(Qe,`cooee-sticky-atc`),t(ze,`cooee-savings-bar`),t(je,`cooee-progressbar`),t(Ze,`cooee-video-playlist`),t(We,`cooee-video-popup`),t(qe,`cooee-video-stories`),t(ke,`cooee-product-options-picker`),t(Be,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-C7xvf-6L-D2Zl6K3r.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Ue).showItemQuickView(e,i);};}
38
38
 
39
- var widgetsDv8l0Y8_ = /*#__PURE__*/Object.freeze({
39
+ var widgetsCK6j6OOD = /*#__PURE__*/Object.freeze({
40
40
  __proto__: null,
41
41
  loadAngularWidgets: Ha
42
42
  });
43
43
 
44
- export { $o as $, Rf as A, Bt as B, xf as C, Df as D, $b as E, Ro as F, Ge as G, Ho as H, ID as I, Ja as J, Ke as K, Lt as L, Mf as M, Nt as N, Ft$2 as O, Cs as P, rc as Q, Rt as R, Sf as S, Tv as T, Ub as U, Vo$1 as V, Wf as W, Xa as X, Yg as Y, mf as Z, _D as _, a, ND as a0, vD as a1, fu as a2, pu as a3, kD as a4, ED as a5, Ef as a6, gv as a7, Zf as a8, qf as a9, fv as aa, Sv as ab, Kg as ac, widgetsDv8l0Y8_ as ad, bE as b, ud as c, Iv as d, _f as e, _v as f, ge$1 as g, g as h, iD as i, W as j, Ka as k, Mt$2 as l, Ye as m, Se$1 as n, of as o, TE as p, wE as q, jt as r, ec as s, lf as t, uv as u, jD as v, wD as w, yf as x, ye as y, nc as z };
44
+ export { $o as $, Rf as A, Bt as B, xf as C, Df as D, $b as E, Ro as F, Ge as G, Ho as H, ID as I, Ja as J, Ke as K, Lt as L, Mf as M, Nt as N, Ft$2 as O, Cs as P, rc as Q, Rt as R, Sf as S, Tv as T, Ub as U, Vo$1 as V, Wf as W, Xa as X, Yg as Y, mf as Z, _D as _, a, ND as a0, vD as a1, fu as a2, pu as a3, kD as a4, ED as a5, Ef as a6, gv as a7, Zf as a8, qf as a9, fv as aa, Sv as ab, Kg as ac, widgetsCK6j6OOD as ad, bE as b, ud as c, Iv as d, _f as e, _v as f, ge$1 as g, g as h, iD as i, W as j, Ka as k, Mt$2 as l, Ye as m, Se$1 as n, of as o, TE as p, wE as q, jt as r, ec as s, lf as t, uv as u, jD as v, wD as w, yf as x, ye as y, nc as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@letscooee/web-sdk",
3
3
  "description": "Engage uniquely and boost conversions with AI-powered customer journeys driven by real-time intent",
4
- "version": "14.2.13",
4
+ "version": "14.2.14",
5
5
  "scripts": {
6
6
  "postinstall": "bash .dev/setup.sh",
7
7
  "lint": "ng lint",