@letscooee/web-sdk 14.8.15 → 14.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{debugger.component-iU9YqU6y-BlQmgGSF.js → debugger.component-CG_-S7Xf-Ba7jb9DY.js} +1 -1
- package/dist/main.min.js +5 -5
- package/dist/{share-dialog.component-tAmlQZNd-BmLoNJcy.js → share-dialog.component-DKEiudMg-D6mR2OHb.js} +2 -2
- package/dist/{video-detail-dialog.component-zAJXIDWb-BA1XN4T2.js → video-detail-dialog.component-B5lH46XS-B8JpGuln.js} +4 -4
- package/dist/{widgets-BU7J_dgm-5JWw-WWW.js → widgets-CmUGXjul-BcJ9RFFl.js} +4 -4
- package/package.json +1 -1
- /package/dist/{renderer-RvPzZTEd-CX-sySv6.js → renderer-D7IHCPuE-CX-sySv6.js} +0 -0
package/dist/{debugger.component-iU9YqU6y-BlQmgGSF.js → debugger.component-CG_-S7Xf-Ba7jb9DY.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B, M, z as zn } from './main.min.js';
|
|
2
|
-
import { S as SN, g as gf, a, X as XE, I as ID, Y as Yo, V as VD, B as BD, Q as Qo, P as Pf, b as Sv, v as vd, H as HD, c as ge, d as Bv, o as oc, n as np, $ as $v, k as kf, e as Hv, f as fm } from './widgets-
|
|
2
|
+
import { S as SN, g as gf, a, X as XE, I as ID, Y as Yo, V as VD, B as BD, Q as Qo, P as Pf, b as Sv, v as vd, H as HD, c as ge, d as Bv, o as oc, n as np, $ as $v, k as kf, e as Hv, f as fm } from './widgets-CmUGXjul-BcJ9RFFl.js';
|
|
3
3
|
|
|
4
4
|
function P(i,t){if(i&1&&(Yo(0,`li`)(1,`span`,1),Sv(2),Bv(3,`date`),Qo(),Sv(4,`\xA0 `),oc(5,`span`,2),Bv(6,`safeHtml`),Qo()),i&2){let e=t.$implicit;vd(2),np($v(3,2,e.time,`hh:mm:ss a`)),vd(3),kf(`innerHTML`,Hv(6,5,e.message),fm);}}var _=class i{logs=SN.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=Object.defineProperty,l$4=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$3=Object.prototype.propertyIsEnumerable;var i$1=(a,b,c)=>b in a?g(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c,r$2=(a,b)=>{for(var c in b||={})h$3.call(b,c)&&i$1(a,c,b[c]);if(f)for(var c of f(b))j$3.call(b,c)&&i$1(a,c,b[c]);return a},s$2=(a,b)=>l$4(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$2=(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$3.call(a,d)&&(c[d]=a[d]);return c};var v$2=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),w$4=(a,b)=>{for(var c in b)g(a,c,{get:b[c],enumerable:true});},q$4=(a,b,c,d)=>{if(b&&typeof b==`object`||typeof b==`function`)for(let e of o(b))!h$3.call(a,e)&&e!==c&&g(a,e,{get:()=>b[e],enumerable:!(d=m$2(b,e))||d.enumerable});return a};var x$2=(a,b,c)=>(c=a!=null?k$4(p$2(a)):{},q$4(!a||!a.__esModule?g(c,`default`,{value:a,enumerable:true}):c,a));
|
|
2
2
|
|
|
3
|
-
var dt$3=v$2((lt,Be)=>{(function(s){if(typeof lt==`object`&&typeof Be<`u`)Be.exports=s();else if(typeof define==`function`&&define.amd)define([],s);else {var n;typeof window<`u`?n=window:typeof global<`u`?n=global:typeof self<`u`?n=self:n=this,n.localforage=s();}})(function(){return (function u(v,I,w){function R(T,B){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;if(!B&&p)return p(T,true);if(b)return b(T,true);var _=new Error(`Cannot find module '`+T+`'`);throw _.code=`MODULE_NOT_FOUND`,_}var A=I[T]={exports:{}};v[T][0].call(A.exports,function(O){var j=v[T][1][O];return R(j||O)},A,A.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),B=w.document.createTextNode(``);T.observe(B,{characterData:true}),b=function(){B.data=m=++m%2;};}else if(!w.setImmediate&&typeof w.MessageChannel<`u`){var p=new w.MessageChannel;p.port1.onmessage=O,b=function(){p.port2.postMessage(0);};}else `document`in w&&`onreadystatechange`in w.document.createElement(`script`)?b=function(){var M=w.document.createElement(`script`);M.onreadystatechange=function(){O(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null;},w.document.documentElement.appendChild(M);}:b=function(){setTimeout(O,0);};var _,A=[];function O(){_=true;for(var M,z,F=A.length;F;){for(z=A,A=[],M=-1;++M<F;)z[M]();F=A.length;}_=false;}v.exports=j;function j(M){A.push(M)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(u,v,I){var w=u(1);function R(){}var b={},m=[`REJECTED`],T=[`FULFILLED`],B=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=B,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,C){if(typeof y!=`function`&&this.state===T||typeof C!=`function`&&this.state===m)return this;var D=new this.constructor(R);if(this.state!==B)A(D,this.state===T?y:C,this.outcome);else this.queue.push(new _(D,y,C));return D};function _(y,C,D){this.promise=y,typeof C==`function`&&(this.onFulfilled=C,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){A(this.promise,this.onFulfilled,y);},_.prototype.callRejected=function(y){b.reject(this.promise,y);},_.prototype.otherCallRejected=function(y){A(this.promise,this.onRejected,y);};function A(y,C,D){w(function(){var L;try{L=C(D);}catch(k){return b.reject(y,k)}L===y?b.reject(y,new TypeError(`Cannot resolve promise with itself`)):b.resolve(y,L);});}b.resolve=function(y,C){var D=M(O,C);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=C;for(var k=-1,U=y.queue.length;++k<U;)y.queue[k].callFulfilled(C);}return y},b.reject=function(y,C){y.state=m,y.outcome=C;for(var D=-1,L=y.queue.length;++D<L;)y.queue[D].callRejected(C);return y};function O(y){var C=y&&y.then;if(y&&(typeof y==`object`||typeof y==`function`)&&typeof C==`function`)return function(){C.apply(y,arguments);}}function j(y,C){var D=false;function L($){D||(D=true,b.reject(y,$));}function k($){D||(D=true,b.resolve(y,$));}function U(){C(k,L);}var H=M(U);H.status===`error`&&L(H.value);}function M(y,C){var D={};try{D.value=y(C),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 C=new this(R);return b.reject(C,y)}p.all=Ie;function Ie(y){var C=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 k=new Array(D),U=0,H=-1,$=new this(R);++H<D;)K(y[H],H);return $;function K(oe,de){C.resolve(oe).then(Se,function(ee){L||(L=true,b.reject($,ee));});function Se(ee){k[de]=ee,++U===D&&!L&&(L=true,b.resolve($,k));}}}p.race=Z;function Z(y){var C=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 k=-1,U=new this(R);++k<D;)H(y[k]);return U;function H($){C.resolve($).then(function(K){L||(L=true,b.resolve(U,K));},function(K){L||(L=true,b.reject(U,K));});}}},{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 B(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 A(e,r,t){typeof r==`function`&&e.then(r),typeof t==`function`&&e.catch(t);}function O(e){return typeof e!=`string`&&(console.warn(e+` used as a key, but it is not a string.`),e=String(e)),e}function j(){if(arguments.length&&typeof arguments[arguments.length-1]==`function`)return arguments[arguments.length-1]}var M=`local-forage-detect-blob-support`,z=void 0,F={},Ie=Object.prototype.toString,Z=`readonly`,y=`readwrite`;function C(e){for(var r=e.length,t=new ArrayBuffer(r),i=new Uint8Array(t),a=0;a<r;a++)i[a]=e.charCodeAt(a);return t}function D(e){return new p(function(r){var t=e.transaction(M,y),i=B([``]);t.objectStore(M).put(i,`key`),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(false);},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/);r(navigator.userAgent.match(/Edge\//)||!a||parseInt(a[1],10)>=43);};}).catch(function(){return false})}function L(e){return typeof z==`boolean`?p.resolve(z):D(e).then(function(r){return z=r,z})}function k(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 U(e){var t=F[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function H(e,r){var i=F[e.name].deferredOperations.pop();if(i)return i.reject(r),i.promise}function $(e,r){return new p(function(t,i){if(F[e.name]=F[e.name]||$e(),e.db)if(r)k(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var o=m.open.apply(m,a);r&&(o.onupgradeneeded=function(c){var f=o.result;try{f.createObjectStore(e.storeName),c.oldVersion<=1&&f.createObjectStore(M);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+c.oldVersion+` to version `+c.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(c){c.preventDefault(),i(o.error);},o.onsuccess=function(){var c=o.result;c.onversionchange=function(f){f.target.close();},t(c),U(e);};})}function K(e){return $(e,false)}function oe(e){return $(e,true)}function de(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 B([C(atob(e.data))],{type:e.type})}function He(e){return e&&e.__local_forage_encoded_blob}function At(e){var r=this,t=r._initReady().then(function(){var i=F[r._dbInfo.name];if(i&&i.dbReady)return i.dbReady});return A(t,e,e),t}function Ct(e){k(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,K(e).then(function(o){return e.db=o,de(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 H(e,o),o})}function q(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(){q(e,r,t,i-1);})}).catch(t);t(o);}}function $e(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function Nt(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=At);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,K(t)}).then(function(g){return t.db=g,de(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(){q(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),He(g)&&(g=ee(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Lt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){q(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;He(S)&&(S=ee(S));var N=e(S,E.key,g++);N!==void 0?a(N):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ot(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){q(i._dbInfo,y,function(d,g){if(d)return c(d);try{var E=g.objectStore(i._dbInfo.storeName);l===null&&(l=void 0);var S=E.put(l,e);g.oncomplete=function(){l===void 0&&(l=null),o(l);},g.onabort=g.onerror=function(){c(S.error?S.error:S.transaction.error);};}catch(N){c(N);}});}).catch(c);});return _(a,t),a}function Pt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){q(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 Bt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,y,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).clear();c.oncomplete=function(){i();},c.onabort=c.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Mt(e,r){var t=this,i=new p(function(a,o){if(e<0){a(null);return}t.ready().then(function(){q(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 Ft(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(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 kt(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):K(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;k(e);var d=F[e.name],g=d.forages;f.close();for(var E=0;E<g.length;E++){var S=g[E];S._dbInfo.db=null,S._dbInfo.version=l;}return new p(function(x,V){var P=m.open(e.name,l);P.onerror=function(G){P.result.close(),V(G);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var G=P.result;G.close(),x(G);};}).then(function(x){d.db=x;for(var V=0;V<g.length;V++){var P=g[V];P._dbInfo.db=x,U(P._dbInfo);}}).catch(function(x){throw (H(e,x)||p.resolve()).catch(function(){}),x})}}):a=c.then(function(f){k(e);var l=F[e.name],d=l.forages;f.close();for(var g=0;g<d.length;g++){var E=d[g];E._dbInfo.db=null;}return new p(function(N,x){var V=m.deleteDatabase(e.name);V.onerror=function(){var P=V.result;P&&P.close(),x(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(),N(P);};}).then(function(N){l.db=N;for(var x=0;x<d.length;x++){var V=d[x];U(V._dbInfo);}}).catch(function(N){throw (H(e,N)||p.resolve()).catch(function(){}),N})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:Nt,_support:T(),iterate:Lt,getItem:xt,setItem:Ot,removeItem:Pt,clear:Bt,length:Vt,key:Mt,keys:Ft,dropInstance:kt};function Wt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ht=`~~local_forage_type~`,Ge=/^~~local_forage_type~([^~]+)~/,me=`__lfsc__:`,De=me.length,Re=`arbf`,Ae=`blob`,Ye=`si08`,je=`ui08`,ze=`uic8`,Ke=`si16`,qe=`si32`,Xe=`ur16`,Je=`ui32`,Qe=`fl32`,Ze=`fl64`,et=De+Re.length,tt=Object.prototype.toString;function rt(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 Ce(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=tt.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&tt.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=me;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=Ye:t===`[object Uint8Array]`?a+=je:t===`[object Uint8ClampedArray]`?a+=ze:t===`[object Int16Array]`?a+=Ke:t===`[object Uint16Array]`?a+=Xe:t===`[object Int32Array]`?a+=qe:t===`[object Uint32Array]`?a+=Je:t===`[object Float32Array]`?a+=Qe:t===`[object Float64Array]`?a+=Ze:r(new Error(`Failed to get type for BinaryArray`))),r(a+Ce(i));}else if(t===`[object Blob]`){var o=new FileReader;o.onload=function(){var c=Ht+e.type+`~`+Ce(this.result);r(me+Ae+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)!==me)return JSON.parse(e);var r=e.substring(et),t=e.substring(De,et),i;if(t===Ae&&Ge.test(r)){var a=r.match(Ge);i=a[1],r=r.substring(a[0].length);}var o=rt(r);switch(t){case Re:return o;case Ae:return B([o],{type:i});case Ye:return new Int8Array(o);case je:return new Uint8Array(o);case ze:return new Uint8ClampedArray(o);case Ke:return new Int16Array(o);case Xe:return new Uint16Array(o);case qe:return new Int32Array(o);case Je:return new Uint32Array(o);case Qe:return new Float32Array(o);case Ze:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var Ne={serialize:$t,deserialize:Gt,stringToBuffer:rt,bufferToString:Ce};function nt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Yt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=typeof e[i]!=`string`?e[i].toString():e[i];var a=new p(function(o,c){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return c(f)}t.db.transaction(function(f){nt(f,t,function(){r._dbInfo=t,o();},function(l,d){c(d);});},c);});return t.serializer=Ne,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(c,f){f.code===f.SYNTAX_ERR?c.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):nt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(c,f);},o);}function jt(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 zt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var N=g.item(S),x=N.value;if(x&&(x=c.serializer.deserialize(x)),x=e(x,N.key,S+1),x!==void 0){a(x);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function ot(e,r,t,i){var a=this;e=O(e);var o=new p(function(c,f){a.ready().then(function(){r===void 0&&(r=null);var l=r,d=a._dbInfo;d.serializer.serialize(r,function(g,E){E?f(E):d.db.transaction(function(S){J(S,d,`INSERT OR REPLACE INTO `+d.storeName+` (key, value) VALUES (?, ?)`,[e,g],function(){c(l);},function(N,x){f(x);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){c(ot.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function Kt(e,r,t){return ot.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 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,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Jt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(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 Qt(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 Zt(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 er(e){return new p(function(r,t){e.transaction(function(i){i.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'`,[],function(a,o){for(var 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 tr(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;return e.name?a=new p(function(o){var c;e.name===t.name?c=i._dbInfo.db:c=openDatabase(e.name,``,``,0),e.storeName?o({db:c,storeNames:[e.storeName]}):o(er(c));}).then(function(o){return new p(function(c,f){o.db.transaction(function(l){function d(N){return new p(function(x,V){l.executeSql(`DROP TABLE IF EXISTS `+N,[],function(){x();},function(P,G){V(G);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){c();}).catch(function(N){f(N);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var rr={_driver:`webSQLStorage`,_initStorage:Yt,_support:Wt(),iterate:zt,getItem:jt,setItem:Kt,removeItem:qt,clear:Xt,length:Jt,key:Qt,keys:Zt,dropInstance:tr};function nr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function it(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function or(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function ir(){return !or()||localStorage.length>0}function ar(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=it(e,r._defaultConfig),ir()?(r._dbInfo=t,t.serializer=Ne,p.resolve()):p.reject()}function sr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var o=localStorage.key(a);o.indexOf(i)===0&&localStorage.removeItem(o);}});return _(t,e),t}function ur(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo,o=localStorage.getItem(a.keyPrefix+e);return o&&(o=a.serializer.deserialize(o)),o});return _(i,r),i}function cr(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,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 fr(e,r){var t=this,i=t.ready().then(function(){var a=t._dbInfo,o;try{o=localStorage.key(e);}catch{o=null;}return o&&(o=o.substring(a.keyPrefix.length)),o});return _(i,r),i}function lr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],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 dr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function mr(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e);});return _(i,r),i}function gr(e,r,t){var i=this;e=O(e);var a=i.ready().then(function(){r===void 0&&(r=null);var o=r;return new p(function(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 pr(e,r){if(r=j.apply(this,arguments),e=typeof e!=`function`&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName;}var i=this,a;return e.name?a=new p(function(o){e.storeName?o(it(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 hr={_driver:`localStorageWrapper`,_initStorage:ar,_support:nr(),iterate:cr,getItem:ur,setItem:gr,removeItem:mr,clear:sr,length:dr,key:fr,keys:lr,dropInstance:pr},vr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},yr=function(r,t){for(var i=r.length,a=0;a<i;){if(vr(r[a],t))return true;a++;}return false},at=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},ie={},st={},te={INDEXEDDB:Ut,WEBSQL:rr,LOCALSTORAGE:hr},Er=[te.INDEXEDDB._driver,te.WEBSQL._driver,te.LOCALSTORAGE._driver],ge=[`dropInstance`],xe=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(ge),_r={description:``,driver:Er.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function br(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})};}function Le(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(at(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({},_r),this._config=Le({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){});}return e.prototype.config=function(t){if((typeof t>`u`?`undefined`:w(t))===`object`){if(this._ready)return new Error(`Can't call config() after localforage has been used.`);for(var i in t){if(i===`storeName`&&(t[i]=t[i].replace(/\W/g,`_`)),i===`version`&&typeof t[i]!=`number`)return new Error(`Database version must be a number.`);this._config[i]=t[i];}return `driver`in t&&t.driver?this.setDriver(this._config.driver):true}else return typeof t==`string`?this._config[t]:this._config},e.prototype.defineDriver=function(t,i,a){var o=new p(function(c,f){try{var l=t._driver,d=new Error(`Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver`);if(!t._driver){f(d);return}for(var g=xe.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var N=g[E];if((!yr(ge,N)||t[N])&&typeof t[N]!=`function`){f(d);return}}var V=function(){for(var ae=function(Sr){return function(){var Dr=new Error(`Method `+Sr+` is not implemented by the current driver`),ut=p.reject(Dr);return _(ut,arguments[arguments.length-1]),ut}},Oe=0,Ir=ge.length;Oe<Ir;Oe++){var Pe=ge[Oe];t[Pe]||(t[Pe]=ae(Pe));}};V();var P=function(ae){ie[l]&&console.info(`Redefining LocalForage driver: `+l),ie[l]=t,st[l]=ae,c();};`_support`in t?t._support&&typeof t._support==`function`?t._support().then(P,f):P(!!t._support):P(!0);}catch(G){f(G);}});return A(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 A(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(Ne);return A(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 A(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;at(t)||(t=[t]);var c=this._getSupportedDrivers(t);function f(){o._config.driver=o.driver();}function l(E){return o._extend(E),f(),o._ready=o._initStorage(o._config),o._ready}function d(E){return function(){var S=0;function N(){for(;S<E.length;){var x=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(x).then(l).catch(N)}f();var V=new Error(`No available storage method found.`);return o._driverSet=p.reject(V),o._driverSet}return N()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=c[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(c);})}).catch(function(){f();var E=new Error(`No available storage method found.`);return o._driverSet=p.reject(E),o._driverSet}),A(this._driverSet,i,a),this._driverSet},e.prototype.supports=function(t){return !!st[t]},e.prototype._extend=function(t){Le(this,t);},e.prototype._getSupportedDrivers=function(t){for(var i=[],a=0,o=t.length;a<o;a++){var c=t[a];this.supports(c)&&i.push(c);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=xe.length;t<i;t++)br(this,xe[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var Dt$2=v$2((St,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],B,p;for(p=1;p<m.length;p++)for(B in m[p])!(B in T)&&m[p].hasOwnProperty(B)&&(T[B]=m[p][B]);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(_,A){A.name&&_.unshift(`[`+A.name+`]`);};var T={},B=function(p,_){Function.prototype.apply.call(p,console,_);};return typeof console>`u`?function(){}:function(p,_){p=Array.prototype.slice.call(p);var A=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):B(A,[O+`: `+(new Date().getTime()-T[O])+`ms`])):(_.level===n.WARN&&console.warn?A=console.warn:_.level===n.ERROR&&console.error?A=console.error:_.level===n.INFO&&console.info?A=console.info:_.level===n.DEBUG&&console.debug?A=console.debug:_.level===n.TRACE&&console.trace&&(A=console.trace),m.formatter(p,_),B(A,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);})(St);});var Ve$3=x$2(dt$3());function pe$5(s){return Ve$3.default.createInstance({name:`lc`,storeName:s,driver:Ve$3.default.LOCALSTORAGE})}var re$5=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$5=class ce extends re$5{static storeName=`usr`;static visitorOldId=null;static{this.storage=pe$5(this.storeName);}static getVisitorId(){return localStorage.getItem(`lc/${this.storeName}/vid`)}};var Me$2=`14.8.15`;var Fe$4=(function(s){return s[s.WEB=3]=`WEB`,s.WEB_SDK=`WEB_SDK`,s.SHOPIFY_APP=`SHOPIFY_APP`,s.SHOPIFY_THEME_EXTENSION=`SHOPIFY_THEME_EXTENSION`,s})(Fe$4||{});var Cr$3=Me$2.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),Zr$3=Fe$4.WEB_SDK,mt$4=`CooeeSDK`,Q$3=Me$2,en$1=parseInt(Cr$3,10);var tn$1=[`collection`,`product`,`cart`],rn$1=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],nn$1=[`View Item`,`View Cart`,`View Collection`],on$1=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],an$1=`https://cdn.jsdelivr.net/npm/swiper@11`;var gt$3=`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:gt$3,styleURL:`${gt$3}/styles.min.css`};var he$3=class he{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 le$5=class le{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;skipCartAttribute;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.skipCartAttribute=n.skipCartAttribute,this.checkoutProvider=n.checkoutProvider,this.widgetCustomisation=n.widgetCustomisation,this}};var ve$5=class ve extends re$5{static storeName=`ses`;static{this.storage=pe$5(this.storeName);}};var pt$3=5,Nr$4=500,ne$4=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 pn$1(s,n){let h=Date.now(),u;try{u=await xr$4(s,n);}catch{}let v=u?new Request(u.url,{method:n?.method||`GET`}):new Request(s,n);if(!u||!u.ok){let m=`Failed to fetch`;u?.statusText&&(m+=`: ${u.statusText}`);let T=new ne$4(m);throw T.request=v,T.response=u?.clone(),T.status=u?.status,T.requestBody=n?.body,T.responseText=await ht$4(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$4(`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 ht$4(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 xr$4(s,n){let h=null,u;for(let v=0;v<=pt$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<pt$3){let I=Math.pow(2,v)*Nr$4;Y$2.info(`Request to ${s} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(u&&!u.ok)return u;throw h||new Error(`Request failed after retries`)}async function ht$4(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var ye$4={},Ee$4,_e$4,yt$2,Et$3,vt$3;async function _t$3(){if(!_e$4)return vt$3??=Lr$3(),vt$3}async function Lr$3(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-B0xRFvEE.js');Et$3=n;_e$4=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}),_e$4.init();}function ke$1(s,n,h){Y$2.error(`${n}:`,s),_t$3().then(()=>{let u=bt$2(h);if(u.setTag(`operation`,n),s instanceof ne$4){Or$4(u,s,n);return}u.captureException(s);});}function Tn$1(s,n,h){_t$3().then(()=>{bt$2(h).captureMessage(s,n??`error`);});}function Or$4(s,n,h){if(Pr$5(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 Pr$5(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 wn$1(s){yt$2=s;}function In$2(s,n){ye$4[s]=r$2(r$2({},ye$4[s]),n);}function Sn$2(s){Ee$4=r$2(r$2({},Ee$4),s);}function bt$2(s){s??={};let{extra:n,tags:h}=s,u=new Et$3;if(u.setClient(_e$4),u.setUser(yt$2),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$4&&u.setTags(Ee$4),Object.keys(ye$4).forEach(v=>{u.setContext(v,ye$4[v]);}),u.setTag(`language`,navigator.language),u.setTag(`timezone`,Tt$1()),Br$4(u),u}function Br$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 Cn(s){return `(\u23F0 took: ${Ue$1(s)})`}function Ue$1(s){if(s<0)return `${s}ms`;let n=new Date(Date.UTC(0,0,0,0,0,0,s)),h=[];return n.getUTCMinutes()&&h.push(n.getUTCMinutes()+`m`),n.getUTCSeconds()&&h.push(n.getUTCSeconds()+`s`),n.getUTCMilliseconds()&&h.push(n.getUTCMilliseconds()+`ms`),h.length||h.push(`0ms`),h.join(` `)}function We$4(){return window.CooeeSDK.runtimeData}function Ln(){return Ue$1(Date.now()-We$4().sdkLoadTime.getTime())}function $n$1(s){try{return new URL(s)}catch{return}}function Gn$1(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function Yn$1(s,n,h=false){return {[s]:Vr$4(n,h),[s+`_wo_currency`]:n}}function Vr$4(s,n=false){if(s==0&&n)return `Free`;let h=We$4(),u=le$5.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(wt$2(),b);}catch(T){return ke$1(T,`util_currency_format`,{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 jn$1(s){let n=wt$2();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return ke$1(h,`util_number_format`,{extra:{lang:n,value:s}}),s.toString()}}function wt$2(){let s=`en`;return typeof navigator<`u`&&(navigator.languages!==void 0&&navigator.languages.length>0?s=navigator.languages[0]:navigator.language&&(s=navigator.language)),s=s.split(`;`)[0],s=s.split(`-`)[0],s||`en`}var Te$2;function Tt$1(){if(Te$2)return Te$2;try{return Te$2=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$2}catch{return ``}}function It$3(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function zn$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 he$3.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 Kn$1(s,n=10,h=document){return (await Mr$4(s,n,h)).item(0)}async function Fr$1(s){if(le$5.get().skipCartAttribute)return {};let[n,h,u]=await Promise.all([ce$5.get(`did`),ve$5.get(`id`,``),ce$5.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 qn$1(s){let n=await Fr$1(s);return Object.entries(n).map(([h,u])=>({key:h,value:u.toString()}))}function Xn$1(s,n,h,u=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:u,value:h});}function Jn$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$3=x$2(Dt$2());var Y$2=class Y{static debuggerEl;static infoLogs=[];static log(...n){W$3.default.info(...n);}static verbose(...n){W$3.default.debug(...n);}static error(...n){W$3.default.error(...n);}static warn(...n){W$3.default.warn(...n);}static info(...n){W$3.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W$3.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 ro(s=mt$4){W$3.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q$3}):`);}}),kr$5()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W$3.default.setLevel(W$3.default[localStorage.cooeeLogLevel]):W$3.default.setLevel(W$3.default.OFF);}function kr$5(){let s=Rt$4();return s===`1`||s===`on`}function Rt$4(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function no(){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 dt$3=v$2((lt,Be)=>{(function(s){if(typeof lt==`object`&&typeof Be<`u`)Be.exports=s();else if(typeof define==`function`&&define.amd)define([],s);else {var n;typeof window<`u`?n=window:typeof global<`u`?n=global:typeof self<`u`?n=self:n=this,n.localforage=s();}})(function(){return (function u(v,I,w){function R(T,B){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;if(!B&&p)return p(T,true);if(b)return b(T,true);var _=new Error(`Cannot find module '`+T+`'`);throw _.code=`MODULE_NOT_FOUND`,_}var A=I[T]={exports:{}};v[T][0].call(A.exports,function(O){var j=v[T][1][O];return R(j||O)},A,A.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),B=w.document.createTextNode(``);T.observe(B,{characterData:true}),b=function(){B.data=m=++m%2;};}else if(!w.setImmediate&&typeof w.MessageChannel<`u`){var p=new w.MessageChannel;p.port1.onmessage=O,b=function(){p.port2.postMessage(0);};}else `document`in w&&`onreadystatechange`in w.document.createElement(`script`)?b=function(){var M=w.document.createElement(`script`);M.onreadystatechange=function(){O(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null;},w.document.documentElement.appendChild(M);}:b=function(){setTimeout(O,0);};var _,A=[];function O(){_=true;for(var M,z,F=A.length;F;){for(z=A,A=[],M=-1;++M<F;)z[M]();F=A.length;}_=false;}v.exports=j;function j(M){A.push(M)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(u,v,I){var w=u(1);function R(){}var b={},m=[`REJECTED`],T=[`FULFILLED`],B=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=B,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,C){if(typeof y!=`function`&&this.state===T||typeof C!=`function`&&this.state===m)return this;var D=new this.constructor(R);if(this.state!==B)A(D,this.state===T?y:C,this.outcome);else this.queue.push(new _(D,y,C));return D};function _(y,C,D){this.promise=y,typeof C==`function`&&(this.onFulfilled=C,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){A(this.promise,this.onFulfilled,y);},_.prototype.callRejected=function(y){b.reject(this.promise,y);},_.prototype.otherCallRejected=function(y){A(this.promise,this.onRejected,y);};function A(y,C,D){w(function(){var L;try{L=C(D);}catch(k){return b.reject(y,k)}L===y?b.reject(y,new TypeError(`Cannot resolve promise with itself`)):b.resolve(y,L);});}b.resolve=function(y,C){var D=M(O,C);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=C;for(var k=-1,U=y.queue.length;++k<U;)y.queue[k].callFulfilled(C);}return y},b.reject=function(y,C){y.state=m,y.outcome=C;for(var D=-1,L=y.queue.length;++D<L;)y.queue[D].callRejected(C);return y};function O(y){var C=y&&y.then;if(y&&(typeof y==`object`||typeof y==`function`)&&typeof C==`function`)return function(){C.apply(y,arguments);}}function j(y,C){var D=false;function L($){D||(D=true,b.reject(y,$));}function k($){D||(D=true,b.resolve(y,$));}function U(){C(k,L);}var H=M(U);H.status===`error`&&L(H.value);}function M(y,C){var D={};try{D.value=y(C),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 C=new this(R);return b.reject(C,y)}p.all=Ie;function Ie(y){var C=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 k=new Array(D),U=0,H=-1,$=new this(R);++H<D;)K(y[H],H);return $;function K(oe,de){C.resolve(oe).then(Se,function(ee){L||(L=true,b.reject($,ee));});function Se(ee){k[de]=ee,++U===D&&!L&&(L=true,b.resolve($,k));}}}p.race=Z;function Z(y){var C=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 k=-1,U=new this(R);++k<D;)H(y[k]);return U;function H($){C.resolve($).then(function(K){L||(L=true,b.resolve(U,K));},function(K){L||(L=true,b.reject(U,K));});}}},{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 B(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 A(e,r,t){typeof r==`function`&&e.then(r),typeof t==`function`&&e.catch(t);}function O(e){return typeof e!=`string`&&(console.warn(e+` used as a key, but it is not a string.`),e=String(e)),e}function j(){if(arguments.length&&typeof arguments[arguments.length-1]==`function`)return arguments[arguments.length-1]}var M=`local-forage-detect-blob-support`,z=void 0,F={},Ie=Object.prototype.toString,Z=`readonly`,y=`readwrite`;function C(e){for(var r=e.length,t=new ArrayBuffer(r),i=new Uint8Array(t),a=0;a<r;a++)i[a]=e.charCodeAt(a);return t}function D(e){return new p(function(r){var t=e.transaction(M,y),i=B([``]);t.objectStore(M).put(i,`key`),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(false);},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/);r(navigator.userAgent.match(/Edge\//)||!a||parseInt(a[1],10)>=43);};}).catch(function(){return false})}function L(e){return typeof z==`boolean`?p.resolve(z):D(e).then(function(r){return z=r,z})}function k(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 U(e){var t=F[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function H(e,r){var i=F[e.name].deferredOperations.pop();if(i)return i.reject(r),i.promise}function $(e,r){return new p(function(t,i){if(F[e.name]=F[e.name]||$e(),e.db)if(r)k(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var o=m.open.apply(m,a);r&&(o.onupgradeneeded=function(c){var f=o.result;try{f.createObjectStore(e.storeName),c.oldVersion<=1&&f.createObjectStore(M);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+c.oldVersion+` to version `+c.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(c){c.preventDefault(),i(o.error);},o.onsuccess=function(){var c=o.result;c.onversionchange=function(f){f.target.close();},t(c),U(e);};})}function K(e){return $(e,false)}function oe(e){return $(e,true)}function de(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 B([C(atob(e.data))],{type:e.type})}function He(e){return e&&e.__local_forage_encoded_blob}function At(e){var r=this,t=r._initReady().then(function(){var i=F[r._dbInfo.name];if(i&&i.dbReady)return i.dbReady});return A(t,e,e),t}function Ct(e){k(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,K(e).then(function(o){return e.db=o,de(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 H(e,o),o})}function q(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(){q(e,r,t,i-1);})}).catch(t);t(o);}}function $e(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function Nt(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=At);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,K(t)}).then(function(g){return t.db=g,de(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(){q(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),He(g)&&(g=ee(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Lt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){q(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;He(S)&&(S=ee(S));var N=e(S,E.key,g++);N!==void 0?a(N):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ot(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){q(i._dbInfo,y,function(d,g){if(d)return c(d);try{var E=g.objectStore(i._dbInfo.storeName);l===null&&(l=void 0);var S=E.put(l,e);g.oncomplete=function(){l===void 0&&(l=null),o(l);},g.onabort=g.onerror=function(){c(S.error?S.error:S.transaction.error);};}catch(N){c(N);}});}).catch(c);});return _(a,t),a}function Pt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){q(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 Bt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,y,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).clear();c.oncomplete=function(){i();},c.onabort=c.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Mt(e,r){var t=this,i=new p(function(a,o){if(e<0){a(null);return}t.ready().then(function(){q(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 Ft(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(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 kt(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):K(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;k(e);var d=F[e.name],g=d.forages;f.close();for(var E=0;E<g.length;E++){var S=g[E];S._dbInfo.db=null,S._dbInfo.version=l;}return new p(function(x,V){var P=m.open(e.name,l);P.onerror=function(G){P.result.close(),V(G);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var G=P.result;G.close(),x(G);};}).then(function(x){d.db=x;for(var V=0;V<g.length;V++){var P=g[V];P._dbInfo.db=x,U(P._dbInfo);}}).catch(function(x){throw (H(e,x)||p.resolve()).catch(function(){}),x})}}):a=c.then(function(f){k(e);var l=F[e.name],d=l.forages;f.close();for(var g=0;g<d.length;g++){var E=d[g];E._dbInfo.db=null;}return new p(function(N,x){var V=m.deleteDatabase(e.name);V.onerror=function(){var P=V.result;P&&P.close(),x(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(),N(P);};}).then(function(N){l.db=N;for(var x=0;x<d.length;x++){var V=d[x];U(V._dbInfo);}}).catch(function(N){throw (H(e,N)||p.resolve()).catch(function(){}),N})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:Nt,_support:T(),iterate:Lt,getItem:xt,setItem:Ot,removeItem:Pt,clear:Bt,length:Vt,key:Mt,keys:Ft,dropInstance:kt};function Wt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ht=`~~local_forage_type~`,Ge=/^~~local_forage_type~([^~]+)~/,me=`__lfsc__:`,De=me.length,Re=`arbf`,Ae=`blob`,Ye=`si08`,je=`ui08`,ze=`uic8`,Ke=`si16`,qe=`si32`,Xe=`ur16`,Je=`ui32`,Qe=`fl32`,Ze=`fl64`,et=De+Re.length,tt=Object.prototype.toString;function rt(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 Ce(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=tt.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&tt.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=me;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=Ye:t===`[object Uint8Array]`?a+=je:t===`[object Uint8ClampedArray]`?a+=ze:t===`[object Int16Array]`?a+=Ke:t===`[object Uint16Array]`?a+=Xe:t===`[object Int32Array]`?a+=qe:t===`[object Uint32Array]`?a+=Je:t===`[object Float32Array]`?a+=Qe:t===`[object Float64Array]`?a+=Ze:r(new Error(`Failed to get type for BinaryArray`))),r(a+Ce(i));}else if(t===`[object Blob]`){var o=new FileReader;o.onload=function(){var c=Ht+e.type+`~`+Ce(this.result);r(me+Ae+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)!==me)return JSON.parse(e);var r=e.substring(et),t=e.substring(De,et),i;if(t===Ae&&Ge.test(r)){var a=r.match(Ge);i=a[1],r=r.substring(a[0].length);}var o=rt(r);switch(t){case Re:return o;case Ae:return B([o],{type:i});case Ye:return new Int8Array(o);case je:return new Uint8Array(o);case ze:return new Uint8ClampedArray(o);case Ke:return new Int16Array(o);case Xe:return new Uint16Array(o);case qe:return new Int32Array(o);case Je:return new Uint32Array(o);case Qe:return new Float32Array(o);case Ze:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var Ne={serialize:$t,deserialize:Gt,stringToBuffer:rt,bufferToString:Ce};function nt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Yt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=typeof e[i]!=`string`?e[i].toString():e[i];var a=new p(function(o,c){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return c(f)}t.db.transaction(function(f){nt(f,t,function(){r._dbInfo=t,o();},function(l,d){c(d);});},c);});return t.serializer=Ne,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(c,f){f.code===f.SYNTAX_ERR?c.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):nt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(c,f);},o);}function jt(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 zt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var N=g.item(S),x=N.value;if(x&&(x=c.serializer.deserialize(x)),x=e(x,N.key,S+1),x!==void 0){a(x);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function ot(e,r,t,i){var a=this;e=O(e);var o=new p(function(c,f){a.ready().then(function(){r===void 0&&(r=null);var l=r,d=a._dbInfo;d.serializer.serialize(r,function(g,E){E?f(E):d.db.transaction(function(S){J(S,d,`INSERT OR REPLACE INTO `+d.storeName+` (key, value) VALUES (?, ?)`,[e,g],function(){c(l);},function(N,x){f(x);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){c(ot.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function Kt(e,r,t){return ot.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 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,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Jt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(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 Qt(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 Zt(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 er(e){return new p(function(r,t){e.transaction(function(i){i.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'`,[],function(a,o){for(var 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 tr(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;return e.name?a=new p(function(o){var c;e.name===t.name?c=i._dbInfo.db:c=openDatabase(e.name,``,``,0),e.storeName?o({db:c,storeNames:[e.storeName]}):o(er(c));}).then(function(o){return new p(function(c,f){o.db.transaction(function(l){function d(N){return new p(function(x,V){l.executeSql(`DROP TABLE IF EXISTS `+N,[],function(){x();},function(P,G){V(G);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){c();}).catch(function(N){f(N);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var rr={_driver:`webSQLStorage`,_initStorage:Yt,_support:Wt(),iterate:zt,getItem:jt,setItem:Kt,removeItem:qt,clear:Xt,length:Jt,key:Qt,keys:Zt,dropInstance:tr};function nr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function it(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function or(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function ir(){return !or()||localStorage.length>0}function ar(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=it(e,r._defaultConfig),ir()?(r._dbInfo=t,t.serializer=Ne,p.resolve()):p.reject()}function sr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var o=localStorage.key(a);o.indexOf(i)===0&&localStorage.removeItem(o);}});return _(t,e),t}function ur(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo,o=localStorage.getItem(a.keyPrefix+e);return o&&(o=a.serializer.deserialize(o)),o});return _(i,r),i}function cr(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,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 fr(e,r){var t=this,i=t.ready().then(function(){var a=t._dbInfo,o;try{o=localStorage.key(e);}catch{o=null;}return o&&(o=o.substring(a.keyPrefix.length)),o});return _(i,r),i}function lr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],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 dr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function mr(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e);});return _(i,r),i}function gr(e,r,t){var i=this;e=O(e);var a=i.ready().then(function(){r===void 0&&(r=null);var o=r;return new p(function(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 pr(e,r){if(r=j.apply(this,arguments),e=typeof e!=`function`&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName;}var i=this,a;return e.name?a=new p(function(o){e.storeName?o(it(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 hr={_driver:`localStorageWrapper`,_initStorage:ar,_support:nr(),iterate:cr,getItem:ur,setItem:gr,removeItem:mr,clear:sr,length:dr,key:fr,keys:lr,dropInstance:pr},vr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},yr=function(r,t){for(var i=r.length,a=0;a<i;){if(vr(r[a],t))return true;a++;}return false},at=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},ie={},st={},te={INDEXEDDB:Ut,WEBSQL:rr,LOCALSTORAGE:hr},Er=[te.INDEXEDDB._driver,te.WEBSQL._driver,te.LOCALSTORAGE._driver],ge=[`dropInstance`],xe=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(ge),_r={description:``,driver:Er.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function br(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})};}function Le(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(at(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({},_r),this._config=Le({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){});}return e.prototype.config=function(t){if((typeof t>`u`?`undefined`:w(t))===`object`){if(this._ready)return new Error(`Can't call config() after localforage has been used.`);for(var i in t){if(i===`storeName`&&(t[i]=t[i].replace(/\W/g,`_`)),i===`version`&&typeof t[i]!=`number`)return new Error(`Database version must be a number.`);this._config[i]=t[i];}return `driver`in t&&t.driver?this.setDriver(this._config.driver):true}else return typeof t==`string`?this._config[t]:this._config},e.prototype.defineDriver=function(t,i,a){var o=new p(function(c,f){try{var l=t._driver,d=new Error(`Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver`);if(!t._driver){f(d);return}for(var g=xe.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var N=g[E];if((!yr(ge,N)||t[N])&&typeof t[N]!=`function`){f(d);return}}var V=function(){for(var ae=function(Sr){return function(){var Dr=new Error(`Method `+Sr+` is not implemented by the current driver`),ut=p.reject(Dr);return _(ut,arguments[arguments.length-1]),ut}},Oe=0,Ir=ge.length;Oe<Ir;Oe++){var Pe=ge[Oe];t[Pe]||(t[Pe]=ae(Pe));}};V();var P=function(ae){ie[l]&&console.info(`Redefining LocalForage driver: `+l),ie[l]=t,st[l]=ae,c();};`_support`in t?t._support&&typeof t._support==`function`?t._support().then(P,f):P(!!t._support):P(!0);}catch(G){f(G);}});return A(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 A(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(Ne);return A(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 A(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;at(t)||(t=[t]);var c=this._getSupportedDrivers(t);function f(){o._config.driver=o.driver();}function l(E){return o._extend(E),f(),o._ready=o._initStorage(o._config),o._ready}function d(E){return function(){var S=0;function N(){for(;S<E.length;){var x=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(x).then(l).catch(N)}f();var V=new Error(`No available storage method found.`);return o._driverSet=p.reject(V),o._driverSet}return N()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=c[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(c);})}).catch(function(){f();var E=new Error(`No available storage method found.`);return o._driverSet=p.reject(E),o._driverSet}),A(this._driverSet,i,a),this._driverSet},e.prototype.supports=function(t){return !!st[t]},e.prototype._extend=function(t){Le(this,t);},e.prototype._getSupportedDrivers=function(t){for(var i=[],a=0,o=t.length;a<o;a++){var c=t[a];this.supports(c)&&i.push(c);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=xe.length;t<i;t++)br(this,xe[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var Dt$2=v$2((St,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],B,p;for(p=1;p<m.length;p++)for(B in m[p])!(B in T)&&m[p].hasOwnProperty(B)&&(T[B]=m[p][B]);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(_,A){A.name&&_.unshift(`[`+A.name+`]`);};var T={},B=function(p,_){Function.prototype.apply.call(p,console,_);};return typeof console>`u`?function(){}:function(p,_){p=Array.prototype.slice.call(p);var A=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):B(A,[O+`: `+(new Date().getTime()-T[O])+`ms`])):(_.level===n.WARN&&console.warn?A=console.warn:_.level===n.ERROR&&console.error?A=console.error:_.level===n.INFO&&console.info?A=console.info:_.level===n.DEBUG&&console.debug?A=console.debug:_.level===n.TRACE&&console.trace&&(A=console.trace),m.formatter(p,_),B(A,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);})(St);});var Ve$3=x$2(dt$3());function pe$5(s){return Ve$3.default.createInstance({name:`lc`,storeName:s,driver:Ve$3.default.LOCALSTORAGE})}var re$5=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$5=class ce extends re$5{static storeName=`usr`;static visitorOldId=null;static{this.storage=pe$5(this.storeName);}static getVisitorId(){return localStorage.getItem(`lc/${this.storeName}/vid`)}};var Me$2=`14.8.16`;var Fe$4=(function(s){return s[s.WEB=3]=`WEB`,s.WEB_SDK=`WEB_SDK`,s.SHOPIFY_APP=`SHOPIFY_APP`,s.SHOPIFY_THEME_EXTENSION=`SHOPIFY_THEME_EXTENSION`,s})(Fe$4||{});var Cr$3=Me$2.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),Zr$3=Fe$4.WEB_SDK,mt$4=`CooeeSDK`,Q$3=Me$2,en$1=parseInt(Cr$3,10);var tn$1=[`collection`,`product`,`cart`],rn$1=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],nn$1=[`View Item`,`View Cart`,`View Collection`],on$1=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],an$1=`https://cdn.jsdelivr.net/npm/swiper@11`;var gt$3=`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:gt$3,styleURL:`${gt$3}/styles.min.css`};var he$3=class he{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 le$5=class le{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;skipCartAttribute;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.skipCartAttribute=n.skipCartAttribute,this.checkoutProvider=n.checkoutProvider,this.widgetCustomisation=n.widgetCustomisation,this}};var ve$5=class ve extends re$5{static storeName=`ses`;static{this.storage=pe$5(this.storeName);}};var pt$3=5,Nr$4=500,ne$4=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 pn$1(s,n){let h=Date.now(),u;try{u=await xr$4(s,n);}catch{}let v=u?new Request(u.url,{method:n?.method||`GET`}):new Request(s,n);if(!u||!u.ok){let m=`Failed to fetch`;u?.statusText&&(m+=`: ${u.statusText}`);let T=new ne$4(m);throw T.request=v,T.response=u?.clone(),T.status=u?.status,T.requestBody=n?.body,T.responseText=await ht$4(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$4(`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 ht$4(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 xr$4(s,n){let h=null,u;for(let v=0;v<=pt$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<pt$3){let I=Math.pow(2,v)*Nr$4;Y$2.info(`Request to ${s} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(u&&!u.ok)return u;throw h||new Error(`Request failed after retries`)}async function ht$4(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var ye$4={},Ee$4,_e$4,yt$2,Et$3,vt$3;async function _t$3(){if(!_e$4)return vt$3??=Lr$3(),vt$3}async function Lr$3(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-B0xRFvEE.js');Et$3=n;_e$4=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}),_e$4.init();}function ke$1(s,n,h){Y$2.error(`${n}:`,s),_t$3().then(()=>{let u=bt$2(h);if(u.setTag(`operation`,n),s instanceof ne$4){Or$4(u,s,n);return}u.captureException(s);});}function Tn$1(s,n,h){_t$3().then(()=>{bt$2(h).captureMessage(s,n??`error`);});}function Or$4(s,n,h){if(Pr$5(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 Pr$5(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 wn$1(s){yt$2=s;}function In$2(s,n){ye$4[s]=r$2(r$2({},ye$4[s]),n);}function Sn$2(s){Ee$4=r$2(r$2({},Ee$4),s);}function bt$2(s){s??={};let{extra:n,tags:h}=s,u=new Et$3;if(u.setClient(_e$4),u.setUser(yt$2),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$4&&u.setTags(Ee$4),Object.keys(ye$4).forEach(v=>{u.setContext(v,ye$4[v]);}),u.setTag(`language`,navigator.language),u.setTag(`timezone`,Tt$1()),Br$4(u),u}function Br$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 Cn(s){return `(\u23F0 took: ${Ue$1(s)})`}function Ue$1(s){if(s<0)return `${s}ms`;let n=new Date(Date.UTC(0,0,0,0,0,0,s)),h=[];return n.getUTCMinutes()&&h.push(n.getUTCMinutes()+`m`),n.getUTCSeconds()&&h.push(n.getUTCSeconds()+`s`),n.getUTCMilliseconds()&&h.push(n.getUTCMilliseconds()+`ms`),h.length||h.push(`0ms`),h.join(` `)}function We$4(){return window.CooeeSDK.runtimeData}function Ln(){return Ue$1(Date.now()-We$4().sdkLoadTime.getTime())}function $n$1(s){try{return new URL(s)}catch{return}}function Gn$1(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function Yn$1(s,n,h=false){return {[s]:Vr$4(n,h),[s+`_wo_currency`]:n}}function Vr$4(s,n=false){if(s==0&&n)return `Free`;let h=We$4(),u=le$5.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(wt$2(),b);}catch(T){return ke$1(T,`util_currency_format`,{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 jn$1(s){let n=wt$2();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return ke$1(h,`util_number_format`,{extra:{lang:n,value:s}}),s.toString()}}function wt$2(){let s=`en`;return typeof navigator<`u`&&(navigator.languages!==void 0&&navigator.languages.length>0?s=navigator.languages[0]:navigator.language&&(s=navigator.language)),s=s.split(`;`)[0],s=s.split(`-`)[0],s||`en`}var Te$2;function Tt$1(){if(Te$2)return Te$2;try{return Te$2=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$2}catch{return ``}}function It$3(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function zn$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 he$3.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 Kn$1(s,n=10,h=document){return (await Mr$4(s,n,h)).item(0)}async function Fr$1(s){if(le$5.get().skipCartAttribute)return {};let[n,h,u]=await Promise.all([ce$5.get(`did`),ve$5.get(`id`,``),ce$5.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 qn$1(s){let n=await Fr$1(s);return Object.entries(n).map(([h,u])=>({key:h,value:u.toString()}))}function Xn$1(s,n,h,u=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:u,value:h});}function Jn$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$3=x$2(Dt$2());var Y$2=class Y{static debuggerEl;static infoLogs=[];static log(...n){W$3.default.info(...n);}static verbose(...n){W$3.default.debug(...n);}static error(...n){W$3.default.error(...n);}static warn(...n){W$3.default.warn(...n);}static info(...n){W$3.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W$3.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 ro(s=mt$4){W$3.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q$3}):`);}}),kr$5()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W$3.default.setLevel(W$3.default[localStorage.cooeeLogLevel]):W$3.default.setLevel(W$3.default.OFF);}function kr$5(){let s=Rt$4();return s===`1`||s===`on`}function Rt$4(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function no(){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
|
|
@@ -80,8 +80,8 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {
|
|
|
80
80
|
<span class="${n}"
|
|
81
81
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
82
82
|
</span>
|
|
83
|
-
`},navigation:{nextEl:r.querySelector(`.swiper-button-next`),prevEl:r.querySelector(`.swiper-button-prev`)},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:false,pauseOnMouseEnter:false}:false,autoHeight:true};e.marquee&&t.autoplay&&typeof t.autoplay==`object`&&(t.speed=e.speed,t.autoplay.pauseOnMouseEnter=true,r.style.setProperty(`--swiper-wrapper-transition-timing-function`,`linear`));let o=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),o}function ir$1(r,e,t){let o={color:r.navigation.color?.rgba};return r.pagination.enabled&&(o.transform=`translateY(-25%)`),l$2(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[l$2(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&l$2(`div`,{class:`swiper-button-next`,style:o,children:l$2(`span`,{})}),r.navigation.enabled&&l$2(`div`,{class:`swiper-button-prev`,style:o,children:l$2(`span`,{})}),r.pagination.enabled&&l$2(`div`,{className:`swiper-pagination`,style:{color:r.pagination.color?.rgba}})]})}var cd=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Ur=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 it=class extends w$1{componentDidMount(){rt$2(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-checkbox`),children:l$2(`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 W$2;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s$2(r$2({},this.getTypoStyles()),{display:`flex`})}};var ne$1=class ne extends w$1{constructor(e,t){super(e,t);}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return l$2(`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 ie$1=class ie extends w$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$2(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new gt$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 st$1=class st extends ie$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$2(je$1,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})})}};var at$1=class at extends w$1{render(){return l$2(`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(){rt$2(()=>{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),On$1(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$2(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let o of t.sellingPlans??[])e.push(l$2(`option`,{value:o.mID,selected:o.isSelected,children:o.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(o=>o.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var mi=new RegExp(`fill="#[a-zA-Z0-9]+"`),ct$1=class ct extends w$1{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),l$2(`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),o=Fe$3(this.props.element.halfStart,{svg:e},this.props.triggerContext),n=this.props.review;if(!n?.rating)return ``;let i=``;if(this.props.element.showSingleStar)i=t;else {let s=5,c=`${n.rating}`.split(`.`);for(let p=0;p<+c[0];p++)i+=t,s--;c[1]&&(i+=o,s--);for(let p=0;p<s;p++)i+=t.replace(mi,`fill="#f1f1f1"`);}return i}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var lt$1=class lt extends w$1{render(){return l$2(`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(){rt$2(()=>{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),On$1(this.mediaStyle.typo))}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(l$2(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,o=this.props.item.vars.find(n=>n.mID===t);this.props.item.setSelectedVariant(o);}};var je$1=class je extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return t.l===`Star Rating`&&!this.props.item.reviews?.rating?void 0:l$2(st$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})}if(e.t===6){let t=this.props.triggerContext,o=t.triggerData;return o.isBundle()||o.isAddOns()?l$2(it,{element:e,item:this.props.item,triggerContext:t}):void 0}if(e.t===8){let t=e;if(!t.templateName)return ``;try{if(!/^[a-zA-Z0-9_-]+$/.test(t.templateName))return Y$2.error(`Invalid partial template name`,t.templateName),``;let o=Fe$3(`{{ @include("${t.templateName}", it) /}}`,this.props.productVariables??{});return l$2(`div`,{className:`lc-partial-`+t.templateName,dangerouslySetInnerHTML:{__html:o}})}catch(o){return Y$2.error(`Failed to render partial element`,t.templateName,this.props.productVariables,o),``}}if(e.t===13){let t=e,o=this.props.item,n=Ur(o.variantImage??o.firstImageURL),i=Ur(o.variantSecondaryImage??o.secondaryImageURL);t.lg=t.sm={src:n,name:o.name,secondarySrc:i};let s=l$2(ne$1,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:l$2(`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$2(`cooee-product-options-picker`,{item:this.props.item,styles:t.style,horizontal:t.horizontal,dropdownType:t.type}):l$2(lt$1,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?l$2(at$1,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?l$2(ct$1,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?l$2(Se$1,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):l$2(ge,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}renderProductTitle(e){let t=l$2(F,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:l$2(`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 o=t.detail.variantID;this.props.item.setSelectedVariantByID(o);});}};var Ie$1=class Ie extends w$1{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){let e=this.props.item,t=this.getProductData();if(this.productElement=new pe$1(We$3(this.props.element,t,this.props.triggerContext)),this.productElement.hide||!this.matchWhenCondition(this.productElement.when))return;let n=this.getClasses([`lc-single-product`,...e.cardClasses??[]].join(` `));return l$2(`div`,{style:r$2({},this.getCompiledStyles()),className:n,children:l$2(je$1,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:t,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,o=e.getTemplateVariables();o.product.quantity=this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount?.type===H$1.BXGY;return !t.hasEffectivePrice()&&n&&(o.product=s$2(r$2(r$2({},o.product),Yn$1(`effective_price`,t.effectivePrice.value)),{price:``})),o.variant.quantity=t.quantity,{product:o.product,variant:o.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var mt$1=class mt extends w$1{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$3()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+`px`;}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Vi$2().then(()=>{this.swiperInstance=nr(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 o=i=>{this.swiperRef=i;},n=()=>e?.map(i=>l$2(`div`,{class:`swiper-slide`,children:this.getProductFragment(i)}));t=l$2(`div`,{style:s$2(r$2({},this.getCompiledStyles()),{display:`block`}),className:this.getClasses(`lc-product-swiper-list`),children:ir$1(this.configuration,o,n)});}else t=l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-product-list`),children:e?.map((o,n)=>this.getProductFragment(o,n!==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 o=this.props.triggerContext.triggerData,n=o.items.length,i;o.isBundle()?i=this.props.element.prod.symbol?.hide!==true?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${i}, auto)`;}}return t}getProductFragment(e,t=false){return l$2(ct$3,{children:[l$2(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$2(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:l$2(F,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var pt$1=class pt extends w$1{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$2().then(()=>{this.swiperInstance=nr(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=n=>{this.swiperRef=n;},o=()=>{let n=e.values?.map(c=>l$2(`div`,{class:`swiper-slide`,onClick:p=>this.onClick(p,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!n?.length)return [];let i=e.conf,s=n.length;if(i.marquee&&s<=Number(i.maxInRow)){let c=Number(i.maxInRow)-s+1;for(let p=0;p<c;p++)n.push(n[p%s]);}return n};return ir$1(e.conf,t,o)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return l$2(ne$1,{element:t,triggerContext:this.props.triggerContext});case 4:return l$2(ie$1,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$2.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let o=We$3(e,{form:t},this.props.triggerContext);return B$2.getParsedElement(o)}getClickAction(e){return We$3(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var ge=class extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),rt$2(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}));});}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return l$2(ie$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return l$2(nt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?l$2(Se$1,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return l$2(F,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return l$2(ne$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return l$2(mt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return l$2(Ie$1,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return l$2(pt$1,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var dt$1=class dt extends w$1{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he$2.GO_TO_URL&&!!$n$1(this.clickAction.gu?.u)||this.clickAction?.at===he$2.OPEN_CART||this.clickAction?.at===he$2.INITIATE_CHECKOUT;}componentDidMount(){rt$2(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return l$2(ct$3,{children:[l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-container`),onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:l$2(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&l$2(`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 _=class r$9{constructor(e){this.engagementTrigger=e;this.triggerContext=new Be$1(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];parentOuterShadowElement;renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;lockReleased$=new U$1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ke$1(e,`widget_render`,{triggerContext:this.triggerContext});});}destroy(){Y$2.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$9.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Mi$2(this.engagementTrigger.content?.afterDeleteJS);}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e);}if(this.rootContainer=await this.getWidgetContainer(true),!this.rootContainer){Y$2.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,Mi$2(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){await this.waitForLockRelease(),this.acquireProcessingLock();try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render();}finally{this.releaseProcessingLock();}}async update(e){this.engagementTrigger.variation=e.variation;}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){Y$2.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render();}finally{this.releaseProcessingLock();}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),true):false}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect();});}acquireProcessingLock(){return this.isProcessing?(Y$2.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$2.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$2.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false,this.lockReleased$.next();}async waitForLockRelease(){this.isProcessing&&await le$2(this.lockReleased$);}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$2.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e);}handleVariationResponse(e){if(!e)return;let t=this.engagementTrigger;Y$2.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(o=>new vt$2(o)),t.nonMutableItems=e.items.map(o=>new vt$2(o))),e.bundleFrom&&(t.bundleFrom=new vt$2(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),he$3.hasKeys(e.stickyATCConfig)&&(t.stickyATCConfig=e.stickyATCConfig),e.props&&he$3.hasKeys(e.props)&&(t.props=r$2(r$2({},t.props),e.props)),e.content&&(t.content=new et(e.content)),t.widget=new He$1(e.widget),t.contentID=e.contentID,t.variation=e.variation,t.placement=e.placement,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 ${Jn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof G?Te.delete(this):Ke$1.delete(this);}async getVariation(){Y$2.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await on(e)).data}catch(t){t instanceof ne$4&&t.response?.status;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(o=>{let n=new IntersectionObserver((i,s)=>{i.forEach(async c=>{if(c.isIntersecting){Y$2.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);o(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);n.observe(this.rootContainer),this.observers.push(n);})}attachScroll(){this.scrollSubscription=Tr$2(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 o={};this.triggerContext.triggerData.items?.length&&(o.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=new Ir$3(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,o,this.engagementTrigger);i.name===`CE Campaign Holdout`&&(i.trigger.holdout=true),we$1(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 o=t.getElementById(e);if(o)return o;let n=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),i=this.engagementTrigger.shortID;o=document.createElement(`div`),o.id=e;let s=`letscooee letscooee-engagement engagement-${i} lc-${n}`;return this.engagementTrigger.content?.classes&&(s+=` ${this.engagementTrigger.content.classes}`),o.className=s,o.dataset.engagementId=i,this.engagementTrigger.id===`preview`&&(o.className+=` letscooee-preview`),o.style.display=`block`,o.style.minHeight=`0.5px`,o.style.minWidth=`0.5px`,o}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 o=this.engagementTrigger.widget;$e$2(Yr$2(dt$1,{element:o.cont,triggerContext:this.triggerContext,elements:o.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let o=this.engagementTrigger.content?.outerCSS?.trim()??``,n=this.engagementTrigger.content?.innerCSS?.trim()??``,i=this.engagementTrigger.content?.globalCSS?.trim()??``;if(i&&le$4(i),!o&&!n)return;let s=this.rootContainer.id;if(e){le$4(n,t),this.injectOuterCSSOnly();return}le$4(`#${s} { ${o+`
|
|
84
|
-
${n}`} }`,this.parentOuterShadowElement);}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 o=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(o)}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 o=t.selector,n;if(o.includes(`:shadow`)){let p=o.split(`:shadow`);n=(await Kn$1(p[0].trim()))?.shadowRoot,o=p[1].trim(),n&&(this.parentOuterShadowElement=n,Hi$2(n,false));}Y$2.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${o}"`);let i=await Kn$1(o,3,n??document);if(!i)return Y$2.warn(`${this.engagementTrigger} no placement found with ${o}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case fe$2.BEFORE1:case fe$2.BEFORE:i.parentElement?.insertBefore(c,i);break;case fe$2.INSIDE_FIRST1:case fe$2.INSIDE_FIRST:i.insertBefore(c,i.firstChild);break;case fe$2.INSIDE_LAST1:case fe$2.INSIDE_LAST:i.appendChild(c);break;case fe$2.AFTER1:case fe$2.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 tr$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 o=this.getItemDiff(e,t),n=this.getItemDiff(t,e);t.push(...o);for(let i of n)re$1.remove(t,i);}getItemDiff(e,t){return e.filter(o=>!t.some(n=>n.selectedOrFirstVariant.value.mID===o.selectedOrFirstVariant.value.mID))}};var G=class extends _{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(!D$1.get().isOpen()&&We$4().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 sr$1=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=h.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$2.warn(`No placement available for ${e.objective}`,e.shortID);return}let o=Array.from(document.querySelectorAll(t.selector));if(!o?.length){Y$2.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let n of o)new r(e,n).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 o=t.vars.find(d=>d.mID===e.id.toString());if(!o)return;let n=new mt$3(o),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of n.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=true,n.changeSellingPlan(d));let s=new vt$2(t);s.vars=[n],s.selectedOrFirstVariant.value=n;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let p=new q$1(this.engagementTrigger);p.placement.selector=`.${c}`,p.items=[s];let u=new G(p);u.renderSilently(),this.watchForCartItemDeletion(u,c);}watchForCartItemDeletion(e,t){let o=new MutationObserver(n=>{n.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(Y$2.verbose(`${t} has been removed`),e.destroy(),o.disconnect());});});});o.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 o=t.selling_plan_allocation?.selling_plan?.name;return !(o&&!e.includes(o))})}};var ar$1=class ar extends _{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var cr$1=class cr extends G{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){ke$1(e,`progressbar_milestones_apply`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await h.getCurrent().getNormalisedCart(true),t=this.engagementTrigger.progressBarConfig,o=[],n=[],i=[],s,c,p=[...t.milestones];for(let u of p){if(u.rewardType!==ve$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],C=u.reached,I=e.items.find(g=>(g.vID===d.vID||g.mID===d.mID)&&g.properties._letscooee_campaign===this.engagementTrigger.shortID);C&&(s=u,c=I),I&&o.push(I),!C&&I&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${I.vID} from cart`),i.push(I)):C&&!I&&(Y$2.verbose(`Adding free gift ${d.vID} to cart`),n.push(d));}t.restrictToLatestFreebie&&s&&(c?(o=o.filter(u=>u.vID!==c.vID),n=[]):n=[s.items[0]],i.push(...o)),t.treatFreebieAsSeparateLineItem?await this.handleSeparateFreebieLineItems(n,i):await this.handleCombinedCartUpdate(n,i);}async handleSeparateFreebieLineItems(e,t){if(!t.length&&!e.length)return;let o=new de$1,n=[];if(e.length){let c=this.addFreebiesOperation(e,o);n.push(c);}if(t.length){let c=this.removeFreebiesOperation(t);n.push(c);}if(!n.length)return;let i;try{i=await Promise.all(n),Y$2.log(`All freebie and coupon operations completed`);}catch(c){ke$1(c,`progressbar_freebie_ops_parallel`,{engagementTrigger:this.engagementTrigger});}let s;e.length&&i?.length&&(s=i[0]),D$1.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(o=>t.updates[o.key??o.vID]=o.quantity-1),kr$1(t,this.engagementTrigger)}async addFreebiesOperation(e,t){return t.addToCart(e,this.engagementTrigger)}async handleCombinedCartUpdate(e,t){let o=this.engagementTrigger.progressBarConfig,n={},i={};t.length&&t.forEach(C=>i[C.key??C.vID]=0),e.length&&e.forEach(C=>i[C.vID]=1);let s=o.coupons,c=[];if(s?.length){c=s.map(g=>g.couponCode);let C=h.getCurrent().discount_codes?.map(g=>g.code)??[];c.every(g=>C.some(y=>y===g))||(n.discount=c.join(`,`));}if(he$3.hasKeys(i)&&(n.updates=i),!he$3.hasKeys(n))return;let p=await kr$1(n,this.engagementTrigger),u=p?.items,d=[];for(let C of e){let I=u?.find(g=>c?.length?g.id+``===C.vID&&g.discounts?.some(y=>c.includes(y.title)):g.id+``===C.vID);I&&d.push(I);}if(!d.length){D$1.get().refreshUI(p,false);return}try{await Promise.all(d.map(C=>tn(C,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(C){ke$1(C,`progressbar_private_attr_add`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{D$1.get().refreshUI(p,false);}}};var gt$1=class gt extends G{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 lr$1=class lr extends _{constructor(e){super(e);}isAllOkToRender(){return !!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e;this.engagementTrigger.isFloatingVideo()?e=`cooee-video-popup`:this.engagementTrigger.isVideoStory()?e=`cooee-video-stories`:e=`cooee-video-playlist`,this.createAngularWidget(e);}};var mr$1=class mr extends _{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var pr$1=class pr extends _{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,o=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,n=e.detail;if(!he$3.hasKeys(n)){Y$2.error(`No detail received for ${o}`);return}Y$2.log(`Detail received for BYOB`,n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==t.shortID&&i!==t.engagementID){Y$2.warn(`Current ${o} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let c=s.map(p=>new pt$2({mID:p.product_id,vID:p.variant_id,quantity:p.quantity||1}));await new Ge$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$2.ADD_BUNDLE,applyDiscount:true}});}};var dr$1=class dr extends _{cartChangeSubscription;isProcessingAddOns=false;afterRootContainerCreated(){this.cartChangeSubscription&&!this.cartChangeSubscription.closed||this.listenCartChange();}preDestroy(){super.preDestroy(),this.cartChangeSubscription?.unsubscribe();}listenCartChange(){let e=new de$1;this.cartChangeSubscription=window.CooeeSDK.cartChange$.subscribe(async t=>{if(this.isProcessingAddOns||!this.wasCurrentItemAdded(t))return;this.isProcessingAddOns=true;let o=this.triggerContext.triggerData;Y$2.log(`${o} detected current item addition to cart`);let n=this.triggerContext.selectedItems;if(!n?.length){Y$2.log(`No add-ons selected for the current product ${o}`),this.isProcessingAddOns=false;return}Y$2.log(`Adding ${n.length} add on items in the cart`);let i=await e.addToCart(n,o);D$1.get().refreshUI(i,false),this.isProcessingAddOns=false;});}wasCurrentItemAdded(e){let t=window.CooeeSDK.runtimeData.currentItem;return t?!!e.itemsAdded?.find(o=>o.mID===t?.mID&&o.vID===t.vID):false}};var Mr=false,Br=false,gr$1=null,ur=null,nn=false,Te=new Set,Ke$1=new Set;function sn(){nn||(nn=true,It$3(()=>{Mo(document.body,{childList:true,subtree:true},500,Uo).subscribe(()=>{Ke$1.forEach(r=>r.rerenderIfDeleted()),Te.forEach(r=>r.rerenderIfDeleted());});}));}async function ut$1(r){if(r.length>0&&await ln(),sn(),Mr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),gr$1=r;return}Mr=true;try{pi(r);}finally{if(Mr=false,gr$1){let e=gr$1;gr$1=null,Y$2.verbose(`Processing queued cart triggers`),ut$1(e);}}}async function ft$1(r){if(r.length>0&&await ln(),sn(),Br){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),ur=r;return}Br=true;try{di(r);}finally{if(Br=false,ur){let e=ur;ur=null,Y$2.verbose(`Processing queued page triggers`),ft$1(e).catch(console.error);}}}function sh(){Te.forEach(r=>r.rerenderAfterCartOpened());}function pi(r){cn(Te,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=an(Te,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(n=>{ke$1(n,`widget_update_render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let o;if(e.isProgressBar())o=new cr$1(e);else if(e.isSubscriptionUpsell()){sr$1.renderCartUpsell(e);continue}else e.isSavingsBar()?o=new gt$1(e):o=new G(e);Te.add(o),o.renderSilently();}}function di(r){cn(Ke$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=an(Ke$1,e);if(t){t.updateAndReRender(e).catch(n=>{ke$1(n,`widget_update_render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let o;e.isVideoObjective()?o=new lr$1(e):e.isBYOB()?o=new pr$1(e):e.isStickyATC()?o=new mr$1(e):e.isSavingsBar()?o=new gt$1(e):e.isCollectionFilter()?o=new ar$1(e):e.isAddOns()?o=new dr$1(e):o=new _(e),Ke$1.add(o),o.renderSilently();}}function an(r,e){for(let t of r)if(t.matches(e))return t}function cn(r,e){let t=new Set(e.map(o=>o.shortID));for(let o of r)t.has(o.engagementTrigger.shortID)||o.destroy();}async function ln(){await(await import('./widgets-BU7J_dgm-5JWw-WWW.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var pn=new U$1,mn=0;pn.pipe(Fe$2(50)).subscribe(async r=>{gi$1(await rt()).catch(t=>{ke$1(t,`widget_fetch`,{extra:{firstLoad:r}});});});function dn(r=false){le$2(K$1).then(()=>{pn.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function on(r){let e=await rt();return Object.assign(r,e),oe$1(`/v1/engagement/get-variant`,r)}async function gi$1(r$10){mn++,mn===1?Y$2.info(`Fetch widgets (after ⏰`,Ln()+` of SDK load)`):Y$2.info(`Fetch widgets`);let e=r$2({},r$10);try{let t=await oe$1(`/v1/engagement/eligible`,e);Y$2.info(`Widgets fetched ${Cn(t.timeTakenMs)}`);ft$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){throw Y$2.error(`Error sending widget getter`,t),t}}var gn=x$2(dr$3()),fr$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 gn.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 Fr={d:(r,e)=>{for(var t in e)Fr.o(e,t)&&!Fr.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Vr={};Fr.d(Vr,{A:()=>ui,k:()=>Wr});var ht$1=function(r,e,t,o){return new(t||(t=Promise))(function(n,i){function s(u){try{p(o.next(u));}catch(d){i(d);}}function c(u){try{p(o.throw(u));}catch(d){i(d);}}function p(u){var d;u.done?n(u.value):(d=u.value,d instanceof t?d:new t(function(C){C(d);})).then(s,c);}p((o=o.apply(r,[])).next());})},Ct$1=function(r,e){var t,o,n,i,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&d[0]?o.return:d[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,d[1])).done)return n;switch(o=0,n&&(d=[2&d[0],n.value]),d[0]){case 0:case 1:n=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,o=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(n=s.trys,!((n=n.length>0&&n[n.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!n||d[1]>n[0]&&d[1]<n[3])){s.label=d[1];break}if(d[0]===6&&s.label<n[1]){s.label=n[1],n=d;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(d);break}n[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(r,s);}catch(C){d=[6,C],o=0;}finally{t=n=0;}if(5&d[0])throw d[1];return {value:d[0]?d[1]:void 0,done:true}})([p,u])}}};function Wr(){return ht$1(this,void 0,Promise,function(){return Ct$1(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var o=`Unknown`,n=false;function i(g){n||(n=true,e({isPrivate:g,browserName:o}));}function s(){var g=0,y=parseInt(`-1`);try{y.toFixed(y);}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 ht$1(this,void 0,void 0,function(){var y,b;return Ct$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 y=f.sent(),b=y,y instanceof Error&&(b=(g=y.message)!==null&&g!==void 0?g:y),typeof b!=`string`?(i(false),[2]):(i(!!b.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function u(){var g;return ht$1(this,void 0,Promise,function(){return Ct$1(this,function(y){switch(y.label){case 0:return ((g=navigator.storage)===null||g===void 0?void 0:g.getDirectory)===void 0?[3,2]:[4,p()];case 1:return y.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(k){var ue=k.target.result,A=function(Cr){i(Cr);};try{ue.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),A(!1);}catch(Cr){(Cr.message||``).includes(`are not yet supported`)?A(!0):A(!1);}finally{ue.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);})(),y.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(g,y){var b;i(Math.round(y/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 C(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}function I(){return ht$1(this,void 0,Promise,function(){var g,y;return Ct$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(y=g instanceof Error&&typeof g.message==`string`?g.message:String(g))!=`string`?(i(false),[2]):(i(y.includes(`Security error`)),[2]);case 4:return i(navigator.serviceWorker===void 0),[2]}})})}(function(){return ht$1(this,void 0,Promise,function(){return Ct$1(this,function(g){switch(g.label){case 0:return s()!==44?[3,2]:(o=`Safari`,[4,u()]);case 1:return g.sent(),[3,6];case 2:return s()!==51?[3,3]:(y=navigator.userAgent,o=y.match(/Chrome/)?navigator.brave!==void 0?`Brave`:y.match(/Edg/)?`Edge`:y.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,C(),[3,6]);case 3:return s()!==25?[3,5]:(o=`Firefox`,[4,I()]);case 4:return g.sent(),[3,6];case 5:c()?(o=`Internet Explorer`,i(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),g.label=6;case 6:return [2]}var y;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=Wr);var ui=Wr,un=Vr.A;Vr.k;var fn=x$2(Dt$2()),hn=async()=>{let r={};try{return await fi$1(r)}catch(e){return ke$1(e,`device_props_collect`),r}},fi$1=async r=>{let e=window.CooeeSDK.uaParser;hi$1(r),Ci$1(r),yi$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:vi$1()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,Sn$2({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([bi$1(r),Ei$1(r),Si$1(r)]),r},hi$1=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Ci$1=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},yi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},vi$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},Ei$1=async r=>{try{await wi$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},wi$1=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(o=>{r.coords=[o.coords.latitude,o.coords.longitude],t();},()=>t());})},bi$1=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},Sn$2({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Si$1=async r=>{try{(await un())?.isPrivate&&(r.incognito=!0,Sn$2({incognito:!0}));}catch(e){fn.default.error(`Unable to detect private/incognito window`,e);}};function yn(r){if(!vn())return;let e=ge$3[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function vn(){return window.clarity&&typeof window.clarity==`function`}var K$1=new gr$2(1),Ii$1=`Store id or shop name is missing`,hr$1;async function Zh(){Y$2.info(`Begin auth after ⏰`,Ln(),`of JS load`);try{await Ti$1(),K$1.next(!0),K$1.complete();}catch(r){r?.message?.includes(Ii$1)&&ke$1(r,`session_initiate`),Y$2.error(`Unable to initiate session`,r),K$1.error(r);}}async function Qo(){return await wn(false),hr$1}async function eC(){let r=Date.now();await Zt.request(`gen_did`,async()=>{let e=await ce$5.get(`did`);e||(e=new $$2().toHexString(),await ce$5.set(`did`,e)),Sn(e);}),Y$2.info(`Device ID set/get done ${Cn(Date.now()-r)}`);}async function En(){if(hr$1)return;let[r,e,t]=await Promise.all([ve$5.get(`id`,``),ce$5.get(`sessionNumber`,1),ve$5.get(`landing`,{})]);bn(r,e,t);}async function Ti$1(){await wn(true);}async function wn(r){let e=false;return await Di$1()?(await Pi$1(),e=true):await xi$1()?(await En(),e=true):await En(),e?await _i$1():r&&dn(),e}async function Pi$1(){Y$2.info(`Starting new session`),await ve$5.clear();let r=new Date,e=new $$2().toHexString(),t=await ce$5.get(`sessionNumber`,0)+1,o=rr$1();await Promise.all([ce$5.set(`sessionNumber`,t),ve$5.set(`id`,e),ve$5.set(`lastUsedTime`,r.getTime()),ve$5.set(`landing`,o)]),bn(e,t,o);}async function Di$1(){let r=await ve$5.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function xi$1(){return !await ve$5.get(`synced`,false)}async function Ri$1(){let r$11=await hn(),e=or$1();return s$2(r$2(r$2({deviceProps:r$11},hr$1),e),{sdk:Zr$3,ad:fr$1.getAdParams(),occurred:Oi$1(We$4().jsLoadTime),properties:{}})}async function _i$1(){Y$2.info(`Ensuring session on server`),await Ai$1();let r=Date.now(),e=await Ri$1();Y$2.info(`Session data generated ${Cn(Date.now()-r)}`);try{let t=await oe$1(`/v1/event/validate-session`,e);Y$2.info(`Auth finished ${Cn(t.timeTakenMs)}`),await ve$5.set(`synced`,!0),t.data.deviceID&&(await ce$5.set(`did`,t.data.deviceID),Sn(t.data.deviceID));ft$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function Ai$1(){let r=await ce$5.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$5.set(`firstSeen`,e.toISOString()),zo(e),In$2(`Visitor Info`,{first_seen:e.toISOString()});}function bn(r,e,t){Sn$2({"cooee_session.number":e}),In$2(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$2.info(`Session number: ${e}, id: ${r}`),hr$1={sessionID:r,sessionNumber:e,landingPage:t};}function Sn(r){Y$2.info(`Visitor ID (old):`,r),Y$2.info(`Visitor ID (new):`,ce$5.getVisitorId()),ce$5.visitorOldId=r;In$2(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),wn$1({id:r});}function Oi$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function sC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Li$1():document.visibilityState===`hidden`&&ki$1();};}async function Li$1(){}async function ki$1(){let r=await Ni$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}Tn(r);}async function Ni$1(){let r=We$4();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function In(){let r=We$4();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function Pn(r){if(!Ui$1()||!le$5.get().pixelPush)return;let t=ge$3[r.intent]?.toLowerCase();t&&(Y$2.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Ui$1(){return window.fbq&&typeof window.fbq==`function`}var Lr=`/v1/event/track-page-unload`;function Fo(r){Y$2.verbose(`Waiting for auth to send event ${r.name}`),le$2(K$1).then(()=>we$1(r)).catch(e=>Y$2.error(`Session not established, skipping trackEvent`,e));}function Tn(r){le$2(K$1).then(()=>{Mi$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function Mi$1(r){let e=We$4().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 oe$1(Lr,t);}catch(o){throw Y$2.error(`Error sending page unload for ${e} to server`,o),o}}function we$1(r){Bi$1(r);}async function Bi$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),qi$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}No();let e=await rt();Object.assign(r,e),In(),ve$5.set(`lastUsedTime`,new Date().getTime());let t=Hi$1(r.name),o=t.toLowerCase().replace(/\s+/g,`-`);try{let n=await oe$1(`/v1/event/track/${o}`,r);Y$2.info(`Event tracked:`,t),Fi$1(r)&&(We$4().currentPageViewEvent={id:r.id,name:r.name}),Vi$1(r,n.data);}catch(n){throw Y$2.error(`Error sending event ${r.name} to server`,n),n}}function Fi$1(r){return on$1.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Vi$1(r,e){Wi$1(r,e).catch(t=>{ke$1(t,`popup_response_process`,{extra:{event:r,response:e}});}),$i$1(e);}async function Wi$1(r,e){if(!e.triggerData?.ian)return;let t=new q$1(e.triggerData);t.occurred=r.occurred,Y$2.log(`${t} will be shown`);let o;try{o=await tr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}t.items=o;new(await(import('./renderer-RvPzZTEd-CX-sySv6.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{ke$1(i,`popup_render`,{extra:{event:r},engagementTrigger:t});});}function $i$1(r){r.intent&&(yn(r.intent),Pn(r),Y$2.info(`Intent is ${ge$3[r.intent]}`));}function Hi$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}
|
|
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 o=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),o}function ir$1(r,e,t){let o={color:r.navigation.color?.rgba};return r.pagination.enabled&&(o.transform=`translateY(-25%)`),l$2(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[l$2(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&l$2(`div`,{class:`swiper-button-next`,style:o,children:l$2(`span`,{})}),r.navigation.enabled&&l$2(`div`,{class:`swiper-button-prev`,style:o,children:l$2(`span`,{})}),r.pagination.enabled&&l$2(`div`,{className:`swiper-pagination`,style:{color:r.pagination.color?.rgba}})]})}var cd=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Ur=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 it=class extends w$1{componentDidMount(){rt$2(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-checkbox`),children:l$2(`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 W$2;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s$2(r$2({},this.getTypoStyles()),{display:`flex`})}};var ne$1=class ne extends w$1{constructor(e,t){super(e,t);}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return l$2(`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 ie$1=class ie extends w$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$2(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new gt$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 st$1=class st extends ie$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$2(je$1,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})})}};var at$1=class at extends w$1{render(){return l$2(`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(){rt$2(()=>{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),On$1(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$2(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let o of t.sellingPlans??[])e.push(l$2(`option`,{value:o.mID,selected:o.isSelected,children:o.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(o=>o.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var mi=new RegExp(`fill="#[a-zA-Z0-9]+"`),ct$1=class ct extends w$1{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),l$2(`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),o=Fe$3(this.props.element.halfStart,{svg:e},this.props.triggerContext),n=this.props.review;if(!n?.rating)return ``;let i=``;if(this.props.element.showSingleStar)i=t;else {let s=5,c=`${n.rating}`.split(`.`);for(let p=0;p<+c[0];p++)i+=t,s--;c[1]&&(i+=o,s--);for(let p=0;p<s;p++)i+=t.replace(mi,`fill="#f1f1f1"`);}return i}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var lt$1=class lt extends w$1{render(){return l$2(`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(){rt$2(()=>{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),On$1(this.mediaStyle.typo))}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(l$2(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,o=this.props.item.vars.find(n=>n.mID===t);this.props.item.setSelectedVariant(o);}};var je$1=class je extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return t.l===`Star Rating`&&!this.props.item.reviews?.rating?void 0:l$2(st$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})}if(e.t===6){let t=this.props.triggerContext,o=t.triggerData;return o.isBundle()||o.isAddOns()?l$2(it,{element:e,item:this.props.item,triggerContext:t}):void 0}if(e.t===8){let t=e;if(!t.templateName)return ``;try{if(!/^[a-zA-Z0-9_-]+$/.test(t.templateName))return Y$2.error(`Invalid partial template name`,t.templateName),``;let o=Fe$3(`{{ @include("${t.templateName}", it) /}}`,this.props.productVariables??{});return l$2(`div`,{className:`lc-partial-`+t.templateName,dangerouslySetInnerHTML:{__html:o}})}catch(o){return Y$2.error(`Failed to render partial element`,t.templateName,this.props.productVariables,o),``}}if(e.t===13){let t=e,o=this.props.item,n=Ur(o.variantImage??o.firstImageURL),i=Ur(o.variantSecondaryImage??o.secondaryImageURL);t.lg=t.sm={src:n,name:o.name,secondarySrc:i};let s=l$2(ne$1,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:l$2(`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$2(`cooee-product-options-picker`,{item:this.props.item,styles:t.style,horizontal:t.horizontal,dropdownType:t.type}):l$2(lt$1,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?l$2(at$1,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?l$2(ct$1,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?l$2(Se$1,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):l$2(ge,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}renderProductTitle(e){let t=l$2(F,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:l$2(`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 o=t.detail.variantID;this.props.item.setSelectedVariantByID(o);});}};var Ie$1=class Ie extends w$1{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){let e=this.props.item,t=this.getProductData();if(this.productElement=new pe$1(We$3(this.props.element,t,this.props.triggerContext)),this.productElement.hide||!this.matchWhenCondition(this.productElement.when))return;let n=this.getClasses([`lc-single-product`,...e.cardClasses??[]].join(` `));return l$2(`div`,{style:r$2({},this.getCompiledStyles()),className:n,children:l$2(je$1,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:t,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,o=e.getTemplateVariables();o.product.quantity=this.props.item.quantity;let n=this.props.triggerContext.triggerData.discount?.type===H$1.BXGY;return !t.hasEffectivePrice()&&n&&(o.product=s$2(r$2(r$2({},o.product),Yn$1(`effective_price`,t.effectivePrice.value)),{price:``})),o.variant.quantity=t.quantity,{product:o.product,variant:o.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var mt$1=class mt extends w$1{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$3()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+`px`;}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Vi$2().then(()=>{this.swiperInstance=nr(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 o=i=>{this.swiperRef=i;},n=()=>e?.map(i=>l$2(`div`,{class:`swiper-slide`,children:this.getProductFragment(i)}));t=l$2(`div`,{style:s$2(r$2({},this.getCompiledStyles()),{display:`block`}),className:this.getClasses(`lc-product-swiper-list`),children:ir$1(this.configuration,o,n)});}else t=l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-product-list`),children:e?.map((o,n)=>this.getProductFragment(o,n!==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 o=this.props.triggerContext.triggerData,n=o.items.length,i;o.isBundle()?i=this.props.element.prod.symbol?.hide!==true?n*2-1:n:i=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${i}, auto)`;}}return t}getProductFragment(e,t=false){return l$2(ct$3,{children:[l$2(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$2(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:l$2(F,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var pt$1=class pt extends w$1{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$2().then(()=>{this.swiperInstance=nr(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=n=>{this.swiperRef=n;},o=()=>{let n=e.values?.map(c=>l$2(`div`,{class:`swiper-slide`,onClick:p=>this.onClick(p,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!n?.length)return [];let i=e.conf,s=n.length;if(i.marquee&&s<=Number(i.maxInRow)){let c=Number(i.maxInRow)-s+1;for(let p=0;p<c;p++)n.push(n[p%s]);}return n};return ir$1(e.conf,t,o)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return l$2(ne$1,{element:t,triggerContext:this.props.triggerContext});case 4:return l$2(ie$1,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$2.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let o=We$3(e,{form:t},this.props.triggerContext);return B$2.getParsedElement(o)}getClickAction(e){return We$3(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var ge=class extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),rt$2(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}));});}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return l$2(ie$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return l$2(nt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?l$2(Se$1,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return l$2(F,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return l$2(ne$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return l$2(mt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return l$2(Ie$1,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return l$2(pt$1,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var dt$1=class dt extends w$1{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he$2.GO_TO_URL&&!!$n$1(this.clickAction.gu?.u)||this.clickAction?.at===he$2.OPEN_CART||this.clickAction?.at===he$2.INITIATE_CHECKOUT;}componentDidMount(){rt$2(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return l$2(ct$3,{children:[l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-container`),onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:l$2(ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&l$2(`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 _=class r$9{constructor(e){this.engagementTrigger=e;this.triggerContext=new Be$1(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];parentOuterShadowElement;renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;lockReleased$=new U$1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ke$1(e,`widget_render`,{triggerContext:this.triggerContext});});}destroy(){Y$2.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$9.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Mi$2(this.engagementTrigger.content?.afterDeleteJS);}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e);}if(this.rootContainer=await this.getWidgetContainer(true),!this.rootContainer){Y$2.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,Mi$2(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){await this.waitForLockRelease(),this.acquireProcessingLock();try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render();}finally{this.releaseProcessingLock();}}async update(e){this.engagementTrigger.variation=e.variation;}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){Y$2.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render();}finally{this.releaseProcessingLock();}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),true):false}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect();});}acquireProcessingLock(){return this.isProcessing?(Y$2.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$2.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$2.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false,this.lockReleased$.next();}async waitForLockRelease(){this.isProcessing&&await le$2(this.lockReleased$);}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$2.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e);}handleVariationResponse(e){if(!e)return;let t=this.engagementTrigger;Y$2.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(o=>new vt$2(o)),t.nonMutableItems=e.items.map(o=>new vt$2(o))),e.bundleFrom&&(t.bundleFrom=new vt$2(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),he$3.hasKeys(e.stickyATCConfig)&&(t.stickyATCConfig=e.stickyATCConfig),e.props&&he$3.hasKeys(e.props)&&(t.props=r$2(r$2({},t.props),e.props)),e.content&&(t.content=new et(e.content)),t.widget=new He$1(e.widget),t.contentID=e.contentID,t.variation=e.variation,t.placement=e.placement,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 ${Jn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof G?Te.delete(this):Ke$1.delete(this);}async getVariation(){Y$2.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await on(e)).data}catch(t){t instanceof ne$4&&t.response?.status;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(o=>{let n=new IntersectionObserver((i,s)=>{i.forEach(async c=>{if(c.isIntersecting){Y$2.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);o(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);n.observe(this.rootContainer),this.observers.push(n);})}attachScroll(){this.scrollSubscription=Tr$2(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 o={};this.triggerContext.triggerData.items?.length&&(o.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=new Ir$3(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,o,this.engagementTrigger);i.name===`CE Campaign Holdout`&&(i.trigger.holdout=true),we$1(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 o=t.getElementById(e);if(o)return o;let n=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),i=this.engagementTrigger.shortID;o=document.createElement(`div`),o.id=e;let s=`letscooee letscooee-engagement engagement-${i} lc-${n}`;return this.engagementTrigger.content?.classes&&(s+=` ${this.engagementTrigger.content.classes}`),o.className=s,o.dataset.engagementId=i,this.engagementTrigger.id===`preview`&&(o.className+=` letscooee-preview`),o.style.display=`block`,o.style.minHeight=`0.5px`,o.style.minWidth=`0.5px`,o}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 o=this.engagementTrigger.widget;$e$2(Yr$2(dt$1,{element:o.cont,triggerContext:this.triggerContext,elements:o.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let o=this.engagementTrigger.content?.outerCSS?.trim()??``,n=this.engagementTrigger.content?.innerCSS?.trim()??``,i=this.engagementTrigger.content?.globalCSS?.trim()??``;if(i&&le$4(i),!o&&!n)return;let s=this.rootContainer.id;if(e){le$4(n,t),this.injectOuterCSSOnly();return}le$4(`#${s} { ${o+`
|
|
84
|
+
${n}`} }`,this.parentOuterShadowElement);}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 o=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(o)}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 o=t.selector,n;if(o.includes(`:shadow`)){let p=o.split(`:shadow`);n=(await Kn$1(p[0].trim()))?.shadowRoot,o=p[1].trim(),n&&(this.parentOuterShadowElement=n,Hi$2(n,false));}Y$2.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${o}"`);let i=await Kn$1(o,3,n??document);if(!i)return Y$2.warn(`${this.engagementTrigger} no placement found with ${o}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case fe$2.BEFORE1:case fe$2.BEFORE:i.parentElement?.insertBefore(c,i);break;case fe$2.INSIDE_FIRST1:case fe$2.INSIDE_FIRST:i.insertBefore(c,i.firstChild);break;case fe$2.INSIDE_LAST1:case fe$2.INSIDE_LAST:i.appendChild(c);break;case fe$2.AFTER1:case fe$2.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 tr$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 o=this.getItemDiff(e,t),n=this.getItemDiff(t,e);t.push(...o);for(let i of n)re$1.remove(t,i);}getItemDiff(e,t){return e.filter(o=>!t.some(n=>n.selectedOrFirstVariant.value.mID===o.selectedOrFirstVariant.value.mID))}};var G=class extends _{constructor(e){super(e);}async rerenderAfterCartOpened(){await 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(!D$1.get().isOpen()&&We$4().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 sr$1=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=h.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$2.warn(`No placement available for ${e.objective}`,e.shortID);return}let o=Array.from(document.querySelectorAll(t.selector));if(!o?.length){Y$2.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let n of o)new r(e,n).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 o=t.vars.find(d=>d.mID===e.id.toString());if(!o)return;let n=new mt$3(o),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of n.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=true,n.changeSellingPlan(d));let s=new vt$2(t);s.vars=[n],s.selectedOrFirstVariant.value=n;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let p=new q$1(this.engagementTrigger);p.placement.selector=`.${c}`,p.items=[s];let u=new G(p);u.renderSilently(),this.watchForCartItemDeletion(u,c);}watchForCartItemDeletion(e,t){let o=new MutationObserver(n=>{n.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(Y$2.verbose(`${t} has been removed`),e.destroy(),o.disconnect());});});});o.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 o=t.selling_plan_allocation?.selling_plan?.name;return !(o&&!e.includes(o))})}};var ar$1=class ar extends _{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var cr$1=class cr extends G{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){ke$1(e,`progressbar_milestones_apply`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await h.getCurrent().getNormalisedCart(true),t=this.engagementTrigger.progressBarConfig,o=[],n=[],i=[],s,c,p=[...t.milestones];for(let u of p){if(u.rewardType!==ve$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],C=u.reached,I=e.items.find(g=>(g.vID===d.vID||g.mID===d.mID)&&g.properties._letscooee_campaign===this.engagementTrigger.shortID);C&&(s=u,c=I),I&&o.push(I),!C&&I&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${I.vID} from cart`),i.push(I)):C&&!I&&(Y$2.verbose(`Adding free gift ${d.vID} to cart`),n.push(d));}t.restrictToLatestFreebie&&s&&(c?(o=o.filter(u=>u.vID!==c.vID),n=[]):n=[s.items[0]],i.push(...o)),t.treatFreebieAsSeparateLineItem?await this.handleSeparateFreebieLineItems(n,i):await this.handleCombinedCartUpdate(n,i);}async handleSeparateFreebieLineItems(e,t){if(!t.length&&!e.length)return;let o=new de$1,n=[];if(e.length){let c=this.addFreebiesOperation(e,o);n.push(c);}if(t.length){let c=this.removeFreebiesOperation(t);n.push(c);}if(!n.length)return;let i;try{i=await Promise.all(n),Y$2.log(`All freebie and coupon operations completed`);}catch(c){ke$1(c,`progressbar_freebie_ops_parallel`,{engagementTrigger:this.engagementTrigger});}let s;e.length&&i?.length&&(s=i[0]),D$1.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(o=>t.updates[o.key??o.vID]=o.quantity-1),kr$1(t,this.engagementTrigger)}async addFreebiesOperation(e,t){return t.addToCart(e,this.engagementTrigger)}async handleCombinedCartUpdate(e,t){let o=this.engagementTrigger.progressBarConfig,n={},i={};t.length&&t.forEach(C=>i[C.key??C.vID]=0),e.length&&e.forEach(C=>i[C.vID]=1);let s=o.coupons,c=[];if(s?.length){c=s.map(g=>g.couponCode);let C=h.getCurrent().discount_codes?.map(g=>g.code)??[];c.every(g=>C.some(y=>y===g))||(n.discount=c.join(`,`));}if(he$3.hasKeys(i)&&(n.updates=i),!he$3.hasKeys(n))return;let p=await kr$1(n,this.engagementTrigger),u=p?.items,d=[];for(let C of e){let I=u?.find(g=>c?.length?g.id+``===C.vID&&g.discounts?.some(y=>c.includes(y.title)):g.id+``===C.vID);I&&d.push(I);}if(!d.length){D$1.get().refreshUI(p,false);return}try{await Promise.all(d.map(C=>tn(C,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(C){ke$1(C,`progressbar_private_attr_add`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{D$1.get().refreshUI(p,false);}}};var gt$1=class gt extends G{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 lr$1=class lr extends _{constructor(e){super(e);}isAllOkToRender(){return !!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e;this.engagementTrigger.isFloatingVideo()?e=`cooee-video-popup`:this.engagementTrigger.isVideoStory()?e=`cooee-video-stories`:e=`cooee-video-playlist`,this.createAngularWidget(e);}};var mr$1=class mr extends _{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var pr$1=class pr extends _{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,o=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,n=e.detail;if(!he$3.hasKeys(n)){Y$2.error(`No detail received for ${o}`);return}Y$2.log(`Detail received for BYOB`,n);let i=n.campaignID??n.campaignId??n.campaign_id;if(i!==t.shortID&&i!==t.engagementID){Y$2.warn(`Current ${o} is not BYOB. Received: ${i}`);return}let s=n.items;if(!s?.length)return;let c=s.map(p=>new pt$2({mID:p.product_id,vID:p.variant_id,quantity:p.quantity||1}));await new Ge$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$2.ADD_BUNDLE,applyDiscount:true}});}};var dr$1=class dr extends _{cartChangeSubscription;isProcessingAddOns=false;afterRootContainerCreated(){this.cartChangeSubscription&&!this.cartChangeSubscription.closed||this.listenCartChange();}preDestroy(){super.preDestroy(),this.cartChangeSubscription?.unsubscribe();}listenCartChange(){let e=new de$1;this.cartChangeSubscription=window.CooeeSDK.cartChange$.subscribe(async t=>{if(this.isProcessingAddOns||!this.wasCurrentItemAdded(t))return;this.isProcessingAddOns=true;let o=this.triggerContext.triggerData;Y$2.log(`${o} detected current item addition to cart`);let n=this.triggerContext.selectedItems;if(!n?.length){Y$2.log(`No add-ons selected for the current product ${o}`),this.isProcessingAddOns=false;return}Y$2.log(`Adding ${n.length} add on items in the cart`);let i=await e.addToCart(n,o);D$1.get().refreshUI(i,false),this.isProcessingAddOns=false;});}wasCurrentItemAdded(e){let t=window.CooeeSDK.runtimeData.currentItem;return t?!!e.itemsAdded?.find(o=>o.mID===t?.mID&&o.vID===t.vID):false}};var Mr=false,Br=false,gr$1=null,ur=null,nn=false,Te=new Set,Ke$1=new Set;function sn(){nn||(nn=true,It$3(()=>{Mo(document.body,{childList:true,subtree:true},500,Uo).subscribe(()=>{Ke$1.forEach(r=>r.rerenderIfDeleted()),Te.forEach(r=>r.rerenderIfDeleted());});}));}async function ut$1(r){if(r.length>0&&await ln(),sn(),Mr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),gr$1=r;return}Mr=true;try{pi(r);}finally{if(Mr=false,gr$1){let e=gr$1;gr$1=null,Y$2.verbose(`Processing queued cart triggers`),ut$1(e);}}}async function ft$1(r){if(r.length>0&&await ln(),sn(),Br){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),ur=r;return}Br=true;try{di(r);}finally{if(Br=false,ur){let e=ur;ur=null,Y$2.verbose(`Processing queued page triggers`),ft$1(e).catch(console.error);}}}function sh(){Te.forEach(r=>r.rerenderAfterCartOpened().catch(e=>ke$1(e,`cart_widget_render_update`,{engagementTrigger:r.engagementTrigger})));}function pi(r){cn(Te,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=an(Te,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(n=>{ke$1(n,`widget_update_render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let o;if(e.isProgressBar())o=new cr$1(e);else if(e.isSubscriptionUpsell()){sr$1.renderCartUpsell(e);continue}else e.isSavingsBar()?o=new gt$1(e):o=new G(e);Te.add(o),o.renderSilently();}}function di(r){cn(Ke$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=an(Ke$1,e);if(t){t.updateAndReRender(e).catch(n=>{ke$1(n,`widget_update_render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let o;e.isVideoObjective()?o=new lr$1(e):e.isBYOB()?o=new pr$1(e):e.isStickyATC()?o=new mr$1(e):e.isSavingsBar()?o=new gt$1(e):e.isCollectionFilter()?o=new ar$1(e):e.isAddOns()?o=new dr$1(e):o=new _(e),Ke$1.add(o),o.renderSilently();}}function an(r,e){for(let t of r)if(t.matches(e))return t}function cn(r,e){let t=new Set(e.map(o=>o.shortID));for(let o of r)t.has(o.engagementTrigger.shortID)||o.destroy();}async function ln(){await(await import('./widgets-CmUGXjul-BcJ9RFFl.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var pn=new U$1,mn=0;pn.pipe(Fe$2(50)).subscribe(async r=>{gi$1(await rt()).catch(t=>{ke$1(t,`widget_fetch`,{extra:{firstLoad:r}});});});function dn(r=false){le$2(K$1).then(()=>{pn.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function on(r){let e=await rt();return Object.assign(r,e),oe$1(`/v1/engagement/get-variant`,r)}async function gi$1(r$10){mn++,mn===1?Y$2.info(`Fetch widgets (after ⏰`,Ln()+` of SDK load)`):Y$2.info(`Fetch widgets`);let e=r$2({},r$10);try{let t=await oe$1(`/v1/engagement/eligible`,e);Y$2.info(`Widgets fetched ${Cn(t.timeTakenMs)}`);ft$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){throw Y$2.error(`Error sending widget getter`,t),t}}var gn=x$2(dr$3()),fr$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 gn.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 Fr={d:(r,e)=>{for(var t in e)Fr.o(e,t)&&!Fr.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Vr={};Fr.d(Vr,{A:()=>ui,k:()=>Wr});var ht$1=function(r,e,t,o){return new(t||(t=Promise))(function(n,i){function s(u){try{p(o.next(u));}catch(d){i(d);}}function c(u){try{p(o.throw(u));}catch(d){i(d);}}function p(u){var d;u.done?n(u.value):(d=u.value,d instanceof t?d:new t(function(C){C(d);})).then(s,c);}p((o=o.apply(r,[])).next());})},Ct$1=function(r,e){var t,o,n,i,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&d[0]?o.return:d[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,d[1])).done)return n;switch(o=0,n&&(d=[2&d[0],n.value]),d[0]){case 0:case 1:n=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,o=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(n=s.trys,!((n=n.length>0&&n[n.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!n||d[1]>n[0]&&d[1]<n[3])){s.label=d[1];break}if(d[0]===6&&s.label<n[1]){s.label=n[1],n=d;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(d);break}n[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(r,s);}catch(C){d=[6,C],o=0;}finally{t=n=0;}if(5&d[0])throw d[1];return {value:d[0]?d[1]:void 0,done:true}})([p,u])}}};function Wr(){return ht$1(this,void 0,Promise,function(){return Ct$1(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var o=`Unknown`,n=false;function i(g){n||(n=true,e({isPrivate:g,browserName:o}));}function s(){var g=0,y=parseInt(`-1`);try{y.toFixed(y);}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 ht$1(this,void 0,void 0,function(){var y,b;return Ct$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 y=f.sent(),b=y,y instanceof Error&&(b=(g=y.message)!==null&&g!==void 0?g:y),typeof b!=`string`?(i(false),[2]):(i(!!b.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function u(){var g;return ht$1(this,void 0,Promise,function(){return Ct$1(this,function(y){switch(y.label){case 0:return ((g=navigator.storage)===null||g===void 0?void 0:g.getDirectory)===void 0?[3,2]:[4,p()];case 1:return y.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(k){var ue=k.target.result,A=function(Cr){i(Cr);};try{ue.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),A(!1);}catch(Cr){(Cr.message||``).includes(`are not yet supported`)?A(!0):A(!1);}finally{ue.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);})(),y.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(g,y){var b;i(Math.round(y/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 C(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}function I(){return ht$1(this,void 0,Promise,function(){var g,y;return Ct$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(y=g instanceof Error&&typeof g.message==`string`?g.message:String(g))!=`string`?(i(false),[2]):(i(y.includes(`Security error`)),[2]);case 4:return i(navigator.serviceWorker===void 0),[2]}})})}(function(){return ht$1(this,void 0,Promise,function(){return Ct$1(this,function(g){switch(g.label){case 0:return s()!==44?[3,2]:(o=`Safari`,[4,u()]);case 1:return g.sent(),[3,6];case 2:return s()!==51?[3,3]:(y=navigator.userAgent,o=y.match(/Chrome/)?navigator.brave!==void 0?`Brave`:y.match(/Edg/)?`Edge`:y.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,C(),[3,6]);case 3:return s()!==25?[3,5]:(o=`Firefox`,[4,I()]);case 4:return g.sent(),[3,6];case 5:c()?(o=`Internet Explorer`,i(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),g.label=6;case 6:return [2]}var y;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=Wr);var ui=Wr,un=Vr.A;Vr.k;var fn=x$2(Dt$2()),hn=async()=>{let r={};try{return await fi$1(r)}catch(e){return ke$1(e,`device_props_collect`),r}},fi$1=async r=>{let e=window.CooeeSDK.uaParser;hi$1(r),Ci$1(r),yi$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:vi$1()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,Sn$2({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([bi$1(r),Ei$1(r),Si$1(r)]),r},hi$1=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Ci$1=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},yi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},vi$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},Ei$1=async r=>{try{await wi$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},wi$1=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(o=>{r.coords=[o.coords.latitude,o.coords.longitude],t();},()=>t());})},bi$1=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},Sn$2({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Si$1=async r=>{try{(await un())?.isPrivate&&(r.incognito=!0,Sn$2({incognito:!0}));}catch(e){fn.default.error(`Unable to detect private/incognito window`,e);}};function yn(r){if(!vn())return;let e=ge$3[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function vn(){return window.clarity&&typeof window.clarity==`function`}var K$1=new gr$2(1),Ii$1=`Store id or shop name is missing`,hr$1;async function Zh(){Y$2.info(`Begin auth after ⏰`,Ln(),`of JS load`);try{await Ti$1(),K$1.next(!0),K$1.complete();}catch(r){r?.message?.includes(Ii$1)&&ke$1(r,`session_initiate`),Y$2.error(`Unable to initiate session`,r),K$1.error(r);}}async function Qo(){return await wn(false),hr$1}async function eC(){let r=Date.now();await Zt.request(`gen_did`,async()=>{let e=await ce$5.get(`did`);e||(e=new $$2().toHexString(),await ce$5.set(`did`,e)),Sn(e);}),Y$2.info(`Device ID set/get done ${Cn(Date.now()-r)}`);}async function En(){if(hr$1)return;let[r,e,t]=await Promise.all([ve$5.get(`id`,``),ce$5.get(`sessionNumber`,1),ve$5.get(`landing`,{})]);bn(r,e,t);}async function Ti$1(){await wn(true);}async function wn(r){let e=false;return await Di$1()?(await Pi$1(),e=true):await xi$1()?(await En(),e=true):await En(),e?await _i$1():r&&dn(),e}async function Pi$1(){Y$2.info(`Starting new session`),await ve$5.clear();let r=new Date,e=new $$2().toHexString(),t=await ce$5.get(`sessionNumber`,0)+1,o=rr$1();await Promise.all([ce$5.set(`sessionNumber`,t),ve$5.set(`id`,e),ve$5.set(`lastUsedTime`,r.getTime()),ve$5.set(`landing`,o)]),bn(e,t,o);}async function Di$1(){let r=await ve$5.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function xi$1(){return !await ve$5.get(`synced`,false)}async function Ri$1(){let r$11=await hn(),e=or$1();return s$2(r$2(r$2({deviceProps:r$11},hr$1),e),{sdk:Zr$3,ad:fr$1.getAdParams(),occurred:Oi$1(We$4().jsLoadTime),properties:{}})}async function _i$1(){Y$2.info(`Ensuring session on server`),await Ai$1();let r=Date.now(),e=await Ri$1();Y$2.info(`Session data generated ${Cn(Date.now()-r)}`);try{let t=await oe$1(`/v1/event/validate-session`,e);Y$2.info(`Auth finished ${Cn(t.timeTakenMs)}`),await ve$5.set(`synced`,!0),t.data.deviceID&&(await ce$5.set(`did`,t.data.deviceID),Sn(t.data.deviceID));ft$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function Ai$1(){let r=await ce$5.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$5.set(`firstSeen`,e.toISOString()),zo(e),In$2(`Visitor Info`,{first_seen:e.toISOString()});}function bn(r,e,t){Sn$2({"cooee_session.number":e}),In$2(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$2.info(`Session number: ${e}, id: ${r}`),hr$1={sessionID:r,sessionNumber:e,landingPage:t};}function Sn(r){Y$2.info(`Visitor ID (old):`,r),Y$2.info(`Visitor ID (new):`,ce$5.getVisitorId()),ce$5.visitorOldId=r;In$2(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),wn$1({id:r});}function Oi$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function sC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Li$1():document.visibilityState===`hidden`&&ki$1();};}async function Li$1(){}async function ki$1(){let r=await Ni$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}Tn(r);}async function Ni$1(){let r=We$4();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function In(){let r=We$4();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function Pn(r){if(!Ui$1()||!le$5.get().pixelPush)return;let t=ge$3[r.intent]?.toLowerCase();t&&(Y$2.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Ui$1(){return window.fbq&&typeof window.fbq==`function`}var Lr=`/v1/event/track-page-unload`;function Fo(r){Y$2.verbose(`Waiting for auth to send event ${r.name}`),le$2(K$1).then(()=>we$1(r)).catch(e=>Y$2.error(`Session not established, skipping trackEvent`,e));}function Tn(r){le$2(K$1).then(()=>{Mi$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function Mi$1(r){let e=We$4().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 oe$1(Lr,t);}catch(o){throw Y$2.error(`Error sending page unload for ${e} to server`,o),o}}function we$1(r){Bi$1(r);}async function Bi$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),qi$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}No();let e=await rt();Object.assign(r,e),In(),ve$5.set(`lastUsedTime`,new Date().getTime());let t=Hi$1(r.name),o=t.toLowerCase().replace(/\s+/g,`-`);try{let n=await oe$1(`/v1/event/track/${o}`,r);Y$2.info(`Event tracked:`,t),Fi$1(r)&&(We$4().currentPageViewEvent={id:r.id,name:r.name}),Vi$1(r,n.data);}catch(n){throw Y$2.error(`Error sending event ${r.name} to server`,n),n}}function Fi$1(r){return on$1.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Vi$1(r,e){Wi$1(r,e).catch(t=>{ke$1(t,`popup_response_process`,{extra:{event:r,response:e}});}),$i$1(e);}async function Wi$1(r,e){if(!e.triggerData?.ian)return;let t=new q$1(e.triggerData);t.occurred=r.occurred,Y$2.log(`${t} will be shown`);let o;try{o=await tr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}t.items=o;new(await(import('./renderer-D7IHCPuE-CX-sySv6.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{ke$1(i,`popup_render`,{extra:{event:r},engagementTrigger:t});});}function $i$1(r){r.intent&&(yn(r.intent),Pn(r),Y$2.info(`Intent is ${ge$3[r.intent]}`));}function Hi$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
|
|
|
@@ -96,14 +96,14 @@ ${e.map(g=>` ${g};`).join(`
|
|
|
96
96
|
${Te.map(g=>` ${g};`).join(`
|
|
97
97
|
`)}
|
|
98
98
|
}
|
|
99
|
-
}`),_t}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,s){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:s,color:e,border:s}:{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:s,color:o,border:s}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Ye=class{apply(e){if(!e)return;le$4(new Ke(e).toCSSString());}};function Mi(){let t=le$5.get();!t.gaMeasurementID||!t.gaEnabled||gr();}async function fr(){let t=await ce$5.get(`gacid`),e=await hr();if(t!==e)return await ce$5.set(`gacid`,e),e}async function gr(){let t=await fr();t&&Bm({gaClientID:t});}async function hr(){let e=le$5.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}var Ni=!!new URL(location.href).searchParams?.get(`new-brand`);async function Bi(t){(t?.enabled||Ni)&&new Ye().apply(t);}function br(t){if(!t)return t;let e=t.match(/:root\s*\{/);if(!e)return t;let i=0,o=-1;for(let s=e.index;s<t.length;s++)if(t[s]===`{`)i++;else if(t[s]===`}`&&--i===0){o=s+1;break}return o===-1?t:(t.slice(0,e.index)+t.slice(o)).trimStart()}async function St(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=w.globalRef.config.update(t);Mi(),D$1.initialize(),e.website&&(Ni&&(e.website.commonCSS=br(e.website.commonCSS)),Ui$2(e.website.commonJS),le$4(e.website.commonCSS),kt(e.website.widgetPartials??[])),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$2(10)).subscribe(async({open:i})=>{Y$2.info(`Cart drawer is now`,i?`open`:`closed`),i&&(sh(),await wr());});}function Hi(t){w.globalRef.apiURLs=t;}function kt(t){t?.length&&t.forEach(e=>{ze$1(e.name,e.template);});}async function wr(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};Fo(new Ir$3(`View Cart`,{items:t.items,amount:e,drawer:true}));}var _e=class{runtimeData=We$4();meddle(){let e=w.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{dn();},e.loadExperiments=()=>{Ge();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(i,o)=>{new Ge$1(i).execute(o);},e.sendEvent=i=>{Fo(i);};}overwritePush(e,i){Xn$1(e,`push`,i);}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0]);}),w.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),w.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(nn$1.includes(e[0])?w.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&w.updateProfile(e);}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0]);}),w.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.currentItem&&vr(e.currentItem),e.currency&&(We$4().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&St(e.configurations),e.storeSettings&&St(e.storeSettings),e.storeBrand&&Bi(e.storeBrand),e.apiURLs&&Hi(e.apiURLs),e.widgetPartials&&kt(e.widgetPartials),e.template&&(this.runtimeData.template=e.template),e._error&&ke$1(e._error,e.slug,e.context),e.customContext&&(this.runtimeData.customContext=r$2(r$2({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(We$4().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=cd();if(e||(e=We$4().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let i=new q$1({id:`preview`,shortID:`1`,redirectBehaviour:ae$3.CART_DRAWER});await new Ge$1(new Be$1(new Date,i)).execute({clickAction:{at:he$2.ADD_TO_CART},embeddedItem:new pt$2({vID:e})});}};function vr(t){let e=We$4();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 pt$2(t);}var de=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 yr=1e3,Er=10,Ct=0,Rt=new Date;function It(t){de.remove(`sleid`),Rt=t??new Date;}function $i(){if(window.scrollY){let t=Fi();zi(t)&&Ui(t);}It$3(()=>{xr();});}function xr(){Tr$2(window,`scroll`).pipe(Fe$2(yr),q$2(()=>{let t=Fi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(zi(t))return t})).subscribe(t=>{Ui(t);});}function zi(t){return Math.abs(Ct-t)>=Er||Ct!==t&&t===100}function Ui(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Rt.getTime()};Ct=t;let o=new Ir$3(`CE Scroll`,e,null,de.getString(`sleid`,``));Fo(o),de.setString(`sleid`,o.id.toHexString()),Rt=new Date(o.occurred);}function Fi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Wi(){Sr();}function Sr(){let t=window.fetch;try{window.fetch=async function(e,i){try{await kr(e,i);}catch(o){ke$1(o,`shopify_graphql_request_modify`,{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 kr(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 Cr(o),Rr()));}async function Cr(t){let e=t.variables.input.attributes??[],i=await qn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function Rr(){let t=We$4().currentItem;if(!t)return;Fo(new Ir$3(`Buy Now Clicked`,{items:[t]}));}var pe=class{constructor(e,i){this.selectors=e;this.eventName=i;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let i=e.currentTarget;Fo(new Ir$3(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 pe{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 pe{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 Ir=[`.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 Vi(){It$3(()=>{Y$2.verbose(`Execution order:`,`document ready`),_r();});}function _r(){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(Ir);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`)&&D$1.get().open();}function ji(){window.addEventListener(`kp-modal:opened`,()=>{We$4().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&Mm({goKwikToken:e});});}var w=class{static globalRef;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),fi(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 _e().meddle();return}await eC(),Zh(),new _e().meddle(),hm(),Ge(),Pr(),sC(),Nl(),Wi(),Vi(),$i(),Je.getInstance().listenSilently(),Xe.getInstance().listenSilently(),ji(),Tr(),oo(),$n(),Me.remove(`conf`).catch(i=>{Y$2.error(`Fail to remove App Config from local storage`,i);});}static initGlobalReference(e){window.CooeeSDK||Xn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Xn$1(this.globalRef,`config`,new le$5),Xn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Xn$1(this.globalRef,`uaParser`,new A,true),Xn$1(this.globalRef,`cart`,h.getCurrent()),Xn$1(this.globalRef,`cartChange$`,kl()),Xn$1(this.globalRef,`cartDrawerToggle$`,D$1.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new A;});}static sendEvent(e,i,o){let s=new Ir$3(e,i,o?.triggerData);o?.occurred&&(s.occurred=o.occurred),Fo(s);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Mm(e);}static setPageName(e){if(!e)return;let i=We$4(),o=i.pageName;if(e===o)return;if(i.pageName=e,tn$1.some(d=>e.includes(d))){It();return}let s={};o&&(s.ps=o);let p=new Ir$3(`CE Screen View`,s);p.occurred=i.jsLoadTime,Fo(p),It(p.occurred);}static previewPopup(e,i){import('./renderer-RvPzZTEd-CX-sySv6.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){if(!e)return;let i=new q$1(e);i.isPageWidgets()?ft$1([i]).catch(console.error):i.isCartEmbed()?ut$1([i]).catch(console.error):Y$2.error(`Unsupported widget type for preview: `+i.onsiteDeliveryType);}};function Pr(){window.CooeeSDK.cartChange$.subscribe(()=>{dn();});}function Tr(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(t){Y$2.error(t);}window.addEventListener(`message`,t=>{if(Y$2.verbose(`Received event`,t),!t.origin.includes(`letscooee.com`)&&!t.origin.includes(`localhost`))return;let e=t.data;typeof e==`object`&&(e.action===`POPUP_PREVIEW`?(w.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(w.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var qi=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,ro(),no(),await w.initForMerchantWebsiteOnly(qi),_e$3(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),kr$5()&&Promise.resolve().then(function () { return sdkDebugLogsB2FGwzym; }).then(({printAllDebugLogs:t})=>t(qi)));
|
|
99
|
+
}`),_t}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,s){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:s,color:e,border:s}:{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:s,color:o,border:s}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Ye=class{apply(e){if(!e)return;le$4(new Ke(e).toCSSString());}};function Mi(){let t=le$5.get();!t.gaMeasurementID||!t.gaEnabled||gr();}async function fr(){let t=await ce$5.get(`gacid`),e=await hr();if(t!==e)return await ce$5.set(`gacid`,e),e}async function gr(){let t=await fr();t&&Bm({gaClientID:t});}async function hr(){let e=le$5.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}var Ni=!!new URL(location.href).searchParams?.get(`new-brand`);async function Bi(t){(t?.enabled||Ni)&&new Ye().apply(t);}function br(t){if(!t)return t;let e=t.match(/:root\s*\{/);if(!e)return t;let i=0,o=-1;for(let s=e.index;s<t.length;s++)if(t[s]===`{`)i++;else if(t[s]===`}`&&--i===0){o=s+1;break}return o===-1?t:(t.slice(0,e.index)+t.slice(o)).trimStart()}async function St(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=w.globalRef.config.update(t);Mi(),D$1.initialize(),e.website&&(Ni&&(e.website.commonCSS=br(e.website.commonCSS)),Ui$2(e.website.commonJS),le$4(e.website.commonCSS),kt(e.website.widgetPartials??[])),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$2(10)).subscribe(async({open:i})=>{Y$2.info(`Cart drawer is now`,i?`open`:`closed`),i&&(sh(),await wr());});}function Hi(t){w.globalRef.apiURLs=t;}function kt(t){t?.length&&t.forEach(e=>{ze$1(e.name,e.template);});}async function wr(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};Fo(new Ir$3(`View Cart`,{items:t.items,amount:e,drawer:true}));}var _e=class{runtimeData=We$4();meddle(){let e=w.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{dn();},e.loadExperiments=()=>{Ge();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(i,o)=>{new Ge$1(i).execute(o);},e.sendEvent=i=>{Fo(i);};}overwritePush(e,i){Xn$1(e,`push`,i);}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0]);}),w.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),w.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(nn$1.includes(e[0])?w.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&w.updateProfile(e);}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0]);}),w.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.currentItem&&vr(e.currentItem),e.currency&&(We$4().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&St(e.configurations),e.storeSettings&&St(e.storeSettings),e.storeBrand&&Bi(e.storeBrand),e.apiURLs&&Hi(e.apiURLs),e.widgetPartials&&kt(e.widgetPartials),e.template&&(this.runtimeData.template=e.template),e._error&&ke$1(e._error,e.slug,e.context),e.customContext&&(this.runtimeData.customContext=r$2(r$2({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(We$4().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=cd();if(e||(e=We$4().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let i=new q$1({id:`preview`,shortID:`1`,redirectBehaviour:ae$3.CART_DRAWER});await new Ge$1(new Be$1(new Date,i)).execute({clickAction:{at:he$2.ADD_TO_CART},embeddedItem:new pt$2({vID:e})});}};function vr(t){let e=We$4();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 pt$2(t);}var de=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 yr=1e3,Er=10,Ct=0,Rt=new Date;function It(t){de.remove(`sleid`),Rt=t??new Date;}function $i(){if(window.scrollY){let t=Fi();zi(t)&&Ui(t);}It$3(()=>{xr();});}function xr(){Tr$2(window,`scroll`).pipe(Fe$2(yr),q$2(()=>{let t=Fi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(zi(t))return t})).subscribe(t=>{Ui(t);});}function zi(t){return Math.abs(Ct-t)>=Er||Ct!==t&&t===100}function Ui(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Rt.getTime()};Ct=t;let o=new Ir$3(`CE Scroll`,e,null,de.getString(`sleid`,``));Fo(o),de.setString(`sleid`,o.id.toHexString()),Rt=new Date(o.occurred);}function Fi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Wi(){Sr();}function Sr(){let t=window.fetch;try{window.fetch=async function(e,i){try{await kr(e,i);}catch(o){ke$1(o,`shopify_graphql_request_modify`,{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 kr(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 Cr(o),Rr()));}async function Cr(t){let e=t.variables.input.attributes??[],i=await qn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function Rr(){let t=We$4().currentItem;if(!t)return;Fo(new Ir$3(`Buy Now Clicked`,{items:[t]}));}var pe=class{constructor(e,i){this.selectors=e;this.eventName=i;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let i=e.currentTarget;Fo(new Ir$3(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 pe{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 pe{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 Ir=[`.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 Vi(){It$3(()=>{Y$2.verbose(`Execution order:`,`document ready`),_r();});}function _r(){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(Ir);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`)&&D$1.get().open();}function ji(){window.addEventListener(`kp-modal:opened`,()=>{We$4().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&Mm({goKwikToken:e});});}var w=class{static globalRef;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),fi(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 _e().meddle();return}await eC(),Zh(),new _e().meddle(),hm(),Ge(),Pr(),sC(),Nl(),Wi(),Vi(),$i(),Je.getInstance().listenSilently(),Xe.getInstance().listenSilently(),ji(),Tr(),oo(),$n(),Me.remove(`conf`).catch(i=>{Y$2.error(`Fail to remove App Config from local storage`,i);});}static initGlobalReference(e){window.CooeeSDK||Xn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Xn$1(this.globalRef,`config`,new le$5),Xn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Xn$1(this.globalRef,`uaParser`,new A,true),Xn$1(this.globalRef,`cart`,h.getCurrent()),Xn$1(this.globalRef,`cartChange$`,kl()),Xn$1(this.globalRef,`cartDrawerToggle$`,D$1.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new A;});}static sendEvent(e,i,o){let s=new Ir$3(e,i,o?.triggerData);o?.occurred&&(s.occurred=o.occurred),Fo(s);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Mm(e);}static setPageName(e){if(!e)return;let i=We$4(),o=i.pageName;if(e===o)return;if(i.pageName=e,tn$1.some(d=>e.includes(d))){It();return}let s={};o&&(s.ps=o);let p=new Ir$3(`CE Screen View`,s);p.occurred=i.jsLoadTime,Fo(p),It(p.occurred);}static previewPopup(e,i){import('./renderer-D7IHCPuE-CX-sySv6.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){if(!e)return;let i=new q$1(e);i.isPageWidgets()?ft$1([i]).catch(console.error):i.isCartEmbed()?ut$1([i]).catch(console.error):Y$2.error(`Unsupported widget type for preview: `+i.onsiteDeliveryType);}};function Pr(){window.CooeeSDK.cartChange$.subscribe(()=>{dn();});}function Tr(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(t){Y$2.error(t);}window.addEventListener(`message`,t=>{if(Y$2.verbose(`Received event`,t),!t.origin.includes(`letscooee.com`)&&!t.origin.includes(`localhost`))return;let e=t.data;typeof e==`object`&&(e.action===`POPUP_PREVIEW`?(w.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(w.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var qi=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,ro(),no(),await w.initForMerchantWebsiteOnly(qi),_e$3(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),kr$5()&&Promise.resolve().then(function () { return sdkDebugLogsDRdokoBQ; }).then(({printAllDebugLogs:t})=>t(qi)));
|
|
100
100
|
|
|
101
101
|
var s=`\xA0\xA0\xA0`,l=[`/v1/engagement/cart-widgets`,`/v1/engagement/page-widgets`,`/v1/event/validate-session`];function d(e){if(e===0)return `0 B`;let i=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(i));return `${(e/Math.pow(i,r)).toFixed(2)} ${n[r]}`}function E(e){let i=performance.getEntriesByType?.(`resource`);if(i)return i.filter(n=>n.name.includes(e)).pop()}function R(){let e=performance.getEntriesByType?.(`resource`);return e?e.filter(i=>l.some(n=>i.name.includes(n))):[]}function S(e,i){if(!e){Y$2.info(`\u{1F4E6} API Resource Metrics for ${i}: Not available`);return}Y$2.info(`📦 ═══════════ API Resource Metrics ═══════════`),Y$2.info(`URL: ${i}`),Y$2.info(`Duration: ${Ue$1(e.duration)}`);let n=e.transferSize===0;if(Y$2.info(`Served from: ${n?`💾 Cache (disk/memory)`:`🌐 Network`}`),!n){Y$2.info(`Transfer size: ${d(e.transferSize)}`),Y$2.info(`Encoded size: ${d(e.encodedBodySize)}`),Y$2.info(`Decoded size: ${d(e.decodedBodySize)}`);let c=(1-e.encodedBodySize/e.decodedBodySize)*100;c>0&&Y$2.info(`Compression ratio: ${c.toFixed(1)}%`);}let r=e.redirectEnd-e.redirectStart,f=e.fetchStart-e.startTime,a=e.domainLookupEnd-e.domainLookupStart,u=e.connectEnd-e.connectStart,m=e.secureConnectionStart>0?e.connectEnd-e.secureConnectionStart:0,g=e.connectEnd===e.connectStart?e.requestStart-e.fetchStart-a:e.requestStart-e.connectEnd,T=e.responseStart-e.requestStart,P=e.responseEnd-e.responseStart;Y$2.info(`Timing breakdown (${Ue$1(e.duration)} total):`),r>0&&Y$2.info(`${s}Redirect: ${Ue$1(r)}`),f>0&&Y$2.info(`${s}Queued: ${Ue$1(f)}`),g>0&&Y$2.info(`${s}Stalled: ${Ue$1(g)}`),a>0&&Y$2.info(`${s}DNS lookup: ${Ue$1(a)}`),u>0&&Y$2.info(`${s}TCP connect: ${Ue$1(u)}`),m>0&&Y$2.info(`${s}SSL handshake: ${Ue$1(m)}`),Y$2.info(`${s}Server waiting (TTFB): ${Ue$1(T)}`),Y$2.info(`${s}Content download: ${Ue$1(P)}`);let $=e.serverTiming;if($?.length){Y$2.info(`Server-Timing:`);for(let c of $){let p=c.description||c.name;c.duration>0?Y$2.info(`${s}${p}: ${Ue$1(c.duration)}`):Y$2.info(`${s}${p}: ${c.duration}`);}}Y$2.info(`📦 ═════════════════════════════════════════════`);}function B(){let e=R();return e.length?e.map(n=>JSON.stringify(n.toJSON())).join(`
|
|
102
102
|
`):``}function z(){let e=new Set;for(let n of l){let r=E(n);r?S(r,n):e.add(n);}if(!e.size||typeof PerformanceObserver>`u`)return;let i=new PerformanceObserver(n=>{for(let r of n.getEntries())for(let f of e)if(r.name.includes(f)){S(r,f),e.delete(f);break}e.size||i.disconnect();});i.observe({type:`resource`,buffered:false});}
|
|
103
103
|
|
|
104
104
|
function a(i){return i?new Date(i).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`}):`N/A`}function M(){let i=performance.getEntriesByType?.(`resource`);if(i)return i.find(o=>o.name.includes(`@letscooee/web-sdk`)&&o.name.includes(`main.min.js`))}function x(i){window.cooeeSDKPreview||(document.readyState===`complete`?setTimeout(()=>L(i),100):window.addEventListener(`load`,()=>{setTimeout(()=>L(i),100);}));}function L(i){try{N(i),z();}catch(o){console.error(`Failed to print debugging logs`,o);}}function N(i){let o=performance.getEntriesByType?.(`navigation`)?.[0],f=window.CooeeSDK?.pageLoadTime,l=M(),s=performance.timeOrigin||0,n=o?.responseEnd?s+o.responseEnd:void 0,d=s,c=o?.domContentLoadedEventEnd||0,m=o?.loadEventEnd||0,u=n&&n>0?n:f?f.getTime():0,T=n&&n>0?`HTML download complete`:`inline script execution`,S=c>0?d+c:void 0,$=m>0?d+m:void 0;Y$2.info(`⏱️ ═══════════════ Performance Timing Report ═══════════════`),Y$2.info(`📅 Absolute Timestamps (Local Time):`),Y$2.info(` Note: Inline script can execute during HTML download (incremental parsing)`),Y$2.info(``),Y$2.info(` 1. Navigation started: ${a(d)}`);let r=f?f.getTime():0;if(n&&n>0&&r?r<n?(Y$2.info(` 2. Inline script executed: ${a(r)} (during HTML parsing)`),Y$2.info(` 3. HTML download complete: ${a(n)}`)):(Y$2.info(` 2. HTML download complete: ${a(n)}`),Y$2.info(` 3. Inline script executed: ${a(r)}`)):n&&n>0?Y$2.info(` 2. HTML download complete: ${a(n)}`):r&&Y$2.info(` 2. Inline script executed: ${a(r)}`),Y$2.info(` 4. SDK module loaded: ${a(i.getTime())} (from CDN)`),S&&Y$2.info(` 5. DOMContentLoaded: ${a(S)}`),$&&Y$2.info(` 6. Page fully loaded: ${a($)}`),Y$2.info(``),Y$2.info(`⏱️ Relative Timings:`),n&&n>0&&d){let g=n-d;Y$2.info(` Shopify backend + HTML download: ${Ue$1(g)} (not Cooee SDK)`);}if(u){let g=i.getTime()-u;if(g<0){let w=r>0?r:d,b=r>0?`inline script execution`:`navigation start`,K=i.getTime()-w;Y$2.info(` SDK module load time: ${Ue$1(K)} after ${b}`),Y$2.info(` (Note: Using earlier baseline because SDK loaded before ${T})`);}else Y$2.info(` SDK module load time: ${Ue$1(g)} after ${T}`),Y$2.info(` (Baseline: ${T} at ${a(u)})`);let v=i.getTime()-d;Y$2.info(` \u{1F3AF} Total SDK load time: ${Ue$1(v)} (from navigation start to SDK ready)`);}c&&c>0&&Y$2.info(` DOMContentLoaded: ${Ue$1(c)} after navigation start`),m&&m>0&&Y$2.info(` Page fully loaded: ${Ue$1(m)} after navigation start`),C(l),Y$2.info(`⏱️ ═══════════════════════════════════════════════════════`);}function C(i){if(!i){Y$2.info(``),Y$2.info(`📦 SDK Resource Metrics: Not available`);return}Y$2.info(``),Y$2.info(`📦 SDK Resource Metrics:`),Y$2.info(` URL: ${i.name}`),Y$2.info(` Download duration: ${Ue$1(i.duration)}`);let o=i.transferSize===0;if(Y$2.info(` Served from: ${o?`💾 Cache (disk/memory)`:`🌐 Network`}`),!o){Y$2.info(` Transfer size: ${d(i.transferSize)}`),Y$2.info(` Encoded size: ${d(i.encodedBodySize)}`),Y$2.info(` Decoded size: ${d(i.decodedBodySize)}`);let f=(1-i.encodedBodySize/i.decodedBodySize)*100;f>0&&Y$2.info(` Compression ratio: ${f.toFixed(1)}%`);}if(i.domainLookupEnd>0){let f=i.domainLookupEnd-i.domainLookupStart,l=i.connectEnd-i.connectStart,s=i.responseStart-i.requestStart,n=i.responseEnd-i.responseStart;Y$2.info(` Timing breakdown:`),f>0&&Y$2.info(` DNS lookup: ${Ue$1(f)}`),l>0&&Y$2.info(` TCP connect: ${Ue$1(l)}`),s>0&&Y$2.info(` Request: ${Ue$1(s)}`),n>0&&Y$2.info(` Response: ${Ue$1(n)}`);}}
|
|
105
105
|
|
|
106
|
-
var
|
|
106
|
+
var sdkDebugLogsDRdokoBQ = /*#__PURE__*/Object.freeze({
|
|
107
107
|
__proto__: null,
|
|
108
108
|
printAllDebugLogs: x
|
|
109
109
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './main.min.js';
|
|
2
|
-
import { h as g, W, G as Ge, K as Ke, g as gf, y as ye, i as nc, b as Sv, r as rc, L as Lf, j as bf } from './widgets-
|
|
3
|
-
import { l, f } from './video-detail-dialog.component-
|
|
2
|
+
import { h as g, W, G as Ge, K as Ke, g as gf, y as ye, i as nc, b as Sv, r as rc, L as Lf, j as bf } from './widgets-CmUGXjul-BcJ9RFFl.js';
|
|
3
|
+
import { l, f } from './video-detail-dialog.component-B5lH46XS-B8JpGuln.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=gf({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&&(nc(0,`div`,0)(1,`div`,1)(2,`h3`),Sv(3,`Share`),rc(),nc(4,`button`,2),Lf(`click`,function(e){return t.onShareAndClose(e)}),bf(5,`cooee-icon`,3),rc()(),nc(6,`div`,4)(7,`button`,5),Lf(`click`,function(e){return t.onShareAndClose(e,`Whatsapp`)}),bf(8,`cooee-icon`,6),nc(9,`span`),Sv(10,`Whatsapp`),rc()(),nc(11,`button`,7),Lf(`click`,function(e){return t.onShareAndClose(e,`X(Twitter)`)}),bf(12,`cooee-icon`,8),nc(13,`span`),Sv(14,`X`),rc()(),nc(15,`button`,9),Lf(`click`,function(e){return t.onShareAndClose(e,`Clipboard`)}),bf(16,`cooee-icon`,10),nc(17,`span`),Sv(18,`Copy link`),rc()()()());},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, H as He, s as se, M, t, D as Dr, l as l$1, O, a as Hi, c as ce, Y, b as V } from './main.min.js';
|
|
2
|
-
import { l as jt, h as g, m as Ye, p as be, G as Ge, W, g as gf, q as Kt, z as zt, s as qt, t as KE, u as YE, w as Wt, x as $t, y as ye, i as nc, L as Lf, A as ic, V as VD, C as Ko, r as rc, E as Ef, D as tv, M as Mf, v as vd, H as HD, F as ac, J as Hf, N as $f, T as TN, R as Ro, K as Ke, O as Wt$1, j as bf, S as SN, U as Ss, Y as Yo, o as oc, Q as Qo, Z as cc, _ as Sf, a0 as WD, a1 as LD, a2 as Iu, a3 as wu, a4 as KD, a5 as PD, a6 as Af, a7 as xv, a8 as op, a9 as rp, aa as Nv, ab as Uv, ac as hm } from './widgets-
|
|
2
|
+
import { l as jt, h as g, m as Ye, p as be, G as Ge, W, g as gf, q as Kt, z as zt, s as qt, t as KE, u as YE, w as Wt, x as $t, y as ye, i as nc, L as Lf, A as ic, V as VD, C as Ko, r as rc, E as Ef, D as tv, M as Mf, v as vd, H as HD, F as ac, J as Hf, N as $f, T as TN, R as Ro, K as Ke, O as Wt$1, j as bf, S as SN, U as Ss, Y as Yo, o as oc, Q as Qo, Z as cc, _ as Sf, a0 as WD, a1 as LD, a2 as Iu, a3 as wu, a4 as KD, a5 as PD, a6 as Af, a7 as xv, a8 as op, a9 as rp, aa as Nv, ab as Uv, ac as hm } from './widgets-CmUGXjul-BcJ9RFFl.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=SN.required();progress=jt(0);constructor(){Ss(t=>{let e=this.video(),o=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,o),t(()=>{e.removeEventListener(`timeupdate`,o);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({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,o){e&1&&(Yo(0,`div`,0)(1,`div`,1),oc(2,`div`),Qo()()),e&2&&(vd(),cc(`width`,o.progress(),`%`),Sf(`aria-valuenow`,o.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=TN();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(Wt$1);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-tAmlQZNd-BmLoNJcy.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=gf({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,o){e&1&&(nc(0,`button`,0),Lf(`click`,function(r){return o.share(r)}),bf(1,`cooee-icon`,1),rc());},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&&(nc(0,`div`,11),bf(1,`div`,15),rc());}function Me(n,t){if(n&1&&bf(0,`source`,13),n&2){let e=t.$implicit;Mf(`type`,xv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&Af(0);}function Ne(n,t){if(n&1){let e=WD();nc(0,`cooee-video-promoted-items`,24),Lf(`cardClick`,function(i){Iu(e);let r=KD(2).$implicit;return wu(KD().productCardClicked(i,r.video))})(`atcSuccess`,function(){Iu(e);return wu(KD(3).onAtcSuccess())}),rc();}if(n&2){let e=KD(2).$implicit;Mf(`items`,e.video.items)(`video`,e.video);}}function Fe(n,t){if(n&1&&bf(0,`cooee-video-card`,23),n&2){let e=KD(2).$implicit;Mf(`card`,e.video.card);}}function ze(n,t){if(n&1){let e=WD();bf(0,`cooee-video-progress-bar`,16),nc(1,`div`,17)(2,`cooee-mute-toggle`,18),op(`mutedChange`,function(i){Iu(e);let r=KD(2);return Nv(r.muted,i)||(r.muted=i),wu(i)}),Lf(`toggled`,function(){Iu(e);return wu(KD(2).muteToggled())}),rc(),Ef(3,Oe,1,0,`ng-container`,8),rc(),nc(4,`div`,19)(5,`cooee-share-button`,20),Lf(`dialogState`,function(i){Iu(e);return wu(KD(2).shareDialogOpen.set(i))}),rc()(),nc(6,`div`,21),LD(7,Ne,1,2,`cooee-video-promoted-items`,22)(8,Fe,1,1,`cooee-video-card`,23),rc();}if(n&2){let e=KD().$implicit,o=tv(5),i=KD(),r=tv(9);Mf(`video`,o),vd(2),rp(`muted`,i.muted),Mf(`videoEl`,o),vd(),Mf(`ngTemplateOutlet`,r),vd(4),PD(e.video.items.length&&i.videoConfig.showItems()?7:e.video.card&&i.videoConfig.footerContent===i.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=WD();nc(0,`cooee-item-detail`,25),Lf(`closeClick`,function(){Iu(e);return wu(KD(2).productModalClosed())})(`atcSuccess`,function(){Iu(e);return wu(KD(2).onAtcSuccess())}),rc();}if(n&2){let e=KD(2);Mf(`item`,e.selectedItem)(`video`,e.selectedVideo)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Ae(n,t){if(n&1){let e=WD();nc(0,`div`,6)(1,`div`,9)(2,`div`,10),LD(3,ke,2,0,`div`,11),nc(4,`video`,12,2),Lf(`click`,function(){let i=Iu(e).$index,r=KD();return wu(r.currentIndex===i&&r.toggleMute())})(`ended`,function(){Iu(e);let i=tv(5);return wu(KD().onVideoEnded(i))})(`loadstart`,function(){let i=Iu(e).$index;return wu(KD().onVideoLoadStart(i))})(`canplay`,function(){let i=Iu(e).$index;return wu(KD().onVideoCanPlay(i))}),VD(6,Me,1,3,`source`,13,Pe),rc(),LD(8,ze,9,5),rc(),LD(9,Le,1,4,`cooee-item-detail`,14),rc()();}if(n&2){let e=t.$implicit,o=t.$index,i=KD();vd(2),cc(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),vd(),PD(i.shouldShowVideoSpinner(o)?3:-1),vd(),Mf(`ngClass`,i.viewTemplateClassName)(`muted`,true),Sf(`preload`,i.isVideoVisible(o)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),vd(2),HD(e.video.sources),vd(2),PD(i.currentIndex===o?8:-1),vd(),PD(i.selectedItem&&i.currentIndex===o?9:-1);}}function Re(n,t){n&1&&Af(0);}function Be(n,t){if(n&1){let e=WD();nc(0,`button`,26),Lf(`click`,function(){Iu(e);return wu(KD().close())}),bf(1,`cooee-icon`,27),rc();}}var Ee=class n{swiperComponent;videoElements;VideoConfigFooterContent=se;currentIndex=0;muted=jt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=jt(false);data=g(Ye);elementRef=g(be);eventData=g(Ge);dialogRef=g(W);swiperInitialized=jt(false);swiperOptions=jt(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 Dr,this.navigationConfig=new l$1({enabled:true,size:50,color:new O({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;}onAtcSuccess(){this.videoConfig.detailPopup.closeDialogOnAtc&&this.close();}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 o=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),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 i=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);i.setVideos(e),window.CooeeSDK.sendEvent(i),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,o=this.currentIndex+1;return t===this.currentIndex||t===e||t===o}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:o=>{this.swiperInitialized.set(true),setTimeout(()=>{o.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(i=>i.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let o=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/o).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(g=>g.video.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(t.length===0)return null;let e=t[0],o=window.innerWidth*.9,i=window.innerHeight*.9,r=o/e.width,k=i/e.height,R=Math.min(r,k);return {width:Math.floor(e.width*R),height:Math.floor(e.height*R)}}setVideoContainerDimensions(t,e){let o=this.elementRef.nativeElement;o.style.setProperty(`--video-container-width`,`${t}px`),o.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,o){if(e&1&&ac(Te,7)(Ie,5),e&2){let i;Hf(i=$f())&&(o.swiperComponent=i.first),Hf(i=$f())&&(o.videoElements=i);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,o){e&1&&Lf(`keydown.escape`,function(r){return o.onKeyDown(r)},hm);},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`,`video`,`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`,`video`],[3,`card`],[3,`cardClick`,`atcSuccess`,`items`,`video`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`atcSuccess`,`item`,`video`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,o){if(e&1&&(nc(0,`div`,3)(1,`cooee-swiper`,4,0),Lf(`slideChange`,function(r){return o.onSlideChange(r)}),ic(3,5),VD(4,Ae,10,10,`div`,6,Se),Ko(),rc(),nc(6,`div`,7),Ef(7,Re,1,0,`ng-container`,8),rc()(),Ef(8,Be,2,0,`ng-template`,null,1,Uv)),e&2){let i=tv(9);Mf(`ngClass`,o.viewTemplateClassName),vd(),Mf(`options`,o.swiperOptions())(`navigationConfig`,o.navigationConfig),vd(3),HD(o.videoEntries),vd(3),Mf(`ngTemplateOutlet`,i);}},dependencies:[Kt,zt,qt,P,S,KE,YE,Wt,$t,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=SN.required();progress=jt(0);constructor(){Ss(t=>{let e=this.video(),o=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,o),t(()=>{e.removeEventListener(`timeupdate`,o);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({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,o){e&1&&(Yo(0,`div`,0)(1,`div`,1),oc(2,`div`),Qo()()),e&2&&(vd(),cc(`width`,o.progress(),`%`),Sf(`aria-valuenow`,o.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=TN();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(Wt$1);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-DKEiudMg-D6mR2OHb.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=gf({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,o){e&1&&(nc(0,`button`,0),Lf(`click`,function(r){return o.share(r)}),bf(1,`cooee-icon`,1),rc());},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&&(nc(0,`div`,11),bf(1,`div`,15),rc());}function Me(n,t){if(n&1&&bf(0,`source`,13),n&2){let e=t.$implicit;Mf(`type`,xv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&Af(0);}function Ne(n,t){if(n&1){let e=WD();nc(0,`cooee-video-promoted-items`,24),Lf(`cardClick`,function(i){Iu(e);let r=KD(2).$implicit;return wu(KD().productCardClicked(i,r.video))})(`atcSuccess`,function(){Iu(e);return wu(KD(3).onAtcSuccess())}),rc();}if(n&2){let e=KD(2).$implicit;Mf(`items`,e.video.items)(`video`,e.video);}}function Fe(n,t){if(n&1&&bf(0,`cooee-video-card`,23),n&2){let e=KD(2).$implicit;Mf(`card`,e.video.card);}}function ze(n,t){if(n&1){let e=WD();bf(0,`cooee-video-progress-bar`,16),nc(1,`div`,17)(2,`cooee-mute-toggle`,18),op(`mutedChange`,function(i){Iu(e);let r=KD(2);return Nv(r.muted,i)||(r.muted=i),wu(i)}),Lf(`toggled`,function(){Iu(e);return wu(KD(2).muteToggled())}),rc(),Ef(3,Oe,1,0,`ng-container`,8),rc(),nc(4,`div`,19)(5,`cooee-share-button`,20),Lf(`dialogState`,function(i){Iu(e);return wu(KD(2).shareDialogOpen.set(i))}),rc()(),nc(6,`div`,21),LD(7,Ne,1,2,`cooee-video-promoted-items`,22)(8,Fe,1,1,`cooee-video-card`,23),rc();}if(n&2){let e=KD().$implicit,o=tv(5),i=KD(),r=tv(9);Mf(`video`,o),vd(2),rp(`muted`,i.muted),Mf(`videoEl`,o),vd(),Mf(`ngTemplateOutlet`,r),vd(4),PD(e.video.items.length&&i.videoConfig.showItems()?7:e.video.card&&i.videoConfig.footerContent===i.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=WD();nc(0,`cooee-item-detail`,25),Lf(`closeClick`,function(){Iu(e);return wu(KD(2).productModalClosed())})(`atcSuccess`,function(){Iu(e);return wu(KD(2).onAtcSuccess())}),rc();}if(n&2){let e=KD(2);Mf(`item`,e.selectedItem)(`video`,e.selectedVideo)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Ae(n,t){if(n&1){let e=WD();nc(0,`div`,6)(1,`div`,9)(2,`div`,10),LD(3,ke,2,0,`div`,11),nc(4,`video`,12,2),Lf(`click`,function(){let i=Iu(e).$index,r=KD();return wu(r.currentIndex===i&&r.toggleMute())})(`ended`,function(){Iu(e);let i=tv(5);return wu(KD().onVideoEnded(i))})(`loadstart`,function(){let i=Iu(e).$index;return wu(KD().onVideoLoadStart(i))})(`canplay`,function(){let i=Iu(e).$index;return wu(KD().onVideoCanPlay(i))}),VD(6,Me,1,3,`source`,13,Pe),rc(),LD(8,ze,9,5),rc(),LD(9,Le,1,4,`cooee-item-detail`,14),rc()();}if(n&2){let e=t.$implicit,o=t.$index,i=KD();vd(2),cc(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),vd(),PD(i.shouldShowVideoSpinner(o)?3:-1),vd(),Mf(`ngClass`,i.viewTemplateClassName)(`muted`,true),Sf(`preload`,i.isVideoVisible(o)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),vd(2),HD(e.video.sources),vd(2),PD(i.currentIndex===o?8:-1),vd(),PD(i.selectedItem&&i.currentIndex===o?9:-1);}}function Re(n,t){n&1&&Af(0);}function Be(n,t){if(n&1){let e=WD();nc(0,`button`,26),Lf(`click`,function(){Iu(e);return wu(KD().close())}),bf(1,`cooee-icon`,27),rc();}}var Ee=class n{swiperComponent;videoElements;VideoConfigFooterContent=se;currentIndex=0;muted=jt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=jt(false);data=g(Ye);elementRef=g(be);eventData=g(Ge);dialogRef=g(W);swiperInitialized=jt(false);swiperOptions=jt(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 Dr,this.navigationConfig=new l$1({enabled:true,size:50,color:new O({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;}onAtcSuccess(){this.videoConfig.detailPopup.closeDialogOnAtc&&this.close();}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 o=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),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 i=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);i.setVideos(e),window.CooeeSDK.sendEvent(i),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,o=this.currentIndex+1;return t===this.currentIndex||t===e||t===o}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:o=>{this.swiperInitialized.set(true),setTimeout(()=>{o.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(i=>i.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let o=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/o).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(g=>g.video.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(t.length===0)return null;let e=t[0],o=window.innerWidth*.9,i=window.innerHeight*.9,r=o/e.width,k=i/e.height,R=Math.min(r,k);return {width:Math.floor(e.width*R),height:Math.floor(e.height*R)}}setVideoContainerDimensions(t,e){let o=this.elementRef.nativeElement;o.style.setProperty(`--video-container-width`,`${t}px`),o.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,o){if(e&1&&ac(Te,7)(Ie,5),e&2){let i;Hf(i=$f())&&(o.swiperComponent=i.first),Hf(i=$f())&&(o.videoElements=i);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,o){e&1&&Lf(`keydown.escape`,function(r){return o.onKeyDown(r)},hm);},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`,`video`,`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`,`video`],[3,`card`],[3,`cardClick`,`atcSuccess`,`items`,`video`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`atcSuccess`,`item`,`video`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,o){if(e&1&&(nc(0,`div`,3)(1,`cooee-swiper`,4,0),Lf(`slideChange`,function(r){return o.onSlideChange(r)}),ic(3,5),VD(4,Ae,10,10,`div`,6,Se),Ko(),rc(),nc(6,`div`,7),Ef(7,Re,1,0,`ng-container`,8),rc()(),Ef(8,Be,2,0,`ng-template`,null,1,Uv)),e&2){let i=tv(9);Mf(`ngClass`,o.viewTemplateClassName),vd(),Mf(`options`,o.swiperOptions())(`navigationConfig`,o.navigationConfig),vd(3),HD(o.videoEntries),vd(3),Mf(`ngTemplateOutlet`,i);}},dependencies:[Kt,zt,qt,P,S,KE,YE,Wt,$t,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
|
|
9
|
+
var videoDetailDialog_componentB5lH46XS = /*#__PURE__*/Object.freeze({
|
|
10
10
|
__proto__: null,
|
|
11
11
|
VideoDetailDialogComponent: Ee
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
export { f, l,
|
|
14
|
+
export { f, l, videoDetailDialog_componentB5lH46XS as v };
|
|
@@ -32,14 +32,14 @@ var rn={schedule(n,t){let e=setTimeout(n,t);return ()=>clearTimeout(e)}};functio
|
|
|
32
32
|
`],encapsulation:3})};var Je=class n{dialog=g(Ro);dialogRef;constructor(){}showItemQuickView(t,e){this.dialogRef=this.dialog.open(Ye,{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 Xe=(i=>(i.SINGLE_DROPDOWN=`SINGLE_DROPDOWN`,i.MULTIPLE_DROPDOWNS=`MULTIPLE_DROPDOWNS`,i.CHIPS=`CHIPS`,i))(Xe||{});var En=n=>({row:n}),yt=(n,t)=>t.id,In=(n,t)=>t.mID;function Pn(n,t){if(n&1&&(nc(0,`option`,7),Sv(1),rc()),n&2){let e=t.$implicit,i=t.$index,o=KD().$implicit,a=KD(2);Mf(`value`,i)(`selected`,a.selectedOptions()[o.name]===e.name)(`disabled`,!!e.disabled),vd(),lc(` `,e.name,` `);}}function kn(n,t){if(n&1){let e=WD();nc(0,`select`,6,0),Lf(`change`,function(){let o=Iu(e).$implicit,a=tv(1);return wu(KD(2).onDropdownChange(o,a.value))}),VD(2,Pn,2,4,`option`,7,BD),rc();}if(n&2){let e=t.$implicit;Mf(`name`,e.name),Sf(`aria-label`,e.name),vd(2),HD(e.optionValues);}}function Dn(n,t){if(n&1&&(nc(0,`div`,2),VD(1,kn,4,2,`select`,5,yt),rc()),n&2){let e=KD();Mf(`ngClass`,Pv(1,En,e.horizontal())),vd(),HD(e.options());}}function Mn(n,t){if(n&1&&(nc(0,`option`,7),Sv(1),rc()),n&2){let e=t.$implicit,i=KD(2);Mf(`value`,e.mID)(`selected`,i.item().selectedOrFirstVariant.value.mID===e.mID)(`disabled`,!e.isAvailable),vd(),lc(` `,e.name,` `);}}function Fn(n,t){if(n&1){let e=WD();nc(0,`div`,3)(1,`select`,8,1),Lf(`change`,function(){Iu(e);let o=tv(2);return wu(KD().onVariantChange(o.value))}),VD(3,Mn,2,4,`option`,7,In),rc()();}if(n&2){let e=KD();vd(),Sf(`aria-label`,`Select variant`),vd(2),HD(e.item().vars);}}function On(n,t){if(n&1&&(nc(0,`div`,11),Sv(1),nc(2,`span`,14),Sv(3),rc()()),n&2){let e=KD().$implicit,i=KD(2);vd(),lc(` `,e.name),vd(2),lc(`: `,i.selectedOptions()[e.name]);}}function An(n,t){if(n&1&&(nc(0,`span`,16),Sv(1),rc()),n&2){KD();let e=Rv(0);vd(),np(e);}}function Ln(n,t){if(n&1){let e=WD();sp(0),nc(1,`button`,15),Lf(`click`,function(){let o=Iu(e).$implicit,a=KD().$implicit;return wu(KD(2).onOptionSelect(a,o))}),LD(2,An,2,1,`span`,16),rc();}if(n&2){let e=t.$implicit,i=KD().$implicit,o=Rv(0),a=KD(2),l=e.name,p=Av(e.displayName||e.name),f=e.swatch,M=o?e.hexColor??l:``,Z=a.selectedOptions()[i.name]===l;vd(),uc(`option-value--swatch`,o)(`option-value--selected`,Z)(`option-value--disabled`,e.disabled),Mf(`title`,p)(`ngStyle`,a.getSwatchStyles(f,M)),Sf(`aria-checked`,Z)(`aria-label`,p)(`aria-disabled`,e.disabled||null),vd(),PD(o?-1:2);}}function Rn(n,t){if(n&1&&(sp(0),nc(1,`div`,10),LD(2,On,4,2,`div`,11),nc(3,`div`,12),VD(4,Ln,3,13,`button`,13,yt),rc()()),n&2){let e=t.$implicit,i=KD(2);Av(i.isColorSwatch(e)),vd(2),PD(i.hideOptionNames()?-1:2),vd(),Sf(`aria-label`,e.name),vd(),HD(e.optionValues);}}function Nn(n,t){if(n&1&&(nc(0,`div`,9),VD(1,Rn,6,3,`div`,10,yt),rc()),n&2){let e=KD();uc(`options-list--horizontal`,e.horizontal()),vd(),HD(e.options());}}var Ae=n=>n.trim().toLowerCase(),et=class n{item=SN.required();selectorType=SN();horizontal=SN(false);hideOptionNames=SN(false);variantSelected=TN();selectedOptions=Zv(()=>{let t=this.item(),e=t.vars.find(o=>o.isAvailable)??t.vars[0],i={};return t.options?.forEach(o=>{let a=e?.selectedOptions.find(l=>l.name===o.name)?.value;a&&(i[o.name]=a);}),i});availabilityIndex=Wv(()=>{let t=this.item(),e=new Map;return t?.vars?.length&&t.vars.forEach((i,o)=>{if(i.isAvailable)for(let a of i.selectedOptions){let l=Ae(a.name),p=e.get(l);p||e.set(l,p=new Map);let f=p.get(a.value);f||p.set(a.value,f=new Set),f.add(o);}}),e});options=Wv(()=>{let t=this.item();return !t.options||t.vars.length===1?[]:(t.options.forEach(e=>{e.optionValues.forEach(i=>{i.disabled=this.isOptionValueDisabledFast(e,i);});}),t.options)});matchedVariant=Wv(()=>{let t=this.item(),e=this.selectedOptions();return t.vars.find(i=>t.options.every(o=>{let a=i.selectedOptions.find(l=>l.name===o.name)?.value;return e[o.name]===a}))});constructor(){Ss(()=>{let t=this.matchedVariant();t&&(this.item().setSelectedVariant(t),this.variantSelected.emit(t));}),Ss(()=>{let t=this.item();if(!t.options)return;try{window.cooeeManipulateProduct&&window.cooeeManipulateProduct(t);}catch(a){Y$1.error(a);}let e=We$3(),o=(e?.currentItem?.vID?this.item().vars.find(a=>a.mID===e.currentItem.vID):void 0)||t.vars.find(a=>a.isAvailable)||t.vars[0];o&&this.syncSelectedOptions(o);});}onPDPVariantChange(t){if(this.item()){this.item().setSelectedVariantByID(t.detail.variantID);let e=this.item().selectedOrFirstVariant.value;this.syncSelectedOptions(e);}}onOptionSelect(t,e){if(e.disabled)return;this.selectedOptions.set(s(r({},this.selectedOptions()),{[t.name]:e.name}));let i=this.matchedVariant();i&&(this.item().setSelectedVariant(i),this.notifyProductChange({product:this.item(),variant:i}));}onDropdownChange(t,e){let i=t.optionValues[Number(e)];i&&this.onOptionSelect(t,i);}isColorSwatch(t){return t.optionValues.some(e=>!!e.swatch||/#[a-f0-9]{6}\b/i.test(e.name))}getSwatchStyles(t,e){return !t&&e?{"--swatch-color":e}:t?.image?.url?{"background-image":`url("${t.image.url}")`}:t?.color?{"--swatch-color":t.color}:{}}showSingleDropdown(){return this.item().vars?.length<=1?false:!this.selectorType()||this.selectorType()===`SINGLE_DROPDOWN`}showMultipleDropdowns(){return this.item().vars?.length<=1?false:this.selectorType()===`MULTIPLE_DROPDOWNS`}showChips(){return this.item().vars?.length<=1?false:this.selectorType()===`CHIPS`}onVariantChange(t){let e=this.item().vars.find(i=>i.mID===t);e&&(this.item().setSelectedVariant(e),this.notifyProductChange({product:this.item(),variant:e}),this.variantSelected.emit(e));}notifyProductChange(t){document.dispatchEvent(new CustomEvent(`letscooee:outbound:variant-change`,{detail:t}));}syncSelectedOptions(t){let e={};t.selectedOptions.forEach(i=>{e[i.name]=i.value;}),this.selectedOptions.set(e);}getCandidateVariantsExcluding(t){let e=this.item(),i=this.availabilityIndex(),o=new Set;e.vars.forEach((l,p)=>{l.isAvailable&&o.add(p);});let a=o;for(let[l,p]of Object.entries(this.selectedOptions())){if(Ae(l)===Ae(t))continue;let f=i.get(Ae(l));if(!f)return new Set;let M=f.get(String(p));if(!M)return new Set;if(a=new Set([...a].filter(Z=>M.has(Z))),a.size===0)return a}return a}isOptionValueDisabledFast(t,e){let o=this.availabilityIndex().get(Ae(t.name));if(!o)return true;let a=e.name,l=o.get(a);if(!l||l.size===0)return true;let p=this.getCandidateVariantsExcluding(t.name);if(p.size===0)return true;for(let f of p)if(l.has(f))return false;return true}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-product-variant-selector`]],hostBindings:function(e,i){e&1&&Lf(`letscooee:variant-change`,function(a){return i.onPDPVariantChange(a)},gm);},inputs:{item:[1,`item`],selectorType:[1,`selectorType`],horizontal:[1,`horizontal`],hideOptionNames:[1,`hideOptionNames`]},outputs:{variantSelected:`variantSelected`},decls:3,vars:1,consts:[[`sel`,``],[`variantSelect`,``],[1,`dropdowns-wrapper`,3,`ngClass`],[1,`dropdown-wrapper`],[1,`options-list`,3,`options-list--horizontal`],[1,`option-selector`,3,`name`],[1,`option-selector`,3,`change`,`name`],[3,`value`,`selected`,`disabled`],[1,`option-selector`,3,`change`],[1,`options-list`],[1,`option-group`],[1,`option-label`],[`role`,`radiogroup`,1,`option-values`],[`type`,`button`,`role`,`radio`,1,`option-value`,3,`option-value--swatch`,`option-value--selected`,`option-value--disabled`,`title`,`ngStyle`],[1,`option-selected-name`],[`type`,`button`,`role`,`radio`,1,`option-value`,3,`click`,`title`,`ngStyle`],[1,`option-value__label`]],template:function(e,i){e&1&&LD(0,Dn,3,3,`div`,2)(1,Fn,5,1,`div`,3)(2,Nn,3,2,`div`,4),e&2&&PD(i.showMultipleDropdowns()?0:i.showSingleDropdown()?1:i.showChips()?2:-1);},dependencies:[YE,QE],styles:[`:host{display:block}.options-list{display:flex;flex-direction:column;gap:var(--lc-spacing-sm, 8px)}.options-list--horizontal{flex-direction:row;flex-wrap:wrap;align-items:flex-start}.option-group{display:flex;flex-direction:column;gap:var(--lc-spacing-xs, 4px)}.option-label{font-family:var(--lc-text-family, inherit);font-size:var(--lc-text-size, 14px);color:rgb(var(--lc-text-color, 0 0 0));line-height:1.4}.option-selected-name{font-weight:500}.option-values{display:flex;flex-wrap:wrap;gap:var(--lc-spacing-xs, 4px)}.option-value{display:inline-flex;align-items:center;justify-content:center;padding:4px var(--lc-spacing-sm, 8px);min-width:36px;min-height:32px;border:1px solid rgb(var(--lc-text-color, 0 0 0)/.2);border-radius:var(--lc-button-radius, 4px);background:transparent;color:rgb(var(--lc-text-color, 0 0 0));font-family:var(--lc-text-family, inherit);font-size:var(--lc-text-size, 14px);line-height:1;cursor:pointer;transition:background .15s,color .15s,border-color .15s}.option-value--selected{background:rgb(var(--lc-primary-color));color:rgb(var(--lc-primary-button-color, 255 255 255));border-color:rgb(var(--lc-primary-color))}.option-value--disabled{opacity:.4;cursor:not-allowed;pointer-events:none}.option-value--disabled .option-value__label{text-decoration:line-through}.option-value--swatch{width:var(--lc-swatch-size, 28px);height:var(--lc-swatch-size, 28px);min-width:unset;min-height:unset;padding:0;border-radius:var(--lc-swatch-radius, 50%);border:2px solid transparent;outline:2px solid transparent;outline-offset:0;background-color:var(--swatch-color, transparent);background-size:cover;background-position:center;transition:outline-color .15s,outline-offset .15s}.option-value--swatch.option-value--selected{border-color:rgb(var(--lc-card-bg-color, 255 255 255));outline-color:rgb(var(--lc-primary-color));outline-offset:2px}.option-value--swatch.option-value--disabled{position:relative;overflow:hidden}.option-value--swatch.option-value--disabled:after{content:"";position:absolute;inset:0;background:linear-gradient(to bottom right,transparent calc(50% - .5px),rgba(0,0,0,.4) calc(50% - .5px) calc(50% + .5px),transparent calc(50% + .5px));border-radius:inherit}.dropdowns-wrapper,.dropdown-wrapper{display:flex;gap:8px;width:100%}.option-selector{width:100%;padding:8px 24px 8px 8px;border:1px solid black;border-radius:var(--lc-button-radius);font-size:var(--lc-text-size)}@media(min-width:768px){.option-selector:hover{border-color:rgba(var(--lc-primary-color))}}.option-selector:focus{outline:none}.option-selector{flex:0 0 130px}@media(max-width:768px){.option-selector{flex:1 1 0;min-width:0}}
|
|
33
33
|
`],encapsulation:2})};var Bn=(n,t)=>({enter:n,exit:t}),zn=(n,t)=>t.id;function Hn(n,t){if(n&1&&(nc(0,`div`,3),bf(1,`img`,10),rc()),n&2){let e,i,o=KD();vd(),Mf(`src`,((e=o.selectedVariant())==null?null:e.getOneImage())||o.currentItem.firstImageURL,pm),Sf(`alt`,((i=o.selectedVariant())==null?null:i.name)||o.currentItem.name||`Product image`);}}function jn(n,t){if(n&1&&(nc(0,`div`,13),Sv(1),rc(),nc(2,`div`,14),Sv(3),rc()),n&2){let e=KD(2);vd(),lc(` `,e.getCurrency(e.selectedVariant().price.cmp),` `),vd(2),lc(` `,e.getDiscountPercentage(e.selectedVariant().price),`% off `);}}function $n(n,t){if(n&1&&(nc(0,`div`,12),Sv(1),rc()),n&2){let e=KD(2);vd(),lc(` `,e.stickyATCConfig.leftText,` `);}}function Un(n,t){if(n&1&&(nc(0,`div`,4)(1,`div`,11),Sv(2),rc(),LD(3,jn,4,2),LD(4,$n,2,1,`div`,12),rc()),n&2){let e=KD();vd(2),lc(` `,e.getCurrency(e.selectedVariant().price.d),` `),vd(),PD(e.selectedVariant().price.cmp?3:-1),vd(),PD(e.stickyATCConfig.leftText?4:-1);}}function Qn(n,t){n&1&&Af(0);}function qn(n,t){if(n&1&&(nc(0,`div`,15),Sv(1),rc()),n&2){let e=t.$implicit,i=t.$index;KD(2);let o=Rv(9);Mf(`ngClass`,jv(2,Bn,i===o.currentIndex,i===o.previousIndex)),vd(),lc(` `,e,` `);}}function Wn(n,t){if(n&1&&(nc(0,`div`,9),VD(1,qn,2,5,`div`,15,BD),rc()),n&2){KD();let e=Rv(9);vd(),HD(e.features);}}function Zn(n,t){if(n&1&&bf(0,`cooee-product-variant-selector`,16),n&2){let e=KD(2);Mf(`item`,e.currentItem)(`horizontal`,true)(`hideOptionNames`,true)(`selectorType`,e.stickyATCConfig.variantSelectorConfig==null?null:e.stickyATCConfig.variantSelectorConfig.type);}}function Gn(n,t){if(n&1&&(nc(0,`option`,21),Sv(1),rc()),n&2){let e,i=t.$implicit,o=KD(3);Mf(`value`,i.id)(`selected`,((e=o.selectedVariant())==null||e.selectedSellingPlan==null||e.selectedSellingPlan.value==null?null:e.selectedSellingPlan.value.id)===i.id),vd(),lc(` `,i.name,` `);}}function Kn(n,t){if(n&1){let e=WD();nc(0,`div`,17)(1,`select`,19,1),Lf(`change`,function(){Iu(e);let o=tv(2);return wu(KD(2).onSubscriptionChange(o.value))}),nc(3,`option`,20),Sv(4,`Select Subscription`),rc(),VD(5,Gn,2,3,`option`,21,zn),rc()();}if(n&2){let e=KD(2);vd(5),HD(e.selectedVariant().sellingPlans);}}function Yn(n,t){if(n&1){let e=WD();nc(0,`div`,18)(1,`button`,22),Lf(`click`,function(){Iu(e);return wu(KD(2).onQuantityDecrement())}),Sv(2,`− `),rc(),nc(3,`span`,23),Sv(4),rc(),nc(5,`button`,24),Lf(`click`,function(){Iu(e);return wu(KD(2).onQuantityIncrement())}),Sv(6,`+ `),rc()();}if(n&2){let e=KD(2);vd(4),np(e.currentItem.selectedQty.value);}}function Jn(n,t){if(n&1&&(LD(0,Zn,1,4,`cooee-product-variant-selector`,16),LD(1,Kn,7,0,`div`,17),LD(2,Yn,7,1,`div`,18)),n&2){let e,i=KD();PD(i.currentItem.options.length&&i.stickyATCConfig.variantSelectorConfig!=null&&i.stickyATCConfig.variantSelectorConfig.show?0:-1),vd(),PD(!((e=i.selectedVariant())==null||e.sellingPlans==null)&&e.sellingPlans.length&&i.stickyATCConfig.showSubscriptionSelector?1:-1),vd(),PD(i.stickyATCConfig.showQuantitySelector?2:-1);}}var tt=class n extends Pe{currentItem;stickyATCConfig;selectedVariant=jt$1(void 0);featureSlider=jt$1({features:[],currentIndex:0});VariantSelectorType=Xe;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];let e=We$3(),i=this.currentItem.vars.find(o=>o.mID===e.currentItem.vID);i&&this.currentItem.setSelectedVariantByID(i.mID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation();}update(){}getCurrency(t){return Vr$1(t)}getDiscountPercentage(t){return ((t.cmp-t.d)/t.cmp*100).toFixed(0)}onSubscriptionChange(t){if(!t)return;let e=this.selectedVariant()?.sellingPlans?.find(i=>i.id===t);e&&(this.selectedVariant()?.changeSellingPlan(e),this.notifyProductChange({product:this.currentItem,sellingPlan:e}));}shouldShowImage(){return !!(this.stickyATCConfig.showImage&&(this.selectedVariant()?.getOneImage()||this.currentItem.firstImageURL))}onQuantityIncrement(){this.updateQuantity(this.currentItem.selectedQty.value+1);}onQuantityDecrement(){this.updateQuantity(Math.max(1,this.currentItem.selectedQty.value-1));}updateQuantity(t){this.currentItem.selectedQuantity=t,this.notifyProductChange({product:this.currentItem,quantity:t});}addToCart(){this.engagementService.executeCTA(he$2.ADD_TO_CART,{item:this.currentItem});}notifyProductChange(t){document.dispatchEvent(new CustomEvent(`letscooee:outbound:variant-change`,{detail:t}));}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let t=this.stickyATCConfig.rightText.split(`
|
|
34
34
|
`),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$2(t,this.currentItem.getTemplateVariables(),this.triggerContext):``}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-sticky-atc`]],hostBindings:function(e,i){e&1&&Lf(`letscooee:variant-change`,function(a){return i.onVariantChange(a)},gm);},features:[up(Gt()),Ya],decls:13,vars:6,consts:[[`selectorsTemplate`,``],[`subscriptionSelect`,``],[1,`lc-wrapper`],[1,`image-wrapper`],[1,`lc-prices`],[4,`ngTemplateOutlet`],[1,`lc-button-wrapper`],[`type`,`button`,1,`lc-button`,`lc-button-atc`,3,`click`],[1,`atc-sale-price`],[1,`lc-features`],[`loading`,`lazy`,3,`src`],[1,`lc-sale-price`],[1,`lc-additional-text`],[1,`lc-compare-price`],[1,`lc-discount-label`],[1,`lc-feature`,3,`ngClass`],[3,`item`,`horizontal`,`hideOptionNames`,`selectorType`],[1,`subscription-selector-wrapper`],[1,`quantity-selector`],[`aria-label`,`Subscription`,1,`subscription-selector`,3,`change`],[`value`,``],[3,`value`,`selected`],[`type`,`button`,`aria-label`,`Decrease quantity`,1,`qty-btn`,3,`click`],[1,`qty-value`],[`type`,`button`,`aria-label`,`Increase quantity`,1,`qty-btn`,3,`click`]],template:function(e,i){if(e&1&&(nc(0,`div`,2),LD(1,Hn,2,2,`div`,3),LD(2,Un,5,3,`div`,4),Ef(3,Qn,1,0,`ng-container`,5),nc(4,`div`,6)(5,`button`,7),Lf(`click`,function(){return i.addToCart()}),Sv(6,` Add To Cart `),nc(7,`span`,8),Sv(8),rc()(),sp(9),LD(10,Wn,3,0,`div`,9),rc()(),Ef(11,Jn,3,3,`ng-template`,null,0,Uv)),e&2){let o=tv(12);vd(),PD(i.shouldShowImage()?1:-1),vd(),PD(i.selectedVariant()&&i.stickyATCConfig.showProductInfo?2:-1),vd(),Mf(`ngTemplateOutlet`,o),vd(5),lc(` `,i.getCurrency(i.selectedVariant().price.d*i.currentItem.selectedQty.value),` `),vd();let a=Av(i.featureSlider());vd(),PD(a.features.length?10:-1);}},dependencies:[YE,KE,et],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%;margin:0 auto}.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:rgba(var(--lc-primary-button-bg-color));color:rgba(var(--lc-primary-button-color));font-weight:var(--lc-primary-button-weight);text-transform:var(--lc-primary-button-transform);border-radius:var(--lc-button-radius);font-size:var(--lc-button-size);font-family:var(--lc-button-family),serif;height:var(--lc-button-height);letter-spacing:var(--lc-button-letter-spacing);transition:filter .12s ease,background-color .2s ease,color .2s ease;border-width:1px;border-style:solid;border-color:rgba(var(--lc-primary-button-border-color));display:flex;align-items:center;justify-content:center;gap:8px}.lc-button cooee-icon,.lc-button>svg,.lc-button>img{width:var(--lc-button-icon-size);height:var(--lc-button-icon-size);color:inherit}.lc-button:hover{filter:brightness(.95)}.lc-button:active{filter:brightness(.9)}.lc-button:focus-visible{outline:2px solid rgba(var(--lc-primary-color, 0, 0, 0));outline-offset:2px}.lc-button{min-width:150px;width:100%;padding:8px}.lc-button .atc-sale-price{display:none}.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}.image-wrapper{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:70px;height:70px;border-radius:4px}.image-wrapper img{width:100%;height:100%;object-fit:cover;border-radius:4px}.selectors-wrapper{display:flex;gap:8px;flex:1 1 100%;min-width:0}cooee-product-variant-selector{flex:0 1 auto}@media(max-width:768px){cooee-product-variant-selector{flex:1 1 0}}.subscription-selector-wrapper{flex:0 0 130px;display:flex}@media(max-width:768px){.subscription-selector-wrapper{flex:1 1 auto;min-width:0}}.subscription-selector-wrapper .subscription-selector{width:100%;padding:8px 24px 8px 8px;border:1px solid black;border-radius:var(--lc-button-radius);font-size:var(--lc-text-size)}@media(min-width:768px){.subscription-selector-wrapper .subscription-selector:hover{border-color:rgba(var(--lc-primary-color))}}.subscription-selector-wrapper .subscription-selector:focus{outline:none}.quantity-selector{flex:0 0 auto;display:flex;align-items:stretch;border:1px solid black;border-radius:var(--lc-button-radius)}.quantity-selector .qty-btn{display:flex;align-items:center;justify-content:center;flex:0 0 28px;border:none;cursor:pointer;font-size:18px;font-weight:600;padding:4px;border-radius:var(--lc-button-radius)}.quantity-selector .qty-btn:active{background-color:#f0f0f0}@media(min-width:768px){.quantity-selector .qty-btn:hover{background-color:#f5f5f5}}.quantity-selector .qty-value{display:flex;place-content:center;justify-content:center;flex:0 0 28px;padding:8px 0;text-align:center;font-size:14px;font-weight:500}@media(max-width:768px){.lc-wrapper{flex-wrap:wrap;align-items:start}.lc-prices,.lc-button-wrapper{flex-basis:auto;flex-grow:1}cooee-product-variant-selector{order:1;flex-basis:100%}.quantity-selector{order:4}.lc-button-wrapper{order:5}}
|
|
35
|
-
`],encapsulation:3})};var Xn=[`videoEl`];async function Di(){return (await import('./video-detail-dialog.component-zAJXIDWb-BA1XN4T2.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var ye=class n extends Pe{videoElements;videoEntries;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Di();}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,o,a){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){o&&(o.muted=false,o.play(),this.onMuteToggled(false,o));return}await this.openDialog(e,i,a);}sendEvent(t,e,i,o){let a=new Ir$1(t,e,this.engagementTrigger);a.setVideos(i),o&&(a.items=[o.toEmbed()]),window.CooeeSDK.sendEvent(a);}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(o=>{let a=o.target,l=a.dataset.videoId;l&&(o.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(a,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(a,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$4();if(!t||!this.videoEntries)return;let e=Je$2();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$2)return;let i=this.videoEntries.findIndex(o=>o.video.shortID===+t);if(i!==-1){let o=this.videoEntries[i].video;await ce$2.set(`muted`,true),await this.openDialog(o,i);}}async openDialog(t,e,i){await Vi$1();let o={videoEntries:this.videoEntries,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await Di();this.dialogRef=this.dialog.open(a,{width:`100vw`,height:`100vh`,data:o,providers:an$1(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(p=>{if(this.dialogRef=null,!p)return;let f=p.lastVideoDuration*1e3,M={videoID:p.lastVideo.id,videoIndex:p.lastVideoIndex,playedTillMS:f,playedTillPercent:f/p.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:M},p.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&ac(Xn,5),e&2){let o;Hf(o=$f())&&(i.videoElements=o);}},features:[Ya],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var _e=class n{video=SN.required({alias:`cooeeVideoSources`});prioritySource=SN(`high`);elementRef=g(be$1);constructor(){Ss(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(a=>a.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=wn$2({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var eo=(n,t)=>t.video.id;function to(n,t){if(n&1&&(bf(0,`div`,1),Bv(1,`safeHtml`)),n&2)Mf(`innerHTML`,Hv(1,1,KD().videoConfig.heading),fm);}function io(n,t){n&1&&(nc(0,`div`,6),bf(1,`div`,12),rc());}function no(n,t){if(n&1){let e=WD();nc(0,`cooee-mute-toggle`,13),Lf(`toggled`,function(o){Iu(e),KD();let a=tv(7);return wu(KD().onMuteToggled(o,a))}),rc();}if(n&2){KD();let e=tv(7);Mf(`muted`,e.muted)(`videoEl`,e);}}function oo(n,t){if(n&1){let e=WD();nc(0,`cooee-video-promoted-items`,16),Lf(`cardClick`,function(o){Iu(e);let a=KD(2).$index,l=tv(7),p=Rv(0);return wu(KD().onItemCardClick(o,p,a,l))}),rc();}if(n&2){KD(2);Mf(`items`,Rv(0).items)(`centeredSlides`,false);}}function ro(n,t){if(n&1){let e=WD();nc(0,`cooee-item-card`,17),Lf(`buttonClick`,function(){Iu(e);let o=KD(2).$index,a=tv(7),l=Rv(0);return wu(KD().addToCartClicked(null,l,o,a))})(`click`,function(){Iu(e);let o=KD(2).$index,a=tv(7),l=Rv(0),p=Rv(1);return wu(KD().onItemCardClick(p,l,o,a))}),rc();}if(n&2){KD(2);Mf(`item`,Rv(1));}}function ao(n,t){if(n&1&&LD(0,oo,1,2,`cooee-video-promoted-items`,14)(1,ro,1,1,`cooee-item-card`,15),n&2){KD();let e=Rv(0),i=KD();PD(Rv(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function so(n,t){if(n&1){let e=WD();nc(0,`cooee-video-card`,18),Lf(`linkClicked`,function(){Iu(e),KD();let o=Rv(0);return wu(KD().sendTriggerClicked(o))}),rc();}if(n&2){KD();Mf(`card`,Rv(2));}}function lo(n,t){if(n&1){let e=WD();sp(0)(1)(2),nc(3,`div`,4)(4,`div`,5),Lf(`click`,function(o){let a=Iu(e).$index,l=tv(7),p=Rv(0);return wu(KD().onVideoTap(o,p,a,l))})(`keydown.enter`,function(o){let a=Iu(e).$index,l=tv(7),p=Rv(0);return wu(KD().onVideoTap(o,p,a,l))})(`keydown.space`,function(o){let a=Iu(e).$index,l=tv(7),p=Rv(0);return wu(KD().onVideoTap(o,p,a,l))}),LD(5,io,2,0,`div`,6),nc(6,`video`,7,0),Lf(`mouseenter`,function(){Iu(e);let o=tv(7);KD();return wu(Rv(1)&&o.play())})(`mouseleave`,function(){Iu(e);let o=tv(7);KD();return wu(Rv(1)&&o.pause())})(`loadstart`,function(){Iu(e);let o=Rv(0);return wu(KD().onVideoLoadStart(o.id))})(`canplay`,function(){Iu(e);let o=Rv(0);return wu(KD().onVideoCanPlay(o.id))}),rc(),nc(8,`div`,8),LD(9,no,1,2,`cooee-mute-toggle`,9),rc()(),nc(10,`div`,10),LD(11,ao,2,1)(12,so,1,1,`cooee-video-card`,11),rc()();}if(n&2){let e=t.$implicit,i=KD(),o=Rv(0),a=Rv(2),l=Av(e.video);vd(),Av(l.items[0]),vd();let f=Av(l.card)&&a===i.VideoConfigFooterContent.CARD;vd(2),cc(`background-image`,l.thumbnail?`url(`+l.thumbnail+`)`:null),vd(),PD(i.isVideoLoading(l.id)?5:-1),vd(),Mf(`cooeeVideoSources`,l)(`muted`,true),Sf(`poster`,l.thumbnail)(`preload`,o?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,l.id),vd(3),PD(i.videoConfig.showMuteButton?9:-1),vd(2),PD(i.videoConfig.showItems()?11:f?12:-1);}}var it=class n extends ye{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,o){let a=e.items?.[0],l=le$3.get().website?.canChangeVariantInCart;if(e.items?.length>1||a?.hasVariants()&&!l){this.onItemCardClick(a,e,i,o);return}this.engagementService.executeCTA(he$2.ADD_TO_CART,{item:a,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(he$2.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,o){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,o,t):this.onVideoTap(null,e,i,o);}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=gf({type:n,selectors:[[`cooee-video-playlist`]],features:[up(Gt()),Ya],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&&(sp(0)(1)(2),LD(3,to,2,3,`div`,1),nc(4,`cooee-swiper`,2),ic(5,3),VD(6,lo,13,14,`div`,4,eo),Ko(),rc()),e&2){Av(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),vd(),Av(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),vd(),Av(i.videoConfig.footerContent),vd(),PD(i.videoConfig.heading?3:-1);let o=i.videoConfig.playlistConfig.videoSwiper;vd(),Mf(`options`,i.swiperOptions)(`navigationConfig`,o==null?null:o.navigation)(`paginationConfig`,o==null?null:o.pagination),vd(2),HD(i.videoEntries);}},dependencies:[qt,Wt,$t,fe,_e,Kt,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
|
+
`],encapsulation:3})};var Xn=[`videoEl`];async function Di(){return (await import('./video-detail-dialog.component-B5lH46XS-B8JpGuln.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var ye=class n extends Pe{videoElements;videoEntries;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Di();}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,o,a){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){o&&(o.muted=false,o.play(),this.onMuteToggled(false,o));return}await this.openDialog(e,i,a);}sendEvent(t,e,i,o){let a=new Ir$1(t,e,this.engagementTrigger);a.setVideos(i),o&&(a.items=[o.toEmbed()]),window.CooeeSDK.sendEvent(a);}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(o=>{let a=o.target,l=a.dataset.videoId;l&&(o.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(a,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(a,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$4();if(!t||!this.videoEntries)return;let e=Je$2();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$2)return;let i=this.videoEntries.findIndex(o=>o.video.shortID===+t);if(i!==-1){let o=this.videoEntries[i].video;await ce$2.set(`muted`,true),await this.openDialog(o,i);}}async openDialog(t,e,i){await Vi$1();let o={videoEntries:this.videoEntries,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await Di();this.dialogRef=this.dialog.open(a,{width:`100vw`,height:`100vh`,data:o,providers:an$1(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(p=>{if(this.dialogRef=null,!p)return;let f=p.lastVideoDuration*1e3,M={videoID:p.lastVideo.id,videoIndex:p.lastVideoIndex,playedTillMS:f,playedTillPercent:f/p.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:M},p.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&ac(Xn,5),e&2){let o;Hf(o=$f())&&(i.videoElements=o);}},features:[Ya],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var _e=class n{video=SN.required({alias:`cooeeVideoSources`});prioritySource=SN(`high`);elementRef=g(be$1);constructor(){Ss(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(a=>a.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=wn$2({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var eo=(n,t)=>t.video.id;function to(n,t){if(n&1&&(bf(0,`div`,1),Bv(1,`safeHtml`)),n&2)Mf(`innerHTML`,Hv(1,1,KD().videoConfig.heading),fm);}function io(n,t){n&1&&(nc(0,`div`,6),bf(1,`div`,12),rc());}function no(n,t){if(n&1){let e=WD();nc(0,`cooee-mute-toggle`,13),Lf(`toggled`,function(o){Iu(e),KD();let a=tv(7);return wu(KD().onMuteToggled(o,a))}),rc();}if(n&2){KD();let e=tv(7);Mf(`muted`,e.muted)(`videoEl`,e);}}function oo(n,t){if(n&1){let e=WD();nc(0,`cooee-video-promoted-items`,16),Lf(`cardClick`,function(o){Iu(e);let a=KD(2).$index,l=tv(7),p=Rv(0);return wu(KD().onItemCardClick(o,p,a,l))}),rc();}if(n&2){KD(2);Mf(`items`,Rv(0).items)(`centeredSlides`,false);}}function ro(n,t){if(n&1){let e=WD();nc(0,`cooee-item-card`,17),Lf(`buttonClick`,function(){Iu(e);let o=KD(2).$index,a=tv(7),l=Rv(0);return wu(KD().addToCartClicked(null,l,o,a))})(`click`,function(){Iu(e);let o=KD(2).$index,a=tv(7),l=Rv(0),p=Rv(1);return wu(KD().onItemCardClick(p,l,o,a))}),rc();}if(n&2){KD(2);Mf(`item`,Rv(1));}}function ao(n,t){if(n&1&&LD(0,oo,1,2,`cooee-video-promoted-items`,14)(1,ro,1,1,`cooee-item-card`,15),n&2){KD();let e=Rv(0),i=KD();PD(Rv(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function so(n,t){if(n&1){let e=WD();nc(0,`cooee-video-card`,18),Lf(`linkClicked`,function(){Iu(e),KD();let o=Rv(0);return wu(KD().sendTriggerClicked(o))}),rc();}if(n&2){KD();Mf(`card`,Rv(2));}}function lo(n,t){if(n&1){let e=WD();sp(0)(1)(2),nc(3,`div`,4)(4,`div`,5),Lf(`click`,function(o){let a=Iu(e).$index,l=tv(7),p=Rv(0);return wu(KD().onVideoTap(o,p,a,l))})(`keydown.enter`,function(o){let a=Iu(e).$index,l=tv(7),p=Rv(0);return wu(KD().onVideoTap(o,p,a,l))})(`keydown.space`,function(o){let a=Iu(e).$index,l=tv(7),p=Rv(0);return wu(KD().onVideoTap(o,p,a,l))}),LD(5,io,2,0,`div`,6),nc(6,`video`,7,0),Lf(`mouseenter`,function(){Iu(e);let o=tv(7);KD();return wu(Rv(1)&&o.play())})(`mouseleave`,function(){Iu(e);let o=tv(7);KD();return wu(Rv(1)&&o.pause())})(`loadstart`,function(){Iu(e);let o=Rv(0);return wu(KD().onVideoLoadStart(o.id))})(`canplay`,function(){Iu(e);let o=Rv(0);return wu(KD().onVideoCanPlay(o.id))}),rc(),nc(8,`div`,8),LD(9,no,1,2,`cooee-mute-toggle`,9),rc()(),nc(10,`div`,10),LD(11,ao,2,1)(12,so,1,1,`cooee-video-card`,11),rc()();}if(n&2){let e=t.$implicit,i=KD(),o=Rv(0),a=Rv(2),l=Av(e.video);vd(),Av(l.items[0]),vd();let f=Av(l.card)&&a===i.VideoConfigFooterContent.CARD;vd(2),cc(`background-image`,l.thumbnail?`url(`+l.thumbnail+`)`:null),vd(),PD(i.isVideoLoading(l.id)?5:-1),vd(),Mf(`cooeeVideoSources`,l)(`muted`,true),Sf(`poster`,l.thumbnail)(`preload`,o?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,l.id),vd(3),PD(i.videoConfig.showMuteButton?9:-1),vd(2),PD(i.videoConfig.showItems()?11:f?12:-1);}}var it=class n extends ye{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,o){let a=e.items?.[0],l=le$3.get().website?.canChangeVariantInCart;if(e.items?.length>1||a?.hasVariants()&&!l){this.onItemCardClick(a,e,i,o);return}this.engagementService.executeCTA(he$2.ADD_TO_CART,{item:a,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(he$2.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,o){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,o,t):this.onVideoTap(null,e,i,o);}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=gf({type:n,selectors:[[`cooee-video-playlist`]],features:[up(Gt()),Ya],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&&(sp(0)(1)(2),LD(3,to,2,3,`div`,1),nc(4,`cooee-swiper`,2),ic(5,3),VD(6,lo,13,14,`div`,4,eo),Ko(),rc()),e&2){Av(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),vd(),Av(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),vd(),Av(i.videoConfig.footerContent),vd(),PD(i.videoConfig.heading?3:-1);let o=i.videoConfig.playlistConfig.videoSwiper;vd(),Mf(`options`,i.swiperOptions)(`navigationConfig`,o==null?null:o.navigation)(`paginationConfig`,o==null?null:o.pagination),vd(2),HD(i.videoEntries);}},dependencies:[qt,Wt,$t,fe,_e,Kt,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)}
|
|
36
36
|
`],encapsulation:3})};var co=[`videoElement`],po=n=>({"cursor-grab":n}),nt=class n extends ye{videoElement;video;isDragging=false;hidden=false;cdkDrag=g(ge$1,{self:true});untilDestroyed=Ut();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=gf({type:n,selectors:[[`cooee-video-popup`]],viewQuery:function(e,i){if(e&1&&ac(co,5),e&2){let o;Hf(o=$f())&&(i.videoElement=o.first);}},hostAttrs:[`role`,`button`,`tabindex`,`0`,`aria-label`,`Open video popup `,`cdkDragBoundary`,`body`],hostVars:2,hostBindings:function(e,i){e&1&&Lf(`keydown.enter`,function(a){return i.onClick(a)})(`keydown.space`,function(a){return i.onClick(a)})(`click`,function(a){return i.onClick(a)}),e&2&&mv(i.popupClasses);},features:[up(Gt()),ID([{directive:ge$1,inputs:[`cdkDragBoundary`,`cdkDragBoundary`]}]),Ya],decls:9,vars:6,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`,`prioritySource`]],template:function(e,i){if(e&1){let o=WD();nc(0,`div`,1)(1,`button`,2),Lf(`click`,function(l){return Iu(o),l.stopPropagation(),wu(i.close())}),bf(2,`cooee-icon`,3),rc(),nc(3,`div`,4),bf(4,`cooee-icon`,5),nc(5,`div`,6),Sv(6,`Tap to unmute`),rc()(),bf(7,`video`,7,0),rc();}e&2&&(Mf(`ngClass`,Pv(4,po,i.isDragging)),vd(7),Mf(`muted`,true)(`cooeeVideoSources`,i.video)(`prioritySource`,`low`));},dependencies:[YE,ye$2,_e],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}
|
|
37
37
|
`],encapsulation:3})};var mo=(n,t)=>t.video.id;function uo(n,t){if(n&1&&(bf(0,`div`,1),Bv(1,`safeHtml`)),n&2)Mf(`innerHTML`,Hv(1,1,KD().videoConfig.heading),fm);}function fo(n,t){n&1&&(nc(0,`div`,9),bf(1,`div`,12),rc());}function go(n,t){if(n&1&&(nc(0,`div`,11),Sv(1),rc()),n&2){let e=KD().$implicit;vd(),np(e.title);}}function vo(n,t){if(n&1){let e=WD();nc(0,`div`,4),Lf(`click`,function(o){let a=Iu(e),l=a.$implicit,p=a.$index;return wu(KD().onVideoTap(o,l.video,p))})(`keydown.enter`,function(o){let a=Iu(e),l=a.$implicit,p=a.$index;return wu(KD().onVideoTap(o,l.video,p))})(`keydown.space`,function(o){let a=Iu(e),l=a.$implicit,p=a.$index;return wu(KD().onVideoTap(o,l.video,p))}),ku(),nc(1,`svg`,5),bf(2,`circle`,6)(3,`circle`,7),rc(),Fu(),nc(4,`div`,8),LD(5,fo,2,0,`div`,9),nc(6,`video`,10,0),Lf(`loadstart`,function(){let o=Iu(e).$implicit;return wu(KD().onVideoLoadStart(o.video.id))})(`canplay`,function(){let o=Iu(e).$implicit;return wu(KD().onVideoCanPlay(o.video.id))}),rc()(),LD(8,go,2,1,`div`,11),rc();}if(n&2){let e=t.$implicit,i=t.$index,o=KD();Sf(`aria-label`,`Open video story `+(i+1)),vd(5),PD(o.isVideoLoading(e.video.id)?5:-1),vd(),Mf(`poster`,e.video.thumbnail)(`cooeeVideoSources`,e.video)(`prioritySource`,`low`)(`muted`,true),Sf(`data-video-id`,e.video.id),vd(2),PD(e.title?8:-1);}}var ot=class n extends ye{constructor(){super();}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver();}ngOnDestroy(){super.ngOnDestroy();}update(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=gf({type:n,selectors:[[`cooee-video-stories`]],features:[up(Gt()),Ya],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&&(LD(0,uo,2,3,`div`,1),nc(1,`div`,2),VD(2,vo,9,8,`div`,3,mo),rc()),e&2&&(PD(i.videoConfig.heading?0:-1),vd(2),HD(i.videoEntries));},dependencies:[_e,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}
|
|
38
|
-
`],encapsulation:3})};async function Rs(){let n=await yC(Pi),t=(e,i)=>{let o=Ii(e,{injector:n.injector});customElements.get(i)||customElements.define(i,o);};t(tt,`cooee-sticky-atc`),t(Ke,`cooee-savings-bar`),t(Ge,`cooee-progressbar`),t(it,`cooee-video-playlist`),t(nt,`cooee-video-popup`),t(ot,`cooee-video-stories`),t(Ne,`cooee-product-options-picker`),t(Qe,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-
|
|
38
|
+
`],encapsulation:3})};async function Rs(){let n=await yC(Pi),t=(e,i)=>{let o=Ii(e,{injector:n.injector});customElements.get(i)||customElements.define(i,o);};t(tt,`cooee-sticky-atc`),t(Ke,`cooee-savings-bar`),t(Ge,`cooee-progressbar`),t(it,`cooee-video-playlist`),t(nt,`cooee-video-popup`),t(ot,`cooee-video-stories`),t(Ne,`cooee-product-options-picker`),t(Qe,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-CG_-S7Xf-Ba7jb9DY.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Je).showItemQuickView(e,i);};}
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var widgetsCmUGXjul = /*#__PURE__*/Object.freeze({
|
|
41
41
|
__proto__: null,
|
|
42
42
|
loadAngularWidgets: Rs
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
export { $v as $, ic as A, BD as B, Ko as C, tv as D, Ef as E, ac as F, Ge$2 as G, HD as H, ID as I, Hf as J, Ke$1 as K, Lf as L, Mf as M, $f as N, Wt$1 as O, Pf as P, Qo as Q, Ro as R, SN as S, TN as T, Ss as U, VD as V, W, XE as X, Yo as Y, cc as Z, Sf as _, a, WD as a0, LD as a1, Iu as a2, wu as a3, KD as a4, PD as a5, Af as a6, xv as a7, op as a8, rp as a9, Nv as aa, Uv as ab, hm as ac,
|
|
45
|
+
export { $v as $, ic as A, BD as B, Ko as C, tv as D, Ef as E, ac as F, Ge$2 as G, HD as H, ID as I, Hf as J, Ke$1 as K, Lf as L, Mf as M, $f as N, Wt$1 as O, Pf as P, Qo as Q, Ro as R, SN as S, TN as T, Ss as U, VD as V, W, XE as X, Yo as Y, cc as Z, Sf as _, a, WD as a0, LD as a1, Iu as a2, wu as a3, KD as a4, PD as a5, Af as a6, xv as a7, op as a8, rp as a9, Nv as aa, Uv as ab, hm as ac, widgetsCmUGXjul as ad, Sv as b, ge$1 as c, Bv as d, Hv as e, fm as f, gf as g, g as h, nc as i, bf as j, kf as k, jt$1 as l, Ye$1 as m, np as n, oc as o, be$1 as p, Kt as q, rc as r, qt as s, KE as t, YE as u, vd as v, Wt as w, $t as x, ye$2 as y, zt 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.8.
|
|
4
|
+
"version": "14.8.16",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "bash .dev/setup.sh",
|
|
7
7
|
"lint": "ng lint",
|
|
File without changes
|