@letscooee/web-sdk 11.5.2 → 11.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{a as Us,b as zt,c as he,e as Cn,f as tr,g as Bs,h as Hs,l as rr}from"./chunk-C4QGUG65.js";import{a as nr}from"./chunk-74XS3G6Q.js";import{$ as pi,$a as En,Aa as gt,Ba as ke,Ca as vn,Da as B,E as Ht,Ea as Os,Fa as Rs,I as gn,K as Dt,L as mt,La as rt,Na as yn,O as N,Oa as Jn,Pa as Qn,Qa as ee,Ra as _t,Sa as Wt,Wa as je,X as Ee,Xa as We,Y as fi,Ya as be,Za as Ms,_ as Ds,_a as Ps,ab as Zn,ba as ht,bb as er,ca as _n,cb as Ue,db as Be,fb as bn,ga as Gt,ha as Q,hb as wt,ia as Z,ib as At,jb as vt,ka as $t,kb as Se,la as jt,ma as oe,mb as Sn,na as W,oa as z,pa as Me,qa as pe,ra as ge,s as li,sa as tt,sb as Ls,t as di,tb as Fs,u as xs,ub as Vs,v as Re,va as nt,wa as ws,wb as ks,x as Ie,xa as As,y as Te,ya as Ns,za as $e}from"./chunk-KHVPWQ5E.js";import{a as _,b as F,c as hn,d as Ts,e as Nl,f as Ol,g as Xn}from"./chunk-V7UGKYBN.js";var Js=Nl((Xs,gi)=>{"use strict";(function(e){if(typeof Xs=="object"&&typeof gi<"u")gi.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,n;return(function r(i,o,s){function u(y,p){if(!o[y]){if(!i[y]){var E=typeof hn=="function"&&hn;if(!p&&E)return E(y,!0);if(l)return l(y,!0);var v=new Error("Cannot find module '"+y+"'");throw v.code="MODULE_NOT_FOUND",v}var A=o[y]={exports:{}};i[y][0].call(A.exports,function(U){var M=i[y][1][U];return u(M||U)},A,A.exports,r,i,o,s)}return o[y].exports}for(var l=typeof hn=="function"&&hn,h=0;h<s.length;h++)u(s[h]);return u})({1:[function(r,i,o){(function(s){"use strict";var u=s.MutationObserver||s.WebKitMutationObserver,l;if(u){var h=0,y=new u(U),p=s.document.createTextNode("");y.observe(p,{characterData:!0}),l=function(){p.data=h=++h%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=U,l=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var O=s.document.createElement("script");O.onreadystatechange=function(){U(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},s.document.documentElement.appendChild(O)}:l=function(){setTimeout(U,0)};var v,A=[];function U(){v=!0;for(var O,V,X=A.length;X;){for(V=A,A=[],O=-1;++O<X;)V[O]();X=A.length}v=!1}i.exports=M;function M(O){A.push(O)===1&&!v&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,i,o){"use strict";var s=r(1);function u(){}var l={},h=["REJECTED"],y=["FULFILLED"],p=["PENDING"];i.exports=E;function E(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=p,this.queue=[],this.outcome=void 0,x!==u&&M(this,x)}E.prototype.catch=function(x){return this.then(null,x)},E.prototype.then=function(x,H){if(typeof x!="function"&&this.state===y||typeof H!="function"&&this.state===h)return this;var L=new this.constructor(u);if(this.state!==p){var G=this.state===y?x:H;A(L,G,this.outcome)}else this.queue.push(new v(L,x,H));return L};function v(x,H,L){this.promise=x,typeof H=="function"&&(this.onFulfilled=H,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}v.prototype.callFulfilled=function(x){l.resolve(this.promise,x)},v.prototype.otherCallFulfilled=function(x){A(this.promise,this.onFulfilled,x)},v.prototype.callRejected=function(x){l.reject(this.promise,x)},v.prototype.otherCallRejected=function(x){A(this.promise,this.onRejected,x)};function A(x,H,L){s(function(){var G;try{G=H(L)}catch(ne){return l.reject(x,ne)}G===x?l.reject(x,new TypeError("Cannot resolve promise with itself")):l.resolve(x,G)})}l.resolve=function(x,H){var L=O(U,H);if(L.status==="error")return l.reject(x,L.value);var G=L.value;if(G)M(x,G);else{x.state=y,x.outcome=H;for(var ne=-1,J=x.queue.length;++ne<J;)x.queue[ne].callFulfilled(H)}return x},l.reject=function(x,H){x.state=h,x.outcome=H;for(var L=-1,G=x.queue.length;++L<G;)x.queue[L].callRejected(H);return x};function U(x){var H=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof H=="function")return function(){H.apply(x,arguments)}}function M(x,H){var L=!1;function G(Ne){L||(L=!0,l.reject(x,Ne))}function ne(Ne){L||(L=!0,l.resolve(x,Ne))}function J(){H(ne,G)}var de=O(J);de.status==="error"&&G(de.value)}function O(x,H){var L={};try{L.value=x(H),L.status="success"}catch(G){L.status="error",L.value=G}return L}E.resolve=V;function V(x){return x instanceof this?x:l.resolve(new this(u),x)}E.reject=X;function X(x){var H=new this(u);return l.reject(H,x)}E.all=we;function we(x){var H=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=x.length,G=!1;if(!L)return this.resolve([]);for(var ne=new Array(L),J=0,de=-1,Ne=new this(u);++de<L;)Ze(x[de],de);return Ne;function Ze(fn,Yn){H.resolve(fn).then(ei,function(Ut){G||(G=!0,l.reject(Ne,Ut))});function ei(Ut){ne[Yn]=Ut,++J===L&&!G&&(G=!0,l.resolve(Ne,ne))}}}E.race=Ae;function Ae(x){var H=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=x.length,G=!1;if(!L)return this.resolve([]);for(var ne=-1,J=new this(u);++ne<L;)de(x[ne]);return J;function de(Ne){H.resolve(Ne).then(function(Ze){G||(G=!0,l.resolve(J,Ze))},function(Ze){G||(G=!0,l.reject(J,Ze))})}}},{1:1}],3:[function(r,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function u(a,d){if(!(a instanceof d))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 h=l();function y(){try{if(!h||!h.open)return!1;var a=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),d=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!a||d)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function p(a,d){a=a||[],d=d||{};try{return new Blob(a,d)}catch(f){if(f.name!=="TypeError")throw f;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,m=new c,g=0;g<a.length;g+=1)m.append(a[g]);return m.getBlob(d.type)}}typeof Promise>"u"&&r(3);var E=Promise;function v(a,d){d&&a.then(function(c){d(null,c)},function(c){d(c)})}function A(a,d,c){typeof d=="function"&&a.then(d),typeof c=="function"&&a.catch(c)}function U(a){return typeof a!="string"&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}function M(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",V=void 0,X={},we=Object.prototype.toString,Ae="readonly",x="readwrite";function H(a){for(var d=a.length,c=new ArrayBuffer(d),m=new Uint8Array(c),g=0;g<d;g++)m[g]=a.charCodeAt(g);return c}function L(a){return new E(function(d){var c=a.transaction(O,x),m=p([""]);c.objectStore(O).put(m,"key"),c.onabort=function(g){g.preventDefault(),g.stopPropagation(),d(!1)},c.oncomplete=function(){var g=navigator.userAgent.match(/Chrome\/(\d+)/),f=navigator.userAgent.match(/Edge\//);d(f||!g||parseInt(g[1],10)>=43)}}).catch(function(){return!1})}function G(a){return typeof V=="boolean"?E.resolve(V):L(a).then(function(d){return V=d,V})}function ne(a){var d=X[a.name],c={};c.promise=new E(function(m,g){c.resolve=m,c.reject=g}),d.deferredOperations.push(c),d.dbReady?d.dbReady=d.dbReady.then(function(){return c.promise}):d.dbReady=c.promise}function J(a){var d=X[a.name],c=d.deferredOperations.pop();if(c)return c.resolve(),c.promise}function de(a,d){var c=X[a.name],m=c.deferredOperations.pop();if(m)return m.reject(d),m.promise}function Ne(a,d){return new E(function(c,m){if(X[a.name]=X[a.name]||os(),a.db)if(d)ne(a),a.db.close();else return c(a.db);var g=[a.name];d&&g.push(a.version);var f=h.open.apply(h,g);d&&(f.onupgradeneeded=function(b){var S=f.result;try{S.createObjectStore(a.storeName),b.oldVersion<=1&&S.createObjectStore(O)}catch(C){if(C.name==="ConstraintError")console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.');else throw C}}),f.onerror=function(b){b.preventDefault(),m(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(S){S.target.close()},c(b),J(a)}})}function Ze(a){return Ne(a,!1)}function fn(a){return Ne(a,!0)}function Yn(a,d){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),m=a.version<a.db.version,g=a.version>a.db.version;if(m&&(a.version!==d&&console.warn('The database "'+a.name+`" can't be downgraded from version `+a.db.version+" to version "+a.version+"."),a.version=a.db.version),g||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function ei(a){return new E(function(d,c){var m=new FileReader;m.onerror=c,m.onloadend=function(g){var f=btoa(g.target.result||"");d({__local_forage_encoded_blob:!0,data:f,type:a.type})},m.readAsBinaryString(a)})}function Ut(a){var d=H(atob(a.data));return p([d],{type:a.type})}function is(a){return a&&a.__local_forage_encoded_blob}function Ou(a){var d=this,c=d._initReady().then(function(){var m=X[d._dbInfo.name];if(m&&m.dbReady)return m.dbReady});return A(c,a,a),c}function Ru(a){ne(a);for(var d=X[a.name],c=d.forages,m=0;m<c.length;m++){var g=c[m];g._dbInfo.db&&(g._dbInfo.db.close(),g._dbInfo.db=null)}return a.db=null,Ze(a).then(function(f){return a.db=f,Yn(a)?fn(a):f}).then(function(f){a.db=d.db=f;for(var b=0;b<c.length;b++)c[b]._dbInfo.db=f}).catch(function(f){throw de(a,f),f})}function et(a,d,c,m){m===void 0&&(m=1);try{var g=a.db.transaction(a.storeName,d);c(null,g)}catch(f){if(m>0&&(!a.db||f.name==="InvalidStateError"||f.name==="NotFoundError"))return E.resolve().then(function(){if(!a.db||f.name==="NotFoundError"&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),fn(a)}).then(function(){return Ru(a).then(function(){et(a,d,c,m-1)})}).catch(c);c(f)}}function os(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Mu(a){var d=this,c={db:null};if(a)for(var m in a)c[m]=a[m];var g=X[c.name];g||(g=os(),X[c.name]=g),g.forages.push(d),d._initReady||(d._initReady=d.ready,d.ready=Ou);var f=[];function b(){return E.resolve()}for(var S=0;S<g.forages.length;S++){var C=g.forages[S];C!==d&&f.push(C._initReady().catch(b))}var I=g.forages.slice(0);return E.all(f).then(function(){return c.db=g.db,Ze(c)}).then(function(T){return c.db=T,Yn(c,d._defaultConfig.version)?fn(c):T}).then(function(T){c.db=g.db=T,d._dbInfo=c;for(var w=0;w<I.length;w++){var k=I[w];k!==d&&(k._dbInfo.db=c.db,k._dbInfo.version=c.version)}})}function Pu(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){et(c._dbInfo,Ae,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=C.get(a);I.onsuccess=function(){var T=I.result;T===void 0&&(T=null),is(T)&&(T=Ut(T)),g(T)},I.onerror=function(){f(I.error)}}catch(T){f(T)}})}).catch(f)});return v(m,d),m}function Lu(a,d){var c=this,m=new E(function(g,f){c.ready().then(function(){et(c._dbInfo,Ae,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=C.openCursor(),T=1;I.onsuccess=function(){var w=I.result;if(w){var k=w.value;is(k)&&(k=Ut(k));var $=a(k,w.key,T++);$!==void 0?g($):w.continue()}else g()},I.onerror=function(){f(I.error)}}catch(w){f(w)}})}).catch(f)});return v(m,d),m}function Fu(a,d,c){var m=this;a=U(a);var g=new E(function(f,b){var S;m.ready().then(function(){return S=m._dbInfo,we.call(d)==="[object Blob]"?G(S.db).then(function(C){return C?d:ei(d)}):d}).then(function(C){et(m._dbInfo,x,function(I,T){if(I)return b(I);try{var w=T.objectStore(m._dbInfo.storeName);C===null&&(C=void 0);var k=w.put(C,a);T.oncomplete=function(){C===void 0&&(C=null),f(C)},T.onabort=T.onerror=function(){var $=k.error?k.error:k.transaction.error;b($)}}catch($){b($)}})}).catch(b)});return v(g,c),g}function Vu(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){et(c._dbInfo,x,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=C.delete(a);S.oncomplete=function(){g()},S.onerror=function(){f(I.error)},S.onabort=function(){var T=I.error?I.error:I.transaction.error;f(T)}}catch(T){f(T)}})}).catch(f)});return v(m,d),m}function ku(a){var d=this,c=new E(function(m,g){d.ready().then(function(){et(d._dbInfo,x,function(f,b){if(f)return g(f);try{var S=b.objectStore(d._dbInfo.storeName),C=S.clear();b.oncomplete=function(){m()},b.onabort=b.onerror=function(){var I=C.error?C.error:C.transaction.error;g(I)}}catch(I){g(I)}})}).catch(g)});return v(c,a),c}function Uu(a){var d=this,c=new E(function(m,g){d.ready().then(function(){et(d._dbInfo,Ae,function(f,b){if(f)return g(f);try{var S=b.objectStore(d._dbInfo.storeName),C=S.count();C.onsuccess=function(){m(C.result)},C.onerror=function(){g(C.error)}}catch(I){g(I)}})}).catch(g)});return v(c,a),c}function Bu(a,d){var c=this,m=new E(function(g,f){if(a<0){g(null);return}c.ready().then(function(){et(c._dbInfo,Ae,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=!1,T=C.openKeyCursor();T.onsuccess=function(){var w=T.result;if(!w){g(null);return}a===0||I?g(w.key):(I=!0,w.advance(a))},T.onerror=function(){f(T.error)}}catch(w){f(w)}})}).catch(f)});return v(m,d),m}function Hu(a){var d=this,c=new E(function(m,g){d.ready().then(function(){et(d._dbInfo,Ae,function(f,b){if(f)return g(f);try{var S=b.objectStore(d._dbInfo.storeName),C=S.openKeyCursor(),I=[];C.onsuccess=function(){var T=C.result;if(!T){m(I);return}I.push(T.key),T.continue()},C.onerror=function(){g(C.error)}}catch(T){g(T)}})}).catch(g)});return v(c,a),c}function Gu(a,d){d=M.apply(this,arguments);var c=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var m=this,g;if(!a.name)g=E.reject("Invalid arguments");else{var f=a.name===c.name&&m._dbInfo.db,b=f?E.resolve(m._dbInfo.db):Ze(a).then(function(S){var C=X[a.name],I=C.forages;C.db=S;for(var T=0;T<I.length;T++)I[T]._dbInfo.db=S;return S});a.storeName?g=b.then(function(S){if(S.objectStoreNames.contains(a.storeName)){var C=S.version+1;ne(a);var I=X[a.name],T=I.forages;S.close();for(var w=0;w<T.length;w++){var k=T[w];k._dbInfo.db=null,k._dbInfo.version=C}var $=new E(function(j,ie){var re=h.open(a.name,C);re.onerror=function(Oe){var mn=re.result;mn.close(),ie(Oe)},re.onupgradeneeded=function(){var Oe=re.result;Oe.deleteObjectStore(a.storeName)},re.onsuccess=function(){var Oe=re.result;Oe.close(),j(Oe)}});return $.then(function(j){I.db=j;for(var ie=0;ie<T.length;ie++){var re=T[ie];re._dbInfo.db=j,J(re._dbInfo)}}).catch(function(j){throw(de(a,j)||E.resolve()).catch(function(){}),j})}}):g=b.then(function(S){ne(a);var C=X[a.name],I=C.forages;S.close();for(var T=0;T<I.length;T++){var w=I[T];w._dbInfo.db=null}var k=new E(function($,j){var ie=h.deleteDatabase(a.name);ie.onerror=function(){var re=ie.result;re&&re.close(),j(ie.error)},ie.onblocked=function(){console.warn('dropInstance blocked for database "'+a.name+'" until all open connections are closed')},ie.onsuccess=function(){var re=ie.result;re&&re.close(),$(re)}});return k.then(function($){C.db=$;for(var j=0;j<I.length;j++){var ie=I[j];J(ie._dbInfo)}}).catch(function($){throw(de(a,$)||E.resolve()).catch(function(){}),$})})}return v(g,d),g}var $u={_driver:"asyncStorage",_initStorage:Mu,_support:y(),iterate:Lu,getItem:Pu,setItem:Fu,removeItem:Vu,clear:ku,length:Uu,key:Bu,keys:Hu,dropInstance:Gu};function ju(){return typeof openDatabase=="function"}var ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wu="~~local_forage_type~",ss=/^~~local_forage_type~([^~]+)~/,qn="__lfsc__:",ti=qn.length,ni="arbf",ri="blob",as="si08",cs="ui08",us="uic8",ls="si16",ds="si32",fs="ur16",ps="ui32",ms="fl32",hs="fl64",gs=ti+ni.length,_s=Object.prototype.toString;function vs(a){var d=a.length*.75,c=a.length,m,g=0,f,b,S,C;a[a.length-1]==="="&&(d--,a[a.length-2]==="="&&d--);var I=new ArrayBuffer(d),T=new Uint8Array(I);for(m=0;m<c;m+=4)f=ft.indexOf(a[m]),b=ft.indexOf(a[m+1]),S=ft.indexOf(a[m+2]),C=ft.indexOf(a[m+3]),T[g++]=f<<2|b>>4,T[g++]=(b&15)<<4|S>>2,T[g++]=(S&3)<<6|C&63;return I}function ii(a){var d=new Uint8Array(a),c="",m;for(m=0;m<d.length;m+=3)c+=ft[d[m]>>2],c+=ft[(d[m]&3)<<4|d[m+1]>>4],c+=ft[(d[m+1]&15)<<2|d[m+2]>>6],c+=ft[d[m+2]&63];return d.length%3===2?c=c.substring(0,c.length-1)+"=":d.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function zu(a,d){var c="";if(a&&(c=_s.call(a)),a&&(c==="[object ArrayBuffer]"||a.buffer&&_s.call(a.buffer)==="[object ArrayBuffer]")){var m,g=qn;a instanceof ArrayBuffer?(m=a,g+=ni):(m=a.buffer,c==="[object Int8Array]"?g+=as:c==="[object Uint8Array]"?g+=cs:c==="[object Uint8ClampedArray]"?g+=us:c==="[object Int16Array]"?g+=ls:c==="[object Uint16Array]"?g+=fs:c==="[object Int32Array]"?g+=ds:c==="[object Uint32Array]"?g+=ps:c==="[object Float32Array]"?g+=ms:c==="[object Float64Array]"?g+=hs:d(new Error("Failed to get type for BinaryArray"))),d(g+ii(m))}else if(c==="[object Blob]"){var f=new FileReader;f.onload=function(){var b=Wu+a.type+"~"+ii(this.result);d(qn+ri+b)},f.readAsArrayBuffer(a)}else try{d(JSON.stringify(a))}catch(b){console.error("Couldn't convert value into a JSON string: ",a),d(null,b)}}function Yu(a){if(a.substring(0,ti)!==qn)return JSON.parse(a);var d=a.substring(gs),c=a.substring(ti,gs),m;if(c===ri&&ss.test(d)){var g=d.match(ss);m=g[1],d=d.substring(g[0].length)}var f=vs(d);switch(c){case ni:return f;case ri:return p([f],{type:m});case as:return new Int8Array(f);case cs:return new Uint8Array(f);case us:return new Uint8ClampedArray(f);case ls:return new Int16Array(f);case fs:return new Uint16Array(f);case ds:return new Int32Array(f);case ps:return new Uint32Array(f);case ms:return new Float32Array(f);case hs:return new Float64Array(f);default:throw new Error("Unkown type: "+c)}}var oi={serialize:zu,deserialize:Yu,stringToBuffer:vs,bufferToString:ii};function ys(a,d,c,m){a.executeSql("CREATE TABLE IF NOT EXISTS "+d.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,m)}function qu(a){var d=this,c={db:null};if(a)for(var m in a)c[m]=typeof a[m]!="string"?a[m].toString():a[m];var g=new E(function(f,b){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(S){return b(S)}c.db.transaction(function(S){ys(S,c,function(){d._dbInfo=c,f()},function(C,I){b(I)})},b)});return c.serializer=oi,g}function pt(a,d,c,m,g,f){a.executeSql(c,m,g,function(b,S){S.code===S.SYNTAX_ERR?b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[d.storeName],function(C,I){I.rows.length?f(C,S):ys(C,d,function(){C.executeSql(c,m,g,f)},f)},f):f(b,S)},f)}function Ku(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"SELECT * FROM "+b.storeName+" WHERE key = ? LIMIT 1",[a],function(C,I){var T=I.rows.length?I.rows.item(0).value:null;T&&(T=b.serializer.deserialize(T)),g(T)},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function Xu(a,d){var c=this,m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"SELECT * FROM "+b.storeName,[],function(C,I){for(var T=I.rows,w=T.length,k=0;k<w;k++){var $=T.item(k),j=$.value;if(j&&(j=b.serializer.deserialize(j)),j=a(j,$.key,k+1),j!==void 0){g(j);return}}g()},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function Es(a,d,c,m){var g=this;a=U(a);var f=new E(function(b,S){g.ready().then(function(){d===void 0&&(d=null);var C=d,I=g._dbInfo;I.serializer.serialize(d,function(T,w){w?S(w):I.db.transaction(function(k){pt(k,I,"INSERT OR REPLACE INTO "+I.storeName+" (key, value) VALUES (?, ?)",[a,T],function(){b(C)},function($,j){S(j)})},function(k){if(k.code===k.QUOTA_ERR){if(m>0){b(Es.apply(g,[a,C,c,m-1]));return}S(k)}})})}).catch(S)});return v(f,c),f}function Ju(a,d,c){return Es.apply(this,[a,d,c,1])}function Qu(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"DELETE FROM "+b.storeName+" WHERE key = ?",[a],function(){g()},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function Zu(a){var d=this,c=new E(function(m,g){d.ready().then(function(){var f=d._dbInfo;f.db.transaction(function(b){pt(b,f,"DELETE FROM "+f.storeName,[],function(){m()},function(S,C){g(C)})})}).catch(g)});return v(c,a),c}function el(a){var d=this,c=new E(function(m,g){d.ready().then(function(){var f=d._dbInfo;f.db.transaction(function(b){pt(b,f,"SELECT COUNT(key) as c FROM "+f.storeName,[],function(S,C){var I=C.rows.item(0).c;m(I)},function(S,C){g(C)})})}).catch(g)});return v(c,a),c}function tl(a,d){var c=this,m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"SELECT key FROM "+b.storeName+" WHERE id = ? LIMIT 1",[a+1],function(C,I){var T=I.rows.length?I.rows.item(0).key:null;g(T)},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function nl(a){var d=this,c=new E(function(m,g){d.ready().then(function(){var f=d._dbInfo;f.db.transaction(function(b){pt(b,f,"SELECT key FROM "+f.storeName,[],function(S,C){for(var I=[],T=0;T<C.rows.length;T++)I.push(C.rows.item(T).key);m(I)},function(S,C){g(C)})})}).catch(g)});return v(c,a),c}function rl(a){return new E(function(d,c){a.transaction(function(m){m.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(g,f){for(var b=[],S=0;S<f.rows.length;S++)b.push(f.rows.item(S).name);d({db:a,storeNames:b})},function(g,f){c(f)})},function(m){c(m)})})}function il(a,d){d=M.apply(this,arguments);var c=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var m=this,g;return a.name?g=new E(function(f){var b;a.name===c.name?b=m._dbInfo.db:b=openDatabase(a.name,"","",0),a.storeName?f({db:b,storeNames:[a.storeName]}):f(rl(b))}).then(function(f){return new E(function(b,S){f.db.transaction(function(C){function I($){return new E(function(j,ie){C.executeSql("DROP TABLE IF EXISTS "+$,[],function(){j()},function(re,Oe){ie(Oe)})})}for(var T=[],w=0,k=f.storeNames.length;w<k;w++)T.push(I(f.storeNames[w]));E.all(T).then(function(){b()}).catch(function($){S($)})},function(C){S(C)})})}):g=E.reject("Invalid arguments"),v(g,d),g}var ol={_driver:"webSQLStorage",_initStorage:qu,_support:ju(),iterate:Xu,getItem:Ku,setItem:Ju,removeItem:Qu,clear:Zu,length:el,key:tl,keys:nl,dropInstance:il};function sl(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function bs(a,d){var c=a.name+"/";return a.storeName!==d.storeName&&(c+=a.storeName+"/"),c}function al(){var a="_localforage_support_test";try{return localStorage.setItem(a,!0),localStorage.removeItem(a),!1}catch{return!0}}function cl(){return!al()||localStorage.length>0}function ul(a){var d=this,c={};if(a)for(var m in a)c[m]=a[m];return c.keyPrefix=bs(a,d._defaultConfig),cl()?(d._dbInfo=c,c.serializer=oi,E.resolve()):E.reject()}function ll(a){var d=this,c=d.ready().then(function(){for(var m=d._dbInfo.keyPrefix,g=localStorage.length-1;g>=0;g--){var f=localStorage.key(g);f.indexOf(m)===0&&localStorage.removeItem(f)}});return v(c,a),c}function dl(a,d){var c=this;a=U(a);var m=c.ready().then(function(){var g=c._dbInfo,f=localStorage.getItem(g.keyPrefix+a);return f&&(f=g.serializer.deserialize(f)),f});return v(m,d),m}function fl(a,d){var c=this,m=c.ready().then(function(){for(var g=c._dbInfo,f=g.keyPrefix,b=f.length,S=localStorage.length,C=1,I=0;I<S;I++){var T=localStorage.key(I);if(T.indexOf(f)===0){var w=localStorage.getItem(T);if(w&&(w=g.serializer.deserialize(w)),w=a(w,T.substring(b),C++),w!==void 0)return w}}});return v(m,d),m}function pl(a,d){var c=this,m=c.ready().then(function(){var g=c._dbInfo,f;try{f=localStorage.key(a)}catch{f=null}return f&&(f=f.substring(g.keyPrefix.length)),f});return v(m,d),m}function ml(a){var d=this,c=d.ready().then(function(){for(var m=d._dbInfo,g=localStorage.length,f=[],b=0;b<g;b++){var S=localStorage.key(b);S.indexOf(m.keyPrefix)===0&&f.push(S.substring(m.keyPrefix.length))}return f});return v(c,a),c}function hl(a){var d=this,c=d.keys().then(function(m){return m.length});return v(c,a),c}function gl(a,d){var c=this;a=U(a);var m=c.ready().then(function(){var g=c._dbInfo;localStorage.removeItem(g.keyPrefix+a)});return v(m,d),m}function _l(a,d,c){var m=this;a=U(a);var g=m.ready().then(function(){d===void 0&&(d=null);var f=d;return new E(function(b,S){var C=m._dbInfo;C.serializer.serialize(d,function(I,T){if(T)S(T);else try{localStorage.setItem(C.keyPrefix+a,I),b(f)}catch(w){(w.name==="QuotaExceededError"||w.name==="NS_ERROR_DOM_QUOTA_REACHED")&&S(w),S(w)}})})});return v(g,c),g}function vl(a,d){if(d=M.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var c=this.config();a.name=a.name||c.name,a.storeName=a.storeName||c.storeName}var m=this,g;return a.name?g=new E(function(f){a.storeName?f(bs(a,m._defaultConfig)):f(a.name+"/")}).then(function(f){for(var b=localStorage.length-1;b>=0;b--){var S=localStorage.key(b);S.indexOf(f)===0&&localStorage.removeItem(S)}}):g=E.reject("Invalid arguments"),v(g,d),g}var yl={_driver:"localStorageWrapper",_initStorage:ul,_support:sl(),iterate:fl,getItem:dl,setItem:_l,removeItem:gl,clear:ll,length:hl,key:pl,keys:ml,dropInstance:vl},El=function(d,c){return d===c||typeof d=="number"&&typeof c=="number"&&isNaN(d)&&isNaN(c)},bl=function(d,c){for(var m=d.length,g=0;g<m;){if(El(d[g],c))return!0;g++}return!1},Ss=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},pn={},Cs={},Bt={INDEXEDDB:$u,WEBSQL:ol,LOCALSTORAGE:yl},Sl=[Bt.INDEXEDDB._driver,Bt.WEBSQL._driver,Bt.LOCALSTORAGE._driver],Kn=["dropInstance"],si=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Kn),Cl={description:"",driver:Sl.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Il(a,d){a[d]=function(){var c=arguments;return a.ready().then(function(){return a[d].apply(a,c)})}}function ai(){for(var a=1;a<arguments.length;a++){var d=arguments[a];if(d)for(var c in d)d.hasOwnProperty(c)&&(Ss(d[c])?arguments[0][c]=d[c].slice():arguments[0][c]=d[c])}return arguments[0]}var Tl=(function(){function a(d){u(this,a);for(var c in Bt)if(Bt.hasOwnProperty(c)){var m=Bt[c],g=m._driver;this[c]=g,pn[g]||this.defineDriver(m)}this._defaultConfig=ai({},Cl),this._config=ai({},this._defaultConfig,d),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return a.prototype.config=function(c){if((typeof c>"u"?"undefined":s(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var m in c){if(m==="storeName"&&(c[m]=c[m].replace(/\W/g,"_")),m==="version"&&typeof c[m]!="number")return new Error("Database version must be a number.");this._config[m]=c[m]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},a.prototype.defineDriver=function(c,m,g){var f=new E(function(b,S){try{var C=c._driver,I=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){S(I);return}for(var T=si.concat("_initStorage"),w=0,k=T.length;w<k;w++){var $=T[w],j=!bl(Kn,$);if((j||c[$])&&typeof c[$]!="function"){S(I);return}}var ie=function(){for(var mn=function(wl){return function(){var Al=new Error("Method "+wl+" is not implemented by the current driver"),Is=E.reject(Al);return v(Is,arguments[arguments.length-1]),Is}},ci=0,Dl=Kn.length;ci<Dl;ci++){var ui=Kn[ci];c[ui]||(c[ui]=mn(ui))}};ie();var re=function(mn){pn[C]&&console.info("Redefining LocalForage driver: "+C),pn[C]=c,Cs[C]=mn,b()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(re,S):re(!!c._support):re(!0)}catch(Oe){S(Oe)}});return A(f,m,g),f},a.prototype.driver=function(){return this._driver||null},a.prototype.getDriver=function(c,m,g){var f=pn[c]?E.resolve(pn[c]):E.reject(new Error("Driver not found."));return A(f,m,g),f},a.prototype.getSerializer=function(c){var m=E.resolve(oi);return A(m,c),m},a.prototype.ready=function(c){var m=this,g=m._driverSet.then(function(){return m._ready===null&&(m._ready=m._initDriver()),m._ready});return A(g,c,c),g},a.prototype.setDriver=function(c,m,g){var f=this;Ss(c)||(c=[c]);var b=this._getSupportedDrivers(c);function S(){f._config.driver=f.driver()}function C(w){return f._extend(w),S(),f._ready=f._initStorage(f._config),f._ready}function I(w){return function(){var k=0;function $(){for(;k<w.length;){var j=w[k];return k++,f._dbInfo=null,f._ready=null,f.getDriver(j).then(C).catch($)}S();var ie=new Error("No available storage method found.");return f._driverSet=E.reject(ie),f._driverSet}return $()}}var T=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=T.then(function(){var w=b[0];return f._dbInfo=null,f._ready=null,f.getDriver(w).then(function(k){f._driver=k._driver,S(),f._wrapLibraryMethodsWithReady(),f._initDriver=I(b)})}).catch(function(){S();var w=new Error("No available storage method found.");return f._driverSet=E.reject(w),f._driverSet}),A(this._driverSet,m,g),this._driverSet},a.prototype.supports=function(c){return!!Cs[c]},a.prototype._extend=function(c){ai(this,c)},a.prototype._getSupportedDrivers=function(c){for(var m=[],g=0,f=c.length;g<f;g++){var b=c[g];this.supports(b)&&m.push(b)}return m},a.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,m=si.length;c<m;c++)Il(this,si[c])},a.prototype.createInstance=function(c){return new a(c)},a})(),xl=new Tl;i.exports=xl},{3:3}]},{},[4])(4)})});var yt=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}};var Gs=0;function ch(e,t){if(!e)return;let n=document.createElement("script");n.id=t??"",n.src=e,n.type="module",document.head.appendChild(n)}function Rl(e=document.head){return $s(zt.styleURL,e,"cooee-global-styles")}function Ml(e=document.head){return $s(zt.swiperStyleURL,e,"cooee-swiper-styles")}function $s(e,t=document.head,n){return new Promise(r=>{if(t.querySelector(`#${n}`)){r();return}let o=document.createElement("link");o.rel="stylesheet",o.href=e,o.id=n,o.onload=()=>{r()},o.onerror=()=>{console.error("Failed to load stylesheet:",e),r()},t.appendChild(o)})}function mi(e,t=document.head){if(!e)return;Gs++;let n=document.createElement("style");n.id=`cooee-app-css-${Gs}`,n.textContent=e,t.appendChild(n)}function uh(e){if(!e)return;let t=document.createElement("script");t.id="cooee-app-script",t.innerHTML=e,document.head.appendChild(t)}function lh(script){if(script)try{eval(script)}catch(e){console.error("Failed to execute script:",e)}}async function js(){let e=(await import("./swiper-bundle-WHJS64TU.js")).default;return window.CooeeSDK.Swiper=e}async function Ws(e,t=!0){if(!e)return;let n=[];t&&n.push(Ml(e)),n.push(Rl(e)),await Promise.all(n);let r=yt.get().website.commonCSS;mi(r,e)}var Pl={"[class.ng-untouched]":"isUntouched","[class.ng-touched]":"isTouched","[class.ng-pristine]":"isPristine","[class.ng-dirty]":"isDirty","[class.ng-valid]":"isValid","[class.ng-invalid]":"isInvalid","[class.ng-pending]":"isPending"},Bh=F(_({},Pl),{"[class.ng-submitted]":"isSubmitted"});var Ll=new xs("",{providedIn:"root",factory:()=>zs}),zs="always";var Fl=(()=>{class e{static \u0275fac=function(r){return new(r||e)};static \u0275mod=fi({type:e});static \u0275inj=di({})}return e})();var Ys=(()=>{class e{static withConfig(n){return{ngModule:e,providers:[{provide:Ll,useValue:n.callSetDisabledState??zs}]}}static \u0275fac=function(r){return new(r||e)};static \u0275mod=fi({type:e});static \u0275inj=di({imports:[Fl]})}return e})();var hi=(function(e){return e.SHOPIFY_CHECKOUT="shopify_checkout",e.THIRD_PARTY_CHECKOUT="third_party_checkout",e.CART_PAGE="cart_page",e.CART_DRAWER="cart_drawer",e})(hi||{});var ot=(function(e){return e[e.NONE=0]="NONE",e[e.REJECT_POPUP=1]="REJECT_POPUP",e[e.ACCEPT_POPUP=2]="ACCEPT_POPUP",e[e.GO_TO_URL=4]="GO_TO_URL",e[e.SHARE=5]="SHARE",e[e.KEY_VALUE=100]="KEY_VALUE",e[e.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",e[e.ADD_TO_CART=102]="ADD_TO_CART",e[e.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",e[e.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",e[e.OPEN_CART=105]="OPEN_CART",e[e.SUBMIT_FORM=106]="SUBMIT_FORM",e[e.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",e[e.ADD_BUNDLE=108]="ADD_BUNDLE",e[e.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",e[e.BUY_NOW=110]="BUY_NOW",e[e.QUICK_VIEW=111]="QUICK_VIEW",e})(ot||{});var Vl=(function(e){return e.FREE_SHIPPING="FREE_SHIPPING",e.DISCOUNT="DISCOUNT",e.FREE_AUTO_GIFT="FREE_AUTO_GIFT",e.FREE_GIFT_SELECT="FREE_GIFT_SELECT",e.UI_ONLY="UI_ONLY",e})(Vl||{});var Et=class e{engagementContext=Re(Cn);eventData=Re(tr);constructor(){}executeCTA(t,n){let r,i=this.engagementContext();if(!i){he.error("Engagement context is not available; aborting executeCTA.");return}if(t===ot.ADD_TO_CART)r="CE Add To Cart Clicked";else if(t===ot.GO_TO_PRODUCT)r="CE View Item Clicked";else if(t===ot.OPEN_CART)r="CE Open Cart Clicked",i.triggerData.redirectBehaviour=hi.CART_DRAWER;else{he.warn(`Unsupported CTA type: ${t}`);return}window.CooeeSDK.executeCTA(i,_({clickAction:{at:t}},n));let o=new Bs(r,this.eventData.props,i.triggerData);n?.video?o.setVideos(n.video):this.eventData.video&&o.setVideos(this.eventData.video),window.CooeeSDK.sendEvent(o)}static \u0275fac=function(n){return new(n||e)};static \u0275prov=li({token:e,factory:e.\u0275fac})};function qs(e,t){return[Et,...Ul(e,t)]}function Ul(e,t){return[{provide:Cn,useValue:Ht(e)},{provide:tr,useValue:_({},t)}]}var ir=class e{elementRef=Re(gn);engagementService=Re(Et);hasSwiper=!1;_engagementTrigger=Ht(null);_triggerContext=Re(Cn);constructor(){this.elementRef.nativeElement.update=this.update.bind(this)}get classes(){let t=["letscooee-widget"],n=this._engagementTrigger();return t.push(`widget-${n?.shortID}`),t}get triggerContext(){return this._triggerContext()}set triggerContext(t){this._triggerContext.set(t),this._engagementTrigger.set(t.triggerData),this.engagementTriggerReceived(t.triggerData)}get engagementTrigger(){return this._engagementTrigger()}ngOnInit(){he.verbose("Init",this.constructor.name);let t=this.elementRef.nativeElement.shadowRoot;t&&Ws(t,this.hasSwiper)}ngOnDestroy(){he.verbose("Destroying",this.constructor.name)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Ee({type:e,selectors:[["ng-component"]],hostVars:2,hostBindings:function(n,r){n&2&&Qn(r.classes)},inputs:{triggerContext:"triggerContext"},decls:1,vars:0,template:function(n,r){n&1&&Ns(0)},encapsulation:2})};var Bl=(e,t)=>({"--option-color":e,"background-color":t}),Ks=(e,t)=>t.id;function Hl(e,t){if(e&1&&(W(0,"span",6),ee(1),z()),e&2){B();let n=be(0);N(),_t(n)}}function Gl(e,t){if(e&1){let n=$e();je(0),W(1,"button",5),ke("click",function(){let i=Ie(n).$implicit,o=B().$implicit,s=B();return Te(s.onOptionChange(o,i))}),Q(2,Hl,2,1,"span",6),z()}if(e&2){let n=t.$implicit,r=B().$implicit,i=be(1),o=n.name,s=We(n.displayName||n.name),u=i?n.hexColor??o:"",l=B().selectedOptions()[r.name]===o;N(),yn("color-type",i)("selected",l)("disabled",n.disabled),oe("title",s)("ngStyle",er(14,Bl,u,u)),Gt("aria-checked",l?"true":"false")("data-value",o)("aria-disabled",n.disabled?"true":null)("aria-label",s),N(),Z(i?-1:2)}}function $l(e,t){if(e&1&&(W(0,"div"),je(1),W(2,"div",1),ee(3),z(),W(4,"div",2),ee(5),z(),W(6,"div",3),$t(7,Gl,3,17,"button",4,Ks),z()()),e&2){let n=t.$implicit,r=B();Qn(Ps("option-group ",n.name.toLowerCase())),N(),We(r.hasHexColors(n)),N(2),Wt("",n.name,":"),N(2),_t(r.selectedOptions()[n.name]),N(),Gt("aria-label",n.name),N(),jt(n.optionValues)}}var In=e=>e.trim().toLowerCase(),or=class e extends ir{selectedVariant=new _n;item=Se.required();selectedOptions=Ht({});options=wt(()=>{let t=this.item();if(!t.options||t.vars.length===1)return[];if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(t,this.engagementTrigger)}catch(n){he.error(n)}return t.options.forEach(n=>{n.optionValues.forEach(r=>{r.disabled=this.isOptionValueDisabledFast(n,r)})}),t.options});matchedVariant=wt(()=>{let t=this.item(),n=this.selectedOptions();return t.vars.find(r=>t.options.every(i=>{let o=r.selectedOptions.find(s=>s.name===i.name)?.value;return n[i.name]===o}))});availabilityIndex=wt(()=>{let t=this.item(),n=new Map;return t?.vars?.length&&t.vars.forEach((r,i)=>{if(r.isAvailable)for(let o of r.selectedOptions){let s=In(o.name),u=o.value,l=n.get(s);l||n.set(s,l=new Map);let h=l.get(u);h||l.set(u,h=new Set),h.add(i)}}),n});constructor(){super(),At(()=>{let n=this.matchedVariant();n&&(this.item().setSelectedVariant(n),this.selectedVariant.emit(n))});let t=At(()=>{let n=this.item();if(!n?.options)return;let r=_({},this.selectedOptions()),i=n.vars.find(o=>o.isAvailable)??n.vars[0];n.options.forEach(o=>{let s=i?.selectedOptions.find(u=>u.name===o.name)?.value;s&&(r[o.name]=s)}),this.selectedOptions.set(r),t.destroy()})}ngOnInit(){super.ngOnInit();let t=this.elementRef.nativeElement.shadowRoot;if(!t)return;let n=yt.get().website?.itemSwatchMapping;n&&mi(n,t)}onOptionChange(t,n){let r=_({},this.selectedOptions());r[t.name]=n.name,this.selectedOptions.set(r)}engagementTriggerReceived(){}update(){}hasHexColors(t){return!!t.optionValues[0]?.name.match(/#[a-f0-9]{6}\b/i)}getCandidateVariantsExcluding(t){let n=this.item(),r=this.availabilityIndex(),i=new Set;n.vars.forEach((s,u)=>{s.isAvailable&&i.add(u)});let o=i;for(let[s,u]of Object.entries(this.selectedOptions())){if(In(s)===In(t))continue;let l=r.get(In(s));if(!l)return new Set;let h=l.get(String(u));if(!h)return new Set;if(o=new Set([...o].filter(y=>h.has(y))),o.size===0)return o}return o}isOptionValueDisabledFast(t,n){let i=this.availabilityIndex().get(In(t.name));if(!i)return!0;let o=n.name,s=i.get(o);if(!s||s.size===0)return!0;let u=this.getCandidateVariantsExcluding(t.name);if(u.size===0)return!0;for(let l of u)if(s.has(l))return!1;return!0}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Ee({type:e,selectors:[["cooee-item-options-picker"]],inputs:{item:[1,"item"]},outputs:{selectedVariant:"selectedVariant"},features:[En(qs()),pi],decls:2,vars:0,consts:[[3,"class"],[1,"name"],[1,"selected-value"],["role","radiogroup",1,"option-values"],["type","button","role","radio",1,"option-value",3,"color-type","selected","disabled","title","ngStyle"],["type","button","role","radio",1,"option-value",3,"click","title","ngStyle"],[1,"title"]],template:function(n,r){n&1&&$t(0,$l,9,7,"div",0,Ks),n&2&&jt(r.options())},dependencies:[ks,Fs,Ys],styles:[`.option-group{display:flex;gap:4px;align-items:center}.option-group+.option-group{margin-top:8px}.option-values{display:flex;flex-wrap:nowrap;overflow-x:auto;padding:6px;gap:4px;scrollbar-gutter:stable both-edges;scrollbar-width:none}.option-values::-webkit-scrollbar{display:none}.selected-value{display:none}.option-value{padding:5px 10px;border:1px solid #ccc;cursor:pointer;border-radius:4px;min-width:32px;min-height:32px;text-align:center;position:relative;flex-shrink:0;--selected-color: var(--option-color, rgba(var(--lc-primary-button-bg-color, 0 0 0)))}.option-value.selected{box-shadow:#fff 0 0 0 2px,var(--selected-color) 0 0 0 4px}.option-value.disabled{opacity:.5;pointer-events:none}
1
+ import{a as Us,b as zt,c as he,e as Cn,f as tr,g as Bs,h as Hs,l as rr}from"./chunk-XJRPLKLE.js";import{a as nr}from"./chunk-74XS3G6Q.js";import{$ as pi,$a as En,Aa as gt,Ba as ke,Ca as vn,Da as B,E as Ht,Ea as Os,Fa as Rs,I as gn,K as Dt,L as mt,La as rt,Na as yn,O as N,Oa as Jn,Pa as Qn,Qa as ee,Ra as _t,Sa as Wt,Wa as je,X as Ee,Xa as We,Y as fi,Ya as be,Za as Ms,_ as Ds,_a as Ps,ab as Zn,ba as ht,bb as er,ca as _n,cb as Ue,db as Be,fb as bn,ga as Gt,ha as Q,hb as wt,ia as Z,ib as At,jb as vt,ka as $t,kb as Se,la as jt,ma as oe,mb as Sn,na as W,oa as z,pa as Me,qa as pe,ra as ge,s as li,sa as tt,sb as Ls,t as di,tb as Fs,u as xs,ub as Vs,v as Re,va as nt,wa as ws,wb as ks,x as Ie,xa as As,y as Te,ya as Ns,za as $e}from"./chunk-KHVPWQ5E.js";import{a as _,b as F,c as hn,d as Ts,e as Nl,f as Ol,g as Xn}from"./chunk-V7UGKYBN.js";var Js=Nl((Xs,gi)=>{"use strict";(function(e){if(typeof Xs=="object"&&typeof gi<"u")gi.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,n;return(function r(i,o,s){function u(y,p){if(!o[y]){if(!i[y]){var E=typeof hn=="function"&&hn;if(!p&&E)return E(y,!0);if(l)return l(y,!0);var v=new Error("Cannot find module '"+y+"'");throw v.code="MODULE_NOT_FOUND",v}var A=o[y]={exports:{}};i[y][0].call(A.exports,function(U){var M=i[y][1][U];return u(M||U)},A,A.exports,r,i,o,s)}return o[y].exports}for(var l=typeof hn=="function"&&hn,h=0;h<s.length;h++)u(s[h]);return u})({1:[function(r,i,o){(function(s){"use strict";var u=s.MutationObserver||s.WebKitMutationObserver,l;if(u){var h=0,y=new u(U),p=s.document.createTextNode("");y.observe(p,{characterData:!0}),l=function(){p.data=h=++h%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=U,l=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var O=s.document.createElement("script");O.onreadystatechange=function(){U(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},s.document.documentElement.appendChild(O)}:l=function(){setTimeout(U,0)};var v,A=[];function U(){v=!0;for(var O,V,X=A.length;X;){for(V=A,A=[],O=-1;++O<X;)V[O]();X=A.length}v=!1}i.exports=M;function M(O){A.push(O)===1&&!v&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,i,o){"use strict";var s=r(1);function u(){}var l={},h=["REJECTED"],y=["FULFILLED"],p=["PENDING"];i.exports=E;function E(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=p,this.queue=[],this.outcome=void 0,x!==u&&M(this,x)}E.prototype.catch=function(x){return this.then(null,x)},E.prototype.then=function(x,H){if(typeof x!="function"&&this.state===y||typeof H!="function"&&this.state===h)return this;var L=new this.constructor(u);if(this.state!==p){var G=this.state===y?x:H;A(L,G,this.outcome)}else this.queue.push(new v(L,x,H));return L};function v(x,H,L){this.promise=x,typeof H=="function"&&(this.onFulfilled=H,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}v.prototype.callFulfilled=function(x){l.resolve(this.promise,x)},v.prototype.otherCallFulfilled=function(x){A(this.promise,this.onFulfilled,x)},v.prototype.callRejected=function(x){l.reject(this.promise,x)},v.prototype.otherCallRejected=function(x){A(this.promise,this.onRejected,x)};function A(x,H,L){s(function(){var G;try{G=H(L)}catch(ne){return l.reject(x,ne)}G===x?l.reject(x,new TypeError("Cannot resolve promise with itself")):l.resolve(x,G)})}l.resolve=function(x,H){var L=O(U,H);if(L.status==="error")return l.reject(x,L.value);var G=L.value;if(G)M(x,G);else{x.state=y,x.outcome=H;for(var ne=-1,J=x.queue.length;++ne<J;)x.queue[ne].callFulfilled(H)}return x},l.reject=function(x,H){x.state=h,x.outcome=H;for(var L=-1,G=x.queue.length;++L<G;)x.queue[L].callRejected(H);return x};function U(x){var H=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof H=="function")return function(){H.apply(x,arguments)}}function M(x,H){var L=!1;function G(Ne){L||(L=!0,l.reject(x,Ne))}function ne(Ne){L||(L=!0,l.resolve(x,Ne))}function J(){H(ne,G)}var de=O(J);de.status==="error"&&G(de.value)}function O(x,H){var L={};try{L.value=x(H),L.status="success"}catch(G){L.status="error",L.value=G}return L}E.resolve=V;function V(x){return x instanceof this?x:l.resolve(new this(u),x)}E.reject=X;function X(x){var H=new this(u);return l.reject(H,x)}E.all=we;function we(x){var H=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=x.length,G=!1;if(!L)return this.resolve([]);for(var ne=new Array(L),J=0,de=-1,Ne=new this(u);++de<L;)Ze(x[de],de);return Ne;function Ze(fn,Yn){H.resolve(fn).then(ei,function(Ut){G||(G=!0,l.reject(Ne,Ut))});function ei(Ut){ne[Yn]=Ut,++J===L&&!G&&(G=!0,l.resolve(Ne,ne))}}}E.race=Ae;function Ae(x){var H=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=x.length,G=!1;if(!L)return this.resolve([]);for(var ne=-1,J=new this(u);++ne<L;)de(x[ne]);return J;function de(Ne){H.resolve(Ne).then(function(Ze){G||(G=!0,l.resolve(J,Ze))},function(Ze){G||(G=!0,l.reject(J,Ze))})}}},{1:1}],3:[function(r,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function u(a,d){if(!(a instanceof d))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 h=l();function y(){try{if(!h||!h.open)return!1;var a=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),d=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!a||d)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function p(a,d){a=a||[],d=d||{};try{return new Blob(a,d)}catch(f){if(f.name!=="TypeError")throw f;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,m=new c,g=0;g<a.length;g+=1)m.append(a[g]);return m.getBlob(d.type)}}typeof Promise>"u"&&r(3);var E=Promise;function v(a,d){d&&a.then(function(c){d(null,c)},function(c){d(c)})}function A(a,d,c){typeof d=="function"&&a.then(d),typeof c=="function"&&a.catch(c)}function U(a){return typeof a!="string"&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}function M(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",V=void 0,X={},we=Object.prototype.toString,Ae="readonly",x="readwrite";function H(a){for(var d=a.length,c=new ArrayBuffer(d),m=new Uint8Array(c),g=0;g<d;g++)m[g]=a.charCodeAt(g);return c}function L(a){return new E(function(d){var c=a.transaction(O,x),m=p([""]);c.objectStore(O).put(m,"key"),c.onabort=function(g){g.preventDefault(),g.stopPropagation(),d(!1)},c.oncomplete=function(){var g=navigator.userAgent.match(/Chrome\/(\d+)/),f=navigator.userAgent.match(/Edge\//);d(f||!g||parseInt(g[1],10)>=43)}}).catch(function(){return!1})}function G(a){return typeof V=="boolean"?E.resolve(V):L(a).then(function(d){return V=d,V})}function ne(a){var d=X[a.name],c={};c.promise=new E(function(m,g){c.resolve=m,c.reject=g}),d.deferredOperations.push(c),d.dbReady?d.dbReady=d.dbReady.then(function(){return c.promise}):d.dbReady=c.promise}function J(a){var d=X[a.name],c=d.deferredOperations.pop();if(c)return c.resolve(),c.promise}function de(a,d){var c=X[a.name],m=c.deferredOperations.pop();if(m)return m.reject(d),m.promise}function Ne(a,d){return new E(function(c,m){if(X[a.name]=X[a.name]||os(),a.db)if(d)ne(a),a.db.close();else return c(a.db);var g=[a.name];d&&g.push(a.version);var f=h.open.apply(h,g);d&&(f.onupgradeneeded=function(b){var S=f.result;try{S.createObjectStore(a.storeName),b.oldVersion<=1&&S.createObjectStore(O)}catch(C){if(C.name==="ConstraintError")console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.');else throw C}}),f.onerror=function(b){b.preventDefault(),m(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(S){S.target.close()},c(b),J(a)}})}function Ze(a){return Ne(a,!1)}function fn(a){return Ne(a,!0)}function Yn(a,d){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),m=a.version<a.db.version,g=a.version>a.db.version;if(m&&(a.version!==d&&console.warn('The database "'+a.name+`" can't be downgraded from version `+a.db.version+" to version "+a.version+"."),a.version=a.db.version),g||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function ei(a){return new E(function(d,c){var m=new FileReader;m.onerror=c,m.onloadend=function(g){var f=btoa(g.target.result||"");d({__local_forage_encoded_blob:!0,data:f,type:a.type})},m.readAsBinaryString(a)})}function Ut(a){var d=H(atob(a.data));return p([d],{type:a.type})}function is(a){return a&&a.__local_forage_encoded_blob}function Ou(a){var d=this,c=d._initReady().then(function(){var m=X[d._dbInfo.name];if(m&&m.dbReady)return m.dbReady});return A(c,a,a),c}function Ru(a){ne(a);for(var d=X[a.name],c=d.forages,m=0;m<c.length;m++){var g=c[m];g._dbInfo.db&&(g._dbInfo.db.close(),g._dbInfo.db=null)}return a.db=null,Ze(a).then(function(f){return a.db=f,Yn(a)?fn(a):f}).then(function(f){a.db=d.db=f;for(var b=0;b<c.length;b++)c[b]._dbInfo.db=f}).catch(function(f){throw de(a,f),f})}function et(a,d,c,m){m===void 0&&(m=1);try{var g=a.db.transaction(a.storeName,d);c(null,g)}catch(f){if(m>0&&(!a.db||f.name==="InvalidStateError"||f.name==="NotFoundError"))return E.resolve().then(function(){if(!a.db||f.name==="NotFoundError"&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),fn(a)}).then(function(){return Ru(a).then(function(){et(a,d,c,m-1)})}).catch(c);c(f)}}function os(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Mu(a){var d=this,c={db:null};if(a)for(var m in a)c[m]=a[m];var g=X[c.name];g||(g=os(),X[c.name]=g),g.forages.push(d),d._initReady||(d._initReady=d.ready,d.ready=Ou);var f=[];function b(){return E.resolve()}for(var S=0;S<g.forages.length;S++){var C=g.forages[S];C!==d&&f.push(C._initReady().catch(b))}var I=g.forages.slice(0);return E.all(f).then(function(){return c.db=g.db,Ze(c)}).then(function(T){return c.db=T,Yn(c,d._defaultConfig.version)?fn(c):T}).then(function(T){c.db=g.db=T,d._dbInfo=c;for(var w=0;w<I.length;w++){var k=I[w];k!==d&&(k._dbInfo.db=c.db,k._dbInfo.version=c.version)}})}function Pu(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){et(c._dbInfo,Ae,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=C.get(a);I.onsuccess=function(){var T=I.result;T===void 0&&(T=null),is(T)&&(T=Ut(T)),g(T)},I.onerror=function(){f(I.error)}}catch(T){f(T)}})}).catch(f)});return v(m,d),m}function Lu(a,d){var c=this,m=new E(function(g,f){c.ready().then(function(){et(c._dbInfo,Ae,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=C.openCursor(),T=1;I.onsuccess=function(){var w=I.result;if(w){var k=w.value;is(k)&&(k=Ut(k));var $=a(k,w.key,T++);$!==void 0?g($):w.continue()}else g()},I.onerror=function(){f(I.error)}}catch(w){f(w)}})}).catch(f)});return v(m,d),m}function Fu(a,d,c){var m=this;a=U(a);var g=new E(function(f,b){var S;m.ready().then(function(){return S=m._dbInfo,we.call(d)==="[object Blob]"?G(S.db).then(function(C){return C?d:ei(d)}):d}).then(function(C){et(m._dbInfo,x,function(I,T){if(I)return b(I);try{var w=T.objectStore(m._dbInfo.storeName);C===null&&(C=void 0);var k=w.put(C,a);T.oncomplete=function(){C===void 0&&(C=null),f(C)},T.onabort=T.onerror=function(){var $=k.error?k.error:k.transaction.error;b($)}}catch($){b($)}})}).catch(b)});return v(g,c),g}function Vu(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){et(c._dbInfo,x,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=C.delete(a);S.oncomplete=function(){g()},S.onerror=function(){f(I.error)},S.onabort=function(){var T=I.error?I.error:I.transaction.error;f(T)}}catch(T){f(T)}})}).catch(f)});return v(m,d),m}function ku(a){var d=this,c=new E(function(m,g){d.ready().then(function(){et(d._dbInfo,x,function(f,b){if(f)return g(f);try{var S=b.objectStore(d._dbInfo.storeName),C=S.clear();b.oncomplete=function(){m()},b.onabort=b.onerror=function(){var I=C.error?C.error:C.transaction.error;g(I)}}catch(I){g(I)}})}).catch(g)});return v(c,a),c}function Uu(a){var d=this,c=new E(function(m,g){d.ready().then(function(){et(d._dbInfo,Ae,function(f,b){if(f)return g(f);try{var S=b.objectStore(d._dbInfo.storeName),C=S.count();C.onsuccess=function(){m(C.result)},C.onerror=function(){g(C.error)}}catch(I){g(I)}})}).catch(g)});return v(c,a),c}function Bu(a,d){var c=this,m=new E(function(g,f){if(a<0){g(null);return}c.ready().then(function(){et(c._dbInfo,Ae,function(b,S){if(b)return f(b);try{var C=S.objectStore(c._dbInfo.storeName),I=!1,T=C.openKeyCursor();T.onsuccess=function(){var w=T.result;if(!w){g(null);return}a===0||I?g(w.key):(I=!0,w.advance(a))},T.onerror=function(){f(T.error)}}catch(w){f(w)}})}).catch(f)});return v(m,d),m}function Hu(a){var d=this,c=new E(function(m,g){d.ready().then(function(){et(d._dbInfo,Ae,function(f,b){if(f)return g(f);try{var S=b.objectStore(d._dbInfo.storeName),C=S.openKeyCursor(),I=[];C.onsuccess=function(){var T=C.result;if(!T){m(I);return}I.push(T.key),T.continue()},C.onerror=function(){g(C.error)}}catch(T){g(T)}})}).catch(g)});return v(c,a),c}function Gu(a,d){d=M.apply(this,arguments);var c=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var m=this,g;if(!a.name)g=E.reject("Invalid arguments");else{var f=a.name===c.name&&m._dbInfo.db,b=f?E.resolve(m._dbInfo.db):Ze(a).then(function(S){var C=X[a.name],I=C.forages;C.db=S;for(var T=0;T<I.length;T++)I[T]._dbInfo.db=S;return S});a.storeName?g=b.then(function(S){if(S.objectStoreNames.contains(a.storeName)){var C=S.version+1;ne(a);var I=X[a.name],T=I.forages;S.close();for(var w=0;w<T.length;w++){var k=T[w];k._dbInfo.db=null,k._dbInfo.version=C}var $=new E(function(j,ie){var re=h.open(a.name,C);re.onerror=function(Oe){var mn=re.result;mn.close(),ie(Oe)},re.onupgradeneeded=function(){var Oe=re.result;Oe.deleteObjectStore(a.storeName)},re.onsuccess=function(){var Oe=re.result;Oe.close(),j(Oe)}});return $.then(function(j){I.db=j;for(var ie=0;ie<T.length;ie++){var re=T[ie];re._dbInfo.db=j,J(re._dbInfo)}}).catch(function(j){throw(de(a,j)||E.resolve()).catch(function(){}),j})}}):g=b.then(function(S){ne(a);var C=X[a.name],I=C.forages;S.close();for(var T=0;T<I.length;T++){var w=I[T];w._dbInfo.db=null}var k=new E(function($,j){var ie=h.deleteDatabase(a.name);ie.onerror=function(){var re=ie.result;re&&re.close(),j(ie.error)},ie.onblocked=function(){console.warn('dropInstance blocked for database "'+a.name+'" until all open connections are closed')},ie.onsuccess=function(){var re=ie.result;re&&re.close(),$(re)}});return k.then(function($){C.db=$;for(var j=0;j<I.length;j++){var ie=I[j];J(ie._dbInfo)}}).catch(function($){throw(de(a,$)||E.resolve()).catch(function(){}),$})})}return v(g,d),g}var $u={_driver:"asyncStorage",_initStorage:Mu,_support:y(),iterate:Lu,getItem:Pu,setItem:Fu,removeItem:Vu,clear:ku,length:Uu,key:Bu,keys:Hu,dropInstance:Gu};function ju(){return typeof openDatabase=="function"}var ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wu="~~local_forage_type~",ss=/^~~local_forage_type~([^~]+)~/,qn="__lfsc__:",ti=qn.length,ni="arbf",ri="blob",as="si08",cs="ui08",us="uic8",ls="si16",ds="si32",fs="ur16",ps="ui32",ms="fl32",hs="fl64",gs=ti+ni.length,_s=Object.prototype.toString;function vs(a){var d=a.length*.75,c=a.length,m,g=0,f,b,S,C;a[a.length-1]==="="&&(d--,a[a.length-2]==="="&&d--);var I=new ArrayBuffer(d),T=new Uint8Array(I);for(m=0;m<c;m+=4)f=ft.indexOf(a[m]),b=ft.indexOf(a[m+1]),S=ft.indexOf(a[m+2]),C=ft.indexOf(a[m+3]),T[g++]=f<<2|b>>4,T[g++]=(b&15)<<4|S>>2,T[g++]=(S&3)<<6|C&63;return I}function ii(a){var d=new Uint8Array(a),c="",m;for(m=0;m<d.length;m+=3)c+=ft[d[m]>>2],c+=ft[(d[m]&3)<<4|d[m+1]>>4],c+=ft[(d[m+1]&15)<<2|d[m+2]>>6],c+=ft[d[m+2]&63];return d.length%3===2?c=c.substring(0,c.length-1)+"=":d.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function zu(a,d){var c="";if(a&&(c=_s.call(a)),a&&(c==="[object ArrayBuffer]"||a.buffer&&_s.call(a.buffer)==="[object ArrayBuffer]")){var m,g=qn;a instanceof ArrayBuffer?(m=a,g+=ni):(m=a.buffer,c==="[object Int8Array]"?g+=as:c==="[object Uint8Array]"?g+=cs:c==="[object Uint8ClampedArray]"?g+=us:c==="[object Int16Array]"?g+=ls:c==="[object Uint16Array]"?g+=fs:c==="[object Int32Array]"?g+=ds:c==="[object Uint32Array]"?g+=ps:c==="[object Float32Array]"?g+=ms:c==="[object Float64Array]"?g+=hs:d(new Error("Failed to get type for BinaryArray"))),d(g+ii(m))}else if(c==="[object Blob]"){var f=new FileReader;f.onload=function(){var b=Wu+a.type+"~"+ii(this.result);d(qn+ri+b)},f.readAsArrayBuffer(a)}else try{d(JSON.stringify(a))}catch(b){console.error("Couldn't convert value into a JSON string: ",a),d(null,b)}}function Yu(a){if(a.substring(0,ti)!==qn)return JSON.parse(a);var d=a.substring(gs),c=a.substring(ti,gs),m;if(c===ri&&ss.test(d)){var g=d.match(ss);m=g[1],d=d.substring(g[0].length)}var f=vs(d);switch(c){case ni:return f;case ri:return p([f],{type:m});case as:return new Int8Array(f);case cs:return new Uint8Array(f);case us:return new Uint8ClampedArray(f);case ls:return new Int16Array(f);case fs:return new Uint16Array(f);case ds:return new Int32Array(f);case ps:return new Uint32Array(f);case ms:return new Float32Array(f);case hs:return new Float64Array(f);default:throw new Error("Unkown type: "+c)}}var oi={serialize:zu,deserialize:Yu,stringToBuffer:vs,bufferToString:ii};function ys(a,d,c,m){a.executeSql("CREATE TABLE IF NOT EXISTS "+d.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,m)}function qu(a){var d=this,c={db:null};if(a)for(var m in a)c[m]=typeof a[m]!="string"?a[m].toString():a[m];var g=new E(function(f,b){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(S){return b(S)}c.db.transaction(function(S){ys(S,c,function(){d._dbInfo=c,f()},function(C,I){b(I)})},b)});return c.serializer=oi,g}function pt(a,d,c,m,g,f){a.executeSql(c,m,g,function(b,S){S.code===S.SYNTAX_ERR?b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[d.storeName],function(C,I){I.rows.length?f(C,S):ys(C,d,function(){C.executeSql(c,m,g,f)},f)},f):f(b,S)},f)}function Ku(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"SELECT * FROM "+b.storeName+" WHERE key = ? LIMIT 1",[a],function(C,I){var T=I.rows.length?I.rows.item(0).value:null;T&&(T=b.serializer.deserialize(T)),g(T)},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function Xu(a,d){var c=this,m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"SELECT * FROM "+b.storeName,[],function(C,I){for(var T=I.rows,w=T.length,k=0;k<w;k++){var $=T.item(k),j=$.value;if(j&&(j=b.serializer.deserialize(j)),j=a(j,$.key,k+1),j!==void 0){g(j);return}}g()},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function Es(a,d,c,m){var g=this;a=U(a);var f=new E(function(b,S){g.ready().then(function(){d===void 0&&(d=null);var C=d,I=g._dbInfo;I.serializer.serialize(d,function(T,w){w?S(w):I.db.transaction(function(k){pt(k,I,"INSERT OR REPLACE INTO "+I.storeName+" (key, value) VALUES (?, ?)",[a,T],function(){b(C)},function($,j){S(j)})},function(k){if(k.code===k.QUOTA_ERR){if(m>0){b(Es.apply(g,[a,C,c,m-1]));return}S(k)}})})}).catch(S)});return v(f,c),f}function Ju(a,d,c){return Es.apply(this,[a,d,c,1])}function Qu(a,d){var c=this;a=U(a);var m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"DELETE FROM "+b.storeName+" WHERE key = ?",[a],function(){g()},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function Zu(a){var d=this,c=new E(function(m,g){d.ready().then(function(){var f=d._dbInfo;f.db.transaction(function(b){pt(b,f,"DELETE FROM "+f.storeName,[],function(){m()},function(S,C){g(C)})})}).catch(g)});return v(c,a),c}function el(a){var d=this,c=new E(function(m,g){d.ready().then(function(){var f=d._dbInfo;f.db.transaction(function(b){pt(b,f,"SELECT COUNT(key) as c FROM "+f.storeName,[],function(S,C){var I=C.rows.item(0).c;m(I)},function(S,C){g(C)})})}).catch(g)});return v(c,a),c}function tl(a,d){var c=this,m=new E(function(g,f){c.ready().then(function(){var b=c._dbInfo;b.db.transaction(function(S){pt(S,b,"SELECT key FROM "+b.storeName+" WHERE id = ? LIMIT 1",[a+1],function(C,I){var T=I.rows.length?I.rows.item(0).key:null;g(T)},function(C,I){f(I)})})}).catch(f)});return v(m,d),m}function nl(a){var d=this,c=new E(function(m,g){d.ready().then(function(){var f=d._dbInfo;f.db.transaction(function(b){pt(b,f,"SELECT key FROM "+f.storeName,[],function(S,C){for(var I=[],T=0;T<C.rows.length;T++)I.push(C.rows.item(T).key);m(I)},function(S,C){g(C)})})}).catch(g)});return v(c,a),c}function rl(a){return new E(function(d,c){a.transaction(function(m){m.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(g,f){for(var b=[],S=0;S<f.rows.length;S++)b.push(f.rows.item(S).name);d({db:a,storeNames:b})},function(g,f){c(f)})},function(m){c(m)})})}function il(a,d){d=M.apply(this,arguments);var c=this.config();a=typeof a!="function"&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var m=this,g;return a.name?g=new E(function(f){var b;a.name===c.name?b=m._dbInfo.db:b=openDatabase(a.name,"","",0),a.storeName?f({db:b,storeNames:[a.storeName]}):f(rl(b))}).then(function(f){return new E(function(b,S){f.db.transaction(function(C){function I($){return new E(function(j,ie){C.executeSql("DROP TABLE IF EXISTS "+$,[],function(){j()},function(re,Oe){ie(Oe)})})}for(var T=[],w=0,k=f.storeNames.length;w<k;w++)T.push(I(f.storeNames[w]));E.all(T).then(function(){b()}).catch(function($){S($)})},function(C){S(C)})})}):g=E.reject("Invalid arguments"),v(g,d),g}var ol={_driver:"webSQLStorage",_initStorage:qu,_support:ju(),iterate:Xu,getItem:Ku,setItem:Ju,removeItem:Qu,clear:Zu,length:el,key:tl,keys:nl,dropInstance:il};function sl(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function bs(a,d){var c=a.name+"/";return a.storeName!==d.storeName&&(c+=a.storeName+"/"),c}function al(){var a="_localforage_support_test";try{return localStorage.setItem(a,!0),localStorage.removeItem(a),!1}catch{return!0}}function cl(){return!al()||localStorage.length>0}function ul(a){var d=this,c={};if(a)for(var m in a)c[m]=a[m];return c.keyPrefix=bs(a,d._defaultConfig),cl()?(d._dbInfo=c,c.serializer=oi,E.resolve()):E.reject()}function ll(a){var d=this,c=d.ready().then(function(){for(var m=d._dbInfo.keyPrefix,g=localStorage.length-1;g>=0;g--){var f=localStorage.key(g);f.indexOf(m)===0&&localStorage.removeItem(f)}});return v(c,a),c}function dl(a,d){var c=this;a=U(a);var m=c.ready().then(function(){var g=c._dbInfo,f=localStorage.getItem(g.keyPrefix+a);return f&&(f=g.serializer.deserialize(f)),f});return v(m,d),m}function fl(a,d){var c=this,m=c.ready().then(function(){for(var g=c._dbInfo,f=g.keyPrefix,b=f.length,S=localStorage.length,C=1,I=0;I<S;I++){var T=localStorage.key(I);if(T.indexOf(f)===0){var w=localStorage.getItem(T);if(w&&(w=g.serializer.deserialize(w)),w=a(w,T.substring(b),C++),w!==void 0)return w}}});return v(m,d),m}function pl(a,d){var c=this,m=c.ready().then(function(){var g=c._dbInfo,f;try{f=localStorage.key(a)}catch{f=null}return f&&(f=f.substring(g.keyPrefix.length)),f});return v(m,d),m}function ml(a){var d=this,c=d.ready().then(function(){for(var m=d._dbInfo,g=localStorage.length,f=[],b=0;b<g;b++){var S=localStorage.key(b);S.indexOf(m.keyPrefix)===0&&f.push(S.substring(m.keyPrefix.length))}return f});return v(c,a),c}function hl(a){var d=this,c=d.keys().then(function(m){return m.length});return v(c,a),c}function gl(a,d){var c=this;a=U(a);var m=c.ready().then(function(){var g=c._dbInfo;localStorage.removeItem(g.keyPrefix+a)});return v(m,d),m}function _l(a,d,c){var m=this;a=U(a);var g=m.ready().then(function(){d===void 0&&(d=null);var f=d;return new E(function(b,S){var C=m._dbInfo;C.serializer.serialize(d,function(I,T){if(T)S(T);else try{localStorage.setItem(C.keyPrefix+a,I),b(f)}catch(w){(w.name==="QuotaExceededError"||w.name==="NS_ERROR_DOM_QUOTA_REACHED")&&S(w),S(w)}})})});return v(g,c),g}function vl(a,d){if(d=M.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var c=this.config();a.name=a.name||c.name,a.storeName=a.storeName||c.storeName}var m=this,g;return a.name?g=new E(function(f){a.storeName?f(bs(a,m._defaultConfig)):f(a.name+"/")}).then(function(f){for(var b=localStorage.length-1;b>=0;b--){var S=localStorage.key(b);S.indexOf(f)===0&&localStorage.removeItem(S)}}):g=E.reject("Invalid arguments"),v(g,d),g}var yl={_driver:"localStorageWrapper",_initStorage:ul,_support:sl(),iterate:fl,getItem:dl,setItem:_l,removeItem:gl,clear:ll,length:hl,key:pl,keys:ml,dropInstance:vl},El=function(d,c){return d===c||typeof d=="number"&&typeof c=="number"&&isNaN(d)&&isNaN(c)},bl=function(d,c){for(var m=d.length,g=0;g<m;){if(El(d[g],c))return!0;g++}return!1},Ss=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},pn={},Cs={},Bt={INDEXEDDB:$u,WEBSQL:ol,LOCALSTORAGE:yl},Sl=[Bt.INDEXEDDB._driver,Bt.WEBSQL._driver,Bt.LOCALSTORAGE._driver],Kn=["dropInstance"],si=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Kn),Cl={description:"",driver:Sl.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Il(a,d){a[d]=function(){var c=arguments;return a.ready().then(function(){return a[d].apply(a,c)})}}function ai(){for(var a=1;a<arguments.length;a++){var d=arguments[a];if(d)for(var c in d)d.hasOwnProperty(c)&&(Ss(d[c])?arguments[0][c]=d[c].slice():arguments[0][c]=d[c])}return arguments[0]}var Tl=(function(){function a(d){u(this,a);for(var c in Bt)if(Bt.hasOwnProperty(c)){var m=Bt[c],g=m._driver;this[c]=g,pn[g]||this.defineDriver(m)}this._defaultConfig=ai({},Cl),this._config=ai({},this._defaultConfig,d),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return a.prototype.config=function(c){if((typeof c>"u"?"undefined":s(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var m in c){if(m==="storeName"&&(c[m]=c[m].replace(/\W/g,"_")),m==="version"&&typeof c[m]!="number")return new Error("Database version must be a number.");this._config[m]=c[m]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},a.prototype.defineDriver=function(c,m,g){var f=new E(function(b,S){try{var C=c._driver,I=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){S(I);return}for(var T=si.concat("_initStorage"),w=0,k=T.length;w<k;w++){var $=T[w],j=!bl(Kn,$);if((j||c[$])&&typeof c[$]!="function"){S(I);return}}var ie=function(){for(var mn=function(wl){return function(){var Al=new Error("Method "+wl+" is not implemented by the current driver"),Is=E.reject(Al);return v(Is,arguments[arguments.length-1]),Is}},ci=0,Dl=Kn.length;ci<Dl;ci++){var ui=Kn[ci];c[ui]||(c[ui]=mn(ui))}};ie();var re=function(mn){pn[C]&&console.info("Redefining LocalForage driver: "+C),pn[C]=c,Cs[C]=mn,b()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(re,S):re(!!c._support):re(!0)}catch(Oe){S(Oe)}});return A(f,m,g),f},a.prototype.driver=function(){return this._driver||null},a.prototype.getDriver=function(c,m,g){var f=pn[c]?E.resolve(pn[c]):E.reject(new Error("Driver not found."));return A(f,m,g),f},a.prototype.getSerializer=function(c){var m=E.resolve(oi);return A(m,c),m},a.prototype.ready=function(c){var m=this,g=m._driverSet.then(function(){return m._ready===null&&(m._ready=m._initDriver()),m._ready});return A(g,c,c),g},a.prototype.setDriver=function(c,m,g){var f=this;Ss(c)||(c=[c]);var b=this._getSupportedDrivers(c);function S(){f._config.driver=f.driver()}function C(w){return f._extend(w),S(),f._ready=f._initStorage(f._config),f._ready}function I(w){return function(){var k=0;function $(){for(;k<w.length;){var j=w[k];return k++,f._dbInfo=null,f._ready=null,f.getDriver(j).then(C).catch($)}S();var ie=new Error("No available storage method found.");return f._driverSet=E.reject(ie),f._driverSet}return $()}}var T=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=T.then(function(){var w=b[0];return f._dbInfo=null,f._ready=null,f.getDriver(w).then(function(k){f._driver=k._driver,S(),f._wrapLibraryMethodsWithReady(),f._initDriver=I(b)})}).catch(function(){S();var w=new Error("No available storage method found.");return f._driverSet=E.reject(w),f._driverSet}),A(this._driverSet,m,g),this._driverSet},a.prototype.supports=function(c){return!!Cs[c]},a.prototype._extend=function(c){ai(this,c)},a.prototype._getSupportedDrivers=function(c){for(var m=[],g=0,f=c.length;g<f;g++){var b=c[g];this.supports(b)&&m.push(b)}return m},a.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,m=si.length;c<m;c++)Il(this,si[c])},a.prototype.createInstance=function(c){return new a(c)},a})(),xl=new Tl;i.exports=xl},{3:3}]},{},[4])(4)})});var yt=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this}};var Gs=0;function ch(e,t){if(!e)return;let n=document.createElement("script");n.id=t??"",n.src=e,n.type="module",document.head.appendChild(n)}function Rl(e=document.head){return $s(zt.styleURL,e,"cooee-global-styles")}function Ml(e=document.head){return $s(zt.swiperStyleURL,e,"cooee-swiper-styles")}function $s(e,t=document.head,n){return new Promise(r=>{if(t.querySelector(`#${n}`)){r();return}let o=document.createElement("link");o.rel="stylesheet",o.href=e,o.id=n,o.onload=()=>{r()},o.onerror=()=>{console.error("Failed to load stylesheet:",e),r()},t.appendChild(o)})}function mi(e,t=document.head){if(!e)return;Gs++;let n=document.createElement("style");n.id=`cooee-app-css-${Gs}`,n.textContent=e,t.appendChild(n)}function uh(e){if(!e)return;let t=document.createElement("script");t.id="cooee-app-script",t.innerHTML=e,document.head.appendChild(t)}function lh(script){if(script)try{eval(script)}catch(e){console.error("Failed to execute script:",e)}}async function js(){let e=(await import("./swiper-bundle-WHJS64TU.js")).default;return window.CooeeSDK.Swiper=e}async function Ws(e,t=!0){if(!e)return;let n=[];t&&n.push(Ml(e)),n.push(Rl(e)),await Promise.all(n);let r=yt.get().website.commonCSS;mi(r,e)}var Pl={"[class.ng-untouched]":"isUntouched","[class.ng-touched]":"isTouched","[class.ng-pristine]":"isPristine","[class.ng-dirty]":"isDirty","[class.ng-valid]":"isValid","[class.ng-invalid]":"isInvalid","[class.ng-pending]":"isPending"},Bh=F(_({},Pl),{"[class.ng-submitted]":"isSubmitted"});var Ll=new xs("",{providedIn:"root",factory:()=>zs}),zs="always";var Fl=(()=>{class e{static \u0275fac=function(r){return new(r||e)};static \u0275mod=fi({type:e});static \u0275inj=di({})}return e})();var Ys=(()=>{class e{static withConfig(n){return{ngModule:e,providers:[{provide:Ll,useValue:n.callSetDisabledState??zs}]}}static \u0275fac=function(r){return new(r||e)};static \u0275mod=fi({type:e});static \u0275inj=di({imports:[Fl]})}return e})();var hi=(function(e){return e.SHOPIFY_CHECKOUT="shopify_checkout",e.THIRD_PARTY_CHECKOUT="third_party_checkout",e.CART_PAGE="cart_page",e.CART_DRAWER="cart_drawer",e})(hi||{});var ot=(function(e){return e[e.NONE=0]="NONE",e[e.REJECT_POPUP=1]="REJECT_POPUP",e[e.ACCEPT_POPUP=2]="ACCEPT_POPUP",e[e.GO_TO_URL=4]="GO_TO_URL",e[e.SHARE=5]="SHARE",e[e.KEY_VALUE=100]="KEY_VALUE",e[e.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",e[e.ADD_TO_CART=102]="ADD_TO_CART",e[e.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",e[e.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",e[e.OPEN_CART=105]="OPEN_CART",e[e.SUBMIT_FORM=106]="SUBMIT_FORM",e[e.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",e[e.ADD_BUNDLE=108]="ADD_BUNDLE",e[e.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",e[e.BUY_NOW=110]="BUY_NOW",e[e.QUICK_VIEW=111]="QUICK_VIEW",e})(ot||{});var Vl=(function(e){return e.FREE_SHIPPING="FREE_SHIPPING",e.DISCOUNT="DISCOUNT",e.FREE_AUTO_GIFT="FREE_AUTO_GIFT",e.FREE_GIFT_SELECT="FREE_GIFT_SELECT",e.UI_ONLY="UI_ONLY",e})(Vl||{});var Et=class e{engagementContext=Re(Cn);eventData=Re(tr);constructor(){}executeCTA(t,n){let r,i=this.engagementContext();if(!i){he.error("Engagement context is not available; aborting executeCTA.");return}if(t===ot.ADD_TO_CART)r="CE Add To Cart Clicked";else if(t===ot.GO_TO_PRODUCT)r="CE View Item Clicked";else if(t===ot.OPEN_CART)r="CE Open Cart Clicked",i.triggerData.redirectBehaviour=hi.CART_DRAWER;else{he.warn(`Unsupported CTA type: ${t}`);return}window.CooeeSDK.executeCTA(i,_({clickAction:{at:t}},n));let o=new Bs(r,this.eventData.props,i.triggerData);n?.video?o.setVideos(n.video):this.eventData.video&&o.setVideos(this.eventData.video),window.CooeeSDK.sendEvent(o)}static \u0275fac=function(n){return new(n||e)};static \u0275prov=li({token:e,factory:e.\u0275fac})};function qs(e,t){return[Et,...Ul(e,t)]}function Ul(e,t){return[{provide:Cn,useValue:Ht(e)},{provide:tr,useValue:_({},t)}]}var ir=class e{elementRef=Re(gn);engagementService=Re(Et);hasSwiper=!1;_engagementTrigger=Ht(null);_triggerContext=Re(Cn);constructor(){this.elementRef.nativeElement.update=this.update.bind(this)}get classes(){let t=["letscooee-widget"],n=this._engagementTrigger();return t.push(`widget-${n?.shortID}`),t}get triggerContext(){return this._triggerContext()}set triggerContext(t){this._triggerContext.set(t),this._engagementTrigger.set(t.triggerData),this.engagementTriggerReceived(t.triggerData)}get engagementTrigger(){return this._engagementTrigger()}ngOnInit(){he.verbose("Init",this.constructor.name);let t=this.elementRef.nativeElement.shadowRoot;t&&Ws(t,this.hasSwiper)}ngOnDestroy(){he.verbose("Destroying",this.constructor.name)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Ee({type:e,selectors:[["ng-component"]],hostVars:2,hostBindings:function(n,r){n&2&&Qn(r.classes)},inputs:{triggerContext:"triggerContext"},decls:1,vars:0,template:function(n,r){n&1&&Ns(0)},encapsulation:2})};var Bl=(e,t)=>({"--option-color":e,"background-color":t}),Ks=(e,t)=>t.id;function Hl(e,t){if(e&1&&(W(0,"span",6),ee(1),z()),e&2){B();let n=be(0);N(),_t(n)}}function Gl(e,t){if(e&1){let n=$e();je(0),W(1,"button",5),ke("click",function(){let i=Ie(n).$implicit,o=B().$implicit,s=B();return Te(s.onOptionChange(o,i))}),Q(2,Hl,2,1,"span",6),z()}if(e&2){let n=t.$implicit,r=B().$implicit,i=be(1),o=n.name,s=We(n.displayName||n.name),u=i?n.hexColor??o:"",l=B().selectedOptions()[r.name]===o;N(),yn("color-type",i)("selected",l)("disabled",n.disabled),oe("title",s)("ngStyle",er(14,Bl,u,u)),Gt("aria-checked",l?"true":"false")("data-value",o)("aria-disabled",n.disabled?"true":null)("aria-label",s),N(),Z(i?-1:2)}}function $l(e,t){if(e&1&&(W(0,"div"),je(1),W(2,"div",1),ee(3),z(),W(4,"div",2),ee(5),z(),W(6,"div",3),$t(7,Gl,3,17,"button",4,Ks),z()()),e&2){let n=t.$implicit,r=B();Qn(Ps("option-group ",n.name.toLowerCase())),N(),We(r.hasHexColors(n)),N(2),Wt("",n.name,":"),N(2),_t(r.selectedOptions()[n.name]),N(),Gt("aria-label",n.name),N(),jt(n.optionValues)}}var In=e=>e.trim().toLowerCase(),or=class e extends ir{selectedVariant=new _n;item=Se.required();selectedOptions=Ht({});options=wt(()=>{let t=this.item();if(!t.options||t.vars.length===1)return[];if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(t,this.engagementTrigger)}catch(n){he.error(n)}return t.options.forEach(n=>{n.optionValues.forEach(r=>{r.disabled=this.isOptionValueDisabledFast(n,r)})}),t.options});matchedVariant=wt(()=>{let t=this.item(),n=this.selectedOptions();return t.vars.find(r=>t.options.every(i=>{let o=r.selectedOptions.find(s=>s.name===i.name)?.value;return n[i.name]===o}))});availabilityIndex=wt(()=>{let t=this.item(),n=new Map;return t?.vars?.length&&t.vars.forEach((r,i)=>{if(r.isAvailable)for(let o of r.selectedOptions){let s=In(o.name),u=o.value,l=n.get(s);l||n.set(s,l=new Map);let h=l.get(u);h||l.set(u,h=new Set),h.add(i)}}),n});constructor(){super(),At(()=>{let n=this.matchedVariant();n&&(this.item().setSelectedVariant(n),this.selectedVariant.emit(n))});let t=At(()=>{let n=this.item();if(!n?.options)return;let r=_({},this.selectedOptions()),i=n.vars.find(o=>o.isAvailable)??n.vars[0];n.options.forEach(o=>{let s=i?.selectedOptions.find(u=>u.name===o.name)?.value;s&&(r[o.name]=s)}),this.selectedOptions.set(r),t.destroy()})}ngOnInit(){super.ngOnInit();let t=this.elementRef.nativeElement.shadowRoot;if(!t)return;let n=yt.get().website?.itemSwatchMapping;n&&mi(n,t)}onOptionChange(t,n){let r=_({},this.selectedOptions());r[t.name]=n.name,this.selectedOptions.set(r)}engagementTriggerReceived(){}update(){}hasHexColors(t){return!!t.optionValues[0]?.name.match(/#[a-f0-9]{6}\b/i)}getCandidateVariantsExcluding(t){let n=this.item(),r=this.availabilityIndex(),i=new Set;n.vars.forEach((s,u)=>{s.isAvailable&&i.add(u)});let o=i;for(let[s,u]of Object.entries(this.selectedOptions())){if(In(s)===In(t))continue;let l=r.get(In(s));if(!l)return new Set;let h=l.get(String(u));if(!h)return new Set;if(o=new Set([...o].filter(y=>h.has(y))),o.size===0)return o}return o}isOptionValueDisabledFast(t,n){let i=this.availabilityIndex().get(In(t.name));if(!i)return!0;let o=n.name,s=i.get(o);if(!s||s.size===0)return!0;let u=this.getCandidateVariantsExcluding(t.name);if(u.size===0)return!0;for(let l of u)if(s.has(l))return!1;return!0}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=Ee({type:e,selectors:[["cooee-item-options-picker"]],inputs:{item:[1,"item"]},outputs:{selectedVariant:"selectedVariant"},features:[En(qs()),pi],decls:2,vars:0,consts:[[3,"class"],[1,"name"],[1,"selected-value"],["role","radiogroup",1,"option-values"],["type","button","role","radio",1,"option-value",3,"color-type","selected","disabled","title","ngStyle"],["type","button","role","radio",1,"option-value",3,"click","title","ngStyle"],[1,"title"]],template:function(n,r){n&1&&$t(0,$l,9,7,"div",0,Ks),n&2&&jt(r.options())},dependencies:[ks,Fs,Ys],styles:[`.option-group{display:flex;gap:4px;align-items:center}.option-group+.option-group{margin-top:8px}.option-values{display:flex;flex-wrap:nowrap;overflow-x:auto;padding:6px;gap:4px;scrollbar-gutter:stable both-edges;scrollbar-width:none}.option-values::-webkit-scrollbar{display:none}.selected-value{display:none}.option-value{padding:5px 10px;border:1px solid #ccc;cursor:pointer;border-radius:4px;min-width:32px;min-height:32px;text-align:center;position:relative;flex-shrink:0;--selected-color: var(--option-color, rgba(var(--lc-primary-button-bg-color, 0 0 0)))}.option-value.selected{box-shadow:#fff 0 0 0 2px,var(--selected-color) 0 0 0 4px}.option-value.disabled{opacity:.5;pointer-events:none}
2
2
  `],encapsulation:3})};var _i=Ol(Js());function sr(e){return _i.default.createInstance({name:"lc",storeName:e,driver:_i.default.LOCALSTORAGE})}var qt=class{static storage;static async get(t,n){return await this.storage?.getItem(t)??n}static set(t,n){return this.storage?.setItem(t,n)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Tn=class Tn extends qt{};Xn(Tn,"storeName","usr"),Tn.storage=sr(Tn.storeName);var vi=Tn;function yi(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}var Fg=()=>typeof navigator<"u"&&"share"in navigator;var Kt=class{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(t){this.onResizeCallback=t,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener("resize",this.debouncedResize),window.addEventListener("orientationchange",this.handleImmediateResize)}destroy(){window.removeEventListener("resize",this.debouncedResize),window.removeEventListener("orientationchange",this.handleImmediateResize)}handleImmediateResize=()=>{this.triggerResize()};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize()},this.debounceDelay)};triggerResize(){let t=window.innerWidth,n=window.innerHeight;(n!==this.lastHeight||t!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=t,this.lastHeight=n)}};var Qs=(n=>(n.SINGLE_PANE="SINGLE_PANE",n.TWO_PANE="TWO_PANE",n))(Qs||{});var xn=class xn extends qt{};Xn(xn,"storeName","ses"),xn.storage=sr(xn.storeName);var Ei=xn;var R=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var P=globalThis;var ze="9.42.0";function Nt(){return Ot(P),P}function Ot(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||ze,t[ze]=t[ze]||{}}function st(e,t,n=P){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[ze]=r[ze]||{};return i[e]||(i[e]=t())}var bi=["debug","info","warn","error","log","assert","trace"],jl="Sentry Logger ",Xt={};function bt(e){if(!("console"in P))return e();let t=P.console,n={},r=Object.keys(Xt);r.forEach(i=>{let o=Xt[i];n[i]=t[i],t[i]=o});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function Wl(){Ci().enabled=!0}function zl(){Ci().enabled=!1}function Zs(){return Ci().enabled}function Yl(...e){Si("log",...e)}function ql(...e){Si("warn",...e)}function Kl(...e){Si("error",...e)}function Si(e,...t){R&&Zs()&&bt(()=>{P.console[e](`${jl}[${e}]:`,...t)})}function Ci(){return R?st("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var D={enable:Wl,disable:zl,isEnabled:Zs,log:Yl,warn:ql,error:Kl};var ea=/\(error: (.*)\)/,ta=/captureMessage|captureException/;function Ti(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{let o=[],s=n.split(`
3
3
  `);for(let u=r;u<s.length;u++){let l=s[u];if(l.length>1024)continue;let h=ea.test(l)?l.replace(ea,"$1"):l;if(!h.match(/\S*Error: /)){for(let y of t){let p=y(h);if(p){o.push(p);break}}if(o.length>=50+i)break}}return na(o.slice(i))}}function na(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(ar(t).function||"")&&t.pop(),t.reverse(),ta.test(ar(t).function||"")&&(t.pop(),ta.test(ar(t).function||"")&&t.pop()),t.slice(0,50).map(n=>F(_({},n),{filename:n.filename||ar(t).filename,function:n.function||"?"}))}function ar(e){return e[e.length-1]||{}}var Ii="<anonymous>";function Pe(e){try{return!e||typeof e!="function"?Ii:e.name||Ii}catch{return Ii}}function cr(e){let t=e.exception;if(t){let n=[];try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}var ur={},ra={};function _e(e,t){ur[e]=ur[e]||[],ur[e].push(t)}function ve(e,t){if(!ra[e]){ra[e]=!0;try{t()}catch(n){R&&D.error(`Error while instrumenting ${e}`,n)}}}function se(e,t){let n=e&&ur[e];if(n)for(let r of n)try{r(t)}catch(i){R&&D.error(`Error while triggering instrumentation handler.
4
4
  Type: ${e}
@@ -1 +1 @@
1
- import{g as p,o as d,p as g}from"./chunk-C4QGUG65.js";var f=(t,e,o,r)=>{if(!e)return;let n={videoID:e.id,videoIndex:o},i=new p("CE Video Shared",{current:n,platform:r},t);window.CooeeSDK.sendEvent(i)},l=(t,e,o=!0)=>{let r=o?encodeURIComponent(m(t,e)):m(t,e),n="Hey! Check out this video for an amazing product -",i=o?encodeURIComponent(n):n;return{url:r,text:i}},m=(t,e)=>{let o=d(window.location.href,t);return g(o,e)};export{f as a,l as b};
1
+ import{g as p,o as d,p as g}from"./chunk-XJRPLKLE.js";var f=(t,e,o,r)=>{if(!e)return;let n={videoID:e.id,videoIndex:o},i=new p("CE Video Shared",{current:n,platform:r},t);window.CooeeSDK.sendEvent(i)},l=(t,e,o=!0)=>{let r=o?encodeURIComponent(m(t,e)):m(t,e),n="Hey! Check out this video for an amazing product -",i=o?encodeURIComponent(n):n;return{url:r,text:i}},m=(t,e)=>{let o=d(window.location.href,t);return g(o,e)};export{f as a,l as b};
@@ -1,4 +1,4 @@
1
- import{$ as Qt,Aa as Ti,Ab as Ui,B as q,Bb as ji,C as W,Cb as ee,Db as ot,E as Zt,Eb as it,Ga as Ci,Gb as ie,H as Kt,Ha as Di,Hb as xt,I as ut,Ia as Ii,Ib as Vi,J as Oi,Jb as Bt,K as Si,Kb as Hi,Lb as $i,Mb as re,R as Jt,T as Et,U as qt,V as Ce,W as De,X as lt,Z as Rt,a as di,ba as Ai,c as Y,ca as bt,d as gi,da as Q,ea as ft,fa as Ni,g as _i,ga as te,hb as Ri,i as yi,ib as xi,kb as Bi,l as mi,m as vi,n as wi,nb as Li,o as Ei,q as bi,qb as Pi,rb as Mi,s as V,u as G,v as S,w as Gt,yb as ki,zb as Fi}from"./chunk-KHVPWQ5E.js";import{a as U,b as pi,e as Ne,f as Te}from"./chunk-V7UGKYBN.js";var Xi=Ne((Wi,ae)=>{"use strict";(function(e){"use strict";var t={};t.VERSION="1.6.1";var i,r={},s=function(d,g){return function(){return g.apply(d,arguments)}},l=function(){var d=arguments,g=d[0],_,v;for(v=1;v<d.length;v++)for(_ in d[v])!(_ in g)&&d[v].hasOwnProperty(_)&&(g[_]=d[v][_]);return g},a=function(d,g){return{value:d,name:g}};t.TRACE=a(1,"TRACE"),t.DEBUG=a(2,"DEBUG"),t.INFO=a(3,"INFO"),t.TIME=a(4,"TIME"),t.WARN=a(5,"WARN"),t.ERROR=a(8,"ERROR"),t.OFF=a(99,"OFF");var f=function(d){this.context=d,this.setLevel(d.filterLevel),this.log=this.info};f.prototype={setLevel:function(d){d&&"value"in d&&(this.context.filterLevel=d)},getLevel:function(){return this.context.filterLevel},enabledFor:function(d){var g=this.context.filterLevel;return d.value>=g.value},trace:function(){this.invoke(t.TRACE,arguments)},debug:function(){this.invoke(t.DEBUG,arguments)},info:function(){this.invoke(t.INFO,arguments)},warn:function(){this.invoke(t.WARN,arguments)},error:function(){this.invoke(t.ERROR,arguments)},time:function(d){typeof d=="string"&&d.length>0&&this.invoke(t.TIME,[d,"start"])},timeEnd:function(d){typeof d=="string"&&d.length>0&&this.invoke(t.TIME,[d,"end"])},invoke:function(d,g){i&&this.enabledFor(d)&&i(g,l({level:d},this.context))}};var p=new f({filterLevel:t.OFF});(function(){var d=t;d.enabledFor=s(p,p.enabledFor),d.trace=s(p,p.trace),d.debug=s(p,p.debug),d.time=s(p,p.time),d.timeEnd=s(p,p.timeEnd),d.info=s(p,p.info),d.warn=s(p,p.warn),d.error=s(p,p.error),d.log=d.info})(),t.setHandler=function(d){i=d},t.setLevel=function(d){p.setLevel(d);for(var g in r)r.hasOwnProperty(g)&&r[g].setLevel(d)},t.getLevel=function(){return p.getLevel()},t.get=function(d){return r[d]||(r[d]=new f(l({name:d},p.context)))},t.createDefaultHandler=function(d){d=d||{},d.formatter=d.formatter||function(E,w){w.name&&E.unshift("["+w.name+"]")};var g={},_=function(v,E){Function.prototype.apply.call(v,console,E)};return typeof console>"u"?function(){}:function(v,E){v=Array.prototype.slice.call(v);var w=console.log,A;E.level===t.TIME?(A=(E.name?"["+E.name+"] ":"")+v[0],v[1]==="start"?console.time?console.time(A):g[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):_(w,[A+": "+(new Date().getTime()-g[A])+"ms"])):(E.level===t.WARN&&console.warn?w=console.warn:E.level===t.ERROR&&console.error?w=console.error:E.level===t.INFO&&console.info?w=console.info:E.level===t.DEBUG&&console.debug?w=console.debug:E.level===t.TRACE&&console.trace&&(w=console.trace),d.formatter(v,E),_(w,v))}},t.useDefaults=function(d){t.setLevel(d&&d.defaultLevel||t.DEBUG),t.setHandler(t.createDefaultHandler(d))},t.setDefaults=t.useDefaults,typeof define=="function"&&define.amd?define(t):typeof ae<"u"&&ae.exports?ae.exports=t:(t._prevLogger=e.Logger,t.noConflict=function(){return e.Logger=t._prevLogger,t},e.Logger=t)})(Wi)});var Fr=Ne((ni,oi)=>{"use strict";(function(e,t){typeof ni=="object"&&typeof oi<"u"?oi.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.fetchRetry=t())})(ni,function(){"use strict";var e=function(r,s){if(s=s||{},typeof r!="function")throw new i("fetch must be a function");if(typeof s!="object")throw new i("defaults must be an object");if(s.retries!==void 0&&!t(s.retries))throw new i("retries must be a positive integer");if(s.retryDelay!==void 0&&!t(s.retryDelay)&&typeof s.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(s.retryOn!==void 0&&!Array.isArray(s.retryOn)&&typeof s.retryOn!="function")throw new i("retryOn property expects an array or function");var l={retries:3,retryDelay:1e3,retryOn:[]};return s=Object.assign(l,s),function(f,p){var d=s.retries,g=s.retryDelay,_=s.retryOn;if(p&&p.retries!==void 0)if(t(p.retries))d=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(t(p.retryDelay)||typeof p.retryDelay=="function")g=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")_=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,E){var w=function(D){var L=typeof Request<"u"&&f instanceof Request?f.clone():f;r(L,p).then(function(N){if(Array.isArray(_)&&_.indexOf(N.status)===-1)v(N);else if(typeof _=="function")try{return Promise.resolve(_(D,null,N)).then(function(B){B?A(D,null,N):v(N)}).catch(E)}catch(B){E(B)}else D<d?A(D,null,N):v(N)}).catch(function(N){if(typeof _=="function")try{Promise.resolve(_(D,N,null)).then(function(B){B?A(D,N,null):E(N)}).catch(function(B){E(B)})}catch(B){E(B)}else D<d?A(D,N,null):E(N)})};function A(D,L,N){var B=typeof g=="function"?g(D,L,N):g;setTimeout(function(){w(++D)},B)}w(0)})}};function t(r){return Number.isInteger(r)&&r>=0}function i(r){this.name="ArgumentError",this.message=r}return e})});var Hr=Ne(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.URLBuilder=void 0;var bo=(function(){function e(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return e.prototype.appendQueryParam=function(t,i){this.params.append(t,i?i.toString():"")},e.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},e.prototype.deleteQueryParam=function(t){this.params.delete(t)},e.prototype.getBase=function(){return this.base},e.prototype.getPath=function(){return this.base.pathname},e.prototype.getHostname=function(){return this.base.hostname},e.prototype.getParams=function(){return this.params},e.prototype.getQueryParam=function(t){if(!this.params)return"";var i=this.params.get(t);return!i||i==="undefined"||i==="null"?void 0:i},e.prototype.getQueryString=function(){return this.params.toString()},e.prototype.setPath=function(t){return this.base.pathname=t,this},e.prototype.setQueryParam=function(t,i){return this.params.set(t,i?i.toString():""),this},e.prototype.setQueryString=function(t){if(t)return t[0]==="?"&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},e.prototype.toString=function(){var t=this.params.toString();return t===""?this.base.search="":this.base.search="?"+t,this.base.toString()},e})();Ee.URLBuilder=bo});var Ie="11.5.2";var Jr=Ie.split("-")[0].split(".").slice(0,3).map(e=>e.padStart(2,"0")).join("");var Yi="CooeeSDK",ne=Ie,To=parseInt(Jr,10);var oe=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${ne}/dist`,se={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:oe,styleURL:`${oe}/widget.min.css`,widgetURL:`${oe}/widget.min.js`,swiperStyleURL:`${oe}/swiper-bundle.min.css`};var X=Te(Xi());var Lt=class{static debuggerEl;static infoLogs=[];static log(...t){X.default.info(...t)}static verbose(...t){X.default.debug(...t)}static error(...t){X.default.error(...t)}static warn(...t){X.default.warn(...t)}static info(...t){X.default.info(...t),this.infoLogs.unshift({time:new Date,message:t.join(" ")}),this.addToDebugger()}static trace(...t){X.default.trace(...t)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function Bo(e=Yi){X.default.useDefaults({formatter:function(i){i.unshift(`${e} (v${ne}):`)}});let t=qr();(t==="1"||t==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?X.default.setLevel(X.default[localStorage.cooeeLogLevel]):X.default.setLevel(se.debug?X.default.TRACE:X.default.OFF)}function qr(){return new URL(location.href).searchParams?.get("cooee-debug")}var ko=new G("EngagementContext"),Fo=new G("EventData");function Qr(e,t){return t={exports:{}},e(t,t.exports),t.exports}var tn=on,en=an,rn=hn,nt=[],K=[],nn=typeof Uint8Array<"u"?Uint8Array:Array,Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pt=0,zi=Re.length;pt<zi;++pt)nt[pt]=Re[pt],K[Re.charCodeAt(pt)]=pt;var pt,zi;K[45]=62;K[95]=63;function lr(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");i===-1&&(i=t);var r=i===t?0:4-i%4;return[i,r]}function on(e){var t=lr(e),i=t[0],r=t[1];return(i+r)*3/4-r}function sn(e,t,i){return(t+i)*3/4-i}function an(e){var t,i=lr(e),r=i[0],s=i[1],l=new nn(sn(e,r,s)),a=0,f=s>0?r-4:r,p;for(p=0;p<f;p+=4)t=K[e.charCodeAt(p)]<<18|K[e.charCodeAt(p+1)]<<12|K[e.charCodeAt(p+2)]<<6|K[e.charCodeAt(p+3)],l[a++]=t>>16&255,l[a++]=t>>8&255,l[a++]=t&255;return s===2&&(t=K[e.charCodeAt(p)]<<2|K[e.charCodeAt(p+1)]>>4,l[a++]=t&255),s===1&&(t=K[e.charCodeAt(p)]<<10|K[e.charCodeAt(p+1)]<<4|K[e.charCodeAt(p+2)]>>2,l[a++]=t>>8&255,l[a++]=t&255),l}function cn(e){return nt[e>>18&63]+nt[e>>12&63]+nt[e>>6&63]+nt[e&63]}function ln(e,t,i){for(var r,s=[],l=t;l<i;l+=3)r=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(e[l+2]&255),s.push(cn(r));return s.join("")}function hn(e){for(var t,i=e.length,r=i%3,s=[],l=16383,a=0,f=i-r;a<f;a+=l)s.push(ln(e,a,a+l>f?f:a+l));return r===1?(t=e[i-1],s.push(nt[t>>2]+nt[t<<4&63]+"==")):r===2&&(t=(e[i-2]<<8)+e[i-1],s.push(nt[t>>10]+nt[t>>4&63]+nt[t<<2&63]+"=")),s.join("")}var xe={byteLength:tn,toByteArray:en,fromByteArray:rn};var un=function(t,i,r,s,l){var a,f,p=l*8-s-1,d=(1<<p)-1,g=d>>1,_=-7,v=r?l-1:0,E=r?-1:1,w=t[i+v];for(v+=E,a=w&(1<<-_)-1,w>>=-_,_+=p;_>0;a=a*256+t[i+v],v+=E,_-=8);for(f=a&(1<<-_)-1,a>>=-_,_+=s;_>0;f=f*256+t[i+v],v+=E,_-=8);if(a===0)a=1-g;else{if(a===d)return f?NaN:(w?-1:1)*(1/0);f=f+Math.pow(2,s),a=a-g}return(w?-1:1)*f*Math.pow(2,a-s)},fn=function(t,i,r,s,l,a){var f,p,d,g=a*8-l-1,_=(1<<g)-1,v=_>>1,E=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=s?0:a-1,A=s?1:-1,D=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(p=isNaN(i)?1:0,f=_):(f=Math.floor(Math.log(i)/Math.LN2),i*(d=Math.pow(2,-f))<1&&(f--,d*=2),f+v>=1?i+=E/d:i+=E*Math.pow(2,1-v),i*d>=2&&(f++,d/=2),f+v>=_?(p=0,f=_):f+v>=1?(p=(i*d-1)*Math.pow(2,l),f=f+v):(p=i*Math.pow(2,v-1)*Math.pow(2,l),f=0));l>=8;t[r+w]=p&255,w+=A,p/=256,l-=8);for(f=f<<l|p,g+=l;g>0;t[r+w]=f&255,w+=A,f/=256,g-=8);t[r+w-A]|=D*128},Ot={read:un,write:fn},he=Qr(function(e,t){var i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var r=2147483647;t.kMaxLength=r,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var c=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(c,n),c.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function l(c){if(c>r)throw new RangeError('The value "'+c+'" is invalid for option "size"');var n=new Uint8Array(c);return Object.setPrototypeOf(n,a.prototype),n}function a(c,n,o){if(typeof c=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return f(c,n,o)}a.poolSize=8192;function f(c,n,o){if(typeof c=="string")return _(c,n);if(ArrayBuffer.isView(c))return E(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c));if(et(c,ArrayBuffer)||c&&et(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(et(c,SharedArrayBuffer)||c&&et(c.buffer,SharedArrayBuffer)))return w(c,n,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var h=c.valueOf&&c.valueOf();if(h!=null&&h!==c)return a.from(h,n,o);var u=A(c);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return a.from(c[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c))}a.from=function(c,n,o){return f(c,n,o)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function p(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function d(c,n,o){return p(c),c<=0?l(c):n!==void 0?typeof o=="string"?l(c).fill(n,o):l(c).fill(n):l(c)}a.alloc=function(c,n,o){return d(c,n,o)};function g(c){return p(c),l(c<0?0:D(c)|0)}a.allocUnsafe=function(c){return g(c)},a.allocUnsafeSlow=function(c){return g(c)};function _(c,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=N(c,n)|0,h=l(o),u=h.write(c,n);return u!==o&&(h=h.slice(0,u)),h}function v(c){for(var n=c.length<0?0:D(c.length)|0,o=l(n),h=0;h<n;h+=1)o[h]=c[h]&255;return o}function E(c){if(et(c,Uint8Array)){var n=new Uint8Array(c);return w(n.buffer,n.byteOffset,n.byteLength)}return v(c)}function w(c,n,o){if(n<0||c.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');var h;return n===void 0&&o===void 0?h=new Uint8Array(c):o===void 0?h=new Uint8Array(c,n):h=new Uint8Array(c,n,o),Object.setPrototypeOf(h,a.prototype),h}function A(c){if(a.isBuffer(c)){var n=D(c.length)|0,o=l(n);return o.length===0||c.copy(o,0,0,n),o}if(c.length!==void 0)return typeof c.length!="number"||Ae(c.length)?l(0):v(c);if(c.type==="Buffer"&&Array.isArray(c.data))return v(c.data)}function D(c){if(c>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return c|0}function L(c){return+c!=c&&(c=0),a.alloc(+c)}a.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==a.prototype},a.compare=function(n,o){if(et(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),et(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),!a.isBuffer(n)||!a.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;for(var h=n.length,u=o.length,y=0,m=Math.min(h,u);y<m;++y)if(n[y]!==o[y]){h=n[y],u=o[y];break}return h<u?-1:u<h?1:0},a.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return a.alloc(0);var h;if(o===void 0)for(o=0,h=0;h<n.length;++h)o+=n[h].length;var u=a.allocUnsafe(o),y=0;for(h=0;h<n.length;++h){var m=n[h];if(et(m,Uint8Array))y+m.length>u.length?a.from(m).copy(u,y):Uint8Array.prototype.set.call(u,m,y);else if(a.isBuffer(m))m.copy(u,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=m.length}return u};function N(c,n){if(a.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||et(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(c));var o=c.length,h=arguments.length>2&&arguments[2]===!0;if(!h&&o===0)return 0;for(var u=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Se(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return hi(c).length;default:if(u)return h?-1:Se(c).length;n=(""+n).toLowerCase(),u=!0}}a.byteLength=N;function B(c,n,o){var h=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(c||(c="utf8");;)switch(c){case"hex":return J(this,n,o);case"utf8":case"utf-8":return vt(this,n,o);case"ascii":return wt(this,n,o);case"latin1":case"binary":return M(this,n,o);case"base64":return mt(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,n,o);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),h=!0}}a.prototype._isBuffer=!0;function O(c,n,o){var h=c[n];c[n]=c[o],c[o]=h}a.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)O(this,o,o+1);return this},a.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)O(this,o,o+3),O(this,o+1,o+2);return this},a.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)O(this,o,o+7),O(this,o+1,o+6),O(this,o+2,o+5),O(this,o+3,o+4);return this},a.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?vt(this,0,n):B.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(n){if(!a.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:a.compare(this,n)===0},a.prototype.inspect=function(){var n="",o=t.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(n,o,h,u,y){if(et(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(n));if(o===void 0&&(o=0),h===void 0&&(h=n?n.length:0),u===void 0&&(u=0),y===void 0&&(y=this.length),o<0||h>n.length||u<0||y>this.length)throw new RangeError("out of range index");if(u>=y&&o>=h)return 0;if(u>=y)return-1;if(o>=h)return 1;if(o>>>=0,h>>>=0,u>>>=0,y>>>=0,this===n)return 0;for(var m=y-u,C=h-o,x=Math.min(m,C),P=this.slice(u,y),j=n.slice(o,h),k=0;k<x;++k)if(P[k]!==j[k]){m=P[k],C=j[k];break}return m<C?-1:C<m?1:0};function z(c,n,o,h,u){if(c.length===0)return-1;if(typeof o=="string"?(h=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Ae(o)&&(o=u?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(u)return-1;o=c.length-1}else if(o<0)if(u)o=0;else return-1;if(typeof n=="string"&&(n=a.from(n,h)),a.isBuffer(n))return n.length===0?-1:tt(c,n,o,h,u);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(c,n,o):Uint8Array.prototype.lastIndexOf.call(c,n,o):tt(c,[n],o,h,u);throw new TypeError("val must be string, number or Buffer")}function tt(c,n,o,h,u){var y=1,m=c.length,C=n.length;if(h!==void 0&&(h=String(h).toLowerCase(),h==="ucs2"||h==="ucs-2"||h==="utf16le"||h==="utf-16le")){if(c.length<2||n.length<2)return-1;y=2,m/=2,C/=2,o/=2}function x(ui,fi){return y===1?ui[fi]:ui.readUInt16BE(fi*y)}var P;if(u){var j=-1;for(P=o;P<m;P++)if(x(c,P)===x(n,j===-1?0:P-j)){if(j===-1&&(j=P),P-j+1===C)return j*y}else j!==-1&&(P-=P-j),j=-1}else for(o+C>m&&(o=m-C),P=o;P>=0;P--){for(var k=!0,zt=0;zt<C;zt++)if(x(c,P+zt)!==x(n,zt)){k=!1;break}if(k)return P}return-1}a.prototype.includes=function(n,o,h){return this.indexOf(n,o,h)!==-1},a.prototype.indexOf=function(n,o,h){return z(this,n,o,h,!0)},a.prototype.lastIndexOf=function(n,o,h){return z(this,n,o,h,!1)};function at(c,n,o,h){o=Number(o)||0;var u=c.length-o;h?(h=Number(h),h>u&&(h=u)):h=u;var y=n.length;h>y/2&&(h=y/2);for(var m=0;m<h;++m){var C=parseInt(n.substr(m*2,2),16);if(Ae(C))return m;c[o+m]=C}return m}function be(c,n,o,h){return Xt(Se(n,c.length-o),c,o,h)}function It(c,n,o,h){return Xt(zr(n),c,o,h)}function Oe(c,n,o,h){return Xt(hi(n),c,o,h)}function Yt(c,n,o,h){return Xt(Gr(n,c.length-o),c,o,h)}a.prototype.write=function(n,o,h,u){if(o===void 0)u="utf8",h=this.length,o=0;else if(h===void 0&&typeof o=="string")u=o,h=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(h)?(h=h>>>0,u===void 0&&(u="utf8")):(u=h,h=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var y=this.length-o;if((h===void 0||h>y)&&(h=y),n.length>0&&(h<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");u||(u="utf8");for(var m=!1;;)switch(u){case"hex":return at(this,n,o,h);case"utf8":case"utf-8":return be(this,n,o,h);case"ascii":case"latin1":case"binary":return It(this,n,o,h);case"base64":return Oe(this,n,o,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Yt(this,n,o,h);default:if(m)throw new TypeError("Unknown encoding: "+u);u=(""+u).toLowerCase(),m=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mt(c,n,o){return n===0&&o===c.length?xe.fromByteArray(c):xe.fromByteArray(c.slice(n,o))}function vt(c,n,o){o=Math.min(c.length,o);for(var h=[],u=n;u<o;){var y=c[u],m=null,C=y>239?4:y>223?3:y>191?2:1;if(u+C<=o){var x,P,j,k;switch(C){case 1:y<128&&(m=y);break;case 2:x=c[u+1],(x&192)===128&&(k=(y&31)<<6|x&63,k>127&&(m=k));break;case 3:x=c[u+1],P=c[u+2],(x&192)===128&&(P&192)===128&&(k=(y&15)<<12|(x&63)<<6|P&63,k>2047&&(k<55296||k>57343)&&(m=k));break;case 4:x=c[u+1],P=c[u+2],j=c[u+3],(x&192)===128&&(P&192)===128&&(j&192)===128&&(k=(y&15)<<18|(x&63)<<12|(P&63)<<6|j&63,k>65535&&k<1114112&&(m=k))}}m===null?(m=65533,C=1):m>65535&&(m-=65536,h.push(m>>>10&1023|55296),m=56320|m&1023),h.push(m),u+=C}return Wt(h)}var ct=4096;function Wt(c){var n=c.length;if(n<=ct)return String.fromCharCode.apply(String,c);for(var o="",h=0;h<n;)o+=String.fromCharCode.apply(String,c.slice(h,h+=ct));return o}function wt(c,n,o){var h="";o=Math.min(c.length,o);for(var u=n;u<o;++u)h+=String.fromCharCode(c[u]&127);return h}function M(c,n,o){var h="";o=Math.min(c.length,o);for(var u=n;u<o;++u)h+=String.fromCharCode(c[u]);return h}function J(c,n,o){var h=c.length;(!n||n<0)&&(n=0),(!o||o<0||o>h)&&(o=h);for(var u="",y=n;y<o;++y)u+=Zr[c[y]];return u}function I(c,n,o){for(var h=c.slice(n,o),u="",y=0;y<h.length-1;y+=2)u+=String.fromCharCode(h[y]+h[y+1]*256);return u}a.prototype.slice=function(n,o){var h=this.length;n=~~n,o=o===void 0?h:~~o,n<0?(n+=h,n<0&&(n=0)):n>h&&(n=h),o<0?(o+=h,o<0&&(o=0)):o>h&&(o=h),o<n&&(o=n);var u=this.subarray(n,o);return Object.setPrototypeOf(u,a.prototype),u};function T(c,n,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+n>o)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=this[n],y=1,m=0;++m<o&&(y*=256);)u+=this[n+m]*y;return u},a.prototype.readUintBE=a.prototype.readUIntBE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=this[n+--o],y=1;o>0&&(y*=256);)u+=this[n+--o]*y;return u},a.prototype.readUint8=a.prototype.readUInt8=function(n,o){return n=n>>>0,o||T(n,1,this.length),this[n]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||T(n,2,this.length),this[n]|this[n+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||T(n,2,this.length),this[n]<<8|this[n+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||T(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||T(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},a.prototype.readIntLE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=this[n],y=1,m=0;++m<o&&(y*=256);)u+=this[n+m]*y;return y*=128,u>=y&&(u-=Math.pow(2,8*o)),u},a.prototype.readIntBE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=o,y=1,m=this[n+--u];u>0&&(y*=256);)m+=this[n+--u]*y;return y*=128,m>=y&&(m-=Math.pow(2,8*o)),m},a.prototype.readInt8=function(n,o){return n=n>>>0,o||T(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},a.prototype.readInt16LE=function(n,o){n=n>>>0,o||T(n,2,this.length);var h=this[n]|this[n+1]<<8;return h&32768?h|4294901760:h},a.prototype.readInt16BE=function(n,o){n=n>>>0,o||T(n,2,this.length);var h=this[n+1]|this[n]<<8;return h&32768?h|4294901760:h},a.prototype.readInt32LE=function(n,o){return n=n>>>0,o||T(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},a.prototype.readInt32BE=function(n,o){return n=n>>>0,o||T(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},a.prototype.readFloatLE=function(n,o){return n=n>>>0,o||T(n,4,this.length),Ot.read(this,n,!0,23,4)},a.prototype.readFloatBE=function(n,o){return n=n>>>0,o||T(n,4,this.length),Ot.read(this,n,!1,23,4)},a.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||T(n,8,this.length),Ot.read(this,n,!0,52,8)},a.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||T(n,8,this.length),Ot.read(this,n,!1,52,8)};function $(c,n,o,h,u,y){if(!a.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>u||n<y)throw new RangeError('"value" argument is out of bounds');if(o+h>c.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(n,o,h,u){if(n=+n,o=o>>>0,h=h>>>0,!u){var y=Math.pow(2,8*h)-1;$(this,n,o,h,y,0)}var m=1,C=0;for(this[o]=n&255;++C<h&&(m*=256);)this[o+C]=n/m&255;return o+h},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(n,o,h,u){if(n=+n,o=o>>>0,h=h>>>0,!u){var y=Math.pow(2,8*h)-1;$(this,n,o,h,y,0)}var m=h-1,C=1;for(this[o+m]=n&255;--m>=0&&(C*=256);)this[o+m]=n/C&255;return o+h},a.prototype.writeUint8=a.prototype.writeUInt8=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,1,255,0),this[o]=n&255,o+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},a.prototype.writeIntLE=function(n,o,h,u){if(n=+n,o=o>>>0,!u){var y=Math.pow(2,8*h-1);$(this,n,o,h,y-1,-y)}var m=0,C=1,x=0;for(this[o]=n&255;++m<h&&(C*=256);)n<0&&x===0&&this[o+m-1]!==0&&(x=1),this[o+m]=(n/C>>0)-x&255;return o+h},a.prototype.writeIntBE=function(n,o,h,u){if(n=+n,o=o>>>0,!u){var y=Math.pow(2,8*h-1);$(this,n,o,h,y-1,-y)}var m=h-1,C=1,x=0;for(this[o+m]=n&255;--m>=0&&(C*=256);)n<0&&x===0&&this[o+m+1]!==0&&(x=1),this[o+m]=(n/C>>0)-x&255;return o+h},a.prototype.writeInt8=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},a.prototype.writeInt16LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},a.prototype.writeInt16BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},a.prototype.writeInt32LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},a.prototype.writeInt32BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function ai(c,n,o,h,u,y){if(o+h>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function ci(c,n,o,h,u){return n=+n,o=o>>>0,u||ai(c,n,o,4),Ot.write(c,n,o,h,23,4),o+4}a.prototype.writeFloatLE=function(n,o,h){return ci(this,n,o,!0,h)},a.prototype.writeFloatBE=function(n,o,h){return ci(this,n,o,!1,h)};function li(c,n,o,h,u){return n=+n,o=o>>>0,u||ai(c,n,o,8),Ot.write(c,n,o,h,52,8),o+8}a.prototype.writeDoubleLE=function(n,o,h){return li(this,n,o,!0,h)},a.prototype.writeDoubleBE=function(n,o,h){return li(this,n,o,!1,h)},a.prototype.copy=function(n,o,h,u){if(!a.isBuffer(n))throw new TypeError("argument should be a Buffer");if(h||(h=0),!u&&u!==0&&(u=this.length),o>=n.length&&(o=n.length),o||(o=0),u>0&&u<h&&(u=h),u===h||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(h<0||h>=this.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("sourceEnd out of bounds");u>this.length&&(u=this.length),n.length-o<u-h&&(u=n.length-o+h);var y=u-h;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,h,u):Uint8Array.prototype.set.call(n,this.subarray(h,u),o),y},a.prototype.fill=function(n,o,h,u){if(typeof n=="string"){if(typeof o=="string"?(u=o,o=0,h=this.length):typeof h=="string"&&(u=h,h=this.length),u!==void 0&&typeof u!="string")throw new TypeError("encoding must be a string");if(typeof u=="string"&&!a.isEncoding(u))throw new TypeError("Unknown encoding: "+u);if(n.length===1){var y=n.charCodeAt(0);(u==="utf8"&&y<128||u==="latin1")&&(n=y)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<h)throw new RangeError("Out of range index");if(h<=o)return this;o=o>>>0,h=h===void 0?this.length:h>>>0,n||(n=0);var m;if(typeof n=="number")for(m=o;m<h;++m)this[m]=n;else{var C=a.isBuffer(n)?n:a.from(n,u),x=C.length;if(x===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(m=0;m<h-o;++m)this[m+o]=C[m%x]}return this};var Wr=/[^+/0-9A-Za-z-_]/g;function Xr(c){if(c=c.split("=")[0],c=c.trim().replace(Wr,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Se(c,n){n=n||1/0;for(var o,h=c.length,u=null,y=[],m=0;m<h;++m){if(o=c.charCodeAt(m),o>55295&&o<57344){if(!u){if(o>56319){(n-=3)>-1&&y.push(239,191,189);continue}else if(m+1===h){(n-=3)>-1&&y.push(239,191,189);continue}u=o;continue}if(o<56320){(n-=3)>-1&&y.push(239,191,189),u=o;continue}o=(u-55296<<10|o-56320)+65536}else u&&(n-=3)>-1&&y.push(239,191,189);if(u=null,o<128){if((n-=1)<0)break;y.push(o)}else if(o<2048){if((n-=2)<0)break;y.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;y.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;y.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return y}function zr(c){for(var n=[],o=0;o<c.length;++o)n.push(c.charCodeAt(o)&255);return n}function Gr(c,n){for(var o,h,u,y=[],m=0;m<c.length&&!((n-=2)<0);++m)o=c.charCodeAt(m),h=o>>8,u=o%256,y.push(u),y.push(h);return y}function hi(c){return xe.toByteArray(Xr(c))}function Xt(c,n,o,h){for(var u=0;u<h&&!(u+o>=n.length||u>=c.length);++u)n[u+o]=c[u];return u}function et(c,n){return c instanceof n||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===n.name}function Ae(c){return c!==c}var Zr=(function(){for(var c="0123456789abcdef",n=new Array(256),o=0;o<16;++o)for(var h=o*16,u=0;u<16;++u)n[h+u]=c[o]+c[u];return n})()}),R=he.Buffer;he.SlowBuffer;he.INSPECT_MAX_BYTES;he.kMaxLength;var ke=function(t,i){return ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l])},ke(t,i)};function ue(e,t){ke(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var gt=(function(e){ue(t,e);function t(i){var r=e.call(this,i)||this;return Object.setPrototypeOf(r,t.prototype),r}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t})(Error),F=(function(e){ue(t,e);function t(i){var r=e.call(this,i)||this;return Object.setPrototypeOf(r,t.prototype),r}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t})(TypeError);function ce(e){return e&&e.Math==Math&&e}function hr(){return ce(typeof globalThis=="object"&&globalThis)||ce(typeof window=="object"&&window)||ce(typeof self=="object"&&self)||ce(typeof global=="object"&&global)||Function("return this")()}function pn(){var e=hr();return typeof e.navigator=="object"&&e.navigator.product==="ReactNative"}var dn=function(t){var i=pn()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(i);for(var r=R.alloc(t),s=0;s<t;++s)r[s]=Math.floor(Math.random()*256);return r},gn=function(){{if(typeof window<"u"){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(R.alloc(t))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(R.alloc(t))}:dn}},ur=gn();function _n(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function Ue(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function yn(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function mn(e){return Ft(e)&&Object.prototype.toString.call(e)==="[object Date]"}function Ft(e){return typeof e=="object"&&e!==null}function fe(e,t){var i=!1;function r(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return i||(console.warn(t),i=!0),e.apply(this,s)}return r}function le(e){if(ArrayBuffer.isView(e))return R.from(e.buffer,e.byteOffset,e.byteLength);if(_n(e))return R.from(e);throw new F("Must use either Buffer or TypedArray")}var vn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,fr=function(e){return typeof e=="string"&&vn.test(e)},Fe=function(e){if(!fr(e))throw new F('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return R.from(t,"hex")},Gi=function(e,t){return t===void 0&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")};var jo=Math.pow(2,63)-1,Vo=-Math.pow(2,63),wn=Math.pow(2,53),En=-Math.pow(2,53);var pr=4;var _t=(function(){function e(t,i){if(!(this instanceof e))return new e(t,i);if(t!=null&&typeof t!="string"&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new F("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=i??e.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=R.alloc(e.BUFFER_SIZE),this.position=0):(typeof t=="string"?this.buffer=R.from(t,"binary"):Array.isArray(t)?this.buffer=R.from(t):this.buffer=le(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if(typeof t=="string"&&t.length!==1)throw new F("only accepts single character String");if(typeof t!="number"&&t.length!==1)throw new F("only accepts single character Uint8Array or Array");var i;if(typeof t=="string"?i=t.charCodeAt(0):typeof t=="number"?i=t:i=t[0],i<0||i>255)throw new F("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=i;else{var r=R.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=i}},e.prototype.write=function(t,i){if(i=typeof i=="number"?i:this.position,this.buffer.length<i+t.length){var r=R.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(le(t),i),this.position=i+t.byteLength>this.position?i+t.length:this.position):typeof t=="string"&&(this.buffer.write(t,i,t.length,"binary"),this.position=i+t.length>this.position?i+t.length:this.position)},e.prototype.read=function(t,i){return i=i&&i>0?i:this.position,this.buffer.slice(t,t+i)},e.prototype.value=function(t){return t=!!t,t&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(t){return this.buffer.toString(t)},e.prototype.toExtendedJSON=function(t){t=t||{};var i=this.buffer.toString("base64"),r=Number(this.sub_type).toString(16);return t.legacy?{$binary:i,$type:r.length===1?"0"+r:r}:{$binary:{base64:i,subType:r.length===1?"0"+r:r}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new Zi(this.buffer.slice(0,this.position));throw new gt('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,i){i=i||{};var r,s;if("$binary"in t?i.legacy&&typeof t.$binary=="string"&&"$type"in t?(s=t.$type?parseInt(t.$type,16):0,r=R.from(t.$binary,"base64")):typeof t.$binary!="string"&&(s=t.$binary.subType?parseInt(t.$binary.subType,16):0,r=R.from(t.$binary.base64,"base64")):"$uuid"in t&&(s=4,r=Fe(t.$uuid)),!r)throw new F("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return s===pr?new Zi(r):new e(r,s)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e})();Object.defineProperty(_t.prototype,"_bsontype",{value:"Binary"});var Be=16,Zi=(function(e){ue(t,e);function t(i){var r=this,s,l;if(i==null)s=t.generate();else if(i instanceof t)s=R.from(i.buffer),l=i.__id;else if(ArrayBuffer.isView(i)&&i.byteLength===Be)s=le(i);else if(typeof i=="string")s=Fe(i);else throw new F("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return r=e.call(this,s,pr)||this,r.__id=l,r}return Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer},set:function(i){this.buffer=i,t.cacheHexString&&(this.__id=Gi(i))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(i){if(i===void 0&&(i=!0),t.cacheHexString&&this.__id)return this.__id;var r=Gi(this.id,i);return t.cacheHexString&&(this.__id=r),r},t.prototype.toString=function(i){return i?this.id.toString(i):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(i){if(!i)return!1;if(i instanceof t)return i.id.equals(this.id);try{return new t(i).id.equals(this.id)}catch{return!1}},t.prototype.toBinary=function(){return new _t(this.id,_t.SUBTYPE_UUID)},t.generate=function(){var i=ur(Be);return i[6]=i[6]&15|64,i[8]=i[8]&63|128,R.from(i)},t.isValid=function(i){return i?i instanceof t?!0:typeof i=="string"?fr(i):Ue(i)?i.length!==Be?!1:(i[6]&240)===64&&(i[8]&128)===128:!1:!1},t.createFromHexString=function(i){var r=Fe(i);return new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t})(_t),pe=(function(){function e(t,i){if(!(this instanceof e))return new e(t,i);this.code=t,this.scope=i}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},e})();Object.defineProperty(pe.prototype,"_bsontype",{value:"Code"});function bn(e){return Ft(e)&&e.$id!=null&&typeof e.$ref=="string"&&(e.$db==null||typeof e.$db=="string")}var Mt=(function(){function e(t,i,r,s){if(!(this instanceof e))return new e(t,i,r,s);var l=t.split(".");l.length===2&&(r=l.shift(),t=l.shift()),this.collection=t,this.oid=i,this.db=r,this.fields=s||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},e.prototype.toExtendedJSON=function(t){t=t||{};var i={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(i.$db=this.db),i=Object.assign(i,this.fields)),i},e.fromExtendedJSON=function(t){var i=Object.assign({},t);return delete i.$ref,delete i.$id,delete i.$db,new e(t.$ref,t.$id,t.$db,i)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e})();Object.defineProperty(Mt.prototype,"_bsontype",{value:"DBRef"});var Z=void 0;try{Z=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Ki=65536,On=1<<24,At=Ki*Ki,dr=At*At,Ji=dr/2,qi={},Qi={},b=(function(){function e(t,i,r){if(t===void 0&&(t=0),!(this instanceof e))return new e(t,i,r);typeof t=="bigint"?Object.assign(this,e.fromBigInt(t,!!i)):typeof t=="string"?Object.assign(this,e.fromString(t,!!i)):(this.low=t|0,this.high=i|0,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,i,r){return new e(t,i,r)},e.fromInt=function(t,i){var r,s,l;return i?(t>>>=0,(l=0<=t&&t<256)&&(s=Qi[t],s)?s:(r=e.fromBits(t,(t|0)<0?-1:0,!0),l&&(Qi[t]=r),r)):(t|=0,(l=-128<=t&&t<128)&&(s=qi[t],s)?s:(r=e.fromBits(t,t<0?-1:0,!1),l&&(qi[t]=r),r))},e.fromNumber=function(t,i){if(isNaN(t))return i?e.UZERO:e.ZERO;if(i){if(t<0)return e.UZERO;if(t>=dr)return e.MAX_UNSIGNED_VALUE}else{if(t<=-Ji)return e.MIN_VALUE;if(t+1>=Ji)return e.MAX_VALUE}return t<0?e.fromNumber(-t,i).neg():e.fromBits(t%At|0,t/At|0,i)},e.fromBigInt=function(t,i){return e.fromString(t.toString(),i)},e.fromString=function(t,i,r){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e.ZERO;if(typeof i=="number"?(r=i,i=!1):i=!!i,r=r||10,r<2||36<r)throw RangeError("radix");var s;if((s=t.indexOf("-"))>0)throw Error("interior hyphen");if(s===0)return e.fromString(t.substring(1),i,r).neg();for(var l=e.fromNumber(Math.pow(r,8)),a=e.ZERO,f=0;f<t.length;f+=8){var p=Math.min(8,t.length-f),d=parseInt(t.substring(f,f+p),r);if(p<8){var g=e.fromNumber(Math.pow(r,p));a=a.mul(g).add(e.fromNumber(d))}else a=a.mul(l),a=a.add(e.fromNumber(d))}return a.unsigned=i,a},e.fromBytes=function(t,i,r){return r?e.fromBytesLE(t,i):e.fromBytesBE(t,i)},e.fromBytesLE=function(t,i){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,i)},e.fromBytesBE=function(t,i){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],i)},e.isLong=function(t){return Ft(t)&&t.__isLong__===!0},e.fromValue=function(t,i){return typeof t=="number"?e.fromNumber(t,i):typeof t=="string"?e.fromString(t,i):e.fromBits(t.low,t.high,typeof i=="boolean"?i:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var i=this.high>>>16,r=this.high&65535,s=this.low>>>16,l=this.low&65535,a=t.high>>>16,f=t.high&65535,p=t.low>>>16,d=t.low&65535,g=0,_=0,v=0,E=0;return E+=l+d,v+=E>>>16,E&=65535,v+=s+p,_+=v>>>16,v&=65535,_+=r+f,g+=_>>>16,_&=65535,g+=i+a,g&=65535,e.fromBits(v<<16|E,g<<16|_,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var i=this.isNegative(),r=t.isNegative();return i&&!r?-1:!i&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(t){return this.compare(t)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(Z){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var i=(this.unsigned?Z.div_u:Z.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(i,Z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var r,s,l;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;l=e.UZERO}else{if(this.eq(e.MIN_VALUE)){if(t.eq(e.ONE)||t.eq(e.NEG_ONE))return e.MIN_VALUE;if(t.eq(e.MIN_VALUE))return e.ONE;var a=this.shr(1);return r=a.div(t).shl(1),r.eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(s=this.sub(t.mul(r)),l=r.add(s.div(t)),l)}else if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();l=e.ZERO}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var f=Math.ceil(Math.log(r)/Math.LN2),p=f<=48?1:Math.pow(2,f-48),d=e.fromNumber(r),g=d.mul(t);g.isNegative()||g.gt(s);)r-=p,d=e.fromNumber(r,this.unsigned),g=d.mul(t);d.isZero()&&(d=e.ONE),l=l.add(d),s=s.sub(g)}return l},e.prototype.div=function(t){return this.divide(t)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},e.prototype.eq=function(t){return this.equals(t)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,i;for(i=31;i>0&&(t&1<<i)===0;i--);return this.high!==0?i+33:i+1},e.prototype.greaterThan=function(t){return this.comp(t)>0},e.prototype.gt=function(t){return this.greaterThan(t)},e.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},e.prototype.gte=function(t){return this.greaterThanOrEqual(t)},e.prototype.ge=function(t){return this.greaterThanOrEqual(t)},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.lessThan=function(t){return this.comp(t)<0},e.prototype.lt=function(t){return this.lessThan(t)},e.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},e.prototype.lte=function(t){return this.lessThanOrEqual(t)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),Z){var i=(this.unsigned?Z.rem_u:Z.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(i,Z.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(t){return this.modulo(t)},e.prototype.rem=function(t){return this.modulo(t)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),Z){var i=Z.mul(this.low,this.high,t.low,t.high);return e.fromBits(i,Z.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,l=this.low>>>16,a=this.low&65535,f=t.high>>>16,p=t.high&65535,d=t.low>>>16,g=t.low&65535,_=0,v=0,E=0,w=0;return w+=a*g,E+=w>>>16,w&=65535,E+=l*g,v+=E>>>16,E&=65535,E+=a*d,v+=E>>>16,E&=65535,v+=s*g,_+=v>>>16,v&=65535,v+=l*d,_+=v>>>16,v&=65535,v+=a*p,_+=v>>>16,v&=65535,_+=r*g+s*d+l*p+a*f,_&=65535,e.fromBits(E<<16|w,_<<16|v,this.unsigned)},e.prototype.mul=function(t){return this.multiply(t)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(t){return!this.equals(t)},e.prototype.neq=function(t){return this.notEquals(t)},e.prototype.ne=function(t){return this.notEquals(t)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(t){return this.shiftLeft(t)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(t){return this.shiftRight(t)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var i=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|i<<32-t,i>>>t,this.unsigned)}else return t===32?e.fromBits(i,0,this.unsigned):e.fromBits(i>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},e.prototype.shru=function(t){return this.shiftRightUnsigned(t)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(t){return this.subtract(t)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*At+(this.low>>>0):this.high*At+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var t=this.high,i=this.low;return[i&255,i>>>8&255,i>>>16&255,i>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},e.prototype.toBytesBE=function(){var t=this.high,i=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,i>>>24,i>>>16&255,i>>>8&255,i&255]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(e.MIN_VALUE)){var i=e.fromNumber(t),r=this.div(i),s=r.mul(i).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var l=e.fromNumber(Math.pow(t,6),this.unsigned),a=this,f="";;){var p=a.div(l),d=a.sub(p.mul(l)).toInt()>>>0,g=d.toString(t);if(a=p,a.isZero())return g+f;for(;g.length<6;)g="0"+g;f=""+g+f}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(t){return this.lessThanOrEqual(t)},e.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,i){var r=e.fromString(t.$numberLong);return i&&i.relaxed?r.toNumber():r},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(On),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e})();Object.defineProperty(b.prototype,"__isLong__",{value:!0});Object.defineProperty(b.prototype,"_bsontype",{value:"Long"});var Sn=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,An=/^(\+|-)?(Infinity|inf)$/i,Nn=/^(\+|-)?NaN$/i,Pt=6111,Le=-6176,tr=6176,Tn=34,Pe=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),er=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ir=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Cn=/^([-+])?(\d+)?$/,Dn=31,rr=16383,In=30,Rn=31;function nr(e){return!isNaN(parseInt(e,10))}function xn(e){var t=b.fromNumber(1e9),i=b.fromNumber(0);if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3])return{quotient:e,rem:i};for(var r=0;r<=3;r++)i=i.shiftLeft(32),i=i.add(new b(e.parts[r],0)),e.parts[r]=i.div(t).low,i=i.modulo(t);return{quotient:e,rem:i}}function Bn(e,t){if(!e&&!t)return{high:b.fromNumber(0),low:b.fromNumber(0)};var i=e.shiftRightUnsigned(32),r=new b(e.getLowBits(),0),s=t.shiftRightUnsigned(32),l=new b(t.getLowBits(),0),a=i.multiply(s),f=i.multiply(l),p=r.multiply(s),d=r.multiply(l);return a=a.add(f.shiftRightUnsigned(32)),f=new b(f.getLowBits(),0).add(p).add(d.shiftRightUnsigned(32)),a=a.add(f.shiftRightUnsigned(32)),d=f.shiftLeft(32).add(new b(d.getLowBits(),0)),{high:a,low:d}}function Ln(e,t){var i=e.high>>>0,r=t.high>>>0;if(i<r)return!0;if(i===r){var s=e.low>>>0,l=t.low>>>0;if(s<l)return!0}return!1}function St(e,t){throw new F('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var je=(function(){function e(t){if(!(this instanceof e))return new e(t);if(typeof t=="string")this.bytes=e.fromString(t).bytes;else if(Ue(t)){if(t.byteLength!==16)throw new F("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}else throw new F("Decimal128 must take a Buffer or string")}return e.fromString=function(t){var i=!1,r=!1,s=!1,l=0,a=0,f=0,p=0,d=0,g=[0],_=0,v=0,E=0,w=0,A=0,D=0,L=new b(0,0),N=new b(0,0),B=0,O=0;if(t.length>=7e3)throw new F(""+t+" not a valid Decimal128 string");var z=t.match(Sn),tt=t.match(An),at=t.match(Nn);if(!z&&!tt&&!at||t.length===0)throw new F(""+t+" not a valid Decimal128 string");if(z){var be=z[2],It=z[4],Oe=z[5],Yt=z[6];It&&Yt===void 0&&St(t,"missing exponent power"),It&&be===void 0&&St(t,"missing exponent base"),It===void 0&&(Oe||Yt)&&St(t,"missing e before exponent")}if((t[O]==="+"||t[O]==="-")&&(i=t[O++]==="-"),!nr(t[O])&&t[O]!=="."){if(t[O]==="i"||t[O]==="I")return new e(R.from(i?er:ir));if(t[O]==="N")return new e(R.from(Pe))}for(;nr(t[O])||t[O]===".";){if(t[O]==="."){r&&St(t,"contains multiple periods"),r=!0,O=O+1;continue}_<34&&(t[O]!=="0"||s)&&(s||(d=a),s=!0,g[v++]=parseInt(t[O],10),_=_+1),s&&(f=f+1),r&&(p=p+1),a=a+1,O=O+1}if(r&&!a)throw new F(""+t+" not a valid Decimal128 string");if(t[O]==="e"||t[O]==="E"){var mt=t.substr(++O).match(Cn);if(!mt||!mt[2])return new e(R.from(Pe));A=parseInt(mt[0],10),O=O+mt[0].length}if(t[O])return new e(R.from(Pe));if(E=0,!_)E=0,w=0,g[0]=0,f=1,_=1,l=0;else if(w=_-1,l=f,l!==1)for(;g[d+l-1]===0;)l=l-1;for(A<=p&&p-A>16384?A=Le:A=A-p;A>Pt;){if(w=w+1,w-E>Tn){var vt=g.join("");if(vt.match(/^0+$/)){A=Pt;break}St(t,"overflow")}A=A-1}for(;A<Le||_<f;){if(w===0&&l<_){A=Le,l=0;break}if(_<f?f=f-1:w=w-1,A<Pt)A=A+1;else{var vt=g.join("");if(vt.match(/^0+$/)){A=Pt;break}St(t,"overflow")}}if(w-E+1<l){var ct=a;r&&(d=d+1,ct=ct+1),i&&(d=d+1,ct=ct+1);var Wt=parseInt(t[d+w+1],10),wt=0;if(Wt>=5&&(wt=1,Wt===5)){for(wt=g[w]%2===1?1:0,D=d+w+2;D<ct;D++)if(parseInt(t[D],10)){wt=1;break}}if(wt){for(var M=w;M>=0;M--)if(++g[M]>9&&(g[M]=0,M===0))if(A<Pt)A=A+1,g[M]=1;else return new e(R.from(i?er:ir))}}if(L=b.fromNumber(0),N=b.fromNumber(0),l===0)L=b.fromNumber(0),N=b.fromNumber(0);else if(w-E<17){var M=E;for(N=b.fromNumber(g[M++]),L=new b(0,0);M<=w;M++)N=N.multiply(b.fromNumber(10)),N=N.add(b.fromNumber(g[M]))}else{var M=E;for(L=b.fromNumber(g[M++]);M<=w-17;M++)L=L.multiply(b.fromNumber(10)),L=L.add(b.fromNumber(g[M]));for(N=b.fromNumber(g[M++]);M<=w;M++)N=N.multiply(b.fromNumber(10)),N=N.add(b.fromNumber(g[M]))}var J=Bn(L,b.fromString("100000000000000000"));J.low=J.low.add(N),Ln(J.low,N)&&(J.high=J.high.add(b.fromNumber(1))),B=A+tr;var I={low:b.fromNumber(0),high:b.fromNumber(0)};J.high.shiftRightUnsigned(49).and(b.fromNumber(1)).equals(b.fromNumber(1))?(I.high=I.high.or(b.fromNumber(3).shiftLeft(61)),I.high=I.high.or(b.fromNumber(B).and(b.fromNumber(16383).shiftLeft(47))),I.high=I.high.or(J.high.and(b.fromNumber(0x7fffffffffff)))):(I.high=I.high.or(b.fromNumber(B&16383).shiftLeft(49)),I.high=I.high.or(J.high.and(b.fromNumber(562949953421311)))),I.low=J.low,i&&(I.high=I.high.or(b.fromString("9223372036854775808")));var T=R.alloc(16);return O=0,T[O++]=I.low.low&255,T[O++]=I.low.low>>8&255,T[O++]=I.low.low>>16&255,T[O++]=I.low.low>>24&255,T[O++]=I.low.high&255,T[O++]=I.low.high>>8&255,T[O++]=I.low.high>>16&255,T[O++]=I.low.high>>24&255,T[O++]=I.high.low&255,T[O++]=I.high.low>>8&255,T[O++]=I.high.low>>16&255,T[O++]=I.high.low>>24&255,T[O++]=I.high.high&255,T[O++]=I.high.high>>8&255,T[O++]=I.high.high>>16&255,T[O++]=I.high.high>>24&255,new e(T)},e.prototype.toString=function(){for(var t,i=0,r=new Array(36),s=0;s<r.length;s++)r[s]=0;var l=0,a=!1,f,p={parts:[0,0,0,0]},d,g,_=[];l=0;var v=this.bytes,E=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24,w=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24,A=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24,D=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24;l=0;var L={low:new b(E,w),high:new b(A,D)};L.high.lessThan(b.ZERO)&&_.push("-");var N=D>>26&Dn;if(N>>3===3){if(N===In)return _.join("")+"Infinity";if(N===Rn)return"NaN";t=D>>15&rr,f=8+(D>>14&1)}else f=D>>14&7,t=D>>17&rr;var B=t-tr;if(p.parts[0]=(D&16383)+((f&15)<<14),p.parts[1]=A,p.parts[2]=w,p.parts[3]=E,p.parts[0]===0&&p.parts[1]===0&&p.parts[2]===0&&p.parts[3]===0)a=!0;else for(g=3;g>=0;g--){var O=0,z=xn(p);if(p=z.quotient,O=z.rem.low,!!O)for(d=8;d>=0;d--)r[g*9+d]=O%10,O=Math.floor(O/10)}if(a)i=1,r[l]=0;else for(i=36;!r[l];)i=i-1,l=l+1;var tt=i-1+B;if(tt>=34||tt<=-7||B>0){if(i>34)return _.push("".concat(0)),B>0?_.push("E+".concat(B)):B<0&&_.push("E".concat(B)),_.join("");_.push("".concat(r[l++])),i=i-1,i&&_.push(".");for(var s=0;s<i;s++)_.push("".concat(r[l++]));_.push("E"),tt>0?_.push("+".concat(tt)):_.push("".concat(tt))}else if(B>=0)for(var s=0;s<i;s++)_.push("".concat(r[l++]));else{var at=i+B;if(at>0)for(var s=0;s<at;s++)_.push("".concat(r[l++]));else _.push("0");for(_.push(".");at++<0;)_.push("0");for(var s=0;s<i-Math.max(at-1,0);s++)_.push("".concat(r[l++]))}return _.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e})();Object.defineProperty(je.prototype,"_bsontype",{value:"Decimal128"});var de=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},e.fromExtendedJSON=function(t,i){var r=parseFloat(t.$numberDouble);return i&&i.relaxed?r:new e(r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},e})();Object.defineProperty(de.prototype,"_bsontype",{value:"Double"});var ge=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,i){return i&&i.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e})();Object.defineProperty(ge.prototype,"_bsontype",{value:"Int32"});var Ve=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e})();Object.defineProperty(Ve.prototype,"_bsontype",{value:"MaxKey"});var He=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e})();Object.defineProperty(He.prototype,"_bsontype",{value:"MinKey"});var Pn=new RegExp("^[0-9a-fA-F]{24}$"),dt=null,rt=Symbol("id"),H=(function(){function e(t){if(!(this instanceof e))return new e(t);var i;if(typeof t=="object"&&t&&"id"in t){if(typeof t.id!="string"&&!ArrayBuffer.isView(t.id))throw new F("Argument passed in must have an id that is of type string or Buffer");"toHexString"in t&&typeof t.toHexString=="function"?i=R.from(t.toHexString(),"hex"):i=t.id}else i=t;if(i==null||typeof i=="number")this[rt]=e.generate(typeof i=="number"?i:void 0);else if(ArrayBuffer.isView(i)&&i.byteLength===12)this[rt]=i instanceof R?i:le(i);else if(typeof i=="string")if(i.length===12){var r=R.from(i);if(r.byteLength===12)this[rt]=r;else throw new F("Argument passed in must be a string of 12 bytes")}else if(i.length===24&&Pn.test(i))this[rt]=R.from(i,"hex");else throw new F("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new F("Argument passed in does not match the accepted types");e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[rt]},set:function(t){this[rt]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){typeof t!="number"&&(t=Math.floor(Date.now()/1e3));var i=e.getInc(),r=R.alloc(12);return r.writeUInt32BE(t,0),dt===null&&(dt=ur(5)),r[4]=dt[0],r[5]=dt[1],r[6]=dt[2],r[7]=dt[3],r[8]=dt[4],r[11]=i&255,r[10]=i>>8&255,r[9]=i>>16&255,r},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(t==null)return!1;if(t instanceof e)return this[rt][11]===t[rt][11]&&this[rt].equals(t[rt]);if(typeof t=="string"&&e.isValid(t)&&t.length===12&&Ue(this.id))return t===R.prototype.toString.call(this.id,"latin1");if(typeof t=="string"&&e.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t=="string"&&e.isValid(t)&&t.length===12)return R.from(t).equals(this.id);if(typeof t=="object"&&"toHexString"in t&&typeof t.toHexString=="function"){var i=t.toHexString(),r=this.toHexString().toLowerCase();return typeof i=="string"&&i.toLowerCase()===r}return!1},e.prototype.getTimestamp=function(){var t=new Date,i=this.id.readUInt32BE(0);return t.setTime(Math.floor(i)*1e3),t},e.createPk=function(){return new e},e.createFromTime=function(t){var i=R.from([0,0,0,0,0,0,0,0,0,0,0,0]);return i.writeUInt32BE(t,0),new e(i)},e.createFromHexString=function(t){if(typeof t>"u"||t!=null&&t.length!==24)throw new F("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(R.from(t,"hex"))},e.isValid=function(t){if(t==null)return!1;try{return new e(t),!0}catch{return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(Math.random()*16777215),e})();Object.defineProperty(H.prototype,"generate",{value:fe(function(e){return H.generate(e)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(H.prototype,"getInc",{value:fe(function(){return H.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(H.prototype,"get_inc",{value:fe(function(){return H.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(H,"get_inc",{value:fe(function(){return H.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(H.prototype,"_bsontype",{value:"ObjectID"});function Mn(e){return e.split("").sort().join("")}var kt=(function(){function e(t,i){if(!(this instanceof e))return new e(t,i);if(this.pattern=t,this.options=Mn(i??""),this.pattern.indexOf("\0")!==-1)throw new gt("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new gt("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if(!(this.options[r]==="i"||this.options[r]==="m"||this.options[r]==="x"||this.options[r]==="l"||this.options[r]==="s"||this.options[r]==="u"))throw new gt("The regular expression option [".concat(this.options[r],"] is not supported"))}return e.parseOptions=function(t){return t?t.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t)if(typeof t.$regex!="string"){if(t.$regex._bsontype==="BSONRegExp")return t}else return new e(t.$regex,e.parseOptions(t.$options));if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new F("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e})();Object.defineProperty(kt.prototype,"_bsontype",{value:"BSONRegExp"});var $e=(function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e})();Object.defineProperty($e.prototype,"_bsontype",{value:"Symbol"});var kn=b,gr=(function(e){ue(t,e);function t(i,r){var s=this;return s instanceof t?(b.isLong(i)?s=e.call(this,i.low,i.high,!0)||this:Ft(i)&&typeof i.t<"u"&&typeof i.i<"u"?s=e.call(this,i.i,i.t,!0)||this:s=e.call(this,i,r,!0)||this,Object.defineProperty(s,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),s):new t(i,r)}return t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(i){return new t(b.fromInt(i,!0))},t.fromNumber=function(i){return new t(b.fromNumber(i,!0))},t.fromBits=function(i,r){return new t(i,r)},t.fromString=function(i,r){return new t(b.fromString(i,!0,r))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(i){return new t(i.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=b.MAX_UNSIGNED_VALUE,t})(kn);function Fn(e){return Ft(e)&&Reflect.has(e,"_bsontype")&&typeof e._bsontype=="string"}var _r=2147483647,yr=-2147483648,mr=9223372036854776e3,vr=-9223372036854776e3,Un={$oid:H,$binary:_t,$uuid:_t,$symbol:$e,$numberInt:ge,$numberDecimal:je,$numberDouble:de,$numberLong:b,$minKey:He,$maxKey:Ve,$regex:kt,$regularExpression:kt,$timestamp:gr};function wr(e,t){if(t===void 0&&(t={}),typeof e=="number"){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=yr&&e<=_r)return new ge(e);if(e>=vr&&e<=mr)return b.fromNumber(e)}return new de(e)}if(e==null||typeof e!="object")return e;if(e.$undefined)return null;for(var i=Object.keys(e).filter(function(_){return _.startsWith("$")&&e[_]!=null}),r=0;r<i.length;r++){var s=Un[i[r]];if(s)return s.fromExtendedJSON(e,t)}if(e.$date!=null){var l=e.$date,a=new Date;return t.legacy?typeof l=="number"?a.setTime(l):typeof l=="string"&&a.setTime(Date.parse(l)):typeof l=="string"?a.setTime(Date.parse(l)):b.isLong(l)?a.setTime(l.toNumber()):typeof l=="number"&&t.relaxed&&a.setTime(l),a}if(e.$code!=null){var f=Object.assign({},e);return e.$scope&&(f.$scope=wr(e.$scope)),pe.fromExtendedJSON(e)}if(bn(e)||e.$dbPointer){var p=e.$ref?e:e.$dbPointer;if(p instanceof Mt)return p;var d=Object.keys(p).filter(function(_){return _.startsWith("$")}),g=!0;if(d.forEach(function(_){["$ref","$id","$db"].indexOf(_)===-1&&(g=!1)}),g)return Mt.fromExtendedJSON(p)}return e}function jn(e,t){return e.map(function(i,r){t.seenObjects.push({propertyName:"index ".concat(r),obj:null});try{return ht(i,t)}finally{t.seenObjects.pop()}})}function or(e){var t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function ht(e,t){if((typeof e=="object"||typeof e=="function")&&e!==null){var i=t.seenObjects.findIndex(function(L){return L.obj===e});if(i!==-1){var r=t.seenObjects.map(function(L){return L.propertyName}),s=r.slice(0,i).map(function(L){return"".concat(L," -> ")}).join(""),l=r[i],a=" -> "+r.slice(i+1,r.length-1).map(function(L){return"".concat(L," -> ")}).join(""),f=r[r.length-1],p=" ".repeat(s.length+l.length/2),d="-".repeat(a.length+(l.length+f.length)/2-1);throw new F(`Converting circular structure to EJSON:
1
+ import{$ as Qt,Aa as Ti,Ab as Ui,B as q,Bb as ji,C as W,Cb as ee,Db as ot,E as Zt,Eb as it,Ga as Ci,Gb as ie,H as Kt,Ha as Di,Hb as xt,I as ut,Ia as Ii,Ib as Vi,J as Oi,Jb as Bt,K as Si,Kb as Hi,Lb as $i,Mb as re,R as Jt,T as Et,U as qt,V as Ce,W as De,X as lt,Z as Rt,a as di,ba as Ai,c as Y,ca as bt,d as gi,da as Q,ea as ft,fa as Ni,g as _i,ga as te,hb as Ri,i as yi,ib as xi,kb as Bi,l as mi,m as vi,n as wi,nb as Li,o as Ei,q as bi,qb as Pi,rb as Mi,s as V,u as G,v as S,w as Gt,yb as ki,zb as Fi}from"./chunk-KHVPWQ5E.js";import{a as U,b as pi,e as Ne,f as Te}from"./chunk-V7UGKYBN.js";var Xi=Ne((Wi,ae)=>{"use strict";(function(e){"use strict";var t={};t.VERSION="1.6.1";var i,r={},s=function(d,g){return function(){return g.apply(d,arguments)}},l=function(){var d=arguments,g=d[0],_,v;for(v=1;v<d.length;v++)for(_ in d[v])!(_ in g)&&d[v].hasOwnProperty(_)&&(g[_]=d[v][_]);return g},a=function(d,g){return{value:d,name:g}};t.TRACE=a(1,"TRACE"),t.DEBUG=a(2,"DEBUG"),t.INFO=a(3,"INFO"),t.TIME=a(4,"TIME"),t.WARN=a(5,"WARN"),t.ERROR=a(8,"ERROR"),t.OFF=a(99,"OFF");var f=function(d){this.context=d,this.setLevel(d.filterLevel),this.log=this.info};f.prototype={setLevel:function(d){d&&"value"in d&&(this.context.filterLevel=d)},getLevel:function(){return this.context.filterLevel},enabledFor:function(d){var g=this.context.filterLevel;return d.value>=g.value},trace:function(){this.invoke(t.TRACE,arguments)},debug:function(){this.invoke(t.DEBUG,arguments)},info:function(){this.invoke(t.INFO,arguments)},warn:function(){this.invoke(t.WARN,arguments)},error:function(){this.invoke(t.ERROR,arguments)},time:function(d){typeof d=="string"&&d.length>0&&this.invoke(t.TIME,[d,"start"])},timeEnd:function(d){typeof d=="string"&&d.length>0&&this.invoke(t.TIME,[d,"end"])},invoke:function(d,g){i&&this.enabledFor(d)&&i(g,l({level:d},this.context))}};var p=new f({filterLevel:t.OFF});(function(){var d=t;d.enabledFor=s(p,p.enabledFor),d.trace=s(p,p.trace),d.debug=s(p,p.debug),d.time=s(p,p.time),d.timeEnd=s(p,p.timeEnd),d.info=s(p,p.info),d.warn=s(p,p.warn),d.error=s(p,p.error),d.log=d.info})(),t.setHandler=function(d){i=d},t.setLevel=function(d){p.setLevel(d);for(var g in r)r.hasOwnProperty(g)&&r[g].setLevel(d)},t.getLevel=function(){return p.getLevel()},t.get=function(d){return r[d]||(r[d]=new f(l({name:d},p.context)))},t.createDefaultHandler=function(d){d=d||{},d.formatter=d.formatter||function(E,w){w.name&&E.unshift("["+w.name+"]")};var g={},_=function(v,E){Function.prototype.apply.call(v,console,E)};return typeof console>"u"?function(){}:function(v,E){v=Array.prototype.slice.call(v);var w=console.log,A;E.level===t.TIME?(A=(E.name?"["+E.name+"] ":"")+v[0],v[1]==="start"?console.time?console.time(A):g[A]=new Date().getTime():console.timeEnd?console.timeEnd(A):_(w,[A+": "+(new Date().getTime()-g[A])+"ms"])):(E.level===t.WARN&&console.warn?w=console.warn:E.level===t.ERROR&&console.error?w=console.error:E.level===t.INFO&&console.info?w=console.info:E.level===t.DEBUG&&console.debug?w=console.debug:E.level===t.TRACE&&console.trace&&(w=console.trace),d.formatter(v,E),_(w,v))}},t.useDefaults=function(d){t.setLevel(d&&d.defaultLevel||t.DEBUG),t.setHandler(t.createDefaultHandler(d))},t.setDefaults=t.useDefaults,typeof define=="function"&&define.amd?define(t):typeof ae<"u"&&ae.exports?ae.exports=t:(t._prevLogger=e.Logger,t.noConflict=function(){return e.Logger=t._prevLogger,t},e.Logger=t)})(Wi)});var Fr=Ne((ni,oi)=>{"use strict";(function(e,t){typeof ni=="object"&&typeof oi<"u"?oi.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.fetchRetry=t())})(ni,function(){"use strict";var e=function(r,s){if(s=s||{},typeof r!="function")throw new i("fetch must be a function");if(typeof s!="object")throw new i("defaults must be an object");if(s.retries!==void 0&&!t(s.retries))throw new i("retries must be a positive integer");if(s.retryDelay!==void 0&&!t(s.retryDelay)&&typeof s.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(s.retryOn!==void 0&&!Array.isArray(s.retryOn)&&typeof s.retryOn!="function")throw new i("retryOn property expects an array or function");var l={retries:3,retryDelay:1e3,retryOn:[]};return s=Object.assign(l,s),function(f,p){var d=s.retries,g=s.retryDelay,_=s.retryOn;if(p&&p.retries!==void 0)if(t(p.retries))d=p.retries;else throw new i("retries must be a positive integer");if(p&&p.retryDelay!==void 0)if(t(p.retryDelay)||typeof p.retryDelay=="function")g=p.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(p&&p.retryOn)if(Array.isArray(p.retryOn)||typeof p.retryOn=="function")_=p.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,E){var w=function(D){var L=typeof Request<"u"&&f instanceof Request?f.clone():f;r(L,p).then(function(N){if(Array.isArray(_)&&_.indexOf(N.status)===-1)v(N);else if(typeof _=="function")try{return Promise.resolve(_(D,null,N)).then(function(B){B?A(D,null,N):v(N)}).catch(E)}catch(B){E(B)}else D<d?A(D,null,N):v(N)}).catch(function(N){if(typeof _=="function")try{Promise.resolve(_(D,N,null)).then(function(B){B?A(D,N,null):E(N)}).catch(function(B){E(B)})}catch(B){E(B)}else D<d?A(D,N,null):E(N)})};function A(D,L,N){var B=typeof g=="function"?g(D,L,N):g;setTimeout(function(){w(++D)},B)}w(0)})}};function t(r){return Number.isInteger(r)&&r>=0}function i(r){this.name="ArgumentError",this.message=r}return e})});var Hr=Ne(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.URLBuilder=void 0;var bo=(function(){function e(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1))}catch(i){console.error("Un-parsable URL",i)}}return e.prototype.appendQueryParam=function(t,i){this.params.append(t,i?i.toString():"")},e.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},e.prototype.deleteQueryParam=function(t){this.params.delete(t)},e.prototype.getBase=function(){return this.base},e.prototype.getPath=function(){return this.base.pathname},e.prototype.getHostname=function(){return this.base.hostname},e.prototype.getParams=function(){return this.params},e.prototype.getQueryParam=function(t){if(!this.params)return"";var i=this.params.get(t);return!i||i==="undefined"||i==="null"?void 0:i},e.prototype.getQueryString=function(){return this.params.toString()},e.prototype.setPath=function(t){return this.base.pathname=t,this},e.prototype.setQueryParam=function(t,i){return this.params.set(t,i?i.toString():""),this},e.prototype.setQueryString=function(t){if(t)return t[0]==="?"&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},e.prototype.toString=function(){var t=this.params.toString();return t===""?this.base.search="":this.base.search="?"+t,this.base.toString()},e})();Ee.URLBuilder=bo});var Ie="11.5.3";var Jr=Ie.split("-")[0].split(".").slice(0,3).map(e=>e.padStart(2,"0")).join("");var Yi="CooeeSDK",ne=Ie,To=parseInt(Jr,10);var oe=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${ne}/dist`,se={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:oe,styleURL:`${oe}/widget.min.css`,widgetURL:`${oe}/widget.min.js`,swiperStyleURL:`${oe}/swiper-bundle.min.css`};var X=Te(Xi());var Lt=class{static debuggerEl;static infoLogs=[];static log(...t){X.default.info(...t)}static verbose(...t){X.default.debug(...t)}static error(...t){X.default.error(...t)}static warn(...t){X.default.warn(...t)}static info(...t){X.default.info(...t),this.infoLogs.unshift({time:new Date,message:t.join(" ")}),this.addToDebugger()}static trace(...t){X.default.trace(...t)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function Bo(e=Yi){X.default.useDefaults({formatter:function(i){i.unshift(`${e} (v${ne}):`)}});let t=qr();(t==="1"||t==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?X.default.setLevel(X.default[localStorage.cooeeLogLevel]):X.default.setLevel(se.debug?X.default.TRACE:X.default.OFF)}function qr(){return new URL(location.href).searchParams?.get("cooee-debug")}var ko=new G("EngagementContext"),Fo=new G("EventData");function Qr(e,t){return t={exports:{}},e(t,t.exports),t.exports}var tn=on,en=an,rn=hn,nt=[],K=[],nn=typeof Uint8Array<"u"?Uint8Array:Array,Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pt=0,zi=Re.length;pt<zi;++pt)nt[pt]=Re[pt],K[Re.charCodeAt(pt)]=pt;var pt,zi;K[45]=62;K[95]=63;function lr(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");i===-1&&(i=t);var r=i===t?0:4-i%4;return[i,r]}function on(e){var t=lr(e),i=t[0],r=t[1];return(i+r)*3/4-r}function sn(e,t,i){return(t+i)*3/4-i}function an(e){var t,i=lr(e),r=i[0],s=i[1],l=new nn(sn(e,r,s)),a=0,f=s>0?r-4:r,p;for(p=0;p<f;p+=4)t=K[e.charCodeAt(p)]<<18|K[e.charCodeAt(p+1)]<<12|K[e.charCodeAt(p+2)]<<6|K[e.charCodeAt(p+3)],l[a++]=t>>16&255,l[a++]=t>>8&255,l[a++]=t&255;return s===2&&(t=K[e.charCodeAt(p)]<<2|K[e.charCodeAt(p+1)]>>4,l[a++]=t&255),s===1&&(t=K[e.charCodeAt(p)]<<10|K[e.charCodeAt(p+1)]<<4|K[e.charCodeAt(p+2)]>>2,l[a++]=t>>8&255,l[a++]=t&255),l}function cn(e){return nt[e>>18&63]+nt[e>>12&63]+nt[e>>6&63]+nt[e&63]}function ln(e,t,i){for(var r,s=[],l=t;l<i;l+=3)r=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(e[l+2]&255),s.push(cn(r));return s.join("")}function hn(e){for(var t,i=e.length,r=i%3,s=[],l=16383,a=0,f=i-r;a<f;a+=l)s.push(ln(e,a,a+l>f?f:a+l));return r===1?(t=e[i-1],s.push(nt[t>>2]+nt[t<<4&63]+"==")):r===2&&(t=(e[i-2]<<8)+e[i-1],s.push(nt[t>>10]+nt[t>>4&63]+nt[t<<2&63]+"=")),s.join("")}var xe={byteLength:tn,toByteArray:en,fromByteArray:rn};var un=function(t,i,r,s,l){var a,f,p=l*8-s-1,d=(1<<p)-1,g=d>>1,_=-7,v=r?l-1:0,E=r?-1:1,w=t[i+v];for(v+=E,a=w&(1<<-_)-1,w>>=-_,_+=p;_>0;a=a*256+t[i+v],v+=E,_-=8);for(f=a&(1<<-_)-1,a>>=-_,_+=s;_>0;f=f*256+t[i+v],v+=E,_-=8);if(a===0)a=1-g;else{if(a===d)return f?NaN:(w?-1:1)*(1/0);f=f+Math.pow(2,s),a=a-g}return(w?-1:1)*f*Math.pow(2,a-s)},fn=function(t,i,r,s,l,a){var f,p,d,g=a*8-l-1,_=(1<<g)-1,v=_>>1,E=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=s?0:a-1,A=s?1:-1,D=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(p=isNaN(i)?1:0,f=_):(f=Math.floor(Math.log(i)/Math.LN2),i*(d=Math.pow(2,-f))<1&&(f--,d*=2),f+v>=1?i+=E/d:i+=E*Math.pow(2,1-v),i*d>=2&&(f++,d/=2),f+v>=_?(p=0,f=_):f+v>=1?(p=(i*d-1)*Math.pow(2,l),f=f+v):(p=i*Math.pow(2,v-1)*Math.pow(2,l),f=0));l>=8;t[r+w]=p&255,w+=A,p/=256,l-=8);for(f=f<<l|p,g+=l;g>0;t[r+w]=f&255,w+=A,f/=256,g-=8);t[r+w-A]|=D*128},Ot={read:un,write:fn},he=Qr(function(e,t){var i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var r=2147483647;t.kMaxLength=r,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var c=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(c,n),c.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function l(c){if(c>r)throw new RangeError('The value "'+c+'" is invalid for option "size"');var n=new Uint8Array(c);return Object.setPrototypeOf(n,a.prototype),n}function a(c,n,o){if(typeof c=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return f(c,n,o)}a.poolSize=8192;function f(c,n,o){if(typeof c=="string")return _(c,n);if(ArrayBuffer.isView(c))return E(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c));if(et(c,ArrayBuffer)||c&&et(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(et(c,SharedArrayBuffer)||c&&et(c.buffer,SharedArrayBuffer)))return w(c,n,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var h=c.valueOf&&c.valueOf();if(h!=null&&h!==c)return a.from(h,n,o);var u=A(c);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return a.from(c[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(c))}a.from=function(c,n,o){return f(c,n,o)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function p(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function d(c,n,o){return p(c),c<=0?l(c):n!==void 0?typeof o=="string"?l(c).fill(n,o):l(c).fill(n):l(c)}a.alloc=function(c,n,o){return d(c,n,o)};function g(c){return p(c),l(c<0?0:D(c)|0)}a.allocUnsafe=function(c){return g(c)},a.allocUnsafeSlow=function(c){return g(c)};function _(c,n){if((typeof n!="string"||n==="")&&(n="utf8"),!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=N(c,n)|0,h=l(o),u=h.write(c,n);return u!==o&&(h=h.slice(0,u)),h}function v(c){for(var n=c.length<0?0:D(c.length)|0,o=l(n),h=0;h<n;h+=1)o[h]=c[h]&255;return o}function E(c){if(et(c,Uint8Array)){var n=new Uint8Array(c);return w(n.buffer,n.byteOffset,n.byteLength)}return v(c)}function w(c,n,o){if(n<0||c.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');var h;return n===void 0&&o===void 0?h=new Uint8Array(c):o===void 0?h=new Uint8Array(c,n):h=new Uint8Array(c,n,o),Object.setPrototypeOf(h,a.prototype),h}function A(c){if(a.isBuffer(c)){var n=D(c.length)|0,o=l(n);return o.length===0||c.copy(o,0,0,n),o}if(c.length!==void 0)return typeof c.length!="number"||Ae(c.length)?l(0):v(c);if(c.type==="Buffer"&&Array.isArray(c.data))return v(c.data)}function D(c){if(c>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return c|0}function L(c){return+c!=c&&(c=0),a.alloc(+c)}a.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==a.prototype},a.compare=function(n,o){if(et(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),et(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),!a.isBuffer(n)||!a.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;for(var h=n.length,u=o.length,y=0,m=Math.min(h,u);y<m;++y)if(n[y]!==o[y]){h=n[y],u=o[y];break}return h<u?-1:u<h?1:0},a.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return a.alloc(0);var h;if(o===void 0)for(o=0,h=0;h<n.length;++h)o+=n[h].length;var u=a.allocUnsafe(o),y=0;for(h=0;h<n.length;++h){var m=n[h];if(et(m,Uint8Array))y+m.length>u.length?a.from(m).copy(u,y):Uint8Array.prototype.set.call(u,m,y);else if(a.isBuffer(m))m.copy(u,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=m.length}return u};function N(c,n){if(a.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||et(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(c));var o=c.length,h=arguments.length>2&&arguments[2]===!0;if(!h&&o===0)return 0;for(var u=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Se(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return hi(c).length;default:if(u)return h?-1:Se(c).length;n=(""+n).toLowerCase(),u=!0}}a.byteLength=N;function B(c,n,o){var h=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(c||(c="utf8");;)switch(c){case"hex":return J(this,n,o);case"utf8":case"utf-8":return vt(this,n,o);case"ascii":return wt(this,n,o);case"latin1":case"binary":return M(this,n,o);case"base64":return mt(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,n,o);default:if(h)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),h=!0}}a.prototype._isBuffer=!0;function O(c,n,o){var h=c[n];c[n]=c[o],c[o]=h}a.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)O(this,o,o+1);return this},a.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)O(this,o,o+3),O(this,o+1,o+2);return this},a.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)O(this,o,o+7),O(this,o+1,o+6),O(this,o+2,o+5),O(this,o+3,o+4);return this},a.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?vt(this,0,n):B.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(n){if(!a.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:a.compare(this,n)===0},a.prototype.inspect=function(){var n="",o=t.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(n,o,h,u,y){if(et(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(n));if(o===void 0&&(o=0),h===void 0&&(h=n?n.length:0),u===void 0&&(u=0),y===void 0&&(y=this.length),o<0||h>n.length||u<0||y>this.length)throw new RangeError("out of range index");if(u>=y&&o>=h)return 0;if(u>=y)return-1;if(o>=h)return 1;if(o>>>=0,h>>>=0,u>>>=0,y>>>=0,this===n)return 0;for(var m=y-u,C=h-o,x=Math.min(m,C),P=this.slice(u,y),j=n.slice(o,h),k=0;k<x;++k)if(P[k]!==j[k]){m=P[k],C=j[k];break}return m<C?-1:C<m?1:0};function z(c,n,o,h,u){if(c.length===0)return-1;if(typeof o=="string"?(h=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Ae(o)&&(o=u?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(u)return-1;o=c.length-1}else if(o<0)if(u)o=0;else return-1;if(typeof n=="string"&&(n=a.from(n,h)),a.isBuffer(n))return n.length===0?-1:tt(c,n,o,h,u);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(c,n,o):Uint8Array.prototype.lastIndexOf.call(c,n,o):tt(c,[n],o,h,u);throw new TypeError("val must be string, number or Buffer")}function tt(c,n,o,h,u){var y=1,m=c.length,C=n.length;if(h!==void 0&&(h=String(h).toLowerCase(),h==="ucs2"||h==="ucs-2"||h==="utf16le"||h==="utf-16le")){if(c.length<2||n.length<2)return-1;y=2,m/=2,C/=2,o/=2}function x(ui,fi){return y===1?ui[fi]:ui.readUInt16BE(fi*y)}var P;if(u){var j=-1;for(P=o;P<m;P++)if(x(c,P)===x(n,j===-1?0:P-j)){if(j===-1&&(j=P),P-j+1===C)return j*y}else j!==-1&&(P-=P-j),j=-1}else for(o+C>m&&(o=m-C),P=o;P>=0;P--){for(var k=!0,zt=0;zt<C;zt++)if(x(c,P+zt)!==x(n,zt)){k=!1;break}if(k)return P}return-1}a.prototype.includes=function(n,o,h){return this.indexOf(n,o,h)!==-1},a.prototype.indexOf=function(n,o,h){return z(this,n,o,h,!0)},a.prototype.lastIndexOf=function(n,o,h){return z(this,n,o,h,!1)};function at(c,n,o,h){o=Number(o)||0;var u=c.length-o;h?(h=Number(h),h>u&&(h=u)):h=u;var y=n.length;h>y/2&&(h=y/2);for(var m=0;m<h;++m){var C=parseInt(n.substr(m*2,2),16);if(Ae(C))return m;c[o+m]=C}return m}function be(c,n,o,h){return Xt(Se(n,c.length-o),c,o,h)}function It(c,n,o,h){return Xt(zr(n),c,o,h)}function Oe(c,n,o,h){return Xt(hi(n),c,o,h)}function Yt(c,n,o,h){return Xt(Gr(n,c.length-o),c,o,h)}a.prototype.write=function(n,o,h,u){if(o===void 0)u="utf8",h=this.length,o=0;else if(h===void 0&&typeof o=="string")u=o,h=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(h)?(h=h>>>0,u===void 0&&(u="utf8")):(u=h,h=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var y=this.length-o;if((h===void 0||h>y)&&(h=y),n.length>0&&(h<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");u||(u="utf8");for(var m=!1;;)switch(u){case"hex":return at(this,n,o,h);case"utf8":case"utf-8":return be(this,n,o,h);case"ascii":case"latin1":case"binary":return It(this,n,o,h);case"base64":return Oe(this,n,o,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Yt(this,n,o,h);default:if(m)throw new TypeError("Unknown encoding: "+u);u=(""+u).toLowerCase(),m=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mt(c,n,o){return n===0&&o===c.length?xe.fromByteArray(c):xe.fromByteArray(c.slice(n,o))}function vt(c,n,o){o=Math.min(c.length,o);for(var h=[],u=n;u<o;){var y=c[u],m=null,C=y>239?4:y>223?3:y>191?2:1;if(u+C<=o){var x,P,j,k;switch(C){case 1:y<128&&(m=y);break;case 2:x=c[u+1],(x&192)===128&&(k=(y&31)<<6|x&63,k>127&&(m=k));break;case 3:x=c[u+1],P=c[u+2],(x&192)===128&&(P&192)===128&&(k=(y&15)<<12|(x&63)<<6|P&63,k>2047&&(k<55296||k>57343)&&(m=k));break;case 4:x=c[u+1],P=c[u+2],j=c[u+3],(x&192)===128&&(P&192)===128&&(j&192)===128&&(k=(y&15)<<18|(x&63)<<12|(P&63)<<6|j&63,k>65535&&k<1114112&&(m=k))}}m===null?(m=65533,C=1):m>65535&&(m-=65536,h.push(m>>>10&1023|55296),m=56320|m&1023),h.push(m),u+=C}return Wt(h)}var ct=4096;function Wt(c){var n=c.length;if(n<=ct)return String.fromCharCode.apply(String,c);for(var o="",h=0;h<n;)o+=String.fromCharCode.apply(String,c.slice(h,h+=ct));return o}function wt(c,n,o){var h="";o=Math.min(c.length,o);for(var u=n;u<o;++u)h+=String.fromCharCode(c[u]&127);return h}function M(c,n,o){var h="";o=Math.min(c.length,o);for(var u=n;u<o;++u)h+=String.fromCharCode(c[u]);return h}function J(c,n,o){var h=c.length;(!n||n<0)&&(n=0),(!o||o<0||o>h)&&(o=h);for(var u="",y=n;y<o;++y)u+=Zr[c[y]];return u}function I(c,n,o){for(var h=c.slice(n,o),u="",y=0;y<h.length-1;y+=2)u+=String.fromCharCode(h[y]+h[y+1]*256);return u}a.prototype.slice=function(n,o){var h=this.length;n=~~n,o=o===void 0?h:~~o,n<0?(n+=h,n<0&&(n=0)):n>h&&(n=h),o<0?(o+=h,o<0&&(o=0)):o>h&&(o=h),o<n&&(o=n);var u=this.subarray(n,o);return Object.setPrototypeOf(u,a.prototype),u};function T(c,n,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+n>o)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=this[n],y=1,m=0;++m<o&&(y*=256);)u+=this[n+m]*y;return u},a.prototype.readUintBE=a.prototype.readUIntBE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=this[n+--o],y=1;o>0&&(y*=256);)u+=this[n+--o]*y;return u},a.prototype.readUint8=a.prototype.readUInt8=function(n,o){return n=n>>>0,o||T(n,1,this.length),this[n]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||T(n,2,this.length),this[n]|this[n+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||T(n,2,this.length),this[n]<<8|this[n+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||T(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||T(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},a.prototype.readIntLE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=this[n],y=1,m=0;++m<o&&(y*=256);)u+=this[n+m]*y;return y*=128,u>=y&&(u-=Math.pow(2,8*o)),u},a.prototype.readIntBE=function(n,o,h){n=n>>>0,o=o>>>0,h||T(n,o,this.length);for(var u=o,y=1,m=this[n+--u];u>0&&(y*=256);)m+=this[n+--u]*y;return y*=128,m>=y&&(m-=Math.pow(2,8*o)),m},a.prototype.readInt8=function(n,o){return n=n>>>0,o||T(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},a.prototype.readInt16LE=function(n,o){n=n>>>0,o||T(n,2,this.length);var h=this[n]|this[n+1]<<8;return h&32768?h|4294901760:h},a.prototype.readInt16BE=function(n,o){n=n>>>0,o||T(n,2,this.length);var h=this[n+1]|this[n]<<8;return h&32768?h|4294901760:h},a.prototype.readInt32LE=function(n,o){return n=n>>>0,o||T(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},a.prototype.readInt32BE=function(n,o){return n=n>>>0,o||T(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},a.prototype.readFloatLE=function(n,o){return n=n>>>0,o||T(n,4,this.length),Ot.read(this,n,!0,23,4)},a.prototype.readFloatBE=function(n,o){return n=n>>>0,o||T(n,4,this.length),Ot.read(this,n,!1,23,4)},a.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||T(n,8,this.length),Ot.read(this,n,!0,52,8)},a.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||T(n,8,this.length),Ot.read(this,n,!1,52,8)};function $(c,n,o,h,u,y){if(!a.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>u||n<y)throw new RangeError('"value" argument is out of bounds');if(o+h>c.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(n,o,h,u){if(n=+n,o=o>>>0,h=h>>>0,!u){var y=Math.pow(2,8*h)-1;$(this,n,o,h,y,0)}var m=1,C=0;for(this[o]=n&255;++C<h&&(m*=256);)this[o+C]=n/m&255;return o+h},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(n,o,h,u){if(n=+n,o=o>>>0,h=h>>>0,!u){var y=Math.pow(2,8*h)-1;$(this,n,o,h,y,0)}var m=h-1,C=1;for(this[o+m]=n&255;--m>=0&&(C*=256);)this[o+m]=n/C&255;return o+h},a.prototype.writeUint8=a.prototype.writeUInt8=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,1,255,0),this[o]=n&255,o+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},a.prototype.writeIntLE=function(n,o,h,u){if(n=+n,o=o>>>0,!u){var y=Math.pow(2,8*h-1);$(this,n,o,h,y-1,-y)}var m=0,C=1,x=0;for(this[o]=n&255;++m<h&&(C*=256);)n<0&&x===0&&this[o+m-1]!==0&&(x=1),this[o+m]=(n/C>>0)-x&255;return o+h},a.prototype.writeIntBE=function(n,o,h,u){if(n=+n,o=o>>>0,!u){var y=Math.pow(2,8*h-1);$(this,n,o,h,y-1,-y)}var m=h-1,C=1,x=0;for(this[o+m]=n&255;--m>=0&&(C*=256);)n<0&&x===0&&this[o+m+1]!==0&&(x=1),this[o+m]=(n/C>>0)-x&255;return o+h},a.prototype.writeInt8=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},a.prototype.writeInt16LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},a.prototype.writeInt16BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},a.prototype.writeInt32LE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},a.prototype.writeInt32BE=function(n,o,h){return n=+n,o=o>>>0,h||$(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function ai(c,n,o,h,u,y){if(o+h>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function ci(c,n,o,h,u){return n=+n,o=o>>>0,u||ai(c,n,o,4),Ot.write(c,n,o,h,23,4),o+4}a.prototype.writeFloatLE=function(n,o,h){return ci(this,n,o,!0,h)},a.prototype.writeFloatBE=function(n,o,h){return ci(this,n,o,!1,h)};function li(c,n,o,h,u){return n=+n,o=o>>>0,u||ai(c,n,o,8),Ot.write(c,n,o,h,52,8),o+8}a.prototype.writeDoubleLE=function(n,o,h){return li(this,n,o,!0,h)},a.prototype.writeDoubleBE=function(n,o,h){return li(this,n,o,!1,h)},a.prototype.copy=function(n,o,h,u){if(!a.isBuffer(n))throw new TypeError("argument should be a Buffer");if(h||(h=0),!u&&u!==0&&(u=this.length),o>=n.length&&(o=n.length),o||(o=0),u>0&&u<h&&(u=h),u===h||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(h<0||h>=this.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("sourceEnd out of bounds");u>this.length&&(u=this.length),n.length-o<u-h&&(u=n.length-o+h);var y=u-h;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,h,u):Uint8Array.prototype.set.call(n,this.subarray(h,u),o),y},a.prototype.fill=function(n,o,h,u){if(typeof n=="string"){if(typeof o=="string"?(u=o,o=0,h=this.length):typeof h=="string"&&(u=h,h=this.length),u!==void 0&&typeof u!="string")throw new TypeError("encoding must be a string");if(typeof u=="string"&&!a.isEncoding(u))throw new TypeError("Unknown encoding: "+u);if(n.length===1){var y=n.charCodeAt(0);(u==="utf8"&&y<128||u==="latin1")&&(n=y)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<h)throw new RangeError("Out of range index");if(h<=o)return this;o=o>>>0,h=h===void 0?this.length:h>>>0,n||(n=0);var m;if(typeof n=="number")for(m=o;m<h;++m)this[m]=n;else{var C=a.isBuffer(n)?n:a.from(n,u),x=C.length;if(x===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(m=0;m<h-o;++m)this[m+o]=C[m%x]}return this};var Wr=/[^+/0-9A-Za-z-_]/g;function Xr(c){if(c=c.split("=")[0],c=c.trim().replace(Wr,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Se(c,n){n=n||1/0;for(var o,h=c.length,u=null,y=[],m=0;m<h;++m){if(o=c.charCodeAt(m),o>55295&&o<57344){if(!u){if(o>56319){(n-=3)>-1&&y.push(239,191,189);continue}else if(m+1===h){(n-=3)>-1&&y.push(239,191,189);continue}u=o;continue}if(o<56320){(n-=3)>-1&&y.push(239,191,189),u=o;continue}o=(u-55296<<10|o-56320)+65536}else u&&(n-=3)>-1&&y.push(239,191,189);if(u=null,o<128){if((n-=1)<0)break;y.push(o)}else if(o<2048){if((n-=2)<0)break;y.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;y.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;y.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return y}function zr(c){for(var n=[],o=0;o<c.length;++o)n.push(c.charCodeAt(o)&255);return n}function Gr(c,n){for(var o,h,u,y=[],m=0;m<c.length&&!((n-=2)<0);++m)o=c.charCodeAt(m),h=o>>8,u=o%256,y.push(u),y.push(h);return y}function hi(c){return xe.toByteArray(Xr(c))}function Xt(c,n,o,h){for(var u=0;u<h&&!(u+o>=n.length||u>=c.length);++u)n[u+o]=c[u];return u}function et(c,n){return c instanceof n||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===n.name}function Ae(c){return c!==c}var Zr=(function(){for(var c="0123456789abcdef",n=new Array(256),o=0;o<16;++o)for(var h=o*16,u=0;u<16;++u)n[h+u]=c[o]+c[u];return n})()}),R=he.Buffer;he.SlowBuffer;he.INSPECT_MAX_BYTES;he.kMaxLength;var ke=function(t,i){return ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l])},ke(t,i)};function ue(e,t){ke(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var gt=(function(e){ue(t,e);function t(i){var r=e.call(this,i)||this;return Object.setPrototypeOf(r,t.prototype),r}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t})(Error),F=(function(e){ue(t,e);function t(i){var r=e.call(this,i)||this;return Object.setPrototypeOf(r,t.prototype),r}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t})(TypeError);function ce(e){return e&&e.Math==Math&&e}function hr(){return ce(typeof globalThis=="object"&&globalThis)||ce(typeof window=="object"&&window)||ce(typeof self=="object"&&self)||ce(typeof global=="object"&&global)||Function("return this")()}function pn(){var e=hr();return typeof e.navigator=="object"&&e.navigator.product==="ReactNative"}var dn=function(t){var i=pn()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(i);for(var r=R.alloc(t),s=0;s<t;++s)r[s]=Math.floor(Math.random()*256);return r},gn=function(){{if(typeof window<"u"){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(R.alloc(t))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(R.alloc(t))}:dn}},ur=gn();function _n(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function Ue(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function yn(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function mn(e){return Ft(e)&&Object.prototype.toString.call(e)==="[object Date]"}function Ft(e){return typeof e=="object"&&e!==null}function fe(e,t){var i=!1;function r(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return i||(console.warn(t),i=!0),e.apply(this,s)}return r}function le(e){if(ArrayBuffer.isView(e))return R.from(e.buffer,e.byteOffset,e.byteLength);if(_n(e))return R.from(e);throw new F("Must use either Buffer or TypedArray")}var vn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,fr=function(e){return typeof e=="string"&&vn.test(e)},Fe=function(e){if(!fr(e))throw new F('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return R.from(t,"hex")},Gi=function(e,t){return t===void 0&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")};var jo=Math.pow(2,63)-1,Vo=-Math.pow(2,63),wn=Math.pow(2,53),En=-Math.pow(2,53);var pr=4;var _t=(function(){function e(t,i){if(!(this instanceof e))return new e(t,i);if(t!=null&&typeof t!="string"&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new F("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=i??e.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=R.alloc(e.BUFFER_SIZE),this.position=0):(typeof t=="string"?this.buffer=R.from(t,"binary"):Array.isArray(t)?this.buffer=R.from(t):this.buffer=le(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if(typeof t=="string"&&t.length!==1)throw new F("only accepts single character String");if(typeof t!="number"&&t.length!==1)throw new F("only accepts single character Uint8Array or Array");var i;if(typeof t=="string"?i=t.charCodeAt(0):typeof t=="number"?i=t:i=t[0],i<0||i>255)throw new F("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=i;else{var r=R.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=i}},e.prototype.write=function(t,i){if(i=typeof i=="number"?i:this.position,this.buffer.length<i+t.length){var r=R.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(le(t),i),this.position=i+t.byteLength>this.position?i+t.length:this.position):typeof t=="string"&&(this.buffer.write(t,i,t.length,"binary"),this.position=i+t.length>this.position?i+t.length:this.position)},e.prototype.read=function(t,i){return i=i&&i>0?i:this.position,this.buffer.slice(t,t+i)},e.prototype.value=function(t){return t=!!t,t&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(t){return this.buffer.toString(t)},e.prototype.toExtendedJSON=function(t){t=t||{};var i=this.buffer.toString("base64"),r=Number(this.sub_type).toString(16);return t.legacy?{$binary:i,$type:r.length===1?"0"+r:r}:{$binary:{base64:i,subType:r.length===1?"0"+r:r}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new Zi(this.buffer.slice(0,this.position));throw new gt('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,i){i=i||{};var r,s;if("$binary"in t?i.legacy&&typeof t.$binary=="string"&&"$type"in t?(s=t.$type?parseInt(t.$type,16):0,r=R.from(t.$binary,"base64")):typeof t.$binary!="string"&&(s=t.$binary.subType?parseInt(t.$binary.subType,16):0,r=R.from(t.$binary.base64,"base64")):"$uuid"in t&&(s=4,r=Fe(t.$uuid)),!r)throw new F("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return s===pr?new Zi(r):new e(r,s)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e})();Object.defineProperty(_t.prototype,"_bsontype",{value:"Binary"});var Be=16,Zi=(function(e){ue(t,e);function t(i){var r=this,s,l;if(i==null)s=t.generate();else if(i instanceof t)s=R.from(i.buffer),l=i.__id;else if(ArrayBuffer.isView(i)&&i.byteLength===Be)s=le(i);else if(typeof i=="string")s=Fe(i);else throw new F("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return r=e.call(this,s,pr)||this,r.__id=l,r}return Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer},set:function(i){this.buffer=i,t.cacheHexString&&(this.__id=Gi(i))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(i){if(i===void 0&&(i=!0),t.cacheHexString&&this.__id)return this.__id;var r=Gi(this.id,i);return t.cacheHexString&&(this.__id=r),r},t.prototype.toString=function(i){return i?this.id.toString(i):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(i){if(!i)return!1;if(i instanceof t)return i.id.equals(this.id);try{return new t(i).id.equals(this.id)}catch{return!1}},t.prototype.toBinary=function(){return new _t(this.id,_t.SUBTYPE_UUID)},t.generate=function(){var i=ur(Be);return i[6]=i[6]&15|64,i[8]=i[8]&63|128,R.from(i)},t.isValid=function(i){return i?i instanceof t?!0:typeof i=="string"?fr(i):Ue(i)?i.length!==Be?!1:(i[6]&240)===64&&(i[8]&128)===128:!1:!1},t.createFromHexString=function(i){var r=Fe(i);return new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t})(_t),pe=(function(){function e(t,i){if(!(this instanceof e))return new e(t,i);this.code=t,this.scope=i}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},e})();Object.defineProperty(pe.prototype,"_bsontype",{value:"Code"});function bn(e){return Ft(e)&&e.$id!=null&&typeof e.$ref=="string"&&(e.$db==null||typeof e.$db=="string")}var Mt=(function(){function e(t,i,r,s){if(!(this instanceof e))return new e(t,i,r,s);var l=t.split(".");l.length===2&&(r=l.shift(),t=l.shift()),this.collection=t,this.oid=i,this.db=r,this.fields=s||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},e.prototype.toExtendedJSON=function(t){t=t||{};var i={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(i.$db=this.db),i=Object.assign(i,this.fields)),i},e.fromExtendedJSON=function(t){var i=Object.assign({},t);return delete i.$ref,delete i.$id,delete i.$db,new e(t.$ref,t.$id,t.$db,i)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e})();Object.defineProperty(Mt.prototype,"_bsontype",{value:"DBRef"});var Z=void 0;try{Z=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Ki=65536,On=1<<24,At=Ki*Ki,dr=At*At,Ji=dr/2,qi={},Qi={},b=(function(){function e(t,i,r){if(t===void 0&&(t=0),!(this instanceof e))return new e(t,i,r);typeof t=="bigint"?Object.assign(this,e.fromBigInt(t,!!i)):typeof t=="string"?Object.assign(this,e.fromString(t,!!i)):(this.low=t|0,this.high=i|0,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,i,r){return new e(t,i,r)},e.fromInt=function(t,i){var r,s,l;return i?(t>>>=0,(l=0<=t&&t<256)&&(s=Qi[t],s)?s:(r=e.fromBits(t,(t|0)<0?-1:0,!0),l&&(Qi[t]=r),r)):(t|=0,(l=-128<=t&&t<128)&&(s=qi[t],s)?s:(r=e.fromBits(t,t<0?-1:0,!1),l&&(qi[t]=r),r))},e.fromNumber=function(t,i){if(isNaN(t))return i?e.UZERO:e.ZERO;if(i){if(t<0)return e.UZERO;if(t>=dr)return e.MAX_UNSIGNED_VALUE}else{if(t<=-Ji)return e.MIN_VALUE;if(t+1>=Ji)return e.MAX_VALUE}return t<0?e.fromNumber(-t,i).neg():e.fromBits(t%At|0,t/At|0,i)},e.fromBigInt=function(t,i){return e.fromString(t.toString(),i)},e.fromString=function(t,i,r){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e.ZERO;if(typeof i=="number"?(r=i,i=!1):i=!!i,r=r||10,r<2||36<r)throw RangeError("radix");var s;if((s=t.indexOf("-"))>0)throw Error("interior hyphen");if(s===0)return e.fromString(t.substring(1),i,r).neg();for(var l=e.fromNumber(Math.pow(r,8)),a=e.ZERO,f=0;f<t.length;f+=8){var p=Math.min(8,t.length-f),d=parseInt(t.substring(f,f+p),r);if(p<8){var g=e.fromNumber(Math.pow(r,p));a=a.mul(g).add(e.fromNumber(d))}else a=a.mul(l),a=a.add(e.fromNumber(d))}return a.unsigned=i,a},e.fromBytes=function(t,i,r){return r?e.fromBytesLE(t,i):e.fromBytesBE(t,i)},e.fromBytesLE=function(t,i){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,i)},e.fromBytesBE=function(t,i){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],i)},e.isLong=function(t){return Ft(t)&&t.__isLong__===!0},e.fromValue=function(t,i){return typeof t=="number"?e.fromNumber(t,i):typeof t=="string"?e.fromString(t,i):e.fromBits(t.low,t.high,typeof i=="boolean"?i:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var i=this.high>>>16,r=this.high&65535,s=this.low>>>16,l=this.low&65535,a=t.high>>>16,f=t.high&65535,p=t.low>>>16,d=t.low&65535,g=0,_=0,v=0,E=0;return E+=l+d,v+=E>>>16,E&=65535,v+=s+p,_+=v>>>16,v&=65535,_+=r+f,g+=_>>>16,_&=65535,g+=i+a,g&=65535,e.fromBits(v<<16|E,g<<16|_,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var i=this.isNegative(),r=t.isNegative();return i&&!r?-1:!i&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(t){return this.compare(t)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(Z){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var i=(this.unsigned?Z.div_u:Z.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(i,Z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var r,s,l;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;l=e.UZERO}else{if(this.eq(e.MIN_VALUE)){if(t.eq(e.ONE)||t.eq(e.NEG_ONE))return e.MIN_VALUE;if(t.eq(e.MIN_VALUE))return e.ONE;var a=this.shr(1);return r=a.div(t).shl(1),r.eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(s=this.sub(t.mul(r)),l=r.add(s.div(t)),l)}else if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();l=e.ZERO}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var f=Math.ceil(Math.log(r)/Math.LN2),p=f<=48?1:Math.pow(2,f-48),d=e.fromNumber(r),g=d.mul(t);g.isNegative()||g.gt(s);)r-=p,d=e.fromNumber(r,this.unsigned),g=d.mul(t);d.isZero()&&(d=e.ONE),l=l.add(d),s=s.sub(g)}return l},e.prototype.div=function(t){return this.divide(t)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},e.prototype.eq=function(t){return this.equals(t)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,i;for(i=31;i>0&&(t&1<<i)===0;i--);return this.high!==0?i+33:i+1},e.prototype.greaterThan=function(t){return this.comp(t)>0},e.prototype.gt=function(t){return this.greaterThan(t)},e.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},e.prototype.gte=function(t){return this.greaterThanOrEqual(t)},e.prototype.ge=function(t){return this.greaterThanOrEqual(t)},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.lessThan=function(t){return this.comp(t)<0},e.prototype.lt=function(t){return this.lessThan(t)},e.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},e.prototype.lte=function(t){return this.lessThanOrEqual(t)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),Z){var i=(this.unsigned?Z.rem_u:Z.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(i,Z.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(t){return this.modulo(t)},e.prototype.rem=function(t){return this.modulo(t)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),Z){var i=Z.mul(this.low,this.high,t.low,t.high);return e.fromBits(i,Z.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,l=this.low>>>16,a=this.low&65535,f=t.high>>>16,p=t.high&65535,d=t.low>>>16,g=t.low&65535,_=0,v=0,E=0,w=0;return w+=a*g,E+=w>>>16,w&=65535,E+=l*g,v+=E>>>16,E&=65535,E+=a*d,v+=E>>>16,E&=65535,v+=s*g,_+=v>>>16,v&=65535,v+=l*d,_+=v>>>16,v&=65535,v+=a*p,_+=v>>>16,v&=65535,_+=r*g+s*d+l*p+a*f,_&=65535,e.fromBits(E<<16|w,_<<16|v,this.unsigned)},e.prototype.mul=function(t){return this.multiply(t)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(t){return!this.equals(t)},e.prototype.neq=function(t){return this.notEquals(t)},e.prototype.ne=function(t){return this.notEquals(t)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(t){return this.shiftLeft(t)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(t){return this.shiftRight(t)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var i=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|i<<32-t,i>>>t,this.unsigned)}else return t===32?e.fromBits(i,0,this.unsigned):e.fromBits(i>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},e.prototype.shru=function(t){return this.shiftRightUnsigned(t)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(t){return this.subtract(t)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*At+(this.low>>>0):this.high*At+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var t=this.high,i=this.low;return[i&255,i>>>8&255,i>>>16&255,i>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},e.prototype.toBytesBE=function(){var t=this.high,i=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,i>>>24,i>>>16&255,i>>>8&255,i&255]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(e.MIN_VALUE)){var i=e.fromNumber(t),r=this.div(i),s=r.mul(i).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var l=e.fromNumber(Math.pow(t,6),this.unsigned),a=this,f="";;){var p=a.div(l),d=a.sub(p.mul(l)).toInt()>>>0,g=d.toString(t);if(a=p,a.isZero())return g+f;for(;g.length<6;)g="0"+g;f=""+g+f}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(t){return this.lessThanOrEqual(t)},e.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,i){var r=e.fromString(t.$numberLong);return i&&i.relaxed?r.toNumber():r},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(On),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e})();Object.defineProperty(b.prototype,"__isLong__",{value:!0});Object.defineProperty(b.prototype,"_bsontype",{value:"Long"});var Sn=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,An=/^(\+|-)?(Infinity|inf)$/i,Nn=/^(\+|-)?NaN$/i,Pt=6111,Le=-6176,tr=6176,Tn=34,Pe=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),er=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ir=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Cn=/^([-+])?(\d+)?$/,Dn=31,rr=16383,In=30,Rn=31;function nr(e){return!isNaN(parseInt(e,10))}function xn(e){var t=b.fromNumber(1e9),i=b.fromNumber(0);if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3])return{quotient:e,rem:i};for(var r=0;r<=3;r++)i=i.shiftLeft(32),i=i.add(new b(e.parts[r],0)),e.parts[r]=i.div(t).low,i=i.modulo(t);return{quotient:e,rem:i}}function Bn(e,t){if(!e&&!t)return{high:b.fromNumber(0),low:b.fromNumber(0)};var i=e.shiftRightUnsigned(32),r=new b(e.getLowBits(),0),s=t.shiftRightUnsigned(32),l=new b(t.getLowBits(),0),a=i.multiply(s),f=i.multiply(l),p=r.multiply(s),d=r.multiply(l);return a=a.add(f.shiftRightUnsigned(32)),f=new b(f.getLowBits(),0).add(p).add(d.shiftRightUnsigned(32)),a=a.add(f.shiftRightUnsigned(32)),d=f.shiftLeft(32).add(new b(d.getLowBits(),0)),{high:a,low:d}}function Ln(e,t){var i=e.high>>>0,r=t.high>>>0;if(i<r)return!0;if(i===r){var s=e.low>>>0,l=t.low>>>0;if(s<l)return!0}return!1}function St(e,t){throw new F('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var je=(function(){function e(t){if(!(this instanceof e))return new e(t);if(typeof t=="string")this.bytes=e.fromString(t).bytes;else if(Ue(t)){if(t.byteLength!==16)throw new F("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}else throw new F("Decimal128 must take a Buffer or string")}return e.fromString=function(t){var i=!1,r=!1,s=!1,l=0,a=0,f=0,p=0,d=0,g=[0],_=0,v=0,E=0,w=0,A=0,D=0,L=new b(0,0),N=new b(0,0),B=0,O=0;if(t.length>=7e3)throw new F(""+t+" not a valid Decimal128 string");var z=t.match(Sn),tt=t.match(An),at=t.match(Nn);if(!z&&!tt&&!at||t.length===0)throw new F(""+t+" not a valid Decimal128 string");if(z){var be=z[2],It=z[4],Oe=z[5],Yt=z[6];It&&Yt===void 0&&St(t,"missing exponent power"),It&&be===void 0&&St(t,"missing exponent base"),It===void 0&&(Oe||Yt)&&St(t,"missing e before exponent")}if((t[O]==="+"||t[O]==="-")&&(i=t[O++]==="-"),!nr(t[O])&&t[O]!=="."){if(t[O]==="i"||t[O]==="I")return new e(R.from(i?er:ir));if(t[O]==="N")return new e(R.from(Pe))}for(;nr(t[O])||t[O]===".";){if(t[O]==="."){r&&St(t,"contains multiple periods"),r=!0,O=O+1;continue}_<34&&(t[O]!=="0"||s)&&(s||(d=a),s=!0,g[v++]=parseInt(t[O],10),_=_+1),s&&(f=f+1),r&&(p=p+1),a=a+1,O=O+1}if(r&&!a)throw new F(""+t+" not a valid Decimal128 string");if(t[O]==="e"||t[O]==="E"){var mt=t.substr(++O).match(Cn);if(!mt||!mt[2])return new e(R.from(Pe));A=parseInt(mt[0],10),O=O+mt[0].length}if(t[O])return new e(R.from(Pe));if(E=0,!_)E=0,w=0,g[0]=0,f=1,_=1,l=0;else if(w=_-1,l=f,l!==1)for(;g[d+l-1]===0;)l=l-1;for(A<=p&&p-A>16384?A=Le:A=A-p;A>Pt;){if(w=w+1,w-E>Tn){var vt=g.join("");if(vt.match(/^0+$/)){A=Pt;break}St(t,"overflow")}A=A-1}for(;A<Le||_<f;){if(w===0&&l<_){A=Le,l=0;break}if(_<f?f=f-1:w=w-1,A<Pt)A=A+1;else{var vt=g.join("");if(vt.match(/^0+$/)){A=Pt;break}St(t,"overflow")}}if(w-E+1<l){var ct=a;r&&(d=d+1,ct=ct+1),i&&(d=d+1,ct=ct+1);var Wt=parseInt(t[d+w+1],10),wt=0;if(Wt>=5&&(wt=1,Wt===5)){for(wt=g[w]%2===1?1:0,D=d+w+2;D<ct;D++)if(parseInt(t[D],10)){wt=1;break}}if(wt){for(var M=w;M>=0;M--)if(++g[M]>9&&(g[M]=0,M===0))if(A<Pt)A=A+1,g[M]=1;else return new e(R.from(i?er:ir))}}if(L=b.fromNumber(0),N=b.fromNumber(0),l===0)L=b.fromNumber(0),N=b.fromNumber(0);else if(w-E<17){var M=E;for(N=b.fromNumber(g[M++]),L=new b(0,0);M<=w;M++)N=N.multiply(b.fromNumber(10)),N=N.add(b.fromNumber(g[M]))}else{var M=E;for(L=b.fromNumber(g[M++]);M<=w-17;M++)L=L.multiply(b.fromNumber(10)),L=L.add(b.fromNumber(g[M]));for(N=b.fromNumber(g[M++]);M<=w;M++)N=N.multiply(b.fromNumber(10)),N=N.add(b.fromNumber(g[M]))}var J=Bn(L,b.fromString("100000000000000000"));J.low=J.low.add(N),Ln(J.low,N)&&(J.high=J.high.add(b.fromNumber(1))),B=A+tr;var I={low:b.fromNumber(0),high:b.fromNumber(0)};J.high.shiftRightUnsigned(49).and(b.fromNumber(1)).equals(b.fromNumber(1))?(I.high=I.high.or(b.fromNumber(3).shiftLeft(61)),I.high=I.high.or(b.fromNumber(B).and(b.fromNumber(16383).shiftLeft(47))),I.high=I.high.or(J.high.and(b.fromNumber(0x7fffffffffff)))):(I.high=I.high.or(b.fromNumber(B&16383).shiftLeft(49)),I.high=I.high.or(J.high.and(b.fromNumber(562949953421311)))),I.low=J.low,i&&(I.high=I.high.or(b.fromString("9223372036854775808")));var T=R.alloc(16);return O=0,T[O++]=I.low.low&255,T[O++]=I.low.low>>8&255,T[O++]=I.low.low>>16&255,T[O++]=I.low.low>>24&255,T[O++]=I.low.high&255,T[O++]=I.low.high>>8&255,T[O++]=I.low.high>>16&255,T[O++]=I.low.high>>24&255,T[O++]=I.high.low&255,T[O++]=I.high.low>>8&255,T[O++]=I.high.low>>16&255,T[O++]=I.high.low>>24&255,T[O++]=I.high.high&255,T[O++]=I.high.high>>8&255,T[O++]=I.high.high>>16&255,T[O++]=I.high.high>>24&255,new e(T)},e.prototype.toString=function(){for(var t,i=0,r=new Array(36),s=0;s<r.length;s++)r[s]=0;var l=0,a=!1,f,p={parts:[0,0,0,0]},d,g,_=[];l=0;var v=this.bytes,E=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24,w=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24,A=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24,D=v[l++]|v[l++]<<8|v[l++]<<16|v[l++]<<24;l=0;var L={low:new b(E,w),high:new b(A,D)};L.high.lessThan(b.ZERO)&&_.push("-");var N=D>>26&Dn;if(N>>3===3){if(N===In)return _.join("")+"Infinity";if(N===Rn)return"NaN";t=D>>15&rr,f=8+(D>>14&1)}else f=D>>14&7,t=D>>17&rr;var B=t-tr;if(p.parts[0]=(D&16383)+((f&15)<<14),p.parts[1]=A,p.parts[2]=w,p.parts[3]=E,p.parts[0]===0&&p.parts[1]===0&&p.parts[2]===0&&p.parts[3]===0)a=!0;else for(g=3;g>=0;g--){var O=0,z=xn(p);if(p=z.quotient,O=z.rem.low,!!O)for(d=8;d>=0;d--)r[g*9+d]=O%10,O=Math.floor(O/10)}if(a)i=1,r[l]=0;else for(i=36;!r[l];)i=i-1,l=l+1;var tt=i-1+B;if(tt>=34||tt<=-7||B>0){if(i>34)return _.push("".concat(0)),B>0?_.push("E+".concat(B)):B<0&&_.push("E".concat(B)),_.join("");_.push("".concat(r[l++])),i=i-1,i&&_.push(".");for(var s=0;s<i;s++)_.push("".concat(r[l++]));_.push("E"),tt>0?_.push("+".concat(tt)):_.push("".concat(tt))}else if(B>=0)for(var s=0;s<i;s++)_.push("".concat(r[l++]));else{var at=i+B;if(at>0)for(var s=0;s<at;s++)_.push("".concat(r[l++]));else _.push("0");for(_.push(".");at++<0;)_.push("0");for(var s=0;s<i-Math.max(at-1,0);s++)_.push("".concat(r[l++]))}return _.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e})();Object.defineProperty(je.prototype,"_bsontype",{value:"Decimal128"});var de=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},e.fromExtendedJSON=function(t,i){var r=parseFloat(t.$numberDouble);return i&&i.relaxed?r:new e(r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},e})();Object.defineProperty(de.prototype,"_bsontype",{value:"Double"});var ge=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,i){return i&&i.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e})();Object.defineProperty(ge.prototype,"_bsontype",{value:"Int32"});var Ve=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e})();Object.defineProperty(Ve.prototype,"_bsontype",{value:"MaxKey"});var He=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e})();Object.defineProperty(He.prototype,"_bsontype",{value:"MinKey"});var Pn=new RegExp("^[0-9a-fA-F]{24}$"),dt=null,rt=Symbol("id"),H=(function(){function e(t){if(!(this instanceof e))return new e(t);var i;if(typeof t=="object"&&t&&"id"in t){if(typeof t.id!="string"&&!ArrayBuffer.isView(t.id))throw new F("Argument passed in must have an id that is of type string or Buffer");"toHexString"in t&&typeof t.toHexString=="function"?i=R.from(t.toHexString(),"hex"):i=t.id}else i=t;if(i==null||typeof i=="number")this[rt]=e.generate(typeof i=="number"?i:void 0);else if(ArrayBuffer.isView(i)&&i.byteLength===12)this[rt]=i instanceof R?i:le(i);else if(typeof i=="string")if(i.length===12){var r=R.from(i);if(r.byteLength===12)this[rt]=r;else throw new F("Argument passed in must be a string of 12 bytes")}else if(i.length===24&&Pn.test(i))this[rt]=R.from(i,"hex");else throw new F("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new F("Argument passed in does not match the accepted types");e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[rt]},set:function(t){this[rt]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){typeof t!="number"&&(t=Math.floor(Date.now()/1e3));var i=e.getInc(),r=R.alloc(12);return r.writeUInt32BE(t,0),dt===null&&(dt=ur(5)),r[4]=dt[0],r[5]=dt[1],r[6]=dt[2],r[7]=dt[3],r[8]=dt[4],r[11]=i&255,r[10]=i>>8&255,r[9]=i>>16&255,r},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(t==null)return!1;if(t instanceof e)return this[rt][11]===t[rt][11]&&this[rt].equals(t[rt]);if(typeof t=="string"&&e.isValid(t)&&t.length===12&&Ue(this.id))return t===R.prototype.toString.call(this.id,"latin1");if(typeof t=="string"&&e.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t=="string"&&e.isValid(t)&&t.length===12)return R.from(t).equals(this.id);if(typeof t=="object"&&"toHexString"in t&&typeof t.toHexString=="function"){var i=t.toHexString(),r=this.toHexString().toLowerCase();return typeof i=="string"&&i.toLowerCase()===r}return!1},e.prototype.getTimestamp=function(){var t=new Date,i=this.id.readUInt32BE(0);return t.setTime(Math.floor(i)*1e3),t},e.createPk=function(){return new e},e.createFromTime=function(t){var i=R.from([0,0,0,0,0,0,0,0,0,0,0,0]);return i.writeUInt32BE(t,0),new e(i)},e.createFromHexString=function(t){if(typeof t>"u"||t!=null&&t.length!==24)throw new F("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(R.from(t,"hex"))},e.isValid=function(t){if(t==null)return!1;try{return new e(t),!0}catch{return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(Math.random()*16777215),e})();Object.defineProperty(H.prototype,"generate",{value:fe(function(e){return H.generate(e)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(H.prototype,"getInc",{value:fe(function(){return H.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(H.prototype,"get_inc",{value:fe(function(){return H.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(H,"get_inc",{value:fe(function(){return H.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(H.prototype,"_bsontype",{value:"ObjectID"});function Mn(e){return e.split("").sort().join("")}var kt=(function(){function e(t,i){if(!(this instanceof e))return new e(t,i);if(this.pattern=t,this.options=Mn(i??""),this.pattern.indexOf("\0")!==-1)throw new gt("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new gt("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if(!(this.options[r]==="i"||this.options[r]==="m"||this.options[r]==="x"||this.options[r]==="l"||this.options[r]==="s"||this.options[r]==="u"))throw new gt("The regular expression option [".concat(this.options[r],"] is not supported"))}return e.parseOptions=function(t){return t?t.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t)if(typeof t.$regex!="string"){if(t.$regex._bsontype==="BSONRegExp")return t}else return new e(t.$regex,e.parseOptions(t.$options));if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new F("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e})();Object.defineProperty(kt.prototype,"_bsontype",{value:"BSONRegExp"});var $e=(function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e})();Object.defineProperty($e.prototype,"_bsontype",{value:"Symbol"});var kn=b,gr=(function(e){ue(t,e);function t(i,r){var s=this;return s instanceof t?(b.isLong(i)?s=e.call(this,i.low,i.high,!0)||this:Ft(i)&&typeof i.t<"u"&&typeof i.i<"u"?s=e.call(this,i.i,i.t,!0)||this:s=e.call(this,i,r,!0)||this,Object.defineProperty(s,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),s):new t(i,r)}return t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(i){return new t(b.fromInt(i,!0))},t.fromNumber=function(i){return new t(b.fromNumber(i,!0))},t.fromBits=function(i,r){return new t(i,r)},t.fromString=function(i,r){return new t(b.fromString(i,!0,r))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(i){return new t(i.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=b.MAX_UNSIGNED_VALUE,t})(kn);function Fn(e){return Ft(e)&&Reflect.has(e,"_bsontype")&&typeof e._bsontype=="string"}var _r=2147483647,yr=-2147483648,mr=9223372036854776e3,vr=-9223372036854776e3,Un={$oid:H,$binary:_t,$uuid:_t,$symbol:$e,$numberInt:ge,$numberDecimal:je,$numberDouble:de,$numberLong:b,$minKey:He,$maxKey:Ve,$regex:kt,$regularExpression:kt,$timestamp:gr};function wr(e,t){if(t===void 0&&(t={}),typeof e=="number"){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=yr&&e<=_r)return new ge(e);if(e>=vr&&e<=mr)return b.fromNumber(e)}return new de(e)}if(e==null||typeof e!="object")return e;if(e.$undefined)return null;for(var i=Object.keys(e).filter(function(_){return _.startsWith("$")&&e[_]!=null}),r=0;r<i.length;r++){var s=Un[i[r]];if(s)return s.fromExtendedJSON(e,t)}if(e.$date!=null){var l=e.$date,a=new Date;return t.legacy?typeof l=="number"?a.setTime(l):typeof l=="string"&&a.setTime(Date.parse(l)):typeof l=="string"?a.setTime(Date.parse(l)):b.isLong(l)?a.setTime(l.toNumber()):typeof l=="number"&&t.relaxed&&a.setTime(l),a}if(e.$code!=null){var f=Object.assign({},e);return e.$scope&&(f.$scope=wr(e.$scope)),pe.fromExtendedJSON(e)}if(bn(e)||e.$dbPointer){var p=e.$ref?e:e.$dbPointer;if(p instanceof Mt)return p;var d=Object.keys(p).filter(function(_){return _.startsWith("$")}),g=!0;if(d.forEach(function(_){["$ref","$id","$db"].indexOf(_)===-1&&(g=!1)}),g)return Mt.fromExtendedJSON(p)}return e}function jn(e,t){return e.map(function(i,r){t.seenObjects.push({propertyName:"index ".concat(r),obj:null});try{return ht(i,t)}finally{t.seenObjects.pop()}})}function or(e){var t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function ht(e,t){if((typeof e=="object"||typeof e=="function")&&e!==null){var i=t.seenObjects.findIndex(function(L){return L.obj===e});if(i!==-1){var r=t.seenObjects.map(function(L){return L.propertyName}),s=r.slice(0,i).map(function(L){return"".concat(L," -> ")}).join(""),l=r[i],a=" -> "+r.slice(i+1,r.length-1).map(function(L){return"".concat(L," -> ")}).join(""),f=r[r.length-1],p=" ".repeat(s.length+l.length/2),d="-".repeat(a.length+(l.length+f.length)/2-1);throw new F(`Converting circular structure to EJSON:
2
2
  `+" ".concat(s).concat(l).concat(a).concat(f,`
3
3
  `)+" ".concat(p,"\\").concat(d,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return jn(e,t);if(e===void 0)return null;if(e instanceof Date||mn(e)){var g=e.getTime(),_=g>-1&&g<2534023188e5;return t.legacy?t.relaxed&&_?{$date:e.getTime()}:{$date:or(e)}:t.relaxed&&_?{$date:or(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(typeof e=="number"&&(!t.relaxed||!isFinite(e))){if(Math.floor(e)===e){var v=e>=yr&&e<=_r,E=e>=vr&&e<=mr;if(v)return{$numberInt:e.toString()};if(E)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||yn(e)){var w=e.flags;if(w===void 0){var A=e.toString().match(/[gimuy]*$/);A&&(w=A[0])}var D=new kt(e.source,w);return D.toExtendedJSON(t)}return e!=null&&typeof e=="object"?Hn(e,t):e}var Vn={Binary:function(e){return new _t(e.value(),e.sub_type)},Code:function(e){return new pe(e.code,e.scope)},DBRef:function(e){return new Mt(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new je(e.bytes)},Double:function(e){return new de(e.value)},Int32:function(e){return new ge(e.value)},Long:function(e){return b.fromBits(e.low!=null?e.low:e.low_,e.low!=null?e.high:e.high_,e.low!=null?e.unsigned:e.unsigned_)},MaxKey:function(){return new Ve},MinKey:function(){return new He},ObjectID:function(e){return new H(e)},ObjectId:function(e){return new H(e)},BSONRegExp:function(e){return new kt(e.pattern,e.options)},Symbol:function(e){return new $e(e.value)},Timestamp:function(e){return gr.fromBits(e.low,e.high)}};function Hn(e,t){if(e==null||typeof e!="object")throw new gt("not an object instance");var i=e._bsontype;if(typeof i>"u"){var r={};for(var s in e){t.seenObjects.push({propertyName:s,obj:null});try{var l=ht(e[s],t);s==="__proto__"?Object.defineProperty(r,s,{value:l,writable:!0,enumerable:!0,configurable:!0}):r[s]=l}finally{t.seenObjects.pop()}}return r}else if(Fn(e)){var a=e;if(typeof a.toExtendedJSON!="function"){var f=Vn[e._bsontype];if(!f)throw new F("Unrecognized or invalid _bsontype: "+e._bsontype);a=f(a)}return i==="Code"&&a.scope?a=new pe(a.code,ht(a.scope,t)):i==="DBRef"&&a.oid&&(a=new Mt(ht(a.collection,t),ht(a.oid,t),ht(a.db,t),ht(a.fields,t))),a.toExtendedJSON(t)}else throw new gt("_bsontype must be a string, but was: "+typeof i)}var sr;(function(e){function t(l,a){var f=Object.assign({},{relaxed:!0,legacy:!1},a);return typeof f.relaxed=="boolean"&&(f.strict=!f.relaxed),typeof f.strict=="boolean"&&(f.relaxed=!f.strict),JSON.parse(l,function(p,d){if(p.indexOf("\0")!==-1)throw new gt("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(p)));return wr(d,f)})}e.parse=t;function i(l,a,f,p){f!=null&&typeof f=="object"&&(p=f,f=0),a!=null&&typeof a=="object"&&!Array.isArray(a)&&(p=a,a=void 0,f=0);var d=Object.assign({relaxed:!0,legacy:!1},p,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=ht(l,d);return JSON.stringify(g,a,f)}e.stringify=i;function r(l,a){return a=a||{},JSON.parse(i(l,a))}e.serialize=r;function s(l,a){return a=a||{},t(JSON.stringify(l),a)}e.deserialize=s})(sr||(sr={}));var ar,cr=hr();cr.Map?ar=cr.Map:ar=(function(){function e(t){t===void 0&&(t=[]),this._keys=[],this._values={};for(var i=0;i<t.length;i++)if(t[i]!=null){var r=t[i],s=r[0],l=r[1];this._keys.push(s),this._values[s]={v:l,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(t){var i=this._values[t];return i==null?!1:(delete this._values[t],this._keys.splice(i.i,1),!0)},e.prototype.entries=function(){var t=this,i=0;return{next:function(){var r=t._keys[i++];return{value:r!==void 0?[r,t._values[r].v]:void 0,done:r===void 0}}}},e.prototype.forEach=function(t,i){i=i||this;for(var r=0;r<this._keys.length;r++){var s=this._keys[r];t.call(i,this._values[s].v,s,i)}},e.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},e.prototype.has=function(t){return this._values[t]!=null},e.prototype.keys=function(){var t=this,i=0;return{next:function(){var r=t._keys[i++];return{value:r!==void 0?r:void 0,done:r===void 0}}}},e.prototype.set=function(t,i){return this._values[t]?(this._values[t].v=i,this):(this._keys.push(t),this._values[t]={v:i,i:this._keys.length-1},this)},e.prototype.values=function(){var t=this,i=0;return{next:function(){var r=t._keys[i++];return{value:r!==void 0?t._values[r].v:void 0,done:r===void 0}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e})();var Ho=b.fromNumber(wn),$o=b.fromNumber(En);var Me=new Uint8Array(8),Yo=new DataView(Me.buffer,Me.byteOffset,Me.byteLength);var $n=1024*1024*17,Wo=R.alloc($n);var _e=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}};var Er=class{constructor(t,i={},r,s){this.name=t;this.properties=i;this.id=s?new H(s):new H,this.occurred=new Date,r&&(this.trigger=new _e(r)),this.newEvent=!s}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(t){t&&(this.videos=[t.id])}};var Ut=class{_attachedHost;attach(t){return this._attachedHost=t,t.attach(this)}detach(){let t=this._attachedHost;t!=null&&(this._attachedHost=null,t.detach())}get isAttached(){return this._attachedHost!=null}setAttachedHost(t){this._attachedHost=t}},Nt=class extends Ut{component;viewContainerRef;injector;projectableNodes;constructor(t,i,r,s){super(),this.component=t,this.viewContainerRef=i,this.injector=r,this.projectableNodes=s}},Tt=class extends Ut{templateRef;viewContainerRef;context;injector;constructor(t,i,r,s){super(),this.templateRef=t,this.viewContainerRef=i,this.context=r,this.injector=s}get origin(){return this.templateRef.elementRef}attach(t,i=this.context){return this.context=i,super.attach(t)}detach(){return this.context=void 0,super.detach()}},Ye=class extends Ut{element;constructor(t){super(),this.element=t instanceof ut?t.nativeElement:t}},Ct=class{_attachedPortal;_disposeFn;_isDisposed=!1;hasAttached(){return!!this._attachedPortal}attach(t){if(t instanceof Nt)return this._attachedPortal=t,this.attachComponentPortal(t);if(t instanceof Tt)return this._attachedPortal=t,this.attachTemplatePortal(t);if(this.attachDomPortal&&t instanceof Ye)return this._attachedPortal=t,this.attachDomPortal(t)}attachDomPortal=null;detach(){this._attachedPortal&&(this._attachedPortal.setAttachedHost(null),this._attachedPortal=null),this._invokeDisposeFn()}dispose(){this.hasAttached()&&this.detach(),this._invokeDisposeFn(),this._isDisposed=!0}setDisposeFn(t){this._disposeFn=t}_invokeDisposeFn(){this._disposeFn&&(this._disposeFn(),this._disposeFn=null)}},ye=class extends Ct{outletElement;_appRef;_defaultInjector;constructor(t,i,r){super(),this.outletElement=t,this._appRef=i,this._defaultInjector=r}attachComponentPortal(t){let i;if(t.viewContainerRef){let r=t.injector||t.viewContainerRef.injector,s=r.get(De,null,{optional:!0})||void 0;i=t.viewContainerRef.createComponent(t.component,{index:t.viewContainerRef.length,injector:r,ngModuleRef:s,projectableNodes:t.projectableNodes||void 0}),this.setDisposeFn(()=>i.destroy())}else{let r=this._appRef,s=t.injector||this._defaultInjector||q.NULL,l=s.get(Gt,r.injector);i=Pi(t.component,{elementInjector:s,environmentInjector:l,projectableNodes:t.projectableNodes||void 0}),r.attachView(i.hostView),this.setDisposeFn(()=>{r.viewCount>0&&r.detachView(i.hostView),i.destroy()})}return this.outletElement.appendChild(this._getComponentRootNode(i)),this._attachedPortal=t,i}attachTemplatePortal(t){let i=t.viewContainerRef,r=i.createEmbeddedView(t.templateRef,t.context,{injector:t.injector});return r.rootNodes.forEach(s=>this.outletElement.appendChild(s)),r.detectChanges(),this.setDisposeFn(()=>{let s=i.indexOf(r);s!==-1&&i.remove(s)}),this._attachedPortal=t,r}attachDomPortal=t=>{let i=t.element;i.parentNode;let r=this.outletElement.ownerDocument.createComment("dom-portal");i.parentNode.insertBefore(r,i),this.outletElement.appendChild(i),this._attachedPortal=t,super.setDisposeFn(()=>{r.parentNode&&r.parentNode.replaceChild(i,r)})};dispose(){super.dispose(),this.outletElement.remove()}_getComponentRootNode(t){return t.hostView.rootNodes[0]}};var ze=(()=>{class e extends Ct{_moduleRef=S(De,{optional:!0});_document=S(W);_viewContainerRef=S(Ce);_isInitialized=!1;_attachedRef;constructor(){super()}get portal(){return this._attachedPortal}set portal(i){this.hasAttached()&&!i&&!this._isInitialized||(this.hasAttached()&&super.detach(),i&&super.attach(i),this._attachedPortal=i||null)}attached=new bt;get attachedRef(){return this._attachedRef}ngOnInit(){this._isInitialized=!0}ngOnDestroy(){super.dispose(),this._attachedRef=this._attachedPortal=null}attachComponentPortal(i){i.setAttachedHost(this);let r=i.viewContainerRef!=null?i.viewContainerRef:this._viewContainerRef,s=r.createComponent(i.component,{index:r.length,injector:i.injector||r.injector,projectableNodes:i.projectableNodes||void 0,ngModuleRef:this._moduleRef||void 0});return r!==this._viewContainerRef&&this._getRootNode().appendChild(s.hostView.rootNodes[0]),super.setDisposeFn(()=>s.destroy()),this._attachedPortal=i,this._attachedRef=s,this.attached.emit(s),s}attachTemplatePortal(i){i.setAttachedHost(this);let r=this._viewContainerRef.createEmbeddedView(i.templateRef,i.context,{injector:i.injector});return super.setDisposeFn(()=>this._viewContainerRef.clear()),this._attachedPortal=i,this._attachedRef=r,this.attached.emit(r),r}attachDomPortal=i=>{let r=i.element;r.parentNode;let s=this._document.createComment("dom-portal");i.setAttachedHost(this),r.parentNode.insertBefore(s,r),this._getRootNode().appendChild(r),this._attachedPortal=i,super.setDisposeFn(()=>{s.parentNode&&s.parentNode.replaceChild(r,s)})};_getRootNode(){let i=this._viewContainerRef.element.nativeElement;return i.nodeType===i.ELEMENT_NODE?i:i.parentNode}static \u0275fac=function(r){return new(r||e)};static \u0275dir=Rt({type:e,selectors:[["","cdkPortalOutlet",""]],inputs:{portal:[0,"cdkPortalOutlet","portal"]},outputs:{attached:"attached"},exportAs:["cdkPortalOutlet"],features:[Qt]})}return e})();var jt;function Yn(){if(jt==null&&typeof window<"u")try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>jt=!0}))}finally{jt=jt||!1}return jt}function br(e){return Yn()?e:!!e.capture}var Wn=new G("cdk-input-modality-detector-options"),Xn={ignoreKeys:[18,17,224,91,16]},Or=650,Ge={passive:!0,capture:!0},zn=(()=>{class e{_platform=S(it);_listenerCleanups;modalityDetected;modalityChanged;get mostRecentModality(){return this._modality.value}_mostRecentTarget=null;_modality=new gi(null);_options;_lastTouchMs=0;_onKeydown=i=>{this._options?.ignoreKeys?.some(r=>r===i.keyCode)||(this._modality.next("keyboard"),this._mostRecentTarget=ot(i))};_onMousedown=i=>{Date.now()-this._lastTouchMs<Or||(this._modality.next(Fi(i)?"keyboard":"mouse"),this._mostRecentTarget=ot(i))};_onTouchstart=i=>{if(Ui(i)){this._modality.next("keyboard");return}this._lastTouchMs=Date.now(),this._modality.next("touch"),this._mostRecentTarget=ot(i)};constructor(){let i=S(Q),r=S(W),s=S(Wn,{optional:!0});if(this._options=U(U({},Xn),s),this.modalityDetected=this._modality.pipe(wi(1)),this.modalityChanged=this.modalityDetected.pipe(vi()),this._platform.isBrowser){let l=S(Et).createRenderer(null,null);this._listenerCleanups=i.runOutsideAngular(()=>[l.listen(r,"keydown",this._onKeydown,Ge),l.listen(r,"mousedown",this._onMousedown,Ge),l.listen(r,"touchstart",this._onTouchstart,Ge)])}}ngOnDestroy(){this._modality.complete(),this._listenerCleanups?.forEach(i=>i())}static \u0275fac=function(r){return new(r||e)};static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),ve=(function(e){return e[e.IMMEDIATE=0]="IMMEDIATE",e[e.EVENTUAL=1]="EVENTUAL",e})(ve||{}),Gn=new G("cdk-focus-monitor-default-options"),me=br({passive:!0,capture:!0}),Sr=(()=>{class e{_ngZone=S(Q);_platform=S(it);_inputModalityDetector=S(zn);_origin=null;_lastFocusOrigin;_windowFocused=!1;_windowFocusTimeoutId;_originTimeoutId;_originFromTouchInteraction=!1;_elementInfo=new Map;_monitoredElementCount=0;_rootNodeFocusListenerCount=new Map;_detectionMode;_windowFocusListener=()=>{this._windowFocused=!0,this._windowFocusTimeoutId=setTimeout(()=>this._windowFocused=!1)};_document=S(W);_stopInputModalityDetector=new Y;constructor(){let i=S(Gn,{optional:!0});this._detectionMode=i?.detectionMode||ve.IMMEDIATE}_rootNodeFocusAndBlurListener=i=>{let r=ot(i);for(let s=r;s;s=s.parentElement)i.type==="focus"?this._onFocus(i,s):this._onBlur(i,s)};monitor(i,r=!1){let s=ie(i);if(!this._platform.isBrowser||s.nodeType!==1)return _i();let l=ji(s)||this._document,a=this._elementInfo.get(s);if(a)return r&&(a.checkChildren=!0),a.subject;let f={checkChildren:r,subject:new Y,rootNode:l};return this._elementInfo.set(s,f),this._registerGlobalListeners(f),f.subject}stopMonitoring(i){let r=ie(i),s=this._elementInfo.get(r);s&&(s.subject.complete(),this._setClasses(r),this._elementInfo.delete(r),this._removeGlobalListeners(s))}focusVia(i,r,s){let l=ie(i),a=this._document.activeElement;l===a?this._getClosestElementsInfo(l).forEach(([f,p])=>this._originChanged(f,r,p)):(this._setOrigin(r),typeof l.focus=="function"&&l.focus(s))}ngOnDestroy(){this._elementInfo.forEach((i,r)=>this.stopMonitoring(r))}_getWindow(){return this._document.defaultView||window}_getFocusOrigin(i){return this._origin?this._originFromTouchInteraction?this._shouldBeAttributedToTouch(i)?"touch":"program":this._origin:this._windowFocused&&this._lastFocusOrigin?this._lastFocusOrigin:i&&this._isLastInteractionFromInputLabel(i)?"mouse":"program"}_shouldBeAttributedToTouch(i){return this._detectionMode===ve.EVENTUAL||!!i?.contains(this._inputModalityDetector._mostRecentTarget)}_setClasses(i,r){i.classList.toggle("cdk-focused",!!r),i.classList.toggle("cdk-touch-focused",r==="touch"),i.classList.toggle("cdk-keyboard-focused",r==="keyboard"),i.classList.toggle("cdk-mouse-focused",r==="mouse"),i.classList.toggle("cdk-program-focused",r==="program")}_setOrigin(i,r=!1){this._ngZone.runOutsideAngular(()=>{if(this._origin=i,this._originFromTouchInteraction=i==="touch"&&r,this._detectionMode===ve.IMMEDIATE){clearTimeout(this._originTimeoutId);let s=this._originFromTouchInteraction?Or:1;this._originTimeoutId=setTimeout(()=>this._origin=null,s)}})}_onFocus(i,r){let s=this._elementInfo.get(r),l=ot(i);!s||!s.checkChildren&&r!==l||this._originChanged(r,this._getFocusOrigin(l),s)}_onBlur(i,r){let s=this._elementInfo.get(r);!s||s.checkChildren&&i.relatedTarget instanceof Node&&r.contains(i.relatedTarget)||(this._setClasses(r),this._emitOrigin(s,null))}_emitOrigin(i,r){i.subject.observers.length&&this._ngZone.run(()=>i.subject.next(r))}_registerGlobalListeners(i){if(!this._platform.isBrowser)return;let r=i.rootNode,s=this._rootNodeFocusListenerCount.get(r)||0;s||this._ngZone.runOutsideAngular(()=>{r.addEventListener("focus",this._rootNodeFocusAndBlurListener,me),r.addEventListener("blur",this._rootNodeFocusAndBlurListener,me)}),this._rootNodeFocusListenerCount.set(r,s+1),++this._monitoredElementCount===1&&(this._ngZone.runOutsideAngular(()=>{this._getWindow().addEventListener("focus",this._windowFocusListener)}),this._inputModalityDetector.modalityDetected.pipe(bi(this._stopInputModalityDetector)).subscribe(l=>{this._setOrigin(l,!0)}))}_removeGlobalListeners(i){let r=i.rootNode;if(this._rootNodeFocusListenerCount.has(r)){let s=this._rootNodeFocusListenerCount.get(r);s>1?this._rootNodeFocusListenerCount.set(r,s-1):(r.removeEventListener("focus",this._rootNodeFocusAndBlurListener,me),r.removeEventListener("blur",this._rootNodeFocusAndBlurListener,me),this._rootNodeFocusListenerCount.delete(r))}--this._monitoredElementCount||(this._getWindow().removeEventListener("focus",this._windowFocusListener),this._stopInputModalityDetector.next(),clearTimeout(this._windowFocusTimeoutId),clearTimeout(this._originTimeoutId))}_originChanged(i,r,s){this._setClasses(i,r),this._emitOrigin(s,r),this._lastFocusOrigin=r}_getClosestElementsInfo(i){let r=[];return this._elementInfo.forEach((s,l)=>{(l===i||s.checkChildren&&l.contains(i))&&r.push([l,s])}),r}_isLastInteractionFromInputLabel(i){let{_mostRecentTarget:r,mostRecentModality:s}=this._inputModalityDetector;if(s!=="mouse"||!r||r===i||i.nodeName!=="INPUT"&&i.nodeName!=="TEXTAREA"||i.disabled)return!1;let l=i.labels;if(l){for(let a=0;a<l.length;a++)if(l[a].contains(r))return!0}return!1}static \u0275fac=function(r){return new(r||e)};static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var Ar=(()=>{class e{static \u0275fac=function(r){return new(r||e)};static \u0275cmp=lt({type:e,selectors:[["ng-component"]],exportAs:["cdkVisuallyHidden"],decls:0,vars:0,template:function(r,s){},styles:[`.cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}
4
4
  `],encapsulation:2,changeDetection:0})}return e})();var Ke=(()=>{class e{_platform=S(it);constructor(){}isDisabled(i){return i.hasAttribute("disabled")}isVisible(i){return qn(i)&&getComputedStyle(i).visibility==="visible"}isTabbable(i){if(!this._platform.isBrowser)return!1;let r=Jn(so(i));if(r&&(Nr(r)===-1||!this.isVisible(r)))return!1;let s=i.nodeName.toLowerCase(),l=Nr(i);return i.hasAttribute("contenteditable")?l!==-1:s==="iframe"||s==="object"||this._platform.WEBKIT&&this._platform.IOS&&!no(i)?!1:s==="audio"?i.hasAttribute("controls")?l!==-1:!1:s==="video"?l===-1?!1:l!==null?!0:this._platform.FIREFOX||i.hasAttribute("controls"):i.tabIndex>=0}isFocusable(i,r){return oo(i)&&!this.isDisabled(i)&&(r?.ignoreVisibility||this.isVisible(i))}static \u0275fac=function(r){return new(r||e)};static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function Jn(e){try{return e.frameElement}catch{return null}}function qn(e){return!!(e.offsetWidth||e.offsetHeight||typeof e.getClientRects=="function"&&e.getClientRects().length)}function Qn(e){let t=e.nodeName.toLowerCase();return t==="input"||t==="select"||t==="button"||t==="textarea"}function to(e){return io(e)&&e.type=="hidden"}function eo(e){return ro(e)&&e.hasAttribute("href")}function io(e){return e.nodeName.toLowerCase()=="input"}function ro(e){return e.nodeName.toLowerCase()=="a"}function Tr(e){if(!e.hasAttribute("tabindex")||e.tabIndex===void 0)return!1;let t=e.getAttribute("tabindex");return!!(t&&!isNaN(parseInt(t,10)))}function Nr(e){if(!Tr(e))return null;let t=parseInt(e.getAttribute("tabindex")||"",10);return isNaN(t)?-1:t}function no(e){let t=e.nodeName.toLowerCase(),i=t==="input"&&e.type;return i==="text"||i==="password"||t==="select"||t==="textarea"}function oo(e){return to(e)?!1:Qn(e)||eo(e)||e.hasAttribute("contenteditable")||Tr(e)}function so(e){return e.ownerDocument&&e.ownerDocument.defaultView||window}var Ze=class{_element;_checker;_ngZone;_document;_injector;_startAnchor;_endAnchor;_hasAttached=!1;startAnchorListener=()=>this.focusLastTabbableElement();endAnchorListener=()=>this.focusFirstTabbableElement();get enabled(){return this._enabled}set enabled(t){this._enabled=t,this._startAnchor&&this._endAnchor&&(this._toggleAnchorTabIndex(t,this._startAnchor),this._toggleAnchorTabIndex(t,this._endAnchor))}_enabled=!0;constructor(t,i,r,s,l=!1,a){this._element=t,this._checker=i,this._ngZone=r,this._document=s,this._injector=a,l||this.attachAnchors()}destroy(){let t=this._startAnchor,i=this._endAnchor;t&&(t.removeEventListener("focus",this.startAnchorListener),t.remove()),i&&(i.removeEventListener("focus",this.endAnchorListener),i.remove()),this._startAnchor=this._endAnchor=null,this._hasAttached=!1}attachAnchors(){return this._hasAttached?!0:(this._ngZone.runOutsideAngular(()=>{this._startAnchor||(this._startAnchor=this._createAnchor(),this._startAnchor.addEventListener("focus",this.startAnchorListener)),this._endAnchor||(this._endAnchor=this._createAnchor(),this._endAnchor.addEventListener("focus",this.endAnchorListener))}),this._element.parentNode&&(this._element.parentNode.insertBefore(this._startAnchor,this._element),this._element.parentNode.insertBefore(this._endAnchor,this._element.nextSibling),this._hasAttached=!0),this._hasAttached)}focusInitialElementWhenReady(t){return new Promise(i=>{this._executeOnStable(()=>i(this.focusInitialElement(t)))})}focusFirstTabbableElementWhenReady(t){return new Promise(i=>{this._executeOnStable(()=>i(this.focusFirstTabbableElement(t)))})}focusLastTabbableElementWhenReady(t){return new Promise(i=>{this._executeOnStable(()=>i(this.focusLastTabbableElement(t)))})}_getRegionBoundary(t){let i=this._element.querySelectorAll(`[cdk-focus-region-${t}], [cdkFocusRegion${t}], [cdk-focus-${t}]`);return t=="start"?i.length?i[0]:this._getFirstTabbableElement(this._element):i.length?i[i.length-1]:this._getLastTabbableElement(this._element)}focusInitialElement(t){let i=this._element.querySelector("[cdk-focus-initial], [cdkFocusInitial]");if(i){if(!this._checker.isFocusable(i)){let r=this._getFirstTabbableElement(i);return r?.focus(t),!!r}return i.focus(t),!0}return this.focusFirstTabbableElement(t)}focusFirstTabbableElement(t){let i=this._getRegionBoundary("start");return i&&i.focus(t),!!i}focusLastTabbableElement(t){let i=this._getRegionBoundary("end");return i&&i.focus(t),!!i}hasAttached(){return this._hasAttached}_getFirstTabbableElement(t){if(this._checker.isFocusable(t)&&this._checker.isTabbable(t))return t;let i=t.children;for(let r=0;r<i.length;r++){let s=i[r].nodeType===this._document.ELEMENT_NODE?this._getFirstTabbableElement(i[r]):null;if(s)return s}return null}_getLastTabbableElement(t){if(this._checker.isFocusable(t)&&this._checker.isTabbable(t))return t;let i=t.children;for(let r=i.length-1;r>=0;r--){let s=i[r].nodeType===this._document.ELEMENT_NODE?this._getLastTabbableElement(i[r]):null;if(s)return s}return null}_createAnchor(){let t=this._document.createElement("div");return this._toggleAnchorTabIndex(this._enabled,t),t.classList.add("cdk-visually-hidden"),t.classList.add("cdk-focus-trap-anchor"),t.setAttribute("aria-hidden","true"),t}_toggleAnchorTabIndex(t,i){t?i.setAttribute("tabindex","0"):i.removeAttribute("tabindex")}toggleAnchors(t){this._startAnchor&&this._endAnchor&&(this._toggleAnchorTabIndex(t,this._startAnchor),this._toggleAnchorTabIndex(t,this._endAnchor))}_executeOnStable(t){this._injector?ft(t,{injector:this._injector}):setTimeout(t)}},Cr=(()=>{class e{_checker=S(Ke);_ngZone=S(Q);_document=S(W);_injector=S(q);constructor(){S(xt).load(Ar)}create(i,r=!1){return new Ze(i,this._checker,this._ngZone,this._document,r,this._injector)}static \u0275fac=function(r){return new(r||e)};static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function Dr(e,...t){return t.length?t.some(i=>e[i]):e.altKey||e.shiftKey||e.ctrlKey||e.metaKey}function Je(){return typeof __karma__<"u"&&!!__karma__||typeof jasmine<"u"&&!!jasmine||typeof jest<"u"&&!!jest||typeof Mocha<"u"&&!!Mocha}function st(e){return e==null?"":typeof e=="string"?e:`${e}px`}var Ir=Hi();function Br(e){return new qe(e.get($i),e.get(W))}var qe=class{_viewportRuler;_previousHTMLStyles={top:"",left:""};_previousScrollPosition;_isEnabled=!1;_document;constructor(t,i){this._viewportRuler=t,this._document=i}attach(){}enable(){if(this._canBeEnabled()){let t=this._document.documentElement;this._previousScrollPosition=this._viewportRuler.getViewportScrollPosition(),this._previousHTMLStyles.left=t.style.left||"",this._previousHTMLStyles.top=t.style.top||"",t.style.left=st(-this._previousScrollPosition.left),t.style.top=st(-this._previousScrollPosition.top),t.classList.add("cdk-global-scrollblock"),this._isEnabled=!0}}disable(){if(this._isEnabled){let t=this._document.documentElement,i=this._document.body,r=t.style,s=i.style,l=r.scrollBehavior||"",a=s.scrollBehavior||"";this._isEnabled=!1,r.left=this._previousHTMLStyles.left,r.top=this._previousHTMLStyles.top,t.classList.remove("cdk-global-scrollblock"),Ir&&(r.scrollBehavior=s.scrollBehavior="auto"),window.scroll(this._previousScrollPosition.left,this._previousScrollPosition.top),Ir&&(r.scrollBehavior=l,s.scrollBehavior=a)}}_canBeEnabled(){if(this._document.documentElement.classList.contains("cdk-global-scrollblock")||this._isEnabled)return!1;let i=this._document.documentElement,r=this._viewportRuler.getViewportSize();return i.scrollHeight>r.height||i.scrollWidth>r.width}};var Qe=class{enable(){}disable(){}attach(){}};var Vt=class{positionStrategy;scrollStrategy=new Qe;panelClass="";hasBackdrop=!1;backdropClass="cdk-overlay-dark-backdrop";disableAnimations;width;height;minWidth;minHeight;maxWidth;maxHeight;direction;disposeOnNavigation=!1;constructor(t){if(t){let i=Object.keys(t);for(let r of i)t[r]!==void 0&&(this[r]=t[r])}}};var Lr=(()=>{class e{_attachedOverlays=[];_document=S(W);_isAttached;constructor(){}ngOnDestroy(){this.detach()}add(i){this.remove(i),this._attachedOverlays.push(i)}remove(i){let r=this._attachedOverlays.indexOf(i);r>-1&&this._attachedOverlays.splice(r,1),this._attachedOverlays.length===0&&this.detach()}static \u0275fac=function(r){return new(r||e)};static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),co=(()=>{class e extends Lr{_ngZone=S(Q);_renderer=S(Et).createRenderer(null,null);_cleanupKeydown;add(i){super.add(i),this._isAttached||(this._ngZone.runOutsideAngular(()=>{this._cleanupKeydown=this._renderer.listen("body","keydown",this._keydownListener)}),this._isAttached=!0)}detach(){this._isAttached&&(this._cleanupKeydown?.(),this._isAttached=!1)}_keydownListener=i=>{let r=this._attachedOverlays;for(let s=r.length-1;s>-1;s--)if(r[s]._keydownEvents.observers.length>0){this._ngZone.run(()=>r[s]._keydownEvents.next(i));break}};static \u0275fac=(()=>{let i;return function(s){return(i||(i=Kt(e)))(s||e)}})();static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),lo=(()=>{class e extends Lr{_platform=S(it);_ngZone=S(Q);_renderer=S(Et).createRenderer(null,null);_cursorOriginalValue;_cursorStyleIsSet=!1;_pointerDownEventTarget;_cleanups;add(i){if(super.add(i),!this._isAttached){let r=this._document.body,s={capture:!0},l=this._renderer;this._cleanups=this._ngZone.runOutsideAngular(()=>[l.listen(r,"pointerdown",this._pointerDownListener,s),l.listen(r,"click",this._clickListener,s),l.listen(r,"auxclick",this._clickListener,s),l.listen(r,"contextmenu",this._clickListener,s)]),this._platform.IOS&&!this._cursorStyleIsSet&&(this._cursorOriginalValue=r.style.cursor,r.style.cursor="pointer",this._cursorStyleIsSet=!0),this._isAttached=!0}}detach(){this._isAttached&&(this._cleanups?.forEach(i=>i()),this._cleanups=void 0,this._platform.IOS&&this._cursorStyleIsSet&&(this._document.body.style.cursor=this._cursorOriginalValue,this._cursorStyleIsSet=!1),this._isAttached=!1)}_pointerDownListener=i=>{this._pointerDownEventTarget=ot(i)};_clickListener=i=>{let r=ot(i),s=i.type==="click"&&this._pointerDownEventTarget?this._pointerDownEventTarget:r;this._pointerDownEventTarget=null;let l=this._attachedOverlays.slice();for(let a=l.length-1;a>-1;a--){let f=l[a];if(f._outsidePointerEvents.observers.length<1||!f.hasAttached())continue;if(Rr(f.overlayElement,r)||Rr(f.overlayElement,s))break;let p=f._outsidePointerEvents;this._ngZone?this._ngZone.run(()=>p.next(i)):p.next(i)}};static \u0275fac=(()=>{let i;return function(s){return(i||(i=Kt(e)))(s||e)}})();static \u0275prov=V({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function Rr(e,t){let i=typeof ShadowRoot<"u"&&ShadowRoot,r=t;for(;r;){if(r===e)return!0;r=i&&r instanceof ShadowRoot?r.host:r.parentNode}return!1}var Pr=(()=>{class e{static \u0275fac=function(r){return new(r||e)};static \u0275cmp=lt({type:e,selectors:[["ng-component"]],hostAttrs:["cdk-overlay-style-loader",""],decls:0,vars:0,template:function(r,s){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed}@layer cdk-overlay{.cdk-overlay-container{z-index:1000}}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute}@layer cdk-overlay{.cdk-global-overlay-wrapper{z-index:1000}}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%}@layer cdk-overlay{.cdk-overlay-pane{z-index:1000}}.cdk-overlay-backdrop{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation}@layer cdk-overlay{.cdk-overlay-backdrop{z-index:1000;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}}@media(prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media(forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}@layer cdk-overlay{.cdk-overlay-dark-backdrop{background:rgba(0,0,0,.32)}}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px}@layer cdk-overlay{.cdk-overlay-connected-position-bounding-box{z-index:1000}}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}
package/dist/main.min.js CHANGED
@@ -7,7 +7,7 @@ import{a as _,b as Z,c as Lo,d as hm,e as Mo,f as Ar,g as Si}from"./chunk-V7UGKY
7
7
 
8
8
  `+ne.message+`
9
9
  `+Array(ne.message.length+1).join("=")+`
10
- `+T(A,U)):ne}}function kt(A,R){var V;return R.cache&&R.name&&R.storage.templates.get(R.name)?R.storage.templates.get(R.name):(V=typeof A=="function"?A:et(A,R),R.cache&&R.name&&R.storage.templates.define(R.name,V),V)}Ae.l.bind(Ae),t.compile=et,t.compileScope=P,t.compileScopeIntoFunction=G,t.compileToString=T,t.defaultConfig=Ae,t.filters=Te,t.getConfig=qe,t.helpers=me,t.nativeHelpers=Be,t.parse=y,t.render=function(A,R,V,U){var H=qe(V||{});if(!H.async)return kt(A,H)(R,H);if(!U){if(typeof n=="function")return new n(function(ne,he){try{ne(kt(A,H)(R,H))}catch(Xe){he(Xe)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{kt(A,H)(R,H,U)}catch(ne){return U(ne)}},t.templates=se,Object.defineProperty(t,"__esModule",{value:!0})})});var ou="11.5.2";var Hv=ou.split("-")[0].split(".").slice(0,3).map(t=>t.padStart(2,"0")).join(""),Qs="WEB",gm="CooeeSDK",Kr=ou,ym=parseInt(Hv,10);var vm=["collection","product","cart"],Em=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}],_m=["View Item","View Cart","View Collection"];var Zs=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Kr}/dist`,zt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:Zs,styleURL:`${Zs}/widget.min.css`,widgetURL:`${Zs}/widget.min.js`,swiperStyleURL:`${Zs}/swiper-bundle.min.css`};var Yt=Ar(Ii());var b=class{static debuggerEl;static infoLogs=[];static log(...e){Yt.default.info(...e)}static verbose(...e){Yt.default.debug(...e)}static error(...e){Yt.default.error(...e)}static warn(...e){Yt.default.warn(...e)}static info(...e){Yt.default.info(...e),this.infoLogs.unshift({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){Yt.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function wm(t=gm){Yt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${Kr}):`)}});let e=su();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Yt.default.setLevel(Yt.default[localStorage.cooeeLogLevel]):Yt.default.setLevel(zt.debug?Yt.default.TRACE:Yt.default.OFF)}function su(){return new URL(location.href).searchParams?.get("cooee-debug")}function Sm(){let t=`
10
+ `+T(A,U)):ne}}function kt(A,R){var V;return R.cache&&R.name&&R.storage.templates.get(R.name)?R.storage.templates.get(R.name):(V=typeof A=="function"?A:et(A,R),R.cache&&R.name&&R.storage.templates.define(R.name,V),V)}Ae.l.bind(Ae),t.compile=et,t.compileScope=P,t.compileScopeIntoFunction=G,t.compileToString=T,t.defaultConfig=Ae,t.filters=Te,t.getConfig=qe,t.helpers=me,t.nativeHelpers=Be,t.parse=y,t.render=function(A,R,V,U){var H=qe(V||{});if(!H.async)return kt(A,H)(R,H);if(!U){if(typeof n=="function")return new n(function(ne,he){try{ne(kt(A,H)(R,H))}catch(Xe){he(Xe)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{kt(A,H)(R,H,U)}catch(ne){return U(ne)}},t.templates=se,Object.defineProperty(t,"__esModule",{value:!0})})});var ou="11.5.3";var Hv=ou.split("-")[0].split(".").slice(0,3).map(t=>t.padStart(2,"0")).join(""),Qs="WEB",gm="CooeeSDK",Kr=ou,ym=parseInt(Hv,10);var vm=["collection","product","cart"],Em=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}],_m=["View Item","View Cart","View Collection"];var Zs=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Kr}/dist`,zt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:Zs,styleURL:`${Zs}/widget.min.css`,widgetURL:`${Zs}/widget.min.js`,swiperStyleURL:`${Zs}/swiper-bundle.min.css`};var Yt=Ar(Ii());var b=class{static debuggerEl;static infoLogs=[];static log(...e){Yt.default.info(...e)}static verbose(...e){Yt.default.debug(...e)}static error(...e){Yt.default.error(...e)}static warn(...e){Yt.default.warn(...e)}static info(...e){Yt.default.info(...e),this.infoLogs.unshift({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){Yt.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function wm(t=gm){Yt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${Kr}):`)}});let e=su();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?Yt.default.setLevel(Yt.default[localStorage.cooeeLogLevel]):Yt.default.setLevel(zt.debug?Yt.default.TRACE:Yt.default.OFF)}function su(){return new URL(location.href).searchParams?.get("cooee-debug")}function Sm(){let t=`
11
11
  display: inline-block;
12
12
  font-size: 14px;
13
13
  background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
@@ -1 +1 @@
1
- import{a as C,b}from"./chunk-PM33IRPM.js";import{e as g,f as h,i as u,l as f}from"./chunk-C4QGUG65.js";import{Ba as l,Qa as c,X as m,na as n,oa as i,pa as r,v as s}from"./chunk-KHVPWQ5E.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};
1
+ import{a as C,b}from"./chunk-T7U4ITDL.js";import{e as g,f as h,i as u,l as f}from"./chunk-XJRPLKLE.js";import{Ba as l,Qa as c,X as m,na as n,oa as i,pa as r,v as s}from"./chunk-KHVPWQ5E.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,3 @@
1
+ import{A as Me,B as Re,a as _e,c as O,d as Ce,f as U,k as Q,q as R,r as De,s as be,t as Te,u as Ie,v as Ee,x as Se,y as ke,z as Pe}from"./chunk-MG3M2WWH.js";import{a as Oe,b as Ne}from"./chunk-T7U4ITDL.js";import{c as we,e as fe,f as N,g as H,i as xe,j as Ve,k as ye,l as F}from"./chunk-XJRPLKLE.js";import"./chunk-74XS3G6Q.js";import{$a as me,Ba as g,D as Y,Da as a,E as f,Ga as $,Ha as j,I as T,Ia as W,Ja as ae,Ka as de,L as J,La as b,M as X,Ma as S,O as s,Ta as se,Ua as le,V as Z,Va as ce,X as w,Za as pe,ba as I,fb as ue,ga as E,ha as x,ia as V,ib as k,ja as ee,jb as P,ka as y,kb as M,la as D,lb as ge,ma as u,na as l,oa as d,pa as _,qa as te,ra as ie,sa as oe,sb as he,ta as ne,ua as re,ub as ve,v as m,va as B,x as c,y as p,za as v}from"./chunk-KHVPWQ5E.js";import"./chunk-V7UGKYBN.js";var A=class n{dialogState=P();dialog=m(ye);triggerData=m(fe)().triggerData;eventData=m(N);containerRef=m(Z);async share(t){t.stopPropagation(),t.preventDefault(),R()&&De()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let t=Ne(this.triggerData,this.eventData.video,!1);await navigator.share(t),Oe(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let t=await import("./share-dialog.component-PAIA4I7H.js");this.dialogState.emit(!0),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(e,i){e&1&&(l(0,"button",0),g("click",function(r){return i.share(r)}),_(1,"cooee-icon",1),d())},dependencies:[F],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 z=class n{video=M.required();progress=f(0);constructor(){k(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100)};e.addEventListener("timeupdate",i),t(()=>{e.removeEventListener("timeupdate",i)})})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(e,i){e&1&&(te(0,"div",0)(1,"div",1),oe(2,"div"),ie()()),e&2&&(s(),S("width",i.progress(),"%"),E("aria-valuenow",i.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var Ae=["swiperContainer"],ze=(n,t)=>t.id;function Le(n,t){if(n&1){let e=v();l(0,"div",3)(1,"cooee-item-card",4),g("buttonClick",function(o){c(e);let r=a();return p(r.onButtonClick(o))})("click",function(){let o=c(e).$implicit,r=a();return p(r.cardClick.emit(o))}),d()()}if(n&2){let e=t.$implicit;s(),u("item",e)}}var L=class n{items=M.required();cardClick=P();destroyRef=m(Y);elementRef=m(T);engagementService=m(U);swiperContainerRef=ge.required("swiperContainer");swiperInstance;constructor(){k(()=>{this.initSwiper()}),this.destroyRef.onDestroy(()=>{this.swiperInstance?.destroy()})}ngOnInit(){O(this.elementRef.nativeElement.shadowRoot)}onButtonClick(t){let e=_e.get().website?.canChangeVariantInCart;if(this.items()?.length>1||t.hasVariants()&&!e){this.cardClick.emit(t);return}this.engagementService.executeCTA(Ce.ADD_TO_CART,{item:t})}initSwiper(){this.swiperInstance=new window.CooeeSDK.Swiper(this.swiperContainerRef().nativeElement,{direction:"horizontal",effect:"slide",slidesPerView:1.2,nested:!0,centeredSlides:!0,spaceBetween:12,mousewheel:{enabled:!0,thresholdDelta:10,thresholdTime:200}})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-promoted-items"]],viewQuery:function(e,i){e&1&&ae(i.swiperContainerRef,Ae,5),e&2&&de()},hostAttrs:[1,"letscooee-widget"],inputs:{items:[1,"items"]},outputs:{cardClick:"cardClick"},features:[me([U])],decls:5,vars:0,consts:[["swiperContainer",""],[1,"swiper-container"],[1,"swiper-wrapper"],[1,"swiper-slide"],["tabindex","0",3,"buttonClick","click","item"]],template:function(e,i){e&1&&(l(0,"div",1,0)(2,"div",2),y(3,Le,2,1,"div",3,ze),d()()),e&2&&(s(3),D(i.items()))},dependencies:[Re],styles:[`:host{display:block;width:100%}cooee-item-card{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background-color:rgba(var(--lc-card-bg-color));cursor:pointer;border-radius:var(--lc-card-radius)}
2
+ `],encapsulation:3})};var Be=["swiperComp"],$e=["videoEl"],je=(n,t)=>t.url;function We(n,t){n&1&&(l(0,"div",11),_(1,"div",15),d())}function He(n,t){if(n&1&&_(0,"source",13),n&2){let e=t.$implicit;u("type",pe(e.mimeType))("src",e.url,J)}}function Ue(n,t){n&1&&B(0)}function Qe(n,t){if(n&1){let e=v();l(0,"cooee-video-promoted-items",24),g("cardClick",function(o){c(e);let r=a(2).$implicit,C=a();return p(C.productCardClicked(o,r))}),d()}if(n&2){let e=a(2).$implicit;u("items",e.items)}}function Ke(n,t){if(n&1&&_(0,"cooee-video-card",23),n&2){let e=a(2).$implicit;u("card",e.card)}}function qe(n,t){if(n&1){let e=v();_(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ce("mutedChange",function(o){c(e);let r=a(2);return le(r.muted,o)||(r.muted=o),p(o)}),g("toggled",function(){c(e);let o=a(2);return p(o.muteToggled())}),d(),I(3,Ue,1,0,"ng-container",8),d(),l(4,"div",19)(5,"cooee-share-button",20),g("dialogState",function(o){c(e);let r=a(2);return p(r.shareDialogOpen.set(o))}),d()(),l(6,"div",21),x(7,Qe,1,1,"cooee-video-promoted-items",22)(8,Ke,1,1,"cooee-video-card",23),d()}if(n&2){let e=a().$implicit,i=b(5),o=a(),r=b(9);u("video",i),s(2),se("muted",o.muted),u("videoEl",i),s(),u("ngTemplateOutlet",r),s(4),V(e.items.length&&o.footerContent===o.VideoConfigFooterContent.FIRST_ITEM?7:e.card&&o.footerContent===o.VideoConfigFooterContent.CARD?8:-1)}}function Ge(n,t){if(n&1){let e=v();l(0,"cooee-item-detail",25),g("closeClick",function(){c(e);let o=a(2);return p(o.productModalClosed())}),d()}if(n&2){let e=a(2);u("item",e.selectedItem)("similarItems",e.selectedVideo.items)}}function Ye(n,t){if(n&1){let e=v();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,We,2,0,"div",11),l(4,"video",12,2),g("click",function(){let o=c(e).$index,r=a();return p(r.currentIndex===o&&r.toggleMute())})("ended",function(){c(e);let o=b(5),r=a();return p(r.onVideoEnded(o))})("loadstart",function(){let o=c(e).$index,r=a();return p(r.onVideoLoadStart(o))})("canplay",function(){let o=c(e).$index,r=a();return p(r.onVideoCanPlay(o))}),y(6,He,1,3,"source",13,je),d(),x(8,qe,9,5),d(),x(9,Ge,1,2,"cooee-item-detail",14),d()()}if(n&2){let e=t.$implicit,i=t.$index,o=a();s(2),S("background-image",e.thumbnail?"url("+e.thumbnail+")":null),s(),V(o.shouldShowVideoSpinner(i)?3:-1),s(),u("ngClass",o.viewTemplateClassName),E("preload",o.isVideoVisible(i)?"metadata":"none")("data-video-id",e.id)("autoplay",null)("muted",!0),s(2),D(e.sources),s(2),V(o.currentIndex===i?8:-1),s(),V(o.selectedItem&&o.currentIndex===i?9:-1)}}function Je(n,t){n&1&&B(0)}function Xe(n,t){if(n&1){let e=v();l(0,"button",26),g("click",function(){c(e);let o=a();return p(o.close())}),_(1,"cooee-icon",27),d()}}var Fe=class n{swiperComponent;videoElements;VideoConfigFooterContent=Se;currentIndex=0;muted=f(!1);selectedItem=null;selectedVideo;detailPopupTemplate;footerContent;viewTemplateClassName="lc-video-only-view";shareDialogOpen=f(!1);data=m(Ve);elementRef=m(T);eventData=m(N);dialogRef=m(xe);swiperInitialized=f(!1);swiperOptions=f(null);videos=[];triggerContext;engagementTrigger;isMobile=R();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.navigationConfig=new Ee({enabled:!0,size:50,color:new Ie({h:"#000000"})}),this.cssLoadedPromise=O(this.elementRef.nativeElement.shadowRoot)}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close()}async ngOnInit(){this.muted.set(await Q.get("muted",!1));let t=this.engagementTrigger?.content?.videoConfig;switch(this.detailPopupTemplate=t?.detailPopup.template??"VIDEO_ONLY_VIEW",this.footerContent=t?.footerContent??"FIRST_ITEM",this.detailPopupTemplate){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 t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause())}toggleMute(){this.muted.update(t=>!t)}async muteToggled(){await Q.set("muted",this.muted());let e=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e)}playActiveVideo(t=!0){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e)}playVideo(t){t.currentTime=0,t.play().catch(e=>we.error(e))}onVideoEnded(t){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else{let e=this.getPreviousVideoDataForEvent(),i=["CE Last Video Ended",{previous:e},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t)}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.detailPopupTemplate==="PRODUCT_DETAIL_VIEW"?this.selectItemForDetailView():this.selectedItem=null;let i=this.currentVideoProps(),o={previous:e,current:i},r=new H("CE Video Changed",o,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(t,e){let i={videoID:e.id,videoIndex:this.currentIndex},o=new H("CE More Item Info Clicked",{current:i},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t}onVideoLoadStart(t){this.videoLoadingStates.set(t,!0)}onVideoCanPlay(t){this.videoLoadingStates.set(t,!1)}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===!0&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:"auto",e=0;this.isProductDetailView()&&(t="auto",e=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:i=>{this.swiperInitialized.set(!0),setTimeout(()=>{i.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.detailPopupTemplate==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height)}calculateOptimalVideoDimensions(){let t=this.videos.map(h=>h.sources?.[0]).filter(h=>h?.width&&h?.height).map(h=>({width:h.width,height:h.height,aspectRatio:h.width/h.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,C=o/e.height,G=Math.min(r,C);return{width:Math.floor(e.width*G),height:Math.floor(e.height*G)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty("--video-container-width",`${t}px`),i.style.setProperty("--video-container-height",`${e}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(e,i){if(e&1&&($(Be,7),$($e,5)),e&2){let o;j(o=W())&&(i.swiperComponent=o.first),j(o=W())&&(i.videoElements=o)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(e,i){e&1&&g("keydown.escape",function(r){return i.onKeyDown(r)},X)},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"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems"],[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"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(e,i){if(e&1){let o=v();l(0,"div",3)(1,"cooee-swiper",4,0),g("slideChange",function(C){return c(o),p(i.onSlideChange(C))}),ne(3,5),y(4,Ye,10,10,"div",6,ee),re(),d(),l(6,"div",7),I(7,Je,1,0,"ng-container",8),d()(),I(8,Xe,2,0,"ng-template",null,1,ue)}if(e&2){let o=b(9);u("ngClass",i.viewTemplateClassName),s(),u("options",i.swiperOptions())("navigationConfig",i.navigationConfig),s(3),D(i.videos),s(3),u("ngTemplateOutlet",o)}},dependencies:[L,Te,Me,A,z,ve,he,Pe,ke,F],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%}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media (max-width: 768px){.video-swiper>.swiper-button-prev,.video-swiper>.swiper-button-next{display:none!important}}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden}.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}
3
+ `],encapsulation:3})};export{Fe as VideoDetailDialogComponent};
@@ -1,4 +1,4 @@
1
- import{A as Fi,B as Ai,a as ui,b as mi,d as it,e as pt,g as se,h as gi,i as ye,j as hi,k as vi,l as yi,m as Ci,n as qe,o as bi,p as wi,q as Vi,t as Ei,w as Ii,x as Ft,y as Pi,z as Di}from"./chunk-VD4K7YVX.js";import{c as K,d as pi,g as fi,i as xi,j as _i,k as ut,l as Ti,m as Mi,n as Si,q as ki}from"./chunk-C4QGUG65.js";import{a as mt}from"./chunk-VS6KZOKA.js";import{a as Ze}from"./chunk-74XS3G6Q.js";import{$ as j,$a as ae,A as qt,Aa as J,B as kt,Ba as Y,Ca as Dt,D as Zt,Da as M,E as xe,F as Qt,Ga as je,Ha as He,Ia as $e,K as ce,L as _e,La as he,Ma as et,N as Wt,O as I,P as Gt,Pa as oi,Q as Jt,Qa as ue,Ra as ri,S as Pt,Sa as Ue,Wa as tt,X as B,Xa as Ae,Ya as we,Za as ze,_ as Yt,aa as Kt,ab as ai,b as ct,bb as si,cb as ve,da as Xt,db as Ve,e as St,eb as li,fa as ei,ga as Xe,gb as ci,ha as H,ia as $,ja as ti,k as jt,ka as oe,la as re,ma as U,na as P,oa as F,p as Ht,pa as Me,q as $t,qa as X,ra as de,s as Ut,sa as ee,sb as dt,ta as ii,ua as ni,v as le,x as O,xb as di,y as L,z as zt,za as pe}from"./chunk-KHVPWQ5E.js";import{a as ge,b as Mt,e as Ui,f as zi}from"./chunk-V7UGKYBN.js";var Ni=Ui((ft,Li)=>{"use strict";(function(o,e){typeof ft=="object"&&typeof Li<"u"?e(ft):typeof define=="function"&&define.amd?define(["exports"],e):e((o=typeof globalThis<"u"?globalThis:o||self).Sqrl={})})(ft,function(o){"use strict";function e(s){var l,d,u=new Error(s);return l=u,d=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(l,d):l.__proto__=d,u}function t(s,l,d){var u=l.slice(0,d).split(/\n/),n=u.length,i=u[n-1].length+1;throw e(s+=" at line "+n+" col "+i+`:
1
+ import{A as Fi,B as Ai,a as ui,b as mi,d as it,e as pt,g as se,h as gi,i as ye,j as hi,k as vi,l as yi,m as Ci,n as qe,o as bi,p as wi,q as Vi,t as Ei,w as Ii,x as Ft,y as Pi,z as Di}from"./chunk-MG3M2WWH.js";import{c as K,d as pi,g as fi,i as xi,j as _i,k as ut,l as Ti,m as Mi,n as Si,q as ki}from"./chunk-XJRPLKLE.js";import{a as mt}from"./chunk-VS6KZOKA.js";import{a as Ze}from"./chunk-74XS3G6Q.js";import{$ as j,$a as ae,A as qt,Aa as J,B as kt,Ba as Y,Ca as Dt,D as Zt,Da as M,E as xe,F as Qt,Ga as je,Ha as He,Ia as $e,K as ce,L as _e,La as he,Ma as et,N as Wt,O as I,P as Gt,Pa as oi,Q as Jt,Qa as ue,Ra as ri,S as Pt,Sa as Ue,Wa as tt,X as B,Xa as Ae,Ya as we,Za as ze,_ as Yt,aa as Kt,ab as ai,b as ct,bb as si,cb as ve,da as Xt,db as Ve,e as St,eb as li,fa as ei,ga as Xe,gb as ci,ha as H,ia as $,ja as ti,k as jt,ka as oe,la as re,ma as U,na as P,oa as F,p as Ht,pa as Me,q as $t,qa as X,ra as de,s as Ut,sa as ee,sb as dt,ta as ii,ua as ni,v as le,x as O,xb as di,y as L,z as zt,za as pe}from"./chunk-KHVPWQ5E.js";import{a as ge,b as Mt,e as Ui,f as zi}from"./chunk-V7UGKYBN.js";var Ni=Ui((ft,Li)=>{"use strict";(function(o,e){typeof ft=="object"&&typeof Li<"u"?e(ft):typeof define=="function"&&define.amd?define(["exports"],e):e((o=typeof globalThis<"u"?globalThis:o||self).Sqrl={})})(ft,function(o){"use strict";function e(s){var l,d,u=new Error(s);return l=u,d=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(l,d):l.__proto__=d,u}function t(s,l,d){var u=l.slice(0,d).split(/\n/),n=u.length,i=u[n-1].length+1;throw e(s+=" at line "+n+" col "+i+`:
2
2
 
3
3
  `+l.split(/\n/)[n-1]+`
4
4
  `+Array(i).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var r=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 m(s,l,d){for(var u in l)c(l,u)&&(l[u]==null||typeof l[u]!="object"||u!=="storage"&&u!=="prefixes"||d?s[u]=l[u]:s[u]=m({},l[u]));return s}var g=/^async +/,_=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,D=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,Q=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,Ee=/[.*+\-?^${}()|[\]\\]/g;function Ie(s){return Ee.test(s)?s.replace(Ee,"\\$&"):s}function nt(s,l){l.rmWhitespace&&(s=s.replace(/[\r\n]+/g,`
@@ -13,7 +13,7 @@ import{A as Fi,B as Ai,a as ui,b as mi,d as it,e as pt,g as se,h as gi,i as ye,j
13
13
  `],encapsulation:3})};var Ct=class o extends ye{item;data=le(_i);dialogRef=le(xi);ItemDetailLayout=wi;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||o)};static \u0275cmp=B({type:o,selectors:[["cooee-item-quick-view"]],features:[ae(se()),j],decls:1,vars:2,consts:[[3,"closeClick","item","layout"]],template:function(t,r){t&1&&(P(0,"cooee-item-detail",0),Y("closeClick",function(){return r.close()}),F()),t&2&&U("item",r.item)("layout",r.ItemDetailLayout.TWO_PANE)},dependencies:[Ei],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 bt=class o{dialog=le(ut);dialogRef;constructor(){}showItemQuickView(e,t){this.dialogRef=this.dialog.open(Ct,{width:"100vw",height:"100dvh",backdropClass:["letscooee-backdrop"],data:{item:t,triggerContext:e}})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=Ut({token:o,factory:o.\u0275fac,providedIn:"root"})};var dn=(o,e)=>({enter:o,exit:e});function pn(o,e){if(o&1&&(P(0,"div",7),ue(1),F(),P(2,"div",8),ue(3),F()),o&2){let t=M(2);I(),Ue(" ",t.getCurrency(t.selectedVariant().price.cmp)," "),I(2),Ue(" ",t.getDiscountPercentage(t.selectedVariant().price),"% off ")}}function un(o,e){if(o&1&&(P(0,"div",6),ue(1),F()),o&2){let t=M(2);I(),Ue(" ",t.stickyATCConfig.leftText," ")}}function mn(o,e){if(o&1&&(P(0,"div",1)(1,"div",5),ue(2),F(),H(3,pn,4,2),H(4,un,2,1,"div",6),F()),o&2){let t=M();I(2),Ue(" ",t.getCurrency(t.selectedVariant().price.d)," "),I(),$(t.selectedVariant().price.cmp?3:-1),I(),$(t.stickyATCConfig.leftText?4:-1)}}function fn(o,e){if(o&1&&(P(0,"div",9),ue(1),F()),o&2){let t=e.$implicit,r=e.$index;M(2);let a=we(5);U("ngClass",si(2,dn,r===a.currentIndex,r===a.previousIndex)),I(),Ue(" ",t," ")}}function gn(o,e){if(o&1&&(P(0,"div",4),oe(1,fn,2,5,"div",9,ti),F()),o&2){M();let t=we(5);I(),re(t.features)}}var xt=class o extends ye{currentItem;stickyATCConfig;selectedVariant=xe(void 0);featureSlider=xe({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(it.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(r=>Mt(ge({},r),{previousIndex:r.currentIndex,currentIndex:(r.currentIndex+1)%r.features.length}))},3e3);this.featureSlider.set({intervalRef:t,currentIndex:0,features:e})}replaceVariables(e){return e?Qe(e,this.currentItem.getTemplateVariables(),this.triggerContext):""}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-sticky-atc"]],hostBindings:function(t,r){t&1&&Y("letscooee:variant-change",function(c){return r.onVariantChange(c)},Wt)},features:[ae(se()),j],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,r){if(t&1){let a=pe();P(0,"div",0),H(1,mn,5,3,"div",1),P(2,"div",2)(3,"button",3),Y("click",function(){return O(a),L(r.addToCart())}),ue(4,"Add To Cart"),F(),tt(5),H(6,gn,3,0,"div",4),F()()}if(t&2){I(),$(r.selectedVariant()&&r.stickyATCConfig.showProductInfo?1:-1),I(4);let a=Ae(r.featureSlider());I(),$(a.features.length?6:-1)}},dependencies:[dt],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 vn=["videoEl"];async function ji(){return(await import("./video-detail-dialog.component-EEENVAT4.js")).VideoDetailDialogComponent}var Se=class o extends ye{videoElements;videos;videoConfig;dialogRef=null;dialog=le(ut);isMobile=Vi();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),ji()}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(r=>{r.nativeElement!==t&&(r.nativeElement.muted=!0,r.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,r,a){e?.stopPropagation(),e?.preventDefault();let c=t.items?.[0];if(this.sendTriggerClicked(t,c),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,r)}sendEvent(e,t,r,a){let c=new fi(e,t,this.engagementTrigger);c.setVideos(r),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=>{K.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(r=>{r.forEach(a=>{let c=a.target,m=c.dataset.videoId;m&&(a.isIntersecting?(this.visibleVideos.add(m),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(m),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(r=>{this.intersectionObserver?.observe(r.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=ki();if(!e||!this.videos)return;let t=Si();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==Mi)return;let r=this.videos.findIndex(a=>a.shortID===+e);if(r!==-1){let a=this.videos[r];await vi.set("muted",!0),await this.openDialog(a,r)}}async openDialog(e,t){await mi();let r={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await ji();this.dialogRef=this.dialog.open(a,{width:"100vw",height:"100vh",data:r,providers:gi(this.triggerContext,{video:e,index:t}),disableClose:!0});let c={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:c},e),this.dialogRef.closed.subscribe(m=>{if(this.dialogRef=null,!m)return;let g=m.lastVideoDuration*1e3,_={videoID:m.lastVideo.id,videoIndex:m.lastVideoIndex,playedTillMS:g,playedTillPercent:g/m.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:_},m.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-abstract-video"]],viewQuery:function(t,r){if(t&1&&je(vn,5),t&2){let a;He(a=$e())&&(r.videoElements=a)}},features:[j],decls:0,vars:0,template:function(t,r){},encapsulation:2})};var yn=(o,e)=>e.id,Cn=(o,e)=>e.url;function bn(o,e){if(o&1&&(Me(0,"div",1),ve(1,"safeHtml")),o&2){let t=M();U("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function xn(o,e){o&1&&(P(0,"div",6),Me(1,"div",14),F())}function _n(o,e){if(o&1&&Me(0,"source",8),o&2){let t=e.$implicit;U("type",ze(t.mimeType))("src",t.url,_e)}}function wn(o,e){if(o&1){let t=pe();P(0,"cooee-mute-toggle",15),Y("toggled",function(a){O(t),M();let c=he(6),m=M();return L(m.onMuteToggled(a,c))}),F()}if(o&2){M();let t=he(6);U("muted",t.muted)("videoEl",t)}}function Vn(o,e){if(o&1){let t=pe();P(0,"cooee-item-card",16),Y("buttonClick",function(){O(t);let a=M(),c=a.$implicit,m=a.$index,g=he(6),_=M();return L(_.addToCartClicked(null,c,m,g))})("click",function(a){O(t);let c=M(),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))}),F()}if(o&2){M();let t=we(0);U("item",t)}}function Tn(o,e){if(o&1){let t=pe();P(0,"cooee-video-card",17),Y("linkClicked",function(){O(t);let a=M().$implicit,c=M();return L(c.sendTriggerClicked(a))}),F()}if(o&2){M();let t=we(1);U("card",t)}}function En(o,e){if(o&1){let t=pe();tt(0)(1),P(2,"div",4)(3,"div",5),Y("click",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))})("keydown.enter",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))})("keydown.space",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))}),H(4,xn,2,0,"div",6),P(5,"video",7,0),Y("mouseenter",function(){O(t);let a=he(6);M();let c=we(1);return L(c&&a.play())})("mouseleave",function(){O(t);let a=he(6);M();let c=we(1);return L(c&&a.pause())})("loadstart",function(){let a=O(t).$implicit,c=M();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=M();return L(c.onVideoCanPlay(a.id))}),oe(7,_n,1,3,"source",8,Cn),F(),P(9,"div",9),H(10,wn,1,2,"cooee-mute-toggle",10),F()(),P(11,"div",11),H(12,Vn,1,1,"cooee-item-card",12)(13,Tn,1,1,"cooee-video-card",13),F()()}if(o&2){let t=e.$implicit,r=M(),a=we(0),c=Ae(t.items[0]);I();let m=Ae(t.card),g=c&&r.videoConfig.footerContent==r.VideoConfigFooterContent.FIRST_ITEM,_=m&&r.videoConfig.footerContent==r.VideoConfigFooterContent.CARD;I(2),et("background-image",t.thumbnail?"url("+t.thumbnail+")":null),I(),$(r.isVideoLoading(t.id)?4:-1),I(),U("muted",!0),Xe("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),I(2),re(t.sources),I(3),$(r.videoConfig.showMuteButton?10:-1),I(2),$(g?12:_?13:-1)}}var _t=class o extends Se{VideoConfigFooterContent=Ft;VideoConfigAutoPlay=Ii;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,r=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:r,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,r,a){let c=t.items?.[0],m=ui.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!m){this.onVideoTap(e,t,r,a);return}this.engagementService.executeCTA(it.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let r=t.items?.[0];this.engagementService.executeCTA(it.GO_TO_PRODUCT,{item:r,video:t})}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||o)};static \u0275cmp=B({type:o,selectors:[["cooee-video-playlist"]],features:[ae(se()),j],decls:7,vars:6,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","muted"],[3,"src","type"],[1,"video-controls"],[3,"muted","videoEl"],["role","region","aria-label","Video details",1,"video-footer"],["role","button","tabindex","0","aria-label","Product detail",3,"item"],[3,"card"],[1,"loading-spinner"],[3,"toggled","muted","videoEl"],["role","button","tabindex","0","aria-label","Product detail",3,"buttonClick","click","item"],[3,"linkClicked","card"]],template:function(t,r){if(t&1&&(tt(0)(1),H(2,bn,2,3,"div",1),P(3,"cooee-swiper",2),ii(4,3),oe(5,En,14,11,"div",4,yn),ni(),F()),t&2){Ae(!r.videoConfig.autoPlay||r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON),I(),Ae(r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON_HOVER),I(),$(r.videoConfig.heading?2:-1);let a=r.videoConfig.playlistConfig==null?null:r.videoConfig.playlistConfig.videoSwiper;I(),U("options",r.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),I(2),re(r.videos)}},dependencies:[Fi,Di,Pi,Ai,Ze],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}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-info{font-size:14px;line-height:normal}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 vn=["videoEl"];async function ji(){return(await import("./video-detail-dialog.component-SWN62LQC.js")).VideoDetailDialogComponent}var Se=class o extends ye{videoElements;videos;videoConfig;dialogRef=null;dialog=le(ut);isMobile=Vi();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),ji()}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(r=>{r.nativeElement!==t&&(r.nativeElement.muted=!0,r.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,r,a){e?.stopPropagation(),e?.preventDefault();let c=t.items?.[0];if(this.sendTriggerClicked(t,c),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,r)}sendEvent(e,t,r,a){let c=new fi(e,t,this.engagementTrigger);c.setVideos(r),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=>{K.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(r=>{r.forEach(a=>{let c=a.target,m=c.dataset.videoId;m&&(a.isIntersecting?(this.visibleVideos.add(m),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(m),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(r=>{this.intersectionObserver?.observe(r.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=ki();if(!e||!this.videos)return;let t=Si();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==Mi)return;let r=this.videos.findIndex(a=>a.shortID===+e);if(r!==-1){let a=this.videos[r];await vi.set("muted",!0),await this.openDialog(a,r)}}async openDialog(e,t){await mi();let r={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await ji();this.dialogRef=this.dialog.open(a,{width:"100vw",height:"100vh",data:r,providers:gi(this.triggerContext,{video:e,index:t}),disableClose:!0});let c={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:c},e),this.dialogRef.closed.subscribe(m=>{if(this.dialogRef=null,!m)return;let g=m.lastVideoDuration*1e3,_={videoID:m.lastVideo.id,videoIndex:m.lastVideoIndex,playedTillMS:g,playedTillPercent:g/m.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:_},m.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-abstract-video"]],viewQuery:function(t,r){if(t&1&&je(vn,5),t&2){let a;He(a=$e())&&(r.videoElements=a)}},features:[j],decls:0,vars:0,template:function(t,r){},encapsulation:2})};var yn=(o,e)=>e.id,Cn=(o,e)=>e.url;function bn(o,e){if(o&1&&(Me(0,"div",1),ve(1,"safeHtml")),o&2){let t=M();U("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function xn(o,e){o&1&&(P(0,"div",6),Me(1,"div",14),F())}function _n(o,e){if(o&1&&Me(0,"source",8),o&2){let t=e.$implicit;U("type",ze(t.mimeType))("src",t.url,_e)}}function wn(o,e){if(o&1){let t=pe();P(0,"cooee-mute-toggle",15),Y("toggled",function(a){O(t),M();let c=he(6),m=M();return L(m.onMuteToggled(a,c))}),F()}if(o&2){M();let t=he(6);U("muted",t.muted)("videoEl",t)}}function Vn(o,e){if(o&1){let t=pe();P(0,"cooee-item-card",16),Y("buttonClick",function(){O(t);let a=M(),c=a.$implicit,m=a.$index,g=he(6),_=M();return L(_.addToCartClicked(null,c,m,g))})("click",function(a){O(t);let c=M(),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))}),F()}if(o&2){M();let t=we(0);U("item",t)}}function Tn(o,e){if(o&1){let t=pe();P(0,"cooee-video-card",17),Y("linkClicked",function(){O(t);let a=M().$implicit,c=M();return L(c.sendTriggerClicked(a))}),F()}if(o&2){M();let t=we(1);U("card",t)}}function En(o,e){if(o&1){let t=pe();tt(0)(1),P(2,"div",4)(3,"div",5),Y("click",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))})("keydown.enter",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))})("keydown.space",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=he(6),D=M();return L(D.onVideoTap(a,m,g,_))}),H(4,xn,2,0,"div",6),P(5,"video",7,0),Y("mouseenter",function(){O(t);let a=he(6);M();let c=we(1);return L(c&&a.play())})("mouseleave",function(){O(t);let a=he(6);M();let c=we(1);return L(c&&a.pause())})("loadstart",function(){let a=O(t).$implicit,c=M();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=M();return L(c.onVideoCanPlay(a.id))}),oe(7,_n,1,3,"source",8,Cn),F(),P(9,"div",9),H(10,wn,1,2,"cooee-mute-toggle",10),F()(),P(11,"div",11),H(12,Vn,1,1,"cooee-item-card",12)(13,Tn,1,1,"cooee-video-card",13),F()()}if(o&2){let t=e.$implicit,r=M(),a=we(0),c=Ae(t.items[0]);I();let m=Ae(t.card),g=c&&r.videoConfig.footerContent==r.VideoConfigFooterContent.FIRST_ITEM,_=m&&r.videoConfig.footerContent==r.VideoConfigFooterContent.CARD;I(2),et("background-image",t.thumbnail?"url("+t.thumbnail+")":null),I(),$(r.isVideoLoading(t.id)?4:-1),I(),U("muted",!0),Xe("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),I(2),re(t.sources),I(3),$(r.videoConfig.showMuteButton?10:-1),I(2),$(g?12:_?13:-1)}}var _t=class o extends Se{VideoConfigFooterContent=Ft;VideoConfigAutoPlay=Ii;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,r=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:r,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,r,a){let c=t.items?.[0],m=ui.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!m){this.onVideoTap(e,t,r,a);return}this.engagementService.executeCTA(it.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let r=t.items?.[0];this.engagementService.executeCTA(it.GO_TO_PRODUCT,{item:r,video:t})}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||o)};static \u0275cmp=B({type:o,selectors:[["cooee-video-playlist"]],features:[ae(se()),j],decls:7,vars:6,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","muted"],[3,"src","type"],[1,"video-controls"],[3,"muted","videoEl"],["role","region","aria-label","Video details",1,"video-footer"],["role","button","tabindex","0","aria-label","Product detail",3,"item"],[3,"card"],[1,"loading-spinner"],[3,"toggled","muted","videoEl"],["role","button","tabindex","0","aria-label","Product detail",3,"buttonClick","click","item"],[3,"linkClicked","card"]],template:function(t,r){if(t&1&&(tt(0)(1),H(2,bn,2,3,"div",1),P(3,"cooee-swiper",2),ii(4,3),oe(5,En,14,11,"div",4,yn),ni(),F()),t&2){Ae(!r.videoConfig.autoPlay||r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON),I(),Ae(r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON_HOVER),I(),$(r.videoConfig.heading?2:-1);let a=r.videoConfig.playlistConfig==null?null:r.videoConfig.playlistConfig.videoSwiper;I(),U("options",r.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),I(2),re(r.videos)}},dependencies:[Fi,Di,Pi,Ai,Ze],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}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-info{font-size:14px;line-height:normal}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})};function Hi(o){o||(o=le(Zt));let e=new ct(t=>{if(o.destroyed){t.next();return}return o.onDestroy(t.next.bind(t))});return t=>t.pipe($t(e))}var In=["videoElement"],Mn=o=>({"cursor-grab":o}),Sn=(o,e)=>e.url;function kn(o,e){if(o&1&&Me(0,"source",8),o&2){let t=e.$implicit;U("type",ze(t.mimeType))("src",t.url,_e)}}var wt=class o extends Se{videoElement;video;isDragging=!1;hidden=!1;cdkDrag=le(mt,{self:!0});untilDestroyed=Hi();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||o)};static \u0275cmp=B({type:o,selectors:[["cooee-video-popup"]],viewQuery:function(t,r){if(t&1&&je(In,5),t&2){let a;He(a=$e())&&(r.videoElement=a.first)}},hostAttrs:["role","button","tabindex","0","aria-label","Open video popup "],hostVars:3,hostBindings:function(t,r){t&1&&Y("keydown.enter",function(c){return r.onClick(c)})("keydown.space",function(c){return r.onClick(c)})("click",function(c){return r.onClick(c)}),t&2&&(J("cdkDragBoundary","body"),oi(r.popupClasses))},features:[ae(se()),Kt([{directive:mt,inputs:["cdkDragBoundary","cdkDragBoundary"]}]),j],decls:11,vars:4,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"],[3,"src","type"]],template:function(t,r){if(t&1){let a=pe();P(0,"div",1)(1,"button",2),Y("click",function(m){return O(a),m.stopPropagation(),L(r.close())}),Me(2,"cooee-icon",3),F(),P(3,"div",4),Me(4,"cooee-icon",5),P(5,"div",6),ue(6,"Tap to unmute"),F()(),P(7,"video",7,0),oe(9,kn,1,3,"source",8,Sn),F()()}t&2&&(U("ngClass",ai(2,Mn,r.isDragging)),I(7),U("muted",!0),I(2),re(r.video.sources))},dependencies:[dt,Ti],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
- `],encapsulation:3})};var Pn=(o,e)=>e.id,Dn=(o,e)=>e.url;function Fn(o,e){if(o&1&&(ee(0,"div",1),ve(1,"safeHtml")),o&2){let t=M();J("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function An(o,e){o&1&&(X(0,"div",9),ee(1,"div",12),de())}function Rn(o,e){if(o&1&&ee(0,"source",11),o&2){let t=e.$implicit;J("type",ze(t.mimeType))("src",t.url,_e)}}function On(o,e){if(o&1){let t=pe();X(0,"div",4),Dt("click",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=M();return L(_.onVideoTap(a,m,g))})("keydown.enter",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=M();return L(_.onVideoTap(a,m,g))})("keydown.space",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=M();return L(_.onVideoTap(a,m,g))}),zt(),X(1,"svg",5),ee(2,"circle",6)(3,"circle",7),de(),qt(),X(4,"div",8),H(5,An,2,0,"div",9),X(6,"video",10,0),Dt("loadstart",function(){let a=O(t).$implicit,c=M();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=M();return L(c.onVideoCanPlay(a.id))}),oe(8,Rn,1,3,"source",11,Dn),de()()()}if(o&2){let t=e.$implicit,r=e.$index,a=M();Xe("aria-label","Open video story "+(r+1)),I(5),$(a.isVideoLoading(t.id)?5:-1),I(),J("poster",t.thumbnail,_e)("muted",!0),Xe("data-video-id",t.id),I(2),re(a.getOptimalSources(t.sources))}}var Vt=class o extends Se{constructor(){super()}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver()}ngOnDestroy(){super.ngOnDestroy()}update(){}getOptimalSources(e){return[...e].reverse().sort((r,a)=>r.mimeType.includes("mp4")&&a.mimeType.includes("m3u8")?-1:r.mimeType.includes("m3u8")&&a.mimeType.includes("mp4")?1:0)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-video-stories"]],features:[ae(se()),j],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","muted"],[3,"src","type"],[1,"loading-spinner"]],template:function(t,r){t&1&&(H(0,Fn,2,3,"div",1),X(1,"div",2),oe(2,On,10,5,"div",3,Pn),de()),t&2&&($(r.videoConfig.heading?0:-1),I(2),re(r.videos))},dependencies:[Ze],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}
18
+ `],encapsulation:3})};var Pn=(o,e)=>e.id,Dn=(o,e)=>e.url;function Fn(o,e){if(o&1&&(ee(0,"div",1),ve(1,"safeHtml")),o&2){let t=M();J("innerHTML",Ve(1,1,t.videoConfig.heading),ce)}}function An(o,e){o&1&&(X(0,"div",9),ee(1,"div",12),de())}function Rn(o,e){if(o&1&&ee(0,"source",11),o&2){let t=e.$implicit;J("type",ze(t.mimeType))("src",t.url,_e)}}function On(o,e){if(o&1){let t=pe();X(0,"div",4),Dt("click",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=M();return L(_.onVideoTap(a,m,g))})("keydown.enter",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=M();return L(_.onVideoTap(a,m,g))})("keydown.space",function(a){let c=O(t),m=c.$implicit,g=c.$index,_=M();return L(_.onVideoTap(a,m,g))}),zt(),X(1,"svg",5),ee(2,"circle",6)(3,"circle",7),de(),qt(),X(4,"div",8),H(5,An,2,0,"div",9),X(6,"video",10,0),Dt("loadstart",function(){let a=O(t).$implicit,c=M();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=M();return L(c.onVideoCanPlay(a.id))}),oe(8,Rn,1,3,"source",11,Dn),de()()()}if(o&2){let t=e.$implicit,r=e.$index,a=M();Xe("aria-label","Open video story "+(r+1)),I(5),$(a.isVideoLoading(t.id)?5:-1),I(),J("poster",t.thumbnail,_e),Xe("data-video-id",t.id)("muted",!0),I(2),re(a.getOptimalSources(t.sources))}}var Vt=class o extends Se{constructor(){super()}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver()}ngOnDestroy(){super.ngOnDestroy()}update(){}getOptimalSources(e){return[...e].reverse().sort((r,a)=>r.mimeType.includes("mp4")&&a.mimeType.includes("m3u8")?-1:r.mimeType.includes("m3u8")&&a.mimeType.includes("mp4")?1:0)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-video-stories"]],features:[ae(se()),j],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"],[3,"src","type"],[1,"loading-spinner"]],template:function(t,r){t&1&&(H(0,Fn,2,3,"div",1),X(1,"div",2),oe(2,On,10,5,"div",3,Pn),de()),t&2&&($(r.videoConfig.heading?0:-1),I(2),re(r.videos))},dependencies:[Ze],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})};pi("CooeeWidgetSDK");(async()=>{let o=await di(Oi),e=(t,r)=>{let a=Ri(t,{injector:o.injector});customElements.define(r,a)};e(xt,"cooee-sticky-atc"),e(yt,"cooee-savings-bar"),e(vt,"cooee-progressbar"),e(_t,"cooee-video-playlist"),e(wt,"cooee-video-popup"),e(Vt,"cooee-video-stories"),e(hi,"cooee-product-options-picker"),sessionStorage.cooeeDebug&&import("./debugger.component-E5DA6AOW.js").then(t=>{e(t.DebuggerComponent,"cooee-debugger")}),window.cooeeShowQuickItem=(t,r)=>{o.injector.get(bt).showItemQuickView(t,r)}})();
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": "11.5.2",
4
+ "version": "11.5.3",
5
5
  "scripts": {
6
6
  "lint": "ng lint",
7
7
  "integrity": "./scripts/validate-integrity.sh",
@@ -1,3 +0,0 @@
1
- import{A as Me,B as Re,a as _e,c as O,d as Ce,f as U,k as Q,q as R,r as De,s as be,t as Te,u as Ie,v as Ee,x as Se,y as ke,z as Pe}from"./chunk-VD4K7YVX.js";import{a as Oe,b as Ne}from"./chunk-PM33IRPM.js";import{c as we,e as fe,f as N,g as H,i as xe,j as Ve,k as ye,l as F}from"./chunk-C4QGUG65.js";import"./chunk-74XS3G6Q.js";import{$a as me,Ba as g,D as Y,Da as a,E as f,Ga as $,Ha as j,I as T,Ia as W,Ja as ae,Ka as de,L as J,La as b,M as X,Ma as S,O as s,Ta as se,Ua as le,V as Z,Va as ce,X as w,Za as pe,ba as I,fb as ue,ga as E,ha as x,ia as V,ib as k,ja as ee,jb as P,ka as y,kb as M,la as D,lb as ge,ma as u,na as l,oa as d,pa as _,qa as te,ra as ie,sa as oe,sb as he,ta as ne,ua as re,ub as ve,v as m,va as B,x as c,y as p,za as v}from"./chunk-KHVPWQ5E.js";import"./chunk-V7UGKYBN.js";var A=class n{dialogState=P();dialog=m(ye);triggerData=m(fe)().triggerData;eventData=m(N);containerRef=m(Z);async share(t){t.stopPropagation(),t.preventDefault(),R()&&De()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let t=Ne(this.triggerData,this.eventData.video,!1);await navigator.share(t),Oe(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let t=await import("./share-dialog.component-JZODNP6L.js");this.dialogState.emit(!0),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(e,i){e&1&&(l(0,"button",0),g("click",function(r){return i.share(r)}),_(1,"cooee-icon",1),d())},dependencies:[F],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 z=class n{video=M.required();progress=f(0);constructor(){k(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100)};e.addEventListener("timeupdate",i),t(()=>{e.removeEventListener("timeupdate",i)})})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(e,i){e&1&&(te(0,"div",0)(1,"div",1),oe(2,"div"),ie()()),e&2&&(s(),S("width",i.progress(),"%"),E("aria-valuenow",i.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var Ae=["swiperContainer"],ze=(n,t)=>t.id;function Le(n,t){if(n&1){let e=v();l(0,"div",3)(1,"cooee-item-card",4),g("buttonClick",function(o){c(e);let r=a();return p(r.onButtonClick(o))})("click",function(){let o=c(e).$implicit,r=a();return p(r.cardClick.emit(o))}),d()()}if(n&2){let e=t.$implicit;s(),u("item",e)}}var L=class n{items=M.required();cardClick=P();destroyRef=m(Y);elementRef=m(T);engagementService=m(U);swiperContainerRef=ge.required("swiperContainer");swiperInstance;constructor(){k(()=>{this.initSwiper()}),this.destroyRef.onDestroy(()=>{this.swiperInstance?.destroy()})}ngOnInit(){O(this.elementRef.nativeElement.shadowRoot)}onButtonClick(t){let e=_e.get().website?.canChangeVariantInCart;if(this.items()?.length>1||t.hasVariants()&&!e){this.cardClick.emit(t);return}this.engagementService.executeCTA(Ce.ADD_TO_CART,{item:t})}initSwiper(){this.swiperInstance=new window.CooeeSDK.Swiper(this.swiperContainerRef().nativeElement,{direction:"horizontal",effect:"slide",slidesPerView:1.2,nested:!0,centeredSlides:!0,spaceBetween:12,mousewheel:{enabled:!0,thresholdDelta:10,thresholdTime:200}})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-promoted-items"]],viewQuery:function(e,i){e&1&&ae(i.swiperContainerRef,Ae,5),e&2&&de()},hostAttrs:[1,"letscooee-widget"],inputs:{items:[1,"items"]},outputs:{cardClick:"cardClick"},features:[me([U])],decls:5,vars:0,consts:[["swiperContainer",""],[1,"swiper-container"],[1,"swiper-wrapper"],[1,"swiper-slide"],["tabindex","0",3,"buttonClick","click","item"]],template:function(e,i){e&1&&(l(0,"div",1,0)(2,"div",2),y(3,Le,2,1,"div",3,ze),d()()),e&2&&(s(3),D(i.items()))},dependencies:[Re],styles:[`:host{display:block;width:100%}cooee-item-card{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background-color:rgba(var(--lc-card-bg-color));cursor:pointer;border-radius:var(--lc-card-radius)}
2
- `],encapsulation:3})};var Be=["swiperComp"],$e=["videoEl"],je=(n,t)=>t.url;function We(n,t){n&1&&(l(0,"div",11),_(1,"div",15),d())}function He(n,t){if(n&1&&_(0,"source",13),n&2){let e=t.$implicit;u("type",pe(e.mimeType))("src",e.url,J)}}function Ue(n,t){n&1&&B(0)}function Qe(n,t){if(n&1){let e=v();l(0,"cooee-video-promoted-items",24),g("cardClick",function(o){c(e);let r=a(2).$implicit,C=a();return p(C.productCardClicked(o,r))}),d()}if(n&2){let e=a(2).$implicit;u("items",e.items)}}function Ke(n,t){if(n&1&&_(0,"cooee-video-card",23),n&2){let e=a(2).$implicit;u("card",e.card)}}function qe(n,t){if(n&1){let e=v();_(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ce("mutedChange",function(o){c(e);let r=a(2);return le(r.muted,o)||(r.muted=o),p(o)}),g("toggled",function(){c(e);let o=a(2);return p(o.muteToggled())}),d(),I(3,Ue,1,0,"ng-container",8),d(),l(4,"div",19)(5,"cooee-share-button",20),g("dialogState",function(o){c(e);let r=a(2);return p(r.shareDialogOpen.set(o))}),d()(),l(6,"div",21),x(7,Qe,1,1,"cooee-video-promoted-items",22)(8,Ke,1,1,"cooee-video-card",23),d()}if(n&2){let e=a().$implicit,i=b(5),o=a(),r=b(9);u("video",i),s(2),se("muted",o.muted),u("videoEl",i),s(),u("ngTemplateOutlet",r),s(4),V(e.items.length&&o.footerContent===o.VideoConfigFooterContent.FIRST_ITEM?7:e.card&&o.footerContent===o.VideoConfigFooterContent.CARD?8:-1)}}function Ge(n,t){if(n&1){let e=v();l(0,"cooee-item-detail",25),g("closeClick",function(){c(e);let o=a(2);return p(o.productModalClosed())}),d()}if(n&2){let e=a(2);u("item",e.selectedItem)("similarItems",e.selectedVideo.items)}}function Ye(n,t){if(n&1){let e=v();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,We,2,0,"div",11),l(4,"video",12,2),g("click",function(){let o=c(e).$index,r=a();return p(r.currentIndex===o&&r.toggleMute())})("ended",function(){c(e);let o=b(5),r=a();return p(r.onVideoEnded(o))})("loadstart",function(){let o=c(e).$index,r=a();return p(r.onVideoLoadStart(o))})("canplay",function(){let o=c(e).$index,r=a();return p(r.onVideoCanPlay(o))}),y(6,He,1,3,"source",13,je),d(),x(8,qe,9,5),d(),x(9,Ge,1,2,"cooee-item-detail",14),d()()}if(n&2){let e=t.$implicit,i=t.$index,o=a();s(2),S("background-image",e.thumbnail?"url("+e.thumbnail+")":null),s(),V(o.shouldShowVideoSpinner(i)?3:-1),s(),u("ngClass",o.viewTemplateClassName),E("preload",o.isVideoVisible(i)?"metadata":"none")("data-video-id",e.id)("autoplay",null)("muted",o.muted||null),s(2),D(e.sources),s(2),V(o.currentIndex===i?8:-1),s(),V(o.selectedItem&&o.currentIndex===i?9:-1)}}function Je(n,t){n&1&&B(0)}function Xe(n,t){if(n&1){let e=v();l(0,"button",26),g("click",function(){c(e);let o=a();return p(o.close())}),_(1,"cooee-icon",27),d()}}var Fe=class n{swiperComponent;videoElements;VideoConfigFooterContent=Se;currentIndex=0;muted=f(!1);selectedItem=null;selectedVideo;detailPopupTemplate;footerContent;viewTemplateClassName="lc-video-only-view";shareDialogOpen=f(!1);data=m(Ve);elementRef=m(T);eventData=m(N);dialogRef=m(xe);swiperInitialized=f(!1);swiperOptions=f(null);videos=[];triggerContext;engagementTrigger;isMobile=R();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.navigationConfig=new Ee({enabled:!0,size:50,color:new Ie({h:"#000000"})}),this.cssLoadedPromise=O(this.elementRef.nativeElement.shadowRoot)}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close()}async ngOnInit(){this.muted.set(await Q.get("muted",!1));let t=this.engagementTrigger?.content?.videoConfig;switch(this.detailPopupTemplate=t?.detailPopup.template??"VIDEO_ONLY_VIEW",this.footerContent=t?.footerContent??"FIRST_ITEM",this.detailPopupTemplate){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 t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause())}toggleMute(){this.muted.update(t=>!t)}async muteToggled(){await Q.set("muted",this.muted());let e=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e)}playActiveVideo(t=!0){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e)}playVideo(t){t.currentTime=0,t.play().catch(e=>we.error(e))}onVideoEnded(t){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else{let e=this.getPreviousVideoDataForEvent(),i=["CE Last Video Ended",{previous:e},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t)}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.detailPopupTemplate==="PRODUCT_DETAIL_VIEW"?this.selectItemForDetailView():this.selectedItem=null;let i=this.currentVideoProps(),o={previous:e,current:i},r=new H("CE Video Changed",o,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(t,e){let i={videoID:e.id,videoIndex:this.currentIndex},o=new H("CE More Item Info Clicked",{current:i},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t}onVideoLoadStart(t){this.videoLoadingStates.set(t,!0)}onVideoCanPlay(t){this.videoLoadingStates.set(t,!1)}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===!0&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:"auto",e=0;this.isProductDetailView()&&(t="auto",e=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:i=>{this.swiperInitialized.set(!0),setTimeout(()=>{i.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.detailPopupTemplate==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height)}calculateOptimalVideoDimensions(){let t=this.videos.map(h=>h.sources?.[0]).filter(h=>h?.width&&h?.height).map(h=>({width:h.width,height:h.height,aspectRatio:h.width/h.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,C=o/e.height,G=Math.min(r,C);return{width:Math.floor(e.width*G),height:Math.floor(e.height*G)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty("--video-container-width",`${t}px`),i.style.setProperty("--video-container-height",`${e}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(e,i){if(e&1&&($(Be,7),$($e,5)),e&2){let o;j(o=W())&&(i.swiperComponent=o.first),j(o=W())&&(i.videoElements=o)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(e,i){e&1&&g("keydown.escape",function(r){return i.onKeyDown(r)},X)},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"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems"],[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"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(e,i){if(e&1){let o=v();l(0,"div",3)(1,"cooee-swiper",4,0),g("slideChange",function(C){return c(o),p(i.onSlideChange(C))}),ne(3,5),y(4,Ye,10,10,"div",6,ee),re(),d(),l(6,"div",7),I(7,Je,1,0,"ng-container",8),d()(),I(8,Xe,2,0,"ng-template",null,1,ue)}if(e&2){let o=b(9);u("ngClass",i.viewTemplateClassName),s(),u("options",i.swiperOptions())("navigationConfig",i.navigationConfig),s(3),D(i.videos),s(3),u("ngTemplateOutlet",o)}},dependencies:[L,Te,Me,A,z,ve,he,Pe,ke,F],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%}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media (max-width: 768px){.video-swiper>.swiper-button-prev,.video-swiper>.swiper-button-next{display:none!important}}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden}.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}
3
- `],encapsulation:3})};export{Fe as VideoDetailDialogComponent};