@letscooee/web-sdk 13.1.5 → 13.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HENN5BVN.js → chunk-4E4YLS3I.js} +1 -1
- package/dist/chunk-BMEFEXWO.js +4 -0
- package/dist/{chunk-HJ2OFJSU.js → chunk-KIK4KPM3.js} +1 -1
- package/dist/chunk-OS2E7UQC.js +6 -0
- package/dist/chunk-PLMFOGWI.js +15 -0
- package/dist/chunk-TNST7VOR.js +10 -0
- package/dist/{chunk-JX4H2JCU.js → chunk-TWXZPLZM.js} +1 -1
- package/dist/{debug-logs-6673UIIX.js → debug-logs-JU6PXCQW.js} +1 -1
- package/dist/debugger.component-L6TPXBHJ.js +4 -0
- package/dist/main.min.js +2 -2
- package/dist/{share-dialog.component-RFDIIBU5.js → share-dialog.component-UGACJ5AR.js} +1 -1
- package/dist/video-detail-dialog.component-BHRF7YI3.js +2 -0
- package/dist/widget.min.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7GY3F663.js +0 -6
- package/dist/chunk-GZXFG2HT.js +0 -24
- package/dist/chunk-K77Q3IPF.js +0 -4
- package/dist/chunk-T6RU7RSX.js +0 -1
- package/dist/debugger.component-QHE6G2B6.js +0 -4
- package/dist/video-detail-dialog.component-IHEL3AQ7.js +0 -2
package/dist/main.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as $s,b as Vs,c as um,d as fm,e as pm,f as mm,g as dm,h as hr,i as Ws,j as b,k as hm,l as gm,m as ym,n as vm,o as Tr}from"./chunk-JX4H2JCU.js";import{a as E,b as Z,c as Ci,d as lm,e as Hl,f as zr,g as wo}from"./chunk-V7UGKYBN.js";var $l=Hl(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.URLBuilder=void 0;var AE=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();js.URLBuilder=AE});var xm=Hl((Im,Kl)=>{"use strict";(function(t){if(typeof Im=="object"&&typeof Kl<"u")Kl.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(o,i,s){function a(m,d){if(!i[m]){if(!o[m]){var _=typeof Ci=="function"&&Ci;if(!d&&_)return _(m,!0);if(l)return l(m,!0);var y=new Error("Cannot find module '"+m+"'");throw y.code="MODULE_NOT_FOUND",y}var C=i[m]={exports:{}};o[m][0].call(C.exports,function(N){var A=o[m][1][N];return a(A||N)},C,C.exports,n,o,i,s)}return i[m].exports}for(var l=typeof Ci=="function"&&Ci,f=0;f<s.length;f++)a(s[f]);return a})({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var f=0,m=new a(N),d=s.document.createTextNode("");m.observe(d,{characterData:!0}),l=function(){d.data=f=++f%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var _=new s.MessageChannel;_.port1.onmessage=N,l=function(){_.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var B=s.document.createElement("script");B.onreadystatechange=function(){N(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},s.document.documentElement.appendChild(B)}:l=function(){setTimeout(N,0)};var y,C=[];function N(){y=!0;for(var B,q,P=C.length;P;){for(q=C,C=[],B=-1;++B<P;)q[B]();P=C.length}y=!1}o.exports=A;function A(B){C.push(B)===1&&!y&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var l={},f=["REJECTED"],m=["FULFILLED"],d=["PENDING"];o.exports=_;function _(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,X!==a&&A(this,X)}_.prototype.catch=function(X){return this.then(null,X)},_.prototype.then=function(X,ce){if(typeof X!="function"&&this.state===m||typeof ce!="function"&&this.state===f)return this;var se=new this.constructor(a);if(this.state!==d){var de=this.state===m?X:ce;C(se,de,this.outcome)}else this.queue.push(new y(se,X,ce));return se};function y(X,ce,se){this.promise=X,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(X){l.resolve(this.promise,X)},y.prototype.otherCallFulfilled=function(X){C(this.promise,this.onFulfilled,X)},y.prototype.callRejected=function(X){l.reject(this.promise,X)},y.prototype.otherCallRejected=function(X){C(this.promise,this.onRejected,X)};function C(X,ce,se){s(function(){var de;try{de=ce(se)}catch(Le){return l.reject(X,Le)}de===X?l.reject(X,new TypeError("Cannot resolve promise with itself")):l.resolve(X,de)})}l.resolve=function(X,ce){var se=B(N,ce);if(se.status==="error")return l.reject(X,se.value);var de=se.value;if(de)A(X,de);else{X.state=m,X.outcome=ce;for(var Le=-1,Se=X.queue.length;++Le<Se;)X.queue[Le].callFulfilled(ce)}return X},l.reject=function(X,ce){X.state=f,X.outcome=ce;for(var se=-1,de=X.queue.length;++se<de;)X.queue[se].callRejected(ce);return X};function N(X){var ce=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof ce=="function")return function(){ce.apply(X,arguments)}}function A(X,ce){var se=!1;function de(qe){se||(se=!0,l.reject(X,qe))}function Le(qe){se||(se=!0,l.resolve(X,qe))}function Se(){ce(Le,de)}var Re=B(Se);Re.status==="error"&&de(Re.value)}function B(X,ce){var se={};try{se.value=X(ce),se.status="success"}catch(de){se.status="error",se.value=de}return se}_.resolve=q;function q(X){return X instanceof this?X:l.resolve(new this(a),X)}_.reject=P;function P(X){var ce=new this(a);return l.reject(ce,X)}_.all=Q;function Q(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=new Array(se),Se=0,Re=-1,qe=new this(a);++Re<se;)Qe(X[Re],Re);return qe;function Qe(Bt,D){ce.resolve(Bt).then(R,function(V){de||(de=!0,l.reject(qe,V))});function R(V){Le[D]=V,++Se===se&&!de&&(de=!0,l.resolve(qe,Le))}}}_.race=Ee;function Ee(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=-1,Se=new this(a);++Le<se;)Re(X[Le]);return Se;function Re(qe){ce.resolve(qe).then(function(Qe){de||(de=!0,l.resolve(Se,Qe))},function(Qe){de||(de=!0,l.reject(Se,Qe))})}}},{1:1}],3:[function(n,o,i){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function a(p,w){if(!(p instanceof w))throw new TypeError("Cannot call a class as a function")}function l(){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 f=l();function m(){try{if(!f||!f.open)return!1;var p=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(p,w){p=p||[],w=w||{};try{return new Blob(p,w)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,I=0;I<p.length;I+=1)T.append(p[I]);return T.getBlob(w.type)}}typeof Promise>"u"&&n(3);var _=Promise;function y(p,w){w&&p.then(function(g){w(null,g)},function(g){w(g)})}function C(p,w,g){typeof w=="function"&&p.then(w),typeof g=="function"&&p.catch(g)}function N(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",q=void 0,P={},Q=Object.prototype.toString,Ee="readonly",X="readwrite";function ce(p){for(var w=p.length,g=new ArrayBuffer(w),T=new Uint8Array(g),I=0;I<w;I++)T[I]=p.charCodeAt(I);return g}function se(p){return new _(function(w){var g=p.transaction(B,X),T=d([""]);g.objectStore(B).put(T,"key"),g.onabort=function(I){I.preventDefault(),I.stopPropagation(),w(!1)},g.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function de(p){return typeof q=="boolean"?_.resolve(q):se(p).then(function(w){return q=w,q})}function Le(p){var w=P[p.name],g={};g.promise=new _(function(T,I){g.resolve=T,g.reject=I}),w.deferredOperations.push(g),w.dbReady?w.dbReady=w.dbReady.then(function(){return g.promise}):w.dbReady=g.promise}function Se(p){var w=P[p.name],g=w.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Re(p,w){var g=P[p.name],T=g.deferredOperations.pop();if(T)return T.reject(w),T.promise}function qe(p,w){return new _(function(g,T){if(P[p.name]=P[p.name]||ze(),p.db)if(w)Le(p),p.db.close();else return g(p.db);var I=[p.name];w&&I.push(p.version);var S=f.open.apply(f,I);w&&(S.onupgradeneeded=function(M){var G=S.result;try{G.createObjectStore(p.storeName),M.oldVersion<=1&&G.createObjectStore(B)}catch(z){if(z.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw z}}),S.onerror=function(M){M.preventDefault(),T(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(G){G.target.close()},g(M),Se(p)}})}function Qe(p){return qe(p,!1)}function Bt(p){return qe(p,!0)}function D(p,w){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),T=p.version<p.db.version,I=p.version>p.db.version;if(T&&(p.version!==w&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),I||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function R(p){return new _(function(w,g){var T=new FileReader;T.onerror=g,T.onloadend=function(I){var S=btoa(I.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:p.type})},T.readAsBinaryString(p)})}function V(p){var w=ce(atob(p.data));return d([w],{type:p.type})}function k(p){return p&&p.__local_forage_encoded_blob}function H(p){var w=this,g=w._initReady().then(function(){var T=P[w._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(g,p,p),g}function ne(p){Le(p);for(var w=P[p.name],g=w.forages,T=0;T<g.length;T++){var I=g[T];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return p.db=null,Qe(p).then(function(S){return p.db=S,D(p)?Bt(p):S}).then(function(S){p.db=w.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Re(p,S),S})}function he(p,w,g,T){T===void 0&&(T=1);try{var I=p.db.transaction(p.storeName,w);g(null,I)}catch(S){if(T>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return _.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),Bt(p)}).then(function(){return ne(p).then(function(){he(p,w,g,T-1)})}).catch(g);g(S)}}function ze(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function et(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=p[T];var I=P[g.name];I||(I=ze(),P[g.name]=I),I.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=H);var S=[];function M(){return _.resolve()}for(var G=0;G<I.forages.length;G++){var z=I.forages[G];z!==w&&S.push(z._initReady().catch(M))}var Y=I.forages.slice(0);return _.all(S).then(function(){return g.db=I.db,Qe(g)}).then(function(J){return g.db=J,D(g,w._defaultConfig.version)?Bt(g):J}).then(function(J){g.db=I.db=J,w._dbInfo=g;for(var te=0;te<Y.length;te++){var ve=Y[te];ve!==w&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function tt(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=z.get(p);Y.onsuccess=function(){var J=Y.result;J===void 0&&(J=null),k(J)&&(J=V(J)),I(J)},Y.onerror=function(){S(Y.error)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function vt(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=z.openCursor(),J=1;Y.onsuccess=function(){var te=Y.result;if(te){var ve=te.value;k(ve)&&(ve=V(ve));var Oe=p(ve,te.key,J++);Oe!==void 0?I(Oe):te.continue()}else I()},Y.onerror=function(){S(Y.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function Et(p,w,g){var T=this;p=N(p);var I=new _(function(S,M){var G;T.ready().then(function(){return G=T._dbInfo,Q.call(w)==="[object Blob]"?de(G.db).then(function(z){return z?w:R(w)}):w}).then(function(z){he(T._dbInfo,X,function(Y,J){if(Y)return M(Y);try{var te=J.objectStore(T._dbInfo.storeName);z===null&&(z=void 0);var ve=te.put(z,p);J.oncomplete=function(){z===void 0&&(z=null),S(z)},J.onabort=J.onerror=function(){var Oe=ve.error?ve.error:ve.transaction.error;M(Oe)}}catch(Oe){M(Oe)}})}).catch(M)});return y(I,g),I}function st(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,X,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=z.delete(p);G.oncomplete=function(){I()},G.onerror=function(){S(Y.error)},G.onabort=function(){var J=Y.error?Y.error:Y.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function we(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,X,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),z=G.clear();M.oncomplete=function(){T()},M.onabort=M.onerror=function(){var Y=z.error?z.error:z.transaction.error;I(Y)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function He(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),z=G.count();z.onsuccess=function(){T(z.result)},z.onerror=function(){I(z.error)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function Ae(p,w){var g=this,T=new _(function(I,S){if(p<0){I(null);return}g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=!1,J=z.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){I(null);return}p===0||Y?I(te.key):(Y=!0,te.advance(p))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function $e(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),z=G.openKeyCursor(),Y=[];z.onsuccess=function(){var J=z.result;if(!J){T(Y);return}Y.push(J.key),J.continue()},z.onerror=function(){I(z.error)}}catch(J){I(J)}})}).catch(I)});return y(g,p),g}function De(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;if(!p.name)I=_.reject("Invalid arguments");else{var S=p.name===g.name&&T._dbInfo.db,M=S?_.resolve(T._dbInfo.db):Qe(p).then(function(G){var z=P[p.name],Y=z.forages;z.db=G;for(var J=0;J<Y.length;J++)Y[J]._dbInfo.db=G;return G});p.storeName?I=M.then(function(G){if(G.objectStoreNames.contains(p.storeName)){var z=G.version+1;Le(p);var Y=P[p.name],J=Y.forages;G.close();for(var te=0;te<J.length;te++){var ve=J[te];ve._dbInfo.db=null,ve._dbInfo.version=z}var Oe=new _(function(Ne,nt){var Ze=f.open(p.name,z);Ze.onerror=function(Xt){var xi=Ze.result;xi.close(),nt(Xt)},Ze.onupgradeneeded=function(){var Xt=Ze.result;Xt.deleteObjectStore(p.storeName)},Ze.onsuccess=function(){var Xt=Ze.result;Xt.close(),Ne(Xt)}});return Oe.then(function(Ne){Y.db=Ne;for(var nt=0;nt<J.length;nt++){var Ze=J[nt];Ze._dbInfo.db=Ne,Se(Ze._dbInfo)}}).catch(function(Ne){throw(Re(p,Ne)||_.resolve()).catch(function(){}),Ne})}}):I=M.then(function(G){Le(p);var z=P[p.name],Y=z.forages;G.close();for(var J=0;J<Y.length;J++){var te=Y[J];te._dbInfo.db=null}var ve=new _(function(Oe,Ne){var nt=f.deleteDatabase(p.name);nt.onerror=function(){var Ze=nt.result;Ze&&Ze.close(),Ne(nt.error)},nt.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},nt.onsuccess=function(){var Ze=nt.result;Ze&&Ze.close(),Oe(Ze)}});return ve.then(function(Oe){z.db=Oe;for(var Ne=0;Ne<Y.length;Ne++){var nt=Y[Ne];Se(nt._dbInfo)}}).catch(function(Oe){throw(Re(p,Oe)||_.resolve()).catch(function(){}),Oe})})}return y(I,w),I}var $t={_driver:"asyncStorage",_initStorage:et,_support:m(),iterate:vt,getItem:tt,setItem:Et,removeItem:st,clear:we,length:He,key:Ae,keys:$e,dropInstance:De};function h(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ue="blob",_e="si08",ge="ui08",Me="uic8",ke="si16",rt="si32",pr="ur16",qr="ui32",_o="fl32",mr="fl64",dr=O+W.length,tm=Object.prototype.toString;function rm(p){var w=p.length*.75,g=p.length,T,I=0,S,M,G,z;p[p.length-1]==="="&&(w--,p[p.length-2]==="="&&w--);var Y=new ArrayBuffer(w),J=new Uint8Array(Y);for(T=0;T<g;T+=4)S=c.indexOf(p[T]),M=c.indexOf(p[T+1]),G=c.indexOf(p[T+2]),z=c.indexOf(p[T+3]),J[I++]=S<<2|M>>4,J[I++]=(M&15)<<4|G>>2,J[I++]=(G&3)<<6|z&63;return Y}function Ll(p){var w=new Uint8Array(p),g="",T;for(T=0;T<w.length;T+=3)g+=c[w[T]>>2],g+=c[(w[T]&3)<<4|w[T+1]>>4],g+=c[(w[T+1]&15)<<2|w[T+2]>>6],g+=c[w[T+2]&63];return w.length%3===2?g=g.substring(0,g.length-1)+"=":w.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Gv(p,w){var g="";if(p&&(g=tm.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&tm.call(p.buffer)==="[object ArrayBuffer]")){var T,I=x;p instanceof ArrayBuffer?(T=p,I+=W):(T=p.buffer,g==="[object Int8Array]"?I+=_e:g==="[object Uint8Array]"?I+=ge:g==="[object Uint8ClampedArray]"?I+=Me:g==="[object Int16Array]"?I+=ke:g==="[object Uint16Array]"?I+=pr:g==="[object Int32Array]"?I+=rt:g==="[object Uint32Array]"?I+=qr:g==="[object Float32Array]"?I+=_o:g==="[object Float64Array]"?I+=mr:w(new Error("Failed to get type for BinaryArray"))),w(I+Ll(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+p.type+"~"+Ll(this.result);w(x+ue+M)},S.readAsArrayBuffer(p)}else try{w(JSON.stringify(p))}catch(M){console.error("Couldn't convert value into a JSON string: ",p),w(null,M)}}function qv(p){if(p.substring(0,O)!==x)return JSON.parse(p);var w=p.substring(dr),g=p.substring(O,dr),T;if(g===ue&&v.test(w)){var I=w.match(v);T=I[1],w=w.substring(I[0].length)}var S=rm(w);switch(g){case W:return S;case ue:return d([S],{type:T});case _e:return new Int8Array(S);case ge:return new Uint8Array(S);case Me:return new Uint8ClampedArray(S);case ke:return new Int16Array(S);case pr:return new Uint16Array(S);case rt:return new Int32Array(S);case qr:return new Uint32Array(S);case _o:return new Float32Array(S);case mr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Ml={serialize:Gv,deserialize:qv,stringToBuffer:rm,bufferToString:Ll};function nm(p,w,g,T){p.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function zv(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=typeof p[T]!="string"?p[T].toString():p[T];var I=new _(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(G){return M(G)}g.db.transaction(function(G){nm(G,g,function(){w._dbInfo=g,S()},function(z,Y){M(Y)})},M)});return g.serializer=Ml,I}function dn(p,w,g,T,I,S){p.executeSql(g,T,I,function(M,G){G.code===G.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(z,Y){Y.rows.length?S(z,G):nm(z,w,function(){z.executeSql(g,T,I,S)},S)},S):S(M,G)},S)}function Yv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[p],function(z,Y){var J=Y.rows.length?Y.rows.item(0).value:null;J&&(J=M.serializer.deserialize(J)),I(J)},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Kv(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName,[],function(z,Y){for(var J=Y.rows,te=J.length,ve=0;ve<te;ve++){var Oe=J.item(ve),Ne=Oe.value;if(Ne&&(Ne=M.serializer.deserialize(Ne)),Ne=p(Ne,Oe.key,ve+1),Ne!==void 0){I(Ne);return}}I()},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function om(p,w,g,T){var I=this;p=N(p);var S=new _(function(M,G){I.ready().then(function(){w===void 0&&(w=null);var z=w,Y=I._dbInfo;Y.serializer.serialize(w,function(J,te){te?G(te):Y.db.transaction(function(ve){dn(ve,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[p,J],function(){M(z)},function(Oe,Ne){G(Ne)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){M(om.apply(I,[p,z,g,T-1]));return}G(ve)}})})}).catch(G)});return y(S,g),S}function Xv(p,w,g){return om.apply(this,[p,w,g,1])}function Jv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[p],function(){I()},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Qv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"DELETE FROM "+S.storeName,[],function(){T()},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function Zv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(G,z){var Y=z.rows.item(0).c;T(Y)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function eE(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[p+1],function(z,Y){var J=Y.rows.length?Y.rows.item(0).key:null;I(J)},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function tE(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT key FROM "+S.storeName,[],function(G,z){for(var Y=[],J=0;J<z.rows.length;J++)Y.push(z.rows.item(J).key);T(Y)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function rE(p){return new _(function(w,g){p.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,S){for(var M=[],G=0;G<S.rows.length;G++)M.push(S.rows.item(G).name);w({db:p,storeNames:M})},function(I,S){g(S)})},function(T){g(T)})})}function nE(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;return p.name?I=new _(function(S){var M;p.name===g.name?M=T._dbInfo.db:M=openDatabase(p.name,"","",0),p.storeName?S({db:M,storeNames:[p.storeName]}):S(rE(M))}).then(function(S){return new _(function(M,G){S.db.transaction(function(z){function Y(Oe){return new _(function(Ne,nt){z.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Ne()},function(Ze,Xt){nt(Xt)})})}for(var J=[],te=0,ve=S.storeNames.length;te<ve;te++)J.push(Y(S.storeNames[te]));_.all(J).then(function(){M()}).catch(function(Oe){G(Oe)})},function(z){G(z)})})}):I=_.reject("Invalid arguments"),y(I,w),I}var oE={_driver:"webSQLStorage",_initStorage:zv,_support:h(),iterate:Kv,getItem:Yv,setItem:Xv,removeItem:Jv,clear:Qv,length:Zv,key:eE,keys:tE,dropInstance:nE};function iE(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function im(p,w){var g=p.name+"/";return p.storeName!==w.storeName&&(g+=p.storeName+"/"),g}function sE(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch{return!0}}function aE(){return!sE()||localStorage.length>0}function cE(p){var w=this,g={};if(p)for(var T in p)g[T]=p[T];return g.keyPrefix=im(p,w._defaultConfig),aE()?(w._dbInfo=g,g.serializer=Ml,_.resolve()):_.reject()}function lE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var S=localStorage.key(I);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,p),g}function uE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo,S=localStorage.getItem(I.keyPrefix+p);return S&&(S=I.serializer.deserialize(S)),S});return y(T,w),T}function fE(p,w){var g=this,T=g.ready().then(function(){for(var I=g._dbInfo,S=I.keyPrefix,M=S.length,G=localStorage.length,z=1,Y=0;Y<G;Y++){var J=localStorage.key(Y);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=I.serializer.deserialize(te)),te=p(te,J.substring(M),z++),te!==void 0)return te}}});return y(T,w),T}function pE(p,w){var g=this,T=g.ready().then(function(){var I=g._dbInfo,S;try{S=localStorage.key(p)}catch{S=null}return S&&(S=S.substring(I.keyPrefix.length)),S});return y(T,w),T}function mE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo,I=localStorage.length,S=[],M=0;M<I;M++){var G=localStorage.key(M);G.indexOf(T.keyPrefix)===0&&S.push(G.substring(T.keyPrefix.length))}return S});return y(g,p),g}function dE(p){var w=this,g=w.keys().then(function(T){return T.length});return y(g,p),g}function hE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo;localStorage.removeItem(I.keyPrefix+p)});return y(T,w),T}function gE(p,w,g){var T=this;p=N(p);var I=T.ready().then(function(){w===void 0&&(w=null);var S=w;return new _(function(M,G){var z=T._dbInfo;z.serializer.serialize(w,function(Y,J){if(J)G(J);else try{localStorage.setItem(z.keyPrefix+p,Y),M(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(te),G(te)}})})});return y(I,g),I}function yE(p,w){if(w=A.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var T=this,I;return p.name?I=new _(function(S){p.storeName?S(im(p,T._defaultConfig)):S(p.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var G=localStorage.key(M);G.indexOf(S)===0&&localStorage.removeItem(G)}}):I=_.reject("Invalid arguments"),y(I,w),I}var vE={_driver:"localStorageWrapper",_initStorage:cE,_support:iE(),iterate:fE,getItem:uE,setItem:gE,removeItem:hE,clear:lE,length:dE,key:pE,keys:mE,dropInstance:yE},EE=function(w,g){return w===g||typeof w=="number"&&typeof g=="number"&&isNaN(w)&&isNaN(g)},_E=function(w,g){for(var T=w.length,I=0;I<T;){if(EE(w[I],g))return!0;I++}return!1},sm=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Ii={},am={},bo={INDEXEDDB:$t,WEBSQL:oE,LOCALSTORAGE:vE},bE=[bo.INDEXEDDB._driver,bo.WEBSQL._driver,bo.LOCALSTORAGE._driver],Hs=["dropInstance"],Bl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Hs),wE={description:"",driver:bE.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function SE(p,w){p[w]=function(){var g=arguments;return p.ready().then(function(){return p[w].apply(p,g)})}}function Ul(){for(var p=1;p<arguments.length;p++){var w=arguments[p];if(w)for(var g in w)w.hasOwnProperty(g)&&(sm(w[g])?arguments[0][g]=w[g].slice():arguments[0][g]=w[g])}return arguments[0]}var TE=(function(){function p(w){a(this,p);for(var g in bo)if(bo.hasOwnProperty(g)){var T=bo[g],I=T._driver;this[g]=I,Ii[I]||this.defineDriver(T)}this._defaultConfig=Ul({},wE),this._config=Ul({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,T,I){var S=new _(function(M,G){try{var z=g._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){G(Y);return}for(var J=Bl.concat("_initStorage"),te=0,ve=J.length;te<ve;te++){var Oe=J[te],Ne=!_E(Hs,Oe);if((Ne||g[Oe])&&typeof g[Oe]!="function"){G(Y);return}}var nt=function(){for(var xi=function(CE){return function(){var RE=new Error("Method "+CE+" is not implemented by the current driver"),cm=_.reject(RE);return y(cm,arguments[arguments.length-1]),cm}},kl=0,xE=Hs.length;kl<xE;kl++){var Fl=Hs[kl];g[Fl]||(g[Fl]=xi(Fl))}};nt();var Ze=function(xi){Ii[z]&&console.info("Redefining LocalForage driver: "+z),Ii[z]=g,am[z]=xi,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ze,G):Ze(!!g._support):Ze(!0)}catch(Xt){G(Xt)}});return C(S,T,I),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,T,I){var S=Ii[g]?_.resolve(Ii[g]):_.reject(new Error("Driver not found."));return C(S,T,I),S},p.prototype.getSerializer=function(g){var T=_.resolve(Ml);return C(T,g),T},p.prototype.ready=function(g){var T=this,I=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return C(I,g,g),I},p.prototype.setDriver=function(g,T,I){var S=this;sm(g)||(g=[g]);var M=this._getSupportedDrivers(g);function G(){S._config.driver=S.driver()}function z(te){return S._extend(te),G(),S._ready=S._initStorage(S._config),S._ready}function Y(te){return function(){var ve=0;function Oe(){for(;ve<te.length;){var Ne=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Ne).then(z).catch(Oe)}G();var nt=new Error("No available storage method found.");return S._driverSet=_.reject(nt),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return _.resolve()}):_.resolve();return this._driverSet=J.then(function(){var te=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,G(),S._wrapLibraryMethodsWithReady(),S._initDriver=Y(M)})}).catch(function(){G();var te=new Error("No available storage method found.");return S._driverSet=_.reject(te),S._driverSet}),C(this._driverSet,T,I),this._driverSet},p.prototype.supports=function(g){return!!am[g]},p.prototype._extend=function(g){Ul(this,g)},p.prototype._getSupportedDrivers=function(g){for(var T=[],I=0,S=g.length;I<S;I++){var M=g[I];this.supports(M)&&T.push(M)}return T},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Bl.length;g<T;g++)SE(this,Bl[g])},p.prototype.createInstance=function(g){return new p(g)},p})(),IE=new TE;o.exports=IE},{3:3}]},{},[4])(4)})});var kf=Hl((ec,ng)=>{"use strict";(function(t,e){typeof ec=="object"&&typeof ng<"u"?e(ec):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ec,function(t){"use strict";function e(D){var R,V,k=new Error(D);return R=k,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,k}function r(D,R,V){var k=R.slice(0,V).split(/\n/),H=k.length,ne=k[H-1].length+1;throw e(D+=" at line "+H+" col "+ne+`:
|
|
1
|
+
import{a as $s,b as Vs,c as um,d as fm,e as pm,f as mm,g as dm,h as hr,i as Ws,j as b,k as hm,l as gm,m as ym,n as vm,o as Tr}from"./chunk-TWXZPLZM.js";import{a as E,b as Z,c as Ci,d as lm,e as Hl,f as zr,g as wo}from"./chunk-V7UGKYBN.js";var $l=Hl(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.URLBuilder=void 0;var AE=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();js.URLBuilder=AE});var xm=Hl((Im,Kl)=>{"use strict";(function(t){if(typeof Im=="object"&&typeof Kl<"u")Kl.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(o,i,s){function a(m,d){if(!i[m]){if(!o[m]){var _=typeof Ci=="function"&&Ci;if(!d&&_)return _(m,!0);if(l)return l(m,!0);var y=new Error("Cannot find module '"+m+"'");throw y.code="MODULE_NOT_FOUND",y}var C=i[m]={exports:{}};o[m][0].call(C.exports,function(N){var A=o[m][1][N];return a(A||N)},C,C.exports,n,o,i,s)}return i[m].exports}for(var l=typeof Ci=="function"&&Ci,f=0;f<s.length;f++)a(s[f]);return a})({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var f=0,m=new a(N),d=s.document.createTextNode("");m.observe(d,{characterData:!0}),l=function(){d.data=f=++f%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var _=new s.MessageChannel;_.port1.onmessage=N,l=function(){_.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var B=s.document.createElement("script");B.onreadystatechange=function(){N(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},s.document.documentElement.appendChild(B)}:l=function(){setTimeout(N,0)};var y,C=[];function N(){y=!0;for(var B,q,P=C.length;P;){for(q=C,C=[],B=-1;++B<P;)q[B]();P=C.length}y=!1}o.exports=A;function A(B){C.push(B)===1&&!y&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var l={},f=["REJECTED"],m=["FULFILLED"],d=["PENDING"];o.exports=_;function _(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,X!==a&&A(this,X)}_.prototype.catch=function(X){return this.then(null,X)},_.prototype.then=function(X,ce){if(typeof X!="function"&&this.state===m||typeof ce!="function"&&this.state===f)return this;var se=new this.constructor(a);if(this.state!==d){var de=this.state===m?X:ce;C(se,de,this.outcome)}else this.queue.push(new y(se,X,ce));return se};function y(X,ce,se){this.promise=X,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(X){l.resolve(this.promise,X)},y.prototype.otherCallFulfilled=function(X){C(this.promise,this.onFulfilled,X)},y.prototype.callRejected=function(X){l.reject(this.promise,X)},y.prototype.otherCallRejected=function(X){C(this.promise,this.onRejected,X)};function C(X,ce,se){s(function(){var de;try{de=ce(se)}catch(Le){return l.reject(X,Le)}de===X?l.reject(X,new TypeError("Cannot resolve promise with itself")):l.resolve(X,de)})}l.resolve=function(X,ce){var se=B(N,ce);if(se.status==="error")return l.reject(X,se.value);var de=se.value;if(de)A(X,de);else{X.state=m,X.outcome=ce;for(var Le=-1,Se=X.queue.length;++Le<Se;)X.queue[Le].callFulfilled(ce)}return X},l.reject=function(X,ce){X.state=f,X.outcome=ce;for(var se=-1,de=X.queue.length;++se<de;)X.queue[se].callRejected(ce);return X};function N(X){var ce=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof ce=="function")return function(){ce.apply(X,arguments)}}function A(X,ce){var se=!1;function de(qe){se||(se=!0,l.reject(X,qe))}function Le(qe){se||(se=!0,l.resolve(X,qe))}function Se(){ce(Le,de)}var Re=B(Se);Re.status==="error"&&de(Re.value)}function B(X,ce){var se={};try{se.value=X(ce),se.status="success"}catch(de){se.status="error",se.value=de}return se}_.resolve=q;function q(X){return X instanceof this?X:l.resolve(new this(a),X)}_.reject=P;function P(X){var ce=new this(a);return l.reject(ce,X)}_.all=Q;function Q(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=new Array(se),Se=0,Re=-1,qe=new this(a);++Re<se;)Qe(X[Re],Re);return qe;function Qe(Bt,D){ce.resolve(Bt).then(R,function(V){de||(de=!0,l.reject(qe,V))});function R(V){Le[D]=V,++Se===se&&!de&&(de=!0,l.resolve(qe,Le))}}}_.race=Ee;function Ee(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=-1,Se=new this(a);++Le<se;)Re(X[Le]);return Se;function Re(qe){ce.resolve(qe).then(function(Qe){de||(de=!0,l.resolve(Se,Qe))},function(Qe){de||(de=!0,l.reject(Se,Qe))})}}},{1:1}],3:[function(n,o,i){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function a(p,w){if(!(p instanceof w))throw new TypeError("Cannot call a class as a function")}function l(){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 f=l();function m(){try{if(!f||!f.open)return!1;var p=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(p,w){p=p||[],w=w||{};try{return new Blob(p,w)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,I=0;I<p.length;I+=1)T.append(p[I]);return T.getBlob(w.type)}}typeof Promise>"u"&&n(3);var _=Promise;function y(p,w){w&&p.then(function(g){w(null,g)},function(g){w(g)})}function C(p,w,g){typeof w=="function"&&p.then(w),typeof g=="function"&&p.catch(g)}function N(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",q=void 0,P={},Q=Object.prototype.toString,Ee="readonly",X="readwrite";function ce(p){for(var w=p.length,g=new ArrayBuffer(w),T=new Uint8Array(g),I=0;I<w;I++)T[I]=p.charCodeAt(I);return g}function se(p){return new _(function(w){var g=p.transaction(B,X),T=d([""]);g.objectStore(B).put(T,"key"),g.onabort=function(I){I.preventDefault(),I.stopPropagation(),w(!1)},g.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function de(p){return typeof q=="boolean"?_.resolve(q):se(p).then(function(w){return q=w,q})}function Le(p){var w=P[p.name],g={};g.promise=new _(function(T,I){g.resolve=T,g.reject=I}),w.deferredOperations.push(g),w.dbReady?w.dbReady=w.dbReady.then(function(){return g.promise}):w.dbReady=g.promise}function Se(p){var w=P[p.name],g=w.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Re(p,w){var g=P[p.name],T=g.deferredOperations.pop();if(T)return T.reject(w),T.promise}function qe(p,w){return new _(function(g,T){if(P[p.name]=P[p.name]||ze(),p.db)if(w)Le(p),p.db.close();else return g(p.db);var I=[p.name];w&&I.push(p.version);var S=f.open.apply(f,I);w&&(S.onupgradeneeded=function(M){var G=S.result;try{G.createObjectStore(p.storeName),M.oldVersion<=1&&G.createObjectStore(B)}catch(z){if(z.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw z}}),S.onerror=function(M){M.preventDefault(),T(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(G){G.target.close()},g(M),Se(p)}})}function Qe(p){return qe(p,!1)}function Bt(p){return qe(p,!0)}function D(p,w){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),T=p.version<p.db.version,I=p.version>p.db.version;if(T&&(p.version!==w&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),I||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function R(p){return new _(function(w,g){var T=new FileReader;T.onerror=g,T.onloadend=function(I){var S=btoa(I.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:p.type})},T.readAsBinaryString(p)})}function V(p){var w=ce(atob(p.data));return d([w],{type:p.type})}function k(p){return p&&p.__local_forage_encoded_blob}function H(p){var w=this,g=w._initReady().then(function(){var T=P[w._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(g,p,p),g}function ne(p){Le(p);for(var w=P[p.name],g=w.forages,T=0;T<g.length;T++){var I=g[T];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return p.db=null,Qe(p).then(function(S){return p.db=S,D(p)?Bt(p):S}).then(function(S){p.db=w.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Re(p,S),S})}function he(p,w,g,T){T===void 0&&(T=1);try{var I=p.db.transaction(p.storeName,w);g(null,I)}catch(S){if(T>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return _.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),Bt(p)}).then(function(){return ne(p).then(function(){he(p,w,g,T-1)})}).catch(g);g(S)}}function ze(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function et(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=p[T];var I=P[g.name];I||(I=ze(),P[g.name]=I),I.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=H);var S=[];function M(){return _.resolve()}for(var G=0;G<I.forages.length;G++){var z=I.forages[G];z!==w&&S.push(z._initReady().catch(M))}var Y=I.forages.slice(0);return _.all(S).then(function(){return g.db=I.db,Qe(g)}).then(function(J){return g.db=J,D(g,w._defaultConfig.version)?Bt(g):J}).then(function(J){g.db=I.db=J,w._dbInfo=g;for(var te=0;te<Y.length;te++){var ve=Y[te];ve!==w&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function tt(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=z.get(p);Y.onsuccess=function(){var J=Y.result;J===void 0&&(J=null),k(J)&&(J=V(J)),I(J)},Y.onerror=function(){S(Y.error)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function vt(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=z.openCursor(),J=1;Y.onsuccess=function(){var te=Y.result;if(te){var ve=te.value;k(ve)&&(ve=V(ve));var Oe=p(ve,te.key,J++);Oe!==void 0?I(Oe):te.continue()}else I()},Y.onerror=function(){S(Y.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function Et(p,w,g){var T=this;p=N(p);var I=new _(function(S,M){var G;T.ready().then(function(){return G=T._dbInfo,Q.call(w)==="[object Blob]"?de(G.db).then(function(z){return z?w:R(w)}):w}).then(function(z){he(T._dbInfo,X,function(Y,J){if(Y)return M(Y);try{var te=J.objectStore(T._dbInfo.storeName);z===null&&(z=void 0);var ve=te.put(z,p);J.oncomplete=function(){z===void 0&&(z=null),S(z)},J.onabort=J.onerror=function(){var Oe=ve.error?ve.error:ve.transaction.error;M(Oe)}}catch(Oe){M(Oe)}})}).catch(M)});return y(I,g),I}function st(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,X,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=z.delete(p);G.oncomplete=function(){I()},G.onerror=function(){S(Y.error)},G.onabort=function(){var J=Y.error?Y.error:Y.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function we(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,X,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),z=G.clear();M.oncomplete=function(){T()},M.onabort=M.onerror=function(){var Y=z.error?z.error:z.transaction.error;I(Y)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function He(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),z=G.count();z.onsuccess=function(){T(z.result)},z.onerror=function(){I(z.error)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function Ae(p,w){var g=this,T=new _(function(I,S){if(p<0){I(null);return}g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var z=G.objectStore(g._dbInfo.storeName),Y=!1,J=z.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){I(null);return}p===0||Y?I(te.key):(Y=!0,te.advance(p))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function $e(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),z=G.openKeyCursor(),Y=[];z.onsuccess=function(){var J=z.result;if(!J){T(Y);return}Y.push(J.key),J.continue()},z.onerror=function(){I(z.error)}}catch(J){I(J)}})}).catch(I)});return y(g,p),g}function De(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;if(!p.name)I=_.reject("Invalid arguments");else{var S=p.name===g.name&&T._dbInfo.db,M=S?_.resolve(T._dbInfo.db):Qe(p).then(function(G){var z=P[p.name],Y=z.forages;z.db=G;for(var J=0;J<Y.length;J++)Y[J]._dbInfo.db=G;return G});p.storeName?I=M.then(function(G){if(G.objectStoreNames.contains(p.storeName)){var z=G.version+1;Le(p);var Y=P[p.name],J=Y.forages;G.close();for(var te=0;te<J.length;te++){var ve=J[te];ve._dbInfo.db=null,ve._dbInfo.version=z}var Oe=new _(function(Ne,nt){var Ze=f.open(p.name,z);Ze.onerror=function(Xt){var xi=Ze.result;xi.close(),nt(Xt)},Ze.onupgradeneeded=function(){var Xt=Ze.result;Xt.deleteObjectStore(p.storeName)},Ze.onsuccess=function(){var Xt=Ze.result;Xt.close(),Ne(Xt)}});return Oe.then(function(Ne){Y.db=Ne;for(var nt=0;nt<J.length;nt++){var Ze=J[nt];Ze._dbInfo.db=Ne,Se(Ze._dbInfo)}}).catch(function(Ne){throw(Re(p,Ne)||_.resolve()).catch(function(){}),Ne})}}):I=M.then(function(G){Le(p);var z=P[p.name],Y=z.forages;G.close();for(var J=0;J<Y.length;J++){var te=Y[J];te._dbInfo.db=null}var ve=new _(function(Oe,Ne){var nt=f.deleteDatabase(p.name);nt.onerror=function(){var Ze=nt.result;Ze&&Ze.close(),Ne(nt.error)},nt.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},nt.onsuccess=function(){var Ze=nt.result;Ze&&Ze.close(),Oe(Ze)}});return ve.then(function(Oe){z.db=Oe;for(var Ne=0;Ne<Y.length;Ne++){var nt=Y[Ne];Se(nt._dbInfo)}}).catch(function(Oe){throw(Re(p,Oe)||_.resolve()).catch(function(){}),Oe})})}return y(I,w),I}var $t={_driver:"asyncStorage",_initStorage:et,_support:m(),iterate:vt,getItem:tt,setItem:Et,removeItem:st,clear:we,length:He,key:Ae,keys:$e,dropInstance:De};function h(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ue="blob",_e="si08",ge="ui08",Me="uic8",ke="si16",rt="si32",pr="ur16",qr="ui32",_o="fl32",mr="fl64",dr=O+W.length,tm=Object.prototype.toString;function rm(p){var w=p.length*.75,g=p.length,T,I=0,S,M,G,z;p[p.length-1]==="="&&(w--,p[p.length-2]==="="&&w--);var Y=new ArrayBuffer(w),J=new Uint8Array(Y);for(T=0;T<g;T+=4)S=c.indexOf(p[T]),M=c.indexOf(p[T+1]),G=c.indexOf(p[T+2]),z=c.indexOf(p[T+3]),J[I++]=S<<2|M>>4,J[I++]=(M&15)<<4|G>>2,J[I++]=(G&3)<<6|z&63;return Y}function Ll(p){var w=new Uint8Array(p),g="",T;for(T=0;T<w.length;T+=3)g+=c[w[T]>>2],g+=c[(w[T]&3)<<4|w[T+1]>>4],g+=c[(w[T+1]&15)<<2|w[T+2]>>6],g+=c[w[T+2]&63];return w.length%3===2?g=g.substring(0,g.length-1)+"=":w.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Gv(p,w){var g="";if(p&&(g=tm.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&tm.call(p.buffer)==="[object ArrayBuffer]")){var T,I=x;p instanceof ArrayBuffer?(T=p,I+=W):(T=p.buffer,g==="[object Int8Array]"?I+=_e:g==="[object Uint8Array]"?I+=ge:g==="[object Uint8ClampedArray]"?I+=Me:g==="[object Int16Array]"?I+=ke:g==="[object Uint16Array]"?I+=pr:g==="[object Int32Array]"?I+=rt:g==="[object Uint32Array]"?I+=qr:g==="[object Float32Array]"?I+=_o:g==="[object Float64Array]"?I+=mr:w(new Error("Failed to get type for BinaryArray"))),w(I+Ll(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+p.type+"~"+Ll(this.result);w(x+ue+M)},S.readAsArrayBuffer(p)}else try{w(JSON.stringify(p))}catch(M){console.error("Couldn't convert value into a JSON string: ",p),w(null,M)}}function qv(p){if(p.substring(0,O)!==x)return JSON.parse(p);var w=p.substring(dr),g=p.substring(O,dr),T;if(g===ue&&v.test(w)){var I=w.match(v);T=I[1],w=w.substring(I[0].length)}var S=rm(w);switch(g){case W:return S;case ue:return d([S],{type:T});case _e:return new Int8Array(S);case ge:return new Uint8Array(S);case Me:return new Uint8ClampedArray(S);case ke:return new Int16Array(S);case pr:return new Uint16Array(S);case rt:return new Int32Array(S);case qr:return new Uint32Array(S);case _o:return new Float32Array(S);case mr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Ml={serialize:Gv,deserialize:qv,stringToBuffer:rm,bufferToString:Ll};function nm(p,w,g,T){p.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function zv(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=typeof p[T]!="string"?p[T].toString():p[T];var I=new _(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(G){return M(G)}g.db.transaction(function(G){nm(G,g,function(){w._dbInfo=g,S()},function(z,Y){M(Y)})},M)});return g.serializer=Ml,I}function dn(p,w,g,T,I,S){p.executeSql(g,T,I,function(M,G){G.code===G.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(z,Y){Y.rows.length?S(z,G):nm(z,w,function(){z.executeSql(g,T,I,S)},S)},S):S(M,G)},S)}function Yv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[p],function(z,Y){var J=Y.rows.length?Y.rows.item(0).value:null;J&&(J=M.serializer.deserialize(J)),I(J)},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Kv(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName,[],function(z,Y){for(var J=Y.rows,te=J.length,ve=0;ve<te;ve++){var Oe=J.item(ve),Ne=Oe.value;if(Ne&&(Ne=M.serializer.deserialize(Ne)),Ne=p(Ne,Oe.key,ve+1),Ne!==void 0){I(Ne);return}}I()},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function om(p,w,g,T){var I=this;p=N(p);var S=new _(function(M,G){I.ready().then(function(){w===void 0&&(w=null);var z=w,Y=I._dbInfo;Y.serializer.serialize(w,function(J,te){te?G(te):Y.db.transaction(function(ve){dn(ve,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[p,J],function(){M(z)},function(Oe,Ne){G(Ne)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){M(om.apply(I,[p,z,g,T-1]));return}G(ve)}})})}).catch(G)});return y(S,g),S}function Xv(p,w,g){return om.apply(this,[p,w,g,1])}function Jv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[p],function(){I()},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Qv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"DELETE FROM "+S.storeName,[],function(){T()},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function Zv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(G,z){var Y=z.rows.item(0).c;T(Y)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function eE(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[p+1],function(z,Y){var J=Y.rows.length?Y.rows.item(0).key:null;I(J)},function(z,Y){S(Y)})})}).catch(S)});return y(T,w),T}function tE(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT key FROM "+S.storeName,[],function(G,z){for(var Y=[],J=0;J<z.rows.length;J++)Y.push(z.rows.item(J).key);T(Y)},function(G,z){I(z)})})}).catch(I)});return y(g,p),g}function rE(p){return new _(function(w,g){p.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,S){for(var M=[],G=0;G<S.rows.length;G++)M.push(S.rows.item(G).name);w({db:p,storeNames:M})},function(I,S){g(S)})},function(T){g(T)})})}function nE(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;return p.name?I=new _(function(S){var M;p.name===g.name?M=T._dbInfo.db:M=openDatabase(p.name,"","",0),p.storeName?S({db:M,storeNames:[p.storeName]}):S(rE(M))}).then(function(S){return new _(function(M,G){S.db.transaction(function(z){function Y(Oe){return new _(function(Ne,nt){z.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Ne()},function(Ze,Xt){nt(Xt)})})}for(var J=[],te=0,ve=S.storeNames.length;te<ve;te++)J.push(Y(S.storeNames[te]));_.all(J).then(function(){M()}).catch(function(Oe){G(Oe)})},function(z){G(z)})})}):I=_.reject("Invalid arguments"),y(I,w),I}var oE={_driver:"webSQLStorage",_initStorage:zv,_support:h(),iterate:Kv,getItem:Yv,setItem:Xv,removeItem:Jv,clear:Qv,length:Zv,key:eE,keys:tE,dropInstance:nE};function iE(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function im(p,w){var g=p.name+"/";return p.storeName!==w.storeName&&(g+=p.storeName+"/"),g}function sE(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch{return!0}}function aE(){return!sE()||localStorage.length>0}function cE(p){var w=this,g={};if(p)for(var T in p)g[T]=p[T];return g.keyPrefix=im(p,w._defaultConfig),aE()?(w._dbInfo=g,g.serializer=Ml,_.resolve()):_.reject()}function lE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var S=localStorage.key(I);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,p),g}function uE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo,S=localStorage.getItem(I.keyPrefix+p);return S&&(S=I.serializer.deserialize(S)),S});return y(T,w),T}function fE(p,w){var g=this,T=g.ready().then(function(){for(var I=g._dbInfo,S=I.keyPrefix,M=S.length,G=localStorage.length,z=1,Y=0;Y<G;Y++){var J=localStorage.key(Y);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=I.serializer.deserialize(te)),te=p(te,J.substring(M),z++),te!==void 0)return te}}});return y(T,w),T}function pE(p,w){var g=this,T=g.ready().then(function(){var I=g._dbInfo,S;try{S=localStorage.key(p)}catch{S=null}return S&&(S=S.substring(I.keyPrefix.length)),S});return y(T,w),T}function mE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo,I=localStorage.length,S=[],M=0;M<I;M++){var G=localStorage.key(M);G.indexOf(T.keyPrefix)===0&&S.push(G.substring(T.keyPrefix.length))}return S});return y(g,p),g}function dE(p){var w=this,g=w.keys().then(function(T){return T.length});return y(g,p),g}function hE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo;localStorage.removeItem(I.keyPrefix+p)});return y(T,w),T}function gE(p,w,g){var T=this;p=N(p);var I=T.ready().then(function(){w===void 0&&(w=null);var S=w;return new _(function(M,G){var z=T._dbInfo;z.serializer.serialize(w,function(Y,J){if(J)G(J);else try{localStorage.setItem(z.keyPrefix+p,Y),M(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(te),G(te)}})})});return y(I,g),I}function yE(p,w){if(w=A.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var T=this,I;return p.name?I=new _(function(S){p.storeName?S(im(p,T._defaultConfig)):S(p.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var G=localStorage.key(M);G.indexOf(S)===0&&localStorage.removeItem(G)}}):I=_.reject("Invalid arguments"),y(I,w),I}var vE={_driver:"localStorageWrapper",_initStorage:cE,_support:iE(),iterate:fE,getItem:uE,setItem:gE,removeItem:hE,clear:lE,length:dE,key:pE,keys:mE,dropInstance:yE},EE=function(w,g){return w===g||typeof w=="number"&&typeof g=="number"&&isNaN(w)&&isNaN(g)},_E=function(w,g){for(var T=w.length,I=0;I<T;){if(EE(w[I],g))return!0;I++}return!1},sm=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Ii={},am={},bo={INDEXEDDB:$t,WEBSQL:oE,LOCALSTORAGE:vE},bE=[bo.INDEXEDDB._driver,bo.WEBSQL._driver,bo.LOCALSTORAGE._driver],Hs=["dropInstance"],Bl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Hs),wE={description:"",driver:bE.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function SE(p,w){p[w]=function(){var g=arguments;return p.ready().then(function(){return p[w].apply(p,g)})}}function Ul(){for(var p=1;p<arguments.length;p++){var w=arguments[p];if(w)for(var g in w)w.hasOwnProperty(g)&&(sm(w[g])?arguments[0][g]=w[g].slice():arguments[0][g]=w[g])}return arguments[0]}var TE=(function(){function p(w){a(this,p);for(var g in bo)if(bo.hasOwnProperty(g)){var T=bo[g],I=T._driver;this[g]=I,Ii[I]||this.defineDriver(T)}this._defaultConfig=Ul({},wE),this._config=Ul({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,T,I){var S=new _(function(M,G){try{var z=g._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){G(Y);return}for(var J=Bl.concat("_initStorage"),te=0,ve=J.length;te<ve;te++){var Oe=J[te],Ne=!_E(Hs,Oe);if((Ne||g[Oe])&&typeof g[Oe]!="function"){G(Y);return}}var nt=function(){for(var xi=function(CE){return function(){var RE=new Error("Method "+CE+" is not implemented by the current driver"),cm=_.reject(RE);return y(cm,arguments[arguments.length-1]),cm}},kl=0,xE=Hs.length;kl<xE;kl++){var Fl=Hs[kl];g[Fl]||(g[Fl]=xi(Fl))}};nt();var Ze=function(xi){Ii[z]&&console.info("Redefining LocalForage driver: "+z),Ii[z]=g,am[z]=xi,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ze,G):Ze(!!g._support):Ze(!0)}catch(Xt){G(Xt)}});return C(S,T,I),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,T,I){var S=Ii[g]?_.resolve(Ii[g]):_.reject(new Error("Driver not found."));return C(S,T,I),S},p.prototype.getSerializer=function(g){var T=_.resolve(Ml);return C(T,g),T},p.prototype.ready=function(g){var T=this,I=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return C(I,g,g),I},p.prototype.setDriver=function(g,T,I){var S=this;sm(g)||(g=[g]);var M=this._getSupportedDrivers(g);function G(){S._config.driver=S.driver()}function z(te){return S._extend(te),G(),S._ready=S._initStorage(S._config),S._ready}function Y(te){return function(){var ve=0;function Oe(){for(;ve<te.length;){var Ne=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Ne).then(z).catch(Oe)}G();var nt=new Error("No available storage method found.");return S._driverSet=_.reject(nt),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return _.resolve()}):_.resolve();return this._driverSet=J.then(function(){var te=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,G(),S._wrapLibraryMethodsWithReady(),S._initDriver=Y(M)})}).catch(function(){G();var te=new Error("No available storage method found.");return S._driverSet=_.reject(te),S._driverSet}),C(this._driverSet,T,I),this._driverSet},p.prototype.supports=function(g){return!!am[g]},p.prototype._extend=function(g){Ul(this,g)},p.prototype._getSupportedDrivers=function(g){for(var T=[],I=0,S=g.length;I<S;I++){var M=g[I];this.supports(M)&&T.push(M)}return T},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Bl.length;g<T;g++)SE(this,Bl[g])},p.prototype.createInstance=function(g){return new p(g)},p})(),IE=new TE;o.exports=IE},{3:3}]},{},[4])(4)})});var kf=Hl((ec,ng)=>{"use strict";(function(t,e){typeof ec=="object"&&typeof ng<"u"?e(ec):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ec,function(t){"use strict";function e(D){var R,V,k=new Error(D);return R=k,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,k}function r(D,R,V){var k=R.slice(0,V).split(/\n/),H=k.length,ne=k[H-1].length+1;throw e(D+=" at line "+H+" col "+ne+`:
|
|
2
2
|
|
|
3
3
|
`+R.split(/\n/)[H-1]+`
|
|
4
4
|
`+Array(ne).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(D){if(!(D instanceof SyntaxError))throw D}function i(D,R){return Object.prototype.hasOwnProperty.call(D,R)}function s(D,R,V){for(var k in R)i(R,k)&&(R[k]==null||typeof R[k]!="object"||k!=="storage"&&k!=="prefixes"||V?D[k]=R[k]:D[k]=s({},R[k]));return D}var a=/^async +/,l=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,f=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,m=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function _(D){return d.test(D)?D.replace(d,"\\$&"):D}function y(D,R){R.rmWhitespace&&(D=D.replace(/[\r\n]+/g,`
|
|
@@ -60,4 +60,4 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
60
60
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
61
61
|
</span>
|
|
62
62
|
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0};e.marquee&&r.autoplay&&typeof r.autoplay=="object"&&(r.speed=e.speed,r.autoplay.pauseOnMouseEnter=!0,t.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let n=new window.CooeeSDK.Swiper(t,r);return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function _l(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),K("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[K("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&K("div",{class:"swiper-button-next",style:n,children:K("span",{})}),t.navigation.enabled&&K("div",{class:"swiper-button-prev",style:n,children:K("span",{})}),t.pagination.enabled&&K("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var As=class extends Ue{componentDidMount(){wt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return K("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:K("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(E({},this.getTypoStyles()),{display:"flex"})}};var pn=class extends Ue{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return K("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===be.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var mn=class extends Ue{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(Hn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Xo,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Ds=class extends mn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(wi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Os=class extends Ue{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){wt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),E(E({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(K("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(K("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var BT=new RegExp('fill="#[a-zA-Z0-9]+"'),Ns=class extends Ue{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),K("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Vo(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Vo(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return"";let i="";if(this.props.element.showSingleStar)i=r;else{let s=5,a=`${o.rating}`.split(".");for(let l=0;l<+a[0];l++)i+=r,s--;a[1]&&(i+=n,s--);for(let l=0;l<s;l++)i+=r.replace(BT,'fill="#f1f1f1"')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Ps=class extends Ue{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){wt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),E(E({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(K("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(o=>o.mID===r);this.props.item.setSelectedVariant(n)}};var Sv=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id},zp=t=>{if(!t)return;let e;try{e=new URL(t)}catch{return}if(e.hostname!=="cdn.shopify.com")return t;let r=e.pathname.split(".");return r.length!==2?t:(e.pathname=r[0]+"_large."+r[1],e.toString())};var wi=class extends Ue{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:K(Ds,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?K(As,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,o=zp(n.variantImage??n.firstImageURL),i=zp(n.variantSecondaryImage??n.secondaryImageURL);r.lg=r.sm={src:o,name:n.name,secondarySrc:i};let s=K(pn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?K("cooee-product-options-picker",{item:this.props.item}):K(Ps,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?K(Os,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?K(Ns,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?K(vo,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):K(Hn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=K(Kt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}attachListener(){document.addEventListener("letscooee:variant-change",e=>{let r=e;if(!r.detail||this.props.item.mID!==r.detail.productID)return;let n=r.detail.variantID;this.props.item.setSelectedVariantByID(n)})}};var Eo=class extends Ue{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Qn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Cn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return K("div",{style:E({},this.getCompiledStyles()),class:"lc-single-product",children:K(wi,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===Jt.BXGY;return!r.hasEffectivePrice()&&o&&(n.product=Z(E(E({},n.product),Lt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var Ls=class extends Ue{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=Wr()?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&&Ac().then(()=>{this.swiperInstance=El(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=i=>{this.swiperRef=i},o=()=>e?.map(i=>K("div",{class:"swiper-slide",children:this.getProductFragment(i)}));r=K("div",{style:Z(E({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:_l(this.configuration,n,o)})}else r=K("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,o)=>this.getProductFragment(n,o!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${i}, auto)`}}return r}getProductFragment(e,r=!1){return K(Lr,{children:[K(Eo,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&K("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:K(Kt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Ms=class extends Ue{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Ac().then(()=>{this.swiperInstance=El(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=o=>{this.swiperRef=o},n=()=>{let o=e.values?.map(a=>K("div",{class:"swiper-slide",onClick:l=>this.onClick(l,{clickAction:this.getClickAction(a)}),children:this.renderElement(a)}));if(!o?.length)return[];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let a=Number(i.maxInRow)-s+1;for(let l=0;l<a;l++)o.push(o[l%s])}return o};return _l(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return K(pn,{element:r,triggerContext:this.props.triggerContext});case 4:return K(mn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Qn(e,{form:r},this.props.triggerContext);return Gt.getParsedElement(n)}getClickAction(e){return Qn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Hn=class extends Ue{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),wt(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return K(mn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return K(Rs,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?K(vo,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return K(Kt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return K(pn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return K(Ls,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return K(Eo,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return K(Ms,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Bs=class extends Ue{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===be.GO_TO_URL&&!!Uo(this.clickAction.gu?.u)||this.clickAction?.at===be.OPEN_CART||this.clickAction?.at===be.INITIATE_CHECKOUT}componentDidMount(){wt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return K(Lr,{children:[K("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:K(Hn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&K("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}};var it=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Ir(new Date,this.engagementTrigger)}static currentEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=!1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ae(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){b.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),ap(this.engagementTrigger.content?.afterDeleteJS)}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){b.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,ap(this.engagementTrigger.content?.afterRenderJS)}async updateAndReRender(e){if(!this.acquireProcessingLock())try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}finally{this.releaseProcessingLock()}}async update(e){this.engagementTrigger.variation=e.variation}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){b.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render()}finally{this.releaseProcessingLock()}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),!0):!1}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}acquireProcessingLock(){return this.isProcessing?(b.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),!0):(b.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=!0,!1)}releaseProcessingLock(){b.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=!1}afterRootContainerCreated(){}isAllOkToRender(){return!!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){b.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){if(!e)return;let r=this.engagementTrigger;b.log(`${r} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(r.items=e.items.map(n=>new xt(n)),r.nonMutableItems=e.items.map(n=>new xt(n))),e.bundleFrom&&(r.bundleFrom=new xt(e.bundleFrom)),e.discount&&(r.discount=e.discount),e.placement&&(r.placement=e.placement),e.props&&_t.hasKeys(e.props)&&(r.props=E(E({},r.props),e.props)),e.content&&(r.content=new rs(e.content)),r.widget=new ti(e.widget),r.contentID=e.contentID,r.variation=e.variation,r.placement=e.placement,r.manipulation=e.manipulation,r.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=r.isExclusionTesting()&&r.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px")}addToRendered(){this.renderedCount++,b.info(`${this.engagementTrigger} rendered \u2705 ${Th(this.renderedCount)} time`)}removeFromRendered(){this instanceof dt?dt.currentEngagements.delete(this):t.currentEngagements.delete(this)}async getVariation(){b.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await Tv(e)).data}catch(r){if(r instanceof er&&r.response?.status===400)return;ae(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async a=>{if(a.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),s.unobserve(this.rootContainer)}})},r);o.observe(this.rootContainer),this.observers.push(o)})}attachScroll(){this.scrollSubscription=po(window,"scroll").pipe(zt(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let o=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",i=new xe(o,n,this.engagementTrigger);i.name==="CE Campaign Holdout"&&(i.trigger.holdout=!0),Mt(i),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=me.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),this.injectOuterCSSOnly(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i} lc-${o}`,n.dataset.engagementId=i,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}async startRendering(){let e=this.rootContainer,r=this.triggerContext.triggerData.hasSwiperElement();r&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),cp(e)),this.injectCampaignCSS(r,e);let n=this.engagementTrigger.widget;Hh(Sf(Bs,{element:n.cont,triggerContext:this.triggerContext,elements:n.elems}),e),this.addToRendered()}injectCampaignCSS(e,r){let n=this.engagementTrigger.content?.outerCSS?.trim()??"",o=this.engagementTrigger.content?.innerCSS?.trim()??"";if(!n&&!o)return;let i=this.rootContainer.id;if(e){sn(o,r),this.injectOuterCSSOnly();return}let s=n+`
|
|
63
|
-
${o}`;sn(`#${i} { ${s} }`)}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let r=this.rootContainer.id;sn(`#${r} { ${e} }`)}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=o/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,o;if(n.includes(":shadow")){let l=n.split(":shadow");o=(await Sn(l[0].trim()))?.shadowRoot,n=l[1].trim(),o&&cp(o,!1)}b.verbose(`${this.engagementTrigger} attempt to render "${r.position}" "${n}"`);let i=await Sn(n,3,o??document);if(!i)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case At.BEFORE1:case At.BEFORE:{i.parentElement?.insertBefore(a,i);break}case At.INSIDE_FIRST1:case At.INSIDE_FIRST:{i.insertBefore(a,i.firstChild);break}case At.INSIDE_LAST1:case At.INSIDE_LAST:{i.appendChild(a);break}case At.AFTER1:case At.AFTER:default:i.parentElement?.insertBefore(a,i.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){b.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}b.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await hl(this.engagementTrigger)}catch(r){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),o=this.getItemDiff(r,e);r.push(...n);for(let i of o)Yr.remove(r,i)}getItemDiff(e,r){return e.filter(n=>!r.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var dt=class extends it{static currentEngagements=new Set;constructor(e){super(e)}rerenderAfterCartOpened(){this.rerenderIfDeleted(),this.checkAndSendEvent()}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!Je.get().isOpen()&&fe().pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var UT=t=>t,Iv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function xv(t,e={childList:!0,subtree:!0},r=500,n=UT){return Qc(o=>{let i=new MutationObserver(s=>o(s));return i.observe(t,e),i},(o,i)=>i.disconnect()).pipe(un(o=>n(o)),Mp(o=>o.length>0),zt(r))}var bl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=me.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new t(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let o=new Mr(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let m of o.sellingPlans??[])m.mID===i.id.toString()&&(m.isSelected=!0,o.changeSellingPlan(m));let s=new xt(r);s.vars=[o],s.selectedOrFirstVariant.value=o;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new St(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let f=new dt(l);f.renderSilently(),this.watchForCartItemDeletion(f,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(b.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var wl=class extends dt{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){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await me.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,a,l=[...r.milestones];for(let A of l){if(A.rewardType!==Gl.FREE_AUTO_GIFT)continue;if(A.isUIOnly&&!A.allowATC){b.verbose(`Skipping milestone ${A.label} as it is UI only and does not allow ATC`);continue}let B=A.items[0],q=A.reached,P=e.items.find(Q=>(Q.vID===B.vID||Q.mID===B.mID)&&Q.properties._letscooee_campaign===this.engagementTrigger.shortID);q&&(s=A,a=P),P&&n.push(P),!q&&P&&r.removeIneligibleItem?(b.verbose(`Removing free gift ${P.vID} from cart`),i.push(P)):q&&!P&&(b.verbose(`Adding free gift ${B.vID} to cart`),o.push(B))}r.restrictToLatestFreebie&&s&&(a?(n=n.filter(A=>A.vID!==a.vID),o=[]):o=[s.items[0]],i.push(...n));let f={},m={};i.length&&i.forEach(A=>m[A.key??A.vID]=0),o.length&&o.forEach(A=>m[A.vID]=1);let d=r.coupons,_=[];if(d?.length){_=d.map(q=>q.couponCode);let A=me.getCurrent().discount_codes?.map(q=>q.code)??[];_.every(q=>A.some(P=>P===q))||(f.discount=_.join(","))}if(_t.hasKeys(m)&&(f.updates=m),!_t.hasKeys(f))return;let y=await mv(f,this.engagementTrigger),C=y?.items,N=[];for(let A of o){let B=C?.find(q=>_?.length?q.id+""===A.vID&&q.discounts?.some(P=>_.includes(P.title)):q.id+""===A.vID);B&&N.push(B)}if(!N.length){Je.get().refreshUI(y,!1);return}try{await Promise.all(N.map(A=>dv(A,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})))}catch(A){ae(A,"add-private-attribute",{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:N}})}finally{Je.get().refreshUI(y,!1)}}};var Us=class extends dt{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 Sl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Tl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Il=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,o=e.detail;if(!_t.hasKeys(o)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==r.shortID&&i!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let a=s.map(l=>new Dt({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new fn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:be.ADD_BUNDLE,applyDiscount:!0}})}};var xl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-collection-filter")}};var Yp=!1,Kp=!1,Cl=null,Rl=null,Cv=!1;function Rv(){Cv||(Cv=!0,wn(()=>{xv(document.body,{childList:!0,subtree:!0},500,Iv).subscribe(()=>{it.currentEngagements.forEach(t=>t.rerenderIfDeleted()),dt.currentEngagements.forEach(t=>t.rerenderIfDeleted())})}))}function Xp(t){if(Rv(),Yp){b.verbose("Cart widget processing in progress, queuing latest triggers"),Cl=t;return}Yp=!0;try{kT(t)}finally{if(Yp=!1,Cl){let e=Cl;Cl=null,b.verbose("Processing queued cart triggers"),Xp(e)}}}function Jp(t){if(Rv(),Kp){b.verbose("Page widget processing in progress, queuing latest triggers"),Rl=t;return}Kp=!0;try{FT(t)}finally{if(Kp=!1,Rl){let e=Rl;Rl=null,b.verbose("Processing queued page triggers"),Jp(e)}}}function kT(t){Dv(dt.currentEngagements,t);for(let e of t){b.info(`${e} received as cart embed`);let r=Av(dt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new wl(e);else if(e.isSubscriptionUpsell()){bl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Us(e):n=new dt(e);dt.currentEngagements.add(n),n.renderSilently()}}function FT(t){Dv(it.currentEngagements,t);for(let e of t){b.info(`${e} received as page embed`);let r=Av(it.currentEngagements,e);if(r){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Sl(e):e.isBYOB()?n=new Il(e):e.isStickyATC()?n=new Tl(e):e.isSavingsBar()?n=new Us(e):e.isCollectionFilter()?n=new xl(e):n=new it(e),it.currentEngagements.add(n),n.renderSilently()}}function Av(t,e){for(let r of t)if(r.matches(e))return r}function Dv(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var Nv=new qt,Ov=0;Nv.pipe(zt(50)).subscribe(async t=>{let e=await Fn();HT(e).catch(r=>{ae(r,"load-page-widgets",{extra:{firstLoad:t}})}),$T(e).catch(r=>{ae(r,"load-cart-widgets",{extra:{firstLoad:t}})})});function ks(t=!1){Sr(ur).then(()=>{Nv.next(t)})}function Pv(){dt.currentEngagements.forEach(t=>t.rerenderAfterCartOpened())}async function Tv(t){let e=await Fn();return Object.assign(t,e),Yt("/v1/engagement/get-variant",t)}async function HT(t){Ov++,Ov===1?b.info("Fetch page widgets (after \u23F0",So()+" of SDK load)"):b.info("Fetch page widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/page-widgets",e);b.info(`Page widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Jp(n)}catch(r){b.error("Error sending widget getter",r)}}async function $T(t){b.info("Fetch cart widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/cart-widgets",e);b.info(`Cart widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Xp(n)}catch(r){b.error("Error sending widget getter",r)}}function Lv(){let t=je.get();!t.gaMeasurementID||!t.gaEnabled||WT()}async function VT(){let t=await Ye.get("gacid"),e=await jT();if(t!==e)return await Ye.set("gacid",e),e}async function WT(){let t=await VT();t&&gl({gaClientID:t})}async function jT(){let e=je.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(r=>{window.gtag("get",e,"client_id",n=>{r(n)})})}async function Mv(t){b.verbose("Received app configuration",t),t.currencyCount=t.currencies?.length;let e=Ce.globalRef.config.update(t);Lv(),Je.initialize(),e.website&&(kg(e.website.commonJS),sn(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(zt(10)).subscribe(async({open:r})=>{b.info("Cart drawer is now",r?"open":"closed"),r&&(Pv(),await GT())})}async function GT(){let t=await me.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},r={items:t.items,amount:e,drawer:!0};Tt(new xe("View Cart",r))}var Al=class{runtimeData=fe();meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{ks()},e.loadExperiments=()=>{vl()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce),e.executeCTA=(r,n)=>{new fn(r).execute(n)},e.sendEvent=r=>{Tt(r)}}overwritePush(e,r){Nr(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(mm.includes(e[0])?Ce.sendEvent(e[0],e[1],E({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&qT(e.currentItem),e.currency&&(fe().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&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&me.getCurrent().update(e.cart),e.configurations&&Mv(e.configurations),e.customContext&&(this.runtimeData.customContext=E(E({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(fe().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=Sv();if(e||(e=fe().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new St({id:"preview",shortID:"1",redirectBehaviour:Qt.CART_DRAWER});await new fn(new Ir(new Date,r)).execute({clickAction:{at:be.ADD_TO_CART},embeddedItem:new Dt({vID:e})})}};function qT(t){let e=fe();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(r)}e.currentItem=new Dt(t)}var Si=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var zT=1e3,YT=10,Qp=0,Zp=new Date;function em(t){Si.remove("sleid"),Zp=t??new Date}function Bv(){if(window.scrollY){let t=Fv();Uv(t)&&kv(t)}wn(()=>{KT()})}function KT(){po(window,"scroll").pipe(zt(zT),un(()=>{let t=Fv();if(t>100){b.warn("Received scroll percent is more than 100",t);return}if(Uv(t))return t})).subscribe(t=>{kv(t)})}function Uv(t){return Math.abs(Qp-t)>=YT||Qp!==t&&t===100}function kv(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Zp.getTime()};Qp=t;let r=Si.getString("sleid",""),n=new xe("CE Scroll",e,null,r);Tt(n),Si.setString("sleid",n.id.toHexString()),Zp=new Date(n.occurred)}function Fv(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Hv(){XT()}function XT(){let t=window.fetch;try{window.fetch=async function(e,r){try{await JT(e,r)}catch(n){ae(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)}}catch(e){console.warn("Fail to override fetch.",`Cooee won't be able to track "Buy Now Clicked" KPI.`),b.error(e)}b.verbose("Securely overwritten window.fetch method for graphql query")}async function JT(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;n?.variables?.input&&(b.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await QT(n),ZT()))}async function QT(t){let e=t.variables.input.attributes??[],r=await $a("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function ZT(){let t=fe().currentItem;if(!t)return;let e=new xe("Buy Now Clicked",{items:[t]});Tt(e)}var Ti=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new xe(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});Tt(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await gf(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Dl=class t extends Ti{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 Ol=class t extends Ti{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 eI=[".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 $v(){wn(()=>{b.verbose("Execution order:","document ready"),tI()})}function tI(){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(eI);if(!e){b.verbose("No clickable cart checkout button found");return}b.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&Je.get().open()}function Wv(){window.addEventListener("kp-modal:opened",()=>{fe().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&bi({goKwikToken:e})}),window.gokwikSdk?Vv():window.addEventListener("gokwikLoaded",Vv)}function Vv(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await me.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new xe("Checkout Started",e);Tt(r)})}var Nl=class{static watch(){let e=localStorage.getItem("cooeeDebugTill"),r=ym();if(r==="1"||r==="on"){let n=this.getDebugMillis();gl({debugTill:n}),e||(e=n.toString(),localStorage.setItem("cooeeDebugTill",e))}r==="on"?sessionStorage.cooeeDebug="1":r==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar(),e&&new Date(+e)<new Date&&localStorage.removeItem("cooeeDebugTill")}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,wn(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Fs=class Fs extends hn{};wo(Fs,"storeName","app"),Fs.storage=Io(Fs.storeName);var Pl=Fs;var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(b.info("Initialising SDK"),Fg(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}this.initGlobalReference(e),await qy(),this.autoAuthenticate(),new Al().meddle(),Sm(),ks(!0),vl(),rI(),ev(),cv(),Hv(),$v(),Bv(),Ol.getInstance().listenSilently(),Dl.getInstance().listenSilently(),Wv(),nI(),Nl.watch(),Pl.remove("conf").catch(r=>{b.error("Fail to remove App Config from local storage",r)})}}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Nr(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Nr(this.globalRef,"config",new je),Nr(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Nr(this.globalRef,"uaParser",new br,!0),Nr(this.globalRef,"cart",me.getCurrent()),Nr(this.globalRef,"cartChange$",av()),Nr(this.globalRef,"cartDrawerToggle$",Je.cartDrawerToggle$.asObservable()),b.verbose("Global reference initialised"),new Dc(()=>{this.globalRef.uaParser=new br})}static injectWidgetAssets(){Bg(hr.widgetURL,"cooee-widget-sdk"),sp()}static autoAuthenticate(){let e=tc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;b.info("Begin auth after \u23F0",So(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((df(r)||r.length!==24)&&df(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,jy(e)}static sendEvent(e,r,n){let o=new xe(e,r,n?.triggerData);n?.occurred&&(o.occurred=n.occurred),Tt(o)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");bi(e)}static setPageName(e){if(!e)return;let r=fe(),n=r.pageName;if(e===n)return;if(r.pageName=e,fm.some(s=>e.includes(s))){em();return}let o={};n&&(o.ps=n);let i=new xe("CE Screen View",o);i.occurred=r.jsLoadTime,Tt(i),em(i.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new it(new St(e)).renderSilently()}};function rI(){window.CooeeSDK.cartChange$.subscribe(()=>{ks()})}function nI(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){b.error(t)}window.addEventListener("message",t=>{if(b.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"?(Ce.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(Ce.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}var jv=new Date;hm();vm();b.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.verbose("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(jv),await Ce.initForAll(),oI(),b.verbose("Execution order:","IIFE end")))());b.verbose("Execution order:","bottom");function oI(){gm()&&import("./debug-logs-6673UIIX.js").then(({printAllDebugLogs:t})=>t(jv))}
|
|
63
|
+
${o}`;sn(`#${i} { ${s} }`)}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let r=this.rootContainer.id;sn(`#${r} { ${e} }`)}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=o/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,o;if(n.includes(":shadow")){let l=n.split(":shadow");o=(await Sn(l[0].trim()))?.shadowRoot,n=l[1].trim(),o&&cp(o,!1)}b.verbose(`${this.engagementTrigger} attempt to render "${r.position}" "${n}"`);let i=await Sn(n,3,o??document);if(!i)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case At.BEFORE1:case At.BEFORE:{i.parentElement?.insertBefore(a,i);break}case At.INSIDE_FIRST1:case At.INSIDE_FIRST:{i.insertBefore(a,i.firstChild);break}case At.INSIDE_LAST1:case At.INSIDE_LAST:{i.appendChild(a);break}case At.AFTER1:case At.AFTER:default:i.parentElement?.insertBefore(a,i.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){b.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}b.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await hl(this.engagementTrigger)}catch(r){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),o=this.getItemDiff(r,e);r.push(...n);for(let i of o)Yr.remove(r,i)}getItemDiff(e,r){return e.filter(n=>!r.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var dt=class extends it{static currentEngagements=new Set;constructor(e){super(e)}rerenderAfterCartOpened(){this.rerenderIfDeleted(),this.checkAndSendEvent()}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!Je.get().isOpen()&&fe().pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var UT=t=>t,Iv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function xv(t,e={childList:!0,subtree:!0},r=500,n=UT){return Qc(o=>{let i=new MutationObserver(s=>o(s));return i.observe(t,e),i},(o,i)=>i.disconnect()).pipe(un(o=>n(o)),Mp(o=>o.length>0),zt(r))}var bl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=me.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new t(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let o=new Mr(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let m of o.sellingPlans??[])m.mID===i.id.toString()&&(m.isSelected=!0,o.changeSellingPlan(m));let s=new xt(r);s.vars=[o],s.selectedOrFirstVariant.value=o;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new St(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let f=new dt(l);f.renderSilently(),this.watchForCartItemDeletion(f,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(b.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var wl=class extends dt{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){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await me.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,a,l=[...r.milestones];for(let A of l){if(A.rewardType!==Gl.FREE_AUTO_GIFT)continue;if(A.isUIOnly&&!A.allowATC){b.verbose(`Skipping milestone ${A.label} as it is UI only and does not allow ATC`);continue}let B=A.items[0],q=A.reached,P=e.items.find(Q=>(Q.vID===B.vID||Q.mID===B.mID)&&Q.properties._letscooee_campaign===this.engagementTrigger.shortID);q&&(s=A,a=P),P&&n.push(P),!q&&P&&r.removeIneligibleItem?(b.verbose(`Removing free gift ${P.vID} from cart`),i.push(P)):q&&!P&&(b.verbose(`Adding free gift ${B.vID} to cart`),o.push(B))}r.restrictToLatestFreebie&&s&&(a?(n=n.filter(A=>A.vID!==a.vID),o=[]):o=[s.items[0]],i.push(...n));let f={},m={};i.length&&i.forEach(A=>m[A.key??A.vID]=0),o.length&&o.forEach(A=>m[A.vID]=1);let d=r.coupons,_=[];if(d?.length){_=d.map(q=>q.couponCode);let A=me.getCurrent().discount_codes?.map(q=>q.code)??[];_.every(q=>A.some(P=>P===q))||(f.discount=_.join(","))}if(_t.hasKeys(m)&&(f.updates=m),!_t.hasKeys(f))return;let y=await mv(f,this.engagementTrigger),C=y?.items,N=[];for(let A of o){let B=C?.find(q=>_?.length?q.id+""===A.vID&&q.discounts?.some(P=>_.includes(P.title)):q.id+""===A.vID);B&&N.push(B)}if(!N.length){Je.get().refreshUI(y,!1);return}try{await Promise.all(N.map(A=>dv(A,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})))}catch(A){ae(A,"add-private-attribute",{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:N}})}finally{Je.get().refreshUI(y,!1)}}};var Us=class extends dt{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 Sl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Tl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Il=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,o=e.detail;if(!_t.hasKeys(o)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==r.shortID&&i!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let a=s.map(l=>new Dt({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new fn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:be.ADD_BUNDLE,applyDiscount:!0}})}};var xl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-collection-filter")}};var Yp=!1,Kp=!1,Cl=null,Rl=null,Cv=!1;function Rv(){Cv||(Cv=!0,wn(()=>{xv(document.body,{childList:!0,subtree:!0},500,Iv).subscribe(()=>{it.currentEngagements.forEach(t=>t.rerenderIfDeleted()),dt.currentEngagements.forEach(t=>t.rerenderIfDeleted())})}))}function Xp(t){if(Rv(),Yp){b.verbose("Cart widget processing in progress, queuing latest triggers"),Cl=t;return}Yp=!0;try{kT(t)}finally{if(Yp=!1,Cl){let e=Cl;Cl=null,b.verbose("Processing queued cart triggers"),Xp(e)}}}function Jp(t){if(Rv(),Kp){b.verbose("Page widget processing in progress, queuing latest triggers"),Rl=t;return}Kp=!0;try{FT(t)}finally{if(Kp=!1,Rl){let e=Rl;Rl=null,b.verbose("Processing queued page triggers"),Jp(e)}}}function kT(t){Dv(dt.currentEngagements,t);for(let e of t){b.info(`${e} received as cart embed`);let r=Av(dt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new wl(e);else if(e.isSubscriptionUpsell()){bl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Us(e):n=new dt(e);dt.currentEngagements.add(n),n.renderSilently()}}function FT(t){Dv(it.currentEngagements,t);for(let e of t){b.info(`${e} received as page embed`);let r=Av(it.currentEngagements,e);if(r){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Sl(e):e.isBYOB()?n=new Il(e):e.isStickyATC()?n=new Tl(e):e.isSavingsBar()?n=new Us(e):e.isCollectionFilter()?n=new xl(e):n=new it(e),it.currentEngagements.add(n),n.renderSilently()}}function Av(t,e){for(let r of t)if(r.matches(e))return r}function Dv(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var Nv=new qt,Ov=0;Nv.pipe(zt(50)).subscribe(async t=>{let e=await Fn();HT(e).catch(r=>{ae(r,"load-page-widgets",{extra:{firstLoad:t}})}),$T(e).catch(r=>{ae(r,"load-cart-widgets",{extra:{firstLoad:t}})})});function ks(t=!1){Sr(ur).then(()=>{Nv.next(t)})}function Pv(){dt.currentEngagements.forEach(t=>t.rerenderAfterCartOpened())}async function Tv(t){let e=await Fn();return Object.assign(t,e),Yt("/v1/engagement/get-variant",t)}async function HT(t){Ov++,Ov===1?b.info("Fetch page widgets (after \u23F0",So()+" of SDK load)"):b.info("Fetch page widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/page-widgets",e);b.info(`Page widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Jp(n)}catch(r){b.error("Error sending widget getter",r)}}async function $T(t){b.info("Fetch cart widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/cart-widgets",e);b.info(`Cart widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Xp(n)}catch(r){b.error("Error sending widget getter",r)}}function Lv(){let t=je.get();!t.gaMeasurementID||!t.gaEnabled||WT()}async function VT(){let t=await Ye.get("gacid"),e=await jT();if(t!==e)return await Ye.set("gacid",e),e}async function WT(){let t=await VT();t&&gl({gaClientID:t})}async function jT(){let e=je.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(r=>{window.gtag("get",e,"client_id",n=>{r(n)})})}async function Mv(t){b.verbose("Received app configuration",t),t.currencyCount=t.currencies?.length;let e=Ce.globalRef.config.update(t);Lv(),Je.initialize(),e.website&&(kg(e.website.commonJS),sn(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(zt(10)).subscribe(async({open:r})=>{b.info("Cart drawer is now",r?"open":"closed"),r&&(Pv(),await GT())})}async function GT(){let t=await me.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},r={items:t.items,amount:e,drawer:!0};Tt(new xe("View Cart",r))}var Al=class{runtimeData=fe();meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{ks()},e.loadExperiments=()=>{vl()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce),e.executeCTA=(r,n)=>{new fn(r).execute(n)},e.sendEvent=r=>{Tt(r)}}overwritePush(e,r){Nr(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(mm.includes(e[0])?Ce.sendEvent(e[0],e[1],E({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&qT(e.currentItem),e.currency&&(fe().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&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&me.getCurrent().update(e.cart),e.configurations&&Mv(e.configurations),e.customContext&&(this.runtimeData.customContext=E(E({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(fe().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=Sv();if(e||(e=fe().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new St({id:"preview",shortID:"1",redirectBehaviour:Qt.CART_DRAWER});await new fn(new Ir(new Date,r)).execute({clickAction:{at:be.ADD_TO_CART},embeddedItem:new Dt({vID:e})})}};function qT(t){let e=fe();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(r)}e.currentItem=new Dt(t)}var Si=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var zT=1e3,YT=10,Qp=0,Zp=new Date;function em(t){Si.remove("sleid"),Zp=t??new Date}function Bv(){if(window.scrollY){let t=Fv();Uv(t)&&kv(t)}wn(()=>{KT()})}function KT(){po(window,"scroll").pipe(zt(zT),un(()=>{let t=Fv();if(t>100){b.warn("Received scroll percent is more than 100",t);return}if(Uv(t))return t})).subscribe(t=>{kv(t)})}function Uv(t){return Math.abs(Qp-t)>=YT||Qp!==t&&t===100}function kv(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Zp.getTime()};Qp=t;let r=Si.getString("sleid",""),n=new xe("CE Scroll",e,null,r);Tt(n),Si.setString("sleid",n.id.toHexString()),Zp=new Date(n.occurred)}function Fv(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Hv(){XT()}function XT(){let t=window.fetch;try{window.fetch=async function(e,r){try{await JT(e,r)}catch(n){ae(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)}}catch(e){console.warn("Fail to override fetch.",`Cooee won't be able to track "Buy Now Clicked" KPI.`),b.error(e)}b.verbose("Securely overwritten window.fetch method for graphql query")}async function JT(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;n?.variables?.input&&(b.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await QT(n),ZT()))}async function QT(t){let e=t.variables.input.attributes??[],r=await $a("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function ZT(){let t=fe().currentItem;if(!t)return;let e=new xe("Buy Now Clicked",{items:[t]});Tt(e)}var Ti=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new xe(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});Tt(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await gf(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Dl=class t extends Ti{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 Ol=class t extends Ti{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 eI=[".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 $v(){wn(()=>{b.verbose("Execution order:","document ready"),tI()})}function tI(){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(eI);if(!e){b.verbose("No clickable cart checkout button found");return}b.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&Je.get().open()}function Wv(){window.addEventListener("kp-modal:opened",()=>{fe().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&bi({goKwikToken:e})}),window.gokwikSdk?Vv():window.addEventListener("gokwikLoaded",Vv)}function Vv(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await me.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new xe("Checkout Started",e);Tt(r)})}var Nl=class{static watch(){let e=localStorage.getItem("cooeeDebugTill"),r=ym();if(r==="1"||r==="on"){let n=this.getDebugMillis();gl({debugTill:n}),e||(e=n.toString(),localStorage.setItem("cooeeDebugTill",e))}r==="on"?sessionStorage.cooeeDebug="1":r==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar(),e&&new Date(+e)<new Date&&localStorage.removeItem("cooeeDebugTill")}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,wn(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Fs=class Fs extends hn{};wo(Fs,"storeName","app"),Fs.storage=Io(Fs.storeName);var Pl=Fs;var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(b.info("Initialising SDK"),Fg(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}this.initGlobalReference(e),await qy(),this.autoAuthenticate(),new Al().meddle(),Sm(),ks(!0),vl(),rI(),ev(),cv(),Hv(),$v(),Bv(),Ol.getInstance().listenSilently(),Dl.getInstance().listenSilently(),Wv(),nI(),Nl.watch(),Pl.remove("conf").catch(r=>{b.error("Fail to remove App Config from local storage",r)})}}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Nr(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Nr(this.globalRef,"config",new je),Nr(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Nr(this.globalRef,"uaParser",new br,!0),Nr(this.globalRef,"cart",me.getCurrent()),Nr(this.globalRef,"cartChange$",av()),Nr(this.globalRef,"cartDrawerToggle$",Je.cartDrawerToggle$.asObservable()),b.verbose("Global reference initialised"),new Dc(()=>{this.globalRef.uaParser=new br})}static injectWidgetAssets(){Bg(hr.widgetURL,"cooee-widget-sdk"),sp()}static autoAuthenticate(){let e=tc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;b.info("Begin auth after \u23F0",So(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((df(r)||r.length!==24)&&df(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,jy(e)}static sendEvent(e,r,n){let o=new xe(e,r,n?.triggerData);n?.occurred&&(o.occurred=n.occurred),Tt(o)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");bi(e)}static setPageName(e){if(!e)return;let r=fe(),n=r.pageName;if(e===n)return;if(r.pageName=e,fm.some(s=>e.includes(s))){em();return}let o={};n&&(o.ps=n);let i=new xe("CE Screen View",o);i.occurred=r.jsLoadTime,Tt(i),em(i.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new it(new St(e)).renderSilently()}};function rI(){window.CooeeSDK.cartChange$.subscribe(()=>{ks()})}function nI(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){b.error(t)}window.addEventListener("message",t=>{if(b.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"?(Ce.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(Ce.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}var jv=new Date;hm();vm();b.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.verbose("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(jv),await Ce.initForAll(),oI(),b.verbose("Execution order:","IIFE end")))());b.verbose("Execution order:","bottom");function oI(){gm()&&import("./debug-logs-JU6PXCQW.js").then(({printAllDebugLogs:t})=>t(jv))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b}from"./chunk-
|
|
1
|
+
import{a as C,b}from"./chunk-4E4YLS3I.js";import{a as g,b as h,d as u,g as f}from"./chunk-OS2E7UQC.js";import{Ba as l,Qa as c,X as m,pa as n,qa as i,ra as r,v as s}from"./chunk-BMEFEXWO.js";import"./chunk-V7UGKYBN.js";var _=class d{dialogRef=s(u);eventData=s(h);triggerData=s(g)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=b(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;default:}o&&C(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close()}static \u0275fac=function(o){return new(o||d)};static \u0275cmp=m({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&&(n(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Share"),i(),n(4,"button",2),l("click",function(e){return t.onShareAndClose(e)}),r(5,"cooee-icon",3),i()(),n(6,"div",4)(7,"button",5),l("click",function(e){return t.onShareAndClose(e,"Whatsapp")}),r(8,"cooee-icon",6),n(9,"span"),c(10,"Whatsapp"),i()(),n(11,"button",7),l("click",function(e){return t.onShareAndClose(e,"X(Twitter)")}),r(12,"cooee-icon",8),n(13,"span"),c(14,"X"),i()(),n(15,"button",9),l("click",function(e){return t.onShareAndClose(e,"Clipboard")}),r(16,"cooee-icon",10),n(17,"span"),c(18,"Copy link"),i()()()())},dependencies:[f],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}"]})};export{_ as ShareDialogComponent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as ue,l as be,o as _e,p as Ce,q as ye,r as xe,s as De,t as Ve,u as Ie}from"./chunk-TNST7VOR.js";import{a as Ee,b as Te}from"./chunk-4E4YLS3I.js";import{a as ge,b as P,c as j,d as he,e as ve,f as fe,g as M}from"./chunk-OS2E7UQC.js";import{b as U,h as k,i as we}from"./chunk-PLMFOGWI.js";import{Ba as h,Bb as me,Da as s,E as _,Ga as F,Ha as B,I as K,Ia as H,L as G,La as V,M as Q,Ma as S,O as d,Ta as ie,Ua as oe,V as q,Va as ne,X as y,Za as re,ba as E,fb as se,ha as T,ia as x,ib as ae,ja as D,jb as de,kb as le,la as Y,ma as $,na as L,oa as u,pa as l,qa as a,ra as w,sa as J,sb as ce,ta as X,ua as Z,ub as pe,v,va as ee,wa as te,x as p,xa as A,y as m,za as C}from"./chunk-BMEFEXWO.js";import"./chunk-ICI7BO4Q.js";import"./chunk-V7UGKYBN.js";var I="a-f\\d",Me=`#?[${I}]{3}[${I}]?`,Oe=`#?[${I}]{6}([${I}]{2})?`,Ne=new RegExp(`[^#${I}]`,"gi"),Re=new RegExp(`^${Me}$|^${Oe}$`,"i");function W(i,e={}){if(typeof i!="string"||Ne.test(i)||!Re.test(i))throw new TypeError("Expected a valid hex string");i=i.replace(/^#/,"");let t=1;i.length===8&&(t=Number.parseInt(i.slice(6,8),16)/255,i=i.slice(0,6)),i.length===4&&(t=Number.parseInt(i.slice(3,4).repeat(2),16)/255,i=i.slice(0,3)),i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);let o=Number.parseInt(i,16),n=o>>16,r=o>>8&255,f=o&255,b=typeof e.alpha=="number"?e.alpha:t;if(e.format==="array")return[n,r,f,b];if(e.format==="css"){let g=b===1?"":` / ${Number((b*100).toFixed(2))}%`;return`rgb(${n} ${r} ${f}${g})`}return{red:n,green:r,blue:f,alpha:b}}var c=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return W(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var O=class i{static DEFAULT_FALLBACK=new c({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new c(e.c)),e.fb&&(this.fb=new c(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??i.DEFAULT_FALLBACK}};var N=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new c(e.color)}};var R=class i{video=le.required();progress=_(0);constructor(){ae(e=>{let t=this.video(),o=()=>{this.progress.set(t.currentTime/t.duration*100)};t.addEventListener("timeupdate",o),e(()=>{t.removeEventListener("timeupdate",o)})})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,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(t,o){t&1&&(J(0,"div",0)(1,"div",1),Z(2,"div"),X()()),t&2&&(d(),S("width",o.progress(),"%"),T("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 z=class i{dialogState=de();dialog=v(fe);triggerData=v(ge)().triggerData;eventData=v(P);containerRef=v(q);async share(e){e.stopPropagation(),e.preventDefault(),k()&&we()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let e=Te(this.triggerData,this.eventData.video,!1);await navigator.share(e),Ee(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let e=await import("./share-dialog.component-UGACJ5AR.js");this.dialogState.emit(!0),this.dialog.open(e.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(t,o){t&1&&(l(0,"button",0),h("click",function(r){return o.share(r)}),w(1,"cooee-icon",1),a())},dependencies:[M],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 ze=["swiperComp"],$e=["videoEl"],Le=(i,e)=>e.url;function Ae(i,e){i&1&&(l(0,"div",11),w(1,"div",15),a())}function Fe(i,e){if(i&1&&w(0,"source",13),i&2){let t=e.$implicit;u("type",re(t.mimeType))("src",t.url,G)}}function Be(i,e){i&1&&A(0)}function He(i,e){if(i&1){let t=C();l(0,"cooee-video-promoted-items",24),h("cardClick",function(n){p(t);let r=s(2).$implicit,f=s();return m(f.productCardClicked(n,r))}),a()}if(i&2){let t=s(2).$implicit;u("items",t.items)}}function je(i,e){if(i&1&&w(0,"cooee-video-card",23),i&2){let t=s(2).$implicit;u("card",t.card)}}function Ue(i,e){if(i&1){let t=C();w(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ne("mutedChange",function(n){p(t);let r=s(2);return oe(r.muted,n)||(r.muted=n),m(n)}),h("toggled",function(){p(t);let n=s(2);return m(n.muteToggled())}),a(),E(3,Be,1,0,"ng-container",8),a(),l(4,"div",19)(5,"cooee-share-button",20),h("dialogState",function(n){p(t);let r=s(2);return m(r.shareDialogOpen.set(n))}),a()(),l(6,"div",21),x(7,He,1,1,"cooee-video-promoted-items",22)(8,je,1,1,"cooee-video-card",23),a()}if(i&2){let t=s().$implicit,o=V(5),n=s(),r=V(9);u("video",o),d(2),ie("muted",n.muted),u("videoEl",o),d(),u("ngTemplateOutlet",r),d(4),D(t.items.length&&n.videoConfig.showItems()?7:t.card&&n.videoConfig.footerContent===n.VideoConfigFooterContent.CARD?8:-1)}}function We(i,e){if(i&1){let t=C();l(0,"cooee-item-detail",25),h("closeClick",function(){p(t);let n=s(2);return m(n.productModalClosed())}),a()}if(i&2){let t=s(2);u("item",t.selectedItem)("similarItems",t.selectedVideo.items)("template",t.videoConfig.itemDetailConfig.template)}}function Ke(i,e){if(i&1){let t=C();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,Ae,2,0,"div",11),l(4,"video",12,2),h("click",function(){let n=p(t).$index,r=s();return m(r.currentIndex===n&&r.toggleMute())})("ended",function(){p(t);let n=V(5),r=s();return m(r.onVideoEnded(n))})("loadstart",function(){let n=p(t).$index,r=s();return m(r.onVideoLoadStart(n))})("canplay",function(){let n=p(t).$index,r=s();return m(r.onVideoCanPlay(n))}),$(6,Fe,1,3,"source",13,Le),a(),x(8,Ue,9,5),a(),x(9,We,1,3,"cooee-item-detail",14),a()()}if(i&2){let t=e.$implicit,o=e.$index,n=s();d(2),S("background-image",t.thumbnail?"url("+t.thumbnail+")":null),d(),D(n.shouldShowVideoSpinner(o)?3:-1),d(),u("ngClass",n.viewTemplateClassName)("muted",!0),T("preload",n.isVideoVisible(o)?"metadata":"none")("data-video-id",t.id)("autoplay",null),d(2),L(t.sources),d(2),D(n.currentIndex===o?8:-1),d(),D(n.selectedItem&&n.currentIndex===o?9:-1)}}function Ge(i,e){i&1&&A(0)}function Qe(i,e){if(i&1){let t=C();l(0,"button",26),h("click",function(){p(t);let n=s();return m(n.close())}),w(1,"cooee-icon",27),a()}}var ke=class i{swiperComponent;videoElements;VideoConfigFooterContent=_e;currentIndex=0;muted=_(!1);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName="lc-video-only-view";shareDialogOpen=_(!1);data=v(ve);elementRef=v(K);eventData=v(P);dialogRef=v(he);swiperInitialized=_(!1);swiperOptions=_(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=k();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Ce,this.navigationConfig=new N({enabled:!0,size:50,color:new c({h:"#000000"})}),this.cssLoadedPromise=ue(this.elementRef.nativeElement.shadowRoot)}onKeyDown(e){e.preventDefault(),e.stopPropagation(),this.close()}async ngOnInit(){switch(this.muted.set(await U.get("muted",!1)),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(!1)}close(){let e=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:e?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(e=>e.nativeElement.pause())}toggleMute(){this.muted.update(e=>!e)}async muteToggled(){await U.set("muted",this.muted());let t=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(t)}playActiveVideo(e=!0){e&&this.pauseAll();let t=this.getCurrentVideoElement();t&&this.playVideo(t)}playVideo(e){e.currentTime=0,e.play().catch(t=>me.error(t))}onVideoEnded(e){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(e):this.moveToNextVideo();else{let t=this.getPreviousVideoDataForEvent(),o=["CE Last Video Ended",{previous:t},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),this.playVideo(e)}}onSlideChange(e){let t=this.getPreviousVideoDataForEvent();this.currentIndex=e.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let o=this.currentVideoProps(),n={previous:t,current:o},r=new j("CE Video Changed",n,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(e,t){let o={videoID:t.id,videoIndex:this.currentIndex},n=new j("CE More Item Info Clicked",{current:o},this.engagementTrigger);n.setVideos(t),window.CooeeSDK.sendEvent(n),this.selectedItem=e}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}shouldShowVideoSpinner(e){return this.swiperInitialized()?this.videoLoadingStates.get(e)===!0&&this.isVideoVisible(e):this.isVideoVisible(e)}isVideoVisible(e){let t=this.currentIndex-1,o=this.currentIndex+1;return e===this.currentIndex||e===t||e===o}async initSwiperOptions(){await this.cssLoadedPromise;let e=this.isMobile?1:"auto",t=0;this.isProductDetailView()&&(e="auto",t=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:e,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:t,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:o=>{this.swiperInitialized.set(!0),setTimeout(()=>{o.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.videoConfig.detailPopup.template==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let e=this.currentVideoProps(),t=this.videoElements.find(n=>n.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;e.playedTillMS=Math.ceil(t?.currentTime*1e3);let o=t?.duration*1e3;return e.playedTillPercent=+(e.playedTillMS/o).toFixed(4),e}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let e=this.calculateOptimalVideoDimensions();e&&this.setVideoContainerDimensions(e.width,e.height)}calculateOptimalVideoDimensions(){let e=this.videos.map(g=>g.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(e.length===0)return null;let t=e[0],o=window.innerWidth*.9,n=window.innerHeight*.9,r=o/t.width,f=n/t.height,b=Math.min(r,f);return{width:Math.floor(t.width*b),height:Math.floor(t.height*b)}}setVideoContainerDimensions(e,t){let o=this.elementRef.nativeElement;o.style.setProperty("--video-container-width",`${e}px`),o.style.setProperty("--video-container-height",`${t}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(t,o){if(t&1&&(F(ze,7),F($e,5)),t&2){let n;B(n=H())&&(o.swiperComponent=n.first),B(n=H())&&(o.videoElements=n)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(t,o){t&1&&h("keydown.escape",function(r){return o.onKeyDown(r)},Q)},decls:10,vars:4,consts:[["swiperComp",""],["closeButtonTemplate",""],["videoEl",""],[1,"lc-shadow-inner",3,"ngClass"],[1,"video-swiper",3,"slideChange","options","navigationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-slide"],[1,"lc-desktop-controls"],[4,"ngTemplateOutlet"],[1,"lc-video-modal-row"],[1,"lc-video-container"],[1,"video-loading-overlay"],["playsinline","",1,"lc-video-el",3,"click","ended","loadstart","canplay","ngClass","muted"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems","template"],[1,"loading-spinner"],[3,"video"],[1,"lc-video-controls"],[3,"mutedChange","toggled","muted","videoEl"],[1,"share-controls"],[3,"dialogState"],[1,"lc-card-container"],[3,"items"],[3,"card"],[3,"cardClick","items"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"closeClick","item","similarItems","template"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(t,o){if(t&1){let n=C();l(0,"div",3)(1,"cooee-swiper",4,0),h("slideChange",function(f){return p(n),m(o.onSlideChange(f))}),ee(3,5),$(4,Ke,10,10,"div",6,Y),te(),a(),l(6,"div",7),E(7,Ge,1,0,"ng-container",8),a()(),E(8,Qe,2,0,"ng-template",null,1,se)}if(t&2){let n=V(9);u("ngClass",o.viewTemplateClassName),d(),u("options",o.swiperOptions())("navigationConfig",o.navigationConfig),d(3),L(o.videos),d(3),u("ngTemplateOutlet",n)}},dependencies:[Ie,ye,Ve,z,R,pe,ce,De,xe,M],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}
|
|
2
|
+
`],encapsulation:3})};export{ke as VideoDetailDialogComponent};
|
package/dist/widget.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as yi,c as rt,d as ut,e as ie,f as Ci,g as se,h as xi,i as Vi,j as Si,k as Ii,m as ki,n as Fi,o as At,q as Di,r as Li,s as Ni,t as Bi,u as Hi}from"./chunk-TNST7VOR.js";import{c as ft,d as Ti,e as Ei,f as gt,g as Pi,h as Ai,i as Ri,l as Oi}from"./chunk-OS2E7UQC.js";import{a as ht}from"./chunk-KIK4KPM3.js";import{a as vi,b as _i,c as bi,d as wi,e as Qe,g as Ge,h as Mi}from"./chunk-PLMFOGWI.js";import{$ as z,$a as te,A as Kt,Aa as ve,B as Jt,Ba as j,Bb as W,Cb as hi,Da as y,E as fe,F as Yt,Ga as Ue,Ha as ze,I as Xt,Ia as qe,K as ce,L as He,La as de,Ma as nt,N as ei,O as V,P as ti,Pa as di,Q as ii,Qa as Z,Ra as ot,S as Ft,Sa as we,Wa as Re,X as U,Xa as ye,Ya as q,Z as ni,_ as oi,aa as ri,ab as We,b as zt,bb as pi,cb as Ce,da as ai,db as Ve,e as qt,eb as mi,fa as si,gb as ui,ha as it,ia as N,ib as fi,ja as B,k as Wt,kb as Dt,la as mt,ma as ge,na as he,oa as H,p as Zt,pa as M,qa as P,ra as ne,s as Qt,sa as je,sb as Ze,ta as $e,ua as Se,v as le,va as li,wa as ci,x as A,xb as gi,y as R,z as Gt,za as J}from"./chunk-BMEFEXWO.js";import"./chunk-ICI7BO4Q.js";import{a as be,b as Ut,e as Gi,f as Ki}from"./chunk-V7UGKYBN.js";var zi=Gi((vt,Ui)=>{"use strict";(function(n,e){typeof vt=="object"&&typeof Ui<"u"?e(vt):typeof define=="function"&&define.amd?define(["exports"],e):e((n=typeof globalThis<"u"?globalThis:n||self).Sqrl={})})(vt,function(n){"use strict";function e(s){var l,d,m=new Error(s);return l=m,d=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(l,d):l.__proto__=d,m}function t(s,l,d){var m=l.slice(0,d).split(/\n/),r=m.length,i=m[r-1].length+1;throw e(s+=" at line "+r+" col "+i+`:
|
|
2
2
|
|
|
3
3
|
`+l.split(/\n/)[r-1]+`
|
|
4
4
|
`+Array(i).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var o=new Function("return this")().Promise,a=!1;try{a=new Function("return (async function(){}).constructor")()}catch(s){if(!(s instanceof SyntaxError))throw s}function c(s,l){return Object.prototype.hasOwnProperty.call(s,l)}function u(s,l,d){for(var m in l)c(l,m)&&(l[m]==null||typeof l[m]!="object"||m!=="storage"&&m!=="prefixes"||d?s[m]=l[m]:s[m]=u({},l[m]));return s}var f=/^async +/,b=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,D=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,Y=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,Te=/[.*+\-?^${}()|[\]\\]/g;function Ee(s){return Te.test(s)?s.replace(Te,"\\$&"):s}function at(s,l){l.rmWhitespace&&(s=s.replace(/[\r\n]+/g,`
|
|
@@ -13,8 +13,8 @@ import{A as Bi,B as Hi,a as vi,b as yi,d as rt,e as ut,f as ie,g as Ci,h as se,i
|
|
|
13
13
|
`],encapsulation:3})};var bt=class n extends se{item;data=le(Ei);dialogRef=le(Ti);ItemDetailLayout=Si;constructor(){super(),this.triggerContext=this.data.triggerContext,this.item=this.data.item}close(){this.dialogRef.close()}engagementTriggerReceived(e){}update(){}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-item-quick-view"]],features:[te(ie()),z],decls:1,vars:2,consts:[[3,"closeClick","item","layout"]],template:function(t,o){t&1&&(M(0,"cooee-item-detail",0),j("closeClick",function(){return o.close()}),P()),t&2&&H("item",o.item)("layout",o.ItemDetailLayout.TWO_PANE)},dependencies:[Di],styles:[`:host{display:flex;align-items:center;justify-content:center;height:100%}@media (min-width: 768px){cooee-item-detail{max-width:900px;max-height:80vh;border-radius:var(--lc-card-radius)}}
|
|
14
14
|
`],encapsulation:3})};var wt=class n{dialog=le(gt);dialogRef;constructor(){}showItemQuickView(e,t){this.dialogRef=this.dialog.open(bt,{width:"100vw",height:"100dvh",backdropClass:["letscooee-backdrop"],data:{item:t,triggerContext:e}})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=Qt({token:n,factory:n.\u0275fac,providedIn:"root"})};var hn=(n,e)=>({enter:n,exit:e});function vn(n,e){if(n&1&&(M(0,"div",7),Z(1),P(),M(2,"div",8),Z(3),P()),n&2){let t=y(2);V(),we(" ",t.getCurrency(t.selectedVariant().price.cmp)," "),V(2),we(" ",t.getDiscountPercentage(t.selectedVariant().price),"% off ")}}function yn(n,e){if(n&1&&(M(0,"div",6),Z(1),P()),n&2){let t=y(2);V(),we(" ",t.stickyATCConfig.leftText," ")}}function Cn(n,e){if(n&1&&(M(0,"div",1)(1,"div",5),Z(2),P(),N(3,vn,4,2),N(4,yn,2,1,"div",6),P()),n&2){let t=y();V(2),we(" ",t.getCurrency(t.selectedVariant().price.d)," "),V(),B(t.selectedVariant().price.cmp?3:-1),V(),B(t.stickyATCConfig.leftText?4:-1)}}function xn(n,e){if(n&1&&(M(0,"div",9),Z(1),P()),n&2){let t=e.$implicit,o=e.$index;y(2);let a=q(5);H("ngClass",pi(2,hn,o===a.currentIndex,o===a.previousIndex)),V(),we(" ",t," ")}}function _n(n,e){if(n&1&&(M(0,"div",4),ge(1,xn,2,5,"div",9,mt),P()),n&2){y();let t=q(5);V(),he(t.features)}}var Vt=class n extends se{currentItem;stickyATCConfig;selectedVariant=fe(void 0);featureSlider=fe({features:[],currentIndex:0});constructor(){super()}onVariantChange(e){this.currentItem&&(this.currentItem.setSelectedVariantByID(e.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value))}engagementTriggerReceived(e){this.stickyATCConfig=e.stickyATCConfig??{},this.currentItem=e.items[0],this.selectedVariant.set(this.currentItem.vars[0]),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation()}update(){}getCurrency(e){return Qe(e)}getDiscountPercentage(e){return((e.cmp-e.d)/e.cmp*100).toFixed(0)}addToCart(){this.engagementService.executeCTA(rt.ADD_TO_CART,{item:this.currentItem})}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let e=this.stickyATCConfig.rightText.split(`
|
|
15
15
|
`),t=e.length===1?null:setInterval(()=>{this.featureSlider.update(o=>Ut(be({},o),{previousIndex:o.currentIndex,currentIndex:(o.currentIndex+1)%o.features.length}))},3e3);this.featureSlider.set({intervalRef:t,currentIndex:0,features:e})}replaceVariables(e){return e?Ke(e,this.currentItem.getTemplateVariables(),this.triggerContext):""}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-sticky-atc"]],hostBindings:function(t,o){t&1&&j("letscooee:variant-change",function(c){return o.onVariantChange(c)},ei)},features:[te(ie()),z],decls:7,vars:3,consts:[[1,"lc-wrapper"],[1,"lc-prices"],[1,"lc-button-wrapper"],["type","button",1,"lc-button","lc-button-atc",3,"click"],[1,"lc-features"],[1,"lc-sale-price"],[1,"lc-additional-text"],[1,"lc-compare-price"],[1,"lc-discount-label"],[1,"lc-feature",3,"ngClass"]],template:function(t,o){if(t&1){let a=J();M(0,"div",0),N(1,Cn,5,3,"div",1),M(2,"div",2)(3,"button",3),j("click",function(){return A(a),R(o.addToCart())}),Z(4,"Add To Cart"),P(),Re(5),N(6,_n,3,0,"div",4),P()()}if(t&2){V(),B(o.selectedVariant()&&o.stickyATCConfig.showProductInfo?1:-1),V(4);let a=ye(o.featureSlider());V(),B(a.features.length?6:-1)}},dependencies:[Ze],styles:[`:host{display:flex;justify-content:center;padding:10px;background-color:#fff;width:100%;box-shadow:4px 0 10px #0006;line-height:normal}.lc-wrapper{display:flex;justify-content:space-between;align-items:center;gap:8px;max-width:1100px;width:100%}.lc-prices{flex:1 1 100%;display:flex;flex-wrap:wrap;align-items:center;gap:6px}@media (min-width: 768px){.lc-prices{gap:8px}}.lc-sale-price{font-size:24px;font-weight:600}.lc-compare-price{font-size:18px;font-weight:600;color:red;text-decoration:line-through}.lc-discount-label{font-size:12px;font-weight:500;color:green}.lc-button-wrapper{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;align-items:center}.lc-button{background-color:#000;color:#fff;opacity:1;pointer-events:auto;border-radius:4px;min-width:150px;width:100%;padding:8px}.lc-additional-text,.lc-feature{font-size:12px;color:#666}.lc-features{position:relative;overflow:hidden;height:16px;text-align:center;width:100%}.lc-features .lc-feature{position:absolute;width:100%;opacity:0;transform:translateY(100%);transition:transform .5s ease,opacity .5s ease}.lc-features .lc-feature.enter{opacity:1;transform:translateY(0);z-index:2}.lc-features .lc-feature.exit{opacity:0;transform:translateY(-100%);z-index:1}
|
|
16
|
-
`],encapsulation:3})};var bn=["videoEl"];async function Wi(){return(await import("./video-detail-dialog.component-IHEL3AQ7.js")).VideoDetailDialogComponent}var Me=class n extends se{videoElements;videos;videoConfig;dialogRef=null;dialog=le(gt);isMobile=Mi();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Wi()}ngAfterViewInit(){this.checkAndOpenVideoFromUrl()}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect()}engagementTriggerReceived(e){this.videoConfig=e.content?.videoConfig,this.videos=this.videoConfig.videos}onMuteToggled(e,t){e||this.videoElements.forEach(o=>{o.nativeElement!==t&&(o.nativeElement.muted=!0,o.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,o,a,c){e?.stopPropagation(),e?.preventDefault();let u=t.items?.[0];if(this.sendTriggerClicked(t,u),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,o,c)}sendEvent(e,t,o,a){let c=new ft(e,t,this.engagementTrigger);c.setVideos(o),a&&(c.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(c)}onDialogClosed(){this.resumePlaylistVideos()}isVideoLoading(e){return this.videoLoadingStates.get(e)??!0}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}playVideo(e){e.play().catch(t=>{W.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(o=>{o.forEach(a=>{let c=a.target,u=c.dataset.videoId;u&&(a.isIntersecting?(this.visibleVideos.add(u),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(u),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(o=>{this.intersectionObserver?.observe(o.nativeElement)})},100)}handleVideoVisibilityChange(e,t){t?this.onVideoBecameVisible(e):e.pause()}onVideoBecameVisible(e){this.playVideo(e)}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(e=>{let t=e.nativeElement;t.paused||(this.pausedVideos.push(t),t.pause())})}resumePlaylistVideos(){this.pausedVideos.forEach(e=>{e.play().catch(()=>{})}),this.pausedVideos=[]}async checkAndOpenVideoFromUrl(){let e=Oi();if(!e||!this.videos)return;let t=Ri();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==Ai)return;let o=this.videos.findIndex(a=>a.shortID===+e);if(o!==-1){let a=this.videos[o];await _i.set("muted",!0),await this.openDialog(a,o)}}async openDialog(e,t,o){await yi();let a={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext,selectedItem:o};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let c=await Wi();this.dialogRef=this.dialog.open(c,{width:"100vw",height:"100vh",data:a,providers:Ci(this.triggerContext,{video:e,index:t}),disableClose:!0});let u={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:u},e),this.dialogRef.closed.subscribe(f=>{if(this.dialogRef=null,!f)return;let b=f.lastVideoDuration*1e3,D={videoID:f.lastVideo.id,videoIndex:f.lastVideoIndex,playedTillMS:b,playedTillPercent:b/f.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:D},f.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-abstract-video"]],viewQuery:function(t,o){if(t&1&&Ue(bn,5),t&2){let a;ze(a=qe())&&(o.videoElements=a)}},features:[z],decls:0,vars:0,template:function(t,o){},encapsulation:2})};var Pe=class n{video=Dt.required({alias:"cooeeVideoSources"});prioritySource=Dt("high");elementRef=le(Xt);constructor(){fi(()=>{this.updateSources()})}updateSources(){let e=this.elementRef.nativeElement,t=this.video(),o=this.prioritySource();e.querySelectorAll("source").forEach(c=>c.remove()),o==="best"?(this.addSource(t.bestSource),this.addSource(t.highSource),this.addSource(t.lowSource)):o==="low"?(this.addSource(t.lowSource),this.addSource(t.highSource),this.addSource(t.bestSource)):(this.addSource(t.highSource),this.addSource(t.bestSource),this.addSource(t.lowSource)),this.addSource(t.m3u8Source),e.load()}addSource(e){if(!e)return;let t=document.createElement("source");t.src=e.url,t.type=e.mimeType,this.elementRef.nativeElement.appendChild(t)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=ni({type:n,selectors:[["video","cooeeVideoSources",""]],inputs:{video:[1,"cooeeVideoSources","video"],prioritySource:[1,"prioritySource"]}})};var wn=(n,e)=>e.id;function Vn(n,e){if(n&1&&(ne(0,"div",1),Ce(1,"safeHtml")),n&2){let t=y();H("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function Tn(n,e){n&1&&(M(0,"div",6),ne(1,"div",12),P())}function En(n,e){if(n&1){let t=J();M(0,"cooee-mute-toggle",13),j("toggled",function(a){A(t),y();let c=de(6),u=y();return R(u.onMuteToggled(a,c))}),P()}if(n&2){y();let t=de(6);H("muted",t.muted)("videoEl",t)}}function Sn(n,e){if(n&1){let t=J();M(0,"cooee-video-promoted-items",16),j("cardClick",function(a){A(t);let c=y(2),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onItemCardClick(a,u,f,b))}),P()}if(n&2){let t=y(2).$implicit;H("items",t.items)("centeredSlides",!1)}}function In(n,e){if(n&1){let t=J();M(0,"cooee-item-card",17),j("buttonClick",function(){A(t);let a=y(2),c=a.$implicit,u=a.$index,f=de(6),b=y();return R(b.addToCartClicked(null,c,u,f))})("click",function(){A(t);let a=y(2),c=a.$implicit,u=a.$index,f=de(6),b=q(0),D=y();return R(D.onItemCardClick(b,c,u,f))}),P()}if(n&2){y(2);let t=q(0);H("item",t)}}function Mn(n,e){if(n&1&&N(0,Sn,1,2,"cooee-video-promoted-items",14)(1,In,1,1,"cooee-item-card",15),n&2){let t=y().$implicit,o=y(),c=q(2)===o.VideoConfigFooterContent.ITEM_SWIPER;B(c&&t.items.length>1?0:t.items.length?1:-1)}}function Pn(n,e){if(n&1){let t=J();M(0,"cooee-video-card",18),j("linkClicked",function(){A(t);let a=y().$implicit,c=y();return R(c.sendTriggerClicked(a))}),P()}if(n&2){y();let t=q(1);H("card",t)}}function kn(n,e){if(n&1){let t=J();Re(0)(1),M(2,"div",4)(3,"div",5),j("click",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onVideoTap(a,u,f,b))})("keydown.enter",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onVideoTap(a,u,f,b))})("keydown.space",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onVideoTap(a,u,f,b))}),N(4,Tn,2,0,"div",6),M(5,"video",7,0),j("mouseenter",function(){A(t);let a=de(6);y();let c=q(1);return R(c&&a.play())})("mouseleave",function(){A(t);let a=de(6);y();let c=q(1);return R(c&&a.pause())})("loadstart",function(){let a=A(t).$implicit,c=y();return R(c.onVideoLoadStart(a.id))})("canplay",function(){let a=A(t).$implicit,c=y();return R(c.onVideoCanPlay(a.id))}),P(),M(7,"div",8),N(8,En,1,2,"cooee-mute-toggle",9),P()(),M(9,"div",10),N(10,Mn,2,1)(11,Pn,1,1,"cooee-video-card",11),P()()}if(n&2){let t=e.$implicit,o=y(),a=q(0),c=q(2);ye(t.items[0]),V();let f=ye(t.card)&&c===o.VideoConfigFooterContent.CARD;V(2),nt("background-image",t.thumbnail?"url("+t.thumbnail+")":null),V(),B(o.isVideoLoading(t.id)?4:-1),V(),H("cooeeVideoSources",t)("muted",!0),it("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),V(3),B(o.videoConfig.showMuteButton?8:-1),V(2),B(o.videoConfig.showItems()?10:f?11:-1)}}var Tt=class n extends Me{VideoConfigFooterContent=At;VideoConfigAutoPlay=Fi;swiperOptions=null;constructor(){super(),this.hasSwiper=!0}ngAfterViewInit(){super.ngAfterViewInit();let e=this.videoConfig.playlistConfig.videoSwiper,t=e?(this.isMobile?e.gapSm:e.gap)+"px":window.cooeePlaylistGap??24,o=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:o,mousewheel:{enabled:!0,forceToAxis:!0},autoplay:e?.autoplay?.enabled?{delay:e?.autoplay?.delay,disableOnInteraction:!1}:!1},this.setupIntersectionObserver(),this.playFirstVideo()}ngOnDestroy(){super.ngOnDestroy()}addToCartClicked(e,t,o,a){let c=t.items?.[0],u=vi.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!u){this.onItemCardClick(c,t,o,a);return}this.engagementService.executeCTA(rt.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let o=t.items?.[0];this.engagementService.executeCTA(rt.GO_TO_PRODUCT,{item:o,video:t})}onItemCardClick(e,t,o,a){this.videoConfig.playlistConfig.itemCardClickBehavior==="OPEN_ITEM_DETAIL"?this.onVideoTap(null,t,o,a,e):this.onVideoTap(null,t,o,a)}update(){}onVideoBecameVisible(e){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(e):this.playVideo(e))}shouldAutoPlay(){return this.videoConfig.autoPlay==="ON"||this.videoConfig.autoPlay==="ON_HOVER"&&this.isMobile}playFirstVideo(){}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-video-playlist"]],features:[te(ie()),z],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(t,o){if(t&1&&(Re(0)(1)(2),N(3,Vn,2,3,"div",1),M(4,"cooee-swiper",2),li(5,3),ge(6,kn,12,12,"div",4,wn),ci(),P()),t&2){ye(!o.videoConfig.autoPlay||o.videoConfig.autoPlay===o.VideoConfigAutoPlay.ON),V(),ye(o.videoConfig.autoPlay===o.VideoConfigAutoPlay.ON_HOVER),V(),ye(o.videoConfig.footerContent),V(),B(o.videoConfig.heading?3:-1);let a=o.videoConfig.playlistConfig.videoSwiper;V(),H("options",o.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),V(2),he(o.videos)}},dependencies:[Bi,Ni,Li,ki,Pe,Hi,Ge],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)}
|
|
16
|
+
`],encapsulation:3})};var bn=["videoEl"];async function Wi(){return(await import("./video-detail-dialog.component-BHRF7YI3.js")).VideoDetailDialogComponent}var Me=class n extends se{videoElements;videos;videoConfig;dialogRef=null;dialog=le(gt);isMobile=Mi();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Wi()}ngAfterViewInit(){this.checkAndOpenVideoFromUrl()}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect()}engagementTriggerReceived(e){this.videoConfig=e.content?.videoConfig,this.videos=this.videoConfig.videos}onMuteToggled(e,t){e||this.videoElements.forEach(o=>{o.nativeElement!==t&&(o.nativeElement.muted=!0,o.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,o,a,c){e?.stopPropagation(),e?.preventDefault();let u=t.items?.[0];if(this.sendTriggerClicked(t,u),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,o,c)}sendEvent(e,t,o,a){let c=new ft(e,t,this.engagementTrigger);c.setVideos(o),a&&(c.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(c)}onDialogClosed(){this.resumePlaylistVideos()}isVideoLoading(e){return this.videoLoadingStates.get(e)??!0}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}playVideo(e){e.play().catch(t=>{W.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(o=>{o.forEach(a=>{let c=a.target,u=c.dataset.videoId;u&&(a.isIntersecting?(this.visibleVideos.add(u),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(u),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(o=>{this.intersectionObserver?.observe(o.nativeElement)})},100)}handleVideoVisibilityChange(e,t){t?this.onVideoBecameVisible(e):e.pause()}onVideoBecameVisible(e){this.playVideo(e)}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(e=>{let t=e.nativeElement;t.paused||(this.pausedVideos.push(t),t.pause())})}resumePlaylistVideos(){this.pausedVideos.forEach(e=>{e.play().catch(()=>{})}),this.pausedVideos=[]}async checkAndOpenVideoFromUrl(){let e=Oi();if(!e||!this.videos)return;let t=Ri();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==Ai)return;let o=this.videos.findIndex(a=>a.shortID===+e);if(o!==-1){let a=this.videos[o];await _i.set("muted",!0),await this.openDialog(a,o)}}async openDialog(e,t,o){await yi();let a={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext,selectedItem:o};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let c=await Wi();this.dialogRef=this.dialog.open(c,{width:"100vw",height:"100vh",data:a,providers:Ci(this.triggerContext,{video:e,index:t}),disableClose:!0});let u={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:u},e),this.dialogRef.closed.subscribe(f=>{if(this.dialogRef=null,!f)return;let b=f.lastVideoDuration*1e3,D={videoID:f.lastVideo.id,videoIndex:f.lastVideoIndex,playedTillMS:b,playedTillPercent:b/f.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:D},f.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-abstract-video"]],viewQuery:function(t,o){if(t&1&&Ue(bn,5),t&2){let a;ze(a=qe())&&(o.videoElements=a)}},features:[z],decls:0,vars:0,template:function(t,o){},encapsulation:2})};var Pe=class n{video=Dt.required({alias:"cooeeVideoSources"});prioritySource=Dt("high");elementRef=le(Xt);constructor(){fi(()=>{this.updateSources()})}updateSources(){let e=this.elementRef.nativeElement,t=this.video(),o=this.prioritySource();e.querySelectorAll("source").forEach(c=>c.remove()),o==="best"?(this.addSource(t.bestSource),this.addSource(t.highSource),this.addSource(t.lowSource)):o==="low"?(this.addSource(t.lowSource),this.addSource(t.highSource),this.addSource(t.bestSource)):(this.addSource(t.highSource),this.addSource(t.bestSource),this.addSource(t.lowSource)),this.addSource(t.m3u8Source),e.load()}addSource(e){if(!e)return;let t=document.createElement("source");t.src=e.url,t.type=e.mimeType,this.elementRef.nativeElement.appendChild(t)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=ni({type:n,selectors:[["video","cooeeVideoSources",""]],inputs:{video:[1,"cooeeVideoSources","video"],prioritySource:[1,"prioritySource"]}})};var wn=(n,e)=>e.id;function Vn(n,e){if(n&1&&(ne(0,"div",1),Ce(1,"safeHtml")),n&2){let t=y();H("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function Tn(n,e){n&1&&(M(0,"div",6),ne(1,"div",12),P())}function En(n,e){if(n&1){let t=J();M(0,"cooee-mute-toggle",13),j("toggled",function(a){A(t),y();let c=de(6),u=y();return R(u.onMuteToggled(a,c))}),P()}if(n&2){y();let t=de(6);H("muted",t.muted)("videoEl",t)}}function Sn(n,e){if(n&1){let t=J();M(0,"cooee-video-promoted-items",16),j("cardClick",function(a){A(t);let c=y(2),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onItemCardClick(a,u,f,b))}),P()}if(n&2){let t=y(2).$implicit;H("items",t.items)("centeredSlides",!1)}}function In(n,e){if(n&1){let t=J();M(0,"cooee-item-card",17),j("buttonClick",function(){A(t);let a=y(2),c=a.$implicit,u=a.$index,f=de(6),b=y();return R(b.addToCartClicked(null,c,u,f))})("click",function(){A(t);let a=y(2),c=a.$implicit,u=a.$index,f=de(6),b=q(0),D=y();return R(D.onItemCardClick(b,c,u,f))}),P()}if(n&2){y(2);let t=q(0);H("item",t)}}function Mn(n,e){if(n&1&&N(0,Sn,1,2,"cooee-video-promoted-items",14)(1,In,1,1,"cooee-item-card",15),n&2){let t=y().$implicit,o=y(),c=q(2)===o.VideoConfigFooterContent.ITEM_SWIPER;B(c&&t.items.length>1?0:t.items.length?1:-1)}}function Pn(n,e){if(n&1){let t=J();M(0,"cooee-video-card",18),j("linkClicked",function(){A(t);let a=y().$implicit,c=y();return R(c.sendTriggerClicked(a))}),P()}if(n&2){y();let t=q(1);H("card",t)}}function kn(n,e){if(n&1){let t=J();Re(0)(1),M(2,"div",4)(3,"div",5),j("click",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onVideoTap(a,u,f,b))})("keydown.enter",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onVideoTap(a,u,f,b))})("keydown.space",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=de(6),D=y();return R(D.onVideoTap(a,u,f,b))}),N(4,Tn,2,0,"div",6),M(5,"video",7,0),j("mouseenter",function(){A(t);let a=de(6);y();let c=q(1);return R(c&&a.play())})("mouseleave",function(){A(t);let a=de(6);y();let c=q(1);return R(c&&a.pause())})("loadstart",function(){let a=A(t).$implicit,c=y();return R(c.onVideoLoadStart(a.id))})("canplay",function(){let a=A(t).$implicit,c=y();return R(c.onVideoCanPlay(a.id))}),P(),M(7,"div",8),N(8,En,1,2,"cooee-mute-toggle",9),P()(),M(9,"div",10),N(10,Mn,2,1)(11,Pn,1,1,"cooee-video-card",11),P()()}if(n&2){let t=e.$implicit,o=y(),a=q(0),c=q(2);ye(t.items[0]),V();let f=ye(t.card)&&c===o.VideoConfigFooterContent.CARD;V(2),nt("background-image",t.thumbnail?"url("+t.thumbnail+")":null),V(),B(o.isVideoLoading(t.id)?4:-1),V(),H("cooeeVideoSources",t)("muted",!0),it("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),V(3),B(o.videoConfig.showMuteButton?8:-1),V(2),B(o.videoConfig.showItems()?10:f?11:-1)}}var Tt=class n extends Me{VideoConfigFooterContent=At;VideoConfigAutoPlay=Fi;swiperOptions=null;constructor(){super(),this.hasSwiper=!0}ngAfterViewInit(){super.ngAfterViewInit();let e=this.videoConfig.playlistConfig.videoSwiper,t=e?(this.isMobile?e.gapSm:e.gap)+"px":window.cooeePlaylistGap??24,o=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:o,mousewheel:{enabled:!0,forceToAxis:!0},autoplay:e?.autoplay?.enabled?{delay:e?.autoplay?.delay,disableOnInteraction:!1}:!1},this.setupIntersectionObserver(),this.playFirstVideo()}ngOnDestroy(){super.ngOnDestroy()}addToCartClicked(e,t,o,a){let c=t.items?.[0],u=vi.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!u){this.onItemCardClick(c,t,o,a);return}this.engagementService.executeCTA(rt.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let o=t.items?.[0];this.engagementService.executeCTA(rt.GO_TO_PRODUCT,{item:o,video:t})}onItemCardClick(e,t,o,a){this.videoConfig.playlistConfig.itemCardClickBehavior==="OPEN_ITEM_DETAIL"?this.onVideoTap(null,t,o,a,e):this.onVideoTap(null,t,o,a)}update(){}onVideoBecameVisible(e){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(e):this.playVideo(e))}shouldAutoPlay(){return this.videoConfig.autoPlay==="ON"||this.videoConfig.autoPlay==="ON_HOVER"&&this.isMobile}playFirstVideo(){}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-video-playlist"]],features:[te(ie()),z],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(t,o){if(t&1&&(Re(0)(1)(2),N(3,Vn,2,3,"div",1),M(4,"cooee-swiper",2),li(5,3),ge(6,kn,12,12,"div",4,wn),ci(),P()),t&2){ye(!o.videoConfig.autoPlay||o.videoConfig.autoPlay===o.VideoConfigAutoPlay.ON),V(),ye(o.videoConfig.autoPlay===o.VideoConfigAutoPlay.ON_HOVER),V(),ye(o.videoConfig.footerContent),V(),B(o.videoConfig.heading?3:-1);let a=o.videoConfig.playlistConfig.videoSwiper;V(),H("options",o.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),V(2),he(o.videos)}},dependencies:[Bi,Ni,Li,ki,Pe,Hi,Ge],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)}
|
|
17
17
|
`],encapsulation:3})};var Fn=["videoElement"],Dn=n=>({"cursor-grab":n}),Et=class n extends Me{videoElement;video;isDragging=!1;hidden=!1;cdkDrag=le(ht,{self:!0});untilDestroyed=Ii();constructor(){super()}get popupClasses(){return this.hidden?["hidden"]:["visible"]}onClick(e){e.stopPropagation(),e.preventDefault(),this.onVideoClick()}ngOnInit(){super.ngOnInit();let e=this.elementRef.nativeElement.closest(".letscooee-engagement");e&&(e.style.zIndex="10000"),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=!0)}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay()},100)}onVideoClick(){if(this.isDragging){this.isDragging=!1;return}this.hidden=!0,this.onVideoTap(null,this.video,0)}close(){this.hidden=!0;let e=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent("CE Trigger Closed",{duration:e})}engagementTriggerReceived(e){super.engagementTriggerReceived(e),this.video=this.videos[0]}update(){}onDialogClosed(){this.hidden=!1}autoPlay(){let e=this.videoElement.nativeElement;this.hidden||this.playVideo(e)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-video-popup"]],viewQuery:function(t,o){if(t&1&&Ue(Fn,5),t&2){let a;ze(a=qe())&&(o.videoElement=a.first)}},hostAttrs:["role","button","tabindex","0","aria-label","Open video popup "],hostVars:3,hostBindings:function(t,o){t&1&&j("keydown.enter",function(c){return o.onClick(c)})("keydown.space",function(c){return o.onClick(c)})("click",function(c){return o.onClick(c)}),t&2&&(ve("cdkDragBoundary","body"),di(o.popupClasses))},features:[te(ie()),ri([{directive:ht,inputs:["cdkDragBoundary","cdkDragBoundary"]}]),z],decls:9,vars:5,consts:[["videoElement",""],[1,"popup-inner",3,"ngClass"],["type","button","aria-label","Close video popup",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"play-button"],["name","unmute","aria-hidden","true"],[1,"text"],["loop","","preload","metadata","playsinline","",3,"muted","cooeeVideoSources"]],template:function(t,o){if(t&1){let a=J();M(0,"div",1)(1,"button",2),j("click",function(u){return A(a),u.stopPropagation(),R(o.close())}),ne(2,"cooee-icon",3),P(),M(3,"div",4),ne(4,"cooee-icon",5),M(5,"div",6),Z(6,"Tap to unmute"),P()(),ne(7,"video",7,0),P()}t&2&&(H("ngClass",We(3,Dn,o.isDragging)),V(7),H("muted",!0)("cooeeVideoSources",o.video))},dependencies:[Ze,Pi,Pe],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}
|
|
18
18
|
`],encapsulation:3})};var An=(n,e)=>e.id;function Rn(n,e){if(n&1&&(ne(0,"div",1),Ce(1,"safeHtml")),n&2){let t=y();H("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function On(n,e){n&1&&(M(0,"div",9),ne(1,"div",11),P())}function Ln(n,e){if(n&1){let t=J();M(0,"div",4),j("click",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=y();return R(b.onVideoTap(a,u,f))})("keydown.enter",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=y();return R(b.onVideoTap(a,u,f))})("keydown.space",function(a){let c=A(t),u=c.$implicit,f=c.$index,b=y();return R(b.onVideoTap(a,u,f))}),Gt(),M(1,"svg",5),ne(2,"circle",6)(3,"circle",7),P(),Kt(),M(4,"div",8),N(5,On,2,0,"div",9),M(6,"video",10,0),j("loadstart",function(){let a=A(t).$implicit,c=y();return R(c.onVideoLoadStart(a.id))})("canplay",function(){let a=A(t).$implicit,c=y();return R(c.onVideoCanPlay(a.id))}),P()()()}if(n&2){let t=e.$implicit,o=e.$index,a=y();it("aria-label","Open video story "+(o+1)),V(5),B(a.isVideoLoading(t.id)?5:-1),V(),H("poster",t.thumbnail,He)("cooeeVideoSources",t)("prioritySource","low")("muted",!0),it("data-video-id",t.id)}}var St=class n extends Me{constructor(){super()}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver()}ngOnDestroy(){super.ngOnDestroy()}update(){}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-video-stories"]],features:[te(ie()),z],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,"loading-spinner"]],template:function(t,o){t&1&&(N(0,Rn,2,3,"div",1),M(1,"div",2),ge(2,Ln,8,7,"div",3,An),P()),t&2&&(B(o.videoConfig.heading?0:-1),V(2),he(o.videos))},dependencies:[Pe,Ge],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;height:5rem;cursor:pointer;flex-shrink:0}.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}
|
|
19
19
|
`],encapsulation:3})};var jt=(t=>(t.IMAGE="IMAGE",t.BUTTON="BUTTON",t))(jt||{});var $t=n=>({active:n});function Nn(n,e){if(n&1&&(M(0,"span",4),Z(1),P()),n&2){let t=y(2);V(),ot(t.collectionFilterConfig.subtitle)}}function Bn(n,e){if(n&1&&(M(0,"div",1)(1,"span",3),Z(2),P(),N(3,Nn,2,1,"span",4),P()),n&2){let t=y();V(2),ot(t.collectionFilterConfig.title),V(),B(t.collectionFilterConfig.subtitle?3:-1)}}function Hn(n,e){if(n&1&&(M(0,"span",9),Z(1),P()),n&2){let t=y(2).$implicit,o=q(0);H("ngClass",We(2,$t,o)),V(),we("",t.label," ")}}function jn(n,e){if(n&1){let t=J();M(0,"div",7),j("mousedown",function(){A(t);let a=y().$implicit,c=q(0),u=y(2);return R(u.filterClick(a,c))}),ne(1,"img",8),N(2,Hn,2,4,"span",9),P()}if(n&2){let t=y().$implicit,o=q(0);V(),H("src",t.imageSrc,He)("ngClass",We(3,$t,o)),V(),B(t.label?2:-1)}}function $n(n,e){if(n&1){let t=J();M(0,"button",10),j("click",function(){A(t);let a=y().$implicit,c=q(0),u=y(2);return R(u.filterClick(a,c))}),Z(1),P()}if(n&2){let t=y().$implicit,o=q(0);H("ngClass",We(2,$t,o)),V(),we("",t.label," ")}}function Un(n,e){if(n&1&&(Re(0),N(1,jn,3,5,"div",5)(2,$n,2,4,"button",6)),n&2){let t=e.$implicit,o=y(2);ye(t.value===o.currentActiveParams()[t.key]),V(),B(o.collectionFilterConfig.template===o.CollectionFilterTemplate.IMAGE?1:o.collectionFilterConfig.template===o.CollectionFilterTemplate.BUTTON?2:-1)}}function zn(n,e){if(n&1&&ge(0,Un,3,2,null,null,mt),n&2){let t=y();he(t.collectionFilterConfig.options)}}var It=class n extends se{currentActiveParams=fe({});collectionFilterConfig;CollectionFilterTemplate=jt;originalPushState;constructor(){super(),this.attachedURLStateChecker()}engagementTriggerReceived(e){this.collectionFilterConfig=e.content.collectionFilterConfig}update(){}ngOnDestroy(){this.originalPushState&&(window.history.pushState=this.originalPushState)}filterClick(e,t=!1){let o=new URL(window.location.href),a=t?"removed":"applied";if(t?o.searchParams.delete(e.key):o.searchParams.set(e.key,e.value),this.collectionFilterConfig.refreshPage){this.sendEvent(e,a),window.location.href=o.href;return}window.history.replaceState({path:o.href},"",o),this.sendEvent(e,a),this.checkAndUpdateParams()}sendEvent(e,t){let o=new ft("CE Trigger Clicked",{filterApplication:t,filter:{key:e.key,value:e.value}},this.engagementTrigger);window.CooeeSDK.sendEvent(o)}attachedURLStateChecker(){this.checkAndUpdateParams(),this.originalPushState=window.history.pushState,window.history.pushState=new Proxy(window.history.pushState,{apply:(e,t,o)=>{e.apply(t,o),this.checkAndUpdateParams()}})}checkAndUpdateParams(){let e=new URL(window.location.href),t={};e.searchParams.forEach((o,a)=>{t[a]=o}),this.currentActiveParams.set(t)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["cooee-collection-filter"]],features:[te(ie()),z],decls:4,vars:2,consts:[[1,"wrapper"],[1,"filter-title-container"],[1,"options-container"],[1,"filter-title"],[1,"filter-subtitle"],[1,"image-filter-wrapper"],["type","button",1,"filter-button",3,"ngClass"],[1,"image-filter-wrapper",3,"mousedown"],["alt","collection filter image",1,"filter-image",3,"src","ngClass"],[1,"filter-label",3,"ngClass"],["type","button",1,"filter-button",3,"click","ngClass"]],template:function(t,o){t&1&&(M(0,"div",0),N(1,Bn,4,2,"div",1),M(2,"div",2),N(3,zn,2,0),P()()),t&2&&(V(),B(o.collectionFilterConfig.title?1:-1),V(2),B(o.collectionFilterConfig.options.length?3:-1))},dependencies:[Ze],styles:[`.wrapper{display:flex;flex-direction:column;gap:10px;padding:10px;justify-content:center;align-items:center}.filter-title-container{display:flex;flex-direction:column;gap:5px;align-items:center}.filter-title-container .filter-title{color:rgba(var(--lc-heading-color));font-family:var(--lc-heading-family),serif;font-weight:var(--lc-heading-weight);font-size:var(--lc-heading-size);transform:var(--lc-heading-transform);letter-spacing:var(--lc-heading-letter-spacing);text-align:var(--lc-heading-align)}.filter-title-container .filter-subtitle{color:rgba(var(--lc-subheading-color));font-weight:var(--lc-subheading-weight);font-size:var(--lc-subheading-size)}.options-container{display:flex;gap:35px;align-items:center;flex-wrap:wrap;justify-content:center}.options-container .image-filter-wrapper{display:flex;gap:10px;flex-direction:column;align-items:center;cursor:pointer}.options-container .image-filter-wrapper .filter-image{width:var(--lc-image-width, 80px);height:var(--lc-image-height, 80px);border-radius:40px}.options-container .image-filter-wrapper .filter-image.active{border:2px solid rgba(var(--lc-primary-color));padding:2px}.options-container .image-filter-wrapper .filter-label{font-size:var(--lc-text-size, 14px);color:rgba(var(--lc-text-color));font-weight:var(--lc-text-weight)}.options-container .image-filter-wrapper .filter-label.active{color:rgba(var(--lc-primary-color))}.options-container .filter-button{background-color:rgba(var(--lc-secondary-button-bg-color));font-size:var(--lc-button-size, 14px);color:rgba(var(--lc-secondary-button-color));border-color:rgba(var(--lc-secondary-button-border-color));font-weight:var(--lc-secondary-button-weight);border-radius:var(--lc-button-radius);font-family:var(--lc-button-family),serif;height:var(--lc-button-height, 36px);padding:0 16px}.options-container .filter-button:hover,.options-container .filter-button.active{background-color:rgba(var(--lc-primary-button-bg-color));color:rgba(var(--lc-primary-button-color));border-color:rgba(var(--lc-primary-button-border-color));font-weight:var(--lc-primary-button-weight)}
|
|
20
|
-
`],encapsulation:3})};hi("CooeeWidgetSDK");(async()=>{let n=await gi($i),e=(t,o)=>{let a=ji(t,{injector:n.injector});customElements.define(o,a)};e(Vt,"cooee-sticky-atc"),e(_t,"cooee-savings-bar"),e(xt,"cooee-progressbar"),e(Tt,"cooee-video-playlist"),e(Et,"cooee-video-popup"),e(St,"cooee-video-stories"),e(xi,"cooee-product-options-picker"),e(It,"cooee-collection-filter"),sessionStorage.cooeeDebug&&import("./debugger.component-
|
|
20
|
+
`],encapsulation:3})};hi("CooeeWidgetSDK");(async()=>{let n=await gi($i),e=(t,o)=>{let a=ji(t,{injector:n.injector});customElements.define(o,a)};e(Vt,"cooee-sticky-atc"),e(_t,"cooee-savings-bar"),e(xt,"cooee-progressbar"),e(Tt,"cooee-video-playlist"),e(Et,"cooee-video-popup"),e(St,"cooee-video-stories"),e(xi,"cooee-product-options-picker"),e(It,"cooee-collection-filter"),sessionStorage.cooeeDebug&&import("./debugger.component-L6TPXBHJ.js").then(t=>{e(t.DebuggerComponent,"cooee-debugger")}),window.cooeeShowQuickItem=(t,o)=>{n.injector.get(wt).showItemQuickView(t,o)}})();
|
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": "13.1.
|
|
4
|
+
"version": "13.1.6",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "ng lint",
|
|
7
7
|
"integrity": "./scripts/validate-integrity.sh",
|